diff --git a/public/assets/libs/Sortable/.bower.json b/public/assets/libs/Sortable/.bower.json new file mode 100644 index 0000000..b2bb5d5 --- /dev/null +++ b/public/assets/libs/Sortable/.bower.json @@ -0,0 +1,40 @@ +{ + "name": "Sortable", + "main": [ + "Sortable.js" + ], + "homepage": "http://SortableJS.github.io/Sortable/", + "authors": [ + "RubaXa ", + "owenm " + ], + "description": "JavaScript library for reorderable drag-and-drop lists on modern browsers and touch devices. No jQuery required. Supports Meteor, AngularJS, React, Polymer, Vue, Knockout and any CSS library, e.g. Bootstrap.", + "keywords": [ + "sortable", + "reorder", + "list", + "html5", + "drag", + "and", + "drop", + "dnd", + "web-components" + ], + "license": "MIT", + "ignore": [ + "node_modules", + "bower_components", + "test", + "tests" + ], + "version": "1.10.2", + "_release": "1.10.2", + "_resolution": { + "type": "version", + "tag": "1.10.2", + "commit": "2addddd67387b6e4b6b5e51806eb698f0a3eee88" + }, + "_source": "https://github.com/RubaXa/Sortable.git", + "_target": "~1.10.0", + "_originalSource": "Sortable" +} \ No newline at end of file diff --git a/public/assets/libs/Sortable/.circleci/config.yml b/public/assets/libs/Sortable/.circleci/config.yml new file mode 100644 index 0000000..ffbb4f1 --- /dev/null +++ b/public/assets/libs/Sortable/.circleci/config.yml @@ -0,0 +1,33 @@ +version: 2.0 +jobs: + build: + docker: + - image: circleci/node:10.16-browsers + steps: + - checkout + + - restore_cache: + keys: + - v1-dependencies-{{ checksum "package.json" }} + - v1-dependencies- + + - run: npm install + + - save_cache: + paths: + - node_modules + key: v1-dependencies-{{ checksum "package.json" }} + + - run: npm run build:umd + + - run: + name: Compatibility Test + command: | + if [ -z "$CIRCLE_PR_NUMBER" ]; + then + npm run test:compat + fi + - run: npm run test + + - store_test_results: + path: /tmp/test-results diff --git a/public/assets/libs/Sortable/.editorconfig b/public/assets/libs/Sortable/.editorconfig new file mode 100644 index 0000000..09d2751 --- /dev/null +++ b/public/assets/libs/Sortable/.editorconfig @@ -0,0 +1,15 @@ +# editorconfig.org +root = true + +[*] +indent_style = tab +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[*.md] +trim_trailing_whitespace = false + +[*.yml] +indent_style = space diff --git a/public/assets/libs/Sortable/.gitignore b/public/assets/libs/Sortable/.gitignore new file mode 100644 index 0000000..bb83eae --- /dev/null +++ b/public/assets/libs/Sortable/.gitignore @@ -0,0 +1,6 @@ +node_modules +mock.png +.*.sw* +.build* +jquery.fn.* +.idea/ diff --git a/public/assets/libs/Sortable/.jshintrc b/public/assets/libs/Sortable/.jshintrc new file mode 100644 index 0000000..ffbcc18 --- /dev/null +++ b/public/assets/libs/Sortable/.jshintrc @@ -0,0 +1,25 @@ +{ + "strict": false, + "newcap": false, + "node": true, + "expr": true, + "supernew": true, + "laxbreak": true, + "esversion": 9, + "white": true, + "globals": { + "define": true, + "test": true, + "expect": true, + "module": true, + "asyncTest": true, + "start": true, + "ok": true, + "equal": true, + "notEqual": true, + "deepEqual": true, + "window": true, + "document": true, + "performance": true + } +} diff --git a/public/assets/libs/Sortable/.testcaferc.json b/public/assets/libs/Sortable/.testcaferc.json new file mode 100644 index 0000000..58a061e --- /dev/null +++ b/public/assets/libs/Sortable/.testcaferc.json @@ -0,0 +1,7 @@ +{ + "speed": 0.4, + "reporter": { + "name": "xunit", + "output": "/tmp/test-results/res.xml" + } +} diff --git a/public/assets/libs/Sortable/CONTRIBUTING.md b/public/assets/libs/Sortable/CONTRIBUTING.md new file mode 100644 index 0000000..25c1490 --- /dev/null +++ b/public/assets/libs/Sortable/CONTRIBUTING.md @@ -0,0 +1,26 @@ +# Contribution Guidelines + +### Issue + + 1. Try [master](https://github.com/SortableJS/Sortable/tree/master/)-branch, perhaps the problem has been solved; + 2. [Use the search](https://github.com/SortableJS/Sortable/search?type=Issues&q=problem), maybe already have an answer; + 3. If not found, create example on [jsbin.com (draft)](https://jsbin.com/kamiwez/edit?html,js,output) and describe the problem. + +--- + +### Pull Request + + 1. Only request to merge with the [master](https://github.com/SortableJS/Sortable/tree/master/)-branch. + 2. Only modify source files, **do not commit the resulting build** + +### Setup + + 1. Fork the repo on [github](https://github.com) + 2. Clone locally + 3. Run `npm i` in the local repo + +### Building + + - For development, build the `./Sortable.js` file using the command `npm run build:umd:watch` + - To build everything and minify it, run `npm run build` + - Do not commit the resulting builds in any pull request – they will be generated at release diff --git a/public/assets/libs/Sortable/ISSUE_TEMPLATE.md b/public/assets/libs/Sortable/ISSUE_TEMPLATE.md new file mode 100644 index 0000000..a4ff620 --- /dev/null +++ b/public/assets/libs/Sortable/ISSUE_TEMPLATE.md @@ -0,0 +1,24 @@ +#### Problem: + + + +#### JSBin/JSFiddle demonstrating the problem: + + +--- +Before you create an issue, check it: + + 1. Try [master](https://github.com/SortableJS/Sortable/tree/master/)-branch, perhaps the problem has been solved; + 2. [Use the search](https://github.com/SortableJS/Sortable/search?q=problem), maybe we already have an answer; + 3. If not found, create an example on [jsbin.com (draft)](http://jsbin.com/vojixek/edit?html,js,output) and describe the problem. + +Bindings: + - Angular + - 2.0+: https://github.com/SortableJS/angular-sortablejs/issues + - legacy: https://github.com/SortableJS/angular-legacy-sortablejs/issues + - React + - ES2015+: https://github.com/SortableJS/react-sortablejs/issues + - mixin: https://github.com/SortableJS/react-mixin-sortablejs/issues + - Polymer: https://github.com/SortableJS/polymer-sortablejs/issues + - Knockout: https://github.com/SortableJS/knockout-sortablejs/issues + - Meteor: https://github.com/SortableJS/meteor-sortablejs/issues diff --git a/public/assets/libs/Sortable/LICENSE b/public/assets/libs/Sortable/LICENSE new file mode 100644 index 0000000..91bffc2 --- /dev/null +++ b/public/assets/libs/Sortable/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 All contributors to Sortable + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/public/assets/libs/Sortable/README.md b/public/assets/libs/Sortable/README.md new file mode 100644 index 0000000..cc06e82 --- /dev/null +++ b/public/assets/libs/Sortable/README.md @@ -0,0 +1,813 @@ +# Sortable   [![Financial Contributors on Open Collective](https://opencollective.com/Sortable/all/badge.svg?label=financial+contributors)](https://opencollective.com/Sortable) [![CircleCI](https://circleci.com/gh/SortableJS/Sortable.svg?style=svg)](https://circleci.com/gh/SortableJS/Sortable) [![DeepScan grade](https://deepscan.io/api/teams/3901/projects/5666/branches/43977/badge/grade.svg)](https://deepscan.io/dashboard#view=project&tid=3901&pid=5666&bid=43977) [![](https://data.jsdelivr.com/v1/package/npm/sortablejs/badge)](https://www.jsdelivr.com/package/npm/sortablejs) [![npm](https://img.shields.io/npm/v/sortablejs.svg)](https://www.npmjs.com/package/sortablejs) + +Sortable is a JavaScript library for reorderable drag-and-drop lists. + +Demo: http://sortablejs.github.io/Sortable/ + +[](https://saucelabs.com/) + +## Features + + * Supports touch devices and [modern](http://caniuse.com/#search=drag) browsers (including IE9) + * Can drag from one list to another or within the same list + * CSS animation when moving items + * Supports drag handles *and selectable text* (better than voidberg's html5sortable) + * Smart auto-scrolling + * Advanced swap detection + * Smooth animations + * [Multi-drag](https://github.com/SortableJS/Sortable/tree/master/plugins/MultiDrag) support + * Support for CSS transforms + * Built using native HTML5 drag and drop API + * Supports + * [Meteor](https://github.com/SortableJS/meteor-sortablejs) + * Angular + * [2.0+](https://github.com/SortableJS/angular-sortablejs) + * [1.*](https://github.com/SortableJS/angular-legacy-sortablejs) + * React + * [ES2015+](https://github.com/SortableJS/react-sortablejs) + * [Mixin](https://github.com/SortableJS/react-mixin-sortablejs) + * [Knockout](https://github.com/SortableJS/knockout-sortablejs) + * [Polymer](https://github.com/SortableJS/polymer-sortablejs) + * [Vue](https://github.com/SortableJS/Vue.Draggable) + * [Ember](https://github.com/SortableJS/ember-sortablejs) + * Supports any CSS library, e.g. [Bootstrap](#bs) + * Simple API + * Support for [plugins](#plugins) + * [CDN](#cdn) + * No jQuery required (but there is [support](https://github.com/SortableJS/jquery-sortablejs)) + * Typescript definitions at `@types/sortablejs` + + +
+ + +### Articles + + * [Dragging Multiple Items in Sortable](https://github.com/SortableJS/Sortable/wiki/Dragging-Multiple-Items-in-Sortable) (April 26, 2019) + * [Swap Thresholds and Direction](https://github.com/SortableJS/Sortable/wiki/Swap-Thresholds-and-Direction) (December 2, 2018) + * [Sortable v1.0 — New capabilities](https://github.com/SortableJS/Sortable/wiki/Sortable-v1.0-—-New-capabilities/) (December 22, 2014) + * [Sorting with the help of HTML5 Drag'n'Drop API](https://github.com/SortableJS/Sortable/wiki/Sorting-with-the-help-of-HTML5-Drag'n'Drop-API/) (December 23, 2013) + +
+ +### Getting Started + +Install with NPM: +```bash +$ npm install sortablejs --save +``` + +Install with Bower: +```bash +$ bower install --save sortablejs +``` + +Import into your project: +```js +// Default SortableJS +import Sortable from 'sortablejs'; + +// Core SortableJS (without default plugins) +import Sortable from 'sortablejs/modular/sortable.core.esm.js'; + +// Complete SortableJS (with all plugins) +import Sortable from 'sortablejs/modular/sortable.complete.esm.js'; +``` + +Cherrypick plugins: +```js +// Cherrypick extra plugins +import Sortable, { MultiDrag, Swap } from 'sortablejs'; + +Sortable.mount(new MultiDrag(), new Swap()); + + +// Cherrypick default plugins +import Sortable, { AutoScroll } from 'sortablejs/modular/sortable.core.esm.js'; + +Sortable.mount(new AutoScroll()); +``` + + +--- + + +### Usage +```html + +``` + +```js +var el = document.getElementById('items'); +var sortable = Sortable.create(el); +``` + +You can use any element for the list and its elements, not just `ul`/`li`. Here is an [example with `div`s](https://jsbin.com/visimub/edit?html,js,output). + + +--- + + +### Options +```js +var sortable = new Sortable(el, { + group: "name", // or { name: "...", pull: [true, false, 'clone', array], put: [true, false, array] } + sort: true, // sorting inside list + delay: 0, // time in milliseconds to define when the sorting should start + delayOnTouchOnly: false, // only delay if user is using touch + touchStartThreshold: 0, // px, how many pixels the point should move before cancelling a delayed drag event + disabled: false, // Disables the sortable if set to true. + store: null, // @see Store + animation: 150, // ms, animation speed moving items when sorting, `0` — without animation + easing: "cubic-bezier(1, 0, 0, 1)", // Easing for animation. Defaults to null. See https://easings.net/ for examples. + handle: ".my-handle", // Drag handle selector within list items + filter: ".ignore-elements", // Selectors that do not lead to dragging (String or Function) + preventOnFilter: true, // Call `event.preventDefault()` when triggered `filter` + draggable: ".item", // Specifies which items inside the element should be draggable + + dataIdAttr: 'data-id', + + ghostClass: "sortable-ghost", // Class name for the drop placeholder + chosenClass: "sortable-chosen", // Class name for the chosen item + dragClass: "sortable-drag", // Class name for the dragging item + + swapThreshold: 1, // Threshold of the swap zone + invertSwap: false, // Will always use inverted swap zone if set to true + invertedSwapThreshold: 1, // Threshold of the inverted swap zone (will be set to swapThreshold value by default) + direction: 'horizontal', // Direction of Sortable (will be detected automatically if not given) + + forceFallback: false, // ignore the HTML5 DnD behaviour and force the fallback to kick in + + fallbackClass: "sortable-fallback", // Class name for the cloned DOM Element when using forceFallback + fallbackOnBody: false, // Appends the cloned DOM Element into the Document's Body + fallbackTolerance: 0, // Specify in pixels how far the mouse should move before it's considered as a drag. + + dragoverBubble: false, + removeCloneOnHide: true, // Remove the clone element when it is not showing, rather than just hiding it + emptyInsertThreshold: 5, // px, distance mouse must be from empty sortable to insert drag element into it + + + setData: function (/** DataTransfer */dataTransfer, /** HTMLElement*/dragEl) { + dataTransfer.setData('Text', dragEl.textContent); // `dataTransfer` object of HTML5 DragEvent + }, + + // Element is chosen + onChoose: function (/**Event*/evt) { + evt.oldIndex; // element index within parent + }, + + // Element is unchosen + onUnchoose: function(/**Event*/evt) { + // same properties as onEnd + }, + + // Element dragging started + onStart: function (/**Event*/evt) { + evt.oldIndex; // element index within parent + }, + + // Element dragging ended + onEnd: function (/**Event*/evt) { + var itemEl = evt.item; // dragged HTMLElement + evt.to; // target list + evt.from; // previous list + evt.oldIndex; // element's old index within old parent + evt.newIndex; // element's new index within new parent + evt.oldDraggableIndex; // element's old index within old parent, only counting draggable elements + evt.newDraggableIndex; // element's new index within new parent, only counting draggable elements + evt.clone // the clone element + evt.pullMode; // when item is in another sortable: `"clone"` if cloning, `true` if moving + }, + + // Element is dropped into the list from another list + onAdd: function (/**Event*/evt) { + // same properties as onEnd + }, + + // Changed sorting within list + onUpdate: function (/**Event*/evt) { + // same properties as onEnd + }, + + // Called by any change to the list (add / update / remove) + onSort: function (/**Event*/evt) { + // same properties as onEnd + }, + + // Element is removed from the list into another list + onRemove: function (/**Event*/evt) { + // same properties as onEnd + }, + + // Attempt to drag a filtered element + onFilter: function (/**Event*/evt) { + var itemEl = evt.item; // HTMLElement receiving the `mousedown|tapstart` event. + }, + + // Event when you move an item in the list or between lists + onMove: function (/**Event*/evt, /**Event*/originalEvent) { + // Example: https://jsbin.com/nawahef/edit?js,output + evt.dragged; // dragged HTMLElement + evt.draggedRect; // DOMRect {left, top, right, bottom} + evt.related; // HTMLElement on which have guided + evt.relatedRect; // DOMRect + evt.willInsertAfter; // Boolean that is true if Sortable will insert drag element after target by default + originalEvent.clientY; // mouse position + // return false; — for cancel + // return -1; — insert before target + // return 1; — insert after target + }, + + // Called when creating a clone of element + onClone: function (/**Event*/evt) { + var origEl = evt.item; + var cloneEl = evt.clone; + }, + + // Called when dragging element changes position + onChange: function(/**Event*/evt) { + evt.newIndex // most likely why this event is used is to get the dragging element's current index + // same properties as onEnd + } +}); +``` + + +--- + + +#### `group` option +To drag elements from one list into another, both lists must have the same `group` value. +You can also define whether lists can give away, give and keep a copy (`clone`), and receive elements. + + * name: `String` — group name + * pull: `true|false|["foo", "bar"]|'clone'|function` — ability to move from the list. `clone` — copy the item, rather than move. Or an array of group names which the elements may be put in. Defaults to `true`. + * put: `true|false|["baz", "qux"]|function` — whether elements can be added from other lists, or an array of group names from which elements can be added. + * revertClone: `boolean` — revert cloned element to initial position after moving to a another list. + + +Demo: + - https://jsbin.com/hijetos/edit?js,output + - https://jsbin.com/nacoyah/edit?js,output — use of complex logic in the `pull` and` put` + - https://jsbin.com/bifuyab/edit?js,output — use `revertClone: true` + + +--- + + +#### `sort` option +Allow sorting inside list. + +Demo: https://jsbin.com/jayedig/edit?js,output + + +--- + + +#### `delay` option +Time in milliseconds to define when the sorting should start. +Unfortunately, due to browser restrictions, delaying is not possible on IE or Edge with native drag & drop. + +Demo: https://jsbin.com/zosiwah/edit?js,output + + +--- + + +#### `delayOnTouchOnly` option +Whether or not the delay should be applied only if the user is using touch (eg. on a mobile device). No delay will be applied in any other case. Defaults to `false`. + + +--- + + +#### `swapThreshold` option +Percentage of the target that the swap zone will take up, as a float between `0` and `1`. + +[Read more](https://github.com/SortableJS/Sortable/wiki/Swap-Thresholds-and-Direction#swap-threshold) + +Demo: http://sortablejs.github.io/Sortable#thresholds + + +--- + + +#### `invertSwap` option +Set to `true` to set the swap zone to the sides of the target, for the effect of sorting "in between" items. + +[Read more](https://github.com/SortableJS/Sortable/wiki/Swap-Thresholds-and-Direction#forcing-inverted-swap-zone) + +Demo: http://sortablejs.github.io/Sortable#thresholds + + +--- + + +#### `invertedSwapThreshold` option +Percentage of the target that the inverted swap zone will take up, as a float between `0` and `1`. If not given, will default to `swapThreshold`. + +[Read more](https://github.com/SortableJS/Sortable/wiki/Swap-Thresholds-and-Direction#dealing-with-swap-glitching) + + +--- + + +#### `direction` option +Direction that the Sortable should sort in. Can be set to `'vertical'`, `'horizontal'`, or a function, which will be called whenever a target is dragged over. Must return `'vertical'` or `'horizontal'`. + +[Read more](https://github.com/SortableJS/Sortable/wiki/Swap-Thresholds-and-Direction#direction) + + +Example of direction detection for vertical list that includes full column and half column elements: + +```js +Sortable.create(el, { + direction: function(evt, target, dragEl) { + if (target !== null && target.className.includes('half-column') && dragEl.className.includes('half-column')) { + return 'horizontal'; + } + return 'vertical'; + } +}); +``` + + +--- + + +#### `touchStartThreshold` option +This option is similar to `fallbackTolerance` option. + +When the `delay` option is set, some phones with very sensitive touch displays like the Samsung Galaxy S8 will fire +unwanted touchmove events even when your finger is not moving, resulting in the sort not triggering. + +This option sets the minimum pointer movement that must occur before the delayed sorting is cancelled. + +Values between 3 to 5 are good. + + +--- + + +#### `disabled` options +Disables the sortable if set to `true`. + +Demo: https://jsbin.com/sewokud/edit?js,output + +```js +var sortable = Sortable.create(list); + +document.getElementById("switcher").onclick = function () { + var state = sortable.option("disabled"); // get + + sortable.option("disabled", !state); // set +}; +``` + + +--- + + +#### `handle` option +To make list items draggable, Sortable disables text selection by the user. +That's not always desirable. To allow text selection, define a drag handler, +which is an area of every list element that allows it to be dragged around. + +Demo: https://jsbin.com/numakuh/edit?html,js,output + +```js +Sortable.create(el, { + handle: ".my-handle" +}); +``` + +```html + +``` + +```css +.my-handle { + cursor: move; + cursor: -webkit-grabbing; +} +``` + + +--- + + +#### `filter` option + + +```js +Sortable.create(list, { + filter: ".js-remove, .js-edit", + onFilter: function (evt) { + var item = evt.item, + ctrl = evt.target; + + if (Sortable.utils.is(ctrl, ".js-remove")) { // Click on remove button + item.parentNode.removeChild(item); // remove sortable item + } + else if (Sortable.utils.is(ctrl, ".js-edit")) { // Click on edit link + // ... + } + } +}) +``` + + +--- + + +#### `ghostClass` option +Class name for the drop placeholder (default `sortable-ghost`). + +Demo: https://jsbin.com/henuyiw/edit?css,js,output + +```css +.ghost { + opacity: 0.4; +} +``` + +```js +Sortable.create(list, { + ghostClass: "ghost" +}); +``` + + +--- + + +#### `chosenClass` option +Class name for the chosen item (default `sortable-chosen`). + +Demo: https://jsbin.com/hoqufox/edit?css,js,output + +```css +.chosen { + color: #fff; + background-color: #c00; +} +``` + +```js +Sortable.create(list, { + delay: 500, + chosenClass: "chosen" +}); +``` + + +--- + + +#### `forceFallback` option +If set to `true`, the Fallback for non HTML5 Browser will be used, even if we are using an HTML5 Browser. +This gives us the possibility to test the behaviour for older Browsers even in newer Browser, or make the Drag 'n Drop feel more consistent between Desktop , Mobile and old Browsers. + +On top of that, the Fallback always generates a copy of that DOM Element and appends the class `fallbackClass` defined in the options. This behaviour controls the look of this 'dragged' Element. + +Demo: https://jsbin.com/sibiput/edit?html,css,js,output + + +--- + + +#### `fallbackTolerance` option +Emulates the native drag threshold. Specify in pixels how far the mouse should move before it's considered as a drag. +Useful if the items are also clickable like in a list of links. + +When the user clicks inside a sortable element, it's not uncommon for your hand to move a little between the time you press and the time you release. +Dragging only starts if you move the pointer past a certain tolerance, so that you don't accidentally start dragging every time you click. + +3 to 5 are probably good values. + + +--- + + +#### `dragoverBubble` option +If set to `true`, the dragover event will bubble to parent sortables. Works on both fallback and native dragover event. +By default, it is false, but Sortable will only stop bubbling the event once the element has been inserted into a parent Sortable, or *can* be inserted into a parent Sortable, but isn't at that specific time (due to animation, etc). + +Since 1.8.0, you will probably want to leave this option as false. Before 1.8.0, it may need to be `true` for nested sortables to work. + + +--- + + +#### `removeCloneOnHide` option +If set to `false`, the clone is hidden by having it's CSS `display` property set to `none`. +By default, this option is `true`, meaning Sortable will remove the cloned element from the DOM when it is supposed to be hidden. + + +--- + + +#### `emptyInsertThreshold` option +The distance (in pixels) the mouse must be from an empty sortable while dragging for the drag element to be inserted into that sortable. Defaults to `5`. Set to `0` to disable this feature. + +Demo: https://jsbin.com/becavoj/edit?js,output + + +--- +### Event object ([demo](https://jsbin.com/fogujiv/edit?js,output)) + + - to:`HTMLElement` — list, in which moved element + - from:`HTMLElement` — previous list + - item:`HTMLElement` — dragged element + - clone:`HTMLElement` + - oldIndex:`Number|undefined` — old index within parent + - newIndex:`Number|undefined` — new index within parent + - oldDraggableIndex: `Number|undefined` — old index within parent, only counting draggable elements + - newDraggableIndex: `Number|undefined` — new index within parent, only counting draggable elements + - pullMode:`String|Boolean|undefined` — Pull mode if dragging into another sortable (`"clone"`, `true`, or `false`), otherwise undefined + + +#### `move` event object + - to:`HTMLElement` + - from:`HTMLElement` + - dragged:`HTMLElement` + - draggedRect:`DOMRect` + - related:`HTMLElement` — element on which have guided + - relatedRect:`DOMRect` + - willInsertAfter:`Boolean` — `true` if will element be inserted after target (or `false` if before) + + +--- + + +### Method + + +##### option(name:`String`[, value:`*`]):`*` +Get or set the option. + + + +##### closest(el:`String`[, selector:`HTMLElement`]):`HTMLElement|null` +For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree. + + +##### toArray():`String[]` +Serializes the sortable's item `data-id`'s (`dataIdAttr` option) into an array of string. + + +##### sort(order:`String[]`) +Sorts the elements according to the array. + +```js +var order = sortable.toArray(); +sortable.sort(order.reverse()); // apply +``` + + +##### save() +Save the current sorting (see [store](#store)) + + +##### destroy() +Removes the sortable functionality completely. + + +--- + + + +### Store +Saving and restoring of the sort. + +```html + +``` + +```js +Sortable.create(el, { + group: "localStorage-example", + store: { + /** + * Get the order of elements. Called once during initialization. + * @param {Sortable} sortable + * @returns {Array} + */ + get: function (sortable) { + var order = localStorage.getItem(sortable.options.group.name); + return order ? order.split('|') : []; + }, + + /** + * Save the order of elements. Called onEnd (when the item is dropped). + * @param {Sortable} sortable + */ + set: function (sortable) { + var order = sortable.toArray(); + localStorage.setItem(sortable.options.group.name, order.join('|')); + } + } +}) +``` + + +--- + + + +### Bootstrap +Demo: https://jsbin.com/visimub/edit?html,js,output + +```html + + + + + + + + + + + + +``` + + +--- + + +### Static methods & properties + + + +##### Sortable.create(el:`HTMLElement`[, options:`Object`]):`Sortable` +Create new instance. + + +--- + + +##### Sortable.active:`Sortable` +The active Sortable instance. + + +--- + + +##### Sortable.dragged:`HTMLElement` +The element being dragged. + + +--- + + +##### Sortable.ghost:`HTMLElement` +The ghost element. + + +--- + + +##### Sortable.clone:`HTMLElement` +The clone element. + + +--- + + +##### Sortable.get(element:`HTMLElement`):`Sortable` +Get the Sortable instance on an element. + + +--- + + +##### Sortable.mount(plugin:`...SortablePlugin|SortablePlugin[]`) +Mounts a plugin to Sortable. + + +--- + + +##### Sortable.utils +* on(el`:HTMLElement`, event`:String`, fn`:Function`) — attach an event handler function +* off(el`:HTMLElement`, event`:String`, fn`:Function`) — remove an event handler +* css(el`:HTMLElement`)`:Object` — get the values of all the CSS properties +* css(el`:HTMLElement`, prop`:String`)`:Mixed` — get the value of style properties +* css(el`:HTMLElement`, prop`:String`, value`:String`) — set one CSS properties +* css(el`:HTMLElement`, props`:Object`) — set more CSS properties +* find(ctx`:HTMLElement`, tagName`:String`[, iterator`:Function`])`:Array` — get elements by tag name +* bind(ctx`:Mixed`, fn`:Function`)`:Function` — Takes a function and returns a new one that will always have a particular context +* is(el`:HTMLElement`, selector`:String`)`:Boolean` — check the current matched set of elements against a selector +* closest(el`:HTMLElement`, selector`:String`[, ctx`:HTMLElement`])`:HTMLElement|Null` — for each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree +* clone(el`:HTMLElement`)`:HTMLElement` — create a deep copy of the set of matched elements +* toggleClass(el`:HTMLElement`, name`:String`, state`:Boolean`) — add or remove one classes from each element +* detectDirection(el`:HTMLElement`)`:String` — automatically detect the [direction](https://github.com/SortableJS/Sortable/wiki/Swap-Thresholds-and-Direction#direction) of the element as either `'vertical'` or `'horizontal'` + + +--- + + +### Plugins +#### Extra Plugins (included in complete versions) + - [MultiDrag](https://github.com/SortableJS/Sortable/tree/master/plugins/MultiDrag) + - [Swap](https://github.com/SortableJS/Sortable/tree/master/plugins/Swap) + +#### Default Plugins (included in default versions) + - [AutoScroll](https://github.com/SortableJS/Sortable/tree/master/plugins/AutoScroll) + - [OnSpill](https://github.com/SortableJS/Sortable/tree/master/plugins/OnSpill) + + +--- + + + +### CDN + +```html + + +``` + + +--- + + +### Contributing (Issue/PR) + +Please, [read this](CONTRIBUTING.md). + + +--- + + +## Contributors + +### Code Contributors + +This project exists thanks to all the people who contribute. [[Contribute](CONTRIBUTING.md)]. + + +### Financial Contributors + +Become a financial contributor and help us sustain our community. [[Contribute](https://opencollective.com/Sortable/contribute)] + +#### Individuals + + + +#### Organizations + +Support this project with your organization. Your logo will show up here with a link to your website. [[Contribute](https://opencollective.com/Sortable/contribute)] + + + + + + + + + + + + +## MIT LICENSE +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/public/assets/libs/Sortable/Sortable.js b/public/assets/libs/Sortable/Sortable.js new file mode 100644 index 0000000..c6d7f9d --- /dev/null +++ b/public/assets/libs/Sortable/Sortable.js @@ -0,0 +1,3709 @@ +/**! + * Sortable 1.10.2 + * @author RubaXa + * @author owenm + * @license MIT + */ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : + typeof define === 'function' && define.amd ? define(factory) : + (global = global || self, global.Sortable = factory()); +}(this, function () { 'use strict'; + + function _typeof(obj) { + if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { + _typeof = function (obj) { + return typeof obj; + }; + } else { + _typeof = function (obj) { + return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; + }; + } + + return _typeof(obj); + } + + function _defineProperty(obj, key, value) { + if (key in obj) { + Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + } else { + obj[key] = value; + } + + return obj; + } + + function _extends() { + _extends = Object.assign || function (target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i]; + + for (var key in source) { + if (Object.prototype.hasOwnProperty.call(source, key)) { + target[key] = source[key]; + } + } + } + + return target; + }; + + return _extends.apply(this, arguments); + } + + function _objectSpread(target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i] != null ? arguments[i] : {}; + var ownKeys = Object.keys(source); + + if (typeof Object.getOwnPropertySymbols === 'function') { + ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { + return Object.getOwnPropertyDescriptor(source, sym).enumerable; + })); + } + + ownKeys.forEach(function (key) { + _defineProperty(target, key, source[key]); + }); + } + + return target; + } + + function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + + for (i = 0; i < sourceKeys.length; i++) { + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + + return target; + } + + function _objectWithoutProperties(source, excluded) { + if (source == null) return {}; + + var target = _objectWithoutPropertiesLoose(source, excluded); + + var key, i; + + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + + for (i = 0; i < sourceSymbolKeys.length; i++) { + key = sourceSymbolKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + + return target; + } + + function _toConsumableArray(arr) { + return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); + } + + function _arrayWithoutHoles(arr) { + if (Array.isArray(arr)) { + for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; + + return arr2; + } + } + + function _iterableToArray(iter) { + if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); + } + + function _nonIterableSpread() { + throw new TypeError("Invalid attempt to spread non-iterable instance"); + } + + var version = "1.10.2"; + + function userAgent(pattern) { + if (typeof window !== 'undefined' && window.navigator) { + return !! + /*@__PURE__*/ + navigator.userAgent.match(pattern); + } + } + + var IE11OrLess = userAgent(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i); + var Edge = userAgent(/Edge/i); + var FireFox = userAgent(/firefox/i); + var Safari = userAgent(/safari/i) && !userAgent(/chrome/i) && !userAgent(/android/i); + var IOS = userAgent(/iP(ad|od|hone)/i); + var ChromeForAndroid = userAgent(/chrome/i) && userAgent(/android/i); + + var captureMode = { + capture: false, + passive: false + }; + + function on(el, event, fn) { + el.addEventListener(event, fn, !IE11OrLess && captureMode); + } + + function off(el, event, fn) { + el.removeEventListener(event, fn, !IE11OrLess && captureMode); + } + + function matches( + /**HTMLElement*/ + el, + /**String*/ + selector) { + if (!selector) return; + selector[0] === '>' && (selector = selector.substring(1)); + + if (el) { + try { + if (el.matches) { + return el.matches(selector); + } else if (el.msMatchesSelector) { + return el.msMatchesSelector(selector); + } else if (el.webkitMatchesSelector) { + return el.webkitMatchesSelector(selector); + } + } catch (_) { + return false; + } + } + + return false; + } + + function getParentOrHost(el) { + return el.host && el !== document && el.host.nodeType ? el.host : el.parentNode; + } + + function closest( + /**HTMLElement*/ + el, + /**String*/ + selector, + /**HTMLElement*/ + ctx, includeCTX) { + if (el) { + ctx = ctx || document; + + do { + if (selector != null && (selector[0] === '>' ? el.parentNode === ctx && matches(el, selector) : matches(el, selector)) || includeCTX && el === ctx) { + return el; + } + + if (el === ctx) break; + /* jshint boss:true */ + } while (el = getParentOrHost(el)); + } + + return null; + } + + var R_SPACE = /\s+/g; + + function toggleClass(el, name, state) { + if (el && name) { + if (el.classList) { + el.classList[state ? 'add' : 'remove'](name); + } else { + var className = (' ' + el.className + ' ').replace(R_SPACE, ' ').replace(' ' + name + ' ', ' '); + el.className = (className + (state ? ' ' + name : '')).replace(R_SPACE, ' '); + } + } + } + + function css(el, prop, val) { + var style = el && el.style; + + if (style) { + if (val === void 0) { + if (document.defaultView && document.defaultView.getComputedStyle) { + val = document.defaultView.getComputedStyle(el, ''); + } else if (el.currentStyle) { + val = el.currentStyle; + } + + return prop === void 0 ? val : val[prop]; + } else { + if (!(prop in style) && prop.indexOf('webkit') === -1) { + prop = '-webkit-' + prop; + } + + style[prop] = val + (typeof val === 'string' ? '' : 'px'); + } + } + } + + function matrix(el, selfOnly) { + var appliedTransforms = ''; + + if (typeof el === 'string') { + appliedTransforms = el; + } else { + do { + var transform = css(el, 'transform'); + + if (transform && transform !== 'none') { + appliedTransforms = transform + ' ' + appliedTransforms; + } + /* jshint boss:true */ + + } while (!selfOnly && (el = el.parentNode)); + } + + var matrixFn = window.DOMMatrix || window.WebKitCSSMatrix || window.CSSMatrix || window.MSCSSMatrix; + /*jshint -W056 */ + + return matrixFn && new matrixFn(appliedTransforms); + } + + function find(ctx, tagName, iterator) { + if (ctx) { + var list = ctx.getElementsByTagName(tagName), + i = 0, + n = list.length; + + if (iterator) { + for (; i < n; i++) { + iterator(list[i], i); + } + } + + return list; + } + + return []; + } + + function getWindowScrollingElement() { + var scrollingElement = document.scrollingElement; + + if (scrollingElement) { + return scrollingElement; + } else { + return document.documentElement; + } + } + /** + * Returns the "bounding client rect" of given element + * @param {HTMLElement} el The element whose boundingClientRect is wanted + * @param {[Boolean]} relativeToContainingBlock Whether the rect should be relative to the containing block of (including) the container + * @param {[Boolean]} relativeToNonStaticParent Whether the rect should be relative to the relative parent of (including) the contaienr + * @param {[Boolean]} undoScale Whether the container's scale() should be undone + * @param {[HTMLElement]} container The parent the element will be placed in + * @return {Object} The boundingClientRect of el, with specified adjustments + */ + + + function getRect(el, relativeToContainingBlock, relativeToNonStaticParent, undoScale, container) { + if (!el.getBoundingClientRect && el !== window) return; + var elRect, top, left, bottom, right, height, width; + + if (el !== window && el !== getWindowScrollingElement()) { + elRect = el.getBoundingClientRect(); + top = elRect.top; + left = elRect.left; + bottom = elRect.bottom; + right = elRect.right; + height = elRect.height; + width = elRect.width; + } else { + top = 0; + left = 0; + bottom = window.innerHeight; + right = window.innerWidth; + height = window.innerHeight; + width = window.innerWidth; + } + + if ((relativeToContainingBlock || relativeToNonStaticParent) && el !== window) { + // Adjust for translate() + container = container || el.parentNode; // solves #1123 (see: https://stackoverflow.com/a/37953806/6088312) + // Not needed on <= IE11 + + if (!IE11OrLess) { + do { + if (container && container.getBoundingClientRect && (css(container, 'transform') !== 'none' || relativeToNonStaticParent && css(container, 'position') !== 'static')) { + var containerRect = container.getBoundingClientRect(); // Set relative to edges of padding box of container + + top -= containerRect.top + parseInt(css(container, 'border-top-width')); + left -= containerRect.left + parseInt(css(container, 'border-left-width')); + bottom = top + elRect.height; + right = left + elRect.width; + break; + } + /* jshint boss:true */ + + } while (container = container.parentNode); + } + } + + if (undoScale && el !== window) { + // Adjust for scale() + var elMatrix = matrix(container || el), + scaleX = elMatrix && elMatrix.a, + scaleY = elMatrix && elMatrix.d; + + if (elMatrix) { + top /= scaleY; + left /= scaleX; + width /= scaleX; + height /= scaleY; + bottom = top + height; + right = left + width; + } + } + + return { + top: top, + left: left, + bottom: bottom, + right: right, + width: width, + height: height + }; + } + /** + * Checks if a side of an element is scrolled past a side of its parents + * @param {HTMLElement} el The element who's side being scrolled out of view is in question + * @param {String} elSide Side of the element in question ('top', 'left', 'right', 'bottom') + * @param {String} parentSide Side of the parent in question ('top', 'left', 'right', 'bottom') + * @return {HTMLElement} The parent scroll element that the el's side is scrolled past, or null if there is no such element + */ + + + function isScrolledPast(el, elSide, parentSide) { + var parent = getParentAutoScrollElement(el, true), + elSideVal = getRect(el)[elSide]; + /* jshint boss:true */ + + while (parent) { + var parentSideVal = getRect(parent)[parentSide], + visible = void 0; + + if (parentSide === 'top' || parentSide === 'left') { + visible = elSideVal >= parentSideVal; + } else { + visible = elSideVal <= parentSideVal; + } + + if (!visible) return parent; + if (parent === getWindowScrollingElement()) break; + parent = getParentAutoScrollElement(parent, false); + } + + return false; + } + /** + * Gets nth child of el, ignoring hidden children, sortable's elements (does not ignore clone if it's visible) + * and non-draggable elements + * @param {HTMLElement} el The parent element + * @param {Number} childNum The index of the child + * @param {Object} options Parent Sortable's options + * @return {HTMLElement} The child at index childNum, or null if not found + */ + + + function getChild(el, childNum, options) { + var currentChild = 0, + i = 0, + children = el.children; + + while (i < children.length) { + if (children[i].style.display !== 'none' && children[i] !== Sortable.ghost && children[i] !== Sortable.dragged && closest(children[i], options.draggable, el, false)) { + if (currentChild === childNum) { + return children[i]; + } + + currentChild++; + } + + i++; + } + + return null; + } + /** + * Gets the last child in the el, ignoring ghostEl or invisible elements (clones) + * @param {HTMLElement} el Parent element + * @param {selector} selector Any other elements that should be ignored + * @return {HTMLElement} The last child, ignoring ghostEl + */ + + + function lastChild(el, selector) { + var last = el.lastElementChild; + + while (last && (last === Sortable.ghost || css(last, 'display') === 'none' || selector && !matches(last, selector))) { + last = last.previousElementSibling; + } + + return last || null; + } + /** + * Returns the index of an element within its parent for a selected set of + * elements + * @param {HTMLElement} el + * @param {selector} selector + * @return {number} + */ + + + function index(el, selector) { + var index = 0; + + if (!el || !el.parentNode) { + return -1; + } + /* jshint boss:true */ + + + while (el = el.previousElementSibling) { + if (el.nodeName.toUpperCase() !== 'TEMPLATE' && el !== Sortable.clone && (!selector || matches(el, selector))) { + index++; + } + } + + return index; + } + /** + * Returns the scroll offset of the given element, added with all the scroll offsets of parent elements. + * The value is returned in real pixels. + * @param {HTMLElement} el + * @return {Array} Offsets in the format of [left, top] + */ + + + function getRelativeScrollOffset(el) { + var offsetLeft = 0, + offsetTop = 0, + winScroller = getWindowScrollingElement(); + + if (el) { + do { + var elMatrix = matrix(el), + scaleX = elMatrix.a, + scaleY = elMatrix.d; + offsetLeft += el.scrollLeft * scaleX; + offsetTop += el.scrollTop * scaleY; + } while (el !== winScroller && (el = el.parentNode)); + } + + return [offsetLeft, offsetTop]; + } + /** + * Returns the index of the object within the given array + * @param {Array} arr Array that may or may not hold the object + * @param {Object} obj An object that has a key-value pair unique to and identical to a key-value pair in the object you want to find + * @return {Number} The index of the object in the array, or -1 + */ + + + function indexOfObject(arr, obj) { + for (var i in arr) { + if (!arr.hasOwnProperty(i)) continue; + + for (var key in obj) { + if (obj.hasOwnProperty(key) && obj[key] === arr[i][key]) return Number(i); + } + } + + return -1; + } + + function getParentAutoScrollElement(el, includeSelf) { + // skip to window + if (!el || !el.getBoundingClientRect) return getWindowScrollingElement(); + var elem = el; + var gotSelf = false; + + do { + // we don't need to get elem css if it isn't even overflowing in the first place (performance) + if (elem.clientWidth < elem.scrollWidth || elem.clientHeight < elem.scrollHeight) { + var elemCSS = css(elem); + + if (elem.clientWidth < elem.scrollWidth && (elemCSS.overflowX == 'auto' || elemCSS.overflowX == 'scroll') || elem.clientHeight < elem.scrollHeight && (elemCSS.overflowY == 'auto' || elemCSS.overflowY == 'scroll')) { + if (!elem.getBoundingClientRect || elem === document.body) return getWindowScrollingElement(); + if (gotSelf || includeSelf) return elem; + gotSelf = true; + } + } + /* jshint boss:true */ + + } while (elem = elem.parentNode); + + return getWindowScrollingElement(); + } + + function extend(dst, src) { + if (dst && src) { + for (var key in src) { + if (src.hasOwnProperty(key)) { + dst[key] = src[key]; + } + } + } + + return dst; + } + + function isRectEqual(rect1, rect2) { + return Math.round(rect1.top) === Math.round(rect2.top) && Math.round(rect1.left) === Math.round(rect2.left) && Math.round(rect1.height) === Math.round(rect2.height) && Math.round(rect1.width) === Math.round(rect2.width); + } + + var _throttleTimeout; + + function throttle(callback, ms) { + return function () { + if (!_throttleTimeout) { + var args = arguments, + _this = this; + + if (args.length === 1) { + callback.call(_this, args[0]); + } else { + callback.apply(_this, args); + } + + _throttleTimeout = setTimeout(function () { + _throttleTimeout = void 0; + }, ms); + } + }; + } + + function cancelThrottle() { + clearTimeout(_throttleTimeout); + _throttleTimeout = void 0; + } + + function scrollBy(el, x, y) { + el.scrollLeft += x; + el.scrollTop += y; + } + + function clone(el) { + var Polymer = window.Polymer; + var $ = window.jQuery || window.Zepto; + + if (Polymer && Polymer.dom) { + return Polymer.dom(el).cloneNode(true); + } else if ($) { + return $(el).clone(true)[0]; + } else { + return el.cloneNode(true); + } + } + + function setRect(el, rect) { + css(el, 'position', 'absolute'); + css(el, 'top', rect.top); + css(el, 'left', rect.left); + css(el, 'width', rect.width); + css(el, 'height', rect.height); + } + + function unsetRect(el) { + css(el, 'position', ''); + css(el, 'top', ''); + css(el, 'left', ''); + css(el, 'width', ''); + css(el, 'height', ''); + } + + var expando = 'Sortable' + new Date().getTime(); + + function AnimationStateManager() { + var animationStates = [], + animationCallbackId; + return { + captureAnimationState: function captureAnimationState() { + animationStates = []; + if (!this.options.animation) return; + var children = [].slice.call(this.el.children); + children.forEach(function (child) { + if (css(child, 'display') === 'none' || child === Sortable.ghost) return; + animationStates.push({ + target: child, + rect: getRect(child) + }); + + var fromRect = _objectSpread({}, animationStates[animationStates.length - 1].rect); // If animating: compensate for current animation + + + if (child.thisAnimationDuration) { + var childMatrix = matrix(child, true); + + if (childMatrix) { + fromRect.top -= childMatrix.f; + fromRect.left -= childMatrix.e; + } + } + + child.fromRect = fromRect; + }); + }, + addAnimationState: function addAnimationState(state) { + animationStates.push(state); + }, + removeAnimationState: function removeAnimationState(target) { + animationStates.splice(indexOfObject(animationStates, { + target: target + }), 1); + }, + animateAll: function animateAll(callback) { + var _this = this; + + if (!this.options.animation) { + clearTimeout(animationCallbackId); + if (typeof callback === 'function') callback(); + return; + } + + var animating = false, + animationTime = 0; + animationStates.forEach(function (state) { + var time = 0, + target = state.target, + fromRect = target.fromRect, + toRect = getRect(target), + prevFromRect = target.prevFromRect, + prevToRect = target.prevToRect, + animatingRect = state.rect, + targetMatrix = matrix(target, true); + + if (targetMatrix) { + // Compensate for current animation + toRect.top -= targetMatrix.f; + toRect.left -= targetMatrix.e; + } + + target.toRect = toRect; + + if (target.thisAnimationDuration) { + // Could also check if animatingRect is between fromRect and toRect + if (isRectEqual(prevFromRect, toRect) && !isRectEqual(fromRect, toRect) && // Make sure animatingRect is on line between toRect & fromRect + (animatingRect.top - toRect.top) / (animatingRect.left - toRect.left) === (fromRect.top - toRect.top) / (fromRect.left - toRect.left)) { + // If returning to same place as started from animation and on same axis + time = calculateRealTime(animatingRect, prevFromRect, prevToRect, _this.options); + } + } // if fromRect != toRect: animate + + + if (!isRectEqual(toRect, fromRect)) { + target.prevFromRect = fromRect; + target.prevToRect = toRect; + + if (!time) { + time = _this.options.animation; + } + + _this.animate(target, animatingRect, toRect, time); + } + + if (time) { + animating = true; + animationTime = Math.max(animationTime, time); + clearTimeout(target.animationResetTimer); + target.animationResetTimer = setTimeout(function () { + target.animationTime = 0; + target.prevFromRect = null; + target.fromRect = null; + target.prevToRect = null; + target.thisAnimationDuration = null; + }, time); + target.thisAnimationDuration = time; + } + }); + clearTimeout(animationCallbackId); + + if (!animating) { + if (typeof callback === 'function') callback(); + } else { + animationCallbackId = setTimeout(function () { + if (typeof callback === 'function') callback(); + }, animationTime); + } + + animationStates = []; + }, + animate: function animate(target, currentRect, toRect, duration) { + if (duration) { + css(target, 'transition', ''); + css(target, 'transform', ''); + var elMatrix = matrix(this.el), + scaleX = elMatrix && elMatrix.a, + scaleY = elMatrix && elMatrix.d, + translateX = (currentRect.left - toRect.left) / (scaleX || 1), + translateY = (currentRect.top - toRect.top) / (scaleY || 1); + target.animatingX = !!translateX; + target.animatingY = !!translateY; + css(target, 'transform', 'translate3d(' + translateX + 'px,' + translateY + 'px,0)'); + repaint(target); // repaint + + css(target, 'transition', 'transform ' + duration + 'ms' + (this.options.easing ? ' ' + this.options.easing : '')); + css(target, 'transform', 'translate3d(0,0,0)'); + typeof target.animated === 'number' && clearTimeout(target.animated); + target.animated = setTimeout(function () { + css(target, 'transition', ''); + css(target, 'transform', ''); + target.animated = false; + target.animatingX = false; + target.animatingY = false; + }, duration); + } + } + }; + } + + function repaint(target) { + return target.offsetWidth; + } + + function calculateRealTime(animatingRect, fromRect, toRect, options) { + return Math.sqrt(Math.pow(fromRect.top - animatingRect.top, 2) + Math.pow(fromRect.left - animatingRect.left, 2)) / Math.sqrt(Math.pow(fromRect.top - toRect.top, 2) + Math.pow(fromRect.left - toRect.left, 2)) * options.animation; + } + + var plugins = []; + var defaults = { + initializeByDefault: true + }; + var PluginManager = { + mount: function mount(plugin) { + // Set default static properties + for (var option in defaults) { + if (defaults.hasOwnProperty(option) && !(option in plugin)) { + plugin[option] = defaults[option]; + } + } + + plugins.push(plugin); + }, + pluginEvent: function pluginEvent(eventName, sortable, evt) { + var _this = this; + + this.eventCanceled = false; + + evt.cancel = function () { + _this.eventCanceled = true; + }; + + var eventNameGlobal = eventName + 'Global'; + plugins.forEach(function (plugin) { + if (!sortable[plugin.pluginName]) return; // Fire global events if it exists in this sortable + + if (sortable[plugin.pluginName][eventNameGlobal]) { + sortable[plugin.pluginName][eventNameGlobal](_objectSpread({ + sortable: sortable + }, evt)); + } // Only fire plugin event if plugin is enabled in this sortable, + // and plugin has event defined + + + if (sortable.options[plugin.pluginName] && sortable[plugin.pluginName][eventName]) { + sortable[plugin.pluginName][eventName](_objectSpread({ + sortable: sortable + }, evt)); + } + }); + }, + initializePlugins: function initializePlugins(sortable, el, defaults, options) { + plugins.forEach(function (plugin) { + var pluginName = plugin.pluginName; + if (!sortable.options[pluginName] && !plugin.initializeByDefault) return; + var initialized = new plugin(sortable, el, sortable.options); + initialized.sortable = sortable; + initialized.options = sortable.options; + sortable[pluginName] = initialized; // Add default options from plugin + + _extends(defaults, initialized.defaults); + }); + + for (var option in sortable.options) { + if (!sortable.options.hasOwnProperty(option)) continue; + var modified = this.modifyOption(sortable, option, sortable.options[option]); + + if (typeof modified !== 'undefined') { + sortable.options[option] = modified; + } + } + }, + getEventProperties: function getEventProperties(name, sortable) { + var eventProperties = {}; + plugins.forEach(function (plugin) { + if (typeof plugin.eventProperties !== 'function') return; + + _extends(eventProperties, plugin.eventProperties.call(sortable[plugin.pluginName], name)); + }); + return eventProperties; + }, + modifyOption: function modifyOption(sortable, name, value) { + var modifiedValue; + plugins.forEach(function (plugin) { + // Plugin must exist on the Sortable + if (!sortable[plugin.pluginName]) return; // If static option listener exists for this option, call in the context of the Sortable's instance of this plugin + + if (plugin.optionListeners && typeof plugin.optionListeners[name] === 'function') { + modifiedValue = plugin.optionListeners[name].call(sortable[plugin.pluginName], value); + } + }); + return modifiedValue; + } + }; + + function dispatchEvent(_ref) { + var sortable = _ref.sortable, + rootEl = _ref.rootEl, + name = _ref.name, + targetEl = _ref.targetEl, + cloneEl = _ref.cloneEl, + toEl = _ref.toEl, + fromEl = _ref.fromEl, + oldIndex = _ref.oldIndex, + newIndex = _ref.newIndex, + oldDraggableIndex = _ref.oldDraggableIndex, + newDraggableIndex = _ref.newDraggableIndex, + originalEvent = _ref.originalEvent, + putSortable = _ref.putSortable, + extraEventProperties = _ref.extraEventProperties; + sortable = sortable || rootEl && rootEl[expando]; + if (!sortable) return; + var evt, + options = sortable.options, + onName = 'on' + name.charAt(0).toUpperCase() + name.substr(1); // Support for new CustomEvent feature + + if (window.CustomEvent && !IE11OrLess && !Edge) { + evt = new CustomEvent(name, { + bubbles: true, + cancelable: true + }); + } else { + evt = document.createEvent('Event'); + evt.initEvent(name, true, true); + } + + evt.to = toEl || rootEl; + evt.from = fromEl || rootEl; + evt.item = targetEl || rootEl; + evt.clone = cloneEl; + evt.oldIndex = oldIndex; + evt.newIndex = newIndex; + evt.oldDraggableIndex = oldDraggableIndex; + evt.newDraggableIndex = newDraggableIndex; + evt.originalEvent = originalEvent; + evt.pullMode = putSortable ? putSortable.lastPutMode : undefined; + + var allEventProperties = _objectSpread({}, extraEventProperties, PluginManager.getEventProperties(name, sortable)); + + for (var option in allEventProperties) { + evt[option] = allEventProperties[option]; + } + + if (rootEl) { + rootEl.dispatchEvent(evt); + } + + if (options[onName]) { + options[onName].call(sortable, evt); + } + } + + var pluginEvent = function pluginEvent(eventName, sortable) { + var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}, + originalEvent = _ref.evt, + data = _objectWithoutProperties(_ref, ["evt"]); + + PluginManager.pluginEvent.bind(Sortable)(eventName, sortable, _objectSpread({ + dragEl: dragEl, + parentEl: parentEl, + ghostEl: ghostEl, + rootEl: rootEl, + nextEl: nextEl, + lastDownEl: lastDownEl, + cloneEl: cloneEl, + cloneHidden: cloneHidden, + dragStarted: moved, + putSortable: putSortable, + activeSortable: Sortable.active, + originalEvent: originalEvent, + oldIndex: oldIndex, + oldDraggableIndex: oldDraggableIndex, + newIndex: newIndex, + newDraggableIndex: newDraggableIndex, + hideGhostForTarget: _hideGhostForTarget, + unhideGhostForTarget: _unhideGhostForTarget, + cloneNowHidden: function cloneNowHidden() { + cloneHidden = true; + }, + cloneNowShown: function cloneNowShown() { + cloneHidden = false; + }, + dispatchSortableEvent: function dispatchSortableEvent(name) { + _dispatchEvent({ + sortable: sortable, + name: name, + originalEvent: originalEvent + }); + } + }, data)); + }; + + function _dispatchEvent(info) { + dispatchEvent(_objectSpread({ + putSortable: putSortable, + cloneEl: cloneEl, + targetEl: dragEl, + rootEl: rootEl, + oldIndex: oldIndex, + oldDraggableIndex: oldDraggableIndex, + newIndex: newIndex, + newDraggableIndex: newDraggableIndex + }, info)); + } + + var dragEl, + parentEl, + ghostEl, + rootEl, + nextEl, + lastDownEl, + cloneEl, + cloneHidden, + oldIndex, + newIndex, + oldDraggableIndex, + newDraggableIndex, + activeGroup, + putSortable, + awaitingDragStarted = false, + ignoreNextClick = false, + sortables = [], + tapEvt, + touchEvt, + lastDx, + lastDy, + tapDistanceLeft, + tapDistanceTop, + moved, + lastTarget, + lastDirection, + pastFirstInvertThresh = false, + isCircumstantialInvert = false, + targetMoveDistance, + // For positioning ghost absolutely + ghostRelativeParent, + ghostRelativeParentInitialScroll = [], + // (left, top) + _silent = false, + savedInputChecked = []; + /** @const */ + + var documentExists = typeof document !== 'undefined', + PositionGhostAbsolutely = IOS, + CSSFloatProperty = Edge || IE11OrLess ? 'cssFloat' : 'float', + // This will not pass for IE9, because IE9 DnD only works on anchors + supportDraggable = documentExists && !ChromeForAndroid && !IOS && 'draggable' in document.createElement('div'), + supportCssPointerEvents = function () { + if (!documentExists) return; // false when <= IE11 + + if (IE11OrLess) { + return false; + } + + var el = document.createElement('x'); + el.style.cssText = 'pointer-events:auto'; + return el.style.pointerEvents === 'auto'; + }(), + _detectDirection = function _detectDirection(el, options) { + var elCSS = css(el), + elWidth = parseInt(elCSS.width) - parseInt(elCSS.paddingLeft) - parseInt(elCSS.paddingRight) - parseInt(elCSS.borderLeftWidth) - parseInt(elCSS.borderRightWidth), + child1 = getChild(el, 0, options), + child2 = getChild(el, 1, options), + firstChildCSS = child1 && css(child1), + secondChildCSS = child2 && css(child2), + firstChildWidth = firstChildCSS && parseInt(firstChildCSS.marginLeft) + parseInt(firstChildCSS.marginRight) + getRect(child1).width, + secondChildWidth = secondChildCSS && parseInt(secondChildCSS.marginLeft) + parseInt(secondChildCSS.marginRight) + getRect(child2).width; + + if (elCSS.display === 'flex') { + return elCSS.flexDirection === 'column' || elCSS.flexDirection === 'column-reverse' ? 'vertical' : 'horizontal'; + } + + if (elCSS.display === 'grid') { + return elCSS.gridTemplateColumns.split(' ').length <= 1 ? 'vertical' : 'horizontal'; + } + + if (child1 && firstChildCSS["float"] && firstChildCSS["float"] !== 'none') { + var touchingSideChild2 = firstChildCSS["float"] === 'left' ? 'left' : 'right'; + return child2 && (secondChildCSS.clear === 'both' || secondChildCSS.clear === touchingSideChild2) ? 'vertical' : 'horizontal'; + } + + return child1 && (firstChildCSS.display === 'block' || firstChildCSS.display === 'flex' || firstChildCSS.display === 'table' || firstChildCSS.display === 'grid' || firstChildWidth >= elWidth && elCSS[CSSFloatProperty] === 'none' || child2 && elCSS[CSSFloatProperty] === 'none' && firstChildWidth + secondChildWidth > elWidth) ? 'vertical' : 'horizontal'; + }, + _dragElInRowColumn = function _dragElInRowColumn(dragRect, targetRect, vertical) { + var dragElS1Opp = vertical ? dragRect.left : dragRect.top, + dragElS2Opp = vertical ? dragRect.right : dragRect.bottom, + dragElOppLength = vertical ? dragRect.width : dragRect.height, + targetS1Opp = vertical ? targetRect.left : targetRect.top, + targetS2Opp = vertical ? targetRect.right : targetRect.bottom, + targetOppLength = vertical ? targetRect.width : targetRect.height; + return dragElS1Opp === targetS1Opp || dragElS2Opp === targetS2Opp || dragElS1Opp + dragElOppLength / 2 === targetS1Opp + targetOppLength / 2; + }, + + /** + * Detects first nearest empty sortable to X and Y position using emptyInsertThreshold. + * @param {Number} x X position + * @param {Number} y Y position + * @return {HTMLElement} Element of the first found nearest Sortable + */ + _detectNearestEmptySortable = function _detectNearestEmptySortable(x, y) { + var ret; + sortables.some(function (sortable) { + if (lastChild(sortable)) return; + var rect = getRect(sortable), + threshold = sortable[expando].options.emptyInsertThreshold, + insideHorizontally = x >= rect.left - threshold && x <= rect.right + threshold, + insideVertically = y >= rect.top - threshold && y <= rect.bottom + threshold; + + if (threshold && insideHorizontally && insideVertically) { + return ret = sortable; + } + }); + return ret; + }, + _prepareGroup = function _prepareGroup(options) { + function toFn(value, pull) { + return function (to, from, dragEl, evt) { + var sameGroup = to.options.group.name && from.options.group.name && to.options.group.name === from.options.group.name; + + if (value == null && (pull || sameGroup)) { + // Default pull value + // Default pull and put value if same group + return true; + } else if (value == null || value === false) { + return false; + } else if (pull && value === 'clone') { + return value; + } else if (typeof value === 'function') { + return toFn(value(to, from, dragEl, evt), pull)(to, from, dragEl, evt); + } else { + var otherGroup = (pull ? to : from).options.group.name; + return value === true || typeof value === 'string' && value === otherGroup || value.join && value.indexOf(otherGroup) > -1; + } + }; + } + + var group = {}; + var originalGroup = options.group; + + if (!originalGroup || _typeof(originalGroup) != 'object') { + originalGroup = { + name: originalGroup + }; + } + + group.name = originalGroup.name; + group.checkPull = toFn(originalGroup.pull, true); + group.checkPut = toFn(originalGroup.put); + group.revertClone = originalGroup.revertClone; + options.group = group; + }, + _hideGhostForTarget = function _hideGhostForTarget() { + if (!supportCssPointerEvents && ghostEl) { + css(ghostEl, 'display', 'none'); + } + }, + _unhideGhostForTarget = function _unhideGhostForTarget() { + if (!supportCssPointerEvents && ghostEl) { + css(ghostEl, 'display', ''); + } + }; // #1184 fix - Prevent click event on fallback if dragged but item not changed position + + + if (documentExists) { + document.addEventListener('click', function (evt) { + if (ignoreNextClick) { + evt.preventDefault(); + evt.stopPropagation && evt.stopPropagation(); + evt.stopImmediatePropagation && evt.stopImmediatePropagation(); + ignoreNextClick = false; + return false; + } + }, true); + } + + var nearestEmptyInsertDetectEvent = function nearestEmptyInsertDetectEvent(evt) { + if (dragEl) { + evt = evt.touches ? evt.touches[0] : evt; + + var nearest = _detectNearestEmptySortable(evt.clientX, evt.clientY); + + if (nearest) { + // Create imitation event + var event = {}; + + for (var i in evt) { + if (evt.hasOwnProperty(i)) { + event[i] = evt[i]; + } + } + + event.target = event.rootEl = nearest; + event.preventDefault = void 0; + event.stopPropagation = void 0; + + nearest[expando]._onDragOver(event); + } + } + }; + + var _checkOutsideTargetEl = function _checkOutsideTargetEl(evt) { + if (dragEl) { + dragEl.parentNode[expando]._isOutsideThisEl(evt.target); + } + }; + /** + * @class Sortable + * @param {HTMLElement} el + * @param {Object} [options] + */ + + + function Sortable(el, options) { + if (!(el && el.nodeType && el.nodeType === 1)) { + throw "Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(el)); + } + + this.el = el; // root element + + this.options = options = _extends({}, options); // Export instance + + el[expando] = this; + var defaults = { + group: null, + sort: true, + disabled: false, + store: null, + handle: null, + draggable: /^[uo]l$/i.test(el.nodeName) ? '>li' : '>*', + swapThreshold: 1, + // percentage; 0 <= x <= 1 + invertSwap: false, + // invert always + invertedSwapThreshold: null, + // will be set to same as swapThreshold if default + removeCloneOnHide: true, + direction: function direction() { + return _detectDirection(el, this.options); + }, + ghostClass: 'sortable-ghost', + chosenClass: 'sortable-chosen', + dragClass: 'sortable-drag', + ignore: 'a, img', + filter: null, + preventOnFilter: true, + animation: 0, + easing: null, + setData: function setData(dataTransfer, dragEl) { + dataTransfer.setData('Text', dragEl.textContent); + }, + dropBubble: false, + dragoverBubble: false, + dataIdAttr: 'data-id', + delay: 0, + delayOnTouchOnly: false, + touchStartThreshold: (Number.parseInt ? Number : window).parseInt(window.devicePixelRatio, 10) || 1, + forceFallback: false, + fallbackClass: 'sortable-fallback', + fallbackOnBody: false, + fallbackTolerance: 0, + fallbackOffset: { + x: 0, + y: 0 + }, + supportPointer: Sortable.supportPointer !== false && 'PointerEvent' in window, + emptyInsertThreshold: 5 + }; + PluginManager.initializePlugins(this, el, defaults); // Set default options + + for (var name in defaults) { + !(name in options) && (options[name] = defaults[name]); + } + + _prepareGroup(options); // Bind all private methods + + + for (var fn in this) { + if (fn.charAt(0) === '_' && typeof this[fn] === 'function') { + this[fn] = this[fn].bind(this); + } + } // Setup drag mode + + + this.nativeDraggable = options.forceFallback ? false : supportDraggable; + + if (this.nativeDraggable) { + // Touch start threshold cannot be greater than the native dragstart threshold + this.options.touchStartThreshold = 1; + } // Bind events + + + if (options.supportPointer) { + on(el, 'pointerdown', this._onTapStart); + } else { + on(el, 'mousedown', this._onTapStart); + on(el, 'touchstart', this._onTapStart); + } + + if (this.nativeDraggable) { + on(el, 'dragover', this); + on(el, 'dragenter', this); + } + + sortables.push(this.el); // Restore sorting + + options.store && options.store.get && this.sort(options.store.get(this) || []); // Add animation state manager + + _extends(this, AnimationStateManager()); + } + + Sortable.prototype = + /** @lends Sortable.prototype */ + { + constructor: Sortable, + _isOutsideThisEl: function _isOutsideThisEl(target) { + if (!this.el.contains(target) && target !== this.el) { + lastTarget = null; + } + }, + _getDirection: function _getDirection(evt, target) { + return typeof this.options.direction === 'function' ? this.options.direction.call(this, evt, target, dragEl) : this.options.direction; + }, + _onTapStart: function _onTapStart( + /** Event|TouchEvent */ + evt) { + if (!evt.cancelable) return; + + var _this = this, + el = this.el, + options = this.options, + preventOnFilter = options.preventOnFilter, + type = evt.type, + touch = evt.touches && evt.touches[0] || evt.pointerType && evt.pointerType === 'touch' && evt, + target = (touch || evt).target, + originalTarget = evt.target.shadowRoot && (evt.path && evt.path[0] || evt.composedPath && evt.composedPath()[0]) || target, + filter = options.filter; + + _saveInputCheckedState(el); // Don't trigger start event when an element is been dragged, otherwise the evt.oldindex always wrong when set option.group. + + + if (dragEl) { + return; + } + + if (/mousedown|pointerdown/.test(type) && evt.button !== 0 || options.disabled) { + return; // only left button and enabled + } // cancel dnd if original target is content editable + + + if (originalTarget.isContentEditable) { + return; + } + + target = closest(target, options.draggable, el, false); + + if (target && target.animated) { + return; + } + + if (lastDownEl === target) { + // Ignoring duplicate `down` + return; + } // Get the index of the dragged element within its parent + + + oldIndex = index(target); + oldDraggableIndex = index(target, options.draggable); // Check filter + + if (typeof filter === 'function') { + if (filter.call(this, evt, target, this)) { + _dispatchEvent({ + sortable: _this, + rootEl: originalTarget, + name: 'filter', + targetEl: target, + toEl: el, + fromEl: el + }); + + pluginEvent('filter', _this, { + evt: evt + }); + preventOnFilter && evt.cancelable && evt.preventDefault(); + return; // cancel dnd + } + } else if (filter) { + filter = filter.split(',').some(function (criteria) { + criteria = closest(originalTarget, criteria.trim(), el, false); + + if (criteria) { + _dispatchEvent({ + sortable: _this, + rootEl: criteria, + name: 'filter', + targetEl: target, + fromEl: el, + toEl: el + }); + + pluginEvent('filter', _this, { + evt: evt + }); + return true; + } + }); + + if (filter) { + preventOnFilter && evt.cancelable && evt.preventDefault(); + return; // cancel dnd + } + } + + if (options.handle && !closest(originalTarget, options.handle, el, false)) { + return; + } // Prepare `dragstart` + + + this._prepareDragStart(evt, touch, target); + }, + _prepareDragStart: function _prepareDragStart( + /** Event */ + evt, + /** Touch */ + touch, + /** HTMLElement */ + target) { + var _this = this, + el = _this.el, + options = _this.options, + ownerDocument = el.ownerDocument, + dragStartFn; + + if (target && !dragEl && target.parentNode === el) { + var dragRect = getRect(target); + rootEl = el; + dragEl = target; + parentEl = dragEl.parentNode; + nextEl = dragEl.nextSibling; + lastDownEl = target; + activeGroup = options.group; + Sortable.dragged = dragEl; + tapEvt = { + target: dragEl, + clientX: (touch || evt).clientX, + clientY: (touch || evt).clientY + }; + tapDistanceLeft = tapEvt.clientX - dragRect.left; + tapDistanceTop = tapEvt.clientY - dragRect.top; + this._lastX = (touch || evt).clientX; + this._lastY = (touch || evt).clientY; + dragEl.style['will-change'] = 'all'; + + dragStartFn = function dragStartFn() { + pluginEvent('delayEnded', _this, { + evt: evt + }); + + if (Sortable.eventCanceled) { + _this._onDrop(); + + return; + } // Delayed drag has been triggered + // we can re-enable the events: touchmove/mousemove + + + _this._disableDelayedDragEvents(); + + if (!FireFox && _this.nativeDraggable) { + dragEl.draggable = true; + } // Bind the events: dragstart/dragend + + + _this._triggerDragStart(evt, touch); // Drag start event + + + _dispatchEvent({ + sortable: _this, + name: 'choose', + originalEvent: evt + }); // Chosen item + + + toggleClass(dragEl, options.chosenClass, true); + }; // Disable "draggable" + + + options.ignore.split(',').forEach(function (criteria) { + find(dragEl, criteria.trim(), _disableDraggable); + }); + on(ownerDocument, 'dragover', nearestEmptyInsertDetectEvent); + on(ownerDocument, 'mousemove', nearestEmptyInsertDetectEvent); + on(ownerDocument, 'touchmove', nearestEmptyInsertDetectEvent); + on(ownerDocument, 'mouseup', _this._onDrop); + on(ownerDocument, 'touchend', _this._onDrop); + on(ownerDocument, 'touchcancel', _this._onDrop); // Make dragEl draggable (must be before delay for FireFox) + + if (FireFox && this.nativeDraggable) { + this.options.touchStartThreshold = 4; + dragEl.draggable = true; + } + + pluginEvent('delayStart', this, { + evt: evt + }); // Delay is impossible for native DnD in Edge or IE + + if (options.delay && (!options.delayOnTouchOnly || touch) && (!this.nativeDraggable || !(Edge || IE11OrLess))) { + if (Sortable.eventCanceled) { + this._onDrop(); + + return; + } // If the user moves the pointer or let go the click or touch + // before the delay has been reached: + // disable the delayed drag + + + on(ownerDocument, 'mouseup', _this._disableDelayedDrag); + on(ownerDocument, 'touchend', _this._disableDelayedDrag); + on(ownerDocument, 'touchcancel', _this._disableDelayedDrag); + on(ownerDocument, 'mousemove', _this._delayedDragTouchMoveHandler); + on(ownerDocument, 'touchmove', _this._delayedDragTouchMoveHandler); + options.supportPointer && on(ownerDocument, 'pointermove', _this._delayedDragTouchMoveHandler); + _this._dragStartTimer = setTimeout(dragStartFn, options.delay); + } else { + dragStartFn(); + } + } + }, + _delayedDragTouchMoveHandler: function _delayedDragTouchMoveHandler( + /** TouchEvent|PointerEvent **/ + e) { + var touch = e.touches ? e.touches[0] : e; + + if (Math.max(Math.abs(touch.clientX - this._lastX), Math.abs(touch.clientY - this._lastY)) >= Math.floor(this.options.touchStartThreshold / (this.nativeDraggable && window.devicePixelRatio || 1))) { + this._disableDelayedDrag(); + } + }, + _disableDelayedDrag: function _disableDelayedDrag() { + dragEl && _disableDraggable(dragEl); + clearTimeout(this._dragStartTimer); + + this._disableDelayedDragEvents(); + }, + _disableDelayedDragEvents: function _disableDelayedDragEvents() { + var ownerDocument = this.el.ownerDocument; + off(ownerDocument, 'mouseup', this._disableDelayedDrag); + off(ownerDocument, 'touchend', this._disableDelayedDrag); + off(ownerDocument, 'touchcancel', this._disableDelayedDrag); + off(ownerDocument, 'mousemove', this._delayedDragTouchMoveHandler); + off(ownerDocument, 'touchmove', this._delayedDragTouchMoveHandler); + off(ownerDocument, 'pointermove', this._delayedDragTouchMoveHandler); + }, + _triggerDragStart: function _triggerDragStart( + /** Event */ + evt, + /** Touch */ + touch) { + touch = touch || evt.pointerType == 'touch' && evt; + + if (!this.nativeDraggable || touch) { + if (this.options.supportPointer) { + on(document, 'pointermove', this._onTouchMove); + } else if (touch) { + on(document, 'touchmove', this._onTouchMove); + } else { + on(document, 'mousemove', this._onTouchMove); + } + } else { + on(dragEl, 'dragend', this); + on(rootEl, 'dragstart', this._onDragStart); + } + + try { + if (document.selection) { + // Timeout neccessary for IE9 + _nextTick(function () { + document.selection.empty(); + }); + } else { + window.getSelection().removeAllRanges(); + } + } catch (err) {} + }, + _dragStarted: function _dragStarted(fallback, evt) { + + awaitingDragStarted = false; + + if (rootEl && dragEl) { + pluginEvent('dragStarted', this, { + evt: evt + }); + + if (this.nativeDraggable) { + on(document, 'dragover', _checkOutsideTargetEl); + } + + var options = this.options; // Apply effect + + !fallback && toggleClass(dragEl, options.dragClass, false); + toggleClass(dragEl, options.ghostClass, true); + Sortable.active = this; + fallback && this._appendGhost(); // Drag start event + + _dispatchEvent({ + sortable: this, + name: 'start', + originalEvent: evt + }); + } else { + this._nulling(); + } + }, + _emulateDragOver: function _emulateDragOver() { + if (touchEvt) { + this._lastX = touchEvt.clientX; + this._lastY = touchEvt.clientY; + + _hideGhostForTarget(); + + var target = document.elementFromPoint(touchEvt.clientX, touchEvt.clientY); + var parent = target; + + while (target && target.shadowRoot) { + target = target.shadowRoot.elementFromPoint(touchEvt.clientX, touchEvt.clientY); + if (target === parent) break; + parent = target; + } + + dragEl.parentNode[expando]._isOutsideThisEl(target); + + if (parent) { + do { + if (parent[expando]) { + var inserted = void 0; + inserted = parent[expando]._onDragOver({ + clientX: touchEvt.clientX, + clientY: touchEvt.clientY, + target: target, + rootEl: parent + }); + + if (inserted && !this.options.dragoverBubble) { + break; + } + } + + target = parent; // store last element + } + /* jshint boss:true */ + while (parent = parent.parentNode); + } + + _unhideGhostForTarget(); + } + }, + _onTouchMove: function _onTouchMove( + /**TouchEvent*/ + evt) { + if (tapEvt) { + var options = this.options, + fallbackTolerance = options.fallbackTolerance, + fallbackOffset = options.fallbackOffset, + touch = evt.touches ? evt.touches[0] : evt, + ghostMatrix = ghostEl && matrix(ghostEl, true), + scaleX = ghostEl && ghostMatrix && ghostMatrix.a, + scaleY = ghostEl && ghostMatrix && ghostMatrix.d, + relativeScrollOffset = PositionGhostAbsolutely && ghostRelativeParent && getRelativeScrollOffset(ghostRelativeParent), + dx = (touch.clientX - tapEvt.clientX + fallbackOffset.x) / (scaleX || 1) + (relativeScrollOffset ? relativeScrollOffset[0] - ghostRelativeParentInitialScroll[0] : 0) / (scaleX || 1), + dy = (touch.clientY - tapEvt.clientY + fallbackOffset.y) / (scaleY || 1) + (relativeScrollOffset ? relativeScrollOffset[1] - ghostRelativeParentInitialScroll[1] : 0) / (scaleY || 1); // only set the status to dragging, when we are actually dragging + + if (!Sortable.active && !awaitingDragStarted) { + if (fallbackTolerance && Math.max(Math.abs(touch.clientX - this._lastX), Math.abs(touch.clientY - this._lastY)) < fallbackTolerance) { + return; + } + + this._onDragStart(evt, true); + } + + if (ghostEl) { + if (ghostMatrix) { + ghostMatrix.e += dx - (lastDx || 0); + ghostMatrix.f += dy - (lastDy || 0); + } else { + ghostMatrix = { + a: 1, + b: 0, + c: 0, + d: 1, + e: dx, + f: dy + }; + } + + var cssMatrix = "matrix(".concat(ghostMatrix.a, ",").concat(ghostMatrix.b, ",").concat(ghostMatrix.c, ",").concat(ghostMatrix.d, ",").concat(ghostMatrix.e, ",").concat(ghostMatrix.f, ")"); + css(ghostEl, 'webkitTransform', cssMatrix); + css(ghostEl, 'mozTransform', cssMatrix); + css(ghostEl, 'msTransform', cssMatrix); + css(ghostEl, 'transform', cssMatrix); + lastDx = dx; + lastDy = dy; + touchEvt = touch; + } + + evt.cancelable && evt.preventDefault(); + } + }, + _appendGhost: function _appendGhost() { + // Bug if using scale(): https://stackoverflow.com/questions/2637058 + // Not being adjusted for + if (!ghostEl) { + var container = this.options.fallbackOnBody ? document.body : rootEl, + rect = getRect(dragEl, true, PositionGhostAbsolutely, true, container), + options = this.options; // Position absolutely + + if (PositionGhostAbsolutely) { + // Get relatively positioned parent + ghostRelativeParent = container; + + while (css(ghostRelativeParent, 'position') === 'static' && css(ghostRelativeParent, 'transform') === 'none' && ghostRelativeParent !== document) { + ghostRelativeParent = ghostRelativeParent.parentNode; + } + + if (ghostRelativeParent !== document.body && ghostRelativeParent !== document.documentElement) { + if (ghostRelativeParent === document) ghostRelativeParent = getWindowScrollingElement(); + rect.top += ghostRelativeParent.scrollTop; + rect.left += ghostRelativeParent.scrollLeft; + } else { + ghostRelativeParent = getWindowScrollingElement(); + } + + ghostRelativeParentInitialScroll = getRelativeScrollOffset(ghostRelativeParent); + } + + ghostEl = dragEl.cloneNode(true); + toggleClass(ghostEl, options.ghostClass, false); + toggleClass(ghostEl, options.fallbackClass, true); + toggleClass(ghostEl, options.dragClass, true); + css(ghostEl, 'transition', ''); + css(ghostEl, 'transform', ''); + css(ghostEl, 'box-sizing', 'border-box'); + css(ghostEl, 'margin', 0); + css(ghostEl, 'top', rect.top); + css(ghostEl, 'left', rect.left); + css(ghostEl, 'width', rect.width); + css(ghostEl, 'height', rect.height); + css(ghostEl, 'opacity', '0.8'); + css(ghostEl, 'position', PositionGhostAbsolutely ? 'absolute' : 'fixed'); + css(ghostEl, 'zIndex', '100000'); + css(ghostEl, 'pointerEvents', 'none'); + Sortable.ghost = ghostEl; + container.appendChild(ghostEl); // Set transform-origin + + css(ghostEl, 'transform-origin', tapDistanceLeft / parseInt(ghostEl.style.width) * 100 + '% ' + tapDistanceTop / parseInt(ghostEl.style.height) * 100 + '%'); + } + }, + _onDragStart: function _onDragStart( + /**Event*/ + evt, + /**boolean*/ + fallback) { + var _this = this; + + var dataTransfer = evt.dataTransfer; + var options = _this.options; + pluginEvent('dragStart', this, { + evt: evt + }); + + if (Sortable.eventCanceled) { + this._onDrop(); + + return; + } + + pluginEvent('setupClone', this); + + if (!Sortable.eventCanceled) { + cloneEl = clone(dragEl); + cloneEl.draggable = false; + cloneEl.style['will-change'] = ''; + + this._hideClone(); + + toggleClass(cloneEl, this.options.chosenClass, false); + Sortable.clone = cloneEl; + } // #1143: IFrame support workaround + + + _this.cloneId = _nextTick(function () { + pluginEvent('clone', _this); + if (Sortable.eventCanceled) return; + + if (!_this.options.removeCloneOnHide) { + rootEl.insertBefore(cloneEl, dragEl); + } + + _this._hideClone(); + + _dispatchEvent({ + sortable: _this, + name: 'clone' + }); + }); + !fallback && toggleClass(dragEl, options.dragClass, true); // Set proper drop events + + if (fallback) { + ignoreNextClick = true; + _this._loopId = setInterval(_this._emulateDragOver, 50); + } else { + // Undo what was set in _prepareDragStart before drag started + off(document, 'mouseup', _this._onDrop); + off(document, 'touchend', _this._onDrop); + off(document, 'touchcancel', _this._onDrop); + + if (dataTransfer) { + dataTransfer.effectAllowed = 'move'; + options.setData && options.setData.call(_this, dataTransfer, dragEl); + } + + on(document, 'drop', _this); // #1276 fix: + + css(dragEl, 'transform', 'translateZ(0)'); + } + + awaitingDragStarted = true; + _this._dragStartId = _nextTick(_this._dragStarted.bind(_this, fallback, evt)); + on(document, 'selectstart', _this); + moved = true; + + if (Safari) { + css(document.body, 'user-select', 'none'); + } + }, + // Returns true - if no further action is needed (either inserted or another condition) + _onDragOver: function _onDragOver( + /**Event*/ + evt) { + var el = this.el, + target = evt.target, + dragRect, + targetRect, + revert, + options = this.options, + group = options.group, + activeSortable = Sortable.active, + isOwner = activeGroup === group, + canSort = options.sort, + fromSortable = putSortable || activeSortable, + vertical, + _this = this, + completedFired = false; + + if (_silent) return; + + function dragOverEvent(name, extra) { + pluginEvent(name, _this, _objectSpread({ + evt: evt, + isOwner: isOwner, + axis: vertical ? 'vertical' : 'horizontal', + revert: revert, + dragRect: dragRect, + targetRect: targetRect, + canSort: canSort, + fromSortable: fromSortable, + target: target, + completed: completed, + onMove: function onMove(target, after) { + return _onMove(rootEl, el, dragEl, dragRect, target, getRect(target), evt, after); + }, + changed: changed + }, extra)); + } // Capture animation state + + + function capture() { + dragOverEvent('dragOverAnimationCapture'); + + _this.captureAnimationState(); + + if (_this !== fromSortable) { + fromSortable.captureAnimationState(); + } + } // Return invocation when dragEl is inserted (or completed) + + + function completed(insertion) { + dragOverEvent('dragOverCompleted', { + insertion: insertion + }); + + if (insertion) { + // Clones must be hidden before folding animation to capture dragRectAbsolute properly + if (isOwner) { + activeSortable._hideClone(); + } else { + activeSortable._showClone(_this); + } + + if (_this !== fromSortable) { + // Set ghost class to new sortable's ghost class + toggleClass(dragEl, putSortable ? putSortable.options.ghostClass : activeSortable.options.ghostClass, false); + toggleClass(dragEl, options.ghostClass, true); + } + + if (putSortable !== _this && _this !== Sortable.active) { + putSortable = _this; + } else if (_this === Sortable.active && putSortable) { + putSortable = null; + } // Animation + + + if (fromSortable === _this) { + _this._ignoreWhileAnimating = target; + } + + _this.animateAll(function () { + dragOverEvent('dragOverAnimationComplete'); + _this._ignoreWhileAnimating = null; + }); + + if (_this !== fromSortable) { + fromSortable.animateAll(); + fromSortable._ignoreWhileAnimating = null; + } + } // Null lastTarget if it is not inside a previously swapped element + + + if (target === dragEl && !dragEl.animated || target === el && !target.animated) { + lastTarget = null; + } // no bubbling and not fallback + + + if (!options.dragoverBubble && !evt.rootEl && target !== document) { + dragEl.parentNode[expando]._isOutsideThisEl(evt.target); // Do not detect for empty insert if already inserted + + + !insertion && nearestEmptyInsertDetectEvent(evt); + } + + !options.dragoverBubble && evt.stopPropagation && evt.stopPropagation(); + return completedFired = true; + } // Call when dragEl has been inserted + + + function changed() { + newIndex = index(dragEl); + newDraggableIndex = index(dragEl, options.draggable); + + _dispatchEvent({ + sortable: _this, + name: 'change', + toEl: el, + newIndex: newIndex, + newDraggableIndex: newDraggableIndex, + originalEvent: evt + }); + } + + if (evt.preventDefault !== void 0) { + evt.cancelable && evt.preventDefault(); + } + + target = closest(target, options.draggable, el, true); + dragOverEvent('dragOver'); + if (Sortable.eventCanceled) return completedFired; + + if (dragEl.contains(evt.target) || target.animated && target.animatingX && target.animatingY || _this._ignoreWhileAnimating === target) { + return completed(false); + } + + ignoreNextClick = false; + + if (activeSortable && !options.disabled && (isOwner ? canSort || (revert = !rootEl.contains(dragEl)) // Reverting item into the original list + : putSortable === this || (this.lastPutMode = activeGroup.checkPull(this, activeSortable, dragEl, evt)) && group.checkPut(this, activeSortable, dragEl, evt))) { + vertical = this._getDirection(evt, target) === 'vertical'; + dragRect = getRect(dragEl); + dragOverEvent('dragOverValid'); + if (Sortable.eventCanceled) return completedFired; + + if (revert) { + parentEl = rootEl; // actualization + + capture(); + + this._hideClone(); + + dragOverEvent('revert'); + + if (!Sortable.eventCanceled) { + if (nextEl) { + rootEl.insertBefore(dragEl, nextEl); + } else { + rootEl.appendChild(dragEl); + } + } + + return completed(true); + } + + var elLastChild = lastChild(el, options.draggable); + + if (!elLastChild || _ghostIsLast(evt, vertical, this) && !elLastChild.animated) { + // If already at end of list: Do not insert + if (elLastChild === dragEl) { + return completed(false); + } // assign target only if condition is true + + + if (elLastChild && el === evt.target) { + target = elLastChild; + } + + if (target) { + targetRect = getRect(target); + } + + if (_onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, !!target) !== false) { + capture(); + el.appendChild(dragEl); + parentEl = el; // actualization + + changed(); + return completed(true); + } + } else if (target.parentNode === el) { + targetRect = getRect(target); + var direction = 0, + targetBeforeFirstSwap, + differentLevel = dragEl.parentNode !== el, + differentRowCol = !_dragElInRowColumn(dragEl.animated && dragEl.toRect || dragRect, target.animated && target.toRect || targetRect, vertical), + side1 = vertical ? 'top' : 'left', + scrolledPastTop = isScrolledPast(target, 'top', 'top') || isScrolledPast(dragEl, 'top', 'top'), + scrollBefore = scrolledPastTop ? scrolledPastTop.scrollTop : void 0; + + if (lastTarget !== target) { + targetBeforeFirstSwap = targetRect[side1]; + pastFirstInvertThresh = false; + isCircumstantialInvert = !differentRowCol && options.invertSwap || differentLevel; + } + + direction = _getSwapDirection(evt, target, targetRect, vertical, differentRowCol ? 1 : options.swapThreshold, options.invertedSwapThreshold == null ? options.swapThreshold : options.invertedSwapThreshold, isCircumstantialInvert, lastTarget === target); + var sibling; + + if (direction !== 0) { + // Check if target is beside dragEl in respective direction (ignoring hidden elements) + var dragIndex = index(dragEl); + + do { + dragIndex -= direction; + sibling = parentEl.children[dragIndex]; + } while (sibling && (css(sibling, 'display') === 'none' || sibling === ghostEl)); + } // If dragEl is already beside target: Do not insert + + + if (direction === 0 || sibling === target) { + return completed(false); + } + + lastTarget = target; + lastDirection = direction; + var nextSibling = target.nextElementSibling, + after = false; + after = direction === 1; + + var moveVector = _onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, after); + + if (moveVector !== false) { + if (moveVector === 1 || moveVector === -1) { + after = moveVector === 1; + } + + _silent = true; + setTimeout(_unsilent, 30); + capture(); + + if (after && !nextSibling) { + el.appendChild(dragEl); + } else { + target.parentNode.insertBefore(dragEl, after ? nextSibling : target); + } // Undo chrome's scroll adjustment (has no effect on other browsers) + + + if (scrolledPastTop) { + scrollBy(scrolledPastTop, 0, scrollBefore - scrolledPastTop.scrollTop); + } + + parentEl = dragEl.parentNode; // actualization + // must be done before animation + + if (targetBeforeFirstSwap !== undefined && !isCircumstantialInvert) { + targetMoveDistance = Math.abs(targetBeforeFirstSwap - getRect(target)[side1]); + } + + changed(); + return completed(true); + } + } + + if (el.contains(dragEl)) { + return completed(false); + } + } + + return false; + }, + _ignoreWhileAnimating: null, + _offMoveEvents: function _offMoveEvents() { + off(document, 'mousemove', this._onTouchMove); + off(document, 'touchmove', this._onTouchMove); + off(document, 'pointermove', this._onTouchMove); + off(document, 'dragover', nearestEmptyInsertDetectEvent); + off(document, 'mousemove', nearestEmptyInsertDetectEvent); + off(document, 'touchmove', nearestEmptyInsertDetectEvent); + }, + _offUpEvents: function _offUpEvents() { + var ownerDocument = this.el.ownerDocument; + off(ownerDocument, 'mouseup', this._onDrop); + off(ownerDocument, 'touchend', this._onDrop); + off(ownerDocument, 'pointerup', this._onDrop); + off(ownerDocument, 'touchcancel', this._onDrop); + off(document, 'selectstart', this); + }, + _onDrop: function _onDrop( + /**Event*/ + evt) { + var el = this.el, + options = this.options; // Get the index of the dragged element within its parent + + newIndex = index(dragEl); + newDraggableIndex = index(dragEl, options.draggable); + pluginEvent('drop', this, { + evt: evt + }); + parentEl = dragEl && dragEl.parentNode; // Get again after plugin event + + newIndex = index(dragEl); + newDraggableIndex = index(dragEl, options.draggable); + + if (Sortable.eventCanceled) { + this._nulling(); + + return; + } + + awaitingDragStarted = false; + isCircumstantialInvert = false; + pastFirstInvertThresh = false; + clearInterval(this._loopId); + clearTimeout(this._dragStartTimer); + + _cancelNextTick(this.cloneId); + + _cancelNextTick(this._dragStartId); // Unbind events + + + if (this.nativeDraggable) { + off(document, 'drop', this); + off(el, 'dragstart', this._onDragStart); + } + + this._offMoveEvents(); + + this._offUpEvents(); + + if (Safari) { + css(document.body, 'user-select', ''); + } + + css(dragEl, 'transform', ''); + + if (evt) { + if (moved) { + evt.cancelable && evt.preventDefault(); + !options.dropBubble && evt.stopPropagation(); + } + + ghostEl && ghostEl.parentNode && ghostEl.parentNode.removeChild(ghostEl); + + if (rootEl === parentEl || putSortable && putSortable.lastPutMode !== 'clone') { + // Remove clone(s) + cloneEl && cloneEl.parentNode && cloneEl.parentNode.removeChild(cloneEl); + } + + if (dragEl) { + if (this.nativeDraggable) { + off(dragEl, 'dragend', this); + } + + _disableDraggable(dragEl); + + dragEl.style['will-change'] = ''; // Remove classes + // ghostClass is added in dragStarted + + if (moved && !awaitingDragStarted) { + toggleClass(dragEl, putSortable ? putSortable.options.ghostClass : this.options.ghostClass, false); + } + + toggleClass(dragEl, this.options.chosenClass, false); // Drag stop event + + _dispatchEvent({ + sortable: this, + name: 'unchoose', + toEl: parentEl, + newIndex: null, + newDraggableIndex: null, + originalEvent: evt + }); + + if (rootEl !== parentEl) { + if (newIndex >= 0) { + // Add event + _dispatchEvent({ + rootEl: parentEl, + name: 'add', + toEl: parentEl, + fromEl: rootEl, + originalEvent: evt + }); // Remove event + + + _dispatchEvent({ + sortable: this, + name: 'remove', + toEl: parentEl, + originalEvent: evt + }); // drag from one list and drop into another + + + _dispatchEvent({ + rootEl: parentEl, + name: 'sort', + toEl: parentEl, + fromEl: rootEl, + originalEvent: evt + }); + + _dispatchEvent({ + sortable: this, + name: 'sort', + toEl: parentEl, + originalEvent: evt + }); + } + + putSortable && putSortable.save(); + } else { + if (newIndex !== oldIndex) { + if (newIndex >= 0) { + // drag & drop within the same list + _dispatchEvent({ + sortable: this, + name: 'update', + toEl: parentEl, + originalEvent: evt + }); + + _dispatchEvent({ + sortable: this, + name: 'sort', + toEl: parentEl, + originalEvent: evt + }); + } + } + } + + if (Sortable.active) { + /* jshint eqnull:true */ + if (newIndex == null || newIndex === -1) { + newIndex = oldIndex; + newDraggableIndex = oldDraggableIndex; + } + + _dispatchEvent({ + sortable: this, + name: 'end', + toEl: parentEl, + originalEvent: evt + }); // Save sorting + + + this.save(); + } + } + } + + this._nulling(); + }, + _nulling: function _nulling() { + pluginEvent('nulling', this); + rootEl = dragEl = parentEl = ghostEl = nextEl = cloneEl = lastDownEl = cloneHidden = tapEvt = touchEvt = moved = newIndex = newDraggableIndex = oldIndex = oldDraggableIndex = lastTarget = lastDirection = putSortable = activeGroup = Sortable.dragged = Sortable.ghost = Sortable.clone = Sortable.active = null; + savedInputChecked.forEach(function (el) { + el.checked = true; + }); + savedInputChecked.length = lastDx = lastDy = 0; + }, + handleEvent: function handleEvent( + /**Event*/ + evt) { + switch (evt.type) { + case 'drop': + case 'dragend': + this._onDrop(evt); + + break; + + case 'dragenter': + case 'dragover': + if (dragEl) { + this._onDragOver(evt); + + _globalDragOver(evt); + } + + break; + + case 'selectstart': + evt.preventDefault(); + break; + } + }, + + /** + * Serializes the item into an array of string. + * @returns {String[]} + */ + toArray: function toArray() { + var order = [], + el, + children = this.el.children, + i = 0, + n = children.length, + options = this.options; + + for (; i < n; i++) { + el = children[i]; + + if (closest(el, options.draggable, this.el, false)) { + order.push(el.getAttribute(options.dataIdAttr) || _generateId(el)); + } + } + + return order; + }, + + /** + * Sorts the elements according to the array. + * @param {String[]} order order of the items + */ + sort: function sort(order) { + var items = {}, + rootEl = this.el; + this.toArray().forEach(function (id, i) { + var el = rootEl.children[i]; + + if (closest(el, this.options.draggable, rootEl, false)) { + items[id] = el; + } + }, this); + order.forEach(function (id) { + if (items[id]) { + rootEl.removeChild(items[id]); + rootEl.appendChild(items[id]); + } + }); + }, + + /** + * Save the current sorting + */ + save: function save() { + var store = this.options.store; + store && store.set && store.set(this); + }, + + /** + * For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree. + * @param {HTMLElement} el + * @param {String} [selector] default: `options.draggable` + * @returns {HTMLElement|null} + */ + closest: function closest$1(el, selector) { + return closest(el, selector || this.options.draggable, this.el, false); + }, + + /** + * Set/get option + * @param {string} name + * @param {*} [value] + * @returns {*} + */ + option: function option(name, value) { + var options = this.options; + + if (value === void 0) { + return options[name]; + } else { + var modifiedValue = PluginManager.modifyOption(this, name, value); + + if (typeof modifiedValue !== 'undefined') { + options[name] = modifiedValue; + } else { + options[name] = value; + } + + if (name === 'group') { + _prepareGroup(options); + } + } + }, + + /** + * Destroy + */ + destroy: function destroy() { + pluginEvent('destroy', this); + var el = this.el; + el[expando] = null; + off(el, 'mousedown', this._onTapStart); + off(el, 'touchstart', this._onTapStart); + off(el, 'pointerdown', this._onTapStart); + + if (this.nativeDraggable) { + off(el, 'dragover', this); + off(el, 'dragenter', this); + } // Remove draggable attributes + + + Array.prototype.forEach.call(el.querySelectorAll('[draggable]'), function (el) { + el.removeAttribute('draggable'); + }); + + this._onDrop(); + + this._disableDelayedDragEvents(); + + sortables.splice(sortables.indexOf(this.el), 1); + this.el = el = null; + }, + _hideClone: function _hideClone() { + if (!cloneHidden) { + pluginEvent('hideClone', this); + if (Sortable.eventCanceled) return; + css(cloneEl, 'display', 'none'); + + if (this.options.removeCloneOnHide && cloneEl.parentNode) { + cloneEl.parentNode.removeChild(cloneEl); + } + + cloneHidden = true; + } + }, + _showClone: function _showClone(putSortable) { + if (putSortable.lastPutMode !== 'clone') { + this._hideClone(); + + return; + } + + if (cloneHidden) { + pluginEvent('showClone', this); + if (Sortable.eventCanceled) return; // show clone at dragEl or original position + + if (rootEl.contains(dragEl) && !this.options.group.revertClone) { + rootEl.insertBefore(cloneEl, dragEl); + } else if (nextEl) { + rootEl.insertBefore(cloneEl, nextEl); + } else { + rootEl.appendChild(cloneEl); + } + + if (this.options.group.revertClone) { + this.animate(dragEl, cloneEl); + } + + css(cloneEl, 'display', ''); + cloneHidden = false; + } + } + }; + + function _globalDragOver( + /**Event*/ + evt) { + if (evt.dataTransfer) { + evt.dataTransfer.dropEffect = 'move'; + } + + evt.cancelable && evt.preventDefault(); + } + + function _onMove(fromEl, toEl, dragEl, dragRect, targetEl, targetRect, originalEvent, willInsertAfter) { + var evt, + sortable = fromEl[expando], + onMoveFn = sortable.options.onMove, + retVal; // Support for new CustomEvent feature + + if (window.CustomEvent && !IE11OrLess && !Edge) { + evt = new CustomEvent('move', { + bubbles: true, + cancelable: true + }); + } else { + evt = document.createEvent('Event'); + evt.initEvent('move', true, true); + } + + evt.to = toEl; + evt.from = fromEl; + evt.dragged = dragEl; + evt.draggedRect = dragRect; + evt.related = targetEl || toEl; + evt.relatedRect = targetRect || getRect(toEl); + evt.willInsertAfter = willInsertAfter; + evt.originalEvent = originalEvent; + fromEl.dispatchEvent(evt); + + if (onMoveFn) { + retVal = onMoveFn.call(sortable, evt, originalEvent); + } + + return retVal; + } + + function _disableDraggable(el) { + el.draggable = false; + } + + function _unsilent() { + _silent = false; + } + + function _ghostIsLast(evt, vertical, sortable) { + var rect = getRect(lastChild(sortable.el, sortable.options.draggable)); + var spacer = 10; + return vertical ? evt.clientX > rect.right + spacer || evt.clientX <= rect.right && evt.clientY > rect.bottom && evt.clientX >= rect.left : evt.clientX > rect.right && evt.clientY > rect.top || evt.clientX <= rect.right && evt.clientY > rect.bottom + spacer; + } + + function _getSwapDirection(evt, target, targetRect, vertical, swapThreshold, invertedSwapThreshold, invertSwap, isLastTarget) { + var mouseOnAxis = vertical ? evt.clientY : evt.clientX, + targetLength = vertical ? targetRect.height : targetRect.width, + targetS1 = vertical ? targetRect.top : targetRect.left, + targetS2 = vertical ? targetRect.bottom : targetRect.right, + invert = false; + + if (!invertSwap) { + // Never invert or create dragEl shadow when target movemenet causes mouse to move past the end of regular swapThreshold + if (isLastTarget && targetMoveDistance < targetLength * swapThreshold) { + // multiplied only by swapThreshold because mouse will already be inside target by (1 - threshold) * targetLength / 2 + // check if past first invert threshold on side opposite of lastDirection + if (!pastFirstInvertThresh && (lastDirection === 1 ? mouseOnAxis > targetS1 + targetLength * invertedSwapThreshold / 2 : mouseOnAxis < targetS2 - targetLength * invertedSwapThreshold / 2)) { + // past first invert threshold, do not restrict inverted threshold to dragEl shadow + pastFirstInvertThresh = true; + } + + if (!pastFirstInvertThresh) { + // dragEl shadow (target move distance shadow) + if (lastDirection === 1 ? mouseOnAxis < targetS1 + targetMoveDistance // over dragEl shadow + : mouseOnAxis > targetS2 - targetMoveDistance) { + return -lastDirection; + } + } else { + invert = true; + } + } else { + // Regular + if (mouseOnAxis > targetS1 + targetLength * (1 - swapThreshold) / 2 && mouseOnAxis < targetS2 - targetLength * (1 - swapThreshold) / 2) { + return _getInsertDirection(target); + } + } + } + + invert = invert || invertSwap; + + if (invert) { + // Invert of regular + if (mouseOnAxis < targetS1 + targetLength * invertedSwapThreshold / 2 || mouseOnAxis > targetS2 - targetLength * invertedSwapThreshold / 2) { + return mouseOnAxis > targetS1 + targetLength / 2 ? 1 : -1; + } + } + + return 0; + } + /** + * Gets the direction dragEl must be swapped relative to target in order to make it + * seem that dragEl has been "inserted" into that element's position + * @param {HTMLElement} target The target whose position dragEl is being inserted at + * @return {Number} Direction dragEl must be swapped + */ + + + function _getInsertDirection(target) { + if (index(dragEl) < index(target)) { + return 1; + } else { + return -1; + } + } + /** + * Generate id + * @param {HTMLElement} el + * @returns {String} + * @private + */ + + + function _generateId(el) { + var str = el.tagName + el.className + el.src + el.href + el.textContent, + i = str.length, + sum = 0; + + while (i--) { + sum += str.charCodeAt(i); + } + + return sum.toString(36); + } + + function _saveInputCheckedState(root) { + savedInputChecked.length = 0; + var inputs = root.getElementsByTagName('input'); + var idx = inputs.length; + + while (idx--) { + var el = inputs[idx]; + el.checked && savedInputChecked.push(el); + } + } + + function _nextTick(fn) { + return setTimeout(fn, 0); + } + + function _cancelNextTick(id) { + return clearTimeout(id); + } // Fixed #973: + + + if (documentExists) { + on(document, 'touchmove', function (evt) { + if ((Sortable.active || awaitingDragStarted) && evt.cancelable) { + evt.preventDefault(); + } + }); + } // Export utils + + + Sortable.utils = { + on: on, + off: off, + css: css, + find: find, + is: function is(el, selector) { + return !!closest(el, selector, el, false); + }, + extend: extend, + throttle: throttle, + closest: closest, + toggleClass: toggleClass, + clone: clone, + index: index, + nextTick: _nextTick, + cancelNextTick: _cancelNextTick, + detectDirection: _detectDirection, + getChild: getChild + }; + /** + * Get the Sortable instance of an element + * @param {HTMLElement} element The element + * @return {Sortable|undefined} The instance of Sortable + */ + + Sortable.get = function (element) { + return element[expando]; + }; + /** + * Mount a plugin to Sortable + * @param {...SortablePlugin|SortablePlugin[]} plugins Plugins being mounted + */ + + + Sortable.mount = function () { + for (var _len = arguments.length, plugins = new Array(_len), _key = 0; _key < _len; _key++) { + plugins[_key] = arguments[_key]; + } + + if (plugins[0].constructor === Array) plugins = plugins[0]; + plugins.forEach(function (plugin) { + if (!plugin.prototype || !plugin.prototype.constructor) { + throw "Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(plugin)); + } + + if (plugin.utils) Sortable.utils = _objectSpread({}, Sortable.utils, plugin.utils); + PluginManager.mount(plugin); + }); + }; + /** + * Create sortable instance + * @param {HTMLElement} el + * @param {Object} [options] + */ + + + Sortable.create = function (el, options) { + return new Sortable(el, options); + }; // Export + + + Sortable.version = version; + + var autoScrolls = [], + scrollEl, + scrollRootEl, + scrolling = false, + lastAutoScrollX, + lastAutoScrollY, + touchEvt$1, + pointerElemChangedInterval; + + function AutoScrollPlugin() { + function AutoScroll() { + this.defaults = { + scroll: true, + scrollSensitivity: 30, + scrollSpeed: 10, + bubbleScroll: true + }; // Bind all private methods + + for (var fn in this) { + if (fn.charAt(0) === '_' && typeof this[fn] === 'function') { + this[fn] = this[fn].bind(this); + } + } + } + + AutoScroll.prototype = { + dragStarted: function dragStarted(_ref) { + var originalEvent = _ref.originalEvent; + + if (this.sortable.nativeDraggable) { + on(document, 'dragover', this._handleAutoScroll); + } else { + if (this.options.supportPointer) { + on(document, 'pointermove', this._handleFallbackAutoScroll); + } else if (originalEvent.touches) { + on(document, 'touchmove', this._handleFallbackAutoScroll); + } else { + on(document, 'mousemove', this._handleFallbackAutoScroll); + } + } + }, + dragOverCompleted: function dragOverCompleted(_ref2) { + var originalEvent = _ref2.originalEvent; + + // For when bubbling is canceled and using fallback (fallback 'touchmove' always reached) + if (!this.options.dragOverBubble && !originalEvent.rootEl) { + this._handleAutoScroll(originalEvent); + } + }, + drop: function drop() { + if (this.sortable.nativeDraggable) { + off(document, 'dragover', this._handleAutoScroll); + } else { + off(document, 'pointermove', this._handleFallbackAutoScroll); + off(document, 'touchmove', this._handleFallbackAutoScroll); + off(document, 'mousemove', this._handleFallbackAutoScroll); + } + + clearPointerElemChangedInterval(); + clearAutoScrolls(); + cancelThrottle(); + }, + nulling: function nulling() { + touchEvt$1 = scrollRootEl = scrollEl = scrolling = pointerElemChangedInterval = lastAutoScrollX = lastAutoScrollY = null; + autoScrolls.length = 0; + }, + _handleFallbackAutoScroll: function _handleFallbackAutoScroll(evt) { + this._handleAutoScroll(evt, true); + }, + _handleAutoScroll: function _handleAutoScroll(evt, fallback) { + var _this = this; + + var x = (evt.touches ? evt.touches[0] : evt).clientX, + y = (evt.touches ? evt.touches[0] : evt).clientY, + elem = document.elementFromPoint(x, y); + touchEvt$1 = evt; // IE does not seem to have native autoscroll, + // Edge's autoscroll seems too conditional, + // MACOS Safari does not have autoscroll, + // Firefox and Chrome are good + + if (fallback || Edge || IE11OrLess || Safari) { + autoScroll(evt, this.options, elem, fallback); // Listener for pointer element change + + var ogElemScroller = getParentAutoScrollElement(elem, true); + + if (scrolling && (!pointerElemChangedInterval || x !== lastAutoScrollX || y !== lastAutoScrollY)) { + pointerElemChangedInterval && clearPointerElemChangedInterval(); // Detect for pointer elem change, emulating native DnD behaviour + + pointerElemChangedInterval = setInterval(function () { + var newElem = getParentAutoScrollElement(document.elementFromPoint(x, y), true); + + if (newElem !== ogElemScroller) { + ogElemScroller = newElem; + clearAutoScrolls(); + } + + autoScroll(evt, _this.options, newElem, fallback); + }, 10); + lastAutoScrollX = x; + lastAutoScrollY = y; + } + } else { + // if DnD is enabled (and browser has good autoscrolling), first autoscroll will already scroll, so get parent autoscroll of first autoscroll + if (!this.options.bubbleScroll || getParentAutoScrollElement(elem, true) === getWindowScrollingElement()) { + clearAutoScrolls(); + return; + } + + autoScroll(evt, this.options, getParentAutoScrollElement(elem, false), false); + } + } + }; + return _extends(AutoScroll, { + pluginName: 'scroll', + initializeByDefault: true + }); + } + + function clearAutoScrolls() { + autoScrolls.forEach(function (autoScroll) { + clearInterval(autoScroll.pid); + }); + autoScrolls = []; + } + + function clearPointerElemChangedInterval() { + clearInterval(pointerElemChangedInterval); + } + + var autoScroll = throttle(function (evt, options, rootEl, isFallback) { + // Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=505521 + if (!options.scroll) return; + var x = (evt.touches ? evt.touches[0] : evt).clientX, + y = (evt.touches ? evt.touches[0] : evt).clientY, + sens = options.scrollSensitivity, + speed = options.scrollSpeed, + winScroller = getWindowScrollingElement(); + var scrollThisInstance = false, + scrollCustomFn; // New scroll root, set scrollEl + + if (scrollRootEl !== rootEl) { + scrollRootEl = rootEl; + clearAutoScrolls(); + scrollEl = options.scroll; + scrollCustomFn = options.scrollFn; + + if (scrollEl === true) { + scrollEl = getParentAutoScrollElement(rootEl, true); + } + } + + var layersOut = 0; + var currentParent = scrollEl; + + do { + var el = currentParent, + rect = getRect(el), + top = rect.top, + bottom = rect.bottom, + left = rect.left, + right = rect.right, + width = rect.width, + height = rect.height, + canScrollX = void 0, + canScrollY = void 0, + scrollWidth = el.scrollWidth, + scrollHeight = el.scrollHeight, + elCSS = css(el), + scrollPosX = el.scrollLeft, + scrollPosY = el.scrollTop; + + if (el === winScroller) { + canScrollX = width < scrollWidth && (elCSS.overflowX === 'auto' || elCSS.overflowX === 'scroll' || elCSS.overflowX === 'visible'); + canScrollY = height < scrollHeight && (elCSS.overflowY === 'auto' || elCSS.overflowY === 'scroll' || elCSS.overflowY === 'visible'); + } else { + canScrollX = width < scrollWidth && (elCSS.overflowX === 'auto' || elCSS.overflowX === 'scroll'); + canScrollY = height < scrollHeight && (elCSS.overflowY === 'auto' || elCSS.overflowY === 'scroll'); + } + + var vx = canScrollX && (Math.abs(right - x) <= sens && scrollPosX + width < scrollWidth) - (Math.abs(left - x) <= sens && !!scrollPosX); + var vy = canScrollY && (Math.abs(bottom - y) <= sens && scrollPosY + height < scrollHeight) - (Math.abs(top - y) <= sens && !!scrollPosY); + + if (!autoScrolls[layersOut]) { + for (var i = 0; i <= layersOut; i++) { + if (!autoScrolls[i]) { + autoScrolls[i] = {}; + } + } + } + + if (autoScrolls[layersOut].vx != vx || autoScrolls[layersOut].vy != vy || autoScrolls[layersOut].el !== el) { + autoScrolls[layersOut].el = el; + autoScrolls[layersOut].vx = vx; + autoScrolls[layersOut].vy = vy; + clearInterval(autoScrolls[layersOut].pid); + + if (vx != 0 || vy != 0) { + scrollThisInstance = true; + /* jshint loopfunc:true */ + + autoScrolls[layersOut].pid = setInterval(function () { + // emulate drag over during autoscroll (fallback), emulating native DnD behaviour + if (isFallback && this.layer === 0) { + Sortable.active._onTouchMove(touchEvt$1); // To move ghost if it is positioned absolutely + + } + + var scrollOffsetY = autoScrolls[this.layer].vy ? autoScrolls[this.layer].vy * speed : 0; + var scrollOffsetX = autoScrolls[this.layer].vx ? autoScrolls[this.layer].vx * speed : 0; + + if (typeof scrollCustomFn === 'function') { + if (scrollCustomFn.call(Sortable.dragged.parentNode[expando], scrollOffsetX, scrollOffsetY, evt, touchEvt$1, autoScrolls[this.layer].el) !== 'continue') { + return; + } + } + + scrollBy(autoScrolls[this.layer].el, scrollOffsetX, scrollOffsetY); + }.bind({ + layer: layersOut + }), 24); + } + } + + layersOut++; + } while (options.bubbleScroll && currentParent !== winScroller && (currentParent = getParentAutoScrollElement(currentParent, false))); + + scrolling = scrollThisInstance; // in case another function catches scrolling as false in between when it is not + }, 30); + + var drop = function drop(_ref) { + var originalEvent = _ref.originalEvent, + putSortable = _ref.putSortable, + dragEl = _ref.dragEl, + activeSortable = _ref.activeSortable, + dispatchSortableEvent = _ref.dispatchSortableEvent, + hideGhostForTarget = _ref.hideGhostForTarget, + unhideGhostForTarget = _ref.unhideGhostForTarget; + if (!originalEvent) return; + var toSortable = putSortable || activeSortable; + hideGhostForTarget(); + var touch = originalEvent.changedTouches && originalEvent.changedTouches.length ? originalEvent.changedTouches[0] : originalEvent; + var target = document.elementFromPoint(touch.clientX, touch.clientY); + unhideGhostForTarget(); + + if (toSortable && !toSortable.el.contains(target)) { + dispatchSortableEvent('spill'); + this.onSpill({ + dragEl: dragEl, + putSortable: putSortable + }); + } + }; + + function Revert() {} + + Revert.prototype = { + startIndex: null, + dragStart: function dragStart(_ref2) { + var oldDraggableIndex = _ref2.oldDraggableIndex; + this.startIndex = oldDraggableIndex; + }, + onSpill: function onSpill(_ref3) { + var dragEl = _ref3.dragEl, + putSortable = _ref3.putSortable; + this.sortable.captureAnimationState(); + + if (putSortable) { + putSortable.captureAnimationState(); + } + + var nextSibling = getChild(this.sortable.el, this.startIndex, this.options); + + if (nextSibling) { + this.sortable.el.insertBefore(dragEl, nextSibling); + } else { + this.sortable.el.appendChild(dragEl); + } + + this.sortable.animateAll(); + + if (putSortable) { + putSortable.animateAll(); + } + }, + drop: drop + }; + + _extends(Revert, { + pluginName: 'revertOnSpill' + }); + + function Remove() {} + + Remove.prototype = { + onSpill: function onSpill(_ref4) { + var dragEl = _ref4.dragEl, + putSortable = _ref4.putSortable; + var parentSortable = putSortable || this.sortable; + parentSortable.captureAnimationState(); + dragEl.parentNode && dragEl.parentNode.removeChild(dragEl); + parentSortable.animateAll(); + }, + drop: drop + }; + + _extends(Remove, { + pluginName: 'removeOnSpill' + }); + + var lastSwapEl; + + function SwapPlugin() { + function Swap() { + this.defaults = { + swapClass: 'sortable-swap-highlight' + }; + } + + Swap.prototype = { + dragStart: function dragStart(_ref) { + var dragEl = _ref.dragEl; + lastSwapEl = dragEl; + }, + dragOverValid: function dragOverValid(_ref2) { + var completed = _ref2.completed, + target = _ref2.target, + onMove = _ref2.onMove, + activeSortable = _ref2.activeSortable, + changed = _ref2.changed, + cancel = _ref2.cancel; + if (!activeSortable.options.swap) return; + var el = this.sortable.el, + options = this.options; + + if (target && target !== el) { + var prevSwapEl = lastSwapEl; + + if (onMove(target) !== false) { + toggleClass(target, options.swapClass, true); + lastSwapEl = target; + } else { + lastSwapEl = null; + } + + if (prevSwapEl && prevSwapEl !== lastSwapEl) { + toggleClass(prevSwapEl, options.swapClass, false); + } + } + + changed(); + completed(true); + cancel(); + }, + drop: function drop(_ref3) { + var activeSortable = _ref3.activeSortable, + putSortable = _ref3.putSortable, + dragEl = _ref3.dragEl; + var toSortable = putSortable || this.sortable; + var options = this.options; + lastSwapEl && toggleClass(lastSwapEl, options.swapClass, false); + + if (lastSwapEl && (options.swap || putSortable && putSortable.options.swap)) { + if (dragEl !== lastSwapEl) { + toSortable.captureAnimationState(); + if (toSortable !== activeSortable) activeSortable.captureAnimationState(); + swapNodes(dragEl, lastSwapEl); + toSortable.animateAll(); + if (toSortable !== activeSortable) activeSortable.animateAll(); + } + } + }, + nulling: function nulling() { + lastSwapEl = null; + } + }; + return _extends(Swap, { + pluginName: 'swap', + eventProperties: function eventProperties() { + return { + swapItem: lastSwapEl + }; + } + }); + } + + function swapNodes(n1, n2) { + var p1 = n1.parentNode, + p2 = n2.parentNode, + i1, + i2; + if (!p1 || !p2 || p1.isEqualNode(n2) || p2.isEqualNode(n1)) return; + i1 = index(n1); + i2 = index(n2); + + if (p1.isEqualNode(p2) && i1 < i2) { + i2++; + } + + p1.insertBefore(n2, p1.children[i1]); + p2.insertBefore(n1, p2.children[i2]); + } + + var multiDragElements = [], + multiDragClones = [], + lastMultiDragSelect, + // for selection with modifier key down (SHIFT) + multiDragSortable, + initialFolding = false, + // Initial multi-drag fold when drag started + folding = false, + // Folding any other time + dragStarted = false, + dragEl$1, + clonesFromRect, + clonesHidden; + + function MultiDragPlugin() { + function MultiDrag(sortable) { + // Bind all private methods + for (var fn in this) { + if (fn.charAt(0) === '_' && typeof this[fn] === 'function') { + this[fn] = this[fn].bind(this); + } + } + + if (sortable.options.supportPointer) { + on(document, 'pointerup', this._deselectMultiDrag); + } else { + on(document, 'mouseup', this._deselectMultiDrag); + on(document, 'touchend', this._deselectMultiDrag); + } + + on(document, 'keydown', this._checkKeyDown); + on(document, 'keyup', this._checkKeyUp); + this.defaults = { + selectedClass: 'sortable-selected', + multiDragKey: null, + setData: function setData(dataTransfer, dragEl) { + var data = ''; + + if (multiDragElements.length && multiDragSortable === sortable) { + multiDragElements.forEach(function (multiDragElement, i) { + data += (!i ? '' : ', ') + multiDragElement.textContent; + }); + } else { + data = dragEl.textContent; + } + + dataTransfer.setData('Text', data); + } + }; + } + + MultiDrag.prototype = { + multiDragKeyDown: false, + isMultiDrag: false, + delayStartGlobal: function delayStartGlobal(_ref) { + var dragged = _ref.dragEl; + dragEl$1 = dragged; + }, + delayEnded: function delayEnded() { + this.isMultiDrag = ~multiDragElements.indexOf(dragEl$1); + }, + setupClone: function setupClone(_ref2) { + var sortable = _ref2.sortable, + cancel = _ref2.cancel; + if (!this.isMultiDrag) return; + + for (var i = 0; i < multiDragElements.length; i++) { + multiDragClones.push(clone(multiDragElements[i])); + multiDragClones[i].sortableIndex = multiDragElements[i].sortableIndex; + multiDragClones[i].draggable = false; + multiDragClones[i].style['will-change'] = ''; + toggleClass(multiDragClones[i], this.options.selectedClass, false); + multiDragElements[i] === dragEl$1 && toggleClass(multiDragClones[i], this.options.chosenClass, false); + } + + sortable._hideClone(); + + cancel(); + }, + clone: function clone(_ref3) { + var sortable = _ref3.sortable, + rootEl = _ref3.rootEl, + dispatchSortableEvent = _ref3.dispatchSortableEvent, + cancel = _ref3.cancel; + if (!this.isMultiDrag) return; + + if (!this.options.removeCloneOnHide) { + if (multiDragElements.length && multiDragSortable === sortable) { + insertMultiDragClones(true, rootEl); + dispatchSortableEvent('clone'); + cancel(); + } + } + }, + showClone: function showClone(_ref4) { + var cloneNowShown = _ref4.cloneNowShown, + rootEl = _ref4.rootEl, + cancel = _ref4.cancel; + if (!this.isMultiDrag) return; + insertMultiDragClones(false, rootEl); + multiDragClones.forEach(function (clone) { + css(clone, 'display', ''); + }); + cloneNowShown(); + clonesHidden = false; + cancel(); + }, + hideClone: function hideClone(_ref5) { + var _this = this; + + var sortable = _ref5.sortable, + cloneNowHidden = _ref5.cloneNowHidden, + cancel = _ref5.cancel; + if (!this.isMultiDrag) return; + multiDragClones.forEach(function (clone) { + css(clone, 'display', 'none'); + + if (_this.options.removeCloneOnHide && clone.parentNode) { + clone.parentNode.removeChild(clone); + } + }); + cloneNowHidden(); + clonesHidden = true; + cancel(); + }, + dragStartGlobal: function dragStartGlobal(_ref6) { + var sortable = _ref6.sortable; + + if (!this.isMultiDrag && multiDragSortable) { + multiDragSortable.multiDrag._deselectMultiDrag(); + } + + multiDragElements.forEach(function (multiDragElement) { + multiDragElement.sortableIndex = index(multiDragElement); + }); // Sort multi-drag elements + + multiDragElements = multiDragElements.sort(function (a, b) { + return a.sortableIndex - b.sortableIndex; + }); + dragStarted = true; + }, + dragStarted: function dragStarted(_ref7) { + var _this2 = this; + + var sortable = _ref7.sortable; + if (!this.isMultiDrag) return; + + if (this.options.sort) { + // Capture rects, + // hide multi drag elements (by positioning them absolute), + // set multi drag elements rects to dragRect, + // show multi drag elements, + // animate to rects, + // unset rects & remove from DOM + sortable.captureAnimationState(); + + if (this.options.animation) { + multiDragElements.forEach(function (multiDragElement) { + if (multiDragElement === dragEl$1) return; + css(multiDragElement, 'position', 'absolute'); + }); + var dragRect = getRect(dragEl$1, false, true, true); + multiDragElements.forEach(function (multiDragElement) { + if (multiDragElement === dragEl$1) return; + setRect(multiDragElement, dragRect); + }); + folding = true; + initialFolding = true; + } + } + + sortable.animateAll(function () { + folding = false; + initialFolding = false; + + if (_this2.options.animation) { + multiDragElements.forEach(function (multiDragElement) { + unsetRect(multiDragElement); + }); + } // Remove all auxiliary multidrag items from el, if sorting enabled + + + if (_this2.options.sort) { + removeMultiDragElements(); + } + }); + }, + dragOver: function dragOver(_ref8) { + var target = _ref8.target, + completed = _ref8.completed, + cancel = _ref8.cancel; + + if (folding && ~multiDragElements.indexOf(target)) { + completed(false); + cancel(); + } + }, + revert: function revert(_ref9) { + var fromSortable = _ref9.fromSortable, + rootEl = _ref9.rootEl, + sortable = _ref9.sortable, + dragRect = _ref9.dragRect; + + if (multiDragElements.length > 1) { + // Setup unfold animation + multiDragElements.forEach(function (multiDragElement) { + sortable.addAnimationState({ + target: multiDragElement, + rect: folding ? getRect(multiDragElement) : dragRect + }); + unsetRect(multiDragElement); + multiDragElement.fromRect = dragRect; + fromSortable.removeAnimationState(multiDragElement); + }); + folding = false; + insertMultiDragElements(!this.options.removeCloneOnHide, rootEl); + } + }, + dragOverCompleted: function dragOverCompleted(_ref10) { + var sortable = _ref10.sortable, + isOwner = _ref10.isOwner, + insertion = _ref10.insertion, + activeSortable = _ref10.activeSortable, + parentEl = _ref10.parentEl, + putSortable = _ref10.putSortable; + var options = this.options; + + if (insertion) { + // Clones must be hidden before folding animation to capture dragRectAbsolute properly + if (isOwner) { + activeSortable._hideClone(); + } + + initialFolding = false; // If leaving sort:false root, or already folding - Fold to new location + + if (options.animation && multiDragElements.length > 1 && (folding || !isOwner && !activeSortable.options.sort && !putSortable)) { + // Fold: Set all multi drag elements's rects to dragEl's rect when multi-drag elements are invisible + var dragRectAbsolute = getRect(dragEl$1, false, true, true); + multiDragElements.forEach(function (multiDragElement) { + if (multiDragElement === dragEl$1) return; + setRect(multiDragElement, dragRectAbsolute); // Move element(s) to end of parentEl so that it does not interfere with multi-drag clones insertion if they are inserted + // while folding, and so that we can capture them again because old sortable will no longer be fromSortable + + parentEl.appendChild(multiDragElement); + }); + folding = true; + } // Clones must be shown (and check to remove multi drags) after folding when interfering multiDragElements are moved out + + + if (!isOwner) { + // Only remove if not folding (folding will remove them anyways) + if (!folding) { + removeMultiDragElements(); + } + + if (multiDragElements.length > 1) { + var clonesHiddenBefore = clonesHidden; + + activeSortable._showClone(sortable); // Unfold animation for clones if showing from hidden + + + if (activeSortable.options.animation && !clonesHidden && clonesHiddenBefore) { + multiDragClones.forEach(function (clone) { + activeSortable.addAnimationState({ + target: clone, + rect: clonesFromRect + }); + clone.fromRect = clonesFromRect; + clone.thisAnimationDuration = null; + }); + } + } else { + activeSortable._showClone(sortable); + } + } + } + }, + dragOverAnimationCapture: function dragOverAnimationCapture(_ref11) { + var dragRect = _ref11.dragRect, + isOwner = _ref11.isOwner, + activeSortable = _ref11.activeSortable; + multiDragElements.forEach(function (multiDragElement) { + multiDragElement.thisAnimationDuration = null; + }); + + if (activeSortable.options.animation && !isOwner && activeSortable.multiDrag.isMultiDrag) { + clonesFromRect = _extends({}, dragRect); + var dragMatrix = matrix(dragEl$1, true); + clonesFromRect.top -= dragMatrix.f; + clonesFromRect.left -= dragMatrix.e; + } + }, + dragOverAnimationComplete: function dragOverAnimationComplete() { + if (folding) { + folding = false; + removeMultiDragElements(); + } + }, + drop: function drop(_ref12) { + var evt = _ref12.originalEvent, + rootEl = _ref12.rootEl, + parentEl = _ref12.parentEl, + sortable = _ref12.sortable, + dispatchSortableEvent = _ref12.dispatchSortableEvent, + oldIndex = _ref12.oldIndex, + putSortable = _ref12.putSortable; + var toSortable = putSortable || this.sortable; + if (!evt) return; + var options = this.options, + children = parentEl.children; // Multi-drag selection + + if (!dragStarted) { + if (options.multiDragKey && !this.multiDragKeyDown) { + this._deselectMultiDrag(); + } + + toggleClass(dragEl$1, options.selectedClass, !~multiDragElements.indexOf(dragEl$1)); + + if (!~multiDragElements.indexOf(dragEl$1)) { + multiDragElements.push(dragEl$1); + dispatchEvent({ + sortable: sortable, + rootEl: rootEl, + name: 'select', + targetEl: dragEl$1, + originalEvt: evt + }); // Modifier activated, select from last to dragEl + + if (evt.shiftKey && lastMultiDragSelect && sortable.el.contains(lastMultiDragSelect)) { + var lastIndex = index(lastMultiDragSelect), + currentIndex = index(dragEl$1); + + if (~lastIndex && ~currentIndex && lastIndex !== currentIndex) { + // Must include lastMultiDragSelect (select it), in case modified selection from no selection + // (but previous selection existed) + var n, i; + + if (currentIndex > lastIndex) { + i = lastIndex; + n = currentIndex; + } else { + i = currentIndex; + n = lastIndex + 1; + } + + for (; i < n; i++) { + if (~multiDragElements.indexOf(children[i])) continue; + toggleClass(children[i], options.selectedClass, true); + multiDragElements.push(children[i]); + dispatchEvent({ + sortable: sortable, + rootEl: rootEl, + name: 'select', + targetEl: children[i], + originalEvt: evt + }); + } + } + } else { + lastMultiDragSelect = dragEl$1; + } + + multiDragSortable = toSortable; + } else { + multiDragElements.splice(multiDragElements.indexOf(dragEl$1), 1); + lastMultiDragSelect = null; + dispatchEvent({ + sortable: sortable, + rootEl: rootEl, + name: 'deselect', + targetEl: dragEl$1, + originalEvt: evt + }); + } + } // Multi-drag drop + + + if (dragStarted && this.isMultiDrag) { + // Do not "unfold" after around dragEl if reverted + if ((parentEl[expando].options.sort || parentEl !== rootEl) && multiDragElements.length > 1) { + var dragRect = getRect(dragEl$1), + multiDragIndex = index(dragEl$1, ':not(.' + this.options.selectedClass + ')'); + if (!initialFolding && options.animation) dragEl$1.thisAnimationDuration = null; + toSortable.captureAnimationState(); + + if (!initialFolding) { + if (options.animation) { + dragEl$1.fromRect = dragRect; + multiDragElements.forEach(function (multiDragElement) { + multiDragElement.thisAnimationDuration = null; + + if (multiDragElement !== dragEl$1) { + var rect = folding ? getRect(multiDragElement) : dragRect; + multiDragElement.fromRect = rect; // Prepare unfold animation + + toSortable.addAnimationState({ + target: multiDragElement, + rect: rect + }); + } + }); + } // Multi drag elements are not necessarily removed from the DOM on drop, so to reinsert + // properly they must all be removed + + + removeMultiDragElements(); + multiDragElements.forEach(function (multiDragElement) { + if (children[multiDragIndex]) { + parentEl.insertBefore(multiDragElement, children[multiDragIndex]); + } else { + parentEl.appendChild(multiDragElement); + } + + multiDragIndex++; + }); // If initial folding is done, the elements may have changed position because they are now + // unfolding around dragEl, even though dragEl may not have his index changed, so update event + // must be fired here as Sortable will not. + + if (oldIndex === index(dragEl$1)) { + var update = false; + multiDragElements.forEach(function (multiDragElement) { + if (multiDragElement.sortableIndex !== index(multiDragElement)) { + update = true; + return; + } + }); + + if (update) { + dispatchSortableEvent('update'); + } + } + } // Must be done after capturing individual rects (scroll bar) + + + multiDragElements.forEach(function (multiDragElement) { + unsetRect(multiDragElement); + }); + toSortable.animateAll(); + } + + multiDragSortable = toSortable; + } // Remove clones if necessary + + + if (rootEl === parentEl || putSortable && putSortable.lastPutMode !== 'clone') { + multiDragClones.forEach(function (clone) { + clone.parentNode && clone.parentNode.removeChild(clone); + }); + } + }, + nullingGlobal: function nullingGlobal() { + this.isMultiDrag = dragStarted = false; + multiDragClones.length = 0; + }, + destroyGlobal: function destroyGlobal() { + this._deselectMultiDrag(); + + off(document, 'pointerup', this._deselectMultiDrag); + off(document, 'mouseup', this._deselectMultiDrag); + off(document, 'touchend', this._deselectMultiDrag); + off(document, 'keydown', this._checkKeyDown); + off(document, 'keyup', this._checkKeyUp); + }, + _deselectMultiDrag: function _deselectMultiDrag(evt) { + if (typeof dragStarted !== "undefined" && dragStarted) return; // Only deselect if selection is in this sortable + + if (multiDragSortable !== this.sortable) return; // Only deselect if target is not item in this sortable + + if (evt && closest(evt.target, this.options.draggable, this.sortable.el, false)) return; // Only deselect if left click + + if (evt && evt.button !== 0) return; + + while (multiDragElements.length) { + var el = multiDragElements[0]; + toggleClass(el, this.options.selectedClass, false); + multiDragElements.shift(); + dispatchEvent({ + sortable: this.sortable, + rootEl: this.sortable.el, + name: 'deselect', + targetEl: el, + originalEvt: evt + }); + } + }, + _checkKeyDown: function _checkKeyDown(evt) { + if (evt.key === this.options.multiDragKey) { + this.multiDragKeyDown = true; + } + }, + _checkKeyUp: function _checkKeyUp(evt) { + if (evt.key === this.options.multiDragKey) { + this.multiDragKeyDown = false; + } + } + }; + return _extends(MultiDrag, { + // Static methods & properties + pluginName: 'multiDrag', + utils: { + /** + * Selects the provided multi-drag item + * @param {HTMLElement} el The element to be selected + */ + select: function select(el) { + var sortable = el.parentNode[expando]; + if (!sortable || !sortable.options.multiDrag || ~multiDragElements.indexOf(el)) return; + + if (multiDragSortable && multiDragSortable !== sortable) { + multiDragSortable.multiDrag._deselectMultiDrag(); + + multiDragSortable = sortable; + } + + toggleClass(el, sortable.options.selectedClass, true); + multiDragElements.push(el); + }, + + /** + * Deselects the provided multi-drag item + * @param {HTMLElement} el The element to be deselected + */ + deselect: function deselect(el) { + var sortable = el.parentNode[expando], + index = multiDragElements.indexOf(el); + if (!sortable || !sortable.options.multiDrag || !~index) return; + toggleClass(el, sortable.options.selectedClass, false); + multiDragElements.splice(index, 1); + } + }, + eventProperties: function eventProperties() { + var _this3 = this; + + var oldIndicies = [], + newIndicies = []; + multiDragElements.forEach(function (multiDragElement) { + oldIndicies.push({ + multiDragElement: multiDragElement, + index: multiDragElement.sortableIndex + }); // multiDragElements will already be sorted if folding + + var newIndex; + + if (folding && multiDragElement !== dragEl$1) { + newIndex = -1; + } else if (folding) { + newIndex = index(multiDragElement, ':not(.' + _this3.options.selectedClass + ')'); + } else { + newIndex = index(multiDragElement); + } + + newIndicies.push({ + multiDragElement: multiDragElement, + index: newIndex + }); + }); + return { + items: _toConsumableArray(multiDragElements), + clones: [].concat(multiDragClones), + oldIndicies: oldIndicies, + newIndicies: newIndicies + }; + }, + optionListeners: { + multiDragKey: function multiDragKey(key) { + key = key.toLowerCase(); + + if (key === 'ctrl') { + key = 'Control'; + } else if (key.length > 1) { + key = key.charAt(0).toUpperCase() + key.substr(1); + } + + return key; + } + } + }); + } + + function insertMultiDragElements(clonesInserted, rootEl) { + multiDragElements.forEach(function (multiDragElement, i) { + var target = rootEl.children[multiDragElement.sortableIndex + (clonesInserted ? Number(i) : 0)]; + + if (target) { + rootEl.insertBefore(multiDragElement, target); + } else { + rootEl.appendChild(multiDragElement); + } + }); + } + /** + * Insert multi-drag clones + * @param {[Boolean]} elementsInserted Whether the multi-drag elements are inserted + * @param {HTMLElement} rootEl + */ + + + function insertMultiDragClones(elementsInserted, rootEl) { + multiDragClones.forEach(function (clone, i) { + var target = rootEl.children[clone.sortableIndex + (elementsInserted ? Number(i) : 0)]; + + if (target) { + rootEl.insertBefore(clone, target); + } else { + rootEl.appendChild(clone); + } + }); + } + + function removeMultiDragElements() { + multiDragElements.forEach(function (multiDragElement) { + if (multiDragElement === dragEl$1) return; + multiDragElement.parentNode && multiDragElement.parentNode.removeChild(multiDragElement); + }); + } + + Sortable.mount(new AutoScrollPlugin()); + Sortable.mount(Remove, Revert); + + Sortable.mount(new SwapPlugin()); + Sortable.mount(new MultiDragPlugin()); + + return Sortable; + +})); diff --git a/public/assets/libs/Sortable/Sortable.min.js b/public/assets/libs/Sortable/Sortable.min.js new file mode 100644 index 0000000..eba0614 --- /dev/null +++ b/public/assets/libs/Sortable/Sortable.min.js @@ -0,0 +1,2 @@ +/*! Sortable 1.10.2 - MIT | git://github.com/SortableJS/Sortable.git */ +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).Sortable=e()}(this,function(){"use strict";function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function a(){return(a=Object.assign||function(t){for(var e=1;e"===e[0]&&(e=e.substring(1)),t)try{if(t.matches)return t.matches(e);if(t.msMatchesSelector)return t.msMatchesSelector(e);if(t.webkitMatchesSelector)return t.webkitMatchesSelector(e)}catch(t){return!1}return!1}}function P(t,e,n,o){if(t){n=n||document;do{if(null!=e&&(">"===e[0]?t.parentNode===n&&h(t,e):h(t,e))||o&&t===n)return t;if(t===n)break}while(t=(i=t).host&&i!==document&&i.host.nodeType?i.host:i.parentNode)}var i;return null}var f,p=/\s+/g;function k(t,e,n){if(t&&e)if(t.classList)t.classList[n?"add":"remove"](e);else{var o=(" "+t.className+" ").replace(p," ").replace(" "+e+" "," ");t.className=(o+(n?" "+e:"")).replace(p," ")}}function R(t,e,n){var o=t&&t.style;if(o){if(void 0===n)return document.defaultView&&document.defaultView.getComputedStyle?n=document.defaultView.getComputedStyle(t,""):t.currentStyle&&(n=t.currentStyle),void 0===e?n:n[e];e in o||-1!==e.indexOf("webkit")||(e="-webkit-"+e),o[e]=n+("string"==typeof n?"":"px")}}function v(t,e){var n="";if("string"==typeof t)n=t;else do{var o=R(t,"transform");o&&"none"!==o&&(n=o+" "+n)}while(!e&&(t=t.parentNode));var i=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return i&&new i(n)}function g(t,e,n){if(t){var o=t.getElementsByTagName(e),i=0,r=o.length;if(n)for(;i=e.left-n&&r<=e.right+n,i=a>=e.top-n&&a<=e.bottom+n;return n&&o&&i?l=t:void 0}}),l}((t=t.touches?t.touches[0]:t).clientX,t.clientY);if(e){var n={};for(var o in t)t.hasOwnProperty(o)&&(n[o]=t[o]);n.target=n.rootEl=e,n.preventDefault=void 0,n.stopPropagation=void 0,e[j]._onDragOver(n)}}}function kt(t){z&&z.parentNode[j]._isOutsideThisEl(t.target)}function Rt(t,e){if(!t||!t.nodeType||1!==t.nodeType)throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(t));this.el=t,this.options=e=a({},e),t[j]=this;var n={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(t.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return Ot(t,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(t,e){t.setData("Text",e.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,delayOnTouchOnly:!1,touchStartThreshold:(Number.parseInt?Number:window).parseInt(window.devicePixelRatio,10)||1,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0},supportPointer:!1!==Rt.supportPointer&&"PointerEvent"in window,emptyInsertThreshold:5};for(var o in O.initializePlugins(this,t,n),n)o in e||(e[o]=n[o]);for(var i in At(e),this)"_"===i.charAt(0)&&"function"==typeof this[i]&&(this[i]=this[i].bind(this));this.nativeDraggable=!e.forceFallback&&xt,this.nativeDraggable&&(this.options.touchStartThreshold=1),e.supportPointer?u(t,"pointerdown",this._onTapStart):(u(t,"mousedown",this._onTapStart),u(t,"touchstart",this._onTapStart)),this.nativeDraggable&&(u(t,"dragover",this),u(t,"dragenter",this)),bt.push(this.el),e.store&&e.store.get&&this.sort(e.store.get(this)||[]),a(this,T())}function Xt(t,e,n,o,i,r,a,l){var s,c,u=t[j],d=u.options.onMove;return!window.CustomEvent||w||E?(s=document.createEvent("Event")).initEvent("move",!0,!0):s=new CustomEvent("move",{bubbles:!0,cancelable:!0}),s.to=e,s.from=t,s.dragged=n,s.draggedRect=o,s.related=i||e,s.relatedRect=r||X(e),s.willInsertAfter=l,s.originalEvent=a,t.dispatchEvent(s),d&&(c=d.call(u,s,a)),c}function Yt(t){t.draggable=!1}function Bt(){Dt=!1}function Ft(t){for(var e=t.tagName+t.className+t.src+t.href+t.textContent,n=e.length,o=0;n--;)o+=e.charCodeAt(n);return o.toString(36)}function Ht(t){return setTimeout(t,0)}function Lt(t){return clearTimeout(t)}Rt.prototype={constructor:Rt,_isOutsideThisEl:function(t){this.el.contains(t)||t===this.el||(ht=null)},_getDirection:function(t,e){return"function"==typeof this.options.direction?this.options.direction.call(this,t,e,z):this.options.direction},_onTapStart:function(e){if(e.cancelable){var n=this,o=this.el,t=this.options,i=t.preventOnFilter,r=e.type,a=e.touches&&e.touches[0]||e.pointerType&&"touch"===e.pointerType&&e,l=(a||e).target,s=e.target.shadowRoot&&(e.path&&e.path[0]||e.composedPath&&e.composedPath()[0])||l,c=t.filter;if(function(t){St.length=0;var e=t.getElementsByTagName("input"),n=e.length;for(;n--;){var o=e[n];o.checked&&St.push(o)}}(o),!z&&!(/mousedown|pointerdown/.test(r)&&0!==e.button||t.disabled||s.isContentEditable||(l=P(l,t.draggable,o,!1))&&l.animated||Z===l)){if(J=F(l),et=F(l,t.draggable),"function"==typeof c){if(c.call(this,e,l,this))return W({sortable:n,rootEl:s,name:"filter",targetEl:l,toEl:o,fromEl:o}),K("filter",n,{evt:e}),void(i&&e.cancelable&&e.preventDefault())}else if(c&&(c=c.split(",").some(function(t){if(t=P(s,t.trim(),o,!1))return W({sortable:n,rootEl:t,name:"filter",targetEl:l,fromEl:o,toEl:o}),K("filter",n,{evt:e}),!0})))return void(i&&e.cancelable&&e.preventDefault());t.handle&&!P(s,t.handle,o,!1)||this._prepareDragStart(e,a,l)}}},_prepareDragStart:function(t,e,n){var o,i=this,r=i.el,a=i.options,l=r.ownerDocument;if(n&&!z&&n.parentNode===r){var s=X(n);if(q=r,G=(z=n).parentNode,V=z.nextSibling,Z=n,ot=a.group,rt={target:Rt.dragged=z,clientX:(e||t).clientX,clientY:(e||t).clientY},ct=rt.clientX-s.left,ut=rt.clientY-s.top,this._lastX=(e||t).clientX,this._lastY=(e||t).clientY,z.style["will-change"]="all",o=function(){K("delayEnded",i,{evt:t}),Rt.eventCanceled?i._onDrop():(i._disableDelayedDragEvents(),!c&&i.nativeDraggable&&(z.draggable=!0),i._triggerDragStart(t,e),W({sortable:i,name:"choose",originalEvent:t}),k(z,a.chosenClass,!0))},a.ignore.split(",").forEach(function(t){g(z,t.trim(),Yt)}),u(l,"dragover",Pt),u(l,"mousemove",Pt),u(l,"touchmove",Pt),u(l,"mouseup",i._onDrop),u(l,"touchend",i._onDrop),u(l,"touchcancel",i._onDrop),c&&this.nativeDraggable&&(this.options.touchStartThreshold=4,z.draggable=!0),K("delayStart",this,{evt:t}),!a.delay||a.delayOnTouchOnly&&!e||this.nativeDraggable&&(E||w))o();else{if(Rt.eventCanceled)return void this._onDrop();u(l,"mouseup",i._disableDelayedDrag),u(l,"touchend",i._disableDelayedDrag),u(l,"touchcancel",i._disableDelayedDrag),u(l,"mousemove",i._delayedDragTouchMoveHandler),u(l,"touchmove",i._delayedDragTouchMoveHandler),a.supportPointer&&u(l,"pointermove",i._delayedDragTouchMoveHandler),i._dragStartTimer=setTimeout(o,a.delay)}}},_delayedDragTouchMoveHandler:function(t){var e=t.touches?t.touches[0]:t;Math.max(Math.abs(e.clientX-this._lastX),Math.abs(e.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){z&&Yt(z),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var t=this.el.ownerDocument;d(t,"mouseup",this._disableDelayedDrag),d(t,"touchend",this._disableDelayedDrag),d(t,"touchcancel",this._disableDelayedDrag),d(t,"mousemove",this._delayedDragTouchMoveHandler),d(t,"touchmove",this._delayedDragTouchMoveHandler),d(t,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(t,e){e=e||"touch"==t.pointerType&&t,!this.nativeDraggable||e?this.options.supportPointer?u(document,"pointermove",this._onTouchMove):u(document,e?"touchmove":"mousemove",this._onTouchMove):(u(z,"dragend",this),u(q,"dragstart",this._onDragStart));try{document.selection?Ht(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch(t){}},_dragStarted:function(t,e){if(vt=!1,q&&z){K("dragStarted",this,{evt:e}),this.nativeDraggable&&u(document,"dragover",kt);var n=this.options;t||k(z,n.dragClass,!1),k(z,n.ghostClass,!0),Rt.active=this,t&&this._appendGhost(),W({sortable:this,name:"start",originalEvent:e})}else this._nulling()},_emulateDragOver:function(){if(at){this._lastX=at.clientX,this._lastY=at.clientY,Nt();for(var t=document.elementFromPoint(at.clientX,at.clientY),e=t;t&&t.shadowRoot&&(t=t.shadowRoot.elementFromPoint(at.clientX,at.clientY))!==e;)e=t;if(z.parentNode[j]._isOutsideThisEl(t),e)do{if(e[j]){if(e[j]._onDragOver({clientX:at.clientX,clientY:at.clientY,target:t,rootEl:e})&&!this.options.dragoverBubble)break}t=e}while(e=e.parentNode);It()}},_onTouchMove:function(t){if(rt){var e=this.options,n=e.fallbackTolerance,o=e.fallbackOffset,i=t.touches?t.touches[0]:t,r=U&&v(U,!0),a=U&&r&&r.a,l=U&&r&&r.d,s=Ct&>&&b(gt),c=(i.clientX-rt.clientX+o.x)/(a||1)+(s?s[0]-Et[0]:0)/(a||1),u=(i.clientY-rt.clientY+o.y)/(l||1)+(s?s[1]-Et[1]:0)/(l||1);if(!Rt.active&&!vt){if(n&&Math.max(Math.abs(i.clientX-this._lastX),Math.abs(i.clientY-this._lastY))o.right+10||t.clientX<=o.right&&t.clientY>o.bottom&&t.clientX>=o.left:t.clientX>o.right&&t.clientY>o.top||t.clientX<=o.right&&t.clientY>o.bottom+10}(n,a,this)&&!g.animated){if(g===z)return A(!1);if(g&&l===n.target&&(s=g),s&&(i=X(s)),!1!==Xt(q,l,z,o,s,i,n,!!s))return O(),l.appendChild(z),G=l,N(),A(!0)}else if(s.parentNode===l){i=X(s);var v,m,b,y=z.parentNode!==l,w=!function(t,e,n){var o=n?t.left:t.top,i=n?t.right:t.bottom,r=n?t.width:t.height,a=n?e.left:e.top,l=n?e.right:e.bottom,s=n?e.width:e.height;return o===a||i===l||o+r/2===a+s/2}(z.animated&&z.toRect||o,s.animated&&s.toRect||i,a),E=a?"top":"left",D=Y(s,"top","top")||Y(z,"top","top"),S=D?D.scrollTop:void 0;if(ht!==s&&(m=i[E],yt=!1,wt=!w&&e.invertSwap||y),0!==(v=function(t,e,n,o,i,r,a,l){var s=o?t.clientY:t.clientX,c=o?n.height:n.width,u=o?n.top:n.left,d=o?n.bottom:n.right,h=!1;if(!a)if(l&&pt", + "owenm " + ], + "description": "JavaScript library for reorderable drag-and-drop lists on modern browsers and touch devices. No jQuery required. Supports Meteor, AngularJS, React, Polymer, Vue, Knockout and any CSS library, e.g. Bootstrap.", + "keywords": [ + "sortable", + "reorder", + "list", + "html5", + "drag", + "and", + "drop", + "dnd", + "web-components" + ], + "license": "MIT", + "ignore": [ + "node_modules", + "bower_components", + "test", + "tests" + ] +} diff --git a/public/assets/libs/Sortable/entry/entry-complete.js b/public/assets/libs/Sortable/entry/entry-complete.js new file mode 100644 index 0000000..bf3dc5c --- /dev/null +++ b/public/assets/libs/Sortable/entry/entry-complete.js @@ -0,0 +1,8 @@ +import Sortable from './entry-defaults.js'; +import Swap from '../plugins/Swap'; +import MultiDrag from '../plugins/MultiDrag'; + +Sortable.mount(new Swap()); +Sortable.mount(new MultiDrag()); + +export default Sortable; diff --git a/public/assets/libs/Sortable/entry/entry-core.js b/public/assets/libs/Sortable/entry/entry-core.js new file mode 100644 index 0000000..b5c3f77 --- /dev/null +++ b/public/assets/libs/Sortable/entry/entry-core.js @@ -0,0 +1,19 @@ +import Sortable from '../src/Sortable.js'; +import AutoScroll from '../plugins/AutoScroll'; +import OnSpill from '../plugins/OnSpill'; +import Swap from '../plugins/Swap'; +import MultiDrag from '../plugins/MultiDrag'; + +export default Sortable; + +export { + Sortable, + + // Default + AutoScroll, + OnSpill, + + // Extra + Swap, + MultiDrag +}; diff --git a/public/assets/libs/Sortable/entry/entry-defaults.js b/public/assets/libs/Sortable/entry/entry-defaults.js new file mode 100644 index 0000000..9d3fb68 --- /dev/null +++ b/public/assets/libs/Sortable/entry/entry-defaults.js @@ -0,0 +1,19 @@ +import Sortable from '../src/Sortable.js'; +import AutoScroll from '../plugins/AutoScroll'; +import { RemoveOnSpill, RevertOnSpill } from '../plugins/OnSpill'; +// Extra +import Swap from '../plugins/Swap'; +import MultiDrag from '../plugins/MultiDrag'; + +Sortable.mount(new AutoScroll()); +Sortable.mount(RemoveOnSpill, RevertOnSpill); + +export default Sortable; + +export { + Sortable, + + // Extra + Swap, + MultiDrag +}; diff --git a/public/assets/libs/Sortable/index.html b/public/assets/libs/Sortable/index.html new file mode 100644 index 0000000..b52fe58 --- /dev/null +++ b/public/assets/libs/Sortable/index.html @@ -0,0 +1,459 @@ + + + + + SortableJS + + + + + + + + + + + + + + Fork me on GitHub + +
+
+ +

SortableJS

+

JavaScript library for reorderable drag-and-drop lists

+ + +
+ +
+

Features

+
+
+
+

Simple list example

+
+
Item 1
+
Item 2
+
Item 3
+
Item 4
+
Item 5
+
Item 6
+
+
+
new Sortable(example1, {
+    animation: 150,
+    ghostClass: 'blue-background-class'
+});
+
+
+
+ +
+

Shared lists

+
+
Item 1
+
Item 2
+
Item 3
+
Item 4
+
Item 5
+
Item 6
+
+ +
+
Item 1
+
Item 2
+
Item 3
+
Item 4
+
Item 5
+
Item 6
+
+
+
new Sortable(example2Left, {
+    group: 'shared', // set both lists to same group
+    animation: 150
+});
+
+new Sortable(example2Right, {
+    group: 'shared',
+    animation: 150
+});
+
+
+
+ +
+

Cloning

+

Try dragging from one list to another. The item you drag will be cloned and the clone will stay in the original list.

+
+
Item 1
+
Item 2
+
Item 3
+
Item 4
+
Item 5
+
Item 6
+
+ +
+
Item 1
+
Item 2
+
Item 3
+
Item 4
+
Item 5
+
Item 6
+
+
+
new Sortable(example3Left, {
+    group: {
+        name: 'shared',
+        pull: 'clone' // To clone: set pull to 'clone'
+    },
+    animation: 150
+});
+
+new Sortable(example3Right, {
+    group: {
+        name: 'shared',
+        pull: 'clone'
+    },
+    animation: 150
+});
+
+
+
+ +
+

Disabling Sorting

+

Try sorting the list on the left. It is not possible because it has it's sort option set to false. However, you can still drag from the list on the left to the list on the right.

+
+
Item 1
+
Item 2
+
Item 3
+
Item 4
+
Item 5
+
Item 6
+
+ +
+
Item 1
+
Item 2
+
Item 3
+
Item 4
+
Item 5
+
Item 6
+
+
+
new Sortable(example4Left, {
+    group: {
+        name: 'shared',
+        pull: 'clone',
+        put: false // Do not allow items to be put into this list
+    },
+    animation: 150,
+    sort: false // To disable sorting: set sort to false
+});
+
+new Sortable(example4Right, {
+    group: 'shared',
+    animation: 150
+});
+
+
+
+ +
+

Handle

+
+
  Item 1
+
  Item 2
+
  Item 3
+
  Item 4
+
  Item 5
+
  Item 6
+
+
+
new Sortable(example5, {
+    handle: '.handle', // handle's class
+    animation: 150
+});
+
+
+
+ +
+

Filter

+

Try dragging the item with a red background. It cannot be done, because that item is filtered out using the filter option.

+
+
Item 1
+
Item 2
+
Item 3
+
Filtered
+
Item 4
+
Item 5
+
+
+
new Sortable(example6, {
+    filter: '.filtered', // 'filtered' class is not draggable
+    animation: 150
+});
+
+
+
+ +
+

Thresholds

+

Try modifying the inputs below to affect the swap thresholds. You can see the swap zones of the squares colored in dark blue, while the "dead zones" (that do not cause a swap) are colored in light blue.

+
+
+ +
+ +
1
+
+ +
+ +
2
+
+
+
+
+
+ +
+ +
+
+
+
Invert Swap
+
+
+ +
+
+
+
+ + +
+
+
+
+
new Sortable(example7, {
+    swapThreshold: 1,
+    animation: 150
+});
+
+
+ + +
+

Examples

+
+
+ +
+

Grid Example

+
+
Item 1
Item 2
Item 3
Item 4
Item 5
Item 6
Item 7
Item 8
Item 9
Item 10
Item 11
Item 12
Item 13
Item 14
Item 15
Item 16
Item 17
Item 18
Item 19
Item 20
+
+
+
+ +
+

Nested Sortables Example

+

NOTE: When using nested Sortables with animation, it is recommended that the fallbackOnBody option is set to true.
It is also always recommended that either the invertSwap option is set to true, or the swapThreshold option is lower than the default value of 1 (eg 0.65).

+
+
Item 1.1 +
+
Item 2.1
+
Item 2.2 +
+
Item 3.1
+
Item 3.2
+
Item 3.3
+
Item 3.4
+
+
+
Item 2.3
+
Item 2.4
+
+
+
Item 1.2
+
Item 1.3
+
Item 1.4 +
+
Item 2.1
+
Item 2.2
+
Item 2.3
+
Item 2.4
+
+
+
Item 1.5
+
+
+
// Loop through each nested sortable element
+for (var i = 0; i < nestedSortables.length; i++) {
+	new Sortable(nestedSortables[i], {
+		group: 'nested',
+		animation: 150,
+		fallbackOnBody: true,
+		swapThreshold: 0.65
+	});
+}
+
+
+ +
+

Plugins

+
+
+ +
+

MultiDrag

+

The MultiDrag plugin allows for multiple items to be dragged at a time. You can click to "select" multiple items, and then drag them as one item.

+
+
Item 1
+
Item 2
+
Item 3
+
Item 4
+
Item 5
+
Item 6
+
+
+
new Sortable(multiDragDemo, {
+	multiDrag: true, // Enable multi-drag
+	selectedClass: 'selected', // The class applied to the selected items
+	animation: 150
+});
+
+
+
+ +
+

Swap

+

The Swap plugin changes the behaviour of Sortable to allow for items to be swapped with eachother rather than sorted.

+
+
Item 1
+
Item 2
+
Item 3
+
Item 4
+
Item 5
+
Item 6
+
+
+
new Sortable(swapDemo, {
+	swap: true, // Enable swap plugin
+	swapClass: 'highlight', // The class applied to the hovered swap item
+	animation: 150
+});
+
+
+
+ + + +
+ +
+

Comparisons

+
+
+ + +
+

jQuery-UI

+ + +

Dragula

+ +
+ +
+ +
+

Framework Support

+
+
+ +
+ +

Vue

+

Vue.Draggable

+ +

React

+

react-sortablejs

+ +

Angular

+

ngx-sortablejs

+ +

jQuery

+

jquery-sortablejs

+ +

Knockout

+

knockout-sortablejs

+ +

Meteor

+

meteor-sortablejs

+ +

Polymer

+

polymer-sortablejs

+ +

Ember

+

ember-sortablejs

+
+ +
+ + + + + + + + + + + diff --git a/public/assets/libs/Sortable/modular/sortable.complete.esm.js b/public/assets/libs/Sortable/modular/sortable.complete.esm.js new file mode 100644 index 0000000..9d60bc0 --- /dev/null +++ b/public/assets/libs/Sortable/modular/sortable.complete.esm.js @@ -0,0 +1,3701 @@ +/**! + * Sortable 1.10.2 + * @author RubaXa + * @author owenm + * @license MIT + */ +function _typeof(obj) { + if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { + _typeof = function (obj) { + return typeof obj; + }; + } else { + _typeof = function (obj) { + return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; + }; + } + + return _typeof(obj); +} + +function _defineProperty(obj, key, value) { + if (key in obj) { + Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + } else { + obj[key] = value; + } + + return obj; +} + +function _extends() { + _extends = Object.assign || function (target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i]; + + for (var key in source) { + if (Object.prototype.hasOwnProperty.call(source, key)) { + target[key] = source[key]; + } + } + } + + return target; + }; + + return _extends.apply(this, arguments); +} + +function _objectSpread(target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i] != null ? arguments[i] : {}; + var ownKeys = Object.keys(source); + + if (typeof Object.getOwnPropertySymbols === 'function') { + ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { + return Object.getOwnPropertyDescriptor(source, sym).enumerable; + })); + } + + ownKeys.forEach(function (key) { + _defineProperty(target, key, source[key]); + }); + } + + return target; +} + +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + + for (i = 0; i < sourceKeys.length; i++) { + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + + return target; +} + +function _objectWithoutProperties(source, excluded) { + if (source == null) return {}; + + var target = _objectWithoutPropertiesLoose(source, excluded); + + var key, i; + + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + + for (i = 0; i < sourceSymbolKeys.length; i++) { + key = sourceSymbolKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + + return target; +} + +function _toConsumableArray(arr) { + return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); +} + +function _arrayWithoutHoles(arr) { + if (Array.isArray(arr)) { + for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; + + return arr2; + } +} + +function _iterableToArray(iter) { + if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); +} + +function _nonIterableSpread() { + throw new TypeError("Invalid attempt to spread non-iterable instance"); +} + +var version = "1.10.2"; + +function userAgent(pattern) { + if (typeof window !== 'undefined' && window.navigator) { + return !! + /*@__PURE__*/ + navigator.userAgent.match(pattern); + } +} + +var IE11OrLess = userAgent(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i); +var Edge = userAgent(/Edge/i); +var FireFox = userAgent(/firefox/i); +var Safari = userAgent(/safari/i) && !userAgent(/chrome/i) && !userAgent(/android/i); +var IOS = userAgent(/iP(ad|od|hone)/i); +var ChromeForAndroid = userAgent(/chrome/i) && userAgent(/android/i); + +var captureMode = { + capture: false, + passive: false +}; + +function on(el, event, fn) { + el.addEventListener(event, fn, !IE11OrLess && captureMode); +} + +function off(el, event, fn) { + el.removeEventListener(event, fn, !IE11OrLess && captureMode); +} + +function matches( +/**HTMLElement*/ +el, +/**String*/ +selector) { + if (!selector) return; + selector[0] === '>' && (selector = selector.substring(1)); + + if (el) { + try { + if (el.matches) { + return el.matches(selector); + } else if (el.msMatchesSelector) { + return el.msMatchesSelector(selector); + } else if (el.webkitMatchesSelector) { + return el.webkitMatchesSelector(selector); + } + } catch (_) { + return false; + } + } + + return false; +} + +function getParentOrHost(el) { + return el.host && el !== document && el.host.nodeType ? el.host : el.parentNode; +} + +function closest( +/**HTMLElement*/ +el, +/**String*/ +selector, +/**HTMLElement*/ +ctx, includeCTX) { + if (el) { + ctx = ctx || document; + + do { + if (selector != null && (selector[0] === '>' ? el.parentNode === ctx && matches(el, selector) : matches(el, selector)) || includeCTX && el === ctx) { + return el; + } + + if (el === ctx) break; + /* jshint boss:true */ + } while (el = getParentOrHost(el)); + } + + return null; +} + +var R_SPACE = /\s+/g; + +function toggleClass(el, name, state) { + if (el && name) { + if (el.classList) { + el.classList[state ? 'add' : 'remove'](name); + } else { + var className = (' ' + el.className + ' ').replace(R_SPACE, ' ').replace(' ' + name + ' ', ' '); + el.className = (className + (state ? ' ' + name : '')).replace(R_SPACE, ' '); + } + } +} + +function css(el, prop, val) { + var style = el && el.style; + + if (style) { + if (val === void 0) { + if (document.defaultView && document.defaultView.getComputedStyle) { + val = document.defaultView.getComputedStyle(el, ''); + } else if (el.currentStyle) { + val = el.currentStyle; + } + + return prop === void 0 ? val : val[prop]; + } else { + if (!(prop in style) && prop.indexOf('webkit') === -1) { + prop = '-webkit-' + prop; + } + + style[prop] = val + (typeof val === 'string' ? '' : 'px'); + } + } +} + +function matrix(el, selfOnly) { + var appliedTransforms = ''; + + if (typeof el === 'string') { + appliedTransforms = el; + } else { + do { + var transform = css(el, 'transform'); + + if (transform && transform !== 'none') { + appliedTransforms = transform + ' ' + appliedTransforms; + } + /* jshint boss:true */ + + } while (!selfOnly && (el = el.parentNode)); + } + + var matrixFn = window.DOMMatrix || window.WebKitCSSMatrix || window.CSSMatrix || window.MSCSSMatrix; + /*jshint -W056 */ + + return matrixFn && new matrixFn(appliedTransforms); +} + +function find(ctx, tagName, iterator) { + if (ctx) { + var list = ctx.getElementsByTagName(tagName), + i = 0, + n = list.length; + + if (iterator) { + for (; i < n; i++) { + iterator(list[i], i); + } + } + + return list; + } + + return []; +} + +function getWindowScrollingElement() { + var scrollingElement = document.scrollingElement; + + if (scrollingElement) { + return scrollingElement; + } else { + return document.documentElement; + } +} +/** + * Returns the "bounding client rect" of given element + * @param {HTMLElement} el The element whose boundingClientRect is wanted + * @param {[Boolean]} relativeToContainingBlock Whether the rect should be relative to the containing block of (including) the container + * @param {[Boolean]} relativeToNonStaticParent Whether the rect should be relative to the relative parent of (including) the contaienr + * @param {[Boolean]} undoScale Whether the container's scale() should be undone + * @param {[HTMLElement]} container The parent the element will be placed in + * @return {Object} The boundingClientRect of el, with specified adjustments + */ + + +function getRect(el, relativeToContainingBlock, relativeToNonStaticParent, undoScale, container) { + if (!el.getBoundingClientRect && el !== window) return; + var elRect, top, left, bottom, right, height, width; + + if (el !== window && el !== getWindowScrollingElement()) { + elRect = el.getBoundingClientRect(); + top = elRect.top; + left = elRect.left; + bottom = elRect.bottom; + right = elRect.right; + height = elRect.height; + width = elRect.width; + } else { + top = 0; + left = 0; + bottom = window.innerHeight; + right = window.innerWidth; + height = window.innerHeight; + width = window.innerWidth; + } + + if ((relativeToContainingBlock || relativeToNonStaticParent) && el !== window) { + // Adjust for translate() + container = container || el.parentNode; // solves #1123 (see: https://stackoverflow.com/a/37953806/6088312) + // Not needed on <= IE11 + + if (!IE11OrLess) { + do { + if (container && container.getBoundingClientRect && (css(container, 'transform') !== 'none' || relativeToNonStaticParent && css(container, 'position') !== 'static')) { + var containerRect = container.getBoundingClientRect(); // Set relative to edges of padding box of container + + top -= containerRect.top + parseInt(css(container, 'border-top-width')); + left -= containerRect.left + parseInt(css(container, 'border-left-width')); + bottom = top + elRect.height; + right = left + elRect.width; + break; + } + /* jshint boss:true */ + + } while (container = container.parentNode); + } + } + + if (undoScale && el !== window) { + // Adjust for scale() + var elMatrix = matrix(container || el), + scaleX = elMatrix && elMatrix.a, + scaleY = elMatrix && elMatrix.d; + + if (elMatrix) { + top /= scaleY; + left /= scaleX; + width /= scaleX; + height /= scaleY; + bottom = top + height; + right = left + width; + } + } + + return { + top: top, + left: left, + bottom: bottom, + right: right, + width: width, + height: height + }; +} +/** + * Checks if a side of an element is scrolled past a side of its parents + * @param {HTMLElement} el The element who's side being scrolled out of view is in question + * @param {String} elSide Side of the element in question ('top', 'left', 'right', 'bottom') + * @param {String} parentSide Side of the parent in question ('top', 'left', 'right', 'bottom') + * @return {HTMLElement} The parent scroll element that the el's side is scrolled past, or null if there is no such element + */ + + +function isScrolledPast(el, elSide, parentSide) { + var parent = getParentAutoScrollElement(el, true), + elSideVal = getRect(el)[elSide]; + /* jshint boss:true */ + + while (parent) { + var parentSideVal = getRect(parent)[parentSide], + visible = void 0; + + if (parentSide === 'top' || parentSide === 'left') { + visible = elSideVal >= parentSideVal; + } else { + visible = elSideVal <= parentSideVal; + } + + if (!visible) return parent; + if (parent === getWindowScrollingElement()) break; + parent = getParentAutoScrollElement(parent, false); + } + + return false; +} +/** + * Gets nth child of el, ignoring hidden children, sortable's elements (does not ignore clone if it's visible) + * and non-draggable elements + * @param {HTMLElement} el The parent element + * @param {Number} childNum The index of the child + * @param {Object} options Parent Sortable's options + * @return {HTMLElement} The child at index childNum, or null if not found + */ + + +function getChild(el, childNum, options) { + var currentChild = 0, + i = 0, + children = el.children; + + while (i < children.length) { + if (children[i].style.display !== 'none' && children[i] !== Sortable.ghost && children[i] !== Sortable.dragged && closest(children[i], options.draggable, el, false)) { + if (currentChild === childNum) { + return children[i]; + } + + currentChild++; + } + + i++; + } + + return null; +} +/** + * Gets the last child in the el, ignoring ghostEl or invisible elements (clones) + * @param {HTMLElement} el Parent element + * @param {selector} selector Any other elements that should be ignored + * @return {HTMLElement} The last child, ignoring ghostEl + */ + + +function lastChild(el, selector) { + var last = el.lastElementChild; + + while (last && (last === Sortable.ghost || css(last, 'display') === 'none' || selector && !matches(last, selector))) { + last = last.previousElementSibling; + } + + return last || null; +} +/** + * Returns the index of an element within its parent for a selected set of + * elements + * @param {HTMLElement} el + * @param {selector} selector + * @return {number} + */ + + +function index(el, selector) { + var index = 0; + + if (!el || !el.parentNode) { + return -1; + } + /* jshint boss:true */ + + + while (el = el.previousElementSibling) { + if (el.nodeName.toUpperCase() !== 'TEMPLATE' && el !== Sortable.clone && (!selector || matches(el, selector))) { + index++; + } + } + + return index; +} +/** + * Returns the scroll offset of the given element, added with all the scroll offsets of parent elements. + * The value is returned in real pixels. + * @param {HTMLElement} el + * @return {Array} Offsets in the format of [left, top] + */ + + +function getRelativeScrollOffset(el) { + var offsetLeft = 0, + offsetTop = 0, + winScroller = getWindowScrollingElement(); + + if (el) { + do { + var elMatrix = matrix(el), + scaleX = elMatrix.a, + scaleY = elMatrix.d; + offsetLeft += el.scrollLeft * scaleX; + offsetTop += el.scrollTop * scaleY; + } while (el !== winScroller && (el = el.parentNode)); + } + + return [offsetLeft, offsetTop]; +} +/** + * Returns the index of the object within the given array + * @param {Array} arr Array that may or may not hold the object + * @param {Object} obj An object that has a key-value pair unique to and identical to a key-value pair in the object you want to find + * @return {Number} The index of the object in the array, or -1 + */ + + +function indexOfObject(arr, obj) { + for (var i in arr) { + if (!arr.hasOwnProperty(i)) continue; + + for (var key in obj) { + if (obj.hasOwnProperty(key) && obj[key] === arr[i][key]) return Number(i); + } + } + + return -1; +} + +function getParentAutoScrollElement(el, includeSelf) { + // skip to window + if (!el || !el.getBoundingClientRect) return getWindowScrollingElement(); + var elem = el; + var gotSelf = false; + + do { + // we don't need to get elem css if it isn't even overflowing in the first place (performance) + if (elem.clientWidth < elem.scrollWidth || elem.clientHeight < elem.scrollHeight) { + var elemCSS = css(elem); + + if (elem.clientWidth < elem.scrollWidth && (elemCSS.overflowX == 'auto' || elemCSS.overflowX == 'scroll') || elem.clientHeight < elem.scrollHeight && (elemCSS.overflowY == 'auto' || elemCSS.overflowY == 'scroll')) { + if (!elem.getBoundingClientRect || elem === document.body) return getWindowScrollingElement(); + if (gotSelf || includeSelf) return elem; + gotSelf = true; + } + } + /* jshint boss:true */ + + } while (elem = elem.parentNode); + + return getWindowScrollingElement(); +} + +function extend(dst, src) { + if (dst && src) { + for (var key in src) { + if (src.hasOwnProperty(key)) { + dst[key] = src[key]; + } + } + } + + return dst; +} + +function isRectEqual(rect1, rect2) { + return Math.round(rect1.top) === Math.round(rect2.top) && Math.round(rect1.left) === Math.round(rect2.left) && Math.round(rect1.height) === Math.round(rect2.height) && Math.round(rect1.width) === Math.round(rect2.width); +} + +var _throttleTimeout; + +function throttle(callback, ms) { + return function () { + if (!_throttleTimeout) { + var args = arguments, + _this = this; + + if (args.length === 1) { + callback.call(_this, args[0]); + } else { + callback.apply(_this, args); + } + + _throttleTimeout = setTimeout(function () { + _throttleTimeout = void 0; + }, ms); + } + }; +} + +function cancelThrottle() { + clearTimeout(_throttleTimeout); + _throttleTimeout = void 0; +} + +function scrollBy(el, x, y) { + el.scrollLeft += x; + el.scrollTop += y; +} + +function clone(el) { + var Polymer = window.Polymer; + var $ = window.jQuery || window.Zepto; + + if (Polymer && Polymer.dom) { + return Polymer.dom(el).cloneNode(true); + } else if ($) { + return $(el).clone(true)[0]; + } else { + return el.cloneNode(true); + } +} + +function setRect(el, rect) { + css(el, 'position', 'absolute'); + css(el, 'top', rect.top); + css(el, 'left', rect.left); + css(el, 'width', rect.width); + css(el, 'height', rect.height); +} + +function unsetRect(el) { + css(el, 'position', ''); + css(el, 'top', ''); + css(el, 'left', ''); + css(el, 'width', ''); + css(el, 'height', ''); +} + +var expando = 'Sortable' + new Date().getTime(); + +function AnimationStateManager() { + var animationStates = [], + animationCallbackId; + return { + captureAnimationState: function captureAnimationState() { + animationStates = []; + if (!this.options.animation) return; + var children = [].slice.call(this.el.children); + children.forEach(function (child) { + if (css(child, 'display') === 'none' || child === Sortable.ghost) return; + animationStates.push({ + target: child, + rect: getRect(child) + }); + + var fromRect = _objectSpread({}, animationStates[animationStates.length - 1].rect); // If animating: compensate for current animation + + + if (child.thisAnimationDuration) { + var childMatrix = matrix(child, true); + + if (childMatrix) { + fromRect.top -= childMatrix.f; + fromRect.left -= childMatrix.e; + } + } + + child.fromRect = fromRect; + }); + }, + addAnimationState: function addAnimationState(state) { + animationStates.push(state); + }, + removeAnimationState: function removeAnimationState(target) { + animationStates.splice(indexOfObject(animationStates, { + target: target + }), 1); + }, + animateAll: function animateAll(callback) { + var _this = this; + + if (!this.options.animation) { + clearTimeout(animationCallbackId); + if (typeof callback === 'function') callback(); + return; + } + + var animating = false, + animationTime = 0; + animationStates.forEach(function (state) { + var time = 0, + target = state.target, + fromRect = target.fromRect, + toRect = getRect(target), + prevFromRect = target.prevFromRect, + prevToRect = target.prevToRect, + animatingRect = state.rect, + targetMatrix = matrix(target, true); + + if (targetMatrix) { + // Compensate for current animation + toRect.top -= targetMatrix.f; + toRect.left -= targetMatrix.e; + } + + target.toRect = toRect; + + if (target.thisAnimationDuration) { + // Could also check if animatingRect is between fromRect and toRect + if (isRectEqual(prevFromRect, toRect) && !isRectEqual(fromRect, toRect) && // Make sure animatingRect is on line between toRect & fromRect + (animatingRect.top - toRect.top) / (animatingRect.left - toRect.left) === (fromRect.top - toRect.top) / (fromRect.left - toRect.left)) { + // If returning to same place as started from animation and on same axis + time = calculateRealTime(animatingRect, prevFromRect, prevToRect, _this.options); + } + } // if fromRect != toRect: animate + + + if (!isRectEqual(toRect, fromRect)) { + target.prevFromRect = fromRect; + target.prevToRect = toRect; + + if (!time) { + time = _this.options.animation; + } + + _this.animate(target, animatingRect, toRect, time); + } + + if (time) { + animating = true; + animationTime = Math.max(animationTime, time); + clearTimeout(target.animationResetTimer); + target.animationResetTimer = setTimeout(function () { + target.animationTime = 0; + target.prevFromRect = null; + target.fromRect = null; + target.prevToRect = null; + target.thisAnimationDuration = null; + }, time); + target.thisAnimationDuration = time; + } + }); + clearTimeout(animationCallbackId); + + if (!animating) { + if (typeof callback === 'function') callback(); + } else { + animationCallbackId = setTimeout(function () { + if (typeof callback === 'function') callback(); + }, animationTime); + } + + animationStates = []; + }, + animate: function animate(target, currentRect, toRect, duration) { + if (duration) { + css(target, 'transition', ''); + css(target, 'transform', ''); + var elMatrix = matrix(this.el), + scaleX = elMatrix && elMatrix.a, + scaleY = elMatrix && elMatrix.d, + translateX = (currentRect.left - toRect.left) / (scaleX || 1), + translateY = (currentRect.top - toRect.top) / (scaleY || 1); + target.animatingX = !!translateX; + target.animatingY = !!translateY; + css(target, 'transform', 'translate3d(' + translateX + 'px,' + translateY + 'px,0)'); + repaint(target); // repaint + + css(target, 'transition', 'transform ' + duration + 'ms' + (this.options.easing ? ' ' + this.options.easing : '')); + css(target, 'transform', 'translate3d(0,0,0)'); + typeof target.animated === 'number' && clearTimeout(target.animated); + target.animated = setTimeout(function () { + css(target, 'transition', ''); + css(target, 'transform', ''); + target.animated = false; + target.animatingX = false; + target.animatingY = false; + }, duration); + } + } + }; +} + +function repaint(target) { + return target.offsetWidth; +} + +function calculateRealTime(animatingRect, fromRect, toRect, options) { + return Math.sqrt(Math.pow(fromRect.top - animatingRect.top, 2) + Math.pow(fromRect.left - animatingRect.left, 2)) / Math.sqrt(Math.pow(fromRect.top - toRect.top, 2) + Math.pow(fromRect.left - toRect.left, 2)) * options.animation; +} + +var plugins = []; +var defaults = { + initializeByDefault: true +}; +var PluginManager = { + mount: function mount(plugin) { + // Set default static properties + for (var option in defaults) { + if (defaults.hasOwnProperty(option) && !(option in plugin)) { + plugin[option] = defaults[option]; + } + } + + plugins.push(plugin); + }, + pluginEvent: function pluginEvent(eventName, sortable, evt) { + var _this = this; + + this.eventCanceled = false; + + evt.cancel = function () { + _this.eventCanceled = true; + }; + + var eventNameGlobal = eventName + 'Global'; + plugins.forEach(function (plugin) { + if (!sortable[plugin.pluginName]) return; // Fire global events if it exists in this sortable + + if (sortable[plugin.pluginName][eventNameGlobal]) { + sortable[plugin.pluginName][eventNameGlobal](_objectSpread({ + sortable: sortable + }, evt)); + } // Only fire plugin event if plugin is enabled in this sortable, + // and plugin has event defined + + + if (sortable.options[plugin.pluginName] && sortable[plugin.pluginName][eventName]) { + sortable[plugin.pluginName][eventName](_objectSpread({ + sortable: sortable + }, evt)); + } + }); + }, + initializePlugins: function initializePlugins(sortable, el, defaults, options) { + plugins.forEach(function (plugin) { + var pluginName = plugin.pluginName; + if (!sortable.options[pluginName] && !plugin.initializeByDefault) return; + var initialized = new plugin(sortable, el, sortable.options); + initialized.sortable = sortable; + initialized.options = sortable.options; + sortable[pluginName] = initialized; // Add default options from plugin + + _extends(defaults, initialized.defaults); + }); + + for (var option in sortable.options) { + if (!sortable.options.hasOwnProperty(option)) continue; + var modified = this.modifyOption(sortable, option, sortable.options[option]); + + if (typeof modified !== 'undefined') { + sortable.options[option] = modified; + } + } + }, + getEventProperties: function getEventProperties(name, sortable) { + var eventProperties = {}; + plugins.forEach(function (plugin) { + if (typeof plugin.eventProperties !== 'function') return; + + _extends(eventProperties, plugin.eventProperties.call(sortable[plugin.pluginName], name)); + }); + return eventProperties; + }, + modifyOption: function modifyOption(sortable, name, value) { + var modifiedValue; + plugins.forEach(function (plugin) { + // Plugin must exist on the Sortable + if (!sortable[plugin.pluginName]) return; // If static option listener exists for this option, call in the context of the Sortable's instance of this plugin + + if (plugin.optionListeners && typeof plugin.optionListeners[name] === 'function') { + modifiedValue = plugin.optionListeners[name].call(sortable[plugin.pluginName], value); + } + }); + return modifiedValue; + } +}; + +function dispatchEvent(_ref) { + var sortable = _ref.sortable, + rootEl = _ref.rootEl, + name = _ref.name, + targetEl = _ref.targetEl, + cloneEl = _ref.cloneEl, + toEl = _ref.toEl, + fromEl = _ref.fromEl, + oldIndex = _ref.oldIndex, + newIndex = _ref.newIndex, + oldDraggableIndex = _ref.oldDraggableIndex, + newDraggableIndex = _ref.newDraggableIndex, + originalEvent = _ref.originalEvent, + putSortable = _ref.putSortable, + extraEventProperties = _ref.extraEventProperties; + sortable = sortable || rootEl && rootEl[expando]; + if (!sortable) return; + var evt, + options = sortable.options, + onName = 'on' + name.charAt(0).toUpperCase() + name.substr(1); // Support for new CustomEvent feature + + if (window.CustomEvent && !IE11OrLess && !Edge) { + evt = new CustomEvent(name, { + bubbles: true, + cancelable: true + }); + } else { + evt = document.createEvent('Event'); + evt.initEvent(name, true, true); + } + + evt.to = toEl || rootEl; + evt.from = fromEl || rootEl; + evt.item = targetEl || rootEl; + evt.clone = cloneEl; + evt.oldIndex = oldIndex; + evt.newIndex = newIndex; + evt.oldDraggableIndex = oldDraggableIndex; + evt.newDraggableIndex = newDraggableIndex; + evt.originalEvent = originalEvent; + evt.pullMode = putSortable ? putSortable.lastPutMode : undefined; + + var allEventProperties = _objectSpread({}, extraEventProperties, PluginManager.getEventProperties(name, sortable)); + + for (var option in allEventProperties) { + evt[option] = allEventProperties[option]; + } + + if (rootEl) { + rootEl.dispatchEvent(evt); + } + + if (options[onName]) { + options[onName].call(sortable, evt); + } +} + +var pluginEvent = function pluginEvent(eventName, sortable) { + var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}, + originalEvent = _ref.evt, + data = _objectWithoutProperties(_ref, ["evt"]); + + PluginManager.pluginEvent.bind(Sortable)(eventName, sortable, _objectSpread({ + dragEl: dragEl, + parentEl: parentEl, + ghostEl: ghostEl, + rootEl: rootEl, + nextEl: nextEl, + lastDownEl: lastDownEl, + cloneEl: cloneEl, + cloneHidden: cloneHidden, + dragStarted: moved, + putSortable: putSortable, + activeSortable: Sortable.active, + originalEvent: originalEvent, + oldIndex: oldIndex, + oldDraggableIndex: oldDraggableIndex, + newIndex: newIndex, + newDraggableIndex: newDraggableIndex, + hideGhostForTarget: _hideGhostForTarget, + unhideGhostForTarget: _unhideGhostForTarget, + cloneNowHidden: function cloneNowHidden() { + cloneHidden = true; + }, + cloneNowShown: function cloneNowShown() { + cloneHidden = false; + }, + dispatchSortableEvent: function dispatchSortableEvent(name) { + _dispatchEvent({ + sortable: sortable, + name: name, + originalEvent: originalEvent + }); + } + }, data)); +}; + +function _dispatchEvent(info) { + dispatchEvent(_objectSpread({ + putSortable: putSortable, + cloneEl: cloneEl, + targetEl: dragEl, + rootEl: rootEl, + oldIndex: oldIndex, + oldDraggableIndex: oldDraggableIndex, + newIndex: newIndex, + newDraggableIndex: newDraggableIndex + }, info)); +} + +var dragEl, + parentEl, + ghostEl, + rootEl, + nextEl, + lastDownEl, + cloneEl, + cloneHidden, + oldIndex, + newIndex, + oldDraggableIndex, + newDraggableIndex, + activeGroup, + putSortable, + awaitingDragStarted = false, + ignoreNextClick = false, + sortables = [], + tapEvt, + touchEvt, + lastDx, + lastDy, + tapDistanceLeft, + tapDistanceTop, + moved, + lastTarget, + lastDirection, + pastFirstInvertThresh = false, + isCircumstantialInvert = false, + targetMoveDistance, + // For positioning ghost absolutely +ghostRelativeParent, + ghostRelativeParentInitialScroll = [], + // (left, top) +_silent = false, + savedInputChecked = []; +/** @const */ + +var documentExists = typeof document !== 'undefined', + PositionGhostAbsolutely = IOS, + CSSFloatProperty = Edge || IE11OrLess ? 'cssFloat' : 'float', + // This will not pass for IE9, because IE9 DnD only works on anchors +supportDraggable = documentExists && !ChromeForAndroid && !IOS && 'draggable' in document.createElement('div'), + supportCssPointerEvents = function () { + if (!documentExists) return; // false when <= IE11 + + if (IE11OrLess) { + return false; + } + + var el = document.createElement('x'); + el.style.cssText = 'pointer-events:auto'; + return el.style.pointerEvents === 'auto'; +}(), + _detectDirection = function _detectDirection(el, options) { + var elCSS = css(el), + elWidth = parseInt(elCSS.width) - parseInt(elCSS.paddingLeft) - parseInt(elCSS.paddingRight) - parseInt(elCSS.borderLeftWidth) - parseInt(elCSS.borderRightWidth), + child1 = getChild(el, 0, options), + child2 = getChild(el, 1, options), + firstChildCSS = child1 && css(child1), + secondChildCSS = child2 && css(child2), + firstChildWidth = firstChildCSS && parseInt(firstChildCSS.marginLeft) + parseInt(firstChildCSS.marginRight) + getRect(child1).width, + secondChildWidth = secondChildCSS && parseInt(secondChildCSS.marginLeft) + parseInt(secondChildCSS.marginRight) + getRect(child2).width; + + if (elCSS.display === 'flex') { + return elCSS.flexDirection === 'column' || elCSS.flexDirection === 'column-reverse' ? 'vertical' : 'horizontal'; + } + + if (elCSS.display === 'grid') { + return elCSS.gridTemplateColumns.split(' ').length <= 1 ? 'vertical' : 'horizontal'; + } + + if (child1 && firstChildCSS["float"] && firstChildCSS["float"] !== 'none') { + var touchingSideChild2 = firstChildCSS["float"] === 'left' ? 'left' : 'right'; + return child2 && (secondChildCSS.clear === 'both' || secondChildCSS.clear === touchingSideChild2) ? 'vertical' : 'horizontal'; + } + + return child1 && (firstChildCSS.display === 'block' || firstChildCSS.display === 'flex' || firstChildCSS.display === 'table' || firstChildCSS.display === 'grid' || firstChildWidth >= elWidth && elCSS[CSSFloatProperty] === 'none' || child2 && elCSS[CSSFloatProperty] === 'none' && firstChildWidth + secondChildWidth > elWidth) ? 'vertical' : 'horizontal'; +}, + _dragElInRowColumn = function _dragElInRowColumn(dragRect, targetRect, vertical) { + var dragElS1Opp = vertical ? dragRect.left : dragRect.top, + dragElS2Opp = vertical ? dragRect.right : dragRect.bottom, + dragElOppLength = vertical ? dragRect.width : dragRect.height, + targetS1Opp = vertical ? targetRect.left : targetRect.top, + targetS2Opp = vertical ? targetRect.right : targetRect.bottom, + targetOppLength = vertical ? targetRect.width : targetRect.height; + return dragElS1Opp === targetS1Opp || dragElS2Opp === targetS2Opp || dragElS1Opp + dragElOppLength / 2 === targetS1Opp + targetOppLength / 2; +}, + +/** + * Detects first nearest empty sortable to X and Y position using emptyInsertThreshold. + * @param {Number} x X position + * @param {Number} y Y position + * @return {HTMLElement} Element of the first found nearest Sortable + */ +_detectNearestEmptySortable = function _detectNearestEmptySortable(x, y) { + var ret; + sortables.some(function (sortable) { + if (lastChild(sortable)) return; + var rect = getRect(sortable), + threshold = sortable[expando].options.emptyInsertThreshold, + insideHorizontally = x >= rect.left - threshold && x <= rect.right + threshold, + insideVertically = y >= rect.top - threshold && y <= rect.bottom + threshold; + + if (threshold && insideHorizontally && insideVertically) { + return ret = sortable; + } + }); + return ret; +}, + _prepareGroup = function _prepareGroup(options) { + function toFn(value, pull) { + return function (to, from, dragEl, evt) { + var sameGroup = to.options.group.name && from.options.group.name && to.options.group.name === from.options.group.name; + + if (value == null && (pull || sameGroup)) { + // Default pull value + // Default pull and put value if same group + return true; + } else if (value == null || value === false) { + return false; + } else if (pull && value === 'clone') { + return value; + } else if (typeof value === 'function') { + return toFn(value(to, from, dragEl, evt), pull)(to, from, dragEl, evt); + } else { + var otherGroup = (pull ? to : from).options.group.name; + return value === true || typeof value === 'string' && value === otherGroup || value.join && value.indexOf(otherGroup) > -1; + } + }; + } + + var group = {}; + var originalGroup = options.group; + + if (!originalGroup || _typeof(originalGroup) != 'object') { + originalGroup = { + name: originalGroup + }; + } + + group.name = originalGroup.name; + group.checkPull = toFn(originalGroup.pull, true); + group.checkPut = toFn(originalGroup.put); + group.revertClone = originalGroup.revertClone; + options.group = group; +}, + _hideGhostForTarget = function _hideGhostForTarget() { + if (!supportCssPointerEvents && ghostEl) { + css(ghostEl, 'display', 'none'); + } +}, + _unhideGhostForTarget = function _unhideGhostForTarget() { + if (!supportCssPointerEvents && ghostEl) { + css(ghostEl, 'display', ''); + } +}; // #1184 fix - Prevent click event on fallback if dragged but item not changed position + + +if (documentExists) { + document.addEventListener('click', function (evt) { + if (ignoreNextClick) { + evt.preventDefault(); + evt.stopPropagation && evt.stopPropagation(); + evt.stopImmediatePropagation && evt.stopImmediatePropagation(); + ignoreNextClick = false; + return false; + } + }, true); +} + +var nearestEmptyInsertDetectEvent = function nearestEmptyInsertDetectEvent(evt) { + if (dragEl) { + evt = evt.touches ? evt.touches[0] : evt; + + var nearest = _detectNearestEmptySortable(evt.clientX, evt.clientY); + + if (nearest) { + // Create imitation event + var event = {}; + + for (var i in evt) { + if (evt.hasOwnProperty(i)) { + event[i] = evt[i]; + } + } + + event.target = event.rootEl = nearest; + event.preventDefault = void 0; + event.stopPropagation = void 0; + + nearest[expando]._onDragOver(event); + } + } +}; + +var _checkOutsideTargetEl = function _checkOutsideTargetEl(evt) { + if (dragEl) { + dragEl.parentNode[expando]._isOutsideThisEl(evt.target); + } +}; +/** + * @class Sortable + * @param {HTMLElement} el + * @param {Object} [options] + */ + + +function Sortable(el, options) { + if (!(el && el.nodeType && el.nodeType === 1)) { + throw "Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(el)); + } + + this.el = el; // root element + + this.options = options = _extends({}, options); // Export instance + + el[expando] = this; + var defaults = { + group: null, + sort: true, + disabled: false, + store: null, + handle: null, + draggable: /^[uo]l$/i.test(el.nodeName) ? '>li' : '>*', + swapThreshold: 1, + // percentage; 0 <= x <= 1 + invertSwap: false, + // invert always + invertedSwapThreshold: null, + // will be set to same as swapThreshold if default + removeCloneOnHide: true, + direction: function direction() { + return _detectDirection(el, this.options); + }, + ghostClass: 'sortable-ghost', + chosenClass: 'sortable-chosen', + dragClass: 'sortable-drag', + ignore: 'a, img', + filter: null, + preventOnFilter: true, + animation: 0, + easing: null, + setData: function setData(dataTransfer, dragEl) { + dataTransfer.setData('Text', dragEl.textContent); + }, + dropBubble: false, + dragoverBubble: false, + dataIdAttr: 'data-id', + delay: 0, + delayOnTouchOnly: false, + touchStartThreshold: (Number.parseInt ? Number : window).parseInt(window.devicePixelRatio, 10) || 1, + forceFallback: false, + fallbackClass: 'sortable-fallback', + fallbackOnBody: false, + fallbackTolerance: 0, + fallbackOffset: { + x: 0, + y: 0 + }, + supportPointer: Sortable.supportPointer !== false && 'PointerEvent' in window, + emptyInsertThreshold: 5 + }; + PluginManager.initializePlugins(this, el, defaults); // Set default options + + for (var name in defaults) { + !(name in options) && (options[name] = defaults[name]); + } + + _prepareGroup(options); // Bind all private methods + + + for (var fn in this) { + if (fn.charAt(0) === '_' && typeof this[fn] === 'function') { + this[fn] = this[fn].bind(this); + } + } // Setup drag mode + + + this.nativeDraggable = options.forceFallback ? false : supportDraggable; + + if (this.nativeDraggable) { + // Touch start threshold cannot be greater than the native dragstart threshold + this.options.touchStartThreshold = 1; + } // Bind events + + + if (options.supportPointer) { + on(el, 'pointerdown', this._onTapStart); + } else { + on(el, 'mousedown', this._onTapStart); + on(el, 'touchstart', this._onTapStart); + } + + if (this.nativeDraggable) { + on(el, 'dragover', this); + on(el, 'dragenter', this); + } + + sortables.push(this.el); // Restore sorting + + options.store && options.store.get && this.sort(options.store.get(this) || []); // Add animation state manager + + _extends(this, AnimationStateManager()); +} + +Sortable.prototype = +/** @lends Sortable.prototype */ +{ + constructor: Sortable, + _isOutsideThisEl: function _isOutsideThisEl(target) { + if (!this.el.contains(target) && target !== this.el) { + lastTarget = null; + } + }, + _getDirection: function _getDirection(evt, target) { + return typeof this.options.direction === 'function' ? this.options.direction.call(this, evt, target, dragEl) : this.options.direction; + }, + _onTapStart: function _onTapStart( + /** Event|TouchEvent */ + evt) { + if (!evt.cancelable) return; + + var _this = this, + el = this.el, + options = this.options, + preventOnFilter = options.preventOnFilter, + type = evt.type, + touch = evt.touches && evt.touches[0] || evt.pointerType && evt.pointerType === 'touch' && evt, + target = (touch || evt).target, + originalTarget = evt.target.shadowRoot && (evt.path && evt.path[0] || evt.composedPath && evt.composedPath()[0]) || target, + filter = options.filter; + + _saveInputCheckedState(el); // Don't trigger start event when an element is been dragged, otherwise the evt.oldindex always wrong when set option.group. + + + if (dragEl) { + return; + } + + if (/mousedown|pointerdown/.test(type) && evt.button !== 0 || options.disabled) { + return; // only left button and enabled + } // cancel dnd if original target is content editable + + + if (originalTarget.isContentEditable) { + return; + } + + target = closest(target, options.draggable, el, false); + + if (target && target.animated) { + return; + } + + if (lastDownEl === target) { + // Ignoring duplicate `down` + return; + } // Get the index of the dragged element within its parent + + + oldIndex = index(target); + oldDraggableIndex = index(target, options.draggable); // Check filter + + if (typeof filter === 'function') { + if (filter.call(this, evt, target, this)) { + _dispatchEvent({ + sortable: _this, + rootEl: originalTarget, + name: 'filter', + targetEl: target, + toEl: el, + fromEl: el + }); + + pluginEvent('filter', _this, { + evt: evt + }); + preventOnFilter && evt.cancelable && evt.preventDefault(); + return; // cancel dnd + } + } else if (filter) { + filter = filter.split(',').some(function (criteria) { + criteria = closest(originalTarget, criteria.trim(), el, false); + + if (criteria) { + _dispatchEvent({ + sortable: _this, + rootEl: criteria, + name: 'filter', + targetEl: target, + fromEl: el, + toEl: el + }); + + pluginEvent('filter', _this, { + evt: evt + }); + return true; + } + }); + + if (filter) { + preventOnFilter && evt.cancelable && evt.preventDefault(); + return; // cancel dnd + } + } + + if (options.handle && !closest(originalTarget, options.handle, el, false)) { + return; + } // Prepare `dragstart` + + + this._prepareDragStart(evt, touch, target); + }, + _prepareDragStart: function _prepareDragStart( + /** Event */ + evt, + /** Touch */ + touch, + /** HTMLElement */ + target) { + var _this = this, + el = _this.el, + options = _this.options, + ownerDocument = el.ownerDocument, + dragStartFn; + + if (target && !dragEl && target.parentNode === el) { + var dragRect = getRect(target); + rootEl = el; + dragEl = target; + parentEl = dragEl.parentNode; + nextEl = dragEl.nextSibling; + lastDownEl = target; + activeGroup = options.group; + Sortable.dragged = dragEl; + tapEvt = { + target: dragEl, + clientX: (touch || evt).clientX, + clientY: (touch || evt).clientY + }; + tapDistanceLeft = tapEvt.clientX - dragRect.left; + tapDistanceTop = tapEvt.clientY - dragRect.top; + this._lastX = (touch || evt).clientX; + this._lastY = (touch || evt).clientY; + dragEl.style['will-change'] = 'all'; + + dragStartFn = function dragStartFn() { + pluginEvent('delayEnded', _this, { + evt: evt + }); + + if (Sortable.eventCanceled) { + _this._onDrop(); + + return; + } // Delayed drag has been triggered + // we can re-enable the events: touchmove/mousemove + + + _this._disableDelayedDragEvents(); + + if (!FireFox && _this.nativeDraggable) { + dragEl.draggable = true; + } // Bind the events: dragstart/dragend + + + _this._triggerDragStart(evt, touch); // Drag start event + + + _dispatchEvent({ + sortable: _this, + name: 'choose', + originalEvent: evt + }); // Chosen item + + + toggleClass(dragEl, options.chosenClass, true); + }; // Disable "draggable" + + + options.ignore.split(',').forEach(function (criteria) { + find(dragEl, criteria.trim(), _disableDraggable); + }); + on(ownerDocument, 'dragover', nearestEmptyInsertDetectEvent); + on(ownerDocument, 'mousemove', nearestEmptyInsertDetectEvent); + on(ownerDocument, 'touchmove', nearestEmptyInsertDetectEvent); + on(ownerDocument, 'mouseup', _this._onDrop); + on(ownerDocument, 'touchend', _this._onDrop); + on(ownerDocument, 'touchcancel', _this._onDrop); // Make dragEl draggable (must be before delay for FireFox) + + if (FireFox && this.nativeDraggable) { + this.options.touchStartThreshold = 4; + dragEl.draggable = true; + } + + pluginEvent('delayStart', this, { + evt: evt + }); // Delay is impossible for native DnD in Edge or IE + + if (options.delay && (!options.delayOnTouchOnly || touch) && (!this.nativeDraggable || !(Edge || IE11OrLess))) { + if (Sortable.eventCanceled) { + this._onDrop(); + + return; + } // If the user moves the pointer or let go the click or touch + // before the delay has been reached: + // disable the delayed drag + + + on(ownerDocument, 'mouseup', _this._disableDelayedDrag); + on(ownerDocument, 'touchend', _this._disableDelayedDrag); + on(ownerDocument, 'touchcancel', _this._disableDelayedDrag); + on(ownerDocument, 'mousemove', _this._delayedDragTouchMoveHandler); + on(ownerDocument, 'touchmove', _this._delayedDragTouchMoveHandler); + options.supportPointer && on(ownerDocument, 'pointermove', _this._delayedDragTouchMoveHandler); + _this._dragStartTimer = setTimeout(dragStartFn, options.delay); + } else { + dragStartFn(); + } + } + }, + _delayedDragTouchMoveHandler: function _delayedDragTouchMoveHandler( + /** TouchEvent|PointerEvent **/ + e) { + var touch = e.touches ? e.touches[0] : e; + + if (Math.max(Math.abs(touch.clientX - this._lastX), Math.abs(touch.clientY - this._lastY)) >= Math.floor(this.options.touchStartThreshold / (this.nativeDraggable && window.devicePixelRatio || 1))) { + this._disableDelayedDrag(); + } + }, + _disableDelayedDrag: function _disableDelayedDrag() { + dragEl && _disableDraggable(dragEl); + clearTimeout(this._dragStartTimer); + + this._disableDelayedDragEvents(); + }, + _disableDelayedDragEvents: function _disableDelayedDragEvents() { + var ownerDocument = this.el.ownerDocument; + off(ownerDocument, 'mouseup', this._disableDelayedDrag); + off(ownerDocument, 'touchend', this._disableDelayedDrag); + off(ownerDocument, 'touchcancel', this._disableDelayedDrag); + off(ownerDocument, 'mousemove', this._delayedDragTouchMoveHandler); + off(ownerDocument, 'touchmove', this._delayedDragTouchMoveHandler); + off(ownerDocument, 'pointermove', this._delayedDragTouchMoveHandler); + }, + _triggerDragStart: function _triggerDragStart( + /** Event */ + evt, + /** Touch */ + touch) { + touch = touch || evt.pointerType == 'touch' && evt; + + if (!this.nativeDraggable || touch) { + if (this.options.supportPointer) { + on(document, 'pointermove', this._onTouchMove); + } else if (touch) { + on(document, 'touchmove', this._onTouchMove); + } else { + on(document, 'mousemove', this._onTouchMove); + } + } else { + on(dragEl, 'dragend', this); + on(rootEl, 'dragstart', this._onDragStart); + } + + try { + if (document.selection) { + // Timeout neccessary for IE9 + _nextTick(function () { + document.selection.empty(); + }); + } else { + window.getSelection().removeAllRanges(); + } + } catch (err) {} + }, + _dragStarted: function _dragStarted(fallback, evt) { + + awaitingDragStarted = false; + + if (rootEl && dragEl) { + pluginEvent('dragStarted', this, { + evt: evt + }); + + if (this.nativeDraggable) { + on(document, 'dragover', _checkOutsideTargetEl); + } + + var options = this.options; // Apply effect + + !fallback && toggleClass(dragEl, options.dragClass, false); + toggleClass(dragEl, options.ghostClass, true); + Sortable.active = this; + fallback && this._appendGhost(); // Drag start event + + _dispatchEvent({ + sortable: this, + name: 'start', + originalEvent: evt + }); + } else { + this._nulling(); + } + }, + _emulateDragOver: function _emulateDragOver() { + if (touchEvt) { + this._lastX = touchEvt.clientX; + this._lastY = touchEvt.clientY; + + _hideGhostForTarget(); + + var target = document.elementFromPoint(touchEvt.clientX, touchEvt.clientY); + var parent = target; + + while (target && target.shadowRoot) { + target = target.shadowRoot.elementFromPoint(touchEvt.clientX, touchEvt.clientY); + if (target === parent) break; + parent = target; + } + + dragEl.parentNode[expando]._isOutsideThisEl(target); + + if (parent) { + do { + if (parent[expando]) { + var inserted = void 0; + inserted = parent[expando]._onDragOver({ + clientX: touchEvt.clientX, + clientY: touchEvt.clientY, + target: target, + rootEl: parent + }); + + if (inserted && !this.options.dragoverBubble) { + break; + } + } + + target = parent; // store last element + } + /* jshint boss:true */ + while (parent = parent.parentNode); + } + + _unhideGhostForTarget(); + } + }, + _onTouchMove: function _onTouchMove( + /**TouchEvent*/ + evt) { + if (tapEvt) { + var options = this.options, + fallbackTolerance = options.fallbackTolerance, + fallbackOffset = options.fallbackOffset, + touch = evt.touches ? evt.touches[0] : evt, + ghostMatrix = ghostEl && matrix(ghostEl, true), + scaleX = ghostEl && ghostMatrix && ghostMatrix.a, + scaleY = ghostEl && ghostMatrix && ghostMatrix.d, + relativeScrollOffset = PositionGhostAbsolutely && ghostRelativeParent && getRelativeScrollOffset(ghostRelativeParent), + dx = (touch.clientX - tapEvt.clientX + fallbackOffset.x) / (scaleX || 1) + (relativeScrollOffset ? relativeScrollOffset[0] - ghostRelativeParentInitialScroll[0] : 0) / (scaleX || 1), + dy = (touch.clientY - tapEvt.clientY + fallbackOffset.y) / (scaleY || 1) + (relativeScrollOffset ? relativeScrollOffset[1] - ghostRelativeParentInitialScroll[1] : 0) / (scaleY || 1); // only set the status to dragging, when we are actually dragging + + if (!Sortable.active && !awaitingDragStarted) { + if (fallbackTolerance && Math.max(Math.abs(touch.clientX - this._lastX), Math.abs(touch.clientY - this._lastY)) < fallbackTolerance) { + return; + } + + this._onDragStart(evt, true); + } + + if (ghostEl) { + if (ghostMatrix) { + ghostMatrix.e += dx - (lastDx || 0); + ghostMatrix.f += dy - (lastDy || 0); + } else { + ghostMatrix = { + a: 1, + b: 0, + c: 0, + d: 1, + e: dx, + f: dy + }; + } + + var cssMatrix = "matrix(".concat(ghostMatrix.a, ",").concat(ghostMatrix.b, ",").concat(ghostMatrix.c, ",").concat(ghostMatrix.d, ",").concat(ghostMatrix.e, ",").concat(ghostMatrix.f, ")"); + css(ghostEl, 'webkitTransform', cssMatrix); + css(ghostEl, 'mozTransform', cssMatrix); + css(ghostEl, 'msTransform', cssMatrix); + css(ghostEl, 'transform', cssMatrix); + lastDx = dx; + lastDy = dy; + touchEvt = touch; + } + + evt.cancelable && evt.preventDefault(); + } + }, + _appendGhost: function _appendGhost() { + // Bug if using scale(): https://stackoverflow.com/questions/2637058 + // Not being adjusted for + if (!ghostEl) { + var container = this.options.fallbackOnBody ? document.body : rootEl, + rect = getRect(dragEl, true, PositionGhostAbsolutely, true, container), + options = this.options; // Position absolutely + + if (PositionGhostAbsolutely) { + // Get relatively positioned parent + ghostRelativeParent = container; + + while (css(ghostRelativeParent, 'position') === 'static' && css(ghostRelativeParent, 'transform') === 'none' && ghostRelativeParent !== document) { + ghostRelativeParent = ghostRelativeParent.parentNode; + } + + if (ghostRelativeParent !== document.body && ghostRelativeParent !== document.documentElement) { + if (ghostRelativeParent === document) ghostRelativeParent = getWindowScrollingElement(); + rect.top += ghostRelativeParent.scrollTop; + rect.left += ghostRelativeParent.scrollLeft; + } else { + ghostRelativeParent = getWindowScrollingElement(); + } + + ghostRelativeParentInitialScroll = getRelativeScrollOffset(ghostRelativeParent); + } + + ghostEl = dragEl.cloneNode(true); + toggleClass(ghostEl, options.ghostClass, false); + toggleClass(ghostEl, options.fallbackClass, true); + toggleClass(ghostEl, options.dragClass, true); + css(ghostEl, 'transition', ''); + css(ghostEl, 'transform', ''); + css(ghostEl, 'box-sizing', 'border-box'); + css(ghostEl, 'margin', 0); + css(ghostEl, 'top', rect.top); + css(ghostEl, 'left', rect.left); + css(ghostEl, 'width', rect.width); + css(ghostEl, 'height', rect.height); + css(ghostEl, 'opacity', '0.8'); + css(ghostEl, 'position', PositionGhostAbsolutely ? 'absolute' : 'fixed'); + css(ghostEl, 'zIndex', '100000'); + css(ghostEl, 'pointerEvents', 'none'); + Sortable.ghost = ghostEl; + container.appendChild(ghostEl); // Set transform-origin + + css(ghostEl, 'transform-origin', tapDistanceLeft / parseInt(ghostEl.style.width) * 100 + '% ' + tapDistanceTop / parseInt(ghostEl.style.height) * 100 + '%'); + } + }, + _onDragStart: function _onDragStart( + /**Event*/ + evt, + /**boolean*/ + fallback) { + var _this = this; + + var dataTransfer = evt.dataTransfer; + var options = _this.options; + pluginEvent('dragStart', this, { + evt: evt + }); + + if (Sortable.eventCanceled) { + this._onDrop(); + + return; + } + + pluginEvent('setupClone', this); + + if (!Sortable.eventCanceled) { + cloneEl = clone(dragEl); + cloneEl.draggable = false; + cloneEl.style['will-change'] = ''; + + this._hideClone(); + + toggleClass(cloneEl, this.options.chosenClass, false); + Sortable.clone = cloneEl; + } // #1143: IFrame support workaround + + + _this.cloneId = _nextTick(function () { + pluginEvent('clone', _this); + if (Sortable.eventCanceled) return; + + if (!_this.options.removeCloneOnHide) { + rootEl.insertBefore(cloneEl, dragEl); + } + + _this._hideClone(); + + _dispatchEvent({ + sortable: _this, + name: 'clone' + }); + }); + !fallback && toggleClass(dragEl, options.dragClass, true); // Set proper drop events + + if (fallback) { + ignoreNextClick = true; + _this._loopId = setInterval(_this._emulateDragOver, 50); + } else { + // Undo what was set in _prepareDragStart before drag started + off(document, 'mouseup', _this._onDrop); + off(document, 'touchend', _this._onDrop); + off(document, 'touchcancel', _this._onDrop); + + if (dataTransfer) { + dataTransfer.effectAllowed = 'move'; + options.setData && options.setData.call(_this, dataTransfer, dragEl); + } + + on(document, 'drop', _this); // #1276 fix: + + css(dragEl, 'transform', 'translateZ(0)'); + } + + awaitingDragStarted = true; + _this._dragStartId = _nextTick(_this._dragStarted.bind(_this, fallback, evt)); + on(document, 'selectstart', _this); + moved = true; + + if (Safari) { + css(document.body, 'user-select', 'none'); + } + }, + // Returns true - if no further action is needed (either inserted or another condition) + _onDragOver: function _onDragOver( + /**Event*/ + evt) { + var el = this.el, + target = evt.target, + dragRect, + targetRect, + revert, + options = this.options, + group = options.group, + activeSortable = Sortable.active, + isOwner = activeGroup === group, + canSort = options.sort, + fromSortable = putSortable || activeSortable, + vertical, + _this = this, + completedFired = false; + + if (_silent) return; + + function dragOverEvent(name, extra) { + pluginEvent(name, _this, _objectSpread({ + evt: evt, + isOwner: isOwner, + axis: vertical ? 'vertical' : 'horizontal', + revert: revert, + dragRect: dragRect, + targetRect: targetRect, + canSort: canSort, + fromSortable: fromSortable, + target: target, + completed: completed, + onMove: function onMove(target, after) { + return _onMove(rootEl, el, dragEl, dragRect, target, getRect(target), evt, after); + }, + changed: changed + }, extra)); + } // Capture animation state + + + function capture() { + dragOverEvent('dragOverAnimationCapture'); + + _this.captureAnimationState(); + + if (_this !== fromSortable) { + fromSortable.captureAnimationState(); + } + } // Return invocation when dragEl is inserted (or completed) + + + function completed(insertion) { + dragOverEvent('dragOverCompleted', { + insertion: insertion + }); + + if (insertion) { + // Clones must be hidden before folding animation to capture dragRectAbsolute properly + if (isOwner) { + activeSortable._hideClone(); + } else { + activeSortable._showClone(_this); + } + + if (_this !== fromSortable) { + // Set ghost class to new sortable's ghost class + toggleClass(dragEl, putSortable ? putSortable.options.ghostClass : activeSortable.options.ghostClass, false); + toggleClass(dragEl, options.ghostClass, true); + } + + if (putSortable !== _this && _this !== Sortable.active) { + putSortable = _this; + } else if (_this === Sortable.active && putSortable) { + putSortable = null; + } // Animation + + + if (fromSortable === _this) { + _this._ignoreWhileAnimating = target; + } + + _this.animateAll(function () { + dragOverEvent('dragOverAnimationComplete'); + _this._ignoreWhileAnimating = null; + }); + + if (_this !== fromSortable) { + fromSortable.animateAll(); + fromSortable._ignoreWhileAnimating = null; + } + } // Null lastTarget if it is not inside a previously swapped element + + + if (target === dragEl && !dragEl.animated || target === el && !target.animated) { + lastTarget = null; + } // no bubbling and not fallback + + + if (!options.dragoverBubble && !evt.rootEl && target !== document) { + dragEl.parentNode[expando]._isOutsideThisEl(evt.target); // Do not detect for empty insert if already inserted + + + !insertion && nearestEmptyInsertDetectEvent(evt); + } + + !options.dragoverBubble && evt.stopPropagation && evt.stopPropagation(); + return completedFired = true; + } // Call when dragEl has been inserted + + + function changed() { + newIndex = index(dragEl); + newDraggableIndex = index(dragEl, options.draggable); + + _dispatchEvent({ + sortable: _this, + name: 'change', + toEl: el, + newIndex: newIndex, + newDraggableIndex: newDraggableIndex, + originalEvent: evt + }); + } + + if (evt.preventDefault !== void 0) { + evt.cancelable && evt.preventDefault(); + } + + target = closest(target, options.draggable, el, true); + dragOverEvent('dragOver'); + if (Sortable.eventCanceled) return completedFired; + + if (dragEl.contains(evt.target) || target.animated && target.animatingX && target.animatingY || _this._ignoreWhileAnimating === target) { + return completed(false); + } + + ignoreNextClick = false; + + if (activeSortable && !options.disabled && (isOwner ? canSort || (revert = !rootEl.contains(dragEl)) // Reverting item into the original list + : putSortable === this || (this.lastPutMode = activeGroup.checkPull(this, activeSortable, dragEl, evt)) && group.checkPut(this, activeSortable, dragEl, evt))) { + vertical = this._getDirection(evt, target) === 'vertical'; + dragRect = getRect(dragEl); + dragOverEvent('dragOverValid'); + if (Sortable.eventCanceled) return completedFired; + + if (revert) { + parentEl = rootEl; // actualization + + capture(); + + this._hideClone(); + + dragOverEvent('revert'); + + if (!Sortable.eventCanceled) { + if (nextEl) { + rootEl.insertBefore(dragEl, nextEl); + } else { + rootEl.appendChild(dragEl); + } + } + + return completed(true); + } + + var elLastChild = lastChild(el, options.draggable); + + if (!elLastChild || _ghostIsLast(evt, vertical, this) && !elLastChild.animated) { + // If already at end of list: Do not insert + if (elLastChild === dragEl) { + return completed(false); + } // assign target only if condition is true + + + if (elLastChild && el === evt.target) { + target = elLastChild; + } + + if (target) { + targetRect = getRect(target); + } + + if (_onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, !!target) !== false) { + capture(); + el.appendChild(dragEl); + parentEl = el; // actualization + + changed(); + return completed(true); + } + } else if (target.parentNode === el) { + targetRect = getRect(target); + var direction = 0, + targetBeforeFirstSwap, + differentLevel = dragEl.parentNode !== el, + differentRowCol = !_dragElInRowColumn(dragEl.animated && dragEl.toRect || dragRect, target.animated && target.toRect || targetRect, vertical), + side1 = vertical ? 'top' : 'left', + scrolledPastTop = isScrolledPast(target, 'top', 'top') || isScrolledPast(dragEl, 'top', 'top'), + scrollBefore = scrolledPastTop ? scrolledPastTop.scrollTop : void 0; + + if (lastTarget !== target) { + targetBeforeFirstSwap = targetRect[side1]; + pastFirstInvertThresh = false; + isCircumstantialInvert = !differentRowCol && options.invertSwap || differentLevel; + } + + direction = _getSwapDirection(evt, target, targetRect, vertical, differentRowCol ? 1 : options.swapThreshold, options.invertedSwapThreshold == null ? options.swapThreshold : options.invertedSwapThreshold, isCircumstantialInvert, lastTarget === target); + var sibling; + + if (direction !== 0) { + // Check if target is beside dragEl in respective direction (ignoring hidden elements) + var dragIndex = index(dragEl); + + do { + dragIndex -= direction; + sibling = parentEl.children[dragIndex]; + } while (sibling && (css(sibling, 'display') === 'none' || sibling === ghostEl)); + } // If dragEl is already beside target: Do not insert + + + if (direction === 0 || sibling === target) { + return completed(false); + } + + lastTarget = target; + lastDirection = direction; + var nextSibling = target.nextElementSibling, + after = false; + after = direction === 1; + + var moveVector = _onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, after); + + if (moveVector !== false) { + if (moveVector === 1 || moveVector === -1) { + after = moveVector === 1; + } + + _silent = true; + setTimeout(_unsilent, 30); + capture(); + + if (after && !nextSibling) { + el.appendChild(dragEl); + } else { + target.parentNode.insertBefore(dragEl, after ? nextSibling : target); + } // Undo chrome's scroll adjustment (has no effect on other browsers) + + + if (scrolledPastTop) { + scrollBy(scrolledPastTop, 0, scrollBefore - scrolledPastTop.scrollTop); + } + + parentEl = dragEl.parentNode; // actualization + // must be done before animation + + if (targetBeforeFirstSwap !== undefined && !isCircumstantialInvert) { + targetMoveDistance = Math.abs(targetBeforeFirstSwap - getRect(target)[side1]); + } + + changed(); + return completed(true); + } + } + + if (el.contains(dragEl)) { + return completed(false); + } + } + + return false; + }, + _ignoreWhileAnimating: null, + _offMoveEvents: function _offMoveEvents() { + off(document, 'mousemove', this._onTouchMove); + off(document, 'touchmove', this._onTouchMove); + off(document, 'pointermove', this._onTouchMove); + off(document, 'dragover', nearestEmptyInsertDetectEvent); + off(document, 'mousemove', nearestEmptyInsertDetectEvent); + off(document, 'touchmove', nearestEmptyInsertDetectEvent); + }, + _offUpEvents: function _offUpEvents() { + var ownerDocument = this.el.ownerDocument; + off(ownerDocument, 'mouseup', this._onDrop); + off(ownerDocument, 'touchend', this._onDrop); + off(ownerDocument, 'pointerup', this._onDrop); + off(ownerDocument, 'touchcancel', this._onDrop); + off(document, 'selectstart', this); + }, + _onDrop: function _onDrop( + /**Event*/ + evt) { + var el = this.el, + options = this.options; // Get the index of the dragged element within its parent + + newIndex = index(dragEl); + newDraggableIndex = index(dragEl, options.draggable); + pluginEvent('drop', this, { + evt: evt + }); + parentEl = dragEl && dragEl.parentNode; // Get again after plugin event + + newIndex = index(dragEl); + newDraggableIndex = index(dragEl, options.draggable); + + if (Sortable.eventCanceled) { + this._nulling(); + + return; + } + + awaitingDragStarted = false; + isCircumstantialInvert = false; + pastFirstInvertThresh = false; + clearInterval(this._loopId); + clearTimeout(this._dragStartTimer); + + _cancelNextTick(this.cloneId); + + _cancelNextTick(this._dragStartId); // Unbind events + + + if (this.nativeDraggable) { + off(document, 'drop', this); + off(el, 'dragstart', this._onDragStart); + } + + this._offMoveEvents(); + + this._offUpEvents(); + + if (Safari) { + css(document.body, 'user-select', ''); + } + + css(dragEl, 'transform', ''); + + if (evt) { + if (moved) { + evt.cancelable && evt.preventDefault(); + !options.dropBubble && evt.stopPropagation(); + } + + ghostEl && ghostEl.parentNode && ghostEl.parentNode.removeChild(ghostEl); + + if (rootEl === parentEl || putSortable && putSortable.lastPutMode !== 'clone') { + // Remove clone(s) + cloneEl && cloneEl.parentNode && cloneEl.parentNode.removeChild(cloneEl); + } + + if (dragEl) { + if (this.nativeDraggable) { + off(dragEl, 'dragend', this); + } + + _disableDraggable(dragEl); + + dragEl.style['will-change'] = ''; // Remove classes + // ghostClass is added in dragStarted + + if (moved && !awaitingDragStarted) { + toggleClass(dragEl, putSortable ? putSortable.options.ghostClass : this.options.ghostClass, false); + } + + toggleClass(dragEl, this.options.chosenClass, false); // Drag stop event + + _dispatchEvent({ + sortable: this, + name: 'unchoose', + toEl: parentEl, + newIndex: null, + newDraggableIndex: null, + originalEvent: evt + }); + + if (rootEl !== parentEl) { + if (newIndex >= 0) { + // Add event + _dispatchEvent({ + rootEl: parentEl, + name: 'add', + toEl: parentEl, + fromEl: rootEl, + originalEvent: evt + }); // Remove event + + + _dispatchEvent({ + sortable: this, + name: 'remove', + toEl: parentEl, + originalEvent: evt + }); // drag from one list and drop into another + + + _dispatchEvent({ + rootEl: parentEl, + name: 'sort', + toEl: parentEl, + fromEl: rootEl, + originalEvent: evt + }); + + _dispatchEvent({ + sortable: this, + name: 'sort', + toEl: parentEl, + originalEvent: evt + }); + } + + putSortable && putSortable.save(); + } else { + if (newIndex !== oldIndex) { + if (newIndex >= 0) { + // drag & drop within the same list + _dispatchEvent({ + sortable: this, + name: 'update', + toEl: parentEl, + originalEvent: evt + }); + + _dispatchEvent({ + sortable: this, + name: 'sort', + toEl: parentEl, + originalEvent: evt + }); + } + } + } + + if (Sortable.active) { + /* jshint eqnull:true */ + if (newIndex == null || newIndex === -1) { + newIndex = oldIndex; + newDraggableIndex = oldDraggableIndex; + } + + _dispatchEvent({ + sortable: this, + name: 'end', + toEl: parentEl, + originalEvent: evt + }); // Save sorting + + + this.save(); + } + } + } + + this._nulling(); + }, + _nulling: function _nulling() { + pluginEvent('nulling', this); + rootEl = dragEl = parentEl = ghostEl = nextEl = cloneEl = lastDownEl = cloneHidden = tapEvt = touchEvt = moved = newIndex = newDraggableIndex = oldIndex = oldDraggableIndex = lastTarget = lastDirection = putSortable = activeGroup = Sortable.dragged = Sortable.ghost = Sortable.clone = Sortable.active = null; + savedInputChecked.forEach(function (el) { + el.checked = true; + }); + savedInputChecked.length = lastDx = lastDy = 0; + }, + handleEvent: function handleEvent( + /**Event*/ + evt) { + switch (evt.type) { + case 'drop': + case 'dragend': + this._onDrop(evt); + + break; + + case 'dragenter': + case 'dragover': + if (dragEl) { + this._onDragOver(evt); + + _globalDragOver(evt); + } + + break; + + case 'selectstart': + evt.preventDefault(); + break; + } + }, + + /** + * Serializes the item into an array of string. + * @returns {String[]} + */ + toArray: function toArray() { + var order = [], + el, + children = this.el.children, + i = 0, + n = children.length, + options = this.options; + + for (; i < n; i++) { + el = children[i]; + + if (closest(el, options.draggable, this.el, false)) { + order.push(el.getAttribute(options.dataIdAttr) || _generateId(el)); + } + } + + return order; + }, + + /** + * Sorts the elements according to the array. + * @param {String[]} order order of the items + */ + sort: function sort(order) { + var items = {}, + rootEl = this.el; + this.toArray().forEach(function (id, i) { + var el = rootEl.children[i]; + + if (closest(el, this.options.draggable, rootEl, false)) { + items[id] = el; + } + }, this); + order.forEach(function (id) { + if (items[id]) { + rootEl.removeChild(items[id]); + rootEl.appendChild(items[id]); + } + }); + }, + + /** + * Save the current sorting + */ + save: function save() { + var store = this.options.store; + store && store.set && store.set(this); + }, + + /** + * For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree. + * @param {HTMLElement} el + * @param {String} [selector] default: `options.draggable` + * @returns {HTMLElement|null} + */ + closest: function closest$1(el, selector) { + return closest(el, selector || this.options.draggable, this.el, false); + }, + + /** + * Set/get option + * @param {string} name + * @param {*} [value] + * @returns {*} + */ + option: function option(name, value) { + var options = this.options; + + if (value === void 0) { + return options[name]; + } else { + var modifiedValue = PluginManager.modifyOption(this, name, value); + + if (typeof modifiedValue !== 'undefined') { + options[name] = modifiedValue; + } else { + options[name] = value; + } + + if (name === 'group') { + _prepareGroup(options); + } + } + }, + + /** + * Destroy + */ + destroy: function destroy() { + pluginEvent('destroy', this); + var el = this.el; + el[expando] = null; + off(el, 'mousedown', this._onTapStart); + off(el, 'touchstart', this._onTapStart); + off(el, 'pointerdown', this._onTapStart); + + if (this.nativeDraggable) { + off(el, 'dragover', this); + off(el, 'dragenter', this); + } // Remove draggable attributes + + + Array.prototype.forEach.call(el.querySelectorAll('[draggable]'), function (el) { + el.removeAttribute('draggable'); + }); + + this._onDrop(); + + this._disableDelayedDragEvents(); + + sortables.splice(sortables.indexOf(this.el), 1); + this.el = el = null; + }, + _hideClone: function _hideClone() { + if (!cloneHidden) { + pluginEvent('hideClone', this); + if (Sortable.eventCanceled) return; + css(cloneEl, 'display', 'none'); + + if (this.options.removeCloneOnHide && cloneEl.parentNode) { + cloneEl.parentNode.removeChild(cloneEl); + } + + cloneHidden = true; + } + }, + _showClone: function _showClone(putSortable) { + if (putSortable.lastPutMode !== 'clone') { + this._hideClone(); + + return; + } + + if (cloneHidden) { + pluginEvent('showClone', this); + if (Sortable.eventCanceled) return; // show clone at dragEl or original position + + if (rootEl.contains(dragEl) && !this.options.group.revertClone) { + rootEl.insertBefore(cloneEl, dragEl); + } else if (nextEl) { + rootEl.insertBefore(cloneEl, nextEl); + } else { + rootEl.appendChild(cloneEl); + } + + if (this.options.group.revertClone) { + this.animate(dragEl, cloneEl); + } + + css(cloneEl, 'display', ''); + cloneHidden = false; + } + } +}; + +function _globalDragOver( +/**Event*/ +evt) { + if (evt.dataTransfer) { + evt.dataTransfer.dropEffect = 'move'; + } + + evt.cancelable && evt.preventDefault(); +} + +function _onMove(fromEl, toEl, dragEl, dragRect, targetEl, targetRect, originalEvent, willInsertAfter) { + var evt, + sortable = fromEl[expando], + onMoveFn = sortable.options.onMove, + retVal; // Support for new CustomEvent feature + + if (window.CustomEvent && !IE11OrLess && !Edge) { + evt = new CustomEvent('move', { + bubbles: true, + cancelable: true + }); + } else { + evt = document.createEvent('Event'); + evt.initEvent('move', true, true); + } + + evt.to = toEl; + evt.from = fromEl; + evt.dragged = dragEl; + evt.draggedRect = dragRect; + evt.related = targetEl || toEl; + evt.relatedRect = targetRect || getRect(toEl); + evt.willInsertAfter = willInsertAfter; + evt.originalEvent = originalEvent; + fromEl.dispatchEvent(evt); + + if (onMoveFn) { + retVal = onMoveFn.call(sortable, evt, originalEvent); + } + + return retVal; +} + +function _disableDraggable(el) { + el.draggable = false; +} + +function _unsilent() { + _silent = false; +} + +function _ghostIsLast(evt, vertical, sortable) { + var rect = getRect(lastChild(sortable.el, sortable.options.draggable)); + var spacer = 10; + return vertical ? evt.clientX > rect.right + spacer || evt.clientX <= rect.right && evt.clientY > rect.bottom && evt.clientX >= rect.left : evt.clientX > rect.right && evt.clientY > rect.top || evt.clientX <= rect.right && evt.clientY > rect.bottom + spacer; +} + +function _getSwapDirection(evt, target, targetRect, vertical, swapThreshold, invertedSwapThreshold, invertSwap, isLastTarget) { + var mouseOnAxis = vertical ? evt.clientY : evt.clientX, + targetLength = vertical ? targetRect.height : targetRect.width, + targetS1 = vertical ? targetRect.top : targetRect.left, + targetS2 = vertical ? targetRect.bottom : targetRect.right, + invert = false; + + if (!invertSwap) { + // Never invert or create dragEl shadow when target movemenet causes mouse to move past the end of regular swapThreshold + if (isLastTarget && targetMoveDistance < targetLength * swapThreshold) { + // multiplied only by swapThreshold because mouse will already be inside target by (1 - threshold) * targetLength / 2 + // check if past first invert threshold on side opposite of lastDirection + if (!pastFirstInvertThresh && (lastDirection === 1 ? mouseOnAxis > targetS1 + targetLength * invertedSwapThreshold / 2 : mouseOnAxis < targetS2 - targetLength * invertedSwapThreshold / 2)) { + // past first invert threshold, do not restrict inverted threshold to dragEl shadow + pastFirstInvertThresh = true; + } + + if (!pastFirstInvertThresh) { + // dragEl shadow (target move distance shadow) + if (lastDirection === 1 ? mouseOnAxis < targetS1 + targetMoveDistance // over dragEl shadow + : mouseOnAxis > targetS2 - targetMoveDistance) { + return -lastDirection; + } + } else { + invert = true; + } + } else { + // Regular + if (mouseOnAxis > targetS1 + targetLength * (1 - swapThreshold) / 2 && mouseOnAxis < targetS2 - targetLength * (1 - swapThreshold) / 2) { + return _getInsertDirection(target); + } + } + } + + invert = invert || invertSwap; + + if (invert) { + // Invert of regular + if (mouseOnAxis < targetS1 + targetLength * invertedSwapThreshold / 2 || mouseOnAxis > targetS2 - targetLength * invertedSwapThreshold / 2) { + return mouseOnAxis > targetS1 + targetLength / 2 ? 1 : -1; + } + } + + return 0; +} +/** + * Gets the direction dragEl must be swapped relative to target in order to make it + * seem that dragEl has been "inserted" into that element's position + * @param {HTMLElement} target The target whose position dragEl is being inserted at + * @return {Number} Direction dragEl must be swapped + */ + + +function _getInsertDirection(target) { + if (index(dragEl) < index(target)) { + return 1; + } else { + return -1; + } +} +/** + * Generate id + * @param {HTMLElement} el + * @returns {String} + * @private + */ + + +function _generateId(el) { + var str = el.tagName + el.className + el.src + el.href + el.textContent, + i = str.length, + sum = 0; + + while (i--) { + sum += str.charCodeAt(i); + } + + return sum.toString(36); +} + +function _saveInputCheckedState(root) { + savedInputChecked.length = 0; + var inputs = root.getElementsByTagName('input'); + var idx = inputs.length; + + while (idx--) { + var el = inputs[idx]; + el.checked && savedInputChecked.push(el); + } +} + +function _nextTick(fn) { + return setTimeout(fn, 0); +} + +function _cancelNextTick(id) { + return clearTimeout(id); +} // Fixed #973: + + +if (documentExists) { + on(document, 'touchmove', function (evt) { + if ((Sortable.active || awaitingDragStarted) && evt.cancelable) { + evt.preventDefault(); + } + }); +} // Export utils + + +Sortable.utils = { + on: on, + off: off, + css: css, + find: find, + is: function is(el, selector) { + return !!closest(el, selector, el, false); + }, + extend: extend, + throttle: throttle, + closest: closest, + toggleClass: toggleClass, + clone: clone, + index: index, + nextTick: _nextTick, + cancelNextTick: _cancelNextTick, + detectDirection: _detectDirection, + getChild: getChild +}; +/** + * Get the Sortable instance of an element + * @param {HTMLElement} element The element + * @return {Sortable|undefined} The instance of Sortable + */ + +Sortable.get = function (element) { + return element[expando]; +}; +/** + * Mount a plugin to Sortable + * @param {...SortablePlugin|SortablePlugin[]} plugins Plugins being mounted + */ + + +Sortable.mount = function () { + for (var _len = arguments.length, plugins = new Array(_len), _key = 0; _key < _len; _key++) { + plugins[_key] = arguments[_key]; + } + + if (plugins[0].constructor === Array) plugins = plugins[0]; + plugins.forEach(function (plugin) { + if (!plugin.prototype || !plugin.prototype.constructor) { + throw "Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(plugin)); + } + + if (plugin.utils) Sortable.utils = _objectSpread({}, Sortable.utils, plugin.utils); + PluginManager.mount(plugin); + }); +}; +/** + * Create sortable instance + * @param {HTMLElement} el + * @param {Object} [options] + */ + + +Sortable.create = function (el, options) { + return new Sortable(el, options); +}; // Export + + +Sortable.version = version; + +var autoScrolls = [], + scrollEl, + scrollRootEl, + scrolling = false, + lastAutoScrollX, + lastAutoScrollY, + touchEvt$1, + pointerElemChangedInterval; + +function AutoScrollPlugin() { + function AutoScroll() { + this.defaults = { + scroll: true, + scrollSensitivity: 30, + scrollSpeed: 10, + bubbleScroll: true + }; // Bind all private methods + + for (var fn in this) { + if (fn.charAt(0) === '_' && typeof this[fn] === 'function') { + this[fn] = this[fn].bind(this); + } + } + } + + AutoScroll.prototype = { + dragStarted: function dragStarted(_ref) { + var originalEvent = _ref.originalEvent; + + if (this.sortable.nativeDraggable) { + on(document, 'dragover', this._handleAutoScroll); + } else { + if (this.options.supportPointer) { + on(document, 'pointermove', this._handleFallbackAutoScroll); + } else if (originalEvent.touches) { + on(document, 'touchmove', this._handleFallbackAutoScroll); + } else { + on(document, 'mousemove', this._handleFallbackAutoScroll); + } + } + }, + dragOverCompleted: function dragOverCompleted(_ref2) { + var originalEvent = _ref2.originalEvent; + + // For when bubbling is canceled and using fallback (fallback 'touchmove' always reached) + if (!this.options.dragOverBubble && !originalEvent.rootEl) { + this._handleAutoScroll(originalEvent); + } + }, + drop: function drop() { + if (this.sortable.nativeDraggable) { + off(document, 'dragover', this._handleAutoScroll); + } else { + off(document, 'pointermove', this._handleFallbackAutoScroll); + off(document, 'touchmove', this._handleFallbackAutoScroll); + off(document, 'mousemove', this._handleFallbackAutoScroll); + } + + clearPointerElemChangedInterval(); + clearAutoScrolls(); + cancelThrottle(); + }, + nulling: function nulling() { + touchEvt$1 = scrollRootEl = scrollEl = scrolling = pointerElemChangedInterval = lastAutoScrollX = lastAutoScrollY = null; + autoScrolls.length = 0; + }, + _handleFallbackAutoScroll: function _handleFallbackAutoScroll(evt) { + this._handleAutoScroll(evt, true); + }, + _handleAutoScroll: function _handleAutoScroll(evt, fallback) { + var _this = this; + + var x = (evt.touches ? evt.touches[0] : evt).clientX, + y = (evt.touches ? evt.touches[0] : evt).clientY, + elem = document.elementFromPoint(x, y); + touchEvt$1 = evt; // IE does not seem to have native autoscroll, + // Edge's autoscroll seems too conditional, + // MACOS Safari does not have autoscroll, + // Firefox and Chrome are good + + if (fallback || Edge || IE11OrLess || Safari) { + autoScroll(evt, this.options, elem, fallback); // Listener for pointer element change + + var ogElemScroller = getParentAutoScrollElement(elem, true); + + if (scrolling && (!pointerElemChangedInterval || x !== lastAutoScrollX || y !== lastAutoScrollY)) { + pointerElemChangedInterval && clearPointerElemChangedInterval(); // Detect for pointer elem change, emulating native DnD behaviour + + pointerElemChangedInterval = setInterval(function () { + var newElem = getParentAutoScrollElement(document.elementFromPoint(x, y), true); + + if (newElem !== ogElemScroller) { + ogElemScroller = newElem; + clearAutoScrolls(); + } + + autoScroll(evt, _this.options, newElem, fallback); + }, 10); + lastAutoScrollX = x; + lastAutoScrollY = y; + } + } else { + // if DnD is enabled (and browser has good autoscrolling), first autoscroll will already scroll, so get parent autoscroll of first autoscroll + if (!this.options.bubbleScroll || getParentAutoScrollElement(elem, true) === getWindowScrollingElement()) { + clearAutoScrolls(); + return; + } + + autoScroll(evt, this.options, getParentAutoScrollElement(elem, false), false); + } + } + }; + return _extends(AutoScroll, { + pluginName: 'scroll', + initializeByDefault: true + }); +} + +function clearAutoScrolls() { + autoScrolls.forEach(function (autoScroll) { + clearInterval(autoScroll.pid); + }); + autoScrolls = []; +} + +function clearPointerElemChangedInterval() { + clearInterval(pointerElemChangedInterval); +} + +var autoScroll = throttle(function (evt, options, rootEl, isFallback) { + // Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=505521 + if (!options.scroll) return; + var x = (evt.touches ? evt.touches[0] : evt).clientX, + y = (evt.touches ? evt.touches[0] : evt).clientY, + sens = options.scrollSensitivity, + speed = options.scrollSpeed, + winScroller = getWindowScrollingElement(); + var scrollThisInstance = false, + scrollCustomFn; // New scroll root, set scrollEl + + if (scrollRootEl !== rootEl) { + scrollRootEl = rootEl; + clearAutoScrolls(); + scrollEl = options.scroll; + scrollCustomFn = options.scrollFn; + + if (scrollEl === true) { + scrollEl = getParentAutoScrollElement(rootEl, true); + } + } + + var layersOut = 0; + var currentParent = scrollEl; + + do { + var el = currentParent, + rect = getRect(el), + top = rect.top, + bottom = rect.bottom, + left = rect.left, + right = rect.right, + width = rect.width, + height = rect.height, + canScrollX = void 0, + canScrollY = void 0, + scrollWidth = el.scrollWidth, + scrollHeight = el.scrollHeight, + elCSS = css(el), + scrollPosX = el.scrollLeft, + scrollPosY = el.scrollTop; + + if (el === winScroller) { + canScrollX = width < scrollWidth && (elCSS.overflowX === 'auto' || elCSS.overflowX === 'scroll' || elCSS.overflowX === 'visible'); + canScrollY = height < scrollHeight && (elCSS.overflowY === 'auto' || elCSS.overflowY === 'scroll' || elCSS.overflowY === 'visible'); + } else { + canScrollX = width < scrollWidth && (elCSS.overflowX === 'auto' || elCSS.overflowX === 'scroll'); + canScrollY = height < scrollHeight && (elCSS.overflowY === 'auto' || elCSS.overflowY === 'scroll'); + } + + var vx = canScrollX && (Math.abs(right - x) <= sens && scrollPosX + width < scrollWidth) - (Math.abs(left - x) <= sens && !!scrollPosX); + var vy = canScrollY && (Math.abs(bottom - y) <= sens && scrollPosY + height < scrollHeight) - (Math.abs(top - y) <= sens && !!scrollPosY); + + if (!autoScrolls[layersOut]) { + for (var i = 0; i <= layersOut; i++) { + if (!autoScrolls[i]) { + autoScrolls[i] = {}; + } + } + } + + if (autoScrolls[layersOut].vx != vx || autoScrolls[layersOut].vy != vy || autoScrolls[layersOut].el !== el) { + autoScrolls[layersOut].el = el; + autoScrolls[layersOut].vx = vx; + autoScrolls[layersOut].vy = vy; + clearInterval(autoScrolls[layersOut].pid); + + if (vx != 0 || vy != 0) { + scrollThisInstance = true; + /* jshint loopfunc:true */ + + autoScrolls[layersOut].pid = setInterval(function () { + // emulate drag over during autoscroll (fallback), emulating native DnD behaviour + if (isFallback && this.layer === 0) { + Sortable.active._onTouchMove(touchEvt$1); // To move ghost if it is positioned absolutely + + } + + var scrollOffsetY = autoScrolls[this.layer].vy ? autoScrolls[this.layer].vy * speed : 0; + var scrollOffsetX = autoScrolls[this.layer].vx ? autoScrolls[this.layer].vx * speed : 0; + + if (typeof scrollCustomFn === 'function') { + if (scrollCustomFn.call(Sortable.dragged.parentNode[expando], scrollOffsetX, scrollOffsetY, evt, touchEvt$1, autoScrolls[this.layer].el) !== 'continue') { + return; + } + } + + scrollBy(autoScrolls[this.layer].el, scrollOffsetX, scrollOffsetY); + }.bind({ + layer: layersOut + }), 24); + } + } + + layersOut++; + } while (options.bubbleScroll && currentParent !== winScroller && (currentParent = getParentAutoScrollElement(currentParent, false))); + + scrolling = scrollThisInstance; // in case another function catches scrolling as false in between when it is not +}, 30); + +var drop = function drop(_ref) { + var originalEvent = _ref.originalEvent, + putSortable = _ref.putSortable, + dragEl = _ref.dragEl, + activeSortable = _ref.activeSortable, + dispatchSortableEvent = _ref.dispatchSortableEvent, + hideGhostForTarget = _ref.hideGhostForTarget, + unhideGhostForTarget = _ref.unhideGhostForTarget; + if (!originalEvent) return; + var toSortable = putSortable || activeSortable; + hideGhostForTarget(); + var touch = originalEvent.changedTouches && originalEvent.changedTouches.length ? originalEvent.changedTouches[0] : originalEvent; + var target = document.elementFromPoint(touch.clientX, touch.clientY); + unhideGhostForTarget(); + + if (toSortable && !toSortable.el.contains(target)) { + dispatchSortableEvent('spill'); + this.onSpill({ + dragEl: dragEl, + putSortable: putSortable + }); + } +}; + +function Revert() {} + +Revert.prototype = { + startIndex: null, + dragStart: function dragStart(_ref2) { + var oldDraggableIndex = _ref2.oldDraggableIndex; + this.startIndex = oldDraggableIndex; + }, + onSpill: function onSpill(_ref3) { + var dragEl = _ref3.dragEl, + putSortable = _ref3.putSortable; + this.sortable.captureAnimationState(); + + if (putSortable) { + putSortable.captureAnimationState(); + } + + var nextSibling = getChild(this.sortable.el, this.startIndex, this.options); + + if (nextSibling) { + this.sortable.el.insertBefore(dragEl, nextSibling); + } else { + this.sortable.el.appendChild(dragEl); + } + + this.sortable.animateAll(); + + if (putSortable) { + putSortable.animateAll(); + } + }, + drop: drop +}; + +_extends(Revert, { + pluginName: 'revertOnSpill' +}); + +function Remove() {} + +Remove.prototype = { + onSpill: function onSpill(_ref4) { + var dragEl = _ref4.dragEl, + putSortable = _ref4.putSortable; + var parentSortable = putSortable || this.sortable; + parentSortable.captureAnimationState(); + dragEl.parentNode && dragEl.parentNode.removeChild(dragEl); + parentSortable.animateAll(); + }, + drop: drop +}; + +_extends(Remove, { + pluginName: 'removeOnSpill' +}); + +var lastSwapEl; + +function SwapPlugin() { + function Swap() { + this.defaults = { + swapClass: 'sortable-swap-highlight' + }; + } + + Swap.prototype = { + dragStart: function dragStart(_ref) { + var dragEl = _ref.dragEl; + lastSwapEl = dragEl; + }, + dragOverValid: function dragOverValid(_ref2) { + var completed = _ref2.completed, + target = _ref2.target, + onMove = _ref2.onMove, + activeSortable = _ref2.activeSortable, + changed = _ref2.changed, + cancel = _ref2.cancel; + if (!activeSortable.options.swap) return; + var el = this.sortable.el, + options = this.options; + + if (target && target !== el) { + var prevSwapEl = lastSwapEl; + + if (onMove(target) !== false) { + toggleClass(target, options.swapClass, true); + lastSwapEl = target; + } else { + lastSwapEl = null; + } + + if (prevSwapEl && prevSwapEl !== lastSwapEl) { + toggleClass(prevSwapEl, options.swapClass, false); + } + } + + changed(); + completed(true); + cancel(); + }, + drop: function drop(_ref3) { + var activeSortable = _ref3.activeSortable, + putSortable = _ref3.putSortable, + dragEl = _ref3.dragEl; + var toSortable = putSortable || this.sortable; + var options = this.options; + lastSwapEl && toggleClass(lastSwapEl, options.swapClass, false); + + if (lastSwapEl && (options.swap || putSortable && putSortable.options.swap)) { + if (dragEl !== lastSwapEl) { + toSortable.captureAnimationState(); + if (toSortable !== activeSortable) activeSortable.captureAnimationState(); + swapNodes(dragEl, lastSwapEl); + toSortable.animateAll(); + if (toSortable !== activeSortable) activeSortable.animateAll(); + } + } + }, + nulling: function nulling() { + lastSwapEl = null; + } + }; + return _extends(Swap, { + pluginName: 'swap', + eventProperties: function eventProperties() { + return { + swapItem: lastSwapEl + }; + } + }); +} + +function swapNodes(n1, n2) { + var p1 = n1.parentNode, + p2 = n2.parentNode, + i1, + i2; + if (!p1 || !p2 || p1.isEqualNode(n2) || p2.isEqualNode(n1)) return; + i1 = index(n1); + i2 = index(n2); + + if (p1.isEqualNode(p2) && i1 < i2) { + i2++; + } + + p1.insertBefore(n2, p1.children[i1]); + p2.insertBefore(n1, p2.children[i2]); +} + +var multiDragElements = [], + multiDragClones = [], + lastMultiDragSelect, + // for selection with modifier key down (SHIFT) +multiDragSortable, + initialFolding = false, + // Initial multi-drag fold when drag started +folding = false, + // Folding any other time +dragStarted = false, + dragEl$1, + clonesFromRect, + clonesHidden; + +function MultiDragPlugin() { + function MultiDrag(sortable) { + // Bind all private methods + for (var fn in this) { + if (fn.charAt(0) === '_' && typeof this[fn] === 'function') { + this[fn] = this[fn].bind(this); + } + } + + if (sortable.options.supportPointer) { + on(document, 'pointerup', this._deselectMultiDrag); + } else { + on(document, 'mouseup', this._deselectMultiDrag); + on(document, 'touchend', this._deselectMultiDrag); + } + + on(document, 'keydown', this._checkKeyDown); + on(document, 'keyup', this._checkKeyUp); + this.defaults = { + selectedClass: 'sortable-selected', + multiDragKey: null, + setData: function setData(dataTransfer, dragEl) { + var data = ''; + + if (multiDragElements.length && multiDragSortable === sortable) { + multiDragElements.forEach(function (multiDragElement, i) { + data += (!i ? '' : ', ') + multiDragElement.textContent; + }); + } else { + data = dragEl.textContent; + } + + dataTransfer.setData('Text', data); + } + }; + } + + MultiDrag.prototype = { + multiDragKeyDown: false, + isMultiDrag: false, + delayStartGlobal: function delayStartGlobal(_ref) { + var dragged = _ref.dragEl; + dragEl$1 = dragged; + }, + delayEnded: function delayEnded() { + this.isMultiDrag = ~multiDragElements.indexOf(dragEl$1); + }, + setupClone: function setupClone(_ref2) { + var sortable = _ref2.sortable, + cancel = _ref2.cancel; + if (!this.isMultiDrag) return; + + for (var i = 0; i < multiDragElements.length; i++) { + multiDragClones.push(clone(multiDragElements[i])); + multiDragClones[i].sortableIndex = multiDragElements[i].sortableIndex; + multiDragClones[i].draggable = false; + multiDragClones[i].style['will-change'] = ''; + toggleClass(multiDragClones[i], this.options.selectedClass, false); + multiDragElements[i] === dragEl$1 && toggleClass(multiDragClones[i], this.options.chosenClass, false); + } + + sortable._hideClone(); + + cancel(); + }, + clone: function clone(_ref3) { + var sortable = _ref3.sortable, + rootEl = _ref3.rootEl, + dispatchSortableEvent = _ref3.dispatchSortableEvent, + cancel = _ref3.cancel; + if (!this.isMultiDrag) return; + + if (!this.options.removeCloneOnHide) { + if (multiDragElements.length && multiDragSortable === sortable) { + insertMultiDragClones(true, rootEl); + dispatchSortableEvent('clone'); + cancel(); + } + } + }, + showClone: function showClone(_ref4) { + var cloneNowShown = _ref4.cloneNowShown, + rootEl = _ref4.rootEl, + cancel = _ref4.cancel; + if (!this.isMultiDrag) return; + insertMultiDragClones(false, rootEl); + multiDragClones.forEach(function (clone) { + css(clone, 'display', ''); + }); + cloneNowShown(); + clonesHidden = false; + cancel(); + }, + hideClone: function hideClone(_ref5) { + var _this = this; + + var sortable = _ref5.sortable, + cloneNowHidden = _ref5.cloneNowHidden, + cancel = _ref5.cancel; + if (!this.isMultiDrag) return; + multiDragClones.forEach(function (clone) { + css(clone, 'display', 'none'); + + if (_this.options.removeCloneOnHide && clone.parentNode) { + clone.parentNode.removeChild(clone); + } + }); + cloneNowHidden(); + clonesHidden = true; + cancel(); + }, + dragStartGlobal: function dragStartGlobal(_ref6) { + var sortable = _ref6.sortable; + + if (!this.isMultiDrag && multiDragSortable) { + multiDragSortable.multiDrag._deselectMultiDrag(); + } + + multiDragElements.forEach(function (multiDragElement) { + multiDragElement.sortableIndex = index(multiDragElement); + }); // Sort multi-drag elements + + multiDragElements = multiDragElements.sort(function (a, b) { + return a.sortableIndex - b.sortableIndex; + }); + dragStarted = true; + }, + dragStarted: function dragStarted(_ref7) { + var _this2 = this; + + var sortable = _ref7.sortable; + if (!this.isMultiDrag) return; + + if (this.options.sort) { + // Capture rects, + // hide multi drag elements (by positioning them absolute), + // set multi drag elements rects to dragRect, + // show multi drag elements, + // animate to rects, + // unset rects & remove from DOM + sortable.captureAnimationState(); + + if (this.options.animation) { + multiDragElements.forEach(function (multiDragElement) { + if (multiDragElement === dragEl$1) return; + css(multiDragElement, 'position', 'absolute'); + }); + var dragRect = getRect(dragEl$1, false, true, true); + multiDragElements.forEach(function (multiDragElement) { + if (multiDragElement === dragEl$1) return; + setRect(multiDragElement, dragRect); + }); + folding = true; + initialFolding = true; + } + } + + sortable.animateAll(function () { + folding = false; + initialFolding = false; + + if (_this2.options.animation) { + multiDragElements.forEach(function (multiDragElement) { + unsetRect(multiDragElement); + }); + } // Remove all auxiliary multidrag items from el, if sorting enabled + + + if (_this2.options.sort) { + removeMultiDragElements(); + } + }); + }, + dragOver: function dragOver(_ref8) { + var target = _ref8.target, + completed = _ref8.completed, + cancel = _ref8.cancel; + + if (folding && ~multiDragElements.indexOf(target)) { + completed(false); + cancel(); + } + }, + revert: function revert(_ref9) { + var fromSortable = _ref9.fromSortable, + rootEl = _ref9.rootEl, + sortable = _ref9.sortable, + dragRect = _ref9.dragRect; + + if (multiDragElements.length > 1) { + // Setup unfold animation + multiDragElements.forEach(function (multiDragElement) { + sortable.addAnimationState({ + target: multiDragElement, + rect: folding ? getRect(multiDragElement) : dragRect + }); + unsetRect(multiDragElement); + multiDragElement.fromRect = dragRect; + fromSortable.removeAnimationState(multiDragElement); + }); + folding = false; + insertMultiDragElements(!this.options.removeCloneOnHide, rootEl); + } + }, + dragOverCompleted: function dragOverCompleted(_ref10) { + var sortable = _ref10.sortable, + isOwner = _ref10.isOwner, + insertion = _ref10.insertion, + activeSortable = _ref10.activeSortable, + parentEl = _ref10.parentEl, + putSortable = _ref10.putSortable; + var options = this.options; + + if (insertion) { + // Clones must be hidden before folding animation to capture dragRectAbsolute properly + if (isOwner) { + activeSortable._hideClone(); + } + + initialFolding = false; // If leaving sort:false root, or already folding - Fold to new location + + if (options.animation && multiDragElements.length > 1 && (folding || !isOwner && !activeSortable.options.sort && !putSortable)) { + // Fold: Set all multi drag elements's rects to dragEl's rect when multi-drag elements are invisible + var dragRectAbsolute = getRect(dragEl$1, false, true, true); + multiDragElements.forEach(function (multiDragElement) { + if (multiDragElement === dragEl$1) return; + setRect(multiDragElement, dragRectAbsolute); // Move element(s) to end of parentEl so that it does not interfere with multi-drag clones insertion if they are inserted + // while folding, and so that we can capture them again because old sortable will no longer be fromSortable + + parentEl.appendChild(multiDragElement); + }); + folding = true; + } // Clones must be shown (and check to remove multi drags) after folding when interfering multiDragElements are moved out + + + if (!isOwner) { + // Only remove if not folding (folding will remove them anyways) + if (!folding) { + removeMultiDragElements(); + } + + if (multiDragElements.length > 1) { + var clonesHiddenBefore = clonesHidden; + + activeSortable._showClone(sortable); // Unfold animation for clones if showing from hidden + + + if (activeSortable.options.animation && !clonesHidden && clonesHiddenBefore) { + multiDragClones.forEach(function (clone) { + activeSortable.addAnimationState({ + target: clone, + rect: clonesFromRect + }); + clone.fromRect = clonesFromRect; + clone.thisAnimationDuration = null; + }); + } + } else { + activeSortable._showClone(sortable); + } + } + } + }, + dragOverAnimationCapture: function dragOverAnimationCapture(_ref11) { + var dragRect = _ref11.dragRect, + isOwner = _ref11.isOwner, + activeSortable = _ref11.activeSortable; + multiDragElements.forEach(function (multiDragElement) { + multiDragElement.thisAnimationDuration = null; + }); + + if (activeSortable.options.animation && !isOwner && activeSortable.multiDrag.isMultiDrag) { + clonesFromRect = _extends({}, dragRect); + var dragMatrix = matrix(dragEl$1, true); + clonesFromRect.top -= dragMatrix.f; + clonesFromRect.left -= dragMatrix.e; + } + }, + dragOverAnimationComplete: function dragOverAnimationComplete() { + if (folding) { + folding = false; + removeMultiDragElements(); + } + }, + drop: function drop(_ref12) { + var evt = _ref12.originalEvent, + rootEl = _ref12.rootEl, + parentEl = _ref12.parentEl, + sortable = _ref12.sortable, + dispatchSortableEvent = _ref12.dispatchSortableEvent, + oldIndex = _ref12.oldIndex, + putSortable = _ref12.putSortable; + var toSortable = putSortable || this.sortable; + if (!evt) return; + var options = this.options, + children = parentEl.children; // Multi-drag selection + + if (!dragStarted) { + if (options.multiDragKey && !this.multiDragKeyDown) { + this._deselectMultiDrag(); + } + + toggleClass(dragEl$1, options.selectedClass, !~multiDragElements.indexOf(dragEl$1)); + + if (!~multiDragElements.indexOf(dragEl$1)) { + multiDragElements.push(dragEl$1); + dispatchEvent({ + sortable: sortable, + rootEl: rootEl, + name: 'select', + targetEl: dragEl$1, + originalEvt: evt + }); // Modifier activated, select from last to dragEl + + if (evt.shiftKey && lastMultiDragSelect && sortable.el.contains(lastMultiDragSelect)) { + var lastIndex = index(lastMultiDragSelect), + currentIndex = index(dragEl$1); + + if (~lastIndex && ~currentIndex && lastIndex !== currentIndex) { + // Must include lastMultiDragSelect (select it), in case modified selection from no selection + // (but previous selection existed) + var n, i; + + if (currentIndex > lastIndex) { + i = lastIndex; + n = currentIndex; + } else { + i = currentIndex; + n = lastIndex + 1; + } + + for (; i < n; i++) { + if (~multiDragElements.indexOf(children[i])) continue; + toggleClass(children[i], options.selectedClass, true); + multiDragElements.push(children[i]); + dispatchEvent({ + sortable: sortable, + rootEl: rootEl, + name: 'select', + targetEl: children[i], + originalEvt: evt + }); + } + } + } else { + lastMultiDragSelect = dragEl$1; + } + + multiDragSortable = toSortable; + } else { + multiDragElements.splice(multiDragElements.indexOf(dragEl$1), 1); + lastMultiDragSelect = null; + dispatchEvent({ + sortable: sortable, + rootEl: rootEl, + name: 'deselect', + targetEl: dragEl$1, + originalEvt: evt + }); + } + } // Multi-drag drop + + + if (dragStarted && this.isMultiDrag) { + // Do not "unfold" after around dragEl if reverted + if ((parentEl[expando].options.sort || parentEl !== rootEl) && multiDragElements.length > 1) { + var dragRect = getRect(dragEl$1), + multiDragIndex = index(dragEl$1, ':not(.' + this.options.selectedClass + ')'); + if (!initialFolding && options.animation) dragEl$1.thisAnimationDuration = null; + toSortable.captureAnimationState(); + + if (!initialFolding) { + if (options.animation) { + dragEl$1.fromRect = dragRect; + multiDragElements.forEach(function (multiDragElement) { + multiDragElement.thisAnimationDuration = null; + + if (multiDragElement !== dragEl$1) { + var rect = folding ? getRect(multiDragElement) : dragRect; + multiDragElement.fromRect = rect; // Prepare unfold animation + + toSortable.addAnimationState({ + target: multiDragElement, + rect: rect + }); + } + }); + } // Multi drag elements are not necessarily removed from the DOM on drop, so to reinsert + // properly they must all be removed + + + removeMultiDragElements(); + multiDragElements.forEach(function (multiDragElement) { + if (children[multiDragIndex]) { + parentEl.insertBefore(multiDragElement, children[multiDragIndex]); + } else { + parentEl.appendChild(multiDragElement); + } + + multiDragIndex++; + }); // If initial folding is done, the elements may have changed position because they are now + // unfolding around dragEl, even though dragEl may not have his index changed, so update event + // must be fired here as Sortable will not. + + if (oldIndex === index(dragEl$1)) { + var update = false; + multiDragElements.forEach(function (multiDragElement) { + if (multiDragElement.sortableIndex !== index(multiDragElement)) { + update = true; + return; + } + }); + + if (update) { + dispatchSortableEvent('update'); + } + } + } // Must be done after capturing individual rects (scroll bar) + + + multiDragElements.forEach(function (multiDragElement) { + unsetRect(multiDragElement); + }); + toSortable.animateAll(); + } + + multiDragSortable = toSortable; + } // Remove clones if necessary + + + if (rootEl === parentEl || putSortable && putSortable.lastPutMode !== 'clone') { + multiDragClones.forEach(function (clone) { + clone.parentNode && clone.parentNode.removeChild(clone); + }); + } + }, + nullingGlobal: function nullingGlobal() { + this.isMultiDrag = dragStarted = false; + multiDragClones.length = 0; + }, + destroyGlobal: function destroyGlobal() { + this._deselectMultiDrag(); + + off(document, 'pointerup', this._deselectMultiDrag); + off(document, 'mouseup', this._deselectMultiDrag); + off(document, 'touchend', this._deselectMultiDrag); + off(document, 'keydown', this._checkKeyDown); + off(document, 'keyup', this._checkKeyUp); + }, + _deselectMultiDrag: function _deselectMultiDrag(evt) { + if (typeof dragStarted !== "undefined" && dragStarted) return; // Only deselect if selection is in this sortable + + if (multiDragSortable !== this.sortable) return; // Only deselect if target is not item in this sortable + + if (evt && closest(evt.target, this.options.draggable, this.sortable.el, false)) return; // Only deselect if left click + + if (evt && evt.button !== 0) return; + + while (multiDragElements.length) { + var el = multiDragElements[0]; + toggleClass(el, this.options.selectedClass, false); + multiDragElements.shift(); + dispatchEvent({ + sortable: this.sortable, + rootEl: this.sortable.el, + name: 'deselect', + targetEl: el, + originalEvt: evt + }); + } + }, + _checkKeyDown: function _checkKeyDown(evt) { + if (evt.key === this.options.multiDragKey) { + this.multiDragKeyDown = true; + } + }, + _checkKeyUp: function _checkKeyUp(evt) { + if (evt.key === this.options.multiDragKey) { + this.multiDragKeyDown = false; + } + } + }; + return _extends(MultiDrag, { + // Static methods & properties + pluginName: 'multiDrag', + utils: { + /** + * Selects the provided multi-drag item + * @param {HTMLElement} el The element to be selected + */ + select: function select(el) { + var sortable = el.parentNode[expando]; + if (!sortable || !sortable.options.multiDrag || ~multiDragElements.indexOf(el)) return; + + if (multiDragSortable && multiDragSortable !== sortable) { + multiDragSortable.multiDrag._deselectMultiDrag(); + + multiDragSortable = sortable; + } + + toggleClass(el, sortable.options.selectedClass, true); + multiDragElements.push(el); + }, + + /** + * Deselects the provided multi-drag item + * @param {HTMLElement} el The element to be deselected + */ + deselect: function deselect(el) { + var sortable = el.parentNode[expando], + index = multiDragElements.indexOf(el); + if (!sortable || !sortable.options.multiDrag || !~index) return; + toggleClass(el, sortable.options.selectedClass, false); + multiDragElements.splice(index, 1); + } + }, + eventProperties: function eventProperties() { + var _this3 = this; + + var oldIndicies = [], + newIndicies = []; + multiDragElements.forEach(function (multiDragElement) { + oldIndicies.push({ + multiDragElement: multiDragElement, + index: multiDragElement.sortableIndex + }); // multiDragElements will already be sorted if folding + + var newIndex; + + if (folding && multiDragElement !== dragEl$1) { + newIndex = -1; + } else if (folding) { + newIndex = index(multiDragElement, ':not(.' + _this3.options.selectedClass + ')'); + } else { + newIndex = index(multiDragElement); + } + + newIndicies.push({ + multiDragElement: multiDragElement, + index: newIndex + }); + }); + return { + items: _toConsumableArray(multiDragElements), + clones: [].concat(multiDragClones), + oldIndicies: oldIndicies, + newIndicies: newIndicies + }; + }, + optionListeners: { + multiDragKey: function multiDragKey(key) { + key = key.toLowerCase(); + + if (key === 'ctrl') { + key = 'Control'; + } else if (key.length > 1) { + key = key.charAt(0).toUpperCase() + key.substr(1); + } + + return key; + } + } + }); +} + +function insertMultiDragElements(clonesInserted, rootEl) { + multiDragElements.forEach(function (multiDragElement, i) { + var target = rootEl.children[multiDragElement.sortableIndex + (clonesInserted ? Number(i) : 0)]; + + if (target) { + rootEl.insertBefore(multiDragElement, target); + } else { + rootEl.appendChild(multiDragElement); + } + }); +} +/** + * Insert multi-drag clones + * @param {[Boolean]} elementsInserted Whether the multi-drag elements are inserted + * @param {HTMLElement} rootEl + */ + + +function insertMultiDragClones(elementsInserted, rootEl) { + multiDragClones.forEach(function (clone, i) { + var target = rootEl.children[clone.sortableIndex + (elementsInserted ? Number(i) : 0)]; + + if (target) { + rootEl.insertBefore(clone, target); + } else { + rootEl.appendChild(clone); + } + }); +} + +function removeMultiDragElements() { + multiDragElements.forEach(function (multiDragElement) { + if (multiDragElement === dragEl$1) return; + multiDragElement.parentNode && multiDragElement.parentNode.removeChild(multiDragElement); + }); +} + +Sortable.mount(new AutoScrollPlugin()); +Sortable.mount(Remove, Revert); + +Sortable.mount(new SwapPlugin()); +Sortable.mount(new MultiDragPlugin()); + +export default Sortable; diff --git a/public/assets/libs/Sortable/modular/sortable.core.esm.js b/public/assets/libs/Sortable/modular/sortable.core.esm.js new file mode 100644 index 0000000..6e6d138 --- /dev/null +++ b/public/assets/libs/Sortable/modular/sortable.core.esm.js @@ -0,0 +1,3698 @@ +/**! + * Sortable 1.10.2 + * @author RubaXa + * @author owenm + * @license MIT + */ +function _typeof(obj) { + if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { + _typeof = function (obj) { + return typeof obj; + }; + } else { + _typeof = function (obj) { + return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; + }; + } + + return _typeof(obj); +} + +function _defineProperty(obj, key, value) { + if (key in obj) { + Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + } else { + obj[key] = value; + } + + return obj; +} + +function _extends() { + _extends = Object.assign || function (target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i]; + + for (var key in source) { + if (Object.prototype.hasOwnProperty.call(source, key)) { + target[key] = source[key]; + } + } + } + + return target; + }; + + return _extends.apply(this, arguments); +} + +function _objectSpread(target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i] != null ? arguments[i] : {}; + var ownKeys = Object.keys(source); + + if (typeof Object.getOwnPropertySymbols === 'function') { + ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { + return Object.getOwnPropertyDescriptor(source, sym).enumerable; + })); + } + + ownKeys.forEach(function (key) { + _defineProperty(target, key, source[key]); + }); + } + + return target; +} + +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + + for (i = 0; i < sourceKeys.length; i++) { + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + + return target; +} + +function _objectWithoutProperties(source, excluded) { + if (source == null) return {}; + + var target = _objectWithoutPropertiesLoose(source, excluded); + + var key, i; + + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + + for (i = 0; i < sourceSymbolKeys.length; i++) { + key = sourceSymbolKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + + return target; +} + +function _toConsumableArray(arr) { + return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); +} + +function _arrayWithoutHoles(arr) { + if (Array.isArray(arr)) { + for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; + + return arr2; + } +} + +function _iterableToArray(iter) { + if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); +} + +function _nonIterableSpread() { + throw new TypeError("Invalid attempt to spread non-iterable instance"); +} + +var version = "1.10.2"; + +function userAgent(pattern) { + if (typeof window !== 'undefined' && window.navigator) { + return !! + /*@__PURE__*/ + navigator.userAgent.match(pattern); + } +} + +var IE11OrLess = userAgent(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i); +var Edge = userAgent(/Edge/i); +var FireFox = userAgent(/firefox/i); +var Safari = userAgent(/safari/i) && !userAgent(/chrome/i) && !userAgent(/android/i); +var IOS = userAgent(/iP(ad|od|hone)/i); +var ChromeForAndroid = userAgent(/chrome/i) && userAgent(/android/i); + +var captureMode = { + capture: false, + passive: false +}; + +function on(el, event, fn) { + el.addEventListener(event, fn, !IE11OrLess && captureMode); +} + +function off(el, event, fn) { + el.removeEventListener(event, fn, !IE11OrLess && captureMode); +} + +function matches( +/**HTMLElement*/ +el, +/**String*/ +selector) { + if (!selector) return; + selector[0] === '>' && (selector = selector.substring(1)); + + if (el) { + try { + if (el.matches) { + return el.matches(selector); + } else if (el.msMatchesSelector) { + return el.msMatchesSelector(selector); + } else if (el.webkitMatchesSelector) { + return el.webkitMatchesSelector(selector); + } + } catch (_) { + return false; + } + } + + return false; +} + +function getParentOrHost(el) { + return el.host && el !== document && el.host.nodeType ? el.host : el.parentNode; +} + +function closest( +/**HTMLElement*/ +el, +/**String*/ +selector, +/**HTMLElement*/ +ctx, includeCTX) { + if (el) { + ctx = ctx || document; + + do { + if (selector != null && (selector[0] === '>' ? el.parentNode === ctx && matches(el, selector) : matches(el, selector)) || includeCTX && el === ctx) { + return el; + } + + if (el === ctx) break; + /* jshint boss:true */ + } while (el = getParentOrHost(el)); + } + + return null; +} + +var R_SPACE = /\s+/g; + +function toggleClass(el, name, state) { + if (el && name) { + if (el.classList) { + el.classList[state ? 'add' : 'remove'](name); + } else { + var className = (' ' + el.className + ' ').replace(R_SPACE, ' ').replace(' ' + name + ' ', ' '); + el.className = (className + (state ? ' ' + name : '')).replace(R_SPACE, ' '); + } + } +} + +function css(el, prop, val) { + var style = el && el.style; + + if (style) { + if (val === void 0) { + if (document.defaultView && document.defaultView.getComputedStyle) { + val = document.defaultView.getComputedStyle(el, ''); + } else if (el.currentStyle) { + val = el.currentStyle; + } + + return prop === void 0 ? val : val[prop]; + } else { + if (!(prop in style) && prop.indexOf('webkit') === -1) { + prop = '-webkit-' + prop; + } + + style[prop] = val + (typeof val === 'string' ? '' : 'px'); + } + } +} + +function matrix(el, selfOnly) { + var appliedTransforms = ''; + + if (typeof el === 'string') { + appliedTransforms = el; + } else { + do { + var transform = css(el, 'transform'); + + if (transform && transform !== 'none') { + appliedTransforms = transform + ' ' + appliedTransforms; + } + /* jshint boss:true */ + + } while (!selfOnly && (el = el.parentNode)); + } + + var matrixFn = window.DOMMatrix || window.WebKitCSSMatrix || window.CSSMatrix || window.MSCSSMatrix; + /*jshint -W056 */ + + return matrixFn && new matrixFn(appliedTransforms); +} + +function find(ctx, tagName, iterator) { + if (ctx) { + var list = ctx.getElementsByTagName(tagName), + i = 0, + n = list.length; + + if (iterator) { + for (; i < n; i++) { + iterator(list[i], i); + } + } + + return list; + } + + return []; +} + +function getWindowScrollingElement() { + var scrollingElement = document.scrollingElement; + + if (scrollingElement) { + return scrollingElement; + } else { + return document.documentElement; + } +} +/** + * Returns the "bounding client rect" of given element + * @param {HTMLElement} el The element whose boundingClientRect is wanted + * @param {[Boolean]} relativeToContainingBlock Whether the rect should be relative to the containing block of (including) the container + * @param {[Boolean]} relativeToNonStaticParent Whether the rect should be relative to the relative parent of (including) the contaienr + * @param {[Boolean]} undoScale Whether the container's scale() should be undone + * @param {[HTMLElement]} container The parent the element will be placed in + * @return {Object} The boundingClientRect of el, with specified adjustments + */ + + +function getRect(el, relativeToContainingBlock, relativeToNonStaticParent, undoScale, container) { + if (!el.getBoundingClientRect && el !== window) return; + var elRect, top, left, bottom, right, height, width; + + if (el !== window && el !== getWindowScrollingElement()) { + elRect = el.getBoundingClientRect(); + top = elRect.top; + left = elRect.left; + bottom = elRect.bottom; + right = elRect.right; + height = elRect.height; + width = elRect.width; + } else { + top = 0; + left = 0; + bottom = window.innerHeight; + right = window.innerWidth; + height = window.innerHeight; + width = window.innerWidth; + } + + if ((relativeToContainingBlock || relativeToNonStaticParent) && el !== window) { + // Adjust for translate() + container = container || el.parentNode; // solves #1123 (see: https://stackoverflow.com/a/37953806/6088312) + // Not needed on <= IE11 + + if (!IE11OrLess) { + do { + if (container && container.getBoundingClientRect && (css(container, 'transform') !== 'none' || relativeToNonStaticParent && css(container, 'position') !== 'static')) { + var containerRect = container.getBoundingClientRect(); // Set relative to edges of padding box of container + + top -= containerRect.top + parseInt(css(container, 'border-top-width')); + left -= containerRect.left + parseInt(css(container, 'border-left-width')); + bottom = top + elRect.height; + right = left + elRect.width; + break; + } + /* jshint boss:true */ + + } while (container = container.parentNode); + } + } + + if (undoScale && el !== window) { + // Adjust for scale() + var elMatrix = matrix(container || el), + scaleX = elMatrix && elMatrix.a, + scaleY = elMatrix && elMatrix.d; + + if (elMatrix) { + top /= scaleY; + left /= scaleX; + width /= scaleX; + height /= scaleY; + bottom = top + height; + right = left + width; + } + } + + return { + top: top, + left: left, + bottom: bottom, + right: right, + width: width, + height: height + }; +} +/** + * Checks if a side of an element is scrolled past a side of its parents + * @param {HTMLElement} el The element who's side being scrolled out of view is in question + * @param {String} elSide Side of the element in question ('top', 'left', 'right', 'bottom') + * @param {String} parentSide Side of the parent in question ('top', 'left', 'right', 'bottom') + * @return {HTMLElement} The parent scroll element that the el's side is scrolled past, or null if there is no such element + */ + + +function isScrolledPast(el, elSide, parentSide) { + var parent = getParentAutoScrollElement(el, true), + elSideVal = getRect(el)[elSide]; + /* jshint boss:true */ + + while (parent) { + var parentSideVal = getRect(parent)[parentSide], + visible = void 0; + + if (parentSide === 'top' || parentSide === 'left') { + visible = elSideVal >= parentSideVal; + } else { + visible = elSideVal <= parentSideVal; + } + + if (!visible) return parent; + if (parent === getWindowScrollingElement()) break; + parent = getParentAutoScrollElement(parent, false); + } + + return false; +} +/** + * Gets nth child of el, ignoring hidden children, sortable's elements (does not ignore clone if it's visible) + * and non-draggable elements + * @param {HTMLElement} el The parent element + * @param {Number} childNum The index of the child + * @param {Object} options Parent Sortable's options + * @return {HTMLElement} The child at index childNum, or null if not found + */ + + +function getChild(el, childNum, options) { + var currentChild = 0, + i = 0, + children = el.children; + + while (i < children.length) { + if (children[i].style.display !== 'none' && children[i] !== Sortable.ghost && children[i] !== Sortable.dragged && closest(children[i], options.draggable, el, false)) { + if (currentChild === childNum) { + return children[i]; + } + + currentChild++; + } + + i++; + } + + return null; +} +/** + * Gets the last child in the el, ignoring ghostEl or invisible elements (clones) + * @param {HTMLElement} el Parent element + * @param {selector} selector Any other elements that should be ignored + * @return {HTMLElement} The last child, ignoring ghostEl + */ + + +function lastChild(el, selector) { + var last = el.lastElementChild; + + while (last && (last === Sortable.ghost || css(last, 'display') === 'none' || selector && !matches(last, selector))) { + last = last.previousElementSibling; + } + + return last || null; +} +/** + * Returns the index of an element within its parent for a selected set of + * elements + * @param {HTMLElement} el + * @param {selector} selector + * @return {number} + */ + + +function index(el, selector) { + var index = 0; + + if (!el || !el.parentNode) { + return -1; + } + /* jshint boss:true */ + + + while (el = el.previousElementSibling) { + if (el.nodeName.toUpperCase() !== 'TEMPLATE' && el !== Sortable.clone && (!selector || matches(el, selector))) { + index++; + } + } + + return index; +} +/** + * Returns the scroll offset of the given element, added with all the scroll offsets of parent elements. + * The value is returned in real pixels. + * @param {HTMLElement} el + * @return {Array} Offsets in the format of [left, top] + */ + + +function getRelativeScrollOffset(el) { + var offsetLeft = 0, + offsetTop = 0, + winScroller = getWindowScrollingElement(); + + if (el) { + do { + var elMatrix = matrix(el), + scaleX = elMatrix.a, + scaleY = elMatrix.d; + offsetLeft += el.scrollLeft * scaleX; + offsetTop += el.scrollTop * scaleY; + } while (el !== winScroller && (el = el.parentNode)); + } + + return [offsetLeft, offsetTop]; +} +/** + * Returns the index of the object within the given array + * @param {Array} arr Array that may or may not hold the object + * @param {Object} obj An object that has a key-value pair unique to and identical to a key-value pair in the object you want to find + * @return {Number} The index of the object in the array, or -1 + */ + + +function indexOfObject(arr, obj) { + for (var i in arr) { + if (!arr.hasOwnProperty(i)) continue; + + for (var key in obj) { + if (obj.hasOwnProperty(key) && obj[key] === arr[i][key]) return Number(i); + } + } + + return -1; +} + +function getParentAutoScrollElement(el, includeSelf) { + // skip to window + if (!el || !el.getBoundingClientRect) return getWindowScrollingElement(); + var elem = el; + var gotSelf = false; + + do { + // we don't need to get elem css if it isn't even overflowing in the first place (performance) + if (elem.clientWidth < elem.scrollWidth || elem.clientHeight < elem.scrollHeight) { + var elemCSS = css(elem); + + if (elem.clientWidth < elem.scrollWidth && (elemCSS.overflowX == 'auto' || elemCSS.overflowX == 'scroll') || elem.clientHeight < elem.scrollHeight && (elemCSS.overflowY == 'auto' || elemCSS.overflowY == 'scroll')) { + if (!elem.getBoundingClientRect || elem === document.body) return getWindowScrollingElement(); + if (gotSelf || includeSelf) return elem; + gotSelf = true; + } + } + /* jshint boss:true */ + + } while (elem = elem.parentNode); + + return getWindowScrollingElement(); +} + +function extend(dst, src) { + if (dst && src) { + for (var key in src) { + if (src.hasOwnProperty(key)) { + dst[key] = src[key]; + } + } + } + + return dst; +} + +function isRectEqual(rect1, rect2) { + return Math.round(rect1.top) === Math.round(rect2.top) && Math.round(rect1.left) === Math.round(rect2.left) && Math.round(rect1.height) === Math.round(rect2.height) && Math.round(rect1.width) === Math.round(rect2.width); +} + +var _throttleTimeout; + +function throttle(callback, ms) { + return function () { + if (!_throttleTimeout) { + var args = arguments, + _this = this; + + if (args.length === 1) { + callback.call(_this, args[0]); + } else { + callback.apply(_this, args); + } + + _throttleTimeout = setTimeout(function () { + _throttleTimeout = void 0; + }, ms); + } + }; +} + +function cancelThrottle() { + clearTimeout(_throttleTimeout); + _throttleTimeout = void 0; +} + +function scrollBy(el, x, y) { + el.scrollLeft += x; + el.scrollTop += y; +} + +function clone(el) { + var Polymer = window.Polymer; + var $ = window.jQuery || window.Zepto; + + if (Polymer && Polymer.dom) { + return Polymer.dom(el).cloneNode(true); + } else if ($) { + return $(el).clone(true)[0]; + } else { + return el.cloneNode(true); + } +} + +function setRect(el, rect) { + css(el, 'position', 'absolute'); + css(el, 'top', rect.top); + css(el, 'left', rect.left); + css(el, 'width', rect.width); + css(el, 'height', rect.height); +} + +function unsetRect(el) { + css(el, 'position', ''); + css(el, 'top', ''); + css(el, 'left', ''); + css(el, 'width', ''); + css(el, 'height', ''); +} + +var expando = 'Sortable' + new Date().getTime(); + +function AnimationStateManager() { + var animationStates = [], + animationCallbackId; + return { + captureAnimationState: function captureAnimationState() { + animationStates = []; + if (!this.options.animation) return; + var children = [].slice.call(this.el.children); + children.forEach(function (child) { + if (css(child, 'display') === 'none' || child === Sortable.ghost) return; + animationStates.push({ + target: child, + rect: getRect(child) + }); + + var fromRect = _objectSpread({}, animationStates[animationStates.length - 1].rect); // If animating: compensate for current animation + + + if (child.thisAnimationDuration) { + var childMatrix = matrix(child, true); + + if (childMatrix) { + fromRect.top -= childMatrix.f; + fromRect.left -= childMatrix.e; + } + } + + child.fromRect = fromRect; + }); + }, + addAnimationState: function addAnimationState(state) { + animationStates.push(state); + }, + removeAnimationState: function removeAnimationState(target) { + animationStates.splice(indexOfObject(animationStates, { + target: target + }), 1); + }, + animateAll: function animateAll(callback) { + var _this = this; + + if (!this.options.animation) { + clearTimeout(animationCallbackId); + if (typeof callback === 'function') callback(); + return; + } + + var animating = false, + animationTime = 0; + animationStates.forEach(function (state) { + var time = 0, + target = state.target, + fromRect = target.fromRect, + toRect = getRect(target), + prevFromRect = target.prevFromRect, + prevToRect = target.prevToRect, + animatingRect = state.rect, + targetMatrix = matrix(target, true); + + if (targetMatrix) { + // Compensate for current animation + toRect.top -= targetMatrix.f; + toRect.left -= targetMatrix.e; + } + + target.toRect = toRect; + + if (target.thisAnimationDuration) { + // Could also check if animatingRect is between fromRect and toRect + if (isRectEqual(prevFromRect, toRect) && !isRectEqual(fromRect, toRect) && // Make sure animatingRect is on line between toRect & fromRect + (animatingRect.top - toRect.top) / (animatingRect.left - toRect.left) === (fromRect.top - toRect.top) / (fromRect.left - toRect.left)) { + // If returning to same place as started from animation and on same axis + time = calculateRealTime(animatingRect, prevFromRect, prevToRect, _this.options); + } + } // if fromRect != toRect: animate + + + if (!isRectEqual(toRect, fromRect)) { + target.prevFromRect = fromRect; + target.prevToRect = toRect; + + if (!time) { + time = _this.options.animation; + } + + _this.animate(target, animatingRect, toRect, time); + } + + if (time) { + animating = true; + animationTime = Math.max(animationTime, time); + clearTimeout(target.animationResetTimer); + target.animationResetTimer = setTimeout(function () { + target.animationTime = 0; + target.prevFromRect = null; + target.fromRect = null; + target.prevToRect = null; + target.thisAnimationDuration = null; + }, time); + target.thisAnimationDuration = time; + } + }); + clearTimeout(animationCallbackId); + + if (!animating) { + if (typeof callback === 'function') callback(); + } else { + animationCallbackId = setTimeout(function () { + if (typeof callback === 'function') callback(); + }, animationTime); + } + + animationStates = []; + }, + animate: function animate(target, currentRect, toRect, duration) { + if (duration) { + css(target, 'transition', ''); + css(target, 'transform', ''); + var elMatrix = matrix(this.el), + scaleX = elMatrix && elMatrix.a, + scaleY = elMatrix && elMatrix.d, + translateX = (currentRect.left - toRect.left) / (scaleX || 1), + translateY = (currentRect.top - toRect.top) / (scaleY || 1); + target.animatingX = !!translateX; + target.animatingY = !!translateY; + css(target, 'transform', 'translate3d(' + translateX + 'px,' + translateY + 'px,0)'); + repaint(target); // repaint + + css(target, 'transition', 'transform ' + duration + 'ms' + (this.options.easing ? ' ' + this.options.easing : '')); + css(target, 'transform', 'translate3d(0,0,0)'); + typeof target.animated === 'number' && clearTimeout(target.animated); + target.animated = setTimeout(function () { + css(target, 'transition', ''); + css(target, 'transform', ''); + target.animated = false; + target.animatingX = false; + target.animatingY = false; + }, duration); + } + } + }; +} + +function repaint(target) { + return target.offsetWidth; +} + +function calculateRealTime(animatingRect, fromRect, toRect, options) { + return Math.sqrt(Math.pow(fromRect.top - animatingRect.top, 2) + Math.pow(fromRect.left - animatingRect.left, 2)) / Math.sqrt(Math.pow(fromRect.top - toRect.top, 2) + Math.pow(fromRect.left - toRect.left, 2)) * options.animation; +} + +var plugins = []; +var defaults = { + initializeByDefault: true +}; +var PluginManager = { + mount: function mount(plugin) { + // Set default static properties + for (var option in defaults) { + if (defaults.hasOwnProperty(option) && !(option in plugin)) { + plugin[option] = defaults[option]; + } + } + + plugins.push(plugin); + }, + pluginEvent: function pluginEvent(eventName, sortable, evt) { + var _this = this; + + this.eventCanceled = false; + + evt.cancel = function () { + _this.eventCanceled = true; + }; + + var eventNameGlobal = eventName + 'Global'; + plugins.forEach(function (plugin) { + if (!sortable[plugin.pluginName]) return; // Fire global events if it exists in this sortable + + if (sortable[plugin.pluginName][eventNameGlobal]) { + sortable[plugin.pluginName][eventNameGlobal](_objectSpread({ + sortable: sortable + }, evt)); + } // Only fire plugin event if plugin is enabled in this sortable, + // and plugin has event defined + + + if (sortable.options[plugin.pluginName] && sortable[plugin.pluginName][eventName]) { + sortable[plugin.pluginName][eventName](_objectSpread({ + sortable: sortable + }, evt)); + } + }); + }, + initializePlugins: function initializePlugins(sortable, el, defaults, options) { + plugins.forEach(function (plugin) { + var pluginName = plugin.pluginName; + if (!sortable.options[pluginName] && !plugin.initializeByDefault) return; + var initialized = new plugin(sortable, el, sortable.options); + initialized.sortable = sortable; + initialized.options = sortable.options; + sortable[pluginName] = initialized; // Add default options from plugin + + _extends(defaults, initialized.defaults); + }); + + for (var option in sortable.options) { + if (!sortable.options.hasOwnProperty(option)) continue; + var modified = this.modifyOption(sortable, option, sortable.options[option]); + + if (typeof modified !== 'undefined') { + sortable.options[option] = modified; + } + } + }, + getEventProperties: function getEventProperties(name, sortable) { + var eventProperties = {}; + plugins.forEach(function (plugin) { + if (typeof plugin.eventProperties !== 'function') return; + + _extends(eventProperties, plugin.eventProperties.call(sortable[plugin.pluginName], name)); + }); + return eventProperties; + }, + modifyOption: function modifyOption(sortable, name, value) { + var modifiedValue; + plugins.forEach(function (plugin) { + // Plugin must exist on the Sortable + if (!sortable[plugin.pluginName]) return; // If static option listener exists for this option, call in the context of the Sortable's instance of this plugin + + if (plugin.optionListeners && typeof plugin.optionListeners[name] === 'function') { + modifiedValue = plugin.optionListeners[name].call(sortable[plugin.pluginName], value); + } + }); + return modifiedValue; + } +}; + +function dispatchEvent(_ref) { + var sortable = _ref.sortable, + rootEl = _ref.rootEl, + name = _ref.name, + targetEl = _ref.targetEl, + cloneEl = _ref.cloneEl, + toEl = _ref.toEl, + fromEl = _ref.fromEl, + oldIndex = _ref.oldIndex, + newIndex = _ref.newIndex, + oldDraggableIndex = _ref.oldDraggableIndex, + newDraggableIndex = _ref.newDraggableIndex, + originalEvent = _ref.originalEvent, + putSortable = _ref.putSortable, + extraEventProperties = _ref.extraEventProperties; + sortable = sortable || rootEl && rootEl[expando]; + if (!sortable) return; + var evt, + options = sortable.options, + onName = 'on' + name.charAt(0).toUpperCase() + name.substr(1); // Support for new CustomEvent feature + + if (window.CustomEvent && !IE11OrLess && !Edge) { + evt = new CustomEvent(name, { + bubbles: true, + cancelable: true + }); + } else { + evt = document.createEvent('Event'); + evt.initEvent(name, true, true); + } + + evt.to = toEl || rootEl; + evt.from = fromEl || rootEl; + evt.item = targetEl || rootEl; + evt.clone = cloneEl; + evt.oldIndex = oldIndex; + evt.newIndex = newIndex; + evt.oldDraggableIndex = oldDraggableIndex; + evt.newDraggableIndex = newDraggableIndex; + evt.originalEvent = originalEvent; + evt.pullMode = putSortable ? putSortable.lastPutMode : undefined; + + var allEventProperties = _objectSpread({}, extraEventProperties, PluginManager.getEventProperties(name, sortable)); + + for (var option in allEventProperties) { + evt[option] = allEventProperties[option]; + } + + if (rootEl) { + rootEl.dispatchEvent(evt); + } + + if (options[onName]) { + options[onName].call(sortable, evt); + } +} + +var pluginEvent = function pluginEvent(eventName, sortable) { + var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}, + originalEvent = _ref.evt, + data = _objectWithoutProperties(_ref, ["evt"]); + + PluginManager.pluginEvent.bind(Sortable)(eventName, sortable, _objectSpread({ + dragEl: dragEl, + parentEl: parentEl, + ghostEl: ghostEl, + rootEl: rootEl, + nextEl: nextEl, + lastDownEl: lastDownEl, + cloneEl: cloneEl, + cloneHidden: cloneHidden, + dragStarted: moved, + putSortable: putSortable, + activeSortable: Sortable.active, + originalEvent: originalEvent, + oldIndex: oldIndex, + oldDraggableIndex: oldDraggableIndex, + newIndex: newIndex, + newDraggableIndex: newDraggableIndex, + hideGhostForTarget: _hideGhostForTarget, + unhideGhostForTarget: _unhideGhostForTarget, + cloneNowHidden: function cloneNowHidden() { + cloneHidden = true; + }, + cloneNowShown: function cloneNowShown() { + cloneHidden = false; + }, + dispatchSortableEvent: function dispatchSortableEvent(name) { + _dispatchEvent({ + sortable: sortable, + name: name, + originalEvent: originalEvent + }); + } + }, data)); +}; + +function _dispatchEvent(info) { + dispatchEvent(_objectSpread({ + putSortable: putSortable, + cloneEl: cloneEl, + targetEl: dragEl, + rootEl: rootEl, + oldIndex: oldIndex, + oldDraggableIndex: oldDraggableIndex, + newIndex: newIndex, + newDraggableIndex: newDraggableIndex + }, info)); +} + +var dragEl, + parentEl, + ghostEl, + rootEl, + nextEl, + lastDownEl, + cloneEl, + cloneHidden, + oldIndex, + newIndex, + oldDraggableIndex, + newDraggableIndex, + activeGroup, + putSortable, + awaitingDragStarted = false, + ignoreNextClick = false, + sortables = [], + tapEvt, + touchEvt, + lastDx, + lastDy, + tapDistanceLeft, + tapDistanceTop, + moved, + lastTarget, + lastDirection, + pastFirstInvertThresh = false, + isCircumstantialInvert = false, + targetMoveDistance, + // For positioning ghost absolutely +ghostRelativeParent, + ghostRelativeParentInitialScroll = [], + // (left, top) +_silent = false, + savedInputChecked = []; +/** @const */ + +var documentExists = typeof document !== 'undefined', + PositionGhostAbsolutely = IOS, + CSSFloatProperty = Edge || IE11OrLess ? 'cssFloat' : 'float', + // This will not pass for IE9, because IE9 DnD only works on anchors +supportDraggable = documentExists && !ChromeForAndroid && !IOS && 'draggable' in document.createElement('div'), + supportCssPointerEvents = function () { + if (!documentExists) return; // false when <= IE11 + + if (IE11OrLess) { + return false; + } + + var el = document.createElement('x'); + el.style.cssText = 'pointer-events:auto'; + return el.style.pointerEvents === 'auto'; +}(), + _detectDirection = function _detectDirection(el, options) { + var elCSS = css(el), + elWidth = parseInt(elCSS.width) - parseInt(elCSS.paddingLeft) - parseInt(elCSS.paddingRight) - parseInt(elCSS.borderLeftWidth) - parseInt(elCSS.borderRightWidth), + child1 = getChild(el, 0, options), + child2 = getChild(el, 1, options), + firstChildCSS = child1 && css(child1), + secondChildCSS = child2 && css(child2), + firstChildWidth = firstChildCSS && parseInt(firstChildCSS.marginLeft) + parseInt(firstChildCSS.marginRight) + getRect(child1).width, + secondChildWidth = secondChildCSS && parseInt(secondChildCSS.marginLeft) + parseInt(secondChildCSS.marginRight) + getRect(child2).width; + + if (elCSS.display === 'flex') { + return elCSS.flexDirection === 'column' || elCSS.flexDirection === 'column-reverse' ? 'vertical' : 'horizontal'; + } + + if (elCSS.display === 'grid') { + return elCSS.gridTemplateColumns.split(' ').length <= 1 ? 'vertical' : 'horizontal'; + } + + if (child1 && firstChildCSS["float"] && firstChildCSS["float"] !== 'none') { + var touchingSideChild2 = firstChildCSS["float"] === 'left' ? 'left' : 'right'; + return child2 && (secondChildCSS.clear === 'both' || secondChildCSS.clear === touchingSideChild2) ? 'vertical' : 'horizontal'; + } + + return child1 && (firstChildCSS.display === 'block' || firstChildCSS.display === 'flex' || firstChildCSS.display === 'table' || firstChildCSS.display === 'grid' || firstChildWidth >= elWidth && elCSS[CSSFloatProperty] === 'none' || child2 && elCSS[CSSFloatProperty] === 'none' && firstChildWidth + secondChildWidth > elWidth) ? 'vertical' : 'horizontal'; +}, + _dragElInRowColumn = function _dragElInRowColumn(dragRect, targetRect, vertical) { + var dragElS1Opp = vertical ? dragRect.left : dragRect.top, + dragElS2Opp = vertical ? dragRect.right : dragRect.bottom, + dragElOppLength = vertical ? dragRect.width : dragRect.height, + targetS1Opp = vertical ? targetRect.left : targetRect.top, + targetS2Opp = vertical ? targetRect.right : targetRect.bottom, + targetOppLength = vertical ? targetRect.width : targetRect.height; + return dragElS1Opp === targetS1Opp || dragElS2Opp === targetS2Opp || dragElS1Opp + dragElOppLength / 2 === targetS1Opp + targetOppLength / 2; +}, + +/** + * Detects first nearest empty sortable to X and Y position using emptyInsertThreshold. + * @param {Number} x X position + * @param {Number} y Y position + * @return {HTMLElement} Element of the first found nearest Sortable + */ +_detectNearestEmptySortable = function _detectNearestEmptySortable(x, y) { + var ret; + sortables.some(function (sortable) { + if (lastChild(sortable)) return; + var rect = getRect(sortable), + threshold = sortable[expando].options.emptyInsertThreshold, + insideHorizontally = x >= rect.left - threshold && x <= rect.right + threshold, + insideVertically = y >= rect.top - threshold && y <= rect.bottom + threshold; + + if (threshold && insideHorizontally && insideVertically) { + return ret = sortable; + } + }); + return ret; +}, + _prepareGroup = function _prepareGroup(options) { + function toFn(value, pull) { + return function (to, from, dragEl, evt) { + var sameGroup = to.options.group.name && from.options.group.name && to.options.group.name === from.options.group.name; + + if (value == null && (pull || sameGroup)) { + // Default pull value + // Default pull and put value if same group + return true; + } else if (value == null || value === false) { + return false; + } else if (pull && value === 'clone') { + return value; + } else if (typeof value === 'function') { + return toFn(value(to, from, dragEl, evt), pull)(to, from, dragEl, evt); + } else { + var otherGroup = (pull ? to : from).options.group.name; + return value === true || typeof value === 'string' && value === otherGroup || value.join && value.indexOf(otherGroup) > -1; + } + }; + } + + var group = {}; + var originalGroup = options.group; + + if (!originalGroup || _typeof(originalGroup) != 'object') { + originalGroup = { + name: originalGroup + }; + } + + group.name = originalGroup.name; + group.checkPull = toFn(originalGroup.pull, true); + group.checkPut = toFn(originalGroup.put); + group.revertClone = originalGroup.revertClone; + options.group = group; +}, + _hideGhostForTarget = function _hideGhostForTarget() { + if (!supportCssPointerEvents && ghostEl) { + css(ghostEl, 'display', 'none'); + } +}, + _unhideGhostForTarget = function _unhideGhostForTarget() { + if (!supportCssPointerEvents && ghostEl) { + css(ghostEl, 'display', ''); + } +}; // #1184 fix - Prevent click event on fallback if dragged but item not changed position + + +if (documentExists) { + document.addEventListener('click', function (evt) { + if (ignoreNextClick) { + evt.preventDefault(); + evt.stopPropagation && evt.stopPropagation(); + evt.stopImmediatePropagation && evt.stopImmediatePropagation(); + ignoreNextClick = false; + return false; + } + }, true); +} + +var nearestEmptyInsertDetectEvent = function nearestEmptyInsertDetectEvent(evt) { + if (dragEl) { + evt = evt.touches ? evt.touches[0] : evt; + + var nearest = _detectNearestEmptySortable(evt.clientX, evt.clientY); + + if (nearest) { + // Create imitation event + var event = {}; + + for (var i in evt) { + if (evt.hasOwnProperty(i)) { + event[i] = evt[i]; + } + } + + event.target = event.rootEl = nearest; + event.preventDefault = void 0; + event.stopPropagation = void 0; + + nearest[expando]._onDragOver(event); + } + } +}; + +var _checkOutsideTargetEl = function _checkOutsideTargetEl(evt) { + if (dragEl) { + dragEl.parentNode[expando]._isOutsideThisEl(evt.target); + } +}; +/** + * @class Sortable + * @param {HTMLElement} el + * @param {Object} [options] + */ + + +function Sortable(el, options) { + if (!(el && el.nodeType && el.nodeType === 1)) { + throw "Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(el)); + } + + this.el = el; // root element + + this.options = options = _extends({}, options); // Export instance + + el[expando] = this; + var defaults = { + group: null, + sort: true, + disabled: false, + store: null, + handle: null, + draggable: /^[uo]l$/i.test(el.nodeName) ? '>li' : '>*', + swapThreshold: 1, + // percentage; 0 <= x <= 1 + invertSwap: false, + // invert always + invertedSwapThreshold: null, + // will be set to same as swapThreshold if default + removeCloneOnHide: true, + direction: function direction() { + return _detectDirection(el, this.options); + }, + ghostClass: 'sortable-ghost', + chosenClass: 'sortable-chosen', + dragClass: 'sortable-drag', + ignore: 'a, img', + filter: null, + preventOnFilter: true, + animation: 0, + easing: null, + setData: function setData(dataTransfer, dragEl) { + dataTransfer.setData('Text', dragEl.textContent); + }, + dropBubble: false, + dragoverBubble: false, + dataIdAttr: 'data-id', + delay: 0, + delayOnTouchOnly: false, + touchStartThreshold: (Number.parseInt ? Number : window).parseInt(window.devicePixelRatio, 10) || 1, + forceFallback: false, + fallbackClass: 'sortable-fallback', + fallbackOnBody: false, + fallbackTolerance: 0, + fallbackOffset: { + x: 0, + y: 0 + }, + supportPointer: Sortable.supportPointer !== false && 'PointerEvent' in window, + emptyInsertThreshold: 5 + }; + PluginManager.initializePlugins(this, el, defaults); // Set default options + + for (var name in defaults) { + !(name in options) && (options[name] = defaults[name]); + } + + _prepareGroup(options); // Bind all private methods + + + for (var fn in this) { + if (fn.charAt(0) === '_' && typeof this[fn] === 'function') { + this[fn] = this[fn].bind(this); + } + } // Setup drag mode + + + this.nativeDraggable = options.forceFallback ? false : supportDraggable; + + if (this.nativeDraggable) { + // Touch start threshold cannot be greater than the native dragstart threshold + this.options.touchStartThreshold = 1; + } // Bind events + + + if (options.supportPointer) { + on(el, 'pointerdown', this._onTapStart); + } else { + on(el, 'mousedown', this._onTapStart); + on(el, 'touchstart', this._onTapStart); + } + + if (this.nativeDraggable) { + on(el, 'dragover', this); + on(el, 'dragenter', this); + } + + sortables.push(this.el); // Restore sorting + + options.store && options.store.get && this.sort(options.store.get(this) || []); // Add animation state manager + + _extends(this, AnimationStateManager()); +} + +Sortable.prototype = +/** @lends Sortable.prototype */ +{ + constructor: Sortable, + _isOutsideThisEl: function _isOutsideThisEl(target) { + if (!this.el.contains(target) && target !== this.el) { + lastTarget = null; + } + }, + _getDirection: function _getDirection(evt, target) { + return typeof this.options.direction === 'function' ? this.options.direction.call(this, evt, target, dragEl) : this.options.direction; + }, + _onTapStart: function _onTapStart( + /** Event|TouchEvent */ + evt) { + if (!evt.cancelable) return; + + var _this = this, + el = this.el, + options = this.options, + preventOnFilter = options.preventOnFilter, + type = evt.type, + touch = evt.touches && evt.touches[0] || evt.pointerType && evt.pointerType === 'touch' && evt, + target = (touch || evt).target, + originalTarget = evt.target.shadowRoot && (evt.path && evt.path[0] || evt.composedPath && evt.composedPath()[0]) || target, + filter = options.filter; + + _saveInputCheckedState(el); // Don't trigger start event when an element is been dragged, otherwise the evt.oldindex always wrong when set option.group. + + + if (dragEl) { + return; + } + + if (/mousedown|pointerdown/.test(type) && evt.button !== 0 || options.disabled) { + return; // only left button and enabled + } // cancel dnd if original target is content editable + + + if (originalTarget.isContentEditable) { + return; + } + + target = closest(target, options.draggable, el, false); + + if (target && target.animated) { + return; + } + + if (lastDownEl === target) { + // Ignoring duplicate `down` + return; + } // Get the index of the dragged element within its parent + + + oldIndex = index(target); + oldDraggableIndex = index(target, options.draggable); // Check filter + + if (typeof filter === 'function') { + if (filter.call(this, evt, target, this)) { + _dispatchEvent({ + sortable: _this, + rootEl: originalTarget, + name: 'filter', + targetEl: target, + toEl: el, + fromEl: el + }); + + pluginEvent('filter', _this, { + evt: evt + }); + preventOnFilter && evt.cancelable && evt.preventDefault(); + return; // cancel dnd + } + } else if (filter) { + filter = filter.split(',').some(function (criteria) { + criteria = closest(originalTarget, criteria.trim(), el, false); + + if (criteria) { + _dispatchEvent({ + sortable: _this, + rootEl: criteria, + name: 'filter', + targetEl: target, + fromEl: el, + toEl: el + }); + + pluginEvent('filter', _this, { + evt: evt + }); + return true; + } + }); + + if (filter) { + preventOnFilter && evt.cancelable && evt.preventDefault(); + return; // cancel dnd + } + } + + if (options.handle && !closest(originalTarget, options.handle, el, false)) { + return; + } // Prepare `dragstart` + + + this._prepareDragStart(evt, touch, target); + }, + _prepareDragStart: function _prepareDragStart( + /** Event */ + evt, + /** Touch */ + touch, + /** HTMLElement */ + target) { + var _this = this, + el = _this.el, + options = _this.options, + ownerDocument = el.ownerDocument, + dragStartFn; + + if (target && !dragEl && target.parentNode === el) { + var dragRect = getRect(target); + rootEl = el; + dragEl = target; + parentEl = dragEl.parentNode; + nextEl = dragEl.nextSibling; + lastDownEl = target; + activeGroup = options.group; + Sortable.dragged = dragEl; + tapEvt = { + target: dragEl, + clientX: (touch || evt).clientX, + clientY: (touch || evt).clientY + }; + tapDistanceLeft = tapEvt.clientX - dragRect.left; + tapDistanceTop = tapEvt.clientY - dragRect.top; + this._lastX = (touch || evt).clientX; + this._lastY = (touch || evt).clientY; + dragEl.style['will-change'] = 'all'; + + dragStartFn = function dragStartFn() { + pluginEvent('delayEnded', _this, { + evt: evt + }); + + if (Sortable.eventCanceled) { + _this._onDrop(); + + return; + } // Delayed drag has been triggered + // we can re-enable the events: touchmove/mousemove + + + _this._disableDelayedDragEvents(); + + if (!FireFox && _this.nativeDraggable) { + dragEl.draggable = true; + } // Bind the events: dragstart/dragend + + + _this._triggerDragStart(evt, touch); // Drag start event + + + _dispatchEvent({ + sortable: _this, + name: 'choose', + originalEvent: evt + }); // Chosen item + + + toggleClass(dragEl, options.chosenClass, true); + }; // Disable "draggable" + + + options.ignore.split(',').forEach(function (criteria) { + find(dragEl, criteria.trim(), _disableDraggable); + }); + on(ownerDocument, 'dragover', nearestEmptyInsertDetectEvent); + on(ownerDocument, 'mousemove', nearestEmptyInsertDetectEvent); + on(ownerDocument, 'touchmove', nearestEmptyInsertDetectEvent); + on(ownerDocument, 'mouseup', _this._onDrop); + on(ownerDocument, 'touchend', _this._onDrop); + on(ownerDocument, 'touchcancel', _this._onDrop); // Make dragEl draggable (must be before delay for FireFox) + + if (FireFox && this.nativeDraggable) { + this.options.touchStartThreshold = 4; + dragEl.draggable = true; + } + + pluginEvent('delayStart', this, { + evt: evt + }); // Delay is impossible for native DnD in Edge or IE + + if (options.delay && (!options.delayOnTouchOnly || touch) && (!this.nativeDraggable || !(Edge || IE11OrLess))) { + if (Sortable.eventCanceled) { + this._onDrop(); + + return; + } // If the user moves the pointer or let go the click or touch + // before the delay has been reached: + // disable the delayed drag + + + on(ownerDocument, 'mouseup', _this._disableDelayedDrag); + on(ownerDocument, 'touchend', _this._disableDelayedDrag); + on(ownerDocument, 'touchcancel', _this._disableDelayedDrag); + on(ownerDocument, 'mousemove', _this._delayedDragTouchMoveHandler); + on(ownerDocument, 'touchmove', _this._delayedDragTouchMoveHandler); + options.supportPointer && on(ownerDocument, 'pointermove', _this._delayedDragTouchMoveHandler); + _this._dragStartTimer = setTimeout(dragStartFn, options.delay); + } else { + dragStartFn(); + } + } + }, + _delayedDragTouchMoveHandler: function _delayedDragTouchMoveHandler( + /** TouchEvent|PointerEvent **/ + e) { + var touch = e.touches ? e.touches[0] : e; + + if (Math.max(Math.abs(touch.clientX - this._lastX), Math.abs(touch.clientY - this._lastY)) >= Math.floor(this.options.touchStartThreshold / (this.nativeDraggable && window.devicePixelRatio || 1))) { + this._disableDelayedDrag(); + } + }, + _disableDelayedDrag: function _disableDelayedDrag() { + dragEl && _disableDraggable(dragEl); + clearTimeout(this._dragStartTimer); + + this._disableDelayedDragEvents(); + }, + _disableDelayedDragEvents: function _disableDelayedDragEvents() { + var ownerDocument = this.el.ownerDocument; + off(ownerDocument, 'mouseup', this._disableDelayedDrag); + off(ownerDocument, 'touchend', this._disableDelayedDrag); + off(ownerDocument, 'touchcancel', this._disableDelayedDrag); + off(ownerDocument, 'mousemove', this._delayedDragTouchMoveHandler); + off(ownerDocument, 'touchmove', this._delayedDragTouchMoveHandler); + off(ownerDocument, 'pointermove', this._delayedDragTouchMoveHandler); + }, + _triggerDragStart: function _triggerDragStart( + /** Event */ + evt, + /** Touch */ + touch) { + touch = touch || evt.pointerType == 'touch' && evt; + + if (!this.nativeDraggable || touch) { + if (this.options.supportPointer) { + on(document, 'pointermove', this._onTouchMove); + } else if (touch) { + on(document, 'touchmove', this._onTouchMove); + } else { + on(document, 'mousemove', this._onTouchMove); + } + } else { + on(dragEl, 'dragend', this); + on(rootEl, 'dragstart', this._onDragStart); + } + + try { + if (document.selection) { + // Timeout neccessary for IE9 + _nextTick(function () { + document.selection.empty(); + }); + } else { + window.getSelection().removeAllRanges(); + } + } catch (err) {} + }, + _dragStarted: function _dragStarted(fallback, evt) { + + awaitingDragStarted = false; + + if (rootEl && dragEl) { + pluginEvent('dragStarted', this, { + evt: evt + }); + + if (this.nativeDraggable) { + on(document, 'dragover', _checkOutsideTargetEl); + } + + var options = this.options; // Apply effect + + !fallback && toggleClass(dragEl, options.dragClass, false); + toggleClass(dragEl, options.ghostClass, true); + Sortable.active = this; + fallback && this._appendGhost(); // Drag start event + + _dispatchEvent({ + sortable: this, + name: 'start', + originalEvent: evt + }); + } else { + this._nulling(); + } + }, + _emulateDragOver: function _emulateDragOver() { + if (touchEvt) { + this._lastX = touchEvt.clientX; + this._lastY = touchEvt.clientY; + + _hideGhostForTarget(); + + var target = document.elementFromPoint(touchEvt.clientX, touchEvt.clientY); + var parent = target; + + while (target && target.shadowRoot) { + target = target.shadowRoot.elementFromPoint(touchEvt.clientX, touchEvt.clientY); + if (target === parent) break; + parent = target; + } + + dragEl.parentNode[expando]._isOutsideThisEl(target); + + if (parent) { + do { + if (parent[expando]) { + var inserted = void 0; + inserted = parent[expando]._onDragOver({ + clientX: touchEvt.clientX, + clientY: touchEvt.clientY, + target: target, + rootEl: parent + }); + + if (inserted && !this.options.dragoverBubble) { + break; + } + } + + target = parent; // store last element + } + /* jshint boss:true */ + while (parent = parent.parentNode); + } + + _unhideGhostForTarget(); + } + }, + _onTouchMove: function _onTouchMove( + /**TouchEvent*/ + evt) { + if (tapEvt) { + var options = this.options, + fallbackTolerance = options.fallbackTolerance, + fallbackOffset = options.fallbackOffset, + touch = evt.touches ? evt.touches[0] : evt, + ghostMatrix = ghostEl && matrix(ghostEl, true), + scaleX = ghostEl && ghostMatrix && ghostMatrix.a, + scaleY = ghostEl && ghostMatrix && ghostMatrix.d, + relativeScrollOffset = PositionGhostAbsolutely && ghostRelativeParent && getRelativeScrollOffset(ghostRelativeParent), + dx = (touch.clientX - tapEvt.clientX + fallbackOffset.x) / (scaleX || 1) + (relativeScrollOffset ? relativeScrollOffset[0] - ghostRelativeParentInitialScroll[0] : 0) / (scaleX || 1), + dy = (touch.clientY - tapEvt.clientY + fallbackOffset.y) / (scaleY || 1) + (relativeScrollOffset ? relativeScrollOffset[1] - ghostRelativeParentInitialScroll[1] : 0) / (scaleY || 1); // only set the status to dragging, when we are actually dragging + + if (!Sortable.active && !awaitingDragStarted) { + if (fallbackTolerance && Math.max(Math.abs(touch.clientX - this._lastX), Math.abs(touch.clientY - this._lastY)) < fallbackTolerance) { + return; + } + + this._onDragStart(evt, true); + } + + if (ghostEl) { + if (ghostMatrix) { + ghostMatrix.e += dx - (lastDx || 0); + ghostMatrix.f += dy - (lastDy || 0); + } else { + ghostMatrix = { + a: 1, + b: 0, + c: 0, + d: 1, + e: dx, + f: dy + }; + } + + var cssMatrix = "matrix(".concat(ghostMatrix.a, ",").concat(ghostMatrix.b, ",").concat(ghostMatrix.c, ",").concat(ghostMatrix.d, ",").concat(ghostMatrix.e, ",").concat(ghostMatrix.f, ")"); + css(ghostEl, 'webkitTransform', cssMatrix); + css(ghostEl, 'mozTransform', cssMatrix); + css(ghostEl, 'msTransform', cssMatrix); + css(ghostEl, 'transform', cssMatrix); + lastDx = dx; + lastDy = dy; + touchEvt = touch; + } + + evt.cancelable && evt.preventDefault(); + } + }, + _appendGhost: function _appendGhost() { + // Bug if using scale(): https://stackoverflow.com/questions/2637058 + // Not being adjusted for + if (!ghostEl) { + var container = this.options.fallbackOnBody ? document.body : rootEl, + rect = getRect(dragEl, true, PositionGhostAbsolutely, true, container), + options = this.options; // Position absolutely + + if (PositionGhostAbsolutely) { + // Get relatively positioned parent + ghostRelativeParent = container; + + while (css(ghostRelativeParent, 'position') === 'static' && css(ghostRelativeParent, 'transform') === 'none' && ghostRelativeParent !== document) { + ghostRelativeParent = ghostRelativeParent.parentNode; + } + + if (ghostRelativeParent !== document.body && ghostRelativeParent !== document.documentElement) { + if (ghostRelativeParent === document) ghostRelativeParent = getWindowScrollingElement(); + rect.top += ghostRelativeParent.scrollTop; + rect.left += ghostRelativeParent.scrollLeft; + } else { + ghostRelativeParent = getWindowScrollingElement(); + } + + ghostRelativeParentInitialScroll = getRelativeScrollOffset(ghostRelativeParent); + } + + ghostEl = dragEl.cloneNode(true); + toggleClass(ghostEl, options.ghostClass, false); + toggleClass(ghostEl, options.fallbackClass, true); + toggleClass(ghostEl, options.dragClass, true); + css(ghostEl, 'transition', ''); + css(ghostEl, 'transform', ''); + css(ghostEl, 'box-sizing', 'border-box'); + css(ghostEl, 'margin', 0); + css(ghostEl, 'top', rect.top); + css(ghostEl, 'left', rect.left); + css(ghostEl, 'width', rect.width); + css(ghostEl, 'height', rect.height); + css(ghostEl, 'opacity', '0.8'); + css(ghostEl, 'position', PositionGhostAbsolutely ? 'absolute' : 'fixed'); + css(ghostEl, 'zIndex', '100000'); + css(ghostEl, 'pointerEvents', 'none'); + Sortable.ghost = ghostEl; + container.appendChild(ghostEl); // Set transform-origin + + css(ghostEl, 'transform-origin', tapDistanceLeft / parseInt(ghostEl.style.width) * 100 + '% ' + tapDistanceTop / parseInt(ghostEl.style.height) * 100 + '%'); + } + }, + _onDragStart: function _onDragStart( + /**Event*/ + evt, + /**boolean*/ + fallback) { + var _this = this; + + var dataTransfer = evt.dataTransfer; + var options = _this.options; + pluginEvent('dragStart', this, { + evt: evt + }); + + if (Sortable.eventCanceled) { + this._onDrop(); + + return; + } + + pluginEvent('setupClone', this); + + if (!Sortable.eventCanceled) { + cloneEl = clone(dragEl); + cloneEl.draggable = false; + cloneEl.style['will-change'] = ''; + + this._hideClone(); + + toggleClass(cloneEl, this.options.chosenClass, false); + Sortable.clone = cloneEl; + } // #1143: IFrame support workaround + + + _this.cloneId = _nextTick(function () { + pluginEvent('clone', _this); + if (Sortable.eventCanceled) return; + + if (!_this.options.removeCloneOnHide) { + rootEl.insertBefore(cloneEl, dragEl); + } + + _this._hideClone(); + + _dispatchEvent({ + sortable: _this, + name: 'clone' + }); + }); + !fallback && toggleClass(dragEl, options.dragClass, true); // Set proper drop events + + if (fallback) { + ignoreNextClick = true; + _this._loopId = setInterval(_this._emulateDragOver, 50); + } else { + // Undo what was set in _prepareDragStart before drag started + off(document, 'mouseup', _this._onDrop); + off(document, 'touchend', _this._onDrop); + off(document, 'touchcancel', _this._onDrop); + + if (dataTransfer) { + dataTransfer.effectAllowed = 'move'; + options.setData && options.setData.call(_this, dataTransfer, dragEl); + } + + on(document, 'drop', _this); // #1276 fix: + + css(dragEl, 'transform', 'translateZ(0)'); + } + + awaitingDragStarted = true; + _this._dragStartId = _nextTick(_this._dragStarted.bind(_this, fallback, evt)); + on(document, 'selectstart', _this); + moved = true; + + if (Safari) { + css(document.body, 'user-select', 'none'); + } + }, + // Returns true - if no further action is needed (either inserted or another condition) + _onDragOver: function _onDragOver( + /**Event*/ + evt) { + var el = this.el, + target = evt.target, + dragRect, + targetRect, + revert, + options = this.options, + group = options.group, + activeSortable = Sortable.active, + isOwner = activeGroup === group, + canSort = options.sort, + fromSortable = putSortable || activeSortable, + vertical, + _this = this, + completedFired = false; + + if (_silent) return; + + function dragOverEvent(name, extra) { + pluginEvent(name, _this, _objectSpread({ + evt: evt, + isOwner: isOwner, + axis: vertical ? 'vertical' : 'horizontal', + revert: revert, + dragRect: dragRect, + targetRect: targetRect, + canSort: canSort, + fromSortable: fromSortable, + target: target, + completed: completed, + onMove: function onMove(target, after) { + return _onMove(rootEl, el, dragEl, dragRect, target, getRect(target), evt, after); + }, + changed: changed + }, extra)); + } // Capture animation state + + + function capture() { + dragOverEvent('dragOverAnimationCapture'); + + _this.captureAnimationState(); + + if (_this !== fromSortable) { + fromSortable.captureAnimationState(); + } + } // Return invocation when dragEl is inserted (or completed) + + + function completed(insertion) { + dragOverEvent('dragOverCompleted', { + insertion: insertion + }); + + if (insertion) { + // Clones must be hidden before folding animation to capture dragRectAbsolute properly + if (isOwner) { + activeSortable._hideClone(); + } else { + activeSortable._showClone(_this); + } + + if (_this !== fromSortable) { + // Set ghost class to new sortable's ghost class + toggleClass(dragEl, putSortable ? putSortable.options.ghostClass : activeSortable.options.ghostClass, false); + toggleClass(dragEl, options.ghostClass, true); + } + + if (putSortable !== _this && _this !== Sortable.active) { + putSortable = _this; + } else if (_this === Sortable.active && putSortable) { + putSortable = null; + } // Animation + + + if (fromSortable === _this) { + _this._ignoreWhileAnimating = target; + } + + _this.animateAll(function () { + dragOverEvent('dragOverAnimationComplete'); + _this._ignoreWhileAnimating = null; + }); + + if (_this !== fromSortable) { + fromSortable.animateAll(); + fromSortable._ignoreWhileAnimating = null; + } + } // Null lastTarget if it is not inside a previously swapped element + + + if (target === dragEl && !dragEl.animated || target === el && !target.animated) { + lastTarget = null; + } // no bubbling and not fallback + + + if (!options.dragoverBubble && !evt.rootEl && target !== document) { + dragEl.parentNode[expando]._isOutsideThisEl(evt.target); // Do not detect for empty insert if already inserted + + + !insertion && nearestEmptyInsertDetectEvent(evt); + } + + !options.dragoverBubble && evt.stopPropagation && evt.stopPropagation(); + return completedFired = true; + } // Call when dragEl has been inserted + + + function changed() { + newIndex = index(dragEl); + newDraggableIndex = index(dragEl, options.draggable); + + _dispatchEvent({ + sortable: _this, + name: 'change', + toEl: el, + newIndex: newIndex, + newDraggableIndex: newDraggableIndex, + originalEvent: evt + }); + } + + if (evt.preventDefault !== void 0) { + evt.cancelable && evt.preventDefault(); + } + + target = closest(target, options.draggable, el, true); + dragOverEvent('dragOver'); + if (Sortable.eventCanceled) return completedFired; + + if (dragEl.contains(evt.target) || target.animated && target.animatingX && target.animatingY || _this._ignoreWhileAnimating === target) { + return completed(false); + } + + ignoreNextClick = false; + + if (activeSortable && !options.disabled && (isOwner ? canSort || (revert = !rootEl.contains(dragEl)) // Reverting item into the original list + : putSortable === this || (this.lastPutMode = activeGroup.checkPull(this, activeSortable, dragEl, evt)) && group.checkPut(this, activeSortable, dragEl, evt))) { + vertical = this._getDirection(evt, target) === 'vertical'; + dragRect = getRect(dragEl); + dragOverEvent('dragOverValid'); + if (Sortable.eventCanceled) return completedFired; + + if (revert) { + parentEl = rootEl; // actualization + + capture(); + + this._hideClone(); + + dragOverEvent('revert'); + + if (!Sortable.eventCanceled) { + if (nextEl) { + rootEl.insertBefore(dragEl, nextEl); + } else { + rootEl.appendChild(dragEl); + } + } + + return completed(true); + } + + var elLastChild = lastChild(el, options.draggable); + + if (!elLastChild || _ghostIsLast(evt, vertical, this) && !elLastChild.animated) { + // If already at end of list: Do not insert + if (elLastChild === dragEl) { + return completed(false); + } // assign target only if condition is true + + + if (elLastChild && el === evt.target) { + target = elLastChild; + } + + if (target) { + targetRect = getRect(target); + } + + if (_onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, !!target) !== false) { + capture(); + el.appendChild(dragEl); + parentEl = el; // actualization + + changed(); + return completed(true); + } + } else if (target.parentNode === el) { + targetRect = getRect(target); + var direction = 0, + targetBeforeFirstSwap, + differentLevel = dragEl.parentNode !== el, + differentRowCol = !_dragElInRowColumn(dragEl.animated && dragEl.toRect || dragRect, target.animated && target.toRect || targetRect, vertical), + side1 = vertical ? 'top' : 'left', + scrolledPastTop = isScrolledPast(target, 'top', 'top') || isScrolledPast(dragEl, 'top', 'top'), + scrollBefore = scrolledPastTop ? scrolledPastTop.scrollTop : void 0; + + if (lastTarget !== target) { + targetBeforeFirstSwap = targetRect[side1]; + pastFirstInvertThresh = false; + isCircumstantialInvert = !differentRowCol && options.invertSwap || differentLevel; + } + + direction = _getSwapDirection(evt, target, targetRect, vertical, differentRowCol ? 1 : options.swapThreshold, options.invertedSwapThreshold == null ? options.swapThreshold : options.invertedSwapThreshold, isCircumstantialInvert, lastTarget === target); + var sibling; + + if (direction !== 0) { + // Check if target is beside dragEl in respective direction (ignoring hidden elements) + var dragIndex = index(dragEl); + + do { + dragIndex -= direction; + sibling = parentEl.children[dragIndex]; + } while (sibling && (css(sibling, 'display') === 'none' || sibling === ghostEl)); + } // If dragEl is already beside target: Do not insert + + + if (direction === 0 || sibling === target) { + return completed(false); + } + + lastTarget = target; + lastDirection = direction; + var nextSibling = target.nextElementSibling, + after = false; + after = direction === 1; + + var moveVector = _onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, after); + + if (moveVector !== false) { + if (moveVector === 1 || moveVector === -1) { + after = moveVector === 1; + } + + _silent = true; + setTimeout(_unsilent, 30); + capture(); + + if (after && !nextSibling) { + el.appendChild(dragEl); + } else { + target.parentNode.insertBefore(dragEl, after ? nextSibling : target); + } // Undo chrome's scroll adjustment (has no effect on other browsers) + + + if (scrolledPastTop) { + scrollBy(scrolledPastTop, 0, scrollBefore - scrolledPastTop.scrollTop); + } + + parentEl = dragEl.parentNode; // actualization + // must be done before animation + + if (targetBeforeFirstSwap !== undefined && !isCircumstantialInvert) { + targetMoveDistance = Math.abs(targetBeforeFirstSwap - getRect(target)[side1]); + } + + changed(); + return completed(true); + } + } + + if (el.contains(dragEl)) { + return completed(false); + } + } + + return false; + }, + _ignoreWhileAnimating: null, + _offMoveEvents: function _offMoveEvents() { + off(document, 'mousemove', this._onTouchMove); + off(document, 'touchmove', this._onTouchMove); + off(document, 'pointermove', this._onTouchMove); + off(document, 'dragover', nearestEmptyInsertDetectEvent); + off(document, 'mousemove', nearestEmptyInsertDetectEvent); + off(document, 'touchmove', nearestEmptyInsertDetectEvent); + }, + _offUpEvents: function _offUpEvents() { + var ownerDocument = this.el.ownerDocument; + off(ownerDocument, 'mouseup', this._onDrop); + off(ownerDocument, 'touchend', this._onDrop); + off(ownerDocument, 'pointerup', this._onDrop); + off(ownerDocument, 'touchcancel', this._onDrop); + off(document, 'selectstart', this); + }, + _onDrop: function _onDrop( + /**Event*/ + evt) { + var el = this.el, + options = this.options; // Get the index of the dragged element within its parent + + newIndex = index(dragEl); + newDraggableIndex = index(dragEl, options.draggable); + pluginEvent('drop', this, { + evt: evt + }); + parentEl = dragEl && dragEl.parentNode; // Get again after plugin event + + newIndex = index(dragEl); + newDraggableIndex = index(dragEl, options.draggable); + + if (Sortable.eventCanceled) { + this._nulling(); + + return; + } + + awaitingDragStarted = false; + isCircumstantialInvert = false; + pastFirstInvertThresh = false; + clearInterval(this._loopId); + clearTimeout(this._dragStartTimer); + + _cancelNextTick(this.cloneId); + + _cancelNextTick(this._dragStartId); // Unbind events + + + if (this.nativeDraggable) { + off(document, 'drop', this); + off(el, 'dragstart', this._onDragStart); + } + + this._offMoveEvents(); + + this._offUpEvents(); + + if (Safari) { + css(document.body, 'user-select', ''); + } + + css(dragEl, 'transform', ''); + + if (evt) { + if (moved) { + evt.cancelable && evt.preventDefault(); + !options.dropBubble && evt.stopPropagation(); + } + + ghostEl && ghostEl.parentNode && ghostEl.parentNode.removeChild(ghostEl); + + if (rootEl === parentEl || putSortable && putSortable.lastPutMode !== 'clone') { + // Remove clone(s) + cloneEl && cloneEl.parentNode && cloneEl.parentNode.removeChild(cloneEl); + } + + if (dragEl) { + if (this.nativeDraggable) { + off(dragEl, 'dragend', this); + } + + _disableDraggable(dragEl); + + dragEl.style['will-change'] = ''; // Remove classes + // ghostClass is added in dragStarted + + if (moved && !awaitingDragStarted) { + toggleClass(dragEl, putSortable ? putSortable.options.ghostClass : this.options.ghostClass, false); + } + + toggleClass(dragEl, this.options.chosenClass, false); // Drag stop event + + _dispatchEvent({ + sortable: this, + name: 'unchoose', + toEl: parentEl, + newIndex: null, + newDraggableIndex: null, + originalEvent: evt + }); + + if (rootEl !== parentEl) { + if (newIndex >= 0) { + // Add event + _dispatchEvent({ + rootEl: parentEl, + name: 'add', + toEl: parentEl, + fromEl: rootEl, + originalEvent: evt + }); // Remove event + + + _dispatchEvent({ + sortable: this, + name: 'remove', + toEl: parentEl, + originalEvent: evt + }); // drag from one list and drop into another + + + _dispatchEvent({ + rootEl: parentEl, + name: 'sort', + toEl: parentEl, + fromEl: rootEl, + originalEvent: evt + }); + + _dispatchEvent({ + sortable: this, + name: 'sort', + toEl: parentEl, + originalEvent: evt + }); + } + + putSortable && putSortable.save(); + } else { + if (newIndex !== oldIndex) { + if (newIndex >= 0) { + // drag & drop within the same list + _dispatchEvent({ + sortable: this, + name: 'update', + toEl: parentEl, + originalEvent: evt + }); + + _dispatchEvent({ + sortable: this, + name: 'sort', + toEl: parentEl, + originalEvent: evt + }); + } + } + } + + if (Sortable.active) { + /* jshint eqnull:true */ + if (newIndex == null || newIndex === -1) { + newIndex = oldIndex; + newDraggableIndex = oldDraggableIndex; + } + + _dispatchEvent({ + sortable: this, + name: 'end', + toEl: parentEl, + originalEvent: evt + }); // Save sorting + + + this.save(); + } + } + } + + this._nulling(); + }, + _nulling: function _nulling() { + pluginEvent('nulling', this); + rootEl = dragEl = parentEl = ghostEl = nextEl = cloneEl = lastDownEl = cloneHidden = tapEvt = touchEvt = moved = newIndex = newDraggableIndex = oldIndex = oldDraggableIndex = lastTarget = lastDirection = putSortable = activeGroup = Sortable.dragged = Sortable.ghost = Sortable.clone = Sortable.active = null; + savedInputChecked.forEach(function (el) { + el.checked = true; + }); + savedInputChecked.length = lastDx = lastDy = 0; + }, + handleEvent: function handleEvent( + /**Event*/ + evt) { + switch (evt.type) { + case 'drop': + case 'dragend': + this._onDrop(evt); + + break; + + case 'dragenter': + case 'dragover': + if (dragEl) { + this._onDragOver(evt); + + _globalDragOver(evt); + } + + break; + + case 'selectstart': + evt.preventDefault(); + break; + } + }, + + /** + * Serializes the item into an array of string. + * @returns {String[]} + */ + toArray: function toArray() { + var order = [], + el, + children = this.el.children, + i = 0, + n = children.length, + options = this.options; + + for (; i < n; i++) { + el = children[i]; + + if (closest(el, options.draggable, this.el, false)) { + order.push(el.getAttribute(options.dataIdAttr) || _generateId(el)); + } + } + + return order; + }, + + /** + * Sorts the elements according to the array. + * @param {String[]} order order of the items + */ + sort: function sort(order) { + var items = {}, + rootEl = this.el; + this.toArray().forEach(function (id, i) { + var el = rootEl.children[i]; + + if (closest(el, this.options.draggable, rootEl, false)) { + items[id] = el; + } + }, this); + order.forEach(function (id) { + if (items[id]) { + rootEl.removeChild(items[id]); + rootEl.appendChild(items[id]); + } + }); + }, + + /** + * Save the current sorting + */ + save: function save() { + var store = this.options.store; + store && store.set && store.set(this); + }, + + /** + * For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree. + * @param {HTMLElement} el + * @param {String} [selector] default: `options.draggable` + * @returns {HTMLElement|null} + */ + closest: function closest$1(el, selector) { + return closest(el, selector || this.options.draggable, this.el, false); + }, + + /** + * Set/get option + * @param {string} name + * @param {*} [value] + * @returns {*} + */ + option: function option(name, value) { + var options = this.options; + + if (value === void 0) { + return options[name]; + } else { + var modifiedValue = PluginManager.modifyOption(this, name, value); + + if (typeof modifiedValue !== 'undefined') { + options[name] = modifiedValue; + } else { + options[name] = value; + } + + if (name === 'group') { + _prepareGroup(options); + } + } + }, + + /** + * Destroy + */ + destroy: function destroy() { + pluginEvent('destroy', this); + var el = this.el; + el[expando] = null; + off(el, 'mousedown', this._onTapStart); + off(el, 'touchstart', this._onTapStart); + off(el, 'pointerdown', this._onTapStart); + + if (this.nativeDraggable) { + off(el, 'dragover', this); + off(el, 'dragenter', this); + } // Remove draggable attributes + + + Array.prototype.forEach.call(el.querySelectorAll('[draggable]'), function (el) { + el.removeAttribute('draggable'); + }); + + this._onDrop(); + + this._disableDelayedDragEvents(); + + sortables.splice(sortables.indexOf(this.el), 1); + this.el = el = null; + }, + _hideClone: function _hideClone() { + if (!cloneHidden) { + pluginEvent('hideClone', this); + if (Sortable.eventCanceled) return; + css(cloneEl, 'display', 'none'); + + if (this.options.removeCloneOnHide && cloneEl.parentNode) { + cloneEl.parentNode.removeChild(cloneEl); + } + + cloneHidden = true; + } + }, + _showClone: function _showClone(putSortable) { + if (putSortable.lastPutMode !== 'clone') { + this._hideClone(); + + return; + } + + if (cloneHidden) { + pluginEvent('showClone', this); + if (Sortable.eventCanceled) return; // show clone at dragEl or original position + + if (rootEl.contains(dragEl) && !this.options.group.revertClone) { + rootEl.insertBefore(cloneEl, dragEl); + } else if (nextEl) { + rootEl.insertBefore(cloneEl, nextEl); + } else { + rootEl.appendChild(cloneEl); + } + + if (this.options.group.revertClone) { + this.animate(dragEl, cloneEl); + } + + css(cloneEl, 'display', ''); + cloneHidden = false; + } + } +}; + +function _globalDragOver( +/**Event*/ +evt) { + if (evt.dataTransfer) { + evt.dataTransfer.dropEffect = 'move'; + } + + evt.cancelable && evt.preventDefault(); +} + +function _onMove(fromEl, toEl, dragEl, dragRect, targetEl, targetRect, originalEvent, willInsertAfter) { + var evt, + sortable = fromEl[expando], + onMoveFn = sortable.options.onMove, + retVal; // Support for new CustomEvent feature + + if (window.CustomEvent && !IE11OrLess && !Edge) { + evt = new CustomEvent('move', { + bubbles: true, + cancelable: true + }); + } else { + evt = document.createEvent('Event'); + evt.initEvent('move', true, true); + } + + evt.to = toEl; + evt.from = fromEl; + evt.dragged = dragEl; + evt.draggedRect = dragRect; + evt.related = targetEl || toEl; + evt.relatedRect = targetRect || getRect(toEl); + evt.willInsertAfter = willInsertAfter; + evt.originalEvent = originalEvent; + fromEl.dispatchEvent(evt); + + if (onMoveFn) { + retVal = onMoveFn.call(sortable, evt, originalEvent); + } + + return retVal; +} + +function _disableDraggable(el) { + el.draggable = false; +} + +function _unsilent() { + _silent = false; +} + +function _ghostIsLast(evt, vertical, sortable) { + var rect = getRect(lastChild(sortable.el, sortable.options.draggable)); + var spacer = 10; + return vertical ? evt.clientX > rect.right + spacer || evt.clientX <= rect.right && evt.clientY > rect.bottom && evt.clientX >= rect.left : evt.clientX > rect.right && evt.clientY > rect.top || evt.clientX <= rect.right && evt.clientY > rect.bottom + spacer; +} + +function _getSwapDirection(evt, target, targetRect, vertical, swapThreshold, invertedSwapThreshold, invertSwap, isLastTarget) { + var mouseOnAxis = vertical ? evt.clientY : evt.clientX, + targetLength = vertical ? targetRect.height : targetRect.width, + targetS1 = vertical ? targetRect.top : targetRect.left, + targetS2 = vertical ? targetRect.bottom : targetRect.right, + invert = false; + + if (!invertSwap) { + // Never invert or create dragEl shadow when target movemenet causes mouse to move past the end of regular swapThreshold + if (isLastTarget && targetMoveDistance < targetLength * swapThreshold) { + // multiplied only by swapThreshold because mouse will already be inside target by (1 - threshold) * targetLength / 2 + // check if past first invert threshold on side opposite of lastDirection + if (!pastFirstInvertThresh && (lastDirection === 1 ? mouseOnAxis > targetS1 + targetLength * invertedSwapThreshold / 2 : mouseOnAxis < targetS2 - targetLength * invertedSwapThreshold / 2)) { + // past first invert threshold, do not restrict inverted threshold to dragEl shadow + pastFirstInvertThresh = true; + } + + if (!pastFirstInvertThresh) { + // dragEl shadow (target move distance shadow) + if (lastDirection === 1 ? mouseOnAxis < targetS1 + targetMoveDistance // over dragEl shadow + : mouseOnAxis > targetS2 - targetMoveDistance) { + return -lastDirection; + } + } else { + invert = true; + } + } else { + // Regular + if (mouseOnAxis > targetS1 + targetLength * (1 - swapThreshold) / 2 && mouseOnAxis < targetS2 - targetLength * (1 - swapThreshold) / 2) { + return _getInsertDirection(target); + } + } + } + + invert = invert || invertSwap; + + if (invert) { + // Invert of regular + if (mouseOnAxis < targetS1 + targetLength * invertedSwapThreshold / 2 || mouseOnAxis > targetS2 - targetLength * invertedSwapThreshold / 2) { + return mouseOnAxis > targetS1 + targetLength / 2 ? 1 : -1; + } + } + + return 0; +} +/** + * Gets the direction dragEl must be swapped relative to target in order to make it + * seem that dragEl has been "inserted" into that element's position + * @param {HTMLElement} target The target whose position dragEl is being inserted at + * @return {Number} Direction dragEl must be swapped + */ + + +function _getInsertDirection(target) { + if (index(dragEl) < index(target)) { + return 1; + } else { + return -1; + } +} +/** + * Generate id + * @param {HTMLElement} el + * @returns {String} + * @private + */ + + +function _generateId(el) { + var str = el.tagName + el.className + el.src + el.href + el.textContent, + i = str.length, + sum = 0; + + while (i--) { + sum += str.charCodeAt(i); + } + + return sum.toString(36); +} + +function _saveInputCheckedState(root) { + savedInputChecked.length = 0; + var inputs = root.getElementsByTagName('input'); + var idx = inputs.length; + + while (idx--) { + var el = inputs[idx]; + el.checked && savedInputChecked.push(el); + } +} + +function _nextTick(fn) { + return setTimeout(fn, 0); +} + +function _cancelNextTick(id) { + return clearTimeout(id); +} // Fixed #973: + + +if (documentExists) { + on(document, 'touchmove', function (evt) { + if ((Sortable.active || awaitingDragStarted) && evt.cancelable) { + evt.preventDefault(); + } + }); +} // Export utils + + +Sortable.utils = { + on: on, + off: off, + css: css, + find: find, + is: function is(el, selector) { + return !!closest(el, selector, el, false); + }, + extend: extend, + throttle: throttle, + closest: closest, + toggleClass: toggleClass, + clone: clone, + index: index, + nextTick: _nextTick, + cancelNextTick: _cancelNextTick, + detectDirection: _detectDirection, + getChild: getChild +}; +/** + * Get the Sortable instance of an element + * @param {HTMLElement} element The element + * @return {Sortable|undefined} The instance of Sortable + */ + +Sortable.get = function (element) { + return element[expando]; +}; +/** + * Mount a plugin to Sortable + * @param {...SortablePlugin|SortablePlugin[]} plugins Plugins being mounted + */ + + +Sortable.mount = function () { + for (var _len = arguments.length, plugins = new Array(_len), _key = 0; _key < _len; _key++) { + plugins[_key] = arguments[_key]; + } + + if (plugins[0].constructor === Array) plugins = plugins[0]; + plugins.forEach(function (plugin) { + if (!plugin.prototype || !plugin.prototype.constructor) { + throw "Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(plugin)); + } + + if (plugin.utils) Sortable.utils = _objectSpread({}, Sortable.utils, plugin.utils); + PluginManager.mount(plugin); + }); +}; +/** + * Create sortable instance + * @param {HTMLElement} el + * @param {Object} [options] + */ + + +Sortable.create = function (el, options) { + return new Sortable(el, options); +}; // Export + + +Sortable.version = version; + +var autoScrolls = [], + scrollEl, + scrollRootEl, + scrolling = false, + lastAutoScrollX, + lastAutoScrollY, + touchEvt$1, + pointerElemChangedInterval; + +function AutoScrollPlugin() { + function AutoScroll() { + this.defaults = { + scroll: true, + scrollSensitivity: 30, + scrollSpeed: 10, + bubbleScroll: true + }; // Bind all private methods + + for (var fn in this) { + if (fn.charAt(0) === '_' && typeof this[fn] === 'function') { + this[fn] = this[fn].bind(this); + } + } + } + + AutoScroll.prototype = { + dragStarted: function dragStarted(_ref) { + var originalEvent = _ref.originalEvent; + + if (this.sortable.nativeDraggable) { + on(document, 'dragover', this._handleAutoScroll); + } else { + if (this.options.supportPointer) { + on(document, 'pointermove', this._handleFallbackAutoScroll); + } else if (originalEvent.touches) { + on(document, 'touchmove', this._handleFallbackAutoScroll); + } else { + on(document, 'mousemove', this._handleFallbackAutoScroll); + } + } + }, + dragOverCompleted: function dragOverCompleted(_ref2) { + var originalEvent = _ref2.originalEvent; + + // For when bubbling is canceled and using fallback (fallback 'touchmove' always reached) + if (!this.options.dragOverBubble && !originalEvent.rootEl) { + this._handleAutoScroll(originalEvent); + } + }, + drop: function drop() { + if (this.sortable.nativeDraggable) { + off(document, 'dragover', this._handleAutoScroll); + } else { + off(document, 'pointermove', this._handleFallbackAutoScroll); + off(document, 'touchmove', this._handleFallbackAutoScroll); + off(document, 'mousemove', this._handleFallbackAutoScroll); + } + + clearPointerElemChangedInterval(); + clearAutoScrolls(); + cancelThrottle(); + }, + nulling: function nulling() { + touchEvt$1 = scrollRootEl = scrollEl = scrolling = pointerElemChangedInterval = lastAutoScrollX = lastAutoScrollY = null; + autoScrolls.length = 0; + }, + _handleFallbackAutoScroll: function _handleFallbackAutoScroll(evt) { + this._handleAutoScroll(evt, true); + }, + _handleAutoScroll: function _handleAutoScroll(evt, fallback) { + var _this = this; + + var x = (evt.touches ? evt.touches[0] : evt).clientX, + y = (evt.touches ? evt.touches[0] : evt).clientY, + elem = document.elementFromPoint(x, y); + touchEvt$1 = evt; // IE does not seem to have native autoscroll, + // Edge's autoscroll seems too conditional, + // MACOS Safari does not have autoscroll, + // Firefox and Chrome are good + + if (fallback || Edge || IE11OrLess || Safari) { + autoScroll(evt, this.options, elem, fallback); // Listener for pointer element change + + var ogElemScroller = getParentAutoScrollElement(elem, true); + + if (scrolling && (!pointerElemChangedInterval || x !== lastAutoScrollX || y !== lastAutoScrollY)) { + pointerElemChangedInterval && clearPointerElemChangedInterval(); // Detect for pointer elem change, emulating native DnD behaviour + + pointerElemChangedInterval = setInterval(function () { + var newElem = getParentAutoScrollElement(document.elementFromPoint(x, y), true); + + if (newElem !== ogElemScroller) { + ogElemScroller = newElem; + clearAutoScrolls(); + } + + autoScroll(evt, _this.options, newElem, fallback); + }, 10); + lastAutoScrollX = x; + lastAutoScrollY = y; + } + } else { + // if DnD is enabled (and browser has good autoscrolling), first autoscroll will already scroll, so get parent autoscroll of first autoscroll + if (!this.options.bubbleScroll || getParentAutoScrollElement(elem, true) === getWindowScrollingElement()) { + clearAutoScrolls(); + return; + } + + autoScroll(evt, this.options, getParentAutoScrollElement(elem, false), false); + } + } + }; + return _extends(AutoScroll, { + pluginName: 'scroll', + initializeByDefault: true + }); +} + +function clearAutoScrolls() { + autoScrolls.forEach(function (autoScroll) { + clearInterval(autoScroll.pid); + }); + autoScrolls = []; +} + +function clearPointerElemChangedInterval() { + clearInterval(pointerElemChangedInterval); +} + +var autoScroll = throttle(function (evt, options, rootEl, isFallback) { + // Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=505521 + if (!options.scroll) return; + var x = (evt.touches ? evt.touches[0] : evt).clientX, + y = (evt.touches ? evt.touches[0] : evt).clientY, + sens = options.scrollSensitivity, + speed = options.scrollSpeed, + winScroller = getWindowScrollingElement(); + var scrollThisInstance = false, + scrollCustomFn; // New scroll root, set scrollEl + + if (scrollRootEl !== rootEl) { + scrollRootEl = rootEl; + clearAutoScrolls(); + scrollEl = options.scroll; + scrollCustomFn = options.scrollFn; + + if (scrollEl === true) { + scrollEl = getParentAutoScrollElement(rootEl, true); + } + } + + var layersOut = 0; + var currentParent = scrollEl; + + do { + var el = currentParent, + rect = getRect(el), + top = rect.top, + bottom = rect.bottom, + left = rect.left, + right = rect.right, + width = rect.width, + height = rect.height, + canScrollX = void 0, + canScrollY = void 0, + scrollWidth = el.scrollWidth, + scrollHeight = el.scrollHeight, + elCSS = css(el), + scrollPosX = el.scrollLeft, + scrollPosY = el.scrollTop; + + if (el === winScroller) { + canScrollX = width < scrollWidth && (elCSS.overflowX === 'auto' || elCSS.overflowX === 'scroll' || elCSS.overflowX === 'visible'); + canScrollY = height < scrollHeight && (elCSS.overflowY === 'auto' || elCSS.overflowY === 'scroll' || elCSS.overflowY === 'visible'); + } else { + canScrollX = width < scrollWidth && (elCSS.overflowX === 'auto' || elCSS.overflowX === 'scroll'); + canScrollY = height < scrollHeight && (elCSS.overflowY === 'auto' || elCSS.overflowY === 'scroll'); + } + + var vx = canScrollX && (Math.abs(right - x) <= sens && scrollPosX + width < scrollWidth) - (Math.abs(left - x) <= sens && !!scrollPosX); + var vy = canScrollY && (Math.abs(bottom - y) <= sens && scrollPosY + height < scrollHeight) - (Math.abs(top - y) <= sens && !!scrollPosY); + + if (!autoScrolls[layersOut]) { + for (var i = 0; i <= layersOut; i++) { + if (!autoScrolls[i]) { + autoScrolls[i] = {}; + } + } + } + + if (autoScrolls[layersOut].vx != vx || autoScrolls[layersOut].vy != vy || autoScrolls[layersOut].el !== el) { + autoScrolls[layersOut].el = el; + autoScrolls[layersOut].vx = vx; + autoScrolls[layersOut].vy = vy; + clearInterval(autoScrolls[layersOut].pid); + + if (vx != 0 || vy != 0) { + scrollThisInstance = true; + /* jshint loopfunc:true */ + + autoScrolls[layersOut].pid = setInterval(function () { + // emulate drag over during autoscroll (fallback), emulating native DnD behaviour + if (isFallback && this.layer === 0) { + Sortable.active._onTouchMove(touchEvt$1); // To move ghost if it is positioned absolutely + + } + + var scrollOffsetY = autoScrolls[this.layer].vy ? autoScrolls[this.layer].vy * speed : 0; + var scrollOffsetX = autoScrolls[this.layer].vx ? autoScrolls[this.layer].vx * speed : 0; + + if (typeof scrollCustomFn === 'function') { + if (scrollCustomFn.call(Sortable.dragged.parentNode[expando], scrollOffsetX, scrollOffsetY, evt, touchEvt$1, autoScrolls[this.layer].el) !== 'continue') { + return; + } + } + + scrollBy(autoScrolls[this.layer].el, scrollOffsetX, scrollOffsetY); + }.bind({ + layer: layersOut + }), 24); + } + } + + layersOut++; + } while (options.bubbleScroll && currentParent !== winScroller && (currentParent = getParentAutoScrollElement(currentParent, false))); + + scrolling = scrollThisInstance; // in case another function catches scrolling as false in between when it is not +}, 30); + +var drop = function drop(_ref) { + var originalEvent = _ref.originalEvent, + putSortable = _ref.putSortable, + dragEl = _ref.dragEl, + activeSortable = _ref.activeSortable, + dispatchSortableEvent = _ref.dispatchSortableEvent, + hideGhostForTarget = _ref.hideGhostForTarget, + unhideGhostForTarget = _ref.unhideGhostForTarget; + if (!originalEvent) return; + var toSortable = putSortable || activeSortable; + hideGhostForTarget(); + var touch = originalEvent.changedTouches && originalEvent.changedTouches.length ? originalEvent.changedTouches[0] : originalEvent; + var target = document.elementFromPoint(touch.clientX, touch.clientY); + unhideGhostForTarget(); + + if (toSortable && !toSortable.el.contains(target)) { + dispatchSortableEvent('spill'); + this.onSpill({ + dragEl: dragEl, + putSortable: putSortable + }); + } +}; + +function Revert() {} + +Revert.prototype = { + startIndex: null, + dragStart: function dragStart(_ref2) { + var oldDraggableIndex = _ref2.oldDraggableIndex; + this.startIndex = oldDraggableIndex; + }, + onSpill: function onSpill(_ref3) { + var dragEl = _ref3.dragEl, + putSortable = _ref3.putSortable; + this.sortable.captureAnimationState(); + + if (putSortable) { + putSortable.captureAnimationState(); + } + + var nextSibling = getChild(this.sortable.el, this.startIndex, this.options); + + if (nextSibling) { + this.sortable.el.insertBefore(dragEl, nextSibling); + } else { + this.sortable.el.appendChild(dragEl); + } + + this.sortable.animateAll(); + + if (putSortable) { + putSortable.animateAll(); + } + }, + drop: drop +}; + +_extends(Revert, { + pluginName: 'revertOnSpill' +}); + +function Remove() {} + +Remove.prototype = { + onSpill: function onSpill(_ref4) { + var dragEl = _ref4.dragEl, + putSortable = _ref4.putSortable; + var parentSortable = putSortable || this.sortable; + parentSortable.captureAnimationState(); + dragEl.parentNode && dragEl.parentNode.removeChild(dragEl); + parentSortable.animateAll(); + }, + drop: drop +}; + +_extends(Remove, { + pluginName: 'removeOnSpill' +}); + +var OnSpill = [Remove, Revert]; + +var lastSwapEl; + +function SwapPlugin() { + function Swap() { + this.defaults = { + swapClass: 'sortable-swap-highlight' + }; + } + + Swap.prototype = { + dragStart: function dragStart(_ref) { + var dragEl = _ref.dragEl; + lastSwapEl = dragEl; + }, + dragOverValid: function dragOverValid(_ref2) { + var completed = _ref2.completed, + target = _ref2.target, + onMove = _ref2.onMove, + activeSortable = _ref2.activeSortable, + changed = _ref2.changed, + cancel = _ref2.cancel; + if (!activeSortable.options.swap) return; + var el = this.sortable.el, + options = this.options; + + if (target && target !== el) { + var prevSwapEl = lastSwapEl; + + if (onMove(target) !== false) { + toggleClass(target, options.swapClass, true); + lastSwapEl = target; + } else { + lastSwapEl = null; + } + + if (prevSwapEl && prevSwapEl !== lastSwapEl) { + toggleClass(prevSwapEl, options.swapClass, false); + } + } + + changed(); + completed(true); + cancel(); + }, + drop: function drop(_ref3) { + var activeSortable = _ref3.activeSortable, + putSortable = _ref3.putSortable, + dragEl = _ref3.dragEl; + var toSortable = putSortable || this.sortable; + var options = this.options; + lastSwapEl && toggleClass(lastSwapEl, options.swapClass, false); + + if (lastSwapEl && (options.swap || putSortable && putSortable.options.swap)) { + if (dragEl !== lastSwapEl) { + toSortable.captureAnimationState(); + if (toSortable !== activeSortable) activeSortable.captureAnimationState(); + swapNodes(dragEl, lastSwapEl); + toSortable.animateAll(); + if (toSortable !== activeSortable) activeSortable.animateAll(); + } + } + }, + nulling: function nulling() { + lastSwapEl = null; + } + }; + return _extends(Swap, { + pluginName: 'swap', + eventProperties: function eventProperties() { + return { + swapItem: lastSwapEl + }; + } + }); +} + +function swapNodes(n1, n2) { + var p1 = n1.parentNode, + p2 = n2.parentNode, + i1, + i2; + if (!p1 || !p2 || p1.isEqualNode(n2) || p2.isEqualNode(n1)) return; + i1 = index(n1); + i2 = index(n2); + + if (p1.isEqualNode(p2) && i1 < i2) { + i2++; + } + + p1.insertBefore(n2, p1.children[i1]); + p2.insertBefore(n1, p2.children[i2]); +} + +var multiDragElements = [], + multiDragClones = [], + lastMultiDragSelect, + // for selection with modifier key down (SHIFT) +multiDragSortable, + initialFolding = false, + // Initial multi-drag fold when drag started +folding = false, + // Folding any other time +dragStarted = false, + dragEl$1, + clonesFromRect, + clonesHidden; + +function MultiDragPlugin() { + function MultiDrag(sortable) { + // Bind all private methods + for (var fn in this) { + if (fn.charAt(0) === '_' && typeof this[fn] === 'function') { + this[fn] = this[fn].bind(this); + } + } + + if (sortable.options.supportPointer) { + on(document, 'pointerup', this._deselectMultiDrag); + } else { + on(document, 'mouseup', this._deselectMultiDrag); + on(document, 'touchend', this._deselectMultiDrag); + } + + on(document, 'keydown', this._checkKeyDown); + on(document, 'keyup', this._checkKeyUp); + this.defaults = { + selectedClass: 'sortable-selected', + multiDragKey: null, + setData: function setData(dataTransfer, dragEl) { + var data = ''; + + if (multiDragElements.length && multiDragSortable === sortable) { + multiDragElements.forEach(function (multiDragElement, i) { + data += (!i ? '' : ', ') + multiDragElement.textContent; + }); + } else { + data = dragEl.textContent; + } + + dataTransfer.setData('Text', data); + } + }; + } + + MultiDrag.prototype = { + multiDragKeyDown: false, + isMultiDrag: false, + delayStartGlobal: function delayStartGlobal(_ref) { + var dragged = _ref.dragEl; + dragEl$1 = dragged; + }, + delayEnded: function delayEnded() { + this.isMultiDrag = ~multiDragElements.indexOf(dragEl$1); + }, + setupClone: function setupClone(_ref2) { + var sortable = _ref2.sortable, + cancel = _ref2.cancel; + if (!this.isMultiDrag) return; + + for (var i = 0; i < multiDragElements.length; i++) { + multiDragClones.push(clone(multiDragElements[i])); + multiDragClones[i].sortableIndex = multiDragElements[i].sortableIndex; + multiDragClones[i].draggable = false; + multiDragClones[i].style['will-change'] = ''; + toggleClass(multiDragClones[i], this.options.selectedClass, false); + multiDragElements[i] === dragEl$1 && toggleClass(multiDragClones[i], this.options.chosenClass, false); + } + + sortable._hideClone(); + + cancel(); + }, + clone: function clone(_ref3) { + var sortable = _ref3.sortable, + rootEl = _ref3.rootEl, + dispatchSortableEvent = _ref3.dispatchSortableEvent, + cancel = _ref3.cancel; + if (!this.isMultiDrag) return; + + if (!this.options.removeCloneOnHide) { + if (multiDragElements.length && multiDragSortable === sortable) { + insertMultiDragClones(true, rootEl); + dispatchSortableEvent('clone'); + cancel(); + } + } + }, + showClone: function showClone(_ref4) { + var cloneNowShown = _ref4.cloneNowShown, + rootEl = _ref4.rootEl, + cancel = _ref4.cancel; + if (!this.isMultiDrag) return; + insertMultiDragClones(false, rootEl); + multiDragClones.forEach(function (clone) { + css(clone, 'display', ''); + }); + cloneNowShown(); + clonesHidden = false; + cancel(); + }, + hideClone: function hideClone(_ref5) { + var _this = this; + + var sortable = _ref5.sortable, + cloneNowHidden = _ref5.cloneNowHidden, + cancel = _ref5.cancel; + if (!this.isMultiDrag) return; + multiDragClones.forEach(function (clone) { + css(clone, 'display', 'none'); + + if (_this.options.removeCloneOnHide && clone.parentNode) { + clone.parentNode.removeChild(clone); + } + }); + cloneNowHidden(); + clonesHidden = true; + cancel(); + }, + dragStartGlobal: function dragStartGlobal(_ref6) { + var sortable = _ref6.sortable; + + if (!this.isMultiDrag && multiDragSortable) { + multiDragSortable.multiDrag._deselectMultiDrag(); + } + + multiDragElements.forEach(function (multiDragElement) { + multiDragElement.sortableIndex = index(multiDragElement); + }); // Sort multi-drag elements + + multiDragElements = multiDragElements.sort(function (a, b) { + return a.sortableIndex - b.sortableIndex; + }); + dragStarted = true; + }, + dragStarted: function dragStarted(_ref7) { + var _this2 = this; + + var sortable = _ref7.sortable; + if (!this.isMultiDrag) return; + + if (this.options.sort) { + // Capture rects, + // hide multi drag elements (by positioning them absolute), + // set multi drag elements rects to dragRect, + // show multi drag elements, + // animate to rects, + // unset rects & remove from DOM + sortable.captureAnimationState(); + + if (this.options.animation) { + multiDragElements.forEach(function (multiDragElement) { + if (multiDragElement === dragEl$1) return; + css(multiDragElement, 'position', 'absolute'); + }); + var dragRect = getRect(dragEl$1, false, true, true); + multiDragElements.forEach(function (multiDragElement) { + if (multiDragElement === dragEl$1) return; + setRect(multiDragElement, dragRect); + }); + folding = true; + initialFolding = true; + } + } + + sortable.animateAll(function () { + folding = false; + initialFolding = false; + + if (_this2.options.animation) { + multiDragElements.forEach(function (multiDragElement) { + unsetRect(multiDragElement); + }); + } // Remove all auxiliary multidrag items from el, if sorting enabled + + + if (_this2.options.sort) { + removeMultiDragElements(); + } + }); + }, + dragOver: function dragOver(_ref8) { + var target = _ref8.target, + completed = _ref8.completed, + cancel = _ref8.cancel; + + if (folding && ~multiDragElements.indexOf(target)) { + completed(false); + cancel(); + } + }, + revert: function revert(_ref9) { + var fromSortable = _ref9.fromSortable, + rootEl = _ref9.rootEl, + sortable = _ref9.sortable, + dragRect = _ref9.dragRect; + + if (multiDragElements.length > 1) { + // Setup unfold animation + multiDragElements.forEach(function (multiDragElement) { + sortable.addAnimationState({ + target: multiDragElement, + rect: folding ? getRect(multiDragElement) : dragRect + }); + unsetRect(multiDragElement); + multiDragElement.fromRect = dragRect; + fromSortable.removeAnimationState(multiDragElement); + }); + folding = false; + insertMultiDragElements(!this.options.removeCloneOnHide, rootEl); + } + }, + dragOverCompleted: function dragOverCompleted(_ref10) { + var sortable = _ref10.sortable, + isOwner = _ref10.isOwner, + insertion = _ref10.insertion, + activeSortable = _ref10.activeSortable, + parentEl = _ref10.parentEl, + putSortable = _ref10.putSortable; + var options = this.options; + + if (insertion) { + // Clones must be hidden before folding animation to capture dragRectAbsolute properly + if (isOwner) { + activeSortable._hideClone(); + } + + initialFolding = false; // If leaving sort:false root, or already folding - Fold to new location + + if (options.animation && multiDragElements.length > 1 && (folding || !isOwner && !activeSortable.options.sort && !putSortable)) { + // Fold: Set all multi drag elements's rects to dragEl's rect when multi-drag elements are invisible + var dragRectAbsolute = getRect(dragEl$1, false, true, true); + multiDragElements.forEach(function (multiDragElement) { + if (multiDragElement === dragEl$1) return; + setRect(multiDragElement, dragRectAbsolute); // Move element(s) to end of parentEl so that it does not interfere with multi-drag clones insertion if they are inserted + // while folding, and so that we can capture them again because old sortable will no longer be fromSortable + + parentEl.appendChild(multiDragElement); + }); + folding = true; + } // Clones must be shown (and check to remove multi drags) after folding when interfering multiDragElements are moved out + + + if (!isOwner) { + // Only remove if not folding (folding will remove them anyways) + if (!folding) { + removeMultiDragElements(); + } + + if (multiDragElements.length > 1) { + var clonesHiddenBefore = clonesHidden; + + activeSortable._showClone(sortable); // Unfold animation for clones if showing from hidden + + + if (activeSortable.options.animation && !clonesHidden && clonesHiddenBefore) { + multiDragClones.forEach(function (clone) { + activeSortable.addAnimationState({ + target: clone, + rect: clonesFromRect + }); + clone.fromRect = clonesFromRect; + clone.thisAnimationDuration = null; + }); + } + } else { + activeSortable._showClone(sortable); + } + } + } + }, + dragOverAnimationCapture: function dragOverAnimationCapture(_ref11) { + var dragRect = _ref11.dragRect, + isOwner = _ref11.isOwner, + activeSortable = _ref11.activeSortable; + multiDragElements.forEach(function (multiDragElement) { + multiDragElement.thisAnimationDuration = null; + }); + + if (activeSortable.options.animation && !isOwner && activeSortable.multiDrag.isMultiDrag) { + clonesFromRect = _extends({}, dragRect); + var dragMatrix = matrix(dragEl$1, true); + clonesFromRect.top -= dragMatrix.f; + clonesFromRect.left -= dragMatrix.e; + } + }, + dragOverAnimationComplete: function dragOverAnimationComplete() { + if (folding) { + folding = false; + removeMultiDragElements(); + } + }, + drop: function drop(_ref12) { + var evt = _ref12.originalEvent, + rootEl = _ref12.rootEl, + parentEl = _ref12.parentEl, + sortable = _ref12.sortable, + dispatchSortableEvent = _ref12.dispatchSortableEvent, + oldIndex = _ref12.oldIndex, + putSortable = _ref12.putSortable; + var toSortable = putSortable || this.sortable; + if (!evt) return; + var options = this.options, + children = parentEl.children; // Multi-drag selection + + if (!dragStarted) { + if (options.multiDragKey && !this.multiDragKeyDown) { + this._deselectMultiDrag(); + } + + toggleClass(dragEl$1, options.selectedClass, !~multiDragElements.indexOf(dragEl$1)); + + if (!~multiDragElements.indexOf(dragEl$1)) { + multiDragElements.push(dragEl$1); + dispatchEvent({ + sortable: sortable, + rootEl: rootEl, + name: 'select', + targetEl: dragEl$1, + originalEvt: evt + }); // Modifier activated, select from last to dragEl + + if (evt.shiftKey && lastMultiDragSelect && sortable.el.contains(lastMultiDragSelect)) { + var lastIndex = index(lastMultiDragSelect), + currentIndex = index(dragEl$1); + + if (~lastIndex && ~currentIndex && lastIndex !== currentIndex) { + // Must include lastMultiDragSelect (select it), in case modified selection from no selection + // (but previous selection existed) + var n, i; + + if (currentIndex > lastIndex) { + i = lastIndex; + n = currentIndex; + } else { + i = currentIndex; + n = lastIndex + 1; + } + + for (; i < n; i++) { + if (~multiDragElements.indexOf(children[i])) continue; + toggleClass(children[i], options.selectedClass, true); + multiDragElements.push(children[i]); + dispatchEvent({ + sortable: sortable, + rootEl: rootEl, + name: 'select', + targetEl: children[i], + originalEvt: evt + }); + } + } + } else { + lastMultiDragSelect = dragEl$1; + } + + multiDragSortable = toSortable; + } else { + multiDragElements.splice(multiDragElements.indexOf(dragEl$1), 1); + lastMultiDragSelect = null; + dispatchEvent({ + sortable: sortable, + rootEl: rootEl, + name: 'deselect', + targetEl: dragEl$1, + originalEvt: evt + }); + } + } // Multi-drag drop + + + if (dragStarted && this.isMultiDrag) { + // Do not "unfold" after around dragEl if reverted + if ((parentEl[expando].options.sort || parentEl !== rootEl) && multiDragElements.length > 1) { + var dragRect = getRect(dragEl$1), + multiDragIndex = index(dragEl$1, ':not(.' + this.options.selectedClass + ')'); + if (!initialFolding && options.animation) dragEl$1.thisAnimationDuration = null; + toSortable.captureAnimationState(); + + if (!initialFolding) { + if (options.animation) { + dragEl$1.fromRect = dragRect; + multiDragElements.forEach(function (multiDragElement) { + multiDragElement.thisAnimationDuration = null; + + if (multiDragElement !== dragEl$1) { + var rect = folding ? getRect(multiDragElement) : dragRect; + multiDragElement.fromRect = rect; // Prepare unfold animation + + toSortable.addAnimationState({ + target: multiDragElement, + rect: rect + }); + } + }); + } // Multi drag elements are not necessarily removed from the DOM on drop, so to reinsert + // properly they must all be removed + + + removeMultiDragElements(); + multiDragElements.forEach(function (multiDragElement) { + if (children[multiDragIndex]) { + parentEl.insertBefore(multiDragElement, children[multiDragIndex]); + } else { + parentEl.appendChild(multiDragElement); + } + + multiDragIndex++; + }); // If initial folding is done, the elements may have changed position because they are now + // unfolding around dragEl, even though dragEl may not have his index changed, so update event + // must be fired here as Sortable will not. + + if (oldIndex === index(dragEl$1)) { + var update = false; + multiDragElements.forEach(function (multiDragElement) { + if (multiDragElement.sortableIndex !== index(multiDragElement)) { + update = true; + return; + } + }); + + if (update) { + dispatchSortableEvent('update'); + } + } + } // Must be done after capturing individual rects (scroll bar) + + + multiDragElements.forEach(function (multiDragElement) { + unsetRect(multiDragElement); + }); + toSortable.animateAll(); + } + + multiDragSortable = toSortable; + } // Remove clones if necessary + + + if (rootEl === parentEl || putSortable && putSortable.lastPutMode !== 'clone') { + multiDragClones.forEach(function (clone) { + clone.parentNode && clone.parentNode.removeChild(clone); + }); + } + }, + nullingGlobal: function nullingGlobal() { + this.isMultiDrag = dragStarted = false; + multiDragClones.length = 0; + }, + destroyGlobal: function destroyGlobal() { + this._deselectMultiDrag(); + + off(document, 'pointerup', this._deselectMultiDrag); + off(document, 'mouseup', this._deselectMultiDrag); + off(document, 'touchend', this._deselectMultiDrag); + off(document, 'keydown', this._checkKeyDown); + off(document, 'keyup', this._checkKeyUp); + }, + _deselectMultiDrag: function _deselectMultiDrag(evt) { + if (typeof dragStarted !== "undefined" && dragStarted) return; // Only deselect if selection is in this sortable + + if (multiDragSortable !== this.sortable) return; // Only deselect if target is not item in this sortable + + if (evt && closest(evt.target, this.options.draggable, this.sortable.el, false)) return; // Only deselect if left click + + if (evt && evt.button !== 0) return; + + while (multiDragElements.length) { + var el = multiDragElements[0]; + toggleClass(el, this.options.selectedClass, false); + multiDragElements.shift(); + dispatchEvent({ + sortable: this.sortable, + rootEl: this.sortable.el, + name: 'deselect', + targetEl: el, + originalEvt: evt + }); + } + }, + _checkKeyDown: function _checkKeyDown(evt) { + if (evt.key === this.options.multiDragKey) { + this.multiDragKeyDown = true; + } + }, + _checkKeyUp: function _checkKeyUp(evt) { + if (evt.key === this.options.multiDragKey) { + this.multiDragKeyDown = false; + } + } + }; + return _extends(MultiDrag, { + // Static methods & properties + pluginName: 'multiDrag', + utils: { + /** + * Selects the provided multi-drag item + * @param {HTMLElement} el The element to be selected + */ + select: function select(el) { + var sortable = el.parentNode[expando]; + if (!sortable || !sortable.options.multiDrag || ~multiDragElements.indexOf(el)) return; + + if (multiDragSortable && multiDragSortable !== sortable) { + multiDragSortable.multiDrag._deselectMultiDrag(); + + multiDragSortable = sortable; + } + + toggleClass(el, sortable.options.selectedClass, true); + multiDragElements.push(el); + }, + + /** + * Deselects the provided multi-drag item + * @param {HTMLElement} el The element to be deselected + */ + deselect: function deselect(el) { + var sortable = el.parentNode[expando], + index = multiDragElements.indexOf(el); + if (!sortable || !sortable.options.multiDrag || !~index) return; + toggleClass(el, sortable.options.selectedClass, false); + multiDragElements.splice(index, 1); + } + }, + eventProperties: function eventProperties() { + var _this3 = this; + + var oldIndicies = [], + newIndicies = []; + multiDragElements.forEach(function (multiDragElement) { + oldIndicies.push({ + multiDragElement: multiDragElement, + index: multiDragElement.sortableIndex + }); // multiDragElements will already be sorted if folding + + var newIndex; + + if (folding && multiDragElement !== dragEl$1) { + newIndex = -1; + } else if (folding) { + newIndex = index(multiDragElement, ':not(.' + _this3.options.selectedClass + ')'); + } else { + newIndex = index(multiDragElement); + } + + newIndicies.push({ + multiDragElement: multiDragElement, + index: newIndex + }); + }); + return { + items: _toConsumableArray(multiDragElements), + clones: [].concat(multiDragClones), + oldIndicies: oldIndicies, + newIndicies: newIndicies + }; + }, + optionListeners: { + multiDragKey: function multiDragKey(key) { + key = key.toLowerCase(); + + if (key === 'ctrl') { + key = 'Control'; + } else if (key.length > 1) { + key = key.charAt(0).toUpperCase() + key.substr(1); + } + + return key; + } + } + }); +} + +function insertMultiDragElements(clonesInserted, rootEl) { + multiDragElements.forEach(function (multiDragElement, i) { + var target = rootEl.children[multiDragElement.sortableIndex + (clonesInserted ? Number(i) : 0)]; + + if (target) { + rootEl.insertBefore(multiDragElement, target); + } else { + rootEl.appendChild(multiDragElement); + } + }); +} +/** + * Insert multi-drag clones + * @param {[Boolean]} elementsInserted Whether the multi-drag elements are inserted + * @param {HTMLElement} rootEl + */ + + +function insertMultiDragClones(elementsInserted, rootEl) { + multiDragClones.forEach(function (clone, i) { + var target = rootEl.children[clone.sortableIndex + (elementsInserted ? Number(i) : 0)]; + + if (target) { + rootEl.insertBefore(clone, target); + } else { + rootEl.appendChild(clone); + } + }); +} + +function removeMultiDragElements() { + multiDragElements.forEach(function (multiDragElement) { + if (multiDragElement === dragEl$1) return; + multiDragElement.parentNode && multiDragElement.parentNode.removeChild(multiDragElement); + }); +} + +export default Sortable; +export { AutoScrollPlugin as AutoScroll, MultiDragPlugin as MultiDrag, OnSpill, Sortable, SwapPlugin as Swap }; diff --git a/public/assets/libs/Sortable/modular/sortable.esm.js b/public/assets/libs/Sortable/modular/sortable.esm.js new file mode 100644 index 0000000..f8a64b1 --- /dev/null +++ b/public/assets/libs/Sortable/modular/sortable.esm.js @@ -0,0 +1,3699 @@ +/**! + * Sortable 1.10.2 + * @author RubaXa + * @author owenm + * @license MIT + */ +function _typeof(obj) { + if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { + _typeof = function (obj) { + return typeof obj; + }; + } else { + _typeof = function (obj) { + return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; + }; + } + + return _typeof(obj); +} + +function _defineProperty(obj, key, value) { + if (key in obj) { + Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + } else { + obj[key] = value; + } + + return obj; +} + +function _extends() { + _extends = Object.assign || function (target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i]; + + for (var key in source) { + if (Object.prototype.hasOwnProperty.call(source, key)) { + target[key] = source[key]; + } + } + } + + return target; + }; + + return _extends.apply(this, arguments); +} + +function _objectSpread(target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i] != null ? arguments[i] : {}; + var ownKeys = Object.keys(source); + + if (typeof Object.getOwnPropertySymbols === 'function') { + ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { + return Object.getOwnPropertyDescriptor(source, sym).enumerable; + })); + } + + ownKeys.forEach(function (key) { + _defineProperty(target, key, source[key]); + }); + } + + return target; +} + +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + + for (i = 0; i < sourceKeys.length; i++) { + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + + return target; +} + +function _objectWithoutProperties(source, excluded) { + if (source == null) return {}; + + var target = _objectWithoutPropertiesLoose(source, excluded); + + var key, i; + + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + + for (i = 0; i < sourceSymbolKeys.length; i++) { + key = sourceSymbolKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + + return target; +} + +function _toConsumableArray(arr) { + return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); +} + +function _arrayWithoutHoles(arr) { + if (Array.isArray(arr)) { + for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; + + return arr2; + } +} + +function _iterableToArray(iter) { + if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); +} + +function _nonIterableSpread() { + throw new TypeError("Invalid attempt to spread non-iterable instance"); +} + +var version = "1.10.2"; + +function userAgent(pattern) { + if (typeof window !== 'undefined' && window.navigator) { + return !! + /*@__PURE__*/ + navigator.userAgent.match(pattern); + } +} + +var IE11OrLess = userAgent(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i); +var Edge = userAgent(/Edge/i); +var FireFox = userAgent(/firefox/i); +var Safari = userAgent(/safari/i) && !userAgent(/chrome/i) && !userAgent(/android/i); +var IOS = userAgent(/iP(ad|od|hone)/i); +var ChromeForAndroid = userAgent(/chrome/i) && userAgent(/android/i); + +var captureMode = { + capture: false, + passive: false +}; + +function on(el, event, fn) { + el.addEventListener(event, fn, !IE11OrLess && captureMode); +} + +function off(el, event, fn) { + el.removeEventListener(event, fn, !IE11OrLess && captureMode); +} + +function matches( +/**HTMLElement*/ +el, +/**String*/ +selector) { + if (!selector) return; + selector[0] === '>' && (selector = selector.substring(1)); + + if (el) { + try { + if (el.matches) { + return el.matches(selector); + } else if (el.msMatchesSelector) { + return el.msMatchesSelector(selector); + } else if (el.webkitMatchesSelector) { + return el.webkitMatchesSelector(selector); + } + } catch (_) { + return false; + } + } + + return false; +} + +function getParentOrHost(el) { + return el.host && el !== document && el.host.nodeType ? el.host : el.parentNode; +} + +function closest( +/**HTMLElement*/ +el, +/**String*/ +selector, +/**HTMLElement*/ +ctx, includeCTX) { + if (el) { + ctx = ctx || document; + + do { + if (selector != null && (selector[0] === '>' ? el.parentNode === ctx && matches(el, selector) : matches(el, selector)) || includeCTX && el === ctx) { + return el; + } + + if (el === ctx) break; + /* jshint boss:true */ + } while (el = getParentOrHost(el)); + } + + return null; +} + +var R_SPACE = /\s+/g; + +function toggleClass(el, name, state) { + if (el && name) { + if (el.classList) { + el.classList[state ? 'add' : 'remove'](name); + } else { + var className = (' ' + el.className + ' ').replace(R_SPACE, ' ').replace(' ' + name + ' ', ' '); + el.className = (className + (state ? ' ' + name : '')).replace(R_SPACE, ' '); + } + } +} + +function css(el, prop, val) { + var style = el && el.style; + + if (style) { + if (val === void 0) { + if (document.defaultView && document.defaultView.getComputedStyle) { + val = document.defaultView.getComputedStyle(el, ''); + } else if (el.currentStyle) { + val = el.currentStyle; + } + + return prop === void 0 ? val : val[prop]; + } else { + if (!(prop in style) && prop.indexOf('webkit') === -1) { + prop = '-webkit-' + prop; + } + + style[prop] = val + (typeof val === 'string' ? '' : 'px'); + } + } +} + +function matrix(el, selfOnly) { + var appliedTransforms = ''; + + if (typeof el === 'string') { + appliedTransforms = el; + } else { + do { + var transform = css(el, 'transform'); + + if (transform && transform !== 'none') { + appliedTransforms = transform + ' ' + appliedTransforms; + } + /* jshint boss:true */ + + } while (!selfOnly && (el = el.parentNode)); + } + + var matrixFn = window.DOMMatrix || window.WebKitCSSMatrix || window.CSSMatrix || window.MSCSSMatrix; + /*jshint -W056 */ + + return matrixFn && new matrixFn(appliedTransforms); +} + +function find(ctx, tagName, iterator) { + if (ctx) { + var list = ctx.getElementsByTagName(tagName), + i = 0, + n = list.length; + + if (iterator) { + for (; i < n; i++) { + iterator(list[i], i); + } + } + + return list; + } + + return []; +} + +function getWindowScrollingElement() { + var scrollingElement = document.scrollingElement; + + if (scrollingElement) { + return scrollingElement; + } else { + return document.documentElement; + } +} +/** + * Returns the "bounding client rect" of given element + * @param {HTMLElement} el The element whose boundingClientRect is wanted + * @param {[Boolean]} relativeToContainingBlock Whether the rect should be relative to the containing block of (including) the container + * @param {[Boolean]} relativeToNonStaticParent Whether the rect should be relative to the relative parent of (including) the contaienr + * @param {[Boolean]} undoScale Whether the container's scale() should be undone + * @param {[HTMLElement]} container The parent the element will be placed in + * @return {Object} The boundingClientRect of el, with specified adjustments + */ + + +function getRect(el, relativeToContainingBlock, relativeToNonStaticParent, undoScale, container) { + if (!el.getBoundingClientRect && el !== window) return; + var elRect, top, left, bottom, right, height, width; + + if (el !== window && el !== getWindowScrollingElement()) { + elRect = el.getBoundingClientRect(); + top = elRect.top; + left = elRect.left; + bottom = elRect.bottom; + right = elRect.right; + height = elRect.height; + width = elRect.width; + } else { + top = 0; + left = 0; + bottom = window.innerHeight; + right = window.innerWidth; + height = window.innerHeight; + width = window.innerWidth; + } + + if ((relativeToContainingBlock || relativeToNonStaticParent) && el !== window) { + // Adjust for translate() + container = container || el.parentNode; // solves #1123 (see: https://stackoverflow.com/a/37953806/6088312) + // Not needed on <= IE11 + + if (!IE11OrLess) { + do { + if (container && container.getBoundingClientRect && (css(container, 'transform') !== 'none' || relativeToNonStaticParent && css(container, 'position') !== 'static')) { + var containerRect = container.getBoundingClientRect(); // Set relative to edges of padding box of container + + top -= containerRect.top + parseInt(css(container, 'border-top-width')); + left -= containerRect.left + parseInt(css(container, 'border-left-width')); + bottom = top + elRect.height; + right = left + elRect.width; + break; + } + /* jshint boss:true */ + + } while (container = container.parentNode); + } + } + + if (undoScale && el !== window) { + // Adjust for scale() + var elMatrix = matrix(container || el), + scaleX = elMatrix && elMatrix.a, + scaleY = elMatrix && elMatrix.d; + + if (elMatrix) { + top /= scaleY; + left /= scaleX; + width /= scaleX; + height /= scaleY; + bottom = top + height; + right = left + width; + } + } + + return { + top: top, + left: left, + bottom: bottom, + right: right, + width: width, + height: height + }; +} +/** + * Checks if a side of an element is scrolled past a side of its parents + * @param {HTMLElement} el The element who's side being scrolled out of view is in question + * @param {String} elSide Side of the element in question ('top', 'left', 'right', 'bottom') + * @param {String} parentSide Side of the parent in question ('top', 'left', 'right', 'bottom') + * @return {HTMLElement} The parent scroll element that the el's side is scrolled past, or null if there is no such element + */ + + +function isScrolledPast(el, elSide, parentSide) { + var parent = getParentAutoScrollElement(el, true), + elSideVal = getRect(el)[elSide]; + /* jshint boss:true */ + + while (parent) { + var parentSideVal = getRect(parent)[parentSide], + visible = void 0; + + if (parentSide === 'top' || parentSide === 'left') { + visible = elSideVal >= parentSideVal; + } else { + visible = elSideVal <= parentSideVal; + } + + if (!visible) return parent; + if (parent === getWindowScrollingElement()) break; + parent = getParentAutoScrollElement(parent, false); + } + + return false; +} +/** + * Gets nth child of el, ignoring hidden children, sortable's elements (does not ignore clone if it's visible) + * and non-draggable elements + * @param {HTMLElement} el The parent element + * @param {Number} childNum The index of the child + * @param {Object} options Parent Sortable's options + * @return {HTMLElement} The child at index childNum, or null if not found + */ + + +function getChild(el, childNum, options) { + var currentChild = 0, + i = 0, + children = el.children; + + while (i < children.length) { + if (children[i].style.display !== 'none' && children[i] !== Sortable.ghost && children[i] !== Sortable.dragged && closest(children[i], options.draggable, el, false)) { + if (currentChild === childNum) { + return children[i]; + } + + currentChild++; + } + + i++; + } + + return null; +} +/** + * Gets the last child in the el, ignoring ghostEl or invisible elements (clones) + * @param {HTMLElement} el Parent element + * @param {selector} selector Any other elements that should be ignored + * @return {HTMLElement} The last child, ignoring ghostEl + */ + + +function lastChild(el, selector) { + var last = el.lastElementChild; + + while (last && (last === Sortable.ghost || css(last, 'display') === 'none' || selector && !matches(last, selector))) { + last = last.previousElementSibling; + } + + return last || null; +} +/** + * Returns the index of an element within its parent for a selected set of + * elements + * @param {HTMLElement} el + * @param {selector} selector + * @return {number} + */ + + +function index(el, selector) { + var index = 0; + + if (!el || !el.parentNode) { + return -1; + } + /* jshint boss:true */ + + + while (el = el.previousElementSibling) { + if (el.nodeName.toUpperCase() !== 'TEMPLATE' && el !== Sortable.clone && (!selector || matches(el, selector))) { + index++; + } + } + + return index; +} +/** + * Returns the scroll offset of the given element, added with all the scroll offsets of parent elements. + * The value is returned in real pixels. + * @param {HTMLElement} el + * @return {Array} Offsets in the format of [left, top] + */ + + +function getRelativeScrollOffset(el) { + var offsetLeft = 0, + offsetTop = 0, + winScroller = getWindowScrollingElement(); + + if (el) { + do { + var elMatrix = matrix(el), + scaleX = elMatrix.a, + scaleY = elMatrix.d; + offsetLeft += el.scrollLeft * scaleX; + offsetTop += el.scrollTop * scaleY; + } while (el !== winScroller && (el = el.parentNode)); + } + + return [offsetLeft, offsetTop]; +} +/** + * Returns the index of the object within the given array + * @param {Array} arr Array that may or may not hold the object + * @param {Object} obj An object that has a key-value pair unique to and identical to a key-value pair in the object you want to find + * @return {Number} The index of the object in the array, or -1 + */ + + +function indexOfObject(arr, obj) { + for (var i in arr) { + if (!arr.hasOwnProperty(i)) continue; + + for (var key in obj) { + if (obj.hasOwnProperty(key) && obj[key] === arr[i][key]) return Number(i); + } + } + + return -1; +} + +function getParentAutoScrollElement(el, includeSelf) { + // skip to window + if (!el || !el.getBoundingClientRect) return getWindowScrollingElement(); + var elem = el; + var gotSelf = false; + + do { + // we don't need to get elem css if it isn't even overflowing in the first place (performance) + if (elem.clientWidth < elem.scrollWidth || elem.clientHeight < elem.scrollHeight) { + var elemCSS = css(elem); + + if (elem.clientWidth < elem.scrollWidth && (elemCSS.overflowX == 'auto' || elemCSS.overflowX == 'scroll') || elem.clientHeight < elem.scrollHeight && (elemCSS.overflowY == 'auto' || elemCSS.overflowY == 'scroll')) { + if (!elem.getBoundingClientRect || elem === document.body) return getWindowScrollingElement(); + if (gotSelf || includeSelf) return elem; + gotSelf = true; + } + } + /* jshint boss:true */ + + } while (elem = elem.parentNode); + + return getWindowScrollingElement(); +} + +function extend(dst, src) { + if (dst && src) { + for (var key in src) { + if (src.hasOwnProperty(key)) { + dst[key] = src[key]; + } + } + } + + return dst; +} + +function isRectEqual(rect1, rect2) { + return Math.round(rect1.top) === Math.round(rect2.top) && Math.round(rect1.left) === Math.round(rect2.left) && Math.round(rect1.height) === Math.round(rect2.height) && Math.round(rect1.width) === Math.round(rect2.width); +} + +var _throttleTimeout; + +function throttle(callback, ms) { + return function () { + if (!_throttleTimeout) { + var args = arguments, + _this = this; + + if (args.length === 1) { + callback.call(_this, args[0]); + } else { + callback.apply(_this, args); + } + + _throttleTimeout = setTimeout(function () { + _throttleTimeout = void 0; + }, ms); + } + }; +} + +function cancelThrottle() { + clearTimeout(_throttleTimeout); + _throttleTimeout = void 0; +} + +function scrollBy(el, x, y) { + el.scrollLeft += x; + el.scrollTop += y; +} + +function clone(el) { + var Polymer = window.Polymer; + var $ = window.jQuery || window.Zepto; + + if (Polymer && Polymer.dom) { + return Polymer.dom(el).cloneNode(true); + } else if ($) { + return $(el).clone(true)[0]; + } else { + return el.cloneNode(true); + } +} + +function setRect(el, rect) { + css(el, 'position', 'absolute'); + css(el, 'top', rect.top); + css(el, 'left', rect.left); + css(el, 'width', rect.width); + css(el, 'height', rect.height); +} + +function unsetRect(el) { + css(el, 'position', ''); + css(el, 'top', ''); + css(el, 'left', ''); + css(el, 'width', ''); + css(el, 'height', ''); +} + +var expando = 'Sortable' + new Date().getTime(); + +function AnimationStateManager() { + var animationStates = [], + animationCallbackId; + return { + captureAnimationState: function captureAnimationState() { + animationStates = []; + if (!this.options.animation) return; + var children = [].slice.call(this.el.children); + children.forEach(function (child) { + if (css(child, 'display') === 'none' || child === Sortable.ghost) return; + animationStates.push({ + target: child, + rect: getRect(child) + }); + + var fromRect = _objectSpread({}, animationStates[animationStates.length - 1].rect); // If animating: compensate for current animation + + + if (child.thisAnimationDuration) { + var childMatrix = matrix(child, true); + + if (childMatrix) { + fromRect.top -= childMatrix.f; + fromRect.left -= childMatrix.e; + } + } + + child.fromRect = fromRect; + }); + }, + addAnimationState: function addAnimationState(state) { + animationStates.push(state); + }, + removeAnimationState: function removeAnimationState(target) { + animationStates.splice(indexOfObject(animationStates, { + target: target + }), 1); + }, + animateAll: function animateAll(callback) { + var _this = this; + + if (!this.options.animation) { + clearTimeout(animationCallbackId); + if (typeof callback === 'function') callback(); + return; + } + + var animating = false, + animationTime = 0; + animationStates.forEach(function (state) { + var time = 0, + target = state.target, + fromRect = target.fromRect, + toRect = getRect(target), + prevFromRect = target.prevFromRect, + prevToRect = target.prevToRect, + animatingRect = state.rect, + targetMatrix = matrix(target, true); + + if (targetMatrix) { + // Compensate for current animation + toRect.top -= targetMatrix.f; + toRect.left -= targetMatrix.e; + } + + target.toRect = toRect; + + if (target.thisAnimationDuration) { + // Could also check if animatingRect is between fromRect and toRect + if (isRectEqual(prevFromRect, toRect) && !isRectEqual(fromRect, toRect) && // Make sure animatingRect is on line between toRect & fromRect + (animatingRect.top - toRect.top) / (animatingRect.left - toRect.left) === (fromRect.top - toRect.top) / (fromRect.left - toRect.left)) { + // If returning to same place as started from animation and on same axis + time = calculateRealTime(animatingRect, prevFromRect, prevToRect, _this.options); + } + } // if fromRect != toRect: animate + + + if (!isRectEqual(toRect, fromRect)) { + target.prevFromRect = fromRect; + target.prevToRect = toRect; + + if (!time) { + time = _this.options.animation; + } + + _this.animate(target, animatingRect, toRect, time); + } + + if (time) { + animating = true; + animationTime = Math.max(animationTime, time); + clearTimeout(target.animationResetTimer); + target.animationResetTimer = setTimeout(function () { + target.animationTime = 0; + target.prevFromRect = null; + target.fromRect = null; + target.prevToRect = null; + target.thisAnimationDuration = null; + }, time); + target.thisAnimationDuration = time; + } + }); + clearTimeout(animationCallbackId); + + if (!animating) { + if (typeof callback === 'function') callback(); + } else { + animationCallbackId = setTimeout(function () { + if (typeof callback === 'function') callback(); + }, animationTime); + } + + animationStates = []; + }, + animate: function animate(target, currentRect, toRect, duration) { + if (duration) { + css(target, 'transition', ''); + css(target, 'transform', ''); + var elMatrix = matrix(this.el), + scaleX = elMatrix && elMatrix.a, + scaleY = elMatrix && elMatrix.d, + translateX = (currentRect.left - toRect.left) / (scaleX || 1), + translateY = (currentRect.top - toRect.top) / (scaleY || 1); + target.animatingX = !!translateX; + target.animatingY = !!translateY; + css(target, 'transform', 'translate3d(' + translateX + 'px,' + translateY + 'px,0)'); + repaint(target); // repaint + + css(target, 'transition', 'transform ' + duration + 'ms' + (this.options.easing ? ' ' + this.options.easing : '')); + css(target, 'transform', 'translate3d(0,0,0)'); + typeof target.animated === 'number' && clearTimeout(target.animated); + target.animated = setTimeout(function () { + css(target, 'transition', ''); + css(target, 'transform', ''); + target.animated = false; + target.animatingX = false; + target.animatingY = false; + }, duration); + } + } + }; +} + +function repaint(target) { + return target.offsetWidth; +} + +function calculateRealTime(animatingRect, fromRect, toRect, options) { + return Math.sqrt(Math.pow(fromRect.top - animatingRect.top, 2) + Math.pow(fromRect.left - animatingRect.left, 2)) / Math.sqrt(Math.pow(fromRect.top - toRect.top, 2) + Math.pow(fromRect.left - toRect.left, 2)) * options.animation; +} + +var plugins = []; +var defaults = { + initializeByDefault: true +}; +var PluginManager = { + mount: function mount(plugin) { + // Set default static properties + for (var option in defaults) { + if (defaults.hasOwnProperty(option) && !(option in plugin)) { + plugin[option] = defaults[option]; + } + } + + plugins.push(plugin); + }, + pluginEvent: function pluginEvent(eventName, sortable, evt) { + var _this = this; + + this.eventCanceled = false; + + evt.cancel = function () { + _this.eventCanceled = true; + }; + + var eventNameGlobal = eventName + 'Global'; + plugins.forEach(function (plugin) { + if (!sortable[plugin.pluginName]) return; // Fire global events if it exists in this sortable + + if (sortable[plugin.pluginName][eventNameGlobal]) { + sortable[plugin.pluginName][eventNameGlobal](_objectSpread({ + sortable: sortable + }, evt)); + } // Only fire plugin event if plugin is enabled in this sortable, + // and plugin has event defined + + + if (sortable.options[plugin.pluginName] && sortable[plugin.pluginName][eventName]) { + sortable[plugin.pluginName][eventName](_objectSpread({ + sortable: sortable + }, evt)); + } + }); + }, + initializePlugins: function initializePlugins(sortable, el, defaults, options) { + plugins.forEach(function (plugin) { + var pluginName = plugin.pluginName; + if (!sortable.options[pluginName] && !plugin.initializeByDefault) return; + var initialized = new plugin(sortable, el, sortable.options); + initialized.sortable = sortable; + initialized.options = sortable.options; + sortable[pluginName] = initialized; // Add default options from plugin + + _extends(defaults, initialized.defaults); + }); + + for (var option in sortable.options) { + if (!sortable.options.hasOwnProperty(option)) continue; + var modified = this.modifyOption(sortable, option, sortable.options[option]); + + if (typeof modified !== 'undefined') { + sortable.options[option] = modified; + } + } + }, + getEventProperties: function getEventProperties(name, sortable) { + var eventProperties = {}; + plugins.forEach(function (plugin) { + if (typeof plugin.eventProperties !== 'function') return; + + _extends(eventProperties, plugin.eventProperties.call(sortable[plugin.pluginName], name)); + }); + return eventProperties; + }, + modifyOption: function modifyOption(sortable, name, value) { + var modifiedValue; + plugins.forEach(function (plugin) { + // Plugin must exist on the Sortable + if (!sortable[plugin.pluginName]) return; // If static option listener exists for this option, call in the context of the Sortable's instance of this plugin + + if (plugin.optionListeners && typeof plugin.optionListeners[name] === 'function') { + modifiedValue = plugin.optionListeners[name].call(sortable[plugin.pluginName], value); + } + }); + return modifiedValue; + } +}; + +function dispatchEvent(_ref) { + var sortable = _ref.sortable, + rootEl = _ref.rootEl, + name = _ref.name, + targetEl = _ref.targetEl, + cloneEl = _ref.cloneEl, + toEl = _ref.toEl, + fromEl = _ref.fromEl, + oldIndex = _ref.oldIndex, + newIndex = _ref.newIndex, + oldDraggableIndex = _ref.oldDraggableIndex, + newDraggableIndex = _ref.newDraggableIndex, + originalEvent = _ref.originalEvent, + putSortable = _ref.putSortable, + extraEventProperties = _ref.extraEventProperties; + sortable = sortable || rootEl && rootEl[expando]; + if (!sortable) return; + var evt, + options = sortable.options, + onName = 'on' + name.charAt(0).toUpperCase() + name.substr(1); // Support for new CustomEvent feature + + if (window.CustomEvent && !IE11OrLess && !Edge) { + evt = new CustomEvent(name, { + bubbles: true, + cancelable: true + }); + } else { + evt = document.createEvent('Event'); + evt.initEvent(name, true, true); + } + + evt.to = toEl || rootEl; + evt.from = fromEl || rootEl; + evt.item = targetEl || rootEl; + evt.clone = cloneEl; + evt.oldIndex = oldIndex; + evt.newIndex = newIndex; + evt.oldDraggableIndex = oldDraggableIndex; + evt.newDraggableIndex = newDraggableIndex; + evt.originalEvent = originalEvent; + evt.pullMode = putSortable ? putSortable.lastPutMode : undefined; + + var allEventProperties = _objectSpread({}, extraEventProperties, PluginManager.getEventProperties(name, sortable)); + + for (var option in allEventProperties) { + evt[option] = allEventProperties[option]; + } + + if (rootEl) { + rootEl.dispatchEvent(evt); + } + + if (options[onName]) { + options[onName].call(sortable, evt); + } +} + +var pluginEvent = function pluginEvent(eventName, sortable) { + var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}, + originalEvent = _ref.evt, + data = _objectWithoutProperties(_ref, ["evt"]); + + PluginManager.pluginEvent.bind(Sortable)(eventName, sortable, _objectSpread({ + dragEl: dragEl, + parentEl: parentEl, + ghostEl: ghostEl, + rootEl: rootEl, + nextEl: nextEl, + lastDownEl: lastDownEl, + cloneEl: cloneEl, + cloneHidden: cloneHidden, + dragStarted: moved, + putSortable: putSortable, + activeSortable: Sortable.active, + originalEvent: originalEvent, + oldIndex: oldIndex, + oldDraggableIndex: oldDraggableIndex, + newIndex: newIndex, + newDraggableIndex: newDraggableIndex, + hideGhostForTarget: _hideGhostForTarget, + unhideGhostForTarget: _unhideGhostForTarget, + cloneNowHidden: function cloneNowHidden() { + cloneHidden = true; + }, + cloneNowShown: function cloneNowShown() { + cloneHidden = false; + }, + dispatchSortableEvent: function dispatchSortableEvent(name) { + _dispatchEvent({ + sortable: sortable, + name: name, + originalEvent: originalEvent + }); + } + }, data)); +}; + +function _dispatchEvent(info) { + dispatchEvent(_objectSpread({ + putSortable: putSortable, + cloneEl: cloneEl, + targetEl: dragEl, + rootEl: rootEl, + oldIndex: oldIndex, + oldDraggableIndex: oldDraggableIndex, + newIndex: newIndex, + newDraggableIndex: newDraggableIndex + }, info)); +} + +var dragEl, + parentEl, + ghostEl, + rootEl, + nextEl, + lastDownEl, + cloneEl, + cloneHidden, + oldIndex, + newIndex, + oldDraggableIndex, + newDraggableIndex, + activeGroup, + putSortable, + awaitingDragStarted = false, + ignoreNextClick = false, + sortables = [], + tapEvt, + touchEvt, + lastDx, + lastDy, + tapDistanceLeft, + tapDistanceTop, + moved, + lastTarget, + lastDirection, + pastFirstInvertThresh = false, + isCircumstantialInvert = false, + targetMoveDistance, + // For positioning ghost absolutely +ghostRelativeParent, + ghostRelativeParentInitialScroll = [], + // (left, top) +_silent = false, + savedInputChecked = []; +/** @const */ + +var documentExists = typeof document !== 'undefined', + PositionGhostAbsolutely = IOS, + CSSFloatProperty = Edge || IE11OrLess ? 'cssFloat' : 'float', + // This will not pass for IE9, because IE9 DnD only works on anchors +supportDraggable = documentExists && !ChromeForAndroid && !IOS && 'draggable' in document.createElement('div'), + supportCssPointerEvents = function () { + if (!documentExists) return; // false when <= IE11 + + if (IE11OrLess) { + return false; + } + + var el = document.createElement('x'); + el.style.cssText = 'pointer-events:auto'; + return el.style.pointerEvents === 'auto'; +}(), + _detectDirection = function _detectDirection(el, options) { + var elCSS = css(el), + elWidth = parseInt(elCSS.width) - parseInt(elCSS.paddingLeft) - parseInt(elCSS.paddingRight) - parseInt(elCSS.borderLeftWidth) - parseInt(elCSS.borderRightWidth), + child1 = getChild(el, 0, options), + child2 = getChild(el, 1, options), + firstChildCSS = child1 && css(child1), + secondChildCSS = child2 && css(child2), + firstChildWidth = firstChildCSS && parseInt(firstChildCSS.marginLeft) + parseInt(firstChildCSS.marginRight) + getRect(child1).width, + secondChildWidth = secondChildCSS && parseInt(secondChildCSS.marginLeft) + parseInt(secondChildCSS.marginRight) + getRect(child2).width; + + if (elCSS.display === 'flex') { + return elCSS.flexDirection === 'column' || elCSS.flexDirection === 'column-reverse' ? 'vertical' : 'horizontal'; + } + + if (elCSS.display === 'grid') { + return elCSS.gridTemplateColumns.split(' ').length <= 1 ? 'vertical' : 'horizontal'; + } + + if (child1 && firstChildCSS["float"] && firstChildCSS["float"] !== 'none') { + var touchingSideChild2 = firstChildCSS["float"] === 'left' ? 'left' : 'right'; + return child2 && (secondChildCSS.clear === 'both' || secondChildCSS.clear === touchingSideChild2) ? 'vertical' : 'horizontal'; + } + + return child1 && (firstChildCSS.display === 'block' || firstChildCSS.display === 'flex' || firstChildCSS.display === 'table' || firstChildCSS.display === 'grid' || firstChildWidth >= elWidth && elCSS[CSSFloatProperty] === 'none' || child2 && elCSS[CSSFloatProperty] === 'none' && firstChildWidth + secondChildWidth > elWidth) ? 'vertical' : 'horizontal'; +}, + _dragElInRowColumn = function _dragElInRowColumn(dragRect, targetRect, vertical) { + var dragElS1Opp = vertical ? dragRect.left : dragRect.top, + dragElS2Opp = vertical ? dragRect.right : dragRect.bottom, + dragElOppLength = vertical ? dragRect.width : dragRect.height, + targetS1Opp = vertical ? targetRect.left : targetRect.top, + targetS2Opp = vertical ? targetRect.right : targetRect.bottom, + targetOppLength = vertical ? targetRect.width : targetRect.height; + return dragElS1Opp === targetS1Opp || dragElS2Opp === targetS2Opp || dragElS1Opp + dragElOppLength / 2 === targetS1Opp + targetOppLength / 2; +}, + +/** + * Detects first nearest empty sortable to X and Y position using emptyInsertThreshold. + * @param {Number} x X position + * @param {Number} y Y position + * @return {HTMLElement} Element of the first found nearest Sortable + */ +_detectNearestEmptySortable = function _detectNearestEmptySortable(x, y) { + var ret; + sortables.some(function (sortable) { + if (lastChild(sortable)) return; + var rect = getRect(sortable), + threshold = sortable[expando].options.emptyInsertThreshold, + insideHorizontally = x >= rect.left - threshold && x <= rect.right + threshold, + insideVertically = y >= rect.top - threshold && y <= rect.bottom + threshold; + + if (threshold && insideHorizontally && insideVertically) { + return ret = sortable; + } + }); + return ret; +}, + _prepareGroup = function _prepareGroup(options) { + function toFn(value, pull) { + return function (to, from, dragEl, evt) { + var sameGroup = to.options.group.name && from.options.group.name && to.options.group.name === from.options.group.name; + + if (value == null && (pull || sameGroup)) { + // Default pull value + // Default pull and put value if same group + return true; + } else if (value == null || value === false) { + return false; + } else if (pull && value === 'clone') { + return value; + } else if (typeof value === 'function') { + return toFn(value(to, from, dragEl, evt), pull)(to, from, dragEl, evt); + } else { + var otherGroup = (pull ? to : from).options.group.name; + return value === true || typeof value === 'string' && value === otherGroup || value.join && value.indexOf(otherGroup) > -1; + } + }; + } + + var group = {}; + var originalGroup = options.group; + + if (!originalGroup || _typeof(originalGroup) != 'object') { + originalGroup = { + name: originalGroup + }; + } + + group.name = originalGroup.name; + group.checkPull = toFn(originalGroup.pull, true); + group.checkPut = toFn(originalGroup.put); + group.revertClone = originalGroup.revertClone; + options.group = group; +}, + _hideGhostForTarget = function _hideGhostForTarget() { + if (!supportCssPointerEvents && ghostEl) { + css(ghostEl, 'display', 'none'); + } +}, + _unhideGhostForTarget = function _unhideGhostForTarget() { + if (!supportCssPointerEvents && ghostEl) { + css(ghostEl, 'display', ''); + } +}; // #1184 fix - Prevent click event on fallback if dragged but item not changed position + + +if (documentExists) { + document.addEventListener('click', function (evt) { + if (ignoreNextClick) { + evt.preventDefault(); + evt.stopPropagation && evt.stopPropagation(); + evt.stopImmediatePropagation && evt.stopImmediatePropagation(); + ignoreNextClick = false; + return false; + } + }, true); +} + +var nearestEmptyInsertDetectEvent = function nearestEmptyInsertDetectEvent(evt) { + if (dragEl) { + evt = evt.touches ? evt.touches[0] : evt; + + var nearest = _detectNearestEmptySortable(evt.clientX, evt.clientY); + + if (nearest) { + // Create imitation event + var event = {}; + + for (var i in evt) { + if (evt.hasOwnProperty(i)) { + event[i] = evt[i]; + } + } + + event.target = event.rootEl = nearest; + event.preventDefault = void 0; + event.stopPropagation = void 0; + + nearest[expando]._onDragOver(event); + } + } +}; + +var _checkOutsideTargetEl = function _checkOutsideTargetEl(evt) { + if (dragEl) { + dragEl.parentNode[expando]._isOutsideThisEl(evt.target); + } +}; +/** + * @class Sortable + * @param {HTMLElement} el + * @param {Object} [options] + */ + + +function Sortable(el, options) { + if (!(el && el.nodeType && el.nodeType === 1)) { + throw "Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(el)); + } + + this.el = el; // root element + + this.options = options = _extends({}, options); // Export instance + + el[expando] = this; + var defaults = { + group: null, + sort: true, + disabled: false, + store: null, + handle: null, + draggable: /^[uo]l$/i.test(el.nodeName) ? '>li' : '>*', + swapThreshold: 1, + // percentage; 0 <= x <= 1 + invertSwap: false, + // invert always + invertedSwapThreshold: null, + // will be set to same as swapThreshold if default + removeCloneOnHide: true, + direction: function direction() { + return _detectDirection(el, this.options); + }, + ghostClass: 'sortable-ghost', + chosenClass: 'sortable-chosen', + dragClass: 'sortable-drag', + ignore: 'a, img', + filter: null, + preventOnFilter: true, + animation: 0, + easing: null, + setData: function setData(dataTransfer, dragEl) { + dataTransfer.setData('Text', dragEl.textContent); + }, + dropBubble: false, + dragoverBubble: false, + dataIdAttr: 'data-id', + delay: 0, + delayOnTouchOnly: false, + touchStartThreshold: (Number.parseInt ? Number : window).parseInt(window.devicePixelRatio, 10) || 1, + forceFallback: false, + fallbackClass: 'sortable-fallback', + fallbackOnBody: false, + fallbackTolerance: 0, + fallbackOffset: { + x: 0, + y: 0 + }, + supportPointer: Sortable.supportPointer !== false && 'PointerEvent' in window, + emptyInsertThreshold: 5 + }; + PluginManager.initializePlugins(this, el, defaults); // Set default options + + for (var name in defaults) { + !(name in options) && (options[name] = defaults[name]); + } + + _prepareGroup(options); // Bind all private methods + + + for (var fn in this) { + if (fn.charAt(0) === '_' && typeof this[fn] === 'function') { + this[fn] = this[fn].bind(this); + } + } // Setup drag mode + + + this.nativeDraggable = options.forceFallback ? false : supportDraggable; + + if (this.nativeDraggable) { + // Touch start threshold cannot be greater than the native dragstart threshold + this.options.touchStartThreshold = 1; + } // Bind events + + + if (options.supportPointer) { + on(el, 'pointerdown', this._onTapStart); + } else { + on(el, 'mousedown', this._onTapStart); + on(el, 'touchstart', this._onTapStart); + } + + if (this.nativeDraggable) { + on(el, 'dragover', this); + on(el, 'dragenter', this); + } + + sortables.push(this.el); // Restore sorting + + options.store && options.store.get && this.sort(options.store.get(this) || []); // Add animation state manager + + _extends(this, AnimationStateManager()); +} + +Sortable.prototype = +/** @lends Sortable.prototype */ +{ + constructor: Sortable, + _isOutsideThisEl: function _isOutsideThisEl(target) { + if (!this.el.contains(target) && target !== this.el) { + lastTarget = null; + } + }, + _getDirection: function _getDirection(evt, target) { + return typeof this.options.direction === 'function' ? this.options.direction.call(this, evt, target, dragEl) : this.options.direction; + }, + _onTapStart: function _onTapStart( + /** Event|TouchEvent */ + evt) { + if (!evt.cancelable) return; + + var _this = this, + el = this.el, + options = this.options, + preventOnFilter = options.preventOnFilter, + type = evt.type, + touch = evt.touches && evt.touches[0] || evt.pointerType && evt.pointerType === 'touch' && evt, + target = (touch || evt).target, + originalTarget = evt.target.shadowRoot && (evt.path && evt.path[0] || evt.composedPath && evt.composedPath()[0]) || target, + filter = options.filter; + + _saveInputCheckedState(el); // Don't trigger start event when an element is been dragged, otherwise the evt.oldindex always wrong when set option.group. + + + if (dragEl) { + return; + } + + if (/mousedown|pointerdown/.test(type) && evt.button !== 0 || options.disabled) { + return; // only left button and enabled + } // cancel dnd if original target is content editable + + + if (originalTarget.isContentEditable) { + return; + } + + target = closest(target, options.draggable, el, false); + + if (target && target.animated) { + return; + } + + if (lastDownEl === target) { + // Ignoring duplicate `down` + return; + } // Get the index of the dragged element within its parent + + + oldIndex = index(target); + oldDraggableIndex = index(target, options.draggable); // Check filter + + if (typeof filter === 'function') { + if (filter.call(this, evt, target, this)) { + _dispatchEvent({ + sortable: _this, + rootEl: originalTarget, + name: 'filter', + targetEl: target, + toEl: el, + fromEl: el + }); + + pluginEvent('filter', _this, { + evt: evt + }); + preventOnFilter && evt.cancelable && evt.preventDefault(); + return; // cancel dnd + } + } else if (filter) { + filter = filter.split(',').some(function (criteria) { + criteria = closest(originalTarget, criteria.trim(), el, false); + + if (criteria) { + _dispatchEvent({ + sortable: _this, + rootEl: criteria, + name: 'filter', + targetEl: target, + fromEl: el, + toEl: el + }); + + pluginEvent('filter', _this, { + evt: evt + }); + return true; + } + }); + + if (filter) { + preventOnFilter && evt.cancelable && evt.preventDefault(); + return; // cancel dnd + } + } + + if (options.handle && !closest(originalTarget, options.handle, el, false)) { + return; + } // Prepare `dragstart` + + + this._prepareDragStart(evt, touch, target); + }, + _prepareDragStart: function _prepareDragStart( + /** Event */ + evt, + /** Touch */ + touch, + /** HTMLElement */ + target) { + var _this = this, + el = _this.el, + options = _this.options, + ownerDocument = el.ownerDocument, + dragStartFn; + + if (target && !dragEl && target.parentNode === el) { + var dragRect = getRect(target); + rootEl = el; + dragEl = target; + parentEl = dragEl.parentNode; + nextEl = dragEl.nextSibling; + lastDownEl = target; + activeGroup = options.group; + Sortable.dragged = dragEl; + tapEvt = { + target: dragEl, + clientX: (touch || evt).clientX, + clientY: (touch || evt).clientY + }; + tapDistanceLeft = tapEvt.clientX - dragRect.left; + tapDistanceTop = tapEvt.clientY - dragRect.top; + this._lastX = (touch || evt).clientX; + this._lastY = (touch || evt).clientY; + dragEl.style['will-change'] = 'all'; + + dragStartFn = function dragStartFn() { + pluginEvent('delayEnded', _this, { + evt: evt + }); + + if (Sortable.eventCanceled) { + _this._onDrop(); + + return; + } // Delayed drag has been triggered + // we can re-enable the events: touchmove/mousemove + + + _this._disableDelayedDragEvents(); + + if (!FireFox && _this.nativeDraggable) { + dragEl.draggable = true; + } // Bind the events: dragstart/dragend + + + _this._triggerDragStart(evt, touch); // Drag start event + + + _dispatchEvent({ + sortable: _this, + name: 'choose', + originalEvent: evt + }); // Chosen item + + + toggleClass(dragEl, options.chosenClass, true); + }; // Disable "draggable" + + + options.ignore.split(',').forEach(function (criteria) { + find(dragEl, criteria.trim(), _disableDraggable); + }); + on(ownerDocument, 'dragover', nearestEmptyInsertDetectEvent); + on(ownerDocument, 'mousemove', nearestEmptyInsertDetectEvent); + on(ownerDocument, 'touchmove', nearestEmptyInsertDetectEvent); + on(ownerDocument, 'mouseup', _this._onDrop); + on(ownerDocument, 'touchend', _this._onDrop); + on(ownerDocument, 'touchcancel', _this._onDrop); // Make dragEl draggable (must be before delay for FireFox) + + if (FireFox && this.nativeDraggable) { + this.options.touchStartThreshold = 4; + dragEl.draggable = true; + } + + pluginEvent('delayStart', this, { + evt: evt + }); // Delay is impossible for native DnD in Edge or IE + + if (options.delay && (!options.delayOnTouchOnly || touch) && (!this.nativeDraggable || !(Edge || IE11OrLess))) { + if (Sortable.eventCanceled) { + this._onDrop(); + + return; + } // If the user moves the pointer or let go the click or touch + // before the delay has been reached: + // disable the delayed drag + + + on(ownerDocument, 'mouseup', _this._disableDelayedDrag); + on(ownerDocument, 'touchend', _this._disableDelayedDrag); + on(ownerDocument, 'touchcancel', _this._disableDelayedDrag); + on(ownerDocument, 'mousemove', _this._delayedDragTouchMoveHandler); + on(ownerDocument, 'touchmove', _this._delayedDragTouchMoveHandler); + options.supportPointer && on(ownerDocument, 'pointermove', _this._delayedDragTouchMoveHandler); + _this._dragStartTimer = setTimeout(dragStartFn, options.delay); + } else { + dragStartFn(); + } + } + }, + _delayedDragTouchMoveHandler: function _delayedDragTouchMoveHandler( + /** TouchEvent|PointerEvent **/ + e) { + var touch = e.touches ? e.touches[0] : e; + + if (Math.max(Math.abs(touch.clientX - this._lastX), Math.abs(touch.clientY - this._lastY)) >= Math.floor(this.options.touchStartThreshold / (this.nativeDraggable && window.devicePixelRatio || 1))) { + this._disableDelayedDrag(); + } + }, + _disableDelayedDrag: function _disableDelayedDrag() { + dragEl && _disableDraggable(dragEl); + clearTimeout(this._dragStartTimer); + + this._disableDelayedDragEvents(); + }, + _disableDelayedDragEvents: function _disableDelayedDragEvents() { + var ownerDocument = this.el.ownerDocument; + off(ownerDocument, 'mouseup', this._disableDelayedDrag); + off(ownerDocument, 'touchend', this._disableDelayedDrag); + off(ownerDocument, 'touchcancel', this._disableDelayedDrag); + off(ownerDocument, 'mousemove', this._delayedDragTouchMoveHandler); + off(ownerDocument, 'touchmove', this._delayedDragTouchMoveHandler); + off(ownerDocument, 'pointermove', this._delayedDragTouchMoveHandler); + }, + _triggerDragStart: function _triggerDragStart( + /** Event */ + evt, + /** Touch */ + touch) { + touch = touch || evt.pointerType == 'touch' && evt; + + if (!this.nativeDraggable || touch) { + if (this.options.supportPointer) { + on(document, 'pointermove', this._onTouchMove); + } else if (touch) { + on(document, 'touchmove', this._onTouchMove); + } else { + on(document, 'mousemove', this._onTouchMove); + } + } else { + on(dragEl, 'dragend', this); + on(rootEl, 'dragstart', this._onDragStart); + } + + try { + if (document.selection) { + // Timeout neccessary for IE9 + _nextTick(function () { + document.selection.empty(); + }); + } else { + window.getSelection().removeAllRanges(); + } + } catch (err) {} + }, + _dragStarted: function _dragStarted(fallback, evt) { + + awaitingDragStarted = false; + + if (rootEl && dragEl) { + pluginEvent('dragStarted', this, { + evt: evt + }); + + if (this.nativeDraggable) { + on(document, 'dragover', _checkOutsideTargetEl); + } + + var options = this.options; // Apply effect + + !fallback && toggleClass(dragEl, options.dragClass, false); + toggleClass(dragEl, options.ghostClass, true); + Sortable.active = this; + fallback && this._appendGhost(); // Drag start event + + _dispatchEvent({ + sortable: this, + name: 'start', + originalEvent: evt + }); + } else { + this._nulling(); + } + }, + _emulateDragOver: function _emulateDragOver() { + if (touchEvt) { + this._lastX = touchEvt.clientX; + this._lastY = touchEvt.clientY; + + _hideGhostForTarget(); + + var target = document.elementFromPoint(touchEvt.clientX, touchEvt.clientY); + var parent = target; + + while (target && target.shadowRoot) { + target = target.shadowRoot.elementFromPoint(touchEvt.clientX, touchEvt.clientY); + if (target === parent) break; + parent = target; + } + + dragEl.parentNode[expando]._isOutsideThisEl(target); + + if (parent) { + do { + if (parent[expando]) { + var inserted = void 0; + inserted = parent[expando]._onDragOver({ + clientX: touchEvt.clientX, + clientY: touchEvt.clientY, + target: target, + rootEl: parent + }); + + if (inserted && !this.options.dragoverBubble) { + break; + } + } + + target = parent; // store last element + } + /* jshint boss:true */ + while (parent = parent.parentNode); + } + + _unhideGhostForTarget(); + } + }, + _onTouchMove: function _onTouchMove( + /**TouchEvent*/ + evt) { + if (tapEvt) { + var options = this.options, + fallbackTolerance = options.fallbackTolerance, + fallbackOffset = options.fallbackOffset, + touch = evt.touches ? evt.touches[0] : evt, + ghostMatrix = ghostEl && matrix(ghostEl, true), + scaleX = ghostEl && ghostMatrix && ghostMatrix.a, + scaleY = ghostEl && ghostMatrix && ghostMatrix.d, + relativeScrollOffset = PositionGhostAbsolutely && ghostRelativeParent && getRelativeScrollOffset(ghostRelativeParent), + dx = (touch.clientX - tapEvt.clientX + fallbackOffset.x) / (scaleX || 1) + (relativeScrollOffset ? relativeScrollOffset[0] - ghostRelativeParentInitialScroll[0] : 0) / (scaleX || 1), + dy = (touch.clientY - tapEvt.clientY + fallbackOffset.y) / (scaleY || 1) + (relativeScrollOffset ? relativeScrollOffset[1] - ghostRelativeParentInitialScroll[1] : 0) / (scaleY || 1); // only set the status to dragging, when we are actually dragging + + if (!Sortable.active && !awaitingDragStarted) { + if (fallbackTolerance && Math.max(Math.abs(touch.clientX - this._lastX), Math.abs(touch.clientY - this._lastY)) < fallbackTolerance) { + return; + } + + this._onDragStart(evt, true); + } + + if (ghostEl) { + if (ghostMatrix) { + ghostMatrix.e += dx - (lastDx || 0); + ghostMatrix.f += dy - (lastDy || 0); + } else { + ghostMatrix = { + a: 1, + b: 0, + c: 0, + d: 1, + e: dx, + f: dy + }; + } + + var cssMatrix = "matrix(".concat(ghostMatrix.a, ",").concat(ghostMatrix.b, ",").concat(ghostMatrix.c, ",").concat(ghostMatrix.d, ",").concat(ghostMatrix.e, ",").concat(ghostMatrix.f, ")"); + css(ghostEl, 'webkitTransform', cssMatrix); + css(ghostEl, 'mozTransform', cssMatrix); + css(ghostEl, 'msTransform', cssMatrix); + css(ghostEl, 'transform', cssMatrix); + lastDx = dx; + lastDy = dy; + touchEvt = touch; + } + + evt.cancelable && evt.preventDefault(); + } + }, + _appendGhost: function _appendGhost() { + // Bug if using scale(): https://stackoverflow.com/questions/2637058 + // Not being adjusted for + if (!ghostEl) { + var container = this.options.fallbackOnBody ? document.body : rootEl, + rect = getRect(dragEl, true, PositionGhostAbsolutely, true, container), + options = this.options; // Position absolutely + + if (PositionGhostAbsolutely) { + // Get relatively positioned parent + ghostRelativeParent = container; + + while (css(ghostRelativeParent, 'position') === 'static' && css(ghostRelativeParent, 'transform') === 'none' && ghostRelativeParent !== document) { + ghostRelativeParent = ghostRelativeParent.parentNode; + } + + if (ghostRelativeParent !== document.body && ghostRelativeParent !== document.documentElement) { + if (ghostRelativeParent === document) ghostRelativeParent = getWindowScrollingElement(); + rect.top += ghostRelativeParent.scrollTop; + rect.left += ghostRelativeParent.scrollLeft; + } else { + ghostRelativeParent = getWindowScrollingElement(); + } + + ghostRelativeParentInitialScroll = getRelativeScrollOffset(ghostRelativeParent); + } + + ghostEl = dragEl.cloneNode(true); + toggleClass(ghostEl, options.ghostClass, false); + toggleClass(ghostEl, options.fallbackClass, true); + toggleClass(ghostEl, options.dragClass, true); + css(ghostEl, 'transition', ''); + css(ghostEl, 'transform', ''); + css(ghostEl, 'box-sizing', 'border-box'); + css(ghostEl, 'margin', 0); + css(ghostEl, 'top', rect.top); + css(ghostEl, 'left', rect.left); + css(ghostEl, 'width', rect.width); + css(ghostEl, 'height', rect.height); + css(ghostEl, 'opacity', '0.8'); + css(ghostEl, 'position', PositionGhostAbsolutely ? 'absolute' : 'fixed'); + css(ghostEl, 'zIndex', '100000'); + css(ghostEl, 'pointerEvents', 'none'); + Sortable.ghost = ghostEl; + container.appendChild(ghostEl); // Set transform-origin + + css(ghostEl, 'transform-origin', tapDistanceLeft / parseInt(ghostEl.style.width) * 100 + '% ' + tapDistanceTop / parseInt(ghostEl.style.height) * 100 + '%'); + } + }, + _onDragStart: function _onDragStart( + /**Event*/ + evt, + /**boolean*/ + fallback) { + var _this = this; + + var dataTransfer = evt.dataTransfer; + var options = _this.options; + pluginEvent('dragStart', this, { + evt: evt + }); + + if (Sortable.eventCanceled) { + this._onDrop(); + + return; + } + + pluginEvent('setupClone', this); + + if (!Sortable.eventCanceled) { + cloneEl = clone(dragEl); + cloneEl.draggable = false; + cloneEl.style['will-change'] = ''; + + this._hideClone(); + + toggleClass(cloneEl, this.options.chosenClass, false); + Sortable.clone = cloneEl; + } // #1143: IFrame support workaround + + + _this.cloneId = _nextTick(function () { + pluginEvent('clone', _this); + if (Sortable.eventCanceled) return; + + if (!_this.options.removeCloneOnHide) { + rootEl.insertBefore(cloneEl, dragEl); + } + + _this._hideClone(); + + _dispatchEvent({ + sortable: _this, + name: 'clone' + }); + }); + !fallback && toggleClass(dragEl, options.dragClass, true); // Set proper drop events + + if (fallback) { + ignoreNextClick = true; + _this._loopId = setInterval(_this._emulateDragOver, 50); + } else { + // Undo what was set in _prepareDragStart before drag started + off(document, 'mouseup', _this._onDrop); + off(document, 'touchend', _this._onDrop); + off(document, 'touchcancel', _this._onDrop); + + if (dataTransfer) { + dataTransfer.effectAllowed = 'move'; + options.setData && options.setData.call(_this, dataTransfer, dragEl); + } + + on(document, 'drop', _this); // #1276 fix: + + css(dragEl, 'transform', 'translateZ(0)'); + } + + awaitingDragStarted = true; + _this._dragStartId = _nextTick(_this._dragStarted.bind(_this, fallback, evt)); + on(document, 'selectstart', _this); + moved = true; + + if (Safari) { + css(document.body, 'user-select', 'none'); + } + }, + // Returns true - if no further action is needed (either inserted or another condition) + _onDragOver: function _onDragOver( + /**Event*/ + evt) { + var el = this.el, + target = evt.target, + dragRect, + targetRect, + revert, + options = this.options, + group = options.group, + activeSortable = Sortable.active, + isOwner = activeGroup === group, + canSort = options.sort, + fromSortable = putSortable || activeSortable, + vertical, + _this = this, + completedFired = false; + + if (_silent) return; + + function dragOverEvent(name, extra) { + pluginEvent(name, _this, _objectSpread({ + evt: evt, + isOwner: isOwner, + axis: vertical ? 'vertical' : 'horizontal', + revert: revert, + dragRect: dragRect, + targetRect: targetRect, + canSort: canSort, + fromSortable: fromSortable, + target: target, + completed: completed, + onMove: function onMove(target, after) { + return _onMove(rootEl, el, dragEl, dragRect, target, getRect(target), evt, after); + }, + changed: changed + }, extra)); + } // Capture animation state + + + function capture() { + dragOverEvent('dragOverAnimationCapture'); + + _this.captureAnimationState(); + + if (_this !== fromSortable) { + fromSortable.captureAnimationState(); + } + } // Return invocation when dragEl is inserted (or completed) + + + function completed(insertion) { + dragOverEvent('dragOverCompleted', { + insertion: insertion + }); + + if (insertion) { + // Clones must be hidden before folding animation to capture dragRectAbsolute properly + if (isOwner) { + activeSortable._hideClone(); + } else { + activeSortable._showClone(_this); + } + + if (_this !== fromSortable) { + // Set ghost class to new sortable's ghost class + toggleClass(dragEl, putSortable ? putSortable.options.ghostClass : activeSortable.options.ghostClass, false); + toggleClass(dragEl, options.ghostClass, true); + } + + if (putSortable !== _this && _this !== Sortable.active) { + putSortable = _this; + } else if (_this === Sortable.active && putSortable) { + putSortable = null; + } // Animation + + + if (fromSortable === _this) { + _this._ignoreWhileAnimating = target; + } + + _this.animateAll(function () { + dragOverEvent('dragOverAnimationComplete'); + _this._ignoreWhileAnimating = null; + }); + + if (_this !== fromSortable) { + fromSortable.animateAll(); + fromSortable._ignoreWhileAnimating = null; + } + } // Null lastTarget if it is not inside a previously swapped element + + + if (target === dragEl && !dragEl.animated || target === el && !target.animated) { + lastTarget = null; + } // no bubbling and not fallback + + + if (!options.dragoverBubble && !evt.rootEl && target !== document) { + dragEl.parentNode[expando]._isOutsideThisEl(evt.target); // Do not detect for empty insert if already inserted + + + !insertion && nearestEmptyInsertDetectEvent(evt); + } + + !options.dragoverBubble && evt.stopPropagation && evt.stopPropagation(); + return completedFired = true; + } // Call when dragEl has been inserted + + + function changed() { + newIndex = index(dragEl); + newDraggableIndex = index(dragEl, options.draggable); + + _dispatchEvent({ + sortable: _this, + name: 'change', + toEl: el, + newIndex: newIndex, + newDraggableIndex: newDraggableIndex, + originalEvent: evt + }); + } + + if (evt.preventDefault !== void 0) { + evt.cancelable && evt.preventDefault(); + } + + target = closest(target, options.draggable, el, true); + dragOverEvent('dragOver'); + if (Sortable.eventCanceled) return completedFired; + + if (dragEl.contains(evt.target) || target.animated && target.animatingX && target.animatingY || _this._ignoreWhileAnimating === target) { + return completed(false); + } + + ignoreNextClick = false; + + if (activeSortable && !options.disabled && (isOwner ? canSort || (revert = !rootEl.contains(dragEl)) // Reverting item into the original list + : putSortable === this || (this.lastPutMode = activeGroup.checkPull(this, activeSortable, dragEl, evt)) && group.checkPut(this, activeSortable, dragEl, evt))) { + vertical = this._getDirection(evt, target) === 'vertical'; + dragRect = getRect(dragEl); + dragOverEvent('dragOverValid'); + if (Sortable.eventCanceled) return completedFired; + + if (revert) { + parentEl = rootEl; // actualization + + capture(); + + this._hideClone(); + + dragOverEvent('revert'); + + if (!Sortable.eventCanceled) { + if (nextEl) { + rootEl.insertBefore(dragEl, nextEl); + } else { + rootEl.appendChild(dragEl); + } + } + + return completed(true); + } + + var elLastChild = lastChild(el, options.draggable); + + if (!elLastChild || _ghostIsLast(evt, vertical, this) && !elLastChild.animated) { + // If already at end of list: Do not insert + if (elLastChild === dragEl) { + return completed(false); + } // assign target only if condition is true + + + if (elLastChild && el === evt.target) { + target = elLastChild; + } + + if (target) { + targetRect = getRect(target); + } + + if (_onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, !!target) !== false) { + capture(); + el.appendChild(dragEl); + parentEl = el; // actualization + + changed(); + return completed(true); + } + } else if (target.parentNode === el) { + targetRect = getRect(target); + var direction = 0, + targetBeforeFirstSwap, + differentLevel = dragEl.parentNode !== el, + differentRowCol = !_dragElInRowColumn(dragEl.animated && dragEl.toRect || dragRect, target.animated && target.toRect || targetRect, vertical), + side1 = vertical ? 'top' : 'left', + scrolledPastTop = isScrolledPast(target, 'top', 'top') || isScrolledPast(dragEl, 'top', 'top'), + scrollBefore = scrolledPastTop ? scrolledPastTop.scrollTop : void 0; + + if (lastTarget !== target) { + targetBeforeFirstSwap = targetRect[side1]; + pastFirstInvertThresh = false; + isCircumstantialInvert = !differentRowCol && options.invertSwap || differentLevel; + } + + direction = _getSwapDirection(evt, target, targetRect, vertical, differentRowCol ? 1 : options.swapThreshold, options.invertedSwapThreshold == null ? options.swapThreshold : options.invertedSwapThreshold, isCircumstantialInvert, lastTarget === target); + var sibling; + + if (direction !== 0) { + // Check if target is beside dragEl in respective direction (ignoring hidden elements) + var dragIndex = index(dragEl); + + do { + dragIndex -= direction; + sibling = parentEl.children[dragIndex]; + } while (sibling && (css(sibling, 'display') === 'none' || sibling === ghostEl)); + } // If dragEl is already beside target: Do not insert + + + if (direction === 0 || sibling === target) { + return completed(false); + } + + lastTarget = target; + lastDirection = direction; + var nextSibling = target.nextElementSibling, + after = false; + after = direction === 1; + + var moveVector = _onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, after); + + if (moveVector !== false) { + if (moveVector === 1 || moveVector === -1) { + after = moveVector === 1; + } + + _silent = true; + setTimeout(_unsilent, 30); + capture(); + + if (after && !nextSibling) { + el.appendChild(dragEl); + } else { + target.parentNode.insertBefore(dragEl, after ? nextSibling : target); + } // Undo chrome's scroll adjustment (has no effect on other browsers) + + + if (scrolledPastTop) { + scrollBy(scrolledPastTop, 0, scrollBefore - scrolledPastTop.scrollTop); + } + + parentEl = dragEl.parentNode; // actualization + // must be done before animation + + if (targetBeforeFirstSwap !== undefined && !isCircumstantialInvert) { + targetMoveDistance = Math.abs(targetBeforeFirstSwap - getRect(target)[side1]); + } + + changed(); + return completed(true); + } + } + + if (el.contains(dragEl)) { + return completed(false); + } + } + + return false; + }, + _ignoreWhileAnimating: null, + _offMoveEvents: function _offMoveEvents() { + off(document, 'mousemove', this._onTouchMove); + off(document, 'touchmove', this._onTouchMove); + off(document, 'pointermove', this._onTouchMove); + off(document, 'dragover', nearestEmptyInsertDetectEvent); + off(document, 'mousemove', nearestEmptyInsertDetectEvent); + off(document, 'touchmove', nearestEmptyInsertDetectEvent); + }, + _offUpEvents: function _offUpEvents() { + var ownerDocument = this.el.ownerDocument; + off(ownerDocument, 'mouseup', this._onDrop); + off(ownerDocument, 'touchend', this._onDrop); + off(ownerDocument, 'pointerup', this._onDrop); + off(ownerDocument, 'touchcancel', this._onDrop); + off(document, 'selectstart', this); + }, + _onDrop: function _onDrop( + /**Event*/ + evt) { + var el = this.el, + options = this.options; // Get the index of the dragged element within its parent + + newIndex = index(dragEl); + newDraggableIndex = index(dragEl, options.draggable); + pluginEvent('drop', this, { + evt: evt + }); + parentEl = dragEl && dragEl.parentNode; // Get again after plugin event + + newIndex = index(dragEl); + newDraggableIndex = index(dragEl, options.draggable); + + if (Sortable.eventCanceled) { + this._nulling(); + + return; + } + + awaitingDragStarted = false; + isCircumstantialInvert = false; + pastFirstInvertThresh = false; + clearInterval(this._loopId); + clearTimeout(this._dragStartTimer); + + _cancelNextTick(this.cloneId); + + _cancelNextTick(this._dragStartId); // Unbind events + + + if (this.nativeDraggable) { + off(document, 'drop', this); + off(el, 'dragstart', this._onDragStart); + } + + this._offMoveEvents(); + + this._offUpEvents(); + + if (Safari) { + css(document.body, 'user-select', ''); + } + + css(dragEl, 'transform', ''); + + if (evt) { + if (moved) { + evt.cancelable && evt.preventDefault(); + !options.dropBubble && evt.stopPropagation(); + } + + ghostEl && ghostEl.parentNode && ghostEl.parentNode.removeChild(ghostEl); + + if (rootEl === parentEl || putSortable && putSortable.lastPutMode !== 'clone') { + // Remove clone(s) + cloneEl && cloneEl.parentNode && cloneEl.parentNode.removeChild(cloneEl); + } + + if (dragEl) { + if (this.nativeDraggable) { + off(dragEl, 'dragend', this); + } + + _disableDraggable(dragEl); + + dragEl.style['will-change'] = ''; // Remove classes + // ghostClass is added in dragStarted + + if (moved && !awaitingDragStarted) { + toggleClass(dragEl, putSortable ? putSortable.options.ghostClass : this.options.ghostClass, false); + } + + toggleClass(dragEl, this.options.chosenClass, false); // Drag stop event + + _dispatchEvent({ + sortable: this, + name: 'unchoose', + toEl: parentEl, + newIndex: null, + newDraggableIndex: null, + originalEvent: evt + }); + + if (rootEl !== parentEl) { + if (newIndex >= 0) { + // Add event + _dispatchEvent({ + rootEl: parentEl, + name: 'add', + toEl: parentEl, + fromEl: rootEl, + originalEvent: evt + }); // Remove event + + + _dispatchEvent({ + sortable: this, + name: 'remove', + toEl: parentEl, + originalEvent: evt + }); // drag from one list and drop into another + + + _dispatchEvent({ + rootEl: parentEl, + name: 'sort', + toEl: parentEl, + fromEl: rootEl, + originalEvent: evt + }); + + _dispatchEvent({ + sortable: this, + name: 'sort', + toEl: parentEl, + originalEvent: evt + }); + } + + putSortable && putSortable.save(); + } else { + if (newIndex !== oldIndex) { + if (newIndex >= 0) { + // drag & drop within the same list + _dispatchEvent({ + sortable: this, + name: 'update', + toEl: parentEl, + originalEvent: evt + }); + + _dispatchEvent({ + sortable: this, + name: 'sort', + toEl: parentEl, + originalEvent: evt + }); + } + } + } + + if (Sortable.active) { + /* jshint eqnull:true */ + if (newIndex == null || newIndex === -1) { + newIndex = oldIndex; + newDraggableIndex = oldDraggableIndex; + } + + _dispatchEvent({ + sortable: this, + name: 'end', + toEl: parentEl, + originalEvent: evt + }); // Save sorting + + + this.save(); + } + } + } + + this._nulling(); + }, + _nulling: function _nulling() { + pluginEvent('nulling', this); + rootEl = dragEl = parentEl = ghostEl = nextEl = cloneEl = lastDownEl = cloneHidden = tapEvt = touchEvt = moved = newIndex = newDraggableIndex = oldIndex = oldDraggableIndex = lastTarget = lastDirection = putSortable = activeGroup = Sortable.dragged = Sortable.ghost = Sortable.clone = Sortable.active = null; + savedInputChecked.forEach(function (el) { + el.checked = true; + }); + savedInputChecked.length = lastDx = lastDy = 0; + }, + handleEvent: function handleEvent( + /**Event*/ + evt) { + switch (evt.type) { + case 'drop': + case 'dragend': + this._onDrop(evt); + + break; + + case 'dragenter': + case 'dragover': + if (dragEl) { + this._onDragOver(evt); + + _globalDragOver(evt); + } + + break; + + case 'selectstart': + evt.preventDefault(); + break; + } + }, + + /** + * Serializes the item into an array of string. + * @returns {String[]} + */ + toArray: function toArray() { + var order = [], + el, + children = this.el.children, + i = 0, + n = children.length, + options = this.options; + + for (; i < n; i++) { + el = children[i]; + + if (closest(el, options.draggable, this.el, false)) { + order.push(el.getAttribute(options.dataIdAttr) || _generateId(el)); + } + } + + return order; + }, + + /** + * Sorts the elements according to the array. + * @param {String[]} order order of the items + */ + sort: function sort(order) { + var items = {}, + rootEl = this.el; + this.toArray().forEach(function (id, i) { + var el = rootEl.children[i]; + + if (closest(el, this.options.draggable, rootEl, false)) { + items[id] = el; + } + }, this); + order.forEach(function (id) { + if (items[id]) { + rootEl.removeChild(items[id]); + rootEl.appendChild(items[id]); + } + }); + }, + + /** + * Save the current sorting + */ + save: function save() { + var store = this.options.store; + store && store.set && store.set(this); + }, + + /** + * For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree. + * @param {HTMLElement} el + * @param {String} [selector] default: `options.draggable` + * @returns {HTMLElement|null} + */ + closest: function closest$1(el, selector) { + return closest(el, selector || this.options.draggable, this.el, false); + }, + + /** + * Set/get option + * @param {string} name + * @param {*} [value] + * @returns {*} + */ + option: function option(name, value) { + var options = this.options; + + if (value === void 0) { + return options[name]; + } else { + var modifiedValue = PluginManager.modifyOption(this, name, value); + + if (typeof modifiedValue !== 'undefined') { + options[name] = modifiedValue; + } else { + options[name] = value; + } + + if (name === 'group') { + _prepareGroup(options); + } + } + }, + + /** + * Destroy + */ + destroy: function destroy() { + pluginEvent('destroy', this); + var el = this.el; + el[expando] = null; + off(el, 'mousedown', this._onTapStart); + off(el, 'touchstart', this._onTapStart); + off(el, 'pointerdown', this._onTapStart); + + if (this.nativeDraggable) { + off(el, 'dragover', this); + off(el, 'dragenter', this); + } // Remove draggable attributes + + + Array.prototype.forEach.call(el.querySelectorAll('[draggable]'), function (el) { + el.removeAttribute('draggable'); + }); + + this._onDrop(); + + this._disableDelayedDragEvents(); + + sortables.splice(sortables.indexOf(this.el), 1); + this.el = el = null; + }, + _hideClone: function _hideClone() { + if (!cloneHidden) { + pluginEvent('hideClone', this); + if (Sortable.eventCanceled) return; + css(cloneEl, 'display', 'none'); + + if (this.options.removeCloneOnHide && cloneEl.parentNode) { + cloneEl.parentNode.removeChild(cloneEl); + } + + cloneHidden = true; + } + }, + _showClone: function _showClone(putSortable) { + if (putSortable.lastPutMode !== 'clone') { + this._hideClone(); + + return; + } + + if (cloneHidden) { + pluginEvent('showClone', this); + if (Sortable.eventCanceled) return; // show clone at dragEl or original position + + if (rootEl.contains(dragEl) && !this.options.group.revertClone) { + rootEl.insertBefore(cloneEl, dragEl); + } else if (nextEl) { + rootEl.insertBefore(cloneEl, nextEl); + } else { + rootEl.appendChild(cloneEl); + } + + if (this.options.group.revertClone) { + this.animate(dragEl, cloneEl); + } + + css(cloneEl, 'display', ''); + cloneHidden = false; + } + } +}; + +function _globalDragOver( +/**Event*/ +evt) { + if (evt.dataTransfer) { + evt.dataTransfer.dropEffect = 'move'; + } + + evt.cancelable && evt.preventDefault(); +} + +function _onMove(fromEl, toEl, dragEl, dragRect, targetEl, targetRect, originalEvent, willInsertAfter) { + var evt, + sortable = fromEl[expando], + onMoveFn = sortable.options.onMove, + retVal; // Support for new CustomEvent feature + + if (window.CustomEvent && !IE11OrLess && !Edge) { + evt = new CustomEvent('move', { + bubbles: true, + cancelable: true + }); + } else { + evt = document.createEvent('Event'); + evt.initEvent('move', true, true); + } + + evt.to = toEl; + evt.from = fromEl; + evt.dragged = dragEl; + evt.draggedRect = dragRect; + evt.related = targetEl || toEl; + evt.relatedRect = targetRect || getRect(toEl); + evt.willInsertAfter = willInsertAfter; + evt.originalEvent = originalEvent; + fromEl.dispatchEvent(evt); + + if (onMoveFn) { + retVal = onMoveFn.call(sortable, evt, originalEvent); + } + + return retVal; +} + +function _disableDraggable(el) { + el.draggable = false; +} + +function _unsilent() { + _silent = false; +} + +function _ghostIsLast(evt, vertical, sortable) { + var rect = getRect(lastChild(sortable.el, sortable.options.draggable)); + var spacer = 10; + return vertical ? evt.clientX > rect.right + spacer || evt.clientX <= rect.right && evt.clientY > rect.bottom && evt.clientX >= rect.left : evt.clientX > rect.right && evt.clientY > rect.top || evt.clientX <= rect.right && evt.clientY > rect.bottom + spacer; +} + +function _getSwapDirection(evt, target, targetRect, vertical, swapThreshold, invertedSwapThreshold, invertSwap, isLastTarget) { + var mouseOnAxis = vertical ? evt.clientY : evt.clientX, + targetLength = vertical ? targetRect.height : targetRect.width, + targetS1 = vertical ? targetRect.top : targetRect.left, + targetS2 = vertical ? targetRect.bottom : targetRect.right, + invert = false; + + if (!invertSwap) { + // Never invert or create dragEl shadow when target movemenet causes mouse to move past the end of regular swapThreshold + if (isLastTarget && targetMoveDistance < targetLength * swapThreshold) { + // multiplied only by swapThreshold because mouse will already be inside target by (1 - threshold) * targetLength / 2 + // check if past first invert threshold on side opposite of lastDirection + if (!pastFirstInvertThresh && (lastDirection === 1 ? mouseOnAxis > targetS1 + targetLength * invertedSwapThreshold / 2 : mouseOnAxis < targetS2 - targetLength * invertedSwapThreshold / 2)) { + // past first invert threshold, do not restrict inverted threshold to dragEl shadow + pastFirstInvertThresh = true; + } + + if (!pastFirstInvertThresh) { + // dragEl shadow (target move distance shadow) + if (lastDirection === 1 ? mouseOnAxis < targetS1 + targetMoveDistance // over dragEl shadow + : mouseOnAxis > targetS2 - targetMoveDistance) { + return -lastDirection; + } + } else { + invert = true; + } + } else { + // Regular + if (mouseOnAxis > targetS1 + targetLength * (1 - swapThreshold) / 2 && mouseOnAxis < targetS2 - targetLength * (1 - swapThreshold) / 2) { + return _getInsertDirection(target); + } + } + } + + invert = invert || invertSwap; + + if (invert) { + // Invert of regular + if (mouseOnAxis < targetS1 + targetLength * invertedSwapThreshold / 2 || mouseOnAxis > targetS2 - targetLength * invertedSwapThreshold / 2) { + return mouseOnAxis > targetS1 + targetLength / 2 ? 1 : -1; + } + } + + return 0; +} +/** + * Gets the direction dragEl must be swapped relative to target in order to make it + * seem that dragEl has been "inserted" into that element's position + * @param {HTMLElement} target The target whose position dragEl is being inserted at + * @return {Number} Direction dragEl must be swapped + */ + + +function _getInsertDirection(target) { + if (index(dragEl) < index(target)) { + return 1; + } else { + return -1; + } +} +/** + * Generate id + * @param {HTMLElement} el + * @returns {String} + * @private + */ + + +function _generateId(el) { + var str = el.tagName + el.className + el.src + el.href + el.textContent, + i = str.length, + sum = 0; + + while (i--) { + sum += str.charCodeAt(i); + } + + return sum.toString(36); +} + +function _saveInputCheckedState(root) { + savedInputChecked.length = 0; + var inputs = root.getElementsByTagName('input'); + var idx = inputs.length; + + while (idx--) { + var el = inputs[idx]; + el.checked && savedInputChecked.push(el); + } +} + +function _nextTick(fn) { + return setTimeout(fn, 0); +} + +function _cancelNextTick(id) { + return clearTimeout(id); +} // Fixed #973: + + +if (documentExists) { + on(document, 'touchmove', function (evt) { + if ((Sortable.active || awaitingDragStarted) && evt.cancelable) { + evt.preventDefault(); + } + }); +} // Export utils + + +Sortable.utils = { + on: on, + off: off, + css: css, + find: find, + is: function is(el, selector) { + return !!closest(el, selector, el, false); + }, + extend: extend, + throttle: throttle, + closest: closest, + toggleClass: toggleClass, + clone: clone, + index: index, + nextTick: _nextTick, + cancelNextTick: _cancelNextTick, + detectDirection: _detectDirection, + getChild: getChild +}; +/** + * Get the Sortable instance of an element + * @param {HTMLElement} element The element + * @return {Sortable|undefined} The instance of Sortable + */ + +Sortable.get = function (element) { + return element[expando]; +}; +/** + * Mount a plugin to Sortable + * @param {...SortablePlugin|SortablePlugin[]} plugins Plugins being mounted + */ + + +Sortable.mount = function () { + for (var _len = arguments.length, plugins = new Array(_len), _key = 0; _key < _len; _key++) { + plugins[_key] = arguments[_key]; + } + + if (plugins[0].constructor === Array) plugins = plugins[0]; + plugins.forEach(function (plugin) { + if (!plugin.prototype || !plugin.prototype.constructor) { + throw "Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(plugin)); + } + + if (plugin.utils) Sortable.utils = _objectSpread({}, Sortable.utils, plugin.utils); + PluginManager.mount(plugin); + }); +}; +/** + * Create sortable instance + * @param {HTMLElement} el + * @param {Object} [options] + */ + + +Sortable.create = function (el, options) { + return new Sortable(el, options); +}; // Export + + +Sortable.version = version; + +var autoScrolls = [], + scrollEl, + scrollRootEl, + scrolling = false, + lastAutoScrollX, + lastAutoScrollY, + touchEvt$1, + pointerElemChangedInterval; + +function AutoScrollPlugin() { + function AutoScroll() { + this.defaults = { + scroll: true, + scrollSensitivity: 30, + scrollSpeed: 10, + bubbleScroll: true + }; // Bind all private methods + + for (var fn in this) { + if (fn.charAt(0) === '_' && typeof this[fn] === 'function') { + this[fn] = this[fn].bind(this); + } + } + } + + AutoScroll.prototype = { + dragStarted: function dragStarted(_ref) { + var originalEvent = _ref.originalEvent; + + if (this.sortable.nativeDraggable) { + on(document, 'dragover', this._handleAutoScroll); + } else { + if (this.options.supportPointer) { + on(document, 'pointermove', this._handleFallbackAutoScroll); + } else if (originalEvent.touches) { + on(document, 'touchmove', this._handleFallbackAutoScroll); + } else { + on(document, 'mousemove', this._handleFallbackAutoScroll); + } + } + }, + dragOverCompleted: function dragOverCompleted(_ref2) { + var originalEvent = _ref2.originalEvent; + + // For when bubbling is canceled and using fallback (fallback 'touchmove' always reached) + if (!this.options.dragOverBubble && !originalEvent.rootEl) { + this._handleAutoScroll(originalEvent); + } + }, + drop: function drop() { + if (this.sortable.nativeDraggable) { + off(document, 'dragover', this._handleAutoScroll); + } else { + off(document, 'pointermove', this._handleFallbackAutoScroll); + off(document, 'touchmove', this._handleFallbackAutoScroll); + off(document, 'mousemove', this._handleFallbackAutoScroll); + } + + clearPointerElemChangedInterval(); + clearAutoScrolls(); + cancelThrottle(); + }, + nulling: function nulling() { + touchEvt$1 = scrollRootEl = scrollEl = scrolling = pointerElemChangedInterval = lastAutoScrollX = lastAutoScrollY = null; + autoScrolls.length = 0; + }, + _handleFallbackAutoScroll: function _handleFallbackAutoScroll(evt) { + this._handleAutoScroll(evt, true); + }, + _handleAutoScroll: function _handleAutoScroll(evt, fallback) { + var _this = this; + + var x = (evt.touches ? evt.touches[0] : evt).clientX, + y = (evt.touches ? evt.touches[0] : evt).clientY, + elem = document.elementFromPoint(x, y); + touchEvt$1 = evt; // IE does not seem to have native autoscroll, + // Edge's autoscroll seems too conditional, + // MACOS Safari does not have autoscroll, + // Firefox and Chrome are good + + if (fallback || Edge || IE11OrLess || Safari) { + autoScroll(evt, this.options, elem, fallback); // Listener for pointer element change + + var ogElemScroller = getParentAutoScrollElement(elem, true); + + if (scrolling && (!pointerElemChangedInterval || x !== lastAutoScrollX || y !== lastAutoScrollY)) { + pointerElemChangedInterval && clearPointerElemChangedInterval(); // Detect for pointer elem change, emulating native DnD behaviour + + pointerElemChangedInterval = setInterval(function () { + var newElem = getParentAutoScrollElement(document.elementFromPoint(x, y), true); + + if (newElem !== ogElemScroller) { + ogElemScroller = newElem; + clearAutoScrolls(); + } + + autoScroll(evt, _this.options, newElem, fallback); + }, 10); + lastAutoScrollX = x; + lastAutoScrollY = y; + } + } else { + // if DnD is enabled (and browser has good autoscrolling), first autoscroll will already scroll, so get parent autoscroll of first autoscroll + if (!this.options.bubbleScroll || getParentAutoScrollElement(elem, true) === getWindowScrollingElement()) { + clearAutoScrolls(); + return; + } + + autoScroll(evt, this.options, getParentAutoScrollElement(elem, false), false); + } + } + }; + return _extends(AutoScroll, { + pluginName: 'scroll', + initializeByDefault: true + }); +} + +function clearAutoScrolls() { + autoScrolls.forEach(function (autoScroll) { + clearInterval(autoScroll.pid); + }); + autoScrolls = []; +} + +function clearPointerElemChangedInterval() { + clearInterval(pointerElemChangedInterval); +} + +var autoScroll = throttle(function (evt, options, rootEl, isFallback) { + // Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=505521 + if (!options.scroll) return; + var x = (evt.touches ? evt.touches[0] : evt).clientX, + y = (evt.touches ? evt.touches[0] : evt).clientY, + sens = options.scrollSensitivity, + speed = options.scrollSpeed, + winScroller = getWindowScrollingElement(); + var scrollThisInstance = false, + scrollCustomFn; // New scroll root, set scrollEl + + if (scrollRootEl !== rootEl) { + scrollRootEl = rootEl; + clearAutoScrolls(); + scrollEl = options.scroll; + scrollCustomFn = options.scrollFn; + + if (scrollEl === true) { + scrollEl = getParentAutoScrollElement(rootEl, true); + } + } + + var layersOut = 0; + var currentParent = scrollEl; + + do { + var el = currentParent, + rect = getRect(el), + top = rect.top, + bottom = rect.bottom, + left = rect.left, + right = rect.right, + width = rect.width, + height = rect.height, + canScrollX = void 0, + canScrollY = void 0, + scrollWidth = el.scrollWidth, + scrollHeight = el.scrollHeight, + elCSS = css(el), + scrollPosX = el.scrollLeft, + scrollPosY = el.scrollTop; + + if (el === winScroller) { + canScrollX = width < scrollWidth && (elCSS.overflowX === 'auto' || elCSS.overflowX === 'scroll' || elCSS.overflowX === 'visible'); + canScrollY = height < scrollHeight && (elCSS.overflowY === 'auto' || elCSS.overflowY === 'scroll' || elCSS.overflowY === 'visible'); + } else { + canScrollX = width < scrollWidth && (elCSS.overflowX === 'auto' || elCSS.overflowX === 'scroll'); + canScrollY = height < scrollHeight && (elCSS.overflowY === 'auto' || elCSS.overflowY === 'scroll'); + } + + var vx = canScrollX && (Math.abs(right - x) <= sens && scrollPosX + width < scrollWidth) - (Math.abs(left - x) <= sens && !!scrollPosX); + var vy = canScrollY && (Math.abs(bottom - y) <= sens && scrollPosY + height < scrollHeight) - (Math.abs(top - y) <= sens && !!scrollPosY); + + if (!autoScrolls[layersOut]) { + for (var i = 0; i <= layersOut; i++) { + if (!autoScrolls[i]) { + autoScrolls[i] = {}; + } + } + } + + if (autoScrolls[layersOut].vx != vx || autoScrolls[layersOut].vy != vy || autoScrolls[layersOut].el !== el) { + autoScrolls[layersOut].el = el; + autoScrolls[layersOut].vx = vx; + autoScrolls[layersOut].vy = vy; + clearInterval(autoScrolls[layersOut].pid); + + if (vx != 0 || vy != 0) { + scrollThisInstance = true; + /* jshint loopfunc:true */ + + autoScrolls[layersOut].pid = setInterval(function () { + // emulate drag over during autoscroll (fallback), emulating native DnD behaviour + if (isFallback && this.layer === 0) { + Sortable.active._onTouchMove(touchEvt$1); // To move ghost if it is positioned absolutely + + } + + var scrollOffsetY = autoScrolls[this.layer].vy ? autoScrolls[this.layer].vy * speed : 0; + var scrollOffsetX = autoScrolls[this.layer].vx ? autoScrolls[this.layer].vx * speed : 0; + + if (typeof scrollCustomFn === 'function') { + if (scrollCustomFn.call(Sortable.dragged.parentNode[expando], scrollOffsetX, scrollOffsetY, evt, touchEvt$1, autoScrolls[this.layer].el) !== 'continue') { + return; + } + } + + scrollBy(autoScrolls[this.layer].el, scrollOffsetX, scrollOffsetY); + }.bind({ + layer: layersOut + }), 24); + } + } + + layersOut++; + } while (options.bubbleScroll && currentParent !== winScroller && (currentParent = getParentAutoScrollElement(currentParent, false))); + + scrolling = scrollThisInstance; // in case another function catches scrolling as false in between when it is not +}, 30); + +var drop = function drop(_ref) { + var originalEvent = _ref.originalEvent, + putSortable = _ref.putSortable, + dragEl = _ref.dragEl, + activeSortable = _ref.activeSortable, + dispatchSortableEvent = _ref.dispatchSortableEvent, + hideGhostForTarget = _ref.hideGhostForTarget, + unhideGhostForTarget = _ref.unhideGhostForTarget; + if (!originalEvent) return; + var toSortable = putSortable || activeSortable; + hideGhostForTarget(); + var touch = originalEvent.changedTouches && originalEvent.changedTouches.length ? originalEvent.changedTouches[0] : originalEvent; + var target = document.elementFromPoint(touch.clientX, touch.clientY); + unhideGhostForTarget(); + + if (toSortable && !toSortable.el.contains(target)) { + dispatchSortableEvent('spill'); + this.onSpill({ + dragEl: dragEl, + putSortable: putSortable + }); + } +}; + +function Revert() {} + +Revert.prototype = { + startIndex: null, + dragStart: function dragStart(_ref2) { + var oldDraggableIndex = _ref2.oldDraggableIndex; + this.startIndex = oldDraggableIndex; + }, + onSpill: function onSpill(_ref3) { + var dragEl = _ref3.dragEl, + putSortable = _ref3.putSortable; + this.sortable.captureAnimationState(); + + if (putSortable) { + putSortable.captureAnimationState(); + } + + var nextSibling = getChild(this.sortable.el, this.startIndex, this.options); + + if (nextSibling) { + this.sortable.el.insertBefore(dragEl, nextSibling); + } else { + this.sortable.el.appendChild(dragEl); + } + + this.sortable.animateAll(); + + if (putSortable) { + putSortable.animateAll(); + } + }, + drop: drop +}; + +_extends(Revert, { + pluginName: 'revertOnSpill' +}); + +function Remove() {} + +Remove.prototype = { + onSpill: function onSpill(_ref4) { + var dragEl = _ref4.dragEl, + putSortable = _ref4.putSortable; + var parentSortable = putSortable || this.sortable; + parentSortable.captureAnimationState(); + dragEl.parentNode && dragEl.parentNode.removeChild(dragEl); + parentSortable.animateAll(); + }, + drop: drop +}; + +_extends(Remove, { + pluginName: 'removeOnSpill' +}); + +var lastSwapEl; + +function SwapPlugin() { + function Swap() { + this.defaults = { + swapClass: 'sortable-swap-highlight' + }; + } + + Swap.prototype = { + dragStart: function dragStart(_ref) { + var dragEl = _ref.dragEl; + lastSwapEl = dragEl; + }, + dragOverValid: function dragOverValid(_ref2) { + var completed = _ref2.completed, + target = _ref2.target, + onMove = _ref2.onMove, + activeSortable = _ref2.activeSortable, + changed = _ref2.changed, + cancel = _ref2.cancel; + if (!activeSortable.options.swap) return; + var el = this.sortable.el, + options = this.options; + + if (target && target !== el) { + var prevSwapEl = lastSwapEl; + + if (onMove(target) !== false) { + toggleClass(target, options.swapClass, true); + lastSwapEl = target; + } else { + lastSwapEl = null; + } + + if (prevSwapEl && prevSwapEl !== lastSwapEl) { + toggleClass(prevSwapEl, options.swapClass, false); + } + } + + changed(); + completed(true); + cancel(); + }, + drop: function drop(_ref3) { + var activeSortable = _ref3.activeSortable, + putSortable = _ref3.putSortable, + dragEl = _ref3.dragEl; + var toSortable = putSortable || this.sortable; + var options = this.options; + lastSwapEl && toggleClass(lastSwapEl, options.swapClass, false); + + if (lastSwapEl && (options.swap || putSortable && putSortable.options.swap)) { + if (dragEl !== lastSwapEl) { + toSortable.captureAnimationState(); + if (toSortable !== activeSortable) activeSortable.captureAnimationState(); + swapNodes(dragEl, lastSwapEl); + toSortable.animateAll(); + if (toSortable !== activeSortable) activeSortable.animateAll(); + } + } + }, + nulling: function nulling() { + lastSwapEl = null; + } + }; + return _extends(Swap, { + pluginName: 'swap', + eventProperties: function eventProperties() { + return { + swapItem: lastSwapEl + }; + } + }); +} + +function swapNodes(n1, n2) { + var p1 = n1.parentNode, + p2 = n2.parentNode, + i1, + i2; + if (!p1 || !p2 || p1.isEqualNode(n2) || p2.isEqualNode(n1)) return; + i1 = index(n1); + i2 = index(n2); + + if (p1.isEqualNode(p2) && i1 < i2) { + i2++; + } + + p1.insertBefore(n2, p1.children[i1]); + p2.insertBefore(n1, p2.children[i2]); +} + +var multiDragElements = [], + multiDragClones = [], + lastMultiDragSelect, + // for selection with modifier key down (SHIFT) +multiDragSortable, + initialFolding = false, + // Initial multi-drag fold when drag started +folding = false, + // Folding any other time +dragStarted = false, + dragEl$1, + clonesFromRect, + clonesHidden; + +function MultiDragPlugin() { + function MultiDrag(sortable) { + // Bind all private methods + for (var fn in this) { + if (fn.charAt(0) === '_' && typeof this[fn] === 'function') { + this[fn] = this[fn].bind(this); + } + } + + if (sortable.options.supportPointer) { + on(document, 'pointerup', this._deselectMultiDrag); + } else { + on(document, 'mouseup', this._deselectMultiDrag); + on(document, 'touchend', this._deselectMultiDrag); + } + + on(document, 'keydown', this._checkKeyDown); + on(document, 'keyup', this._checkKeyUp); + this.defaults = { + selectedClass: 'sortable-selected', + multiDragKey: null, + setData: function setData(dataTransfer, dragEl) { + var data = ''; + + if (multiDragElements.length && multiDragSortable === sortable) { + multiDragElements.forEach(function (multiDragElement, i) { + data += (!i ? '' : ', ') + multiDragElement.textContent; + }); + } else { + data = dragEl.textContent; + } + + dataTransfer.setData('Text', data); + } + }; + } + + MultiDrag.prototype = { + multiDragKeyDown: false, + isMultiDrag: false, + delayStartGlobal: function delayStartGlobal(_ref) { + var dragged = _ref.dragEl; + dragEl$1 = dragged; + }, + delayEnded: function delayEnded() { + this.isMultiDrag = ~multiDragElements.indexOf(dragEl$1); + }, + setupClone: function setupClone(_ref2) { + var sortable = _ref2.sortable, + cancel = _ref2.cancel; + if (!this.isMultiDrag) return; + + for (var i = 0; i < multiDragElements.length; i++) { + multiDragClones.push(clone(multiDragElements[i])); + multiDragClones[i].sortableIndex = multiDragElements[i].sortableIndex; + multiDragClones[i].draggable = false; + multiDragClones[i].style['will-change'] = ''; + toggleClass(multiDragClones[i], this.options.selectedClass, false); + multiDragElements[i] === dragEl$1 && toggleClass(multiDragClones[i], this.options.chosenClass, false); + } + + sortable._hideClone(); + + cancel(); + }, + clone: function clone(_ref3) { + var sortable = _ref3.sortable, + rootEl = _ref3.rootEl, + dispatchSortableEvent = _ref3.dispatchSortableEvent, + cancel = _ref3.cancel; + if (!this.isMultiDrag) return; + + if (!this.options.removeCloneOnHide) { + if (multiDragElements.length && multiDragSortable === sortable) { + insertMultiDragClones(true, rootEl); + dispatchSortableEvent('clone'); + cancel(); + } + } + }, + showClone: function showClone(_ref4) { + var cloneNowShown = _ref4.cloneNowShown, + rootEl = _ref4.rootEl, + cancel = _ref4.cancel; + if (!this.isMultiDrag) return; + insertMultiDragClones(false, rootEl); + multiDragClones.forEach(function (clone) { + css(clone, 'display', ''); + }); + cloneNowShown(); + clonesHidden = false; + cancel(); + }, + hideClone: function hideClone(_ref5) { + var _this = this; + + var sortable = _ref5.sortable, + cloneNowHidden = _ref5.cloneNowHidden, + cancel = _ref5.cancel; + if (!this.isMultiDrag) return; + multiDragClones.forEach(function (clone) { + css(clone, 'display', 'none'); + + if (_this.options.removeCloneOnHide && clone.parentNode) { + clone.parentNode.removeChild(clone); + } + }); + cloneNowHidden(); + clonesHidden = true; + cancel(); + }, + dragStartGlobal: function dragStartGlobal(_ref6) { + var sortable = _ref6.sortable; + + if (!this.isMultiDrag && multiDragSortable) { + multiDragSortable.multiDrag._deselectMultiDrag(); + } + + multiDragElements.forEach(function (multiDragElement) { + multiDragElement.sortableIndex = index(multiDragElement); + }); // Sort multi-drag elements + + multiDragElements = multiDragElements.sort(function (a, b) { + return a.sortableIndex - b.sortableIndex; + }); + dragStarted = true; + }, + dragStarted: function dragStarted(_ref7) { + var _this2 = this; + + var sortable = _ref7.sortable; + if (!this.isMultiDrag) return; + + if (this.options.sort) { + // Capture rects, + // hide multi drag elements (by positioning them absolute), + // set multi drag elements rects to dragRect, + // show multi drag elements, + // animate to rects, + // unset rects & remove from DOM + sortable.captureAnimationState(); + + if (this.options.animation) { + multiDragElements.forEach(function (multiDragElement) { + if (multiDragElement === dragEl$1) return; + css(multiDragElement, 'position', 'absolute'); + }); + var dragRect = getRect(dragEl$1, false, true, true); + multiDragElements.forEach(function (multiDragElement) { + if (multiDragElement === dragEl$1) return; + setRect(multiDragElement, dragRect); + }); + folding = true; + initialFolding = true; + } + } + + sortable.animateAll(function () { + folding = false; + initialFolding = false; + + if (_this2.options.animation) { + multiDragElements.forEach(function (multiDragElement) { + unsetRect(multiDragElement); + }); + } // Remove all auxiliary multidrag items from el, if sorting enabled + + + if (_this2.options.sort) { + removeMultiDragElements(); + } + }); + }, + dragOver: function dragOver(_ref8) { + var target = _ref8.target, + completed = _ref8.completed, + cancel = _ref8.cancel; + + if (folding && ~multiDragElements.indexOf(target)) { + completed(false); + cancel(); + } + }, + revert: function revert(_ref9) { + var fromSortable = _ref9.fromSortable, + rootEl = _ref9.rootEl, + sortable = _ref9.sortable, + dragRect = _ref9.dragRect; + + if (multiDragElements.length > 1) { + // Setup unfold animation + multiDragElements.forEach(function (multiDragElement) { + sortable.addAnimationState({ + target: multiDragElement, + rect: folding ? getRect(multiDragElement) : dragRect + }); + unsetRect(multiDragElement); + multiDragElement.fromRect = dragRect; + fromSortable.removeAnimationState(multiDragElement); + }); + folding = false; + insertMultiDragElements(!this.options.removeCloneOnHide, rootEl); + } + }, + dragOverCompleted: function dragOverCompleted(_ref10) { + var sortable = _ref10.sortable, + isOwner = _ref10.isOwner, + insertion = _ref10.insertion, + activeSortable = _ref10.activeSortable, + parentEl = _ref10.parentEl, + putSortable = _ref10.putSortable; + var options = this.options; + + if (insertion) { + // Clones must be hidden before folding animation to capture dragRectAbsolute properly + if (isOwner) { + activeSortable._hideClone(); + } + + initialFolding = false; // If leaving sort:false root, or already folding - Fold to new location + + if (options.animation && multiDragElements.length > 1 && (folding || !isOwner && !activeSortable.options.sort && !putSortable)) { + // Fold: Set all multi drag elements's rects to dragEl's rect when multi-drag elements are invisible + var dragRectAbsolute = getRect(dragEl$1, false, true, true); + multiDragElements.forEach(function (multiDragElement) { + if (multiDragElement === dragEl$1) return; + setRect(multiDragElement, dragRectAbsolute); // Move element(s) to end of parentEl so that it does not interfere with multi-drag clones insertion if they are inserted + // while folding, and so that we can capture them again because old sortable will no longer be fromSortable + + parentEl.appendChild(multiDragElement); + }); + folding = true; + } // Clones must be shown (and check to remove multi drags) after folding when interfering multiDragElements are moved out + + + if (!isOwner) { + // Only remove if not folding (folding will remove them anyways) + if (!folding) { + removeMultiDragElements(); + } + + if (multiDragElements.length > 1) { + var clonesHiddenBefore = clonesHidden; + + activeSortable._showClone(sortable); // Unfold animation for clones if showing from hidden + + + if (activeSortable.options.animation && !clonesHidden && clonesHiddenBefore) { + multiDragClones.forEach(function (clone) { + activeSortable.addAnimationState({ + target: clone, + rect: clonesFromRect + }); + clone.fromRect = clonesFromRect; + clone.thisAnimationDuration = null; + }); + } + } else { + activeSortable._showClone(sortable); + } + } + } + }, + dragOverAnimationCapture: function dragOverAnimationCapture(_ref11) { + var dragRect = _ref11.dragRect, + isOwner = _ref11.isOwner, + activeSortable = _ref11.activeSortable; + multiDragElements.forEach(function (multiDragElement) { + multiDragElement.thisAnimationDuration = null; + }); + + if (activeSortable.options.animation && !isOwner && activeSortable.multiDrag.isMultiDrag) { + clonesFromRect = _extends({}, dragRect); + var dragMatrix = matrix(dragEl$1, true); + clonesFromRect.top -= dragMatrix.f; + clonesFromRect.left -= dragMatrix.e; + } + }, + dragOverAnimationComplete: function dragOverAnimationComplete() { + if (folding) { + folding = false; + removeMultiDragElements(); + } + }, + drop: function drop(_ref12) { + var evt = _ref12.originalEvent, + rootEl = _ref12.rootEl, + parentEl = _ref12.parentEl, + sortable = _ref12.sortable, + dispatchSortableEvent = _ref12.dispatchSortableEvent, + oldIndex = _ref12.oldIndex, + putSortable = _ref12.putSortable; + var toSortable = putSortable || this.sortable; + if (!evt) return; + var options = this.options, + children = parentEl.children; // Multi-drag selection + + if (!dragStarted) { + if (options.multiDragKey && !this.multiDragKeyDown) { + this._deselectMultiDrag(); + } + + toggleClass(dragEl$1, options.selectedClass, !~multiDragElements.indexOf(dragEl$1)); + + if (!~multiDragElements.indexOf(dragEl$1)) { + multiDragElements.push(dragEl$1); + dispatchEvent({ + sortable: sortable, + rootEl: rootEl, + name: 'select', + targetEl: dragEl$1, + originalEvt: evt + }); // Modifier activated, select from last to dragEl + + if (evt.shiftKey && lastMultiDragSelect && sortable.el.contains(lastMultiDragSelect)) { + var lastIndex = index(lastMultiDragSelect), + currentIndex = index(dragEl$1); + + if (~lastIndex && ~currentIndex && lastIndex !== currentIndex) { + // Must include lastMultiDragSelect (select it), in case modified selection from no selection + // (but previous selection existed) + var n, i; + + if (currentIndex > lastIndex) { + i = lastIndex; + n = currentIndex; + } else { + i = currentIndex; + n = lastIndex + 1; + } + + for (; i < n; i++) { + if (~multiDragElements.indexOf(children[i])) continue; + toggleClass(children[i], options.selectedClass, true); + multiDragElements.push(children[i]); + dispatchEvent({ + sortable: sortable, + rootEl: rootEl, + name: 'select', + targetEl: children[i], + originalEvt: evt + }); + } + } + } else { + lastMultiDragSelect = dragEl$1; + } + + multiDragSortable = toSortable; + } else { + multiDragElements.splice(multiDragElements.indexOf(dragEl$1), 1); + lastMultiDragSelect = null; + dispatchEvent({ + sortable: sortable, + rootEl: rootEl, + name: 'deselect', + targetEl: dragEl$1, + originalEvt: evt + }); + } + } // Multi-drag drop + + + if (dragStarted && this.isMultiDrag) { + // Do not "unfold" after around dragEl if reverted + if ((parentEl[expando].options.sort || parentEl !== rootEl) && multiDragElements.length > 1) { + var dragRect = getRect(dragEl$1), + multiDragIndex = index(dragEl$1, ':not(.' + this.options.selectedClass + ')'); + if (!initialFolding && options.animation) dragEl$1.thisAnimationDuration = null; + toSortable.captureAnimationState(); + + if (!initialFolding) { + if (options.animation) { + dragEl$1.fromRect = dragRect; + multiDragElements.forEach(function (multiDragElement) { + multiDragElement.thisAnimationDuration = null; + + if (multiDragElement !== dragEl$1) { + var rect = folding ? getRect(multiDragElement) : dragRect; + multiDragElement.fromRect = rect; // Prepare unfold animation + + toSortable.addAnimationState({ + target: multiDragElement, + rect: rect + }); + } + }); + } // Multi drag elements are not necessarily removed from the DOM on drop, so to reinsert + // properly they must all be removed + + + removeMultiDragElements(); + multiDragElements.forEach(function (multiDragElement) { + if (children[multiDragIndex]) { + parentEl.insertBefore(multiDragElement, children[multiDragIndex]); + } else { + parentEl.appendChild(multiDragElement); + } + + multiDragIndex++; + }); // If initial folding is done, the elements may have changed position because they are now + // unfolding around dragEl, even though dragEl may not have his index changed, so update event + // must be fired here as Sortable will not. + + if (oldIndex === index(dragEl$1)) { + var update = false; + multiDragElements.forEach(function (multiDragElement) { + if (multiDragElement.sortableIndex !== index(multiDragElement)) { + update = true; + return; + } + }); + + if (update) { + dispatchSortableEvent('update'); + } + } + } // Must be done after capturing individual rects (scroll bar) + + + multiDragElements.forEach(function (multiDragElement) { + unsetRect(multiDragElement); + }); + toSortable.animateAll(); + } + + multiDragSortable = toSortable; + } // Remove clones if necessary + + + if (rootEl === parentEl || putSortable && putSortable.lastPutMode !== 'clone') { + multiDragClones.forEach(function (clone) { + clone.parentNode && clone.parentNode.removeChild(clone); + }); + } + }, + nullingGlobal: function nullingGlobal() { + this.isMultiDrag = dragStarted = false; + multiDragClones.length = 0; + }, + destroyGlobal: function destroyGlobal() { + this._deselectMultiDrag(); + + off(document, 'pointerup', this._deselectMultiDrag); + off(document, 'mouseup', this._deselectMultiDrag); + off(document, 'touchend', this._deselectMultiDrag); + off(document, 'keydown', this._checkKeyDown); + off(document, 'keyup', this._checkKeyUp); + }, + _deselectMultiDrag: function _deselectMultiDrag(evt) { + if (typeof dragStarted !== "undefined" && dragStarted) return; // Only deselect if selection is in this sortable + + if (multiDragSortable !== this.sortable) return; // Only deselect if target is not item in this sortable + + if (evt && closest(evt.target, this.options.draggable, this.sortable.el, false)) return; // Only deselect if left click + + if (evt && evt.button !== 0) return; + + while (multiDragElements.length) { + var el = multiDragElements[0]; + toggleClass(el, this.options.selectedClass, false); + multiDragElements.shift(); + dispatchEvent({ + sortable: this.sortable, + rootEl: this.sortable.el, + name: 'deselect', + targetEl: el, + originalEvt: evt + }); + } + }, + _checkKeyDown: function _checkKeyDown(evt) { + if (evt.key === this.options.multiDragKey) { + this.multiDragKeyDown = true; + } + }, + _checkKeyUp: function _checkKeyUp(evt) { + if (evt.key === this.options.multiDragKey) { + this.multiDragKeyDown = false; + } + } + }; + return _extends(MultiDrag, { + // Static methods & properties + pluginName: 'multiDrag', + utils: { + /** + * Selects the provided multi-drag item + * @param {HTMLElement} el The element to be selected + */ + select: function select(el) { + var sortable = el.parentNode[expando]; + if (!sortable || !sortable.options.multiDrag || ~multiDragElements.indexOf(el)) return; + + if (multiDragSortable && multiDragSortable !== sortable) { + multiDragSortable.multiDrag._deselectMultiDrag(); + + multiDragSortable = sortable; + } + + toggleClass(el, sortable.options.selectedClass, true); + multiDragElements.push(el); + }, + + /** + * Deselects the provided multi-drag item + * @param {HTMLElement} el The element to be deselected + */ + deselect: function deselect(el) { + var sortable = el.parentNode[expando], + index = multiDragElements.indexOf(el); + if (!sortable || !sortable.options.multiDrag || !~index) return; + toggleClass(el, sortable.options.selectedClass, false); + multiDragElements.splice(index, 1); + } + }, + eventProperties: function eventProperties() { + var _this3 = this; + + var oldIndicies = [], + newIndicies = []; + multiDragElements.forEach(function (multiDragElement) { + oldIndicies.push({ + multiDragElement: multiDragElement, + index: multiDragElement.sortableIndex + }); // multiDragElements will already be sorted if folding + + var newIndex; + + if (folding && multiDragElement !== dragEl$1) { + newIndex = -1; + } else if (folding) { + newIndex = index(multiDragElement, ':not(.' + _this3.options.selectedClass + ')'); + } else { + newIndex = index(multiDragElement); + } + + newIndicies.push({ + multiDragElement: multiDragElement, + index: newIndex + }); + }); + return { + items: _toConsumableArray(multiDragElements), + clones: [].concat(multiDragClones), + oldIndicies: oldIndicies, + newIndicies: newIndicies + }; + }, + optionListeners: { + multiDragKey: function multiDragKey(key) { + key = key.toLowerCase(); + + if (key === 'ctrl') { + key = 'Control'; + } else if (key.length > 1) { + key = key.charAt(0).toUpperCase() + key.substr(1); + } + + return key; + } + } + }); +} + +function insertMultiDragElements(clonesInserted, rootEl) { + multiDragElements.forEach(function (multiDragElement, i) { + var target = rootEl.children[multiDragElement.sortableIndex + (clonesInserted ? Number(i) : 0)]; + + if (target) { + rootEl.insertBefore(multiDragElement, target); + } else { + rootEl.appendChild(multiDragElement); + } + }); +} +/** + * Insert multi-drag clones + * @param {[Boolean]} elementsInserted Whether the multi-drag elements are inserted + * @param {HTMLElement} rootEl + */ + + +function insertMultiDragClones(elementsInserted, rootEl) { + multiDragClones.forEach(function (clone, i) { + var target = rootEl.children[clone.sortableIndex + (elementsInserted ? Number(i) : 0)]; + + if (target) { + rootEl.insertBefore(clone, target); + } else { + rootEl.appendChild(clone); + } + }); +} + +function removeMultiDragElements() { + multiDragElements.forEach(function (multiDragElement) { + if (multiDragElement === dragEl$1) return; + multiDragElement.parentNode && multiDragElement.parentNode.removeChild(multiDragElement); + }); +} + +Sortable.mount(new AutoScrollPlugin()); +Sortable.mount(Remove, Revert); + +export default Sortable; +export { MultiDragPlugin as MultiDrag, Sortable, SwapPlugin as Swap }; diff --git a/public/assets/libs/Sortable/package-lock.json b/public/assets/libs/Sortable/package-lock.json new file mode 100644 index 0000000..dbc696b --- /dev/null +++ b/public/assets/libs/Sortable/package-lock.json @@ -0,0 +1,5704 @@ +{ + "name": "sortablejs", + "version": "1.10.1", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "@babel/code-frame": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.0.0.tgz", + "integrity": "sha512-OfC2uemaknXr87bdLUkWog7nYuliM9Ij5HUcajsVcMCpQrcLmtxRbVFTIqmcSkSeYRBFBRxs2FiUqFJDLdiebA==", + "dev": true, + "requires": { + "@babel/highlight": "^7.0.0" + } + }, + "@babel/core": { + "version": "7.4.5", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.4.5.tgz", + "integrity": "sha512-OvjIh6aqXtlsA8ujtGKfC7LYWksYSX8yQcM8Ay3LuvVeQ63lcOKgoZWVqcpFwkd29aYU9rVx7jxhfhiEDV9MZA==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.0.0", + "@babel/generator": "^7.4.4", + "@babel/helpers": "^7.4.4", + "@babel/parser": "^7.4.5", + "@babel/template": "^7.4.4", + "@babel/traverse": "^7.4.5", + "@babel/types": "^7.4.4", + "convert-source-map": "^1.1.0", + "debug": "^4.1.0", + "json5": "^2.1.0", + "lodash": "^4.17.11", + "resolve": "^1.3.2", + "semver": "^5.4.1", + "source-map": "^0.5.0" + } + }, + "@babel/generator": { + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.4.4.tgz", + "integrity": "sha512-53UOLK6TVNqKxf7RUh8NE851EHRxOOeVXKbK2bivdb+iziMyk03Sr4eaE9OELCbyZAAafAKPDwF2TPUES5QbxQ==", + "dev": true, + "requires": { + "@babel/types": "^7.4.4", + "jsesc": "^2.5.1", + "lodash": "^4.17.11", + "source-map": "^0.5.0", + "trim-right": "^1.0.1" + } + }, + "@babel/helper-annotate-as-pure": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.0.0.tgz", + "integrity": "sha512-3UYcJUj9kvSLbLbUIfQTqzcy5VX7GRZ/CCDrnOaZorFFM01aXp1+GJwuFGV4NDDoAS+mOUyHcO6UD/RfqOks3Q==", + "dev": true, + "requires": { + "@babel/types": "^7.0.0" + } + }, + "@babel/helper-builder-binary-assignment-operator-visitor": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/@babel/helper-builder-binary-assignment-operator-visitor/-/helper-builder-binary-assignment-operator-visitor-7.1.0.tgz", + "integrity": "sha512-qNSR4jrmJ8M1VMM9tibvyRAHXQs2PmaksQF7c1CGJNipfe3D8p+wgNwgso/P2A2r2mdgBWAXljNWR0QRZAMW8w==", + "dev": true, + "requires": { + "@babel/helper-explode-assignable-expression": "^7.1.0", + "@babel/types": "^7.0.0" + } + }, + "@babel/helper-call-delegate": { + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@babel/helper-call-delegate/-/helper-call-delegate-7.4.4.tgz", + "integrity": "sha512-l79boDFJ8S1c5hvQvG+rc+wHw6IuH7YldmRKsYtpbawsxURu/paVy57FZMomGK22/JckepaikOkY0MoAmdyOlQ==", + "dev": true, + "requires": { + "@babel/helper-hoist-variables": "^7.4.4", + "@babel/traverse": "^7.4.4", + "@babel/types": "^7.4.4" + } + }, + "@babel/helper-define-map": { + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@babel/helper-define-map/-/helper-define-map-7.4.4.tgz", + "integrity": "sha512-IX3Ln8gLhZpSuqHJSnTNBWGDE9kdkTEWl21A/K7PQ00tseBwbqCHTvNLHSBd9M0R5rER4h5Rsvj9vw0R5SieBg==", + "dev": true, + "requires": { + "@babel/helper-function-name": "^7.1.0", + "@babel/types": "^7.4.4", + "lodash": "^4.17.11" + } + }, + "@babel/helper-explode-assignable-expression": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/@babel/helper-explode-assignable-expression/-/helper-explode-assignable-expression-7.1.0.tgz", + "integrity": "sha512-NRQpfHrJ1msCHtKjbzs9YcMmJZOg6mQMmGRB+hbamEdG5PNpaSm95275VD92DvJKuyl0s2sFiDmMZ+EnnvufqA==", + "dev": true, + "requires": { + "@babel/traverse": "^7.1.0", + "@babel/types": "^7.0.0" + } + }, + "@babel/helper-function-name": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.1.0.tgz", + "integrity": "sha512-A95XEoCpb3TO+KZzJ4S/5uW5fNe26DjBGqf1o9ucyLyCmi1dXq/B3c8iaWTfBk3VvetUxl16e8tIrd5teOCfGw==", + "dev": true, + "requires": { + "@babel/helper-get-function-arity": "^7.0.0", + "@babel/template": "^7.1.0", + "@babel/types": "^7.0.0" + } + }, + "@babel/helper-get-function-arity": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.0.0.tgz", + "integrity": "sha512-r2DbJeg4svYvt3HOS74U4eWKsUAMRH01Z1ds1zx8KNTPtpTL5JAsdFv8BNyOpVqdFhHkkRDIg5B4AsxmkjAlmQ==", + "dev": true, + "requires": { + "@babel/types": "^7.0.0" + } + }, + "@babel/helper-hoist-variables": { + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.4.4.tgz", + "integrity": "sha512-VYk2/H/BnYbZDDg39hr3t2kKyifAm1W6zHRfhx8jGjIHpQEBv9dry7oQ2f3+J703TLu69nYdxsovl0XYfcnK4w==", + "dev": true, + "requires": { + "@babel/types": "^7.4.4" + } + }, + "@babel/helper-member-expression-to-functions": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.0.0.tgz", + "integrity": "sha512-avo+lm/QmZlv27Zsi0xEor2fKcqWG56D5ae9dzklpIaY7cQMK5N8VSpaNVPPagiqmy7LrEjK1IWdGMOqPu5csg==", + "dev": true, + "requires": { + "@babel/types": "^7.0.0" + } + }, + "@babel/helper-module-imports": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.0.0.tgz", + "integrity": "sha512-aP/hlLq01DWNEiDg4Jn23i+CXxW/owM4WpDLFUbpjxe4NS3BhLVZQ5i7E0ZrxuQ/vwekIeciyamgB1UIYxxM6A==", + "dev": true, + "requires": { + "@babel/types": "^7.0.0" + } + }, + "@babel/helper-module-transforms": { + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.4.4.tgz", + "integrity": "sha512-3Z1yp8TVQf+B4ynN7WoHPKS8EkdTbgAEy0nU0rs/1Kw4pDgmvYH3rz3aI11KgxKCba2cn7N+tqzV1mY2HMN96w==", + "dev": true, + "requires": { + "@babel/helper-module-imports": "^7.0.0", + "@babel/helper-simple-access": "^7.1.0", + "@babel/helper-split-export-declaration": "^7.4.4", + "@babel/template": "^7.4.4", + "@babel/types": "^7.4.4", + "lodash": "^4.17.11" + } + }, + "@babel/helper-optimise-call-expression": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.0.0.tgz", + "integrity": "sha512-u8nd9NQePYNQV8iPWu/pLLYBqZBa4ZaY1YWRFMuxrid94wKI1QNt67NEZ7GAe5Kc/0LLScbim05xZFWkAdrj9g==", + "dev": true, + "requires": { + "@babel/types": "^7.0.0" + } + }, + "@babel/helper-plugin-utils": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.0.0.tgz", + "integrity": "sha512-CYAOUCARwExnEixLdB6sDm2dIJ/YgEAKDM1MOeMeZu9Ld/bDgVo8aiWrXwcY7OBh+1Ea2uUcVRcxKk0GJvW7QA==", + "dev": true + }, + "@babel/helper-regex": { + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@babel/helper-regex/-/helper-regex-7.4.4.tgz", + "integrity": "sha512-Y5nuB/kESmR3tKjU8Nkn1wMGEx1tjJX076HBMeL3XLQCu6vA/YRzuTW0bbb+qRnXvQGn+d6Rx953yffl8vEy7Q==", + "dev": true, + "requires": { + "lodash": "^4.17.11" + } + }, + "@babel/helper-remap-async-to-generator": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/@babel/helper-remap-async-to-generator/-/helper-remap-async-to-generator-7.1.0.tgz", + "integrity": "sha512-3fOK0L+Fdlg8S5al8u/hWE6vhufGSn0bN09xm2LXMy//REAF8kDCrYoOBKYmA8m5Nom+sV9LyLCwrFynA8/slg==", + "dev": true, + "requires": { + "@babel/helper-annotate-as-pure": "^7.0.0", + "@babel/helper-wrap-function": "^7.1.0", + "@babel/template": "^7.1.0", + "@babel/traverse": "^7.1.0", + "@babel/types": "^7.0.0" + } + }, + "@babel/helper-replace-supers": { + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.4.4.tgz", + "integrity": "sha512-04xGEnd+s01nY1l15EuMS1rfKktNF+1CkKmHoErDppjAAZL+IUBZpzT748x262HF7fibaQPhbvWUl5HeSt1EXg==", + "dev": true, + "requires": { + "@babel/helper-member-expression-to-functions": "^7.0.0", + "@babel/helper-optimise-call-expression": "^7.0.0", + "@babel/traverse": "^7.4.4", + "@babel/types": "^7.4.4" + } + }, + "@babel/helper-simple-access": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.1.0.tgz", + "integrity": "sha512-Vk+78hNjRbsiu49zAPALxTb+JUQCz1aolpd8osOF16BGnLtseD21nbHgLPGUwrXEurZgiCOUmvs3ExTu4F5x6w==", + "dev": true, + "requires": { + "@babel/template": "^7.1.0", + "@babel/types": "^7.0.0" + } + }, + "@babel/helper-split-export-declaration": { + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.4.4.tgz", + "integrity": "sha512-Ro/XkzLf3JFITkW6b+hNxzZ1n5OQ80NvIUdmHspih1XAhtN3vPTuUFT4eQnela+2MaZ5ulH+iyP513KJrxbN7Q==", + "dev": true, + "requires": { + "@babel/types": "^7.4.4" + } + }, + "@babel/helper-wrap-function": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/@babel/helper-wrap-function/-/helper-wrap-function-7.2.0.tgz", + "integrity": "sha512-o9fP1BZLLSrYlxYEYyl2aS+Flun5gtjTIG8iln+XuEzQTs0PLagAGSXUcqruJwD5fM48jzIEggCKpIfWTcR7pQ==", + "dev": true, + "requires": { + "@babel/helper-function-name": "^7.1.0", + "@babel/template": "^7.1.0", + "@babel/traverse": "^7.1.0", + "@babel/types": "^7.2.0" + } + }, + "@babel/helpers": { + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.4.4.tgz", + "integrity": "sha512-igczbR/0SeuPR8RFfC7tGrbdTbFL3QTvH6D+Z6zNxnTe//GyqmtHmDkzrqDmyZ3eSwPqB/LhyKoU5DXsp+Vp2A==", + "dev": true, + "requires": { + "@babel/template": "^7.4.4", + "@babel/traverse": "^7.4.4", + "@babel/types": "^7.4.4" + } + }, + "@babel/highlight": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.0.0.tgz", + "integrity": "sha512-UFMC4ZeFC48Tpvj7C8UgLvtkaUuovQX+5xNWrsIoMG8o2z+XFKjKaN9iVmS84dPwVN00W4wPmqvYoZF3EGAsfw==", + "dev": true, + "requires": { + "chalk": "^2.0.0", + "esutils": "^2.0.2", + "js-tokens": "^4.0.0" + } + }, + "@babel/parser": { + "version": "7.4.5", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.4.5.tgz", + "integrity": "sha512-9mUqkL1FF5T7f0WDFfAoDdiMVPWsdD1gZYzSnaXsxUCUqzuch/8of9G3VUSNiZmMBoRxT3neyVsqeiL/ZPcjew==", + "dev": true + }, + "@babel/plugin-proposal-async-generator-functions": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.2.0.tgz", + "integrity": "sha512-+Dfo/SCQqrwx48ptLVGLdE39YtWRuKc/Y9I5Fy0P1DDBB9lsAHpjcEJQt+4IifuSOSTLBKJObJqMvaO1pIE8LQ==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.0.0", + "@babel/helper-remap-async-to-generator": "^7.1.0", + "@babel/plugin-syntax-async-generators": "^7.2.0" + } + }, + "@babel/plugin-proposal-json-strings": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-json-strings/-/plugin-proposal-json-strings-7.2.0.tgz", + "integrity": "sha512-MAFV1CA/YVmYwZG0fBQyXhmj0BHCB5egZHCKWIFVv/XCxAeVGIHfos3SwDck4LvCllENIAg7xMKOG5kH0dzyUg==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.0.0", + "@babel/plugin-syntax-json-strings": "^7.2.0" + } + }, + "@babel/plugin-proposal-object-rest-spread": { + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.4.4.tgz", + "integrity": "sha512-dMBG6cSPBbHeEBdFXeQ2QLc5gUpg4Vkaz8octD4aoW/ISO+jBOcsuxYL7bsb5WSu8RLP6boxrBIALEHgoHtO9g==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.0.0", + "@babel/plugin-syntax-object-rest-spread": "^7.2.0" + } + }, + "@babel/plugin-proposal-optional-catch-binding": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-optional-catch-binding/-/plugin-proposal-optional-catch-binding-7.2.0.tgz", + "integrity": "sha512-mgYj3jCcxug6KUcX4OBoOJz3CMrwRfQELPQ5560F70YQUBZB7uac9fqaWamKR1iWUzGiK2t0ygzjTScZnVz75g==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.0.0", + "@babel/plugin-syntax-optional-catch-binding": "^7.2.0" + } + }, + "@babel/plugin-proposal-unicode-property-regex": { + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-unicode-property-regex/-/plugin-proposal-unicode-property-regex-7.4.4.tgz", + "integrity": "sha512-j1NwnOqMG9mFUOH58JTFsA/+ZYzQLUZ/drqWUqxCYLGeu2JFZL8YrNC9hBxKmWtAuOCHPcRpgv7fhap09Fb4kA==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.0.0", + "@babel/helper-regex": "^7.4.4", + "regexpu-core": "^4.5.4" + } + }, + "@babel/plugin-syntax-async-generators": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.2.0.tgz", + "integrity": "sha512-1ZrIRBv2t0GSlcwVoQ6VgSLpLgiN/FVQUzt9znxo7v2Ov4jJrs8RY8tv0wvDmFN3qIdMKWrmMMW6yZ0G19MfGg==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.0.0" + } + }, + "@babel/plugin-syntax-json-strings": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.2.0.tgz", + "integrity": "sha512-5UGYnMSLRE1dqqZwug+1LISpA403HzlSfsg6P9VXU6TBjcSHeNlw4DxDx7LgpF+iKZoOG/+uzqoRHTdcUpiZNg==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.0.0" + } + }, + "@babel/plugin-syntax-object-rest-spread": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.2.0.tgz", + "integrity": "sha512-t0JKGgqk2We+9may3t0xDdmneaXmyxq0xieYcKHxIsrJO64n1OiMWNUtc5gQK1PA0NpdCRrtZp4z+IUaKugrSA==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.0.0" + } + }, + "@babel/plugin-syntax-optional-catch-binding": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.2.0.tgz", + "integrity": "sha512-bDe4xKNhb0LI7IvZHiA13kff0KEfaGX/Hv4lMA9+7TEc63hMNvfKo6ZFpXhKuEp+II/q35Gc4NoMeDZyaUbj9w==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.0.0" + } + }, + "@babel/plugin-transform-arrow-functions": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.2.0.tgz", + "integrity": "sha512-ER77Cax1+8/8jCB9fo4Ud161OZzWN5qawi4GusDuRLcDbDG+bIGYY20zb2dfAFdTRGzrfq2xZPvF0R64EHnimg==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.0.0" + } + }, + "@babel/plugin-transform-async-to-generator": { + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.4.4.tgz", + "integrity": "sha512-YiqW2Li8TXmzgbXw+STsSqPBPFnGviiaSp6CYOq55X8GQ2SGVLrXB6pNid8HkqkZAzOH6knbai3snhP7v0fNwA==", + "dev": true, + "requires": { + "@babel/helper-module-imports": "^7.0.0", + "@babel/helper-plugin-utils": "^7.0.0", + "@babel/helper-remap-async-to-generator": "^7.1.0" + } + }, + "@babel/plugin-transform-block-scoped-functions": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.2.0.tgz", + "integrity": "sha512-ntQPR6q1/NKuphly49+QiQiTN0O63uOwjdD6dhIjSWBI5xlrbUFh720TIpzBhpnrLfv2tNH/BXvLIab1+BAI0w==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.0.0" + } + }, + "@babel/plugin-transform-block-scoping": { + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.4.4.tgz", + "integrity": "sha512-jkTUyWZcTrwxu5DD4rWz6rDB5Cjdmgz6z7M7RLXOJyCUkFBawssDGcGh8M/0FTSB87avyJI1HsTwUXp9nKA1PA==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.0.0", + "lodash": "^4.17.11" + } + }, + "@babel/plugin-transform-classes": { + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-classes/-/plugin-transform-classes-7.4.4.tgz", + "integrity": "sha512-/e44eFLImEGIpL9qPxSRat13I5QNRgBLu2hOQJCF7VLy/otSM/sypV1+XaIw5+502RX/+6YaSAPmldk+nhHDPw==", + "dev": true, + "requires": { + "@babel/helper-annotate-as-pure": "^7.0.0", + "@babel/helper-define-map": "^7.4.4", + "@babel/helper-function-name": "^7.1.0", + "@babel/helper-optimise-call-expression": "^7.0.0", + "@babel/helper-plugin-utils": "^7.0.0", + "@babel/helper-replace-supers": "^7.4.4", + "@babel/helper-split-export-declaration": "^7.4.4", + "globals": "^11.1.0" + } + }, + "@babel/plugin-transform-computed-properties": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.2.0.tgz", + "integrity": "sha512-kP/drqTxY6Xt3NNpKiMomfgkNn4o7+vKxK2DDKcBG9sHj51vHqMBGy8wbDS/J4lMxnqs153/T3+DmCEAkC5cpA==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.0.0" + } + }, + "@babel/plugin-transform-destructuring": { + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.4.4.tgz", + "integrity": "sha512-/aOx+nW0w8eHiEHm+BTERB2oJn5D127iye/SUQl7NjHy0lf+j7h4MKMMSOwdazGq9OxgiNADncE+SRJkCxjZpQ==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.0.0" + } + }, + "@babel/plugin-transform-dotall-regex": { + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.4.4.tgz", + "integrity": "sha512-P05YEhRc2h53lZDjRPk/OektxCVevFzZs2Gfjd545Wde3k+yFDbXORgl2e0xpbq8mLcKJ7Idss4fAg0zORN/zg==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.0.0", + "@babel/helper-regex": "^7.4.4", + "regexpu-core": "^4.5.4" + } + }, + "@babel/plugin-transform-duplicate-keys": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-duplicate-keys/-/plugin-transform-duplicate-keys-7.2.0.tgz", + "integrity": "sha512-q+yuxW4DsTjNceUiTzK0L+AfQ0zD9rWaTLiUqHA8p0gxx7lu1EylenfzjeIWNkPy6e/0VG/Wjw9uf9LueQwLOw==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.0.0" + } + }, + "@babel/plugin-transform-exponentiation-operator": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-exponentiation-operator/-/plugin-transform-exponentiation-operator-7.2.0.tgz", + "integrity": "sha512-umh4hR6N7mu4Elq9GG8TOu9M0bakvlsREEC+ialrQN6ABS4oDQ69qJv1VtR3uxlKMCQMCvzk7vr17RHKcjx68A==", + "dev": true, + "requires": { + "@babel/helper-builder-binary-assignment-operator-visitor": "^7.1.0", + "@babel/helper-plugin-utils": "^7.0.0" + } + }, + "@babel/plugin-transform-for-of": { + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.4.4.tgz", + "integrity": "sha512-9T/5Dlr14Z9TIEXLXkt8T1DU7F24cbhwhMNUziN3hB1AXoZcdzPcTiKGRn/6iOymDqtTKWnr/BtRKN9JwbKtdQ==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.0.0" + } + }, + "@babel/plugin-transform-function-name": { + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-function-name/-/plugin-transform-function-name-7.4.4.tgz", + "integrity": "sha512-iU9pv7U+2jC9ANQkKeNF6DrPy4GBa4NWQtl6dHB4Pb3izX2JOEvDTFarlNsBj/63ZEzNNIAMs3Qw4fNCcSOXJA==", + "dev": true, + "requires": { + "@babel/helper-function-name": "^7.1.0", + "@babel/helper-plugin-utils": "^7.0.0" + } + }, + "@babel/plugin-transform-literals": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-literals/-/plugin-transform-literals-7.2.0.tgz", + "integrity": "sha512-2ThDhm4lI4oV7fVQ6pNNK+sx+c/GM5/SaML0w/r4ZB7sAneD/piDJtwdKlNckXeyGK7wlwg2E2w33C/Hh+VFCg==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.0.0" + } + }, + "@babel/plugin-transform-member-expression-literals": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-member-expression-literals/-/plugin-transform-member-expression-literals-7.2.0.tgz", + "integrity": "sha512-HiU3zKkSU6scTidmnFJ0bMX8hz5ixC93b4MHMiYebmk2lUVNGOboPsqQvx5LzooihijUoLR/v7Nc1rbBtnc7FA==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.0.0" + } + }, + "@babel/plugin-transform-modules-amd": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.2.0.tgz", + "integrity": "sha512-mK2A8ucqz1qhrdqjS9VMIDfIvvT2thrEsIQzbaTdc5QFzhDjQv2CkJJ5f6BXIkgbmaoax3zBr2RyvV/8zeoUZw==", + "dev": true, + "requires": { + "@babel/helper-module-transforms": "^7.1.0", + "@babel/helper-plugin-utils": "^7.0.0" + } + }, + "@babel/plugin-transform-modules-commonjs": { + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.4.4.tgz", + "integrity": "sha512-4sfBOJt58sEo9a2BQXnZq+Q3ZTSAUXyK3E30o36BOGnJ+tvJ6YSxF0PG6kERvbeISgProodWuI9UVG3/FMY6iw==", + "dev": true, + "requires": { + "@babel/helper-module-transforms": "^7.4.4", + "@babel/helper-plugin-utils": "^7.0.0", + "@babel/helper-simple-access": "^7.1.0" + } + }, + "@babel/plugin-transform-modules-systemjs": { + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.4.4.tgz", + "integrity": "sha512-MSiModfILQc3/oqnG7NrP1jHaSPryO6tA2kOMmAQApz5dayPxWiHqmq4sWH2xF5LcQK56LlbKByCd8Aah/OIkQ==", + "dev": true, + "requires": { + "@babel/helper-hoist-variables": "^7.4.4", + "@babel/helper-plugin-utils": "^7.0.0" + } + }, + "@babel/plugin-transform-modules-umd": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-umd/-/plugin-transform-modules-umd-7.2.0.tgz", + "integrity": "sha512-BV3bw6MyUH1iIsGhXlOK6sXhmSarZjtJ/vMiD9dNmpY8QXFFQTj+6v92pcfy1iqa8DeAfJFwoxcrS/TUZda6sw==", + "dev": true, + "requires": { + "@babel/helper-module-transforms": "^7.1.0", + "@babel/helper-plugin-utils": "^7.0.0" + } + }, + "@babel/plugin-transform-named-capturing-groups-regex": { + "version": "7.4.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.4.5.tgz", + "integrity": "sha512-z7+2IsWafTBbjNsOxU/Iv5CvTJlr5w4+HGu1HovKYTtgJ362f7kBcQglkfmlspKKZ3bgrbSGvLfNx++ZJgCWsg==", + "dev": true, + "requires": { + "regexp-tree": "^0.1.6" + } + }, + "@babel/plugin-transform-new-target": { + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-new-target/-/plugin-transform-new-target-7.4.4.tgz", + "integrity": "sha512-r1z3T2DNGQwwe2vPGZMBNjioT2scgWzK9BCnDEh+46z8EEwXBq24uRzd65I7pjtugzPSj921aM15RpESgzsSuA==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.0.0" + } + }, + "@babel/plugin-transform-object-assign": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-object-assign/-/plugin-transform-object-assign-7.2.0.tgz", + "integrity": "sha512-nmE55cZBPFgUktbF2OuoZgPRadfxosLOpSgzEPYotKSls9J4pEPcembi8r78RU37Rph6UApCpNmsQA4QMWK9Ng==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.0.0" + } + }, + "@babel/plugin-transform-object-super": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.2.0.tgz", + "integrity": "sha512-VMyhPYZISFZAqAPVkiYb7dUe2AsVi2/wCT5+wZdsNO31FojQJa9ns40hzZ6U9f50Jlq4w6qwzdBB2uwqZ00ebg==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.0.0", + "@babel/helper-replace-supers": "^7.1.0" + } + }, + "@babel/plugin-transform-parameters": { + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.4.4.tgz", + "integrity": "sha512-oMh5DUO1V63nZcu/ZVLQFqiihBGo4OpxJxR1otF50GMeCLiRx5nUdtokd+u9SuVJrvvuIh9OosRFPP4pIPnwmw==", + "dev": true, + "requires": { + "@babel/helper-call-delegate": "^7.4.4", + "@babel/helper-get-function-arity": "^7.0.0", + "@babel/helper-plugin-utils": "^7.0.0" + } + }, + "@babel/plugin-transform-property-literals": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-property-literals/-/plugin-transform-property-literals-7.2.0.tgz", + "integrity": "sha512-9q7Dbk4RhgcLp8ebduOpCbtjh7C0itoLYHXd9ueASKAG/is5PQtMR5VJGka9NKqGhYEGn5ITahd4h9QeBMylWQ==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.0.0" + } + }, + "@babel/plugin-transform-regenerator": { + "version": "7.4.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.4.5.tgz", + "integrity": "sha512-gBKRh5qAaCWntnd09S8QC7r3auLCqq5DI6O0DlfoyDjslSBVqBibrMdsqO+Uhmx3+BlOmE/Kw1HFxmGbv0N9dA==", + "dev": true, + "requires": { + "regenerator-transform": "^0.14.0" + } + }, + "@babel/plugin-transform-reserved-words": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-reserved-words/-/plugin-transform-reserved-words-7.2.0.tgz", + "integrity": "sha512-fz43fqW8E1tAB3DKF19/vxbpib1fuyCwSPE418ge5ZxILnBhWyhtPgz8eh1RCGGJlwvksHkyxMxh0eenFi+kFw==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.0.0" + } + }, + "@babel/plugin-transform-shorthand-properties": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.2.0.tgz", + "integrity": "sha512-QP4eUM83ha9zmYtpbnyjTLAGKQritA5XW/iG9cjtuOI8s1RuL/3V6a3DeSHfKutJQ+ayUfeZJPcnCYEQzaPQqg==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.0.0" + } + }, + "@babel/plugin-transform-spread": { + "version": "7.2.2", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-spread/-/plugin-transform-spread-7.2.2.tgz", + "integrity": "sha512-KWfky/58vubwtS0hLqEnrWJjsMGaOeSBn90Ezn5Jeg9Z8KKHmELbP1yGylMlm5N6TPKeY9A2+UaSYLdxahg01w==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.0.0" + } + }, + "@babel/plugin-transform-sticky-regex": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-sticky-regex/-/plugin-transform-sticky-regex-7.2.0.tgz", + "integrity": "sha512-KKYCoGaRAf+ckH8gEL3JHUaFVyNHKe3ASNsZ+AlktgHevvxGigoIttrEJb8iKN03Q7Eazlv1s6cx2B2cQ3Jabw==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.0.0", + "@babel/helper-regex": "^7.0.0" + } + }, + "@babel/plugin-transform-template-literals": { + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.4.4.tgz", + "integrity": "sha512-mQrEC4TWkhLN0z8ygIvEL9ZEToPhG5K7KDW3pzGqOfIGZ28Jb0POUkeWcoz8HnHvhFy6dwAT1j8OzqN8s804+g==", + "dev": true, + "requires": { + "@babel/helper-annotate-as-pure": "^7.0.0", + "@babel/helper-plugin-utils": "^7.0.0" + } + }, + "@babel/plugin-transform-typeof-symbol": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-typeof-symbol/-/plugin-transform-typeof-symbol-7.2.0.tgz", + "integrity": "sha512-2LNhETWYxiYysBtrBTqL8+La0jIoQQnIScUJc74OYvUGRmkskNY4EzLCnjHBzdmb38wqtTaixpo1NctEcvMDZw==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.0.0" + } + }, + "@babel/plugin-transform-unicode-regex": { + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.4.4.tgz", + "integrity": "sha512-il+/XdNw01i93+M9J9u4T7/e/Ue/vWfNZE4IRUQjplu2Mqb/AFTDimkw2tdEdSH50wuQXZAbXSql0UphQke+vA==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.0.0", + "@babel/helper-regex": "^7.4.4", + "regexpu-core": "^4.5.4" + } + }, + "@babel/preset-env": { + "version": "7.4.5", + "resolved": "https://registry.npmjs.org/@babel/preset-env/-/preset-env-7.4.5.tgz", + "integrity": "sha512-f2yNVXM+FsR5V8UwcFeIHzHWgnhXg3NpRmy0ADvALpnhB0SLbCvrCRr4BLOUYbQNLS+Z0Yer46x9dJXpXewI7w==", + "dev": true, + "requires": { + "@babel/helper-module-imports": "^7.0.0", + "@babel/helper-plugin-utils": "^7.0.0", + "@babel/plugin-proposal-async-generator-functions": "^7.2.0", + "@babel/plugin-proposal-json-strings": "^7.2.0", + "@babel/plugin-proposal-object-rest-spread": "^7.4.4", + "@babel/plugin-proposal-optional-catch-binding": "^7.2.0", + "@babel/plugin-proposal-unicode-property-regex": "^7.4.4", + "@babel/plugin-syntax-async-generators": "^7.2.0", + "@babel/plugin-syntax-json-strings": "^7.2.0", + "@babel/plugin-syntax-object-rest-spread": "^7.2.0", + "@babel/plugin-syntax-optional-catch-binding": "^7.2.0", + "@babel/plugin-transform-arrow-functions": "^7.2.0", + "@babel/plugin-transform-async-to-generator": "^7.4.4", + "@babel/plugin-transform-block-scoped-functions": "^7.2.0", + "@babel/plugin-transform-block-scoping": "^7.4.4", + "@babel/plugin-transform-classes": "^7.4.4", + "@babel/plugin-transform-computed-properties": "^7.2.0", + "@babel/plugin-transform-destructuring": "^7.4.4", + "@babel/plugin-transform-dotall-regex": "^7.4.4", + "@babel/plugin-transform-duplicate-keys": "^7.2.0", + "@babel/plugin-transform-exponentiation-operator": "^7.2.0", + "@babel/plugin-transform-for-of": "^7.4.4", + "@babel/plugin-transform-function-name": "^7.4.4", + "@babel/plugin-transform-literals": "^7.2.0", + "@babel/plugin-transform-member-expression-literals": "^7.2.0", + "@babel/plugin-transform-modules-amd": "^7.2.0", + "@babel/plugin-transform-modules-commonjs": "^7.4.4", + "@babel/plugin-transform-modules-systemjs": "^7.4.4", + "@babel/plugin-transform-modules-umd": "^7.2.0", + "@babel/plugin-transform-named-capturing-groups-regex": "^7.4.5", + "@babel/plugin-transform-new-target": "^7.4.4", + "@babel/plugin-transform-object-super": "^7.2.0", + "@babel/plugin-transform-parameters": "^7.4.4", + "@babel/plugin-transform-property-literals": "^7.2.0", + "@babel/plugin-transform-regenerator": "^7.4.5", + "@babel/plugin-transform-reserved-words": "^7.2.0", + "@babel/plugin-transform-shorthand-properties": "^7.2.0", + "@babel/plugin-transform-spread": "^7.2.0", + "@babel/plugin-transform-sticky-regex": "^7.2.0", + "@babel/plugin-transform-template-literals": "^7.4.4", + "@babel/plugin-transform-typeof-symbol": "^7.2.0", + "@babel/plugin-transform-unicode-regex": "^7.4.4", + "@babel/types": "^7.4.4", + "browserslist": "^4.6.0", + "core-js-compat": "^3.1.1", + "invariant": "^2.2.2", + "js-levenshtein": "^1.1.3", + "semver": "^5.5.0" + } + }, + "@babel/template": { + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.4.4.tgz", + "integrity": "sha512-CiGzLN9KgAvgZsnivND7rkA+AeJ9JB0ciPOD4U59GKbQP2iQl+olF1l76kJOupqidozfZ32ghwBEJDhnk9MEcw==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.0.0", + "@babel/parser": "^7.4.4", + "@babel/types": "^7.4.4" + } + }, + "@babel/traverse": { + "version": "7.4.5", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.4.5.tgz", + "integrity": "sha512-Vc+qjynwkjRmIFGxy0KYoPj4FdVDxLej89kMHFsWScq999uX+pwcX4v9mWRjW0KcAYTPAuVQl2LKP1wEVLsp+A==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.0.0", + "@babel/generator": "^7.4.4", + "@babel/helper-function-name": "^7.1.0", + "@babel/helper-split-export-declaration": "^7.4.4", + "@babel/parser": "^7.4.5", + "@babel/types": "^7.4.4", + "debug": "^4.1.0", + "globals": "^11.1.0", + "lodash": "^4.17.11" + } + }, + "@babel/types": { + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.4.4.tgz", + "integrity": "sha512-dOllgYdnEFOebhkKCjzSVFqw/PmmB8pH6RGOWkY4GsboQNd47b1fBThBSwlHAq9alF9vc1M3+6oqR47R50L0tQ==", + "dev": true, + "requires": { + "esutils": "^2.0.2", + "lodash": "^4.17.11", + "to-fast-properties": "^2.0.0" + } + }, + "@mrmlnc/readdir-enhanced": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/@mrmlnc/readdir-enhanced/-/readdir-enhanced-2.2.1.tgz", + "integrity": "sha512-bPHp6Ji8b41szTOcaP63VlnbbO5Ny6dwAATtY6JTjh5N2OLrb5Qk/Th5cRkRQhkWCt+EJsYrNB0MiL+Gpn6e3g==", + "dev": true, + "requires": { + "call-me-maybe": "^1.0.1", + "glob-to-regexp": "^0.3.0" + } + }, + "@nodelib/fs.stat": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-1.1.3.tgz", + "integrity": "sha512-shAmDyaQC4H92APFoIaVDHCx5bStIocgvbwQyxPRrbUY20V1EYTbSDchWbuwlMG3V17cprZhA6+78JfB+3DTPw==", + "dev": true + }, + "@types/error-stack-parser": { + "version": "1.3.18", + "resolved": "https://registry.npmjs.org/@types/error-stack-parser/-/error-stack-parser-1.3.18.tgz", + "integrity": "sha1-4ByfjIXKg7YQMgxiJYsMkCat4Pc=", + "dev": true + }, + "@types/estree": { + "version": "0.0.39", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.39.tgz", + "integrity": "sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw==", + "dev": true + }, + "@types/events": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@types/events/-/events-3.0.0.tgz", + "integrity": "sha512-EaObqwIvayI5a8dCzhFrjKzVwKLxjoG9T6Ppd5CEo07LRKfQ8Yokw54r5+Wq7FaBQ+yXRvQAYPrHwya1/UFt9g==", + "dev": true + }, + "@types/glob": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.1.1.tgz", + "integrity": "sha512-1Bh06cbWJUHMC97acuD6UMG29nMt0Aqz1vF3guLfG+kHHJhy3AyohZFFxYk2f7Q1SQIrNwvncxAE0N/9s70F2w==", + "dev": true, + "requires": { + "@types/events": "*", + "@types/minimatch": "*", + "@types/node": "*" + } + }, + "@types/lodash": { + "version": "4.14.135", + "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.135.tgz", + "integrity": "sha512-Ed+tSZ9qM1oYpi5kzdsBuOzcAIn1wDW+e8TFJ50IMJMlSopGdJgKAbhHzN6h1E1OfjlGOr2JepzEWtg9NIfoNg==", + "dev": true + }, + "@types/minimatch": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.3.tgz", + "integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA==", + "dev": true + }, + "@types/node": { + "version": "12.0.2", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.0.2.tgz", + "integrity": "sha512-5tabW/i+9mhrfEOUcLDu2xBPsHJ+X5Orqy9FKpale3SjDA17j5AEpYq5vfy3oAeAHGcvANRCO3NV3d2D6q3NiA==", + "dev": true + }, + "@types/resolve": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/@types/resolve/-/resolve-0.0.8.tgz", + "integrity": "sha512-auApPaJf3NPfe18hSoJkp8EbZzer2ISk7o8mCC3M9he/a04+gbMF97NkpD2S8riMGvm4BMRI59/SZQSaLTKpsQ==", + "dev": true, + "requires": { + "@types/node": "*" + } + }, + "acorn": { + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.1.1.tgz", + "integrity": "sha512-jPTiwtOxaHNaAPg/dmrJ/beuzLRnXtB0kQPQ8JpotKJgTB6rX6c8mlf315941pyjBSaPg8NHXS9fhP4u17DpGA==", + "dev": true + }, + "acorn-hammerhead": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/acorn-hammerhead/-/acorn-hammerhead-0.2.0.tgz", + "integrity": "sha512-kbX1s/0ZikW0WEBY6IrooFgX3AP2D9ycTg0OhxRYLF0Tew/bDK2+8lTxFR4cDdoCZm6Ax8eVf8EV6gbTtr8EYQ==", + "dev": true, + "requires": { + "@types/estree": "^0.0.39" + } + }, + "adm-zip": { + "version": "0.4.13", + "resolved": "https://registry.npmjs.org/adm-zip/-/adm-zip-0.4.13.tgz", + "integrity": "sha512-fERNJX8sOXfel6qCBCMPvZLzENBEhZTzKqg6vrOW5pvoEaQuJhRU4ndTAh6lHOxn1I6jnz2NHra56ZODM751uw==", + "dev": true + }, + "agent-base": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-4.3.0.tgz", + "integrity": "sha512-salcGninV0nPrwpGNn4VTXBb1SOuXQBiqbrNXoeizJsHrsL6ERFM2Ne3JUSBWRE6aeNJI2ROP/WEEIDUiDe3cg==", + "dev": true, + "requires": { + "es6-promisify": "^5.0.0" + } + }, + "ajv": { + "version": "6.10.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.10.0.tgz", + "integrity": "sha512-nffhOpkymDECQyR0mnsUtoCE8RlX38G0rYP+wgLWFyZuUyuuojSSvi/+euOiQBIn63whYwYVIIH1TvE3tu4OEg==", + "dev": true, + "requires": { + "fast-deep-equal": "^2.0.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + } + }, + "amdefine": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.1.tgz", + "integrity": "sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU=", + "dev": true + }, + "ansi-escapes": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-2.0.0.tgz", + "integrity": "sha1-W65SvkJIeN2Xg+iRDj/Cki6DyBs=", + "dev": true + }, + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "dev": true + }, + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "archiver": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/archiver/-/archiver-2.1.1.tgz", + "integrity": "sha1-/2YrSnggFJSj7lRNOjP+dJZQnrw=", + "dev": true, + "requires": { + "archiver-utils": "^1.3.0", + "async": "^2.0.0", + "buffer-crc32": "^0.2.1", + "glob": "^7.0.0", + "lodash": "^4.8.0", + "readable-stream": "^2.0.0", + "tar-stream": "^1.5.0", + "zip-stream": "^1.2.0" + }, + "dependencies": { + "async": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/async/-/async-2.6.2.tgz", + "integrity": "sha512-H1qVYh1MYhEEFLsP97cVKqCGo7KfCyTt6uEWqsTBr9SO84oK9Uwbyd/yCW+6rKJLHksBNUVWZDAjfS+Ccx0Bbg==", + "dev": true, + "requires": { + "lodash": "^4.17.11" + } + } + } + }, + "archiver-utils": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/archiver-utils/-/archiver-utils-1.3.0.tgz", + "integrity": "sha1-5QtMCccL89aA4y/xt5lOn52JUXQ=", + "dev": true, + "requires": { + "glob": "^7.0.0", + "graceful-fs": "^4.1.0", + "lazystream": "^1.0.0", + "lodash": "^4.8.0", + "normalize-path": "^2.0.0", + "readable-stream": "^2.0.0" + } + }, + "arr-diff": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz", + "integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=", + "dev": true + }, + "arr-flatten": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz", + "integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==", + "dev": true + }, + "arr-union": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/arr-union/-/arr-union-3.1.0.tgz", + "integrity": "sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ=", + "dev": true + }, + "array-find": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/array-find/-/array-find-1.0.0.tgz", + "integrity": "sha1-bI4obRHtdoMn+OYuzuhzU8o+eLg=", + "dev": true + }, + "array-union": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-1.0.2.tgz", + "integrity": "sha1-mjRBDk9OPaI96jdb5b5w8kd47Dk=", + "dev": true, + "requires": { + "array-uniq": "^1.0.1" + } + }, + "array-uniq": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/array-uniq/-/array-uniq-1.0.3.tgz", + "integrity": "sha1-r2rId6Jcx/dOBYiUdThY39sk/bY=", + "dev": true + }, + "array-unique": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz", + "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=", + "dev": true + }, + "asn1": { + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", + "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", + "dev": true, + "requires": { + "safer-buffer": "~2.1.0" + } + }, + "assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", + "dev": true + }, + "assertion-error": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", + "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", + "dev": true + }, + "assign-symbols": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assign-symbols/-/assign-symbols-1.0.0.tgz", + "integrity": "sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c=", + "dev": true + }, + "async": { + "version": "0.2.6", + "resolved": "https://registry.npmjs.org/async/-/async-0.2.6.tgz", + "integrity": "sha1-rT83PZJJrjJIgVZVgryQ4VKrvWg=", + "dev": true + }, + "async-exit-hook": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/async-exit-hook/-/async-exit-hook-1.1.2.tgz", + "integrity": "sha1-gJXXXkiMKazuBVH+hyUhadeJz7o=", + "dev": true + }, + "async-limiter": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.0.tgz", + "integrity": "sha512-jp/uFnooOiO+L211eZOoSyzpOITMXx1rBITauYykG3BRYPu8h0UcxsPNB04RR5vo4Tyz3+ay17tR6JVf9qzYWg==", + "dev": true + }, + "asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", + "dev": true + }, + "atob": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/atob/-/atob-2.1.2.tgz", + "integrity": "sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==", + "dev": true + }, + "aws-sign2": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", + "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=", + "dev": true + }, + "aws4": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.8.0.tgz", + "integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ==", + "dev": true + }, + "babel-code-frame": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz", + "integrity": "sha1-Y/1D99weO7fONZR9uP42mj9Yx0s=", + "dev": true, + "requires": { + "chalk": "^1.1.3", + "esutils": "^2.0.2", + "js-tokens": "^3.0.2" + }, + "dependencies": { + "ansi-styles": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", + "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", + "dev": true + }, + "chalk": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", + "dev": true, + "requires": { + "ansi-styles": "^2.2.1", + "escape-string-regexp": "^1.0.2", + "has-ansi": "^2.0.0", + "strip-ansi": "^3.0.0", + "supports-color": "^2.0.0" + } + }, + "js-tokens": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz", + "integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=", + "dev": true + }, + "supports-color": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", + "dev": true + } + } + }, + "babel-core": { + "version": "6.26.3", + "resolved": "https://registry.npmjs.org/babel-core/-/babel-core-6.26.3.tgz", + "integrity": "sha512-6jyFLuDmeidKmUEb3NM+/yawG0M2bDZ9Z1qbZP59cyHLz8kYGKYwpJP0UwUKKUiTRNvxfLesJnTedqczP7cTDA==", + "dev": true, + "requires": { + "babel-code-frame": "^6.26.0", + "babel-generator": "^6.26.0", + "babel-helpers": "^6.24.1", + "babel-messages": "^6.23.0", + "babel-register": "^6.26.0", + "babel-runtime": "^6.26.0", + "babel-template": "^6.26.0", + "babel-traverse": "^6.26.0", + "babel-types": "^6.26.0", + "babylon": "^6.18.0", + "convert-source-map": "^1.5.1", + "debug": "^2.6.9", + "json5": "^0.5.1", + "lodash": "^4.17.4", + "minimatch": "^3.0.4", + "path-is-absolute": "^1.0.1", + "private": "^0.1.8", + "slash": "^1.0.0", + "source-map": "^0.5.7" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "json5": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/json5/-/json5-0.5.1.tgz", + "integrity": "sha1-Hq3nrMASA0rYTiOWdn6tn6VJWCE=", + "dev": true + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + } + } + }, + "babel-generator": { + "version": "6.26.1", + "resolved": "https://registry.npmjs.org/babel-generator/-/babel-generator-6.26.1.tgz", + "integrity": "sha512-HyfwY6ApZj7BYTcJURpM5tznulaBvyio7/0d4zFOeMPUmfxkCjHocCuoLa2SAGzBI8AREcH3eP3758F672DppA==", + "dev": true, + "requires": { + "babel-messages": "^6.23.0", + "babel-runtime": "^6.26.0", + "babel-types": "^6.26.0", + "detect-indent": "^4.0.0", + "jsesc": "^1.3.0", + "lodash": "^4.17.4", + "source-map": "^0.5.7", + "trim-right": "^1.0.1" + }, + "dependencies": { + "jsesc": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-1.3.0.tgz", + "integrity": "sha1-RsP+yMGJKxKwgz25vHYiF226s0s=", + "dev": true + } + } + }, + "babel-helper-bindify-decorators": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-bindify-decorators/-/babel-helper-bindify-decorators-6.24.1.tgz", + "integrity": "sha1-FMGeXxQte0fxmlJDHlKxzLxAozA=", + "dev": true, + "requires": { + "babel-runtime": "^6.22.0", + "babel-traverse": "^6.24.1", + "babel-types": "^6.24.1" + } + }, + "babel-helper-builder-binary-assignment-operator-visitor": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-builder-binary-assignment-operator-visitor/-/babel-helper-builder-binary-assignment-operator-visitor-6.24.1.tgz", + "integrity": "sha1-zORReto1b0IgvK6KAsKzRvmlZmQ=", + "dev": true, + "requires": { + "babel-helper-explode-assignable-expression": "^6.24.1", + "babel-runtime": "^6.22.0", + "babel-types": "^6.24.1" + } + }, + "babel-helper-call-delegate": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-call-delegate/-/babel-helper-call-delegate-6.24.1.tgz", + "integrity": "sha1-7Oaqzdx25Bw0YfiL/Fdb0Nqi340=", + "dev": true, + "requires": { + "babel-helper-hoist-variables": "^6.24.1", + "babel-runtime": "^6.22.0", + "babel-traverse": "^6.24.1", + "babel-types": "^6.24.1" + } + }, + "babel-helper-define-map": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-helper-define-map/-/babel-helper-define-map-6.26.0.tgz", + "integrity": "sha1-pfVtq0GiX5fstJjH66ypgZ+Vvl8=", + "dev": true, + "requires": { + "babel-helper-function-name": "^6.24.1", + "babel-runtime": "^6.26.0", + "babel-types": "^6.26.0", + "lodash": "^4.17.4" + } + }, + "babel-helper-explode-assignable-expression": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-explode-assignable-expression/-/babel-helper-explode-assignable-expression-6.24.1.tgz", + "integrity": "sha1-8luCz33BBDPFX3BZLVdGQArCLKo=", + "dev": true, + "requires": { + "babel-runtime": "^6.22.0", + "babel-traverse": "^6.24.1", + "babel-types": "^6.24.1" + } + }, + "babel-helper-explode-class": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-explode-class/-/babel-helper-explode-class-6.24.1.tgz", + "integrity": "sha1-fcKjkQ3uAHBW4eMdZAztPVTqqes=", + "dev": true, + "requires": { + "babel-helper-bindify-decorators": "^6.24.1", + "babel-runtime": "^6.22.0", + "babel-traverse": "^6.24.1", + "babel-types": "^6.24.1" + } + }, + "babel-helper-function-name": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-function-name/-/babel-helper-function-name-6.24.1.tgz", + "integrity": "sha1-00dbjAPtmCQqJbSDUasYOZ01gKk=", + "dev": true, + "requires": { + "babel-helper-get-function-arity": "^6.24.1", + "babel-runtime": "^6.22.0", + "babel-template": "^6.24.1", + "babel-traverse": "^6.24.1", + "babel-types": "^6.24.1" + } + }, + "babel-helper-get-function-arity": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-get-function-arity/-/babel-helper-get-function-arity-6.24.1.tgz", + "integrity": "sha1-j3eCqpNAfEHTqlCQj4mwMbG2hT0=", + "dev": true, + "requires": { + "babel-runtime": "^6.22.0", + "babel-types": "^6.24.1" + } + }, + "babel-helper-hoist-variables": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-hoist-variables/-/babel-helper-hoist-variables-6.24.1.tgz", + "integrity": "sha1-HssnaJydJVE+rbyZFKc/VAi+enY=", + "dev": true, + "requires": { + "babel-runtime": "^6.22.0", + "babel-types": "^6.24.1" + } + }, + "babel-helper-optimise-call-expression": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-optimise-call-expression/-/babel-helper-optimise-call-expression-6.24.1.tgz", + "integrity": "sha1-96E0J7qfc/j0+pk8VKl4gtEkQlc=", + "dev": true, + "requires": { + "babel-runtime": "^6.22.0", + "babel-types": "^6.24.1" + } + }, + "babel-helper-regex": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-helper-regex/-/babel-helper-regex-6.26.0.tgz", + "integrity": "sha1-MlxZ+QL4LyS3T6zu0DY5VPZJXnI=", + "dev": true, + "requires": { + "babel-runtime": "^6.26.0", + "babel-types": "^6.26.0", + "lodash": "^4.17.4" + } + }, + "babel-helper-remap-async-to-generator": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-remap-async-to-generator/-/babel-helper-remap-async-to-generator-6.24.1.tgz", + "integrity": "sha1-XsWBgnrXI/7N04HxySg5BnbkVRs=", + "dev": true, + "requires": { + "babel-helper-function-name": "^6.24.1", + "babel-runtime": "^6.22.0", + "babel-template": "^6.24.1", + "babel-traverse": "^6.24.1", + "babel-types": "^6.24.1" + } + }, + "babel-helper-replace-supers": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-replace-supers/-/babel-helper-replace-supers-6.24.1.tgz", + "integrity": "sha1-v22/5Dk40XNpohPKiov3S2qQqxo=", + "dev": true, + "requires": { + "babel-helper-optimise-call-expression": "^6.24.1", + "babel-messages": "^6.23.0", + "babel-runtime": "^6.22.0", + "babel-template": "^6.24.1", + "babel-traverse": "^6.24.1", + "babel-types": "^6.24.1" + } + }, + "babel-helpers": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helpers/-/babel-helpers-6.24.1.tgz", + "integrity": "sha1-NHHenK7DiOXIUOWX5Yom3fN2ArI=", + "dev": true, + "requires": { + "babel-runtime": "^6.22.0", + "babel-template": "^6.24.1" + } + }, + "babel-messages": { + "version": "6.23.0", + "resolved": "https://registry.npmjs.org/babel-messages/-/babel-messages-6.23.0.tgz", + "integrity": "sha1-8830cDhYA1sqKVHG7F7fbGLyYw4=", + "dev": true, + "requires": { + "babel-runtime": "^6.22.0" + } + }, + "babel-plugin-check-es2015-constants": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-check-es2015-constants/-/babel-plugin-check-es2015-constants-6.22.0.tgz", + "integrity": "sha1-NRV7EBQm/S/9PaP3XH0ekYNbv4o=", + "dev": true, + "requires": { + "babel-runtime": "^6.22.0" + } + }, + "babel-plugin-syntax-async-functions": { + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/babel-plugin-syntax-async-functions/-/babel-plugin-syntax-async-functions-6.13.0.tgz", + "integrity": "sha1-ytnK0RkbWtY0vzCuCHI5HgZHvpU=", + "dev": true + }, + "babel-plugin-syntax-async-generators": { + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/babel-plugin-syntax-async-generators/-/babel-plugin-syntax-async-generators-6.13.0.tgz", + "integrity": "sha1-a8lj67FuzLrmuStZbrfzXDQqi5o=", + "dev": true + }, + "babel-plugin-syntax-class-properties": { + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/babel-plugin-syntax-class-properties/-/babel-plugin-syntax-class-properties-6.13.0.tgz", + "integrity": "sha1-1+sjt5oxf4VDlixQW4J8fWysJ94=", + "dev": true + }, + "babel-plugin-syntax-decorators": { + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/babel-plugin-syntax-decorators/-/babel-plugin-syntax-decorators-6.13.0.tgz", + "integrity": "sha1-MSVjtNvePMgGzuPkFszurd0RrAs=", + "dev": true + }, + "babel-plugin-syntax-dynamic-import": { + "version": "6.18.0", + "resolved": "https://registry.npmjs.org/babel-plugin-syntax-dynamic-import/-/babel-plugin-syntax-dynamic-import-6.18.0.tgz", + "integrity": "sha1-jWomIpyDdFqZgqRBBRVyyqF5sdo=", + "dev": true + }, + "babel-plugin-syntax-exponentiation-operator": { + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/babel-plugin-syntax-exponentiation-operator/-/babel-plugin-syntax-exponentiation-operator-6.13.0.tgz", + "integrity": "sha1-nufoM3KQ2pUoggGmpX9BcDF4MN4=", + "dev": true + }, + "babel-plugin-syntax-flow": { + "version": "6.18.0", + "resolved": "https://registry.npmjs.org/babel-plugin-syntax-flow/-/babel-plugin-syntax-flow-6.18.0.tgz", + "integrity": "sha1-TDqyCiryaqIM0lmVw5jE63AxDI0=", + "dev": true + }, + "babel-plugin-syntax-object-rest-spread": { + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/babel-plugin-syntax-object-rest-spread/-/babel-plugin-syntax-object-rest-spread-6.13.0.tgz", + "integrity": "sha1-/WU28rzhODb/o6VFjEkDpZe7O/U=", + "dev": true + }, + "babel-plugin-syntax-trailing-function-commas": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-syntax-trailing-function-commas/-/babel-plugin-syntax-trailing-function-commas-6.22.0.tgz", + "integrity": "sha1-ugNgk3+NBuQBgKQ/4NVhb/9TLPM=", + "dev": true + }, + "babel-plugin-transform-async-generator-functions": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-async-generator-functions/-/babel-plugin-transform-async-generator-functions-6.24.1.tgz", + "integrity": "sha1-8FiQAUX9PpkHpt3yjaWfIVJYpds=", + "dev": true, + "requires": { + "babel-helper-remap-async-to-generator": "^6.24.1", + "babel-plugin-syntax-async-generators": "^6.5.0", + "babel-runtime": "^6.22.0" + } + }, + "babel-plugin-transform-async-to-generator": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-async-to-generator/-/babel-plugin-transform-async-to-generator-6.24.1.tgz", + "integrity": "sha1-ZTbjeK/2yx1VF6wOQOs+n8jQh2E=", + "dev": true, + "requires": { + "babel-helper-remap-async-to-generator": "^6.24.1", + "babel-plugin-syntax-async-functions": "^6.8.0", + "babel-runtime": "^6.22.0" + } + }, + "babel-plugin-transform-class-properties": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-class-properties/-/babel-plugin-transform-class-properties-6.24.1.tgz", + "integrity": "sha1-anl2PqYdM9NvN7YRqp3vgagbRqw=", + "dev": true, + "requires": { + "babel-helper-function-name": "^6.24.1", + "babel-plugin-syntax-class-properties": "^6.8.0", + "babel-runtime": "^6.22.0", + "babel-template": "^6.24.1" + } + }, + "babel-plugin-transform-decorators": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-decorators/-/babel-plugin-transform-decorators-6.24.1.tgz", + "integrity": "sha1-eIAT2PjGtSIr33s0Q5Df13Vp4k0=", + "dev": true, + "requires": { + "babel-helper-explode-class": "^6.24.1", + "babel-plugin-syntax-decorators": "^6.13.0", + "babel-runtime": "^6.22.0", + "babel-template": "^6.24.1", + "babel-types": "^6.24.1" + } + }, + "babel-plugin-transform-es2015-arrow-functions": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-arrow-functions/-/babel-plugin-transform-es2015-arrow-functions-6.22.0.tgz", + "integrity": "sha1-RSaSy3EdX3ncf4XkQM5BufJE0iE=", + "dev": true, + "requires": { + "babel-runtime": "^6.22.0" + } + }, + "babel-plugin-transform-es2015-block-scoped-functions": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-block-scoped-functions/-/babel-plugin-transform-es2015-block-scoped-functions-6.22.0.tgz", + "integrity": "sha1-u8UbSflk1wy42OC5ToICRs46YUE=", + "dev": true, + "requires": { + "babel-runtime": "^6.22.0" + } + }, + "babel-plugin-transform-es2015-block-scoping": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-block-scoping/-/babel-plugin-transform-es2015-block-scoping-6.26.0.tgz", + "integrity": "sha1-1w9SmcEwjQXBL0Y4E7CgnnOxiV8=", + "dev": true, + "requires": { + "babel-runtime": "^6.26.0", + "babel-template": "^6.26.0", + "babel-traverse": "^6.26.0", + "babel-types": "^6.26.0", + "lodash": "^4.17.4" + } + }, + "babel-plugin-transform-es2015-classes": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-classes/-/babel-plugin-transform-es2015-classes-6.24.1.tgz", + "integrity": "sha1-WkxYpQyclGHlZLSyo7+ryXolhNs=", + "dev": true, + "requires": { + "babel-helper-define-map": "^6.24.1", + "babel-helper-function-name": "^6.24.1", + "babel-helper-optimise-call-expression": "^6.24.1", + "babel-helper-replace-supers": "^6.24.1", + "babel-messages": "^6.23.0", + "babel-runtime": "^6.22.0", + "babel-template": "^6.24.1", + "babel-traverse": "^6.24.1", + "babel-types": "^6.24.1" + } + }, + "babel-plugin-transform-es2015-computed-properties": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-computed-properties/-/babel-plugin-transform-es2015-computed-properties-6.24.1.tgz", + "integrity": "sha1-b+Ko0WiV1WNPTNmZttNICjCBWbM=", + "dev": true, + "requires": { + "babel-runtime": "^6.22.0", + "babel-template": "^6.24.1" + } + }, + "babel-plugin-transform-es2015-destructuring": { + "version": "6.23.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-destructuring/-/babel-plugin-transform-es2015-destructuring-6.23.0.tgz", + "integrity": "sha1-mXux8auWf2gtKwh2/jWNYOdlxW0=", + "dev": true, + "requires": { + "babel-runtime": "^6.22.0" + } + }, + "babel-plugin-transform-es2015-duplicate-keys": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-duplicate-keys/-/babel-plugin-transform-es2015-duplicate-keys-6.24.1.tgz", + "integrity": "sha1-c+s9MQypaePvnskcU3QabxV2Qj4=", + "dev": true, + "requires": { + "babel-runtime": "^6.22.0", + "babel-types": "^6.24.1" + } + }, + "babel-plugin-transform-es2015-for-of": { + "version": "6.23.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-for-of/-/babel-plugin-transform-es2015-for-of-6.23.0.tgz", + "integrity": "sha1-9HyVsrYT3x0+zC/bdXNiPHUkhpE=", + "dev": true, + "requires": { + "babel-runtime": "^6.22.0" + } + }, + "babel-plugin-transform-es2015-function-name": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-function-name/-/babel-plugin-transform-es2015-function-name-6.24.1.tgz", + "integrity": "sha1-g0yJhTvDaxrw86TF26qU/Y6sqos=", + "dev": true, + "requires": { + "babel-helper-function-name": "^6.24.1", + "babel-runtime": "^6.22.0", + "babel-types": "^6.24.1" + } + }, + "babel-plugin-transform-es2015-literals": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-literals/-/babel-plugin-transform-es2015-literals-6.22.0.tgz", + "integrity": "sha1-T1SgLWzWbPkVKAAZox0xklN3yi4=", + "dev": true, + "requires": { + "babel-runtime": "^6.22.0" + } + }, + "babel-plugin-transform-es2015-modules-amd": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-modules-amd/-/babel-plugin-transform-es2015-modules-amd-6.24.1.tgz", + "integrity": "sha1-Oz5UAXI5hC1tGcMBHEvS8AoA0VQ=", + "dev": true, + "requires": { + "babel-plugin-transform-es2015-modules-commonjs": "^6.24.1", + "babel-runtime": "^6.22.0", + "babel-template": "^6.24.1" + } + }, + "babel-plugin-transform-es2015-modules-commonjs": { + "version": "6.26.2", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-modules-commonjs/-/babel-plugin-transform-es2015-modules-commonjs-6.26.2.tgz", + "integrity": "sha512-CV9ROOHEdrjcwhIaJNBGMBCodN+1cfkwtM1SbUHmvyy35KGT7fohbpOxkE2uLz1o6odKK2Ck/tz47z+VqQfi9Q==", + "dev": true, + "requires": { + "babel-plugin-transform-strict-mode": "^6.24.1", + "babel-runtime": "^6.26.0", + "babel-template": "^6.26.0", + "babel-types": "^6.26.0" + } + }, + "babel-plugin-transform-es2015-modules-systemjs": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-modules-systemjs/-/babel-plugin-transform-es2015-modules-systemjs-6.24.1.tgz", + "integrity": "sha1-/4mhQrkRmpBhlfXxBuzzBdlAfSM=", + "dev": true, + "requires": { + "babel-helper-hoist-variables": "^6.24.1", + "babel-runtime": "^6.22.0", + "babel-template": "^6.24.1" + } + }, + "babel-plugin-transform-es2015-modules-umd": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-modules-umd/-/babel-plugin-transform-es2015-modules-umd-6.24.1.tgz", + "integrity": "sha1-rJl+YoXNGO1hdq22B9YCNErThGg=", + "dev": true, + "requires": { + "babel-plugin-transform-es2015-modules-amd": "^6.24.1", + "babel-runtime": "^6.22.0", + "babel-template": "^6.24.1" + } + }, + "babel-plugin-transform-es2015-object-super": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-object-super/-/babel-plugin-transform-es2015-object-super-6.24.1.tgz", + "integrity": "sha1-JM72muIcuDp/hgPa0CH1cusnj40=", + "dev": true, + "requires": { + "babel-helper-replace-supers": "^6.24.1", + "babel-runtime": "^6.22.0" + } + }, + "babel-plugin-transform-es2015-parameters": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-parameters/-/babel-plugin-transform-es2015-parameters-6.24.1.tgz", + "integrity": "sha1-V6w1GrScrxSpfNE7CfZv3wpiXys=", + "dev": true, + "requires": { + "babel-helper-call-delegate": "^6.24.1", + "babel-helper-get-function-arity": "^6.24.1", + "babel-runtime": "^6.22.0", + "babel-template": "^6.24.1", + "babel-traverse": "^6.24.1", + "babel-types": "^6.24.1" + } + }, + "babel-plugin-transform-es2015-shorthand-properties": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-shorthand-properties/-/babel-plugin-transform-es2015-shorthand-properties-6.24.1.tgz", + "integrity": "sha1-JPh11nIch2YbvZmkYi5R8U3jiqA=", + "dev": true, + "requires": { + "babel-runtime": "^6.22.0", + "babel-types": "^6.24.1" + } + }, + "babel-plugin-transform-es2015-spread": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-spread/-/babel-plugin-transform-es2015-spread-6.22.0.tgz", + "integrity": "sha1-1taKmfia7cRTbIGlQujdnxdG+NE=", + "dev": true, + "requires": { + "babel-runtime": "^6.22.0" + } + }, + "babel-plugin-transform-es2015-sticky-regex": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-sticky-regex/-/babel-plugin-transform-es2015-sticky-regex-6.24.1.tgz", + "integrity": "sha1-AMHNsaynERLN8M9hJsLta0V8zbw=", + "dev": true, + "requires": { + "babel-helper-regex": "^6.24.1", + "babel-runtime": "^6.22.0", + "babel-types": "^6.24.1" + } + }, + "babel-plugin-transform-es2015-template-literals": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-template-literals/-/babel-plugin-transform-es2015-template-literals-6.22.0.tgz", + "integrity": "sha1-qEs0UPfp+PH2g51taH2oS7EjbY0=", + "dev": true, + "requires": { + "babel-runtime": "^6.22.0" + } + }, + "babel-plugin-transform-es2015-typeof-symbol": { + "version": "6.23.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-typeof-symbol/-/babel-plugin-transform-es2015-typeof-symbol-6.23.0.tgz", + "integrity": "sha1-3sCfHN3/lLUqxz1QXITfWdzOs3I=", + "dev": true, + "requires": { + "babel-runtime": "^6.22.0" + } + }, + "babel-plugin-transform-es2015-unicode-regex": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-unicode-regex/-/babel-plugin-transform-es2015-unicode-regex-6.24.1.tgz", + "integrity": "sha1-04sS9C6nMj9yk4fxinxa4frrNek=", + "dev": true, + "requires": { + "babel-helper-regex": "^6.24.1", + "babel-runtime": "^6.22.0", + "regexpu-core": "^2.0.0" + }, + "dependencies": { + "jsesc": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz", + "integrity": "sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0=", + "dev": true + }, + "regexpu-core": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-2.0.0.tgz", + "integrity": "sha1-SdA4g3uNz4v6W5pCE5k45uoq4kA=", + "dev": true, + "requires": { + "regenerate": "^1.2.1", + "regjsgen": "^0.2.0", + "regjsparser": "^0.1.4" + } + }, + "regjsgen": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/regjsgen/-/regjsgen-0.2.0.tgz", + "integrity": "sha1-bAFq3qxVT3WCP+N6wFuS1aTtsfc=", + "dev": true + }, + "regjsparser": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.1.5.tgz", + "integrity": "sha1-fuj4Tcb6eS0/0K4ijSS9lJ6tIFw=", + "dev": true, + "requires": { + "jsesc": "~0.5.0" + } + } + } + }, + "babel-plugin-transform-exponentiation-operator": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-exponentiation-operator/-/babel-plugin-transform-exponentiation-operator-6.24.1.tgz", + "integrity": "sha1-KrDJx/MJj6SJB3cruBP+QejeOg4=", + "dev": true, + "requires": { + "babel-helper-builder-binary-assignment-operator-visitor": "^6.24.1", + "babel-plugin-syntax-exponentiation-operator": "^6.8.0", + "babel-runtime": "^6.22.0" + } + }, + "babel-plugin-transform-flow-strip-types": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-flow-strip-types/-/babel-plugin-transform-flow-strip-types-6.22.0.tgz", + "integrity": "sha1-hMtnKTXUNxT9wyvOhFaNh0Qc988=", + "dev": true, + "requires": { + "babel-plugin-syntax-flow": "^6.18.0", + "babel-runtime": "^6.22.0" + } + }, + "babel-plugin-transform-for-of-as-array": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-for-of-as-array/-/babel-plugin-transform-for-of-as-array-1.1.1.tgz", + "integrity": "sha512-eE4hZJhOUKpX0q/X3adR8B4hLox+t8oe4ZqmhANUmv4cds07AbWt6O0rtFXK7PKFPPnW4nz/5mpbkPMkflyGeg==", + "dev": true + }, + "babel-plugin-transform-object-rest-spread": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-object-rest-spread/-/babel-plugin-transform-object-rest-spread-6.26.0.tgz", + "integrity": "sha1-DzZpLVD+9rfi1LOsFHgTepY7ewY=", + "dev": true, + "requires": { + "babel-plugin-syntax-object-rest-spread": "^6.8.0", + "babel-runtime": "^6.26.0" + } + }, + "babel-plugin-transform-regenerator": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-regenerator/-/babel-plugin-transform-regenerator-6.26.0.tgz", + "integrity": "sha1-4HA2lvveJ/Cj78rPi03KL3s6jy8=", + "dev": true, + "requires": { + "regenerator-transform": "^0.10.0" + }, + "dependencies": { + "regenerator-transform": { + "version": "0.10.1", + "resolved": "https://registry.npmjs.org/regenerator-transform/-/regenerator-transform-0.10.1.tgz", + "integrity": "sha512-PJepbvDbuK1xgIgnau7Y90cwaAmO/LCLMI2mPvaXq2heGMR3aWW5/BQvYrhJ8jgmQjXewXvBjzfqKcVOmhjZ6Q==", + "dev": true, + "requires": { + "babel-runtime": "^6.18.0", + "babel-types": "^6.19.0", + "private": "^0.1.6" + } + } + } + }, + "babel-plugin-transform-runtime": { + "version": "6.23.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-runtime/-/babel-plugin-transform-runtime-6.23.0.tgz", + "integrity": "sha1-iEkNRGUC6puOfvsP4J7E2ZR5se4=", + "dev": true, + "requires": { + "babel-runtime": "^6.22.0" + } + }, + "babel-plugin-transform-strict-mode": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-strict-mode/-/babel-plugin-transform-strict-mode-6.24.1.tgz", + "integrity": "sha1-1fr3qleKZbvlkc9e2uBKDGcCB1g=", + "dev": true, + "requires": { + "babel-runtime": "^6.22.0", + "babel-types": "^6.24.1" + } + }, + "babel-preset-env": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/babel-preset-env/-/babel-preset-env-1.7.0.tgz", + "integrity": "sha512-9OR2afuKDneX2/q2EurSftUYM0xGu4O2D9adAhVfADDhrYDaxXV0rBbevVYoY9n6nyX1PmQW/0jtpJvUNr9CHg==", + "dev": true, + "requires": { + "babel-plugin-check-es2015-constants": "^6.22.0", + "babel-plugin-syntax-trailing-function-commas": "^6.22.0", + "babel-plugin-transform-async-to-generator": "^6.22.0", + "babel-plugin-transform-es2015-arrow-functions": "^6.22.0", + "babel-plugin-transform-es2015-block-scoped-functions": "^6.22.0", + "babel-plugin-transform-es2015-block-scoping": "^6.23.0", + "babel-plugin-transform-es2015-classes": "^6.23.0", + "babel-plugin-transform-es2015-computed-properties": "^6.22.0", + "babel-plugin-transform-es2015-destructuring": "^6.23.0", + "babel-plugin-transform-es2015-duplicate-keys": "^6.22.0", + "babel-plugin-transform-es2015-for-of": "^6.23.0", + "babel-plugin-transform-es2015-function-name": "^6.22.0", + "babel-plugin-transform-es2015-literals": "^6.22.0", + "babel-plugin-transform-es2015-modules-amd": "^6.22.0", + "babel-plugin-transform-es2015-modules-commonjs": "^6.23.0", + "babel-plugin-transform-es2015-modules-systemjs": "^6.23.0", + "babel-plugin-transform-es2015-modules-umd": "^6.23.0", + "babel-plugin-transform-es2015-object-super": "^6.22.0", + "babel-plugin-transform-es2015-parameters": "^6.23.0", + "babel-plugin-transform-es2015-shorthand-properties": "^6.22.0", + "babel-plugin-transform-es2015-spread": "^6.22.0", + "babel-plugin-transform-es2015-sticky-regex": "^6.22.0", + "babel-plugin-transform-es2015-template-literals": "^6.22.0", + "babel-plugin-transform-es2015-typeof-symbol": "^6.23.0", + "babel-plugin-transform-es2015-unicode-regex": "^6.22.0", + "babel-plugin-transform-exponentiation-operator": "^6.22.0", + "babel-plugin-transform-regenerator": "^6.22.0", + "browserslist": "^3.2.6", + "invariant": "^2.2.2", + "semver": "^5.3.0" + }, + "dependencies": { + "browserslist": { + "version": "3.2.8", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-3.2.8.tgz", + "integrity": "sha512-WHVocJYavUwVgVViC0ORikPHQquXwVh939TaelZ4WDqpWgTX/FsGhl/+P4qBUAGcRvtOgDgC+xftNWWp2RUTAQ==", + "dev": true, + "requires": { + "caniuse-lite": "^1.0.30000844", + "electron-to-chromium": "^1.3.47" + } + } + } + }, + "babel-preset-flow": { + "version": "6.23.0", + "resolved": "https://registry.npmjs.org/babel-preset-flow/-/babel-preset-flow-6.23.0.tgz", + "integrity": "sha1-5xIYiHCFrpoktb5Baa/7WZgWxJ0=", + "dev": true, + "requires": { + "babel-plugin-transform-flow-strip-types": "^6.22.0" + } + }, + "babel-preset-stage-2": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-preset-stage-2/-/babel-preset-stage-2-6.24.1.tgz", + "integrity": "sha1-2eKWD7PXEYfw5k7sYrwHdnIZvcE=", + "dev": true, + "requires": { + "babel-plugin-syntax-dynamic-import": "^6.18.0", + "babel-plugin-transform-class-properties": "^6.24.1", + "babel-plugin-transform-decorators": "^6.24.1", + "babel-preset-stage-3": "^6.24.1" + } + }, + "babel-preset-stage-3": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-preset-stage-3/-/babel-preset-stage-3-6.24.1.tgz", + "integrity": "sha1-g2raCp56f6N8sTj7kyb4eTSkg5U=", + "dev": true, + "requires": { + "babel-plugin-syntax-trailing-function-commas": "^6.22.0", + "babel-plugin-transform-async-generator-functions": "^6.24.1", + "babel-plugin-transform-async-to-generator": "^6.24.1", + "babel-plugin-transform-exponentiation-operator": "^6.24.1", + "babel-plugin-transform-object-rest-spread": "^6.22.0" + } + }, + "babel-register": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-register/-/babel-register-6.26.0.tgz", + "integrity": "sha1-btAhFz4vy0htestFxgCahW9kcHE=", + "dev": true, + "requires": { + "babel-core": "^6.26.0", + "babel-runtime": "^6.26.0", + "core-js": "^2.5.0", + "home-or-tmp": "^2.0.0", + "lodash": "^4.17.4", + "mkdirp": "^0.5.1", + "source-map-support": "^0.4.15" + }, + "dependencies": { + "source-map-support": { + "version": "0.4.18", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.4.18.tgz", + "integrity": "sha512-try0/JqxPLF9nOjvSta7tVondkP5dwgyLDjVoyMDlmjugT2lRZ1OfsrYTkCd2hkDnJTKRbO/Rl3orm8vlsUzbA==", + "dev": true, + "requires": { + "source-map": "^0.5.6" + } + } + } + }, + "babel-runtime": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz", + "integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=", + "dev": true, + "requires": { + "core-js": "^2.4.0", + "regenerator-runtime": "^0.11.0" + } + }, + "babel-template": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-template/-/babel-template-6.26.0.tgz", + "integrity": "sha1-3gPi0WOWsGn0bdn/+FIfsaDjXgI=", + "dev": true, + "requires": { + "babel-runtime": "^6.26.0", + "babel-traverse": "^6.26.0", + "babel-types": "^6.26.0", + "babylon": "^6.18.0", + "lodash": "^4.17.4" + } + }, + "babel-traverse": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-traverse/-/babel-traverse-6.26.0.tgz", + "integrity": "sha1-RqnL1+3MYsjlwGTi0tjQ9ANXZu4=", + "dev": true, + "requires": { + "babel-code-frame": "^6.26.0", + "babel-messages": "^6.23.0", + "babel-runtime": "^6.26.0", + "babel-types": "^6.26.0", + "babylon": "^6.18.0", + "debug": "^2.6.8", + "globals": "^9.18.0", + "invariant": "^2.2.2", + "lodash": "^4.17.4" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "globals": { + "version": "9.18.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-9.18.0.tgz", + "integrity": "sha512-S0nG3CLEQiY/ILxqtztTWH/3iRRdyBLw6KMDxnKMchrtbj2OFmehVh0WUCfW3DUrIgx/qFrJPICrq4Z4sTR9UQ==", + "dev": true + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + } + } + }, + "babel-types": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-types/-/babel-types-6.26.0.tgz", + "integrity": "sha1-o7Bz+Uq0nrb6Vc1lInozQ4BjJJc=", + "dev": true, + "requires": { + "babel-runtime": "^6.26.0", + "esutils": "^2.0.2", + "lodash": "^4.17.4", + "to-fast-properties": "^1.0.3" + }, + "dependencies": { + "to-fast-properties": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-1.0.3.tgz", + "integrity": "sha1-uDVx+k2MJbguIxsG46MFXeTKGkc=", + "dev": true + } + } + }, + "babylon": { + "version": "6.18.0", + "resolved": "https://registry.npmjs.org/babylon/-/babylon-6.18.0.tgz", + "integrity": "sha512-q/UEjfGJ2Cm3oKV71DJz9d25TPnq5rhBVL2Q4fA5wcC3jcrdn7+SssEybFIxwAvvP+YCsCYNKughoF33GxgycQ==", + "dev": true + }, + "balanced-match": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", + "dev": true + }, + "base": { + "version": "0.11.2", + "resolved": "https://registry.npmjs.org/base/-/base-0.11.2.tgz", + "integrity": "sha512-5T6P4xPgpp0YDFvSWwEZ4NoE3aM4QBQXDzmVbraCkFj8zHM+mba8SyqB5DbZWyR7mYHo6Y7BdQo3MoA4m0TeQg==", + "dev": true, + "requires": { + "cache-base": "^1.0.1", + "class-utils": "^0.3.5", + "component-emitter": "^1.2.1", + "define-property": "^1.0.0", + "isobject": "^3.0.1", + "mixin-deep": "^1.2.0", + "pascalcase": "^0.1.1" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "dev": true, + "requires": { + "is-descriptor": "^1.0.0" + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + } + } + }, + "base64-js": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.3.0.tgz", + "integrity": "sha512-ccav/yGvoa80BQDljCxsmmQ3Xvx60/UpBIij5QN21W3wBi/hhIC9OoO+KLpu9IJTS9j4DRVJ3aDDF9cMSoa2lw==", + "dev": true + }, + "bcrypt-pbkdf": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", + "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", + "dev": true, + "requires": { + "tweetnacl": "^0.14.3" + } + }, + "bin-v8-flags-filter": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/bin-v8-flags-filter/-/bin-v8-flags-filter-1.2.0.tgz", + "integrity": "sha512-g8aeYkY7GhyyKRvQMBsJQZjhm2iCX3dKYvfrMpwVR8IxmUGrkpCBFoKbB9Rh0o3sTLCjU/1tFpZ4C7j3f+D+3g==", + "dev": true + }, + "bl": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/bl/-/bl-1.2.2.tgz", + "integrity": "sha512-e8tQYnZodmebYDWGH7KMRvtzKXaJHx3BbilrgZCfvyLUYdKpK1t5PSPmpkny/SgiTSCnjfLW7v5rlONXVFkQEA==", + "dev": true, + "requires": { + "readable-stream": "^2.3.5", + "safe-buffer": "^5.1.1" + } + }, + "bowser": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/bowser/-/bowser-1.6.0.tgz", + "integrity": "sha1-N/w4e2Fstq7zcNq01r1AK3TFxU0=", + "dev": true + }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "braces": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz", + "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==", + "dev": true, + "requires": { + "arr-flatten": "^1.1.0", + "array-unique": "^0.3.2", + "extend-shallow": "^2.0.1", + "fill-range": "^4.0.0", + "isobject": "^3.0.1", + "repeat-element": "^1.1.2", + "snapdragon": "^0.8.1", + "snapdragon-node": "^2.0.1", + "split-string": "^3.0.2", + "to-regex": "^3.0.1" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "brotli": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/brotli/-/brotli-1.3.2.tgz", + "integrity": "sha1-UlqcrU/LqWR119OI9q7LE+7VL0Y=", + "dev": true, + "requires": { + "base64-js": "^1.1.2" + } + }, + "browserslist": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.6.0.tgz", + "integrity": "sha512-Jk0YFwXBuMOOol8n6FhgkDzn3mY9PYLYGk29zybF05SbRTsMgPqmTNeQQhOghCxq5oFqAXE3u4sYddr4C0uRhg==", + "dev": true, + "requires": { + "caniuse-lite": "^1.0.30000967", + "electron-to-chromium": "^1.3.133", + "node-releases": "^1.1.19" + } + }, + "buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.2.1.tgz", + "integrity": "sha512-c+Ko0loDaFfuPWiL02ls9Xd3GO3cPVmUobQ6t3rXNUk304u6hGq+8N/kFi+QEIKhzK3uwolVhLzszmfLmMLnqg==", + "dev": true, + "requires": { + "base64-js": "^1.0.2", + "ieee754": "^1.1.4" + } + }, + "buffer-alloc": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/buffer-alloc/-/buffer-alloc-1.2.0.tgz", + "integrity": "sha512-CFsHQgjtW1UChdXgbyJGtnm+O/uLQeZdtbDo8mfUgYXCHSM1wgrVxXm6bSyrUuErEb+4sYVGCzASBRot7zyrow==", + "dev": true, + "requires": { + "buffer-alloc-unsafe": "^1.1.0", + "buffer-fill": "^1.0.0" + } + }, + "buffer-alloc-unsafe": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/buffer-alloc-unsafe/-/buffer-alloc-unsafe-1.1.0.tgz", + "integrity": "sha512-TEM2iMIEQdJ2yjPJoSIsldnleVaAk1oW3DBVUykyOLsEsFmEc9kn+SFFPz+gl54KQNxlDnAwCXosOS9Okx2xAg==", + "dev": true + }, + "buffer-crc32": { + "version": "0.2.13", + "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz", + "integrity": "sha1-DTM+PwDqxQqhRUq9MO+MKl2ackI=", + "dev": true + }, + "buffer-fill": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/buffer-fill/-/buffer-fill-1.0.0.tgz", + "integrity": "sha1-+PeLdniYiO858gXNY39o5wISKyw=", + "dev": true + }, + "buffer-from": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", + "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==", + "dev": true + }, + "builtin-modules": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-3.1.0.tgz", + "integrity": "sha512-k0KL0aWZuBt2lrxrcASWDfwOLMnodeQjodT/1SxEQAXsHANgo6ZC/VEaSEHCXt7aSTZ4/4H5LKa+tBXmW7Vtvw==", + "dev": true + }, + "cache-base": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/cache-base/-/cache-base-1.0.1.tgz", + "integrity": "sha512-AKcdTnFSWATd5/GCPRxr2ChwIJ85CeyrEyjRHlKxQ56d4XJMGym0uAiKn0xbLOGOl3+yRpOTi484dVCEc5AUzQ==", + "dev": true, + "requires": { + "collection-visit": "^1.0.0", + "component-emitter": "^1.2.1", + "get-value": "^2.0.6", + "has-value": "^1.0.0", + "isobject": "^3.0.1", + "set-value": "^2.0.0", + "to-object-path": "^0.3.0", + "union-value": "^1.0.0", + "unset-value": "^1.0.0" + } + }, + "call-me-maybe": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/call-me-maybe/-/call-me-maybe-1.0.1.tgz", + "integrity": "sha1-JtII6onje1y95gJQoV8DHBak1ms=", + "dev": true + }, + "callsite": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/callsite/-/callsite-1.0.0.tgz", + "integrity": "sha1-KAOY5dZkvXQDi28JBRU+borxvCA=", + "dev": true + }, + "callsite-record": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/callsite-record/-/callsite-record-4.1.3.tgz", + "integrity": "sha512-otAcPmu8TiHZ38cIL3NjQa1nGoSQRRe8WDDUgj5ZUwJWn1wzOYBwVSJbpVyzZ0sesQeKlYsPu9DG70fhh6AK9g==", + "dev": true, + "requires": { + "@types/error-stack-parser": "^1.3.18", + "@types/lodash": "^4.14.72", + "callsite": "^1.0.0", + "chalk": "^2.4.0", + "error-stack-parser": "^1.3.3", + "highlight-es": "^1.0.0", + "lodash": "4.6.1 || ^4.16.1", + "pinkie-promise": "^2.0.0" + } + }, + "caniuse-lite": { + "version": "1.0.30000971", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000971.tgz", + "integrity": "sha512-TQFYFhRS0O5rdsmSbF1Wn+16latXYsQJat66f7S7lizXW1PVpWJeZw9wqqVLIjuxDRz7s7xRUj13QCfd8hKn6g==", + "dev": true + }, + "caseless": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", + "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=", + "dev": true + }, + "chai": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/chai/-/chai-4.2.0.tgz", + "integrity": "sha512-XQU3bhBukrOsQCuwZndwGcCVQHyZi53fQ6Ys1Fym7E4olpIqqZZhhoFJoaKVvV17lWQoXYwgWN2nF5crA8J2jw==", + "dev": true, + "requires": { + "assertion-error": "^1.1.0", + "check-error": "^1.0.2", + "deep-eql": "^3.0.1", + "get-func-name": "^2.0.0", + "pathval": "^1.1.0", + "type-detect": "^4.0.5" + } + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "check-error": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", + "integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=", + "dev": true + }, + "chrome-emulated-devices-list": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/chrome-emulated-devices-list/-/chrome-emulated-devices-list-0.1.1.tgz", + "integrity": "sha512-wQu6YKNTNGaUXovpkvXLnfeumVK47r2TKpOuCTwOKv/5SmRzfHual+E+oDIwS3KFWAcJPAhoNRAOLvXwzC6/pw==", + "dev": true + }, + "chrome-remote-interface": { + "version": "0.25.7", + "resolved": "https://registry.npmjs.org/chrome-remote-interface/-/chrome-remote-interface-0.25.7.tgz", + "integrity": "sha512-6zI6LbR2IiGmduFZededaerEr9hHXabxT/L+fRrdq65a0CfyLMzpq0BKuZiqN0Upqcacsb6q2POj7fmobwBsEA==", + "dev": true, + "requires": { + "commander": "2.11.x", + "ws": "3.3.x" + }, + "dependencies": { + "commander": { + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.11.0.tgz", + "integrity": "sha512-b0553uYA5YAEGgyYIGYROzKQ7X5RAqedkfjiZxwi0kL1g3bOaBNNZfYkzt/CL0umgD5wc9Jec2FbB98CjkMRvQ==", + "dev": true + } + } + }, + "ci-info": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-1.6.0.tgz", + "integrity": "sha512-vsGdkwSCDpWmP80ncATX7iea5DWQemg1UgCW5J8tqjU3lYw4FBYuj89J0CTVomA7BEfvSZd84GmHko+MxFQU2A==", + "dev": true + }, + "class-utils": { + "version": "0.3.6", + "resolved": "https://registry.npmjs.org/class-utils/-/class-utils-0.3.6.tgz", + "integrity": "sha512-qOhPa/Fj7s6TY8H8esGu5QNpMMQxz79h+urzrNYN6mn+9BnxlDGf5QZ+XeCDsxSjPqsSR56XOZOJmpeurnLMeg==", + "dev": true, + "requires": { + "arr-union": "^3.1.0", + "define-property": "^0.2.5", + "isobject": "^3.0.0", + "static-extend": "^0.1.1" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "^0.1.0" + } + } + } + }, + "code-point-at": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", + "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", + "dev": true + }, + "coffeescript": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/coffeescript/-/coffeescript-2.4.1.tgz", + "integrity": "sha512-34GV1aHrsMpTaO3KfMJL40ZNuvKDR/g98THHnE9bQj8HjMaZvSrLik99WWqyMhRtbe8V5hpx5iLgdcSvM/S2wg==", + "dev": true + }, + "collection-visit": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/collection-visit/-/collection-visit-1.0.0.tgz", + "integrity": "sha1-S8A3PBZLwykbTTaMgpzxqApZ3KA=", + "dev": true, + "requires": { + "map-visit": "^1.0.0", + "object-visit": "^1.0.0" + } + }, + "color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", + "dev": true + }, + "combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "dev": true, + "requires": { + "delayed-stream": "~1.0.0" + } + }, + "commander": { + "version": "2.20.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.0.tgz", + "integrity": "sha512-7j2y+40w61zy6YC2iRNpUe/NwhNyoXrYpHMrSunaMG64nRnaf96zO/KMQR4OyN/UnE5KLyEBnKHd4aG3rskjpQ==", + "dev": true + }, + "component-emitter": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz", + "integrity": "sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg==", + "dev": true + }, + "compress-commons": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/compress-commons/-/compress-commons-1.2.2.tgz", + "integrity": "sha1-UkqfEJA/OoEzibAiXSfEi7dRiQ8=", + "dev": true, + "requires": { + "buffer-crc32": "^0.2.1", + "crc32-stream": "^2.0.0", + "normalize-path": "^2.0.0", + "readable-stream": "^2.0.0" + } + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "dev": true + }, + "convert-source-map": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.6.0.tgz", + "integrity": "sha512-eFu7XigvxdZ1ETfbgPBohgyQ/Z++C0eEhTor0qRwBw9unw+L0/6V8wkSuGgzdThkiS5lSpdptOQPD8Ak40a+7A==", + "dev": true, + "requires": { + "safe-buffer": "~5.1.1" + } + }, + "copy-descriptor": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/copy-descriptor/-/copy-descriptor-0.1.1.tgz", + "integrity": "sha1-Z29us8OZl8LuGsOpJP1hJHSPV40=", + "dev": true + }, + "core-js": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.9.tgz", + "integrity": "sha512-HOpZf6eXmnl7la+cUdMnLvUxKNqLUzJvgIziQ0DiF3JwSImNphIqdGqzj6hIKyX04MmV0poclQ7+wjWvxQyR2A==", + "dev": true + }, + "core-js-compat": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.1.2.tgz", + "integrity": "sha512-X0Ch5f6itrHxhg5HSJucX6nNLNAGr+jq+biBh6nPGc3YAWz2a8p/ZIZY8cUkDzSRNG54omAuu3hoEF8qZbu/6Q==", + "dev": true, + "requires": { + "browserslist": "^4.6.0", + "core-js-pure": "3.1.2", + "semver": "^6.0.0" + }, + "dependencies": { + "semver": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.1.0.tgz", + "integrity": "sha512-kCqEOOHoBcFs/2Ccuk4Xarm/KiWRSLEX9CAZF8xkJ6ZPlIoTZ8V5f7J16vYLJqDbR7KrxTJpR2lqjIEm2Qx9cQ==", + "dev": true + } + } + }, + "core-js-pure": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/core-js-pure/-/core-js-pure-3.1.2.tgz", + "integrity": "sha512-5ckIdBF26B3ldK9PM177y2ZcATP2oweam9RskHSoqfZCrJ2As6wVg8zJ1zTriFsZf6clj/N1ThDFRGaomMsh9w==", + "dev": true + }, + "core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", + "dev": true + }, + "crc": { + "version": "3.8.0", + "resolved": "https://registry.npmjs.org/crc/-/crc-3.8.0.tgz", + "integrity": "sha512-iX3mfgcTMIq3ZKLIsVFAbv7+Mc10kxabAGQb8HvjA1o3T1PIYprbakQ65d3I+2HGHt6nSKkM9PYjgoJO2KcFBQ==", + "dev": true, + "requires": { + "buffer": "^5.1.0" + } + }, + "crc32-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/crc32-stream/-/crc32-stream-2.0.0.tgz", + "integrity": "sha1-483TtN8xaN10494/u8t7KX/pCPQ=", + "dev": true, + "requires": { + "crc": "^3.4.4", + "readable-stream": "^2.0.0" + } + }, + "crypto-md5": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/crypto-md5/-/crypto-md5-1.0.0.tgz", + "integrity": "sha1-zMjadQx1PH7curxUKWdHKjhOhrs=", + "dev": true + }, + "css": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/css/-/css-2.2.3.tgz", + "integrity": "sha512-0W171WccAjQGGTKLhw4m2nnl0zPHUlTO/I8td4XzJgIB8Hg3ZZx71qT4G4eX8OVsSiaAKiUMy73E3nsbPlg2DQ==", + "dev": true, + "requires": { + "inherits": "^2.0.1", + "source-map": "^0.1.38", + "source-map-resolve": "^0.5.1", + "urix": "^0.1.0" + }, + "dependencies": { + "source-map": { + "version": "0.1.43", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.1.43.tgz", + "integrity": "sha1-wkvBRspRfBRx9drL4lcbK3+eM0Y=", + "dev": true, + "requires": { + "amdefine": ">=0.0.4" + } + } + } + }, + "dashdash": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", + "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", + "dev": true, + "requires": { + "assert-plus": "^1.0.0" + } + }, + "debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "decode-uri-component": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz", + "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=", + "dev": true + }, + "dedent": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/dedent/-/dedent-0.4.0.tgz", + "integrity": "sha1-h979BAvUwVldljKC7FfzwqhSVkI=", + "dev": true + }, + "deep-eql": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-3.0.1.tgz", + "integrity": "sha512-+QeIQyN5ZuO+3Uk5DYh6/1eKO0m0YmJFGNmFHGACpf1ClL1nmlV/p4gNgbl2pJGxgXb4faqo6UE+M5ACEMyVcw==", + "dev": true, + "requires": { + "type-detect": "^4.0.0" + } + }, + "define-property": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-2.0.2.tgz", + "integrity": "sha512-jwK2UV4cnPpbcG7+VRARKTZPUWowwXA8bzH5NP6ud0oeAxyYPuGZUAC7hMugpCdz4BeSZl2Dl9k66CHJ/46ZYQ==", + "dev": true, + "requires": { + "is-descriptor": "^1.0.2", + "isobject": "^3.0.1" + }, + "dependencies": { + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + } + } + }, + "del": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/del/-/del-3.0.0.tgz", + "integrity": "sha1-U+z2mf/LyzljdpGrE7rxYIGXZuU=", + "dev": true, + "requires": { + "globby": "^6.1.0", + "is-path-cwd": "^1.0.0", + "is-path-in-cwd": "^1.0.0", + "p-map": "^1.1.1", + "pify": "^3.0.0", + "rimraf": "^2.2.8" + }, + "dependencies": { + "globby": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/globby/-/globby-6.1.0.tgz", + "integrity": "sha1-9abXDoOV4hyFj7BInWTfAkJNUGw=", + "dev": true, + "requires": { + "array-union": "^1.0.1", + "glob": "^7.0.3", + "object-assign": "^4.0.1", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0" + }, + "dependencies": { + "pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", + "dev": true + } + } + }, + "pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", + "dev": true + } + } + }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", + "dev": true + }, + "desired-capabilities": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/desired-capabilities/-/desired-capabilities-0.1.0.tgz", + "integrity": "sha1-84YNEu3g2sgZpHzJWaaMULqbqD4=", + "dev": true, + "requires": { + "extend": "^3.0.0" + } + }, + "detect-indent": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/detect-indent/-/detect-indent-4.0.0.tgz", + "integrity": "sha1-920GQ1LN9Docts5hnE7jqUdd4gg=", + "dev": true, + "requires": { + "repeating": "^2.0.0" + } + }, + "dir-glob": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-2.2.2.tgz", + "integrity": "sha512-f9LBi5QWzIW3I6e//uxZoLBlUt9kcp66qo0sSCxL6YZKc75R1c4MFCoe/LaZiBGmgujvQdxc5Bn3QhfyvK5Hsw==", + "dev": true, + "requires": { + "path-type": "^3.0.0" + } + }, + "ecc-jsbn": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", + "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", + "dev": true, + "requires": { + "jsbn": "~0.1.0", + "safer-buffer": "^2.1.0" + } + }, + "electron-to-chromium": { + "version": "1.3.137", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.137.tgz", + "integrity": "sha512-kGi32g42a8vS/WnYE7ELJyejRT7hbr3UeOOu0WeuYuQ29gCpg9Lrf6RdcTQVXSt/v0bjCfnlb/EWOOsiKpTmkw==", + "dev": true + }, + "elegant-spinner": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/elegant-spinner/-/elegant-spinner-1.0.1.tgz", + "integrity": "sha1-2wQ1IcldfjA/2PNFvtwzSc+wcp4=", + "dev": true + }, + "emittery": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/emittery/-/emittery-0.4.1.tgz", + "integrity": "sha512-r4eRSeStEGf6M5SKdrQhhLK5bOwOBxQhIE3YSTnZE3GpKiLfnnhE+tPtrJE79+eDJgm39BM6LSoI8SCx4HbwlQ==", + "dev": true + }, + "end-of-stream": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.1.tgz", + "integrity": "sha512-1MkrZNvWTKCaigbn+W15elq2BB/L22nqrSY5DKlo3X6+vclJm8Bb5djXJBmEX6fS3+zCh/F4VBK5Z2KxJt4s2Q==", + "dev": true, + "requires": { + "once": "^1.4.0" + } + }, + "endpoint-utils": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/endpoint-utils/-/endpoint-utils-1.0.2.tgz", + "integrity": "sha1-CAjDNppyfNeWejn/NOvJJriBRqg=", + "dev": true, + "requires": { + "ip": "^1.1.3", + "pinkie-promise": "^1.0.0" + }, + "dependencies": { + "pinkie": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-1.0.0.tgz", + "integrity": "sha1-Wkfyi6EBXQIBvae/DzWOR77Ix+Q=", + "dev": true + }, + "pinkie-promise": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-1.0.0.tgz", + "integrity": "sha1-0dpn9UglY7t89X8oauKCLs+/NnA=", + "dev": true, + "requires": { + "pinkie": "^1.0.0" + } + } + } + }, + "error-stack-parser": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/error-stack-parser/-/error-stack-parser-1.3.6.tgz", + "integrity": "sha1-4Oc7k+QXE40c18C3RrGkoUhUwpI=", + "dev": true, + "requires": { + "stackframe": "^0.3.1" + } + }, + "es6-promise": { + "version": "4.2.8", + "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz", + "integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==", + "dev": true + }, + "es6-promisify": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/es6-promisify/-/es6-promisify-5.0.0.tgz", + "integrity": "sha1-UQnWLz5W6pZ8S2NQWu8IKRyKUgM=", + "dev": true, + "requires": { + "es6-promise": "^4.0.3" + } + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "dev": true + }, + "esotope-hammerhead": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/esotope-hammerhead/-/esotope-hammerhead-0.2.1.tgz", + "integrity": "sha512-IicdvCt1BIFTIM4nbjxGp98whIakOYZ4lA0UaDXnXpJpB11jYBX11Uv3x2f5ncSlFmxyZRdrN5skH5wK4TCWFQ==", + "dev": true, + "requires": { + "@types/estree": "^0.0.39" + } + }, + "estree-walker": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-0.6.0.tgz", + "integrity": "sha512-peq1RfVAVzr3PU/jL31RaOjUKLoZJpObQWJJ+LgfcxDUifyLZ1RjPQZTl0pzj2uJ45b7A7XpyppXvxdEqzo4rw==", + "dev": true + }, + "esutils": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", + "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=", + "dev": true + }, + "expand-brackets": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-2.1.4.tgz", + "integrity": "sha1-t3c14xXOMPa27/D4OwQVGiJEliI=", + "dev": true, + "requires": { + "debug": "^2.3.3", + "define-property": "^0.2.5", + "extend-shallow": "^2.0.1", + "posix-character-classes": "^0.1.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "^0.1.0" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + } + } + }, + "extend": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", + "dev": true + }, + "extend-shallow": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-3.0.2.tgz", + "integrity": "sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg=", + "dev": true, + "requires": { + "assign-symbols": "^1.0.0", + "is-extendable": "^1.0.1" + }, + "dependencies": { + "is-extendable": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", + "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", + "dev": true, + "requires": { + "is-plain-object": "^2.0.4" + } + } + } + }, + "extglob": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.4.tgz", + "integrity": "sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw==", + "dev": true, + "requires": { + "array-unique": "^0.3.2", + "define-property": "^1.0.0", + "expand-brackets": "^2.1.4", + "extend-shallow": "^2.0.1", + "fragment-cache": "^0.2.1", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "dev": true, + "requires": { + "is-descriptor": "^1.0.0" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + } + } + }, + "extsprintf": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", + "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=", + "dev": true + }, + "fast-deep-equal": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz", + "integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=", + "dev": true + }, + "fast-glob": { + "version": "2.2.7", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-2.2.7.tgz", + "integrity": "sha512-g1KuQwHOZAmOZMuBtHdxDtju+T2RT8jgCC9aANsbpdiDDTSnjgfuVsIBNKbUeJI3oKMRExcfNDtJl4OhbffMsw==", + "dev": true, + "requires": { + "@mrmlnc/readdir-enhanced": "^2.2.1", + "@nodelib/fs.stat": "^1.1.2", + "glob-parent": "^3.1.0", + "is-glob": "^4.0.0", + "merge2": "^1.2.3", + "micromatch": "^3.1.10" + }, + "dependencies": { + "is-glob": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz", + "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==", + "dev": true, + "requires": { + "is-extglob": "^2.1.1" + } + } + } + }, + "fast-json-stable-stringify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", + "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=", + "dev": true + }, + "fill-range": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", + "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", + "dev": true, + "requires": { + "extend-shallow": "^2.0.1", + "is-number": "^3.0.0", + "repeat-string": "^1.6.1", + "to-regex-range": "^2.1.0" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "for-in": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", + "integrity": "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=", + "dev": true + }, + "forever-agent": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", + "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=", + "dev": true + }, + "form-data": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", + "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", + "dev": true, + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.6", + "mime-types": "^2.1.12" + } + }, + "fragment-cache": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/fragment-cache/-/fragment-cache-0.2.1.tgz", + "integrity": "sha1-QpD60n8T6Jvn8zeZxrxaCr//DRk=", + "dev": true, + "requires": { + "map-cache": "^0.2.2" + } + }, + "fs-constants": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz", + "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==", + "dev": true + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "dev": true + }, + "get-func-name": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", + "integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=", + "dev": true + }, + "get-stdin": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-4.0.1.tgz", + "integrity": "sha1-uWjGsKBDhDJJAui/Gl3zJXmkUP4=", + "dev": true + }, + "get-value": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/get-value/-/get-value-2.0.6.tgz", + "integrity": "sha1-3BXKHGcjh8p2vTesCjlbogQqLCg=", + "dev": true + }, + "getpass": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", + "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", + "dev": true, + "requires": { + "assert-plus": "^1.0.0" + } + }, + "glob": { + "version": "7.1.4", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.4.tgz", + "integrity": "sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "glob-parent": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-3.1.0.tgz", + "integrity": "sha1-nmr2KZ2NO9K9QEMIMr0RPfkGxa4=", + "dev": true, + "requires": { + "is-glob": "^3.1.0", + "path-dirname": "^1.0.0" + }, + "dependencies": { + "is-glob": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-3.1.0.tgz", + "integrity": "sha1-e6WuJCF4BKxwcHuWkiVnSGzD6Eo=", + "dev": true, + "requires": { + "is-extglob": "^2.1.0" + } + } + } + }, + "glob-to-regexp": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/glob-to-regexp/-/glob-to-regexp-0.3.0.tgz", + "integrity": "sha1-jFoUlNIGbFcMw7/kSWF1rMTVAqs=", + "dev": true + }, + "globals": { + "version": "11.12.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", + "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", + "dev": true + }, + "globby": { + "version": "9.2.0", + "resolved": "https://registry.npmjs.org/globby/-/globby-9.2.0.tgz", + "integrity": "sha512-ollPHROa5mcxDEkwg6bPt3QbEf4pDQSNtd6JPL1YvOvAo/7/0VAm9TccUeoTmarjPw4pfUthSCqcyfNB1I3ZSg==", + "dev": true, + "requires": { + "@types/glob": "^7.1.1", + "array-union": "^1.0.2", + "dir-glob": "^2.2.2", + "fast-glob": "^2.2.6", + "glob": "^7.1.3", + "ignore": "^4.0.3", + "pify": "^4.0.1", + "slash": "^2.0.0" + }, + "dependencies": { + "pify": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", + "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==", + "dev": true + }, + "slash": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-2.0.0.tgz", + "integrity": "sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A==", + "dev": true + } + } + }, + "graceful-fs": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.0.tgz", + "integrity": "sha512-jpSvDPV4Cq/bgtpndIWbI5hmYxhQGHPC4d4cqBPb4DLniCfhJokdXhwhaDuLBGLQdvvRum/UiX6ECVIPvDXqdg==", + "dev": true + }, + "graphlib": { + "version": "2.1.7", + "resolved": "https://registry.npmjs.org/graphlib/-/graphlib-2.1.7.tgz", + "integrity": "sha512-TyI9jIy2J4j0qgPmOOrHTCtpPqJGN/aurBwc6ZT+bRii+di1I+Wv3obRhVrmBEXet+qkMaEX67dXrwsd3QQM6w==", + "dev": true, + "requires": { + "lodash": "^4.17.5" + } + }, + "har-schema": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", + "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=", + "dev": true + }, + "har-validator": { + "version": "5.1.3", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.3.tgz", + "integrity": "sha512-sNvOCzEQNr/qrvJgc3UG/kD4QtlHycrzwS+6mfTrrSq97BvaYcPZZI1ZSqGSPR73Cxn4LKTD4PttRwfU7jWq5g==", + "dev": true, + "requires": { + "ajv": "^6.5.5", + "har-schema": "^2.0.0" + } + }, + "has-ansi": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", + "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", + "dev": true, + "requires": { + "ansi-regex": "^2.0.0" + } + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "has-value": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-value/-/has-value-1.0.0.tgz", + "integrity": "sha1-GLKB2lhbHFxR3vJMkw7SmgvmsXc=", + "dev": true, + "requires": { + "get-value": "^2.0.6", + "has-values": "^1.0.0", + "isobject": "^3.0.0" + } + }, + "has-values": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-values/-/has-values-1.0.0.tgz", + "integrity": "sha1-lbC2P+whRmGab+V/51Yo1aOe/k8=", + "dev": true, + "requires": { + "is-number": "^3.0.0", + "kind-of": "^4.0.0" + }, + "dependencies": { + "kind-of": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-4.0.0.tgz", + "integrity": "sha1-IIE989cSkosgc3hpGkUGb65y3Vc=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "highlight-es": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/highlight-es/-/highlight-es-1.0.3.tgz", + "integrity": "sha512-s/SIX6yp/5S1p8aC/NRDC1fwEb+myGIfp8/TzZz0rtAv8fzsdX7vGl3Q1TrXCsczFq8DI3CBFBCySPClfBSdbg==", + "dev": true, + "requires": { + "chalk": "^2.4.0", + "is-es2016-keyword": "^1.0.0", + "js-tokens": "^3.0.0" + }, + "dependencies": { + "js-tokens": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz", + "integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=", + "dev": true + } + } + }, + "home-or-tmp": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/home-or-tmp/-/home-or-tmp-2.0.0.tgz", + "integrity": "sha1-42w/LSyufXRqhX440Y1fMqeILbg=", + "dev": true, + "requires": { + "os-homedir": "^1.0.0", + "os-tmpdir": "^1.0.1" + } + }, + "http-signature": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", + "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", + "dev": true, + "requires": { + "assert-plus": "^1.0.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" + } + }, + "https-proxy-agent": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-2.2.1.tgz", + "integrity": "sha512-HPCTS1LW51bcyMYbxUIOO4HEOlQ1/1qRaFWcyxvwaqUS9TY88aoEuHUY33kuAh1YhVVaDQhLZsnPd+XNARWZlQ==", + "dev": true, + "requires": { + "agent-base": "^4.1.0", + "debug": "^3.1.0" + }, + "dependencies": { + "debug": { + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", + "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + } + } + }, + "iconv-lite": { + "version": "0.4.11", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.11.tgz", + "integrity": "sha1-LstC/SlHRJIiCaLnxATayHk9it4=", + "dev": true + }, + "ieee754": { + "version": "1.1.13", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.13.tgz", + "integrity": "sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg==", + "dev": true + }, + "ignore": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", + "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", + "dev": true + }, + "import-lazy": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/import-lazy/-/import-lazy-3.1.0.tgz", + "integrity": "sha512-8/gvXvX2JMn0F+CDlSC4l6kOmVaLOO3XLkksI7CI3Ud95KDYJuYur2b9P/PUt/i/pDAMd/DulQsNbbbmRRsDIQ==", + "dev": true + }, + "indent-string": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-1.2.2.tgz", + "integrity": "sha1-25m8xYPrarux5I3LsZmamGBBy2s=", + "dev": true, + "requires": { + "get-stdin": "^4.0.1", + "minimist": "^1.1.0", + "repeating": "^1.1.0" + }, + "dependencies": { + "repeating": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/repeating/-/repeating-1.1.3.tgz", + "integrity": "sha1-PUEUIYh3U3SU+X93+Xhfq4EPpKw=", + "dev": true, + "requires": { + "is-finite": "^1.0.0" + } + } + } + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dev": true, + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true + }, + "invariant": { + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/invariant/-/invariant-2.2.4.tgz", + "integrity": "sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA==", + "dev": true, + "requires": { + "loose-envify": "^1.0.0" + } + }, + "ip": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/ip/-/ip-1.1.5.tgz", + "integrity": "sha1-vd7XARQpCCjAoDnnLvJfWq7ENUo=", + "dev": true + }, + "is-accessor-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", + "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", + "dev": true + }, + "is-ci": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/is-ci/-/is-ci-1.2.1.tgz", + "integrity": "sha512-s6tfsaQaQi3JNciBH6shVqEDvhGut0SUXr31ag8Pd8BBbVVlcGfWhpPmEOoM6RJ5TFhbypvf5yyRw/VXW1IiWg==", + "dev": true, + "requires": { + "ci-info": "^1.5.0" + } + }, + "is-data-descriptor": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", + "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "is-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", + "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "^0.1.6", + "is-data-descriptor": "^0.1.4", + "kind-of": "^5.0.0" + }, + "dependencies": { + "kind-of": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", + "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", + "dev": true + } + } + }, + "is-docker": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-1.1.0.tgz", + "integrity": "sha1-8EN01O7lMQ6ajhE78UlUEeRhdqE=", + "dev": true + }, + "is-es2016-keyword": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-es2016-keyword/-/is-es2016-keyword-1.0.0.tgz", + "integrity": "sha1-9uVOEQxeT40mXmnS7Q6vjPX0dxg=", + "dev": true + }, + "is-extendable": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", + "integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=", + "dev": true + }, + "is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", + "dev": true + }, + "is-finite": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-finite/-/is-finite-1.0.2.tgz", + "integrity": "sha1-zGZ3aVYCvlUO8R6LSqYwU0K20Ko=", + "dev": true, + "requires": { + "number-is-nan": "^1.0.0" + } + }, + "is-fullwidth-code-point": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", + "dev": true, + "requires": { + "number-is-nan": "^1.0.0" + } + }, + "is-glob": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz", + "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", + "dev": true, + "requires": { + "is-extglob": "^1.0.0" + }, + "dependencies": { + "is-extglob": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz", + "integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=", + "dev": true + } + } + }, + "is-jquery-obj": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/is-jquery-obj/-/is-jquery-obj-0.1.1.tgz", + "integrity": "sha512-18toSebUVF7y717dgw/Dzn6djOCqrkiDp3MhB8P6TdKyCVkbD1ZwE7Uz8Hwx6hUPTvKjbyYH9ncXT4ts4qLaSA==", + "dev": true + }, + "is-module": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-module/-/is-module-1.0.0.tgz", + "integrity": "sha1-Mlj7afeMFNW4FdZkM2tM/7ZEFZE=", + "dev": true + }, + "is-number": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", + "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "is-path-cwd": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-path-cwd/-/is-path-cwd-1.0.0.tgz", + "integrity": "sha1-0iXsIxMuie3Tj9p2dHLmLmXxEG0=", + "dev": true + }, + "is-path-in-cwd": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-path-in-cwd/-/is-path-in-cwd-1.0.1.tgz", + "integrity": "sha512-FjV1RTW48E7CWM7eE/J2NJvAEEVektecDBVBE5Hh3nM1Jd0kvhHtX68Pr3xsDf857xt3Y4AkwVULK1Vku62aaQ==", + "dev": true, + "requires": { + "is-path-inside": "^1.0.0" + } + }, + "is-path-inside": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-1.0.1.tgz", + "integrity": "sha1-jvW33lBDej/cprToZe96pVy0gDY=", + "dev": true, + "requires": { + "path-is-inside": "^1.0.1" + } + }, + "is-plain-object": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", + "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", + "dev": true, + "requires": { + "isobject": "^3.0.1" + } + }, + "is-stream": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", + "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", + "dev": true + }, + "is-typedarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", + "dev": true + }, + "is-utf8": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz", + "integrity": "sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI=", + "dev": true + }, + "is-windows": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", + "integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==", + "dev": true + }, + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "dev": true + }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", + "dev": true + }, + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + }, + "isstream": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", + "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=", + "dev": true + }, + "js-levenshtein": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/js-levenshtein/-/js-levenshtein-1.1.6.tgz", + "integrity": "sha512-X2BB11YZtrRqY4EnQcLX5Rh373zbK4alC1FW7D7MBhL2gtcC17cTnr6DmfHZeS0s2rTHjUTMMHfG7gO8SSdw+g==", + "dev": true + }, + "js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true + }, + "jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", + "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", + "dev": true + }, + "jsesc": { + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", + "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==", + "dev": true + }, + "json-schema": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", + "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=", + "dev": true + }, + "json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true + }, + "json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=", + "dev": true + }, + "json5": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.1.0.tgz", + "integrity": "sha512-8Mh9h6xViijj36g7Dxi+Y4S6hNGV96vcJZr/SrlHh1LR/pEn/8j/+qIBbs44YKl69Lrfctp4QD+AdWLTMqEZAQ==", + "dev": true, + "requires": { + "minimist": "^1.2.0" + } + }, + "jsprim": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", + "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", + "dev": true, + "requires": { + "assert-plus": "1.0.0", + "extsprintf": "1.3.0", + "json-schema": "0.2.3", + "verror": "1.10.0" + } + }, + "kind-of": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", + "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", + "dev": true + }, + "lazystream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/lazystream/-/lazystream-1.0.0.tgz", + "integrity": "sha1-9plf4PggOS9hOWvolGJAe7dxaOQ=", + "dev": true, + "requires": { + "readable-stream": "^2.0.5" + } + }, + "linux-platform-info": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/linux-platform-info/-/linux-platform-info-0.0.3.tgz", + "integrity": "sha1-La4yQ4Xmbj11W+yD+Gx77qYc64M=", + "dev": true, + "requires": { + "os-family": "^1.0.0" + } + }, + "lodash": { + "version": "4.17.11", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", + "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", + "dev": true + }, + "log-update-async-hook": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/log-update-async-hook/-/log-update-async-hook-2.0.2.tgz", + "integrity": "sha512-HQwkKFTZeUOrDi1Duf2CSUa/pSpcaCHKLdx3D/Z16DsipzByOBffcg5y0JZA1q0n80dYgLXe2hFM9JGNgBsTDw==", + "dev": true, + "requires": { + "ansi-escapes": "^2.0.0", + "async-exit-hook": "^1.1.2", + "onetime": "^2.0.1", + "wrap-ansi": "^2.1.0" + } + }, + "loose-envify": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", + "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", + "dev": true, + "requires": { + "js-tokens": "^3.0.0 || ^4.0.0" + } + }, + "lru-cache": { + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-2.6.3.tgz", + "integrity": "sha1-UczQtPwMhDWH16VwnOTTt2Kb7cU=", + "dev": true + }, + "make-dir": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-1.3.0.tgz", + "integrity": "sha512-2w31R7SJtieJJnQtGc7RVL2StM2vGYVfqUOvUDxH6bC6aJTxPxTF0GnIgCyu7tjockiUWAYQRbxa7vKn34s5sQ==", + "dev": true, + "requires": { + "pify": "^3.0.0" + }, + "dependencies": { + "pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", + "dev": true + } + } + }, + "map-cache": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/map-cache/-/map-cache-0.2.2.tgz", + "integrity": "sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8=", + "dev": true + }, + "map-reverse": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/map-reverse/-/map-reverse-1.0.1.tgz", + "integrity": "sha1-J06fUAphEVMYO1uNhJCpwcI+4xA=", + "dev": true + }, + "map-visit": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/map-visit/-/map-visit-1.0.0.tgz", + "integrity": "sha1-7Nyo8TFE5mDxtb1B8S80edmN+48=", + "dev": true, + "requires": { + "object-visit": "^1.0.0" + } + }, + "match-url-wildcard": { + "version": "0.0.4", + "resolved": "https://registry.npmjs.org/match-url-wildcard/-/match-url-wildcard-0.0.4.tgz", + "integrity": "sha512-R1XhQaamUZPWLOPtp4ig5j+3jctN+skhgRmEQTUamMzmNtRG69QEirQs0NZKLtHMR7tzWpmtnS4Eqv65DcgXUA==", + "dev": true, + "requires": { + "escape-string-regexp": "^1.0.5" + } + }, + "merge-stream": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-1.0.1.tgz", + "integrity": "sha1-QEEgLVCKNCugAXQAjfDCUbjBNeE=", + "dev": true, + "requires": { + "readable-stream": "^2.0.1" + } + }, + "merge2": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.2.3.tgz", + "integrity": "sha512-gdUU1Fwj5ep4kplwcmftruWofEFt6lfpkkr3h860CXbAB9c3hGb55EOL2ali0Td5oebvW0E1+3Sr+Ur7XfKpRA==", + "dev": true + }, + "micromatch": { + "version": "3.1.10", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz", + "integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==", + "dev": true, + "requires": { + "arr-diff": "^4.0.0", + "array-unique": "^0.3.2", + "braces": "^2.3.1", + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "extglob": "^2.0.4", + "fragment-cache": "^0.2.1", + "kind-of": "^6.0.2", + "nanomatch": "^1.2.9", + "object.pick": "^1.3.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.2" + } + }, + "mime": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.4.1.tgz", + "integrity": "sha512-KI1+qOZu5DcW6wayYHSzR/tXKCDC5Om4s1z2QJjDULzLcmf3DvzS7oluY4HCTrc+9FiKmWUgeNLg7W3uIQvxtQ==", + "dev": true + }, + "mime-db": { + "version": "1.40.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.40.0.tgz", + "integrity": "sha512-jYdeOMPy9vnxEqFRRo6ZvTZ8d9oPb+k18PKoYNYUe2stVEBPPwsln/qWzdbmaIvnhZ9v2P+CuecK+fpUfsV2mA==", + "dev": true + }, + "mime-types": { + "version": "2.1.24", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.24.tgz", + "integrity": "sha512-WaFHS3MCl5fapm3oLxU4eYDw77IQM2ACcxQ9RIxfaC3ooc6PFuBMGZZsYpvoXS5D5QTWPieo1jjLdAm3TBP3cQ==", + "dev": true, + "requires": { + "mime-db": "1.40.0" + } + }, + "mimic-fn": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz", + "integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==", + "dev": true + }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "minimist": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", + "dev": true + }, + "mixin-deep": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.2.tgz", + "integrity": "sha512-WRoDn//mXBiJ1H40rqa3vH0toePwSsGb45iInWlTySa+Uu4k3tYUSxa2v1KqAiLtvlrSzaExqS1gtk96A9zvEA==", + "dev": true, + "requires": { + "for-in": "^1.0.2", + "is-extendable": "^1.0.1" + }, + "dependencies": { + "is-extendable": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", + "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", + "dev": true, + "requires": { + "is-plain-object": "^2.0.4" + } + } + } + }, + "mkdirp": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", + "dev": true, + "requires": { + "minimist": "0.0.8" + }, + "dependencies": { + "minimist": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", + "dev": true + } + } + }, + "moment": { + "version": "2.24.0", + "resolved": "https://registry.npmjs.org/moment/-/moment-2.24.0.tgz", + "integrity": "sha512-bV7f+6l2QigeBBZSM/6yTNq4P2fNpSWj/0e7jQcy87A8e7o2nAfP/34/2ky5Vw4B9S446EtIhodAzkFCcR4dQg==", + "dev": true + }, + "moment-duration-format-commonjs": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/moment-duration-format-commonjs/-/moment-duration-format-commonjs-1.0.0.tgz", + "integrity": "sha512-MVFR4hIh4jfuwSCPBEE5CCwn3refvTsxK/Yv/DpKJ6YcNnCimlVJ6DQeTJG1KVQPw1o8m3tkbHE9gVjivyv9iA==", + "dev": true + }, + "ms": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", + "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", + "dev": true + }, + "mustache": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/mustache/-/mustache-2.3.2.tgz", + "integrity": "sha512-KpMNwdQsYz3O/SBS1qJ/o3sqUJ5wSb8gb0pul8CO0S56b9Y2ALm8zCfsjPXsqGFfoNBkDwZuZIAjhsZI03gYVQ==", + "dev": true + }, + "nanoid": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-1.3.4.tgz", + "integrity": "sha512-4ug4BsuHxiVHoRUe1ud6rUFT3WUMmjXt1W0quL0CviZQANdan7D8kqN5/maw53hmAApY/jfzMRkC57BNNs60ZQ==", + "dev": true + }, + "nanomatch": { + "version": "1.2.13", + "resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.13.tgz", + "integrity": "sha512-fpoe2T0RbHwBTBUOftAfBPaDEi06ufaUai0mE6Yn1kacc3SnTErfb/h+X94VXzI64rKFHYImXSvdwGGCmwOqCA==", + "dev": true, + "requires": { + "arr-diff": "^4.0.0", + "array-unique": "^0.3.2", + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "fragment-cache": "^0.2.1", + "is-windows": "^1.0.2", + "kind-of": "^6.0.2", + "object.pick": "^1.3.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + } + }, + "node-releases": { + "version": "1.1.21", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.21.tgz", + "integrity": "sha512-TwnURTCjc8a+ElJUjmDqU6+12jhli1Q61xOQmdZ7ECZVBZuQpN/1UnembiIHDM1wCcfLvh5wrWXUF5H6ufX64Q==", + "dev": true, + "requires": { + "semver": "^5.3.0" + } + }, + "node-version": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/node-version/-/node-version-1.2.0.tgz", + "integrity": "sha512-ma6oU4Sk0qOoKEAymVoTvk8EdXEobdS7m/mAGhDJ8Rouugho48crHBORAmy5BoOcv8wraPM6xumapQp5hl4iIQ==", + "dev": true + }, + "normalize-path": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", + "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=", + "dev": true, + "requires": { + "remove-trailing-separator": "^1.0.1" + } + }, + "number-is-nan": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", + "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", + "dev": true + }, + "oauth-sign": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", + "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==", + "dev": true + }, + "object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", + "dev": true + }, + "object-copy": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/object-copy/-/object-copy-0.1.0.tgz", + "integrity": "sha1-fn2Fi3gb18mRpBupde04EnVOmYw=", + "dev": true, + "requires": { + "copy-descriptor": "^0.1.0", + "define-property": "^0.2.5", + "kind-of": "^3.0.3" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "^0.1.0" + } + }, + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "object-visit": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/object-visit/-/object-visit-1.0.1.tgz", + "integrity": "sha1-95xEk68MU3e1n+OdOV5BBC3QRbs=", + "dev": true, + "requires": { + "isobject": "^3.0.0" + } + }, + "object.pick": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/object.pick/-/object.pick-1.3.0.tgz", + "integrity": "sha1-h6EKxMFpS9Lhy/U1kaZhQftd10c=", + "dev": true, + "requires": { + "isobject": "^3.0.1" + } + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dev": true, + "requires": { + "wrappy": "1" + } + }, + "onetime": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-2.0.1.tgz", + "integrity": "sha1-BnQoIw/WdEOyeUsiu6UotoZ5YtQ=", + "dev": true, + "requires": { + "mimic-fn": "^1.0.0" + } + }, + "os-family": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/os-family/-/os-family-1.1.0.tgz", + "integrity": "sha512-E3Orl5pvDJXnVmpaAA2TeNNpNhTMl4o5HghuWhOivBjEiTnJSrMYSa5uZMek1lBEvu8kKEsa2YgVcGFVDqX/9w==", + "dev": true + }, + "os-homedir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", + "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", + "dev": true + }, + "os-tmpdir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", + "dev": true + }, + "p-map": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/p-map/-/p-map-1.2.0.tgz", + "integrity": "sha512-r6zKACMNhjPJMTl8KcFH4li//gkrXWfbD6feV8l6doRHlzljFWGJ2AP6iKaCJXyZmAUMOPtvbW7EXkbWO/pLEA==", + "dev": true + }, + "parse5": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-1.5.1.tgz", + "integrity": "sha1-m387DeMr543CQBsXVzzK8Pb1nZQ=", + "dev": true + }, + "pascalcase": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/pascalcase/-/pascalcase-0.1.1.tgz", + "integrity": "sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ=", + "dev": true + }, + "path-dirname": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/path-dirname/-/path-dirname-1.0.2.tgz", + "integrity": "sha1-zDPSTVJeCZpTiMAzbG4yuRYGCeA=", + "dev": true + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "dev": true + }, + "path-is-inside": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/path-is-inside/-/path-is-inside-1.0.2.tgz", + "integrity": "sha1-NlQX3t5EQw0cEa9hAn+s8HS9/FM=", + "dev": true + }, + "path-parse": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", + "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", + "dev": true + }, + "path-type": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-3.0.0.tgz", + "integrity": "sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg==", + "dev": true, + "requires": { + "pify": "^3.0.0" + }, + "dependencies": { + "pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", + "dev": true + } + } + }, + "pathval": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.0.tgz", + "integrity": "sha1-uULm1L3mUwBe9rcTYd74cn0GReA=", + "dev": true + }, + "performance-now": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", + "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=", + "dev": true + }, + "pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", + "dev": true + }, + "pinkie": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", + "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=", + "dev": true + }, + "pinkie-promise": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", + "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", + "dev": true, + "requires": { + "pinkie": "^2.0.0" + } + }, + "pngjs": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/pngjs/-/pngjs-3.4.0.tgz", + "integrity": "sha512-NCrCHhWmnQklfH4MtJMRjZ2a8c80qXeMlQMv2uVp9ISJMTt562SbGd6n2oq0PaPgKm7Z6pL9E2UlLIhC+SHL3w==", + "dev": true + }, + "posix-character-classes": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/posix-character-classes/-/posix-character-classes-0.1.1.tgz", + "integrity": "sha1-AerA/jta9xoqbAL+q7jB/vfgDqs=", + "dev": true + }, + "private": { + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/private/-/private-0.1.8.tgz", + "integrity": "sha512-VvivMrbvd2nKkiG38qjULzlc+4Vx4wm/whI9pQD35YrARNnhxeiRktSOhSukRLFNlzg6Br/cJPet5J/u19r/mg==", + "dev": true + }, + "process-nextick-args": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", + "dev": true + }, + "promisify-event": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/promisify-event/-/promisify-event-1.0.0.tgz", + "integrity": "sha1-vXUj6ga3AWLzcJeQFrU6aGxg6Q8=", + "dev": true, + "requires": { + "pinkie-promise": "^2.0.0" + } + }, + "pseudomap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", + "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=", + "dev": true + }, + "psl": { + "version": "1.1.33", + "resolved": "https://registry.npmjs.org/psl/-/psl-1.1.33.tgz", + "integrity": "sha512-LTDP2uSrsc7XCb5lO7A8BI1qYxRe/8EqlRvMeEl6rsnYAqDOl8xHR+8lSAIVfrNaSAlTPTNOCgNjWcoUL3AZsw==", + "dev": true + }, + "punycode": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", + "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=", + "dev": true + }, + "q": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/q/-/q-1.4.1.tgz", + "integrity": "sha1-VXBbzZPF82c1MMLCy8DCs63cKG4=", + "dev": true + }, + "qrcode-terminal": { + "version": "0.10.0", + "resolved": "https://registry.npmjs.org/qrcode-terminal/-/qrcode-terminal-0.10.0.tgz", + "integrity": "sha1-p2pI4mEKGPl/o6K9UytoKs/4bFM=", + "dev": true + }, + "qs": { + "version": "6.5.2", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", + "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==", + "dev": true + }, + "read-file-relative": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/read-file-relative/-/read-file-relative-1.2.0.tgz", + "integrity": "sha1-mPfZbqoh0rTHov69Y9L8jPNen5s=", + "dev": true, + "requires": { + "callsite": "^1.0.0" + } + }, + "readable-stream": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", + "dev": true, + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "regenerate": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.4.0.tgz", + "integrity": "sha512-1G6jJVDWrt0rK99kBjvEtziZNCICAuvIPkSiUFIQxVP06RCVpq3dmDo2oi6ABpYaDYaTRr67BEhL8r1wgEZZKg==", + "dev": true + }, + "regenerate-unicode-properties": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/regenerate-unicode-properties/-/regenerate-unicode-properties-8.1.0.tgz", + "integrity": "sha512-LGZzkgtLY79GeXLm8Dp0BVLdQlWICzBnJz/ipWUgo59qBaZ+BHtq51P2q1uVZlppMuUAT37SDk39qUbjTWB7bA==", + "dev": true, + "requires": { + "regenerate": "^1.4.0" + } + }, + "regenerator-runtime": { + "version": "0.11.1", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz", + "integrity": "sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg==", + "dev": true + }, + "regenerator-transform": { + "version": "0.14.0", + "resolved": "https://registry.npmjs.org/regenerator-transform/-/regenerator-transform-0.14.0.tgz", + "integrity": "sha512-rtOelq4Cawlbmq9xuMR5gdFmv7ku/sFoB7sRiywx7aq53bc52b4j6zvH7Te1Vt/X2YveDKnCGUbioieU7FEL3w==", + "dev": true, + "requires": { + "private": "^0.1.6" + } + }, + "regex-not": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/regex-not/-/regex-not-1.0.2.tgz", + "integrity": "sha512-J6SDjUgDxQj5NusnOtdFxDwN/+HWykR8GELwctJ7mdqhcyy1xEc4SRFHUXvxTp661YaVKAjfRLZ9cCqS6tn32A==", + "dev": true, + "requires": { + "extend-shallow": "^3.0.2", + "safe-regex": "^1.1.0" + } + }, + "regexp-tree": { + "version": "0.1.10", + "resolved": "https://registry.npmjs.org/regexp-tree/-/regexp-tree-0.1.10.tgz", + "integrity": "sha512-K1qVSbcedffwuIslMwpe6vGlj+ZXRnGkvjAtFHfDZZZuEdA/h0dxljAPu9vhUo6Rrx2U2AwJ+nSQ6hK+lrP5MQ==", + "dev": true + }, + "regexpu-core": { + "version": "4.5.4", + "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-4.5.4.tgz", + "integrity": "sha512-BtizvGtFQKGPUcTy56o3nk1bGRp4SZOTYrDtGNlqCQufptV5IkkLN6Emw+yunAJjzf+C9FQFtvq7IoA3+oMYHQ==", + "dev": true, + "requires": { + "regenerate": "^1.4.0", + "regenerate-unicode-properties": "^8.0.2", + "regjsgen": "^0.5.0", + "regjsparser": "^0.6.0", + "unicode-match-property-ecmascript": "^1.0.4", + "unicode-match-property-value-ecmascript": "^1.1.0" + } + }, + "regjsgen": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/regjsgen/-/regjsgen-0.5.0.tgz", + "integrity": "sha512-RnIrLhrXCX5ow/E5/Mh2O4e/oa1/jW0eaBKTSy3LaCj+M3Bqvm97GWDp2yUtzIs4LEn65zR2yiYGFqb2ApnzDA==", + "dev": true + }, + "regjsparser": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.6.0.tgz", + "integrity": "sha512-RQ7YyokLiQBomUJuUG8iGVvkgOLxwyZM8k6d3q5SAXpg4r5TZJZigKFvC6PpD+qQ98bCDC5YelPeA3EucDoNeQ==", + "dev": true, + "requires": { + "jsesc": "~0.5.0" + }, + "dependencies": { + "jsesc": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz", + "integrity": "sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0=", + "dev": true + } + } + }, + "remove-trailing-separator": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz", + "integrity": "sha1-wkvOKig62tW8P1jg1IJJuSN52O8=", + "dev": true + }, + "repeat-element": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.3.tgz", + "integrity": "sha512-ahGq0ZnV5m5XtZLMb+vP76kcAM5nkLqk0lpqAuojSKGgQtn4eRi4ZZGm2olo2zKFH+sMsWaqOCW1dqAnOru72g==", + "dev": true + }, + "repeat-string": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", + "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=", + "dev": true + }, + "repeating": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/repeating/-/repeating-2.0.1.tgz", + "integrity": "sha1-UhTFOpJtNVJwdSf7q0FdvAjQbdo=", + "dev": true, + "requires": { + "is-finite": "^1.0.0" + } + }, + "replicator": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/replicator/-/replicator-1.0.3.tgz", + "integrity": "sha512-WsKsraaM0x0QHy5CtzdgFXUxyowoBhyNkmPqmZShW6h+rOWnyT6Od3zRdTX9r616rAA6kDC9MKQGnSM/CJKfVQ==", + "dev": true + }, + "request": { + "version": "2.88.0", + "resolved": "https://registry.npmjs.org/request/-/request-2.88.0.tgz", + "integrity": "sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg==", + "dev": true, + "requires": { + "aws-sign2": "~0.7.0", + "aws4": "^1.8.0", + "caseless": "~0.12.0", + "combined-stream": "~1.0.6", + "extend": "~3.0.2", + "forever-agent": "~0.6.1", + "form-data": "~2.3.2", + "har-validator": "~5.1.0", + "http-signature": "~1.2.0", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.19", + "oauth-sign": "~0.9.0", + "performance-now": "^2.1.0", + "qs": "~6.5.2", + "safe-buffer": "^5.1.2", + "tough-cookie": "~2.4.3", + "tunnel-agent": "^0.6.0", + "uuid": "^3.3.2" + }, + "dependencies": { + "tough-cookie": { + "version": "2.4.3", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.4.3.tgz", + "integrity": "sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ==", + "dev": true, + "requires": { + "psl": "^1.1.24", + "punycode": "^1.4.1" + } + } + } + }, + "resolve": { + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.11.0.tgz", + "integrity": "sha512-WL2pBDjqT6pGUNSUzMw00o4T7If+z4H2x3Gz893WoUQ5KW8Vr9txp00ykiP16VBaZF5+j/OcXJHZ9+PCvdiDKw==", + "dev": true, + "requires": { + "path-parse": "^1.0.6" + } + }, + "resolve-cwd": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-1.0.0.tgz", + "integrity": "sha1-Tq7qQe0EDRcCRX32SkKysH0kb58=", + "dev": true, + "requires": { + "resolve-from": "^2.0.0" + }, + "dependencies": { + "resolve-from": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-2.0.0.tgz", + "integrity": "sha1-lICrIOlP+h2egKgEx+oUdhGWa1c=", + "dev": true + } + } + }, + "resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true + }, + "resolve-url": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/resolve-url/-/resolve-url-0.2.1.tgz", + "integrity": "sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo=", + "dev": true + }, + "ret": { + "version": "0.1.15", + "resolved": "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz", + "integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==", + "dev": true + }, + "rimraf": { + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz", + "integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + }, + "rollup": { + "version": "1.12.3", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-1.12.3.tgz", + "integrity": "sha512-ueWhPijWN+GaPgD3l77hXih/gcDXmYph6sWeQegwBYtaqAE834e8u+MC2wT6FKIUsz1DBOyOXAQXUZB+rjWDoQ==", + "dev": true, + "requires": { + "@types/estree": "0.0.39", + "@types/node": "^12.0.2", + "acorn": "^6.1.1" + } + }, + "rollup-plugin-babel": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/rollup-plugin-babel/-/rollup-plugin-babel-4.3.2.tgz", + "integrity": "sha512-KfnizE258L/4enADKX61ozfwGHoqYauvoofghFJBhFnpH9Sb9dNPpWg8QHOaAfVASUYV8w0mCx430i9z0LJoJg==", + "dev": true, + "requires": { + "@babel/helper-module-imports": "^7.0.0", + "rollup-pluginutils": "^2.3.0" + } + }, + "rollup-plugin-json": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/rollup-plugin-json/-/rollup-plugin-json-4.0.0.tgz", + "integrity": "sha512-hgb8N7Cgfw5SZAkb3jf0QXii6QX/FOkiIq2M7BAQIEydjHvTyxXHQiIzZaTFgx1GK0cRCHOCBHIyEkkLdWKxow==", + "dev": true, + "requires": { + "rollup-pluginutils": "^2.5.0" + } + }, + "rollup-plugin-node-resolve": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/rollup-plugin-node-resolve/-/rollup-plugin-node-resolve-5.0.0.tgz", + "integrity": "sha512-JUFr7DkFps3div9DYwpSg0O+s8zuSSRASUZUVNx6h6zhw2m8vcpToeS68JDPsFbmisMVSMYK0IxftngCRv7M9Q==", + "dev": true, + "requires": { + "@types/resolve": "0.0.8", + "builtin-modules": "^3.1.0", + "is-module": "^1.0.0", + "resolve": "^1.10.1", + "rollup-pluginutils": "^2.7.0" + } + }, + "rollup-pluginutils": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/rollup-pluginutils/-/rollup-pluginutils-2.7.1.tgz", + "integrity": "sha512-3nRf3buQGR9qz/IsSzhZAJyoK663kzseps8itkYHr+Z7ESuaffEPfgRinxbCRA0pf0gzLqkNKkSb8aNVTq75NA==", + "dev": true, + "requires": { + "estree-walker": "^0.6.0", + "micromatch": "^3.1.10" + } + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true + }, + "safe-regex": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz", + "integrity": "sha1-QKNmnzsHfR6UPURinhV91IAjvy4=", + "dev": true, + "requires": { + "ret": "~0.1.10" + } + }, + "safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "dev": true + }, + "sanitize-filename": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/sanitize-filename/-/sanitize-filename-1.6.1.tgz", + "integrity": "sha1-YS2hyWRz+gLczaktzVtKsWSmdyo=", + "dev": true, + "requires": { + "truncate-utf8-bytes": "^1.0.0" + } + }, + "sauce-connect-launcher": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/sauce-connect-launcher/-/sauce-connect-launcher-1.2.7.tgz", + "integrity": "sha512-v07+QhFrxgz3seMFuRSonu3gW1s6DbcLQlFhjsRrmKUauzPbbudHdnn91WYgEwhoZVdPNzeZpAEJwcQyd9xnTA==", + "dev": true, + "requires": { + "adm-zip": "~0.4.3", + "async": "^2.1.2", + "https-proxy-agent": "^2.2.1", + "lodash": "^4.16.6", + "rimraf": "^2.5.4" + }, + "dependencies": { + "async": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/async/-/async-2.6.2.tgz", + "integrity": "sha512-H1qVYh1MYhEEFLsP97cVKqCGo7KfCyTt6uEWqsTBr9SO84oK9Uwbyd/yCW+6rKJLHksBNUVWZDAjfS+Ccx0Bbg==", + "dev": true, + "requires": { + "lodash": "^4.17.11" + } + } + } + }, + "saucelabs-connector": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/saucelabs-connector/-/saucelabs-connector-0.3.0.tgz", + "integrity": "sha512-r0PWFUZeWMoWaKWhvnaHpro5VfpLbg+avKdjb0bs+xSTNh4S6sgjVJMhM8vSjOXog2DjZVe1Agv4Ta5GCMLMog==", + "dev": true, + "requires": { + "babel-runtime": "^5.8.20", + "lodash": "^4.13.1", + "os-family": "^1.0.0", + "pify": "^2.3.0", + "pinkie": "^2.0.4", + "read-file-relative": "^1.2.0", + "request": "^2.67.0", + "sauce-connect-launcher": "^1.2.5", + "wd": "^1.2.0" + }, + "dependencies": { + "babel-runtime": { + "version": "5.8.38", + "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-5.8.38.tgz", + "integrity": "sha1-HAsC62MxL18If/IEUIJ7QlydTBk=", + "dev": true, + "requires": { + "core-js": "^1.0.0" + } + }, + "core-js": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-1.2.7.tgz", + "integrity": "sha1-ZSKUwUZR2yj6k70tX/KYOk8IxjY=", + "dev": true + } + } + }, + "semver": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.0.tgz", + "integrity": "sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA==", + "dev": true + }, + "set-value": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.0.tgz", + "integrity": "sha512-hw0yxk9GT/Hr5yJEYnHNKYXkIA8mVJgd9ditYZCe16ZczcaELYYcfvaXesNACk2O8O0nTiPQcQhGUQj8JLzeeg==", + "dev": true, + "requires": { + "extend-shallow": "^2.0.1", + "is-extendable": "^0.1.1", + "is-plain-object": "^2.0.3", + "split-string": "^3.0.1" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "slash": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-1.0.0.tgz", + "integrity": "sha1-xB8vbDn8FtHNF61LXYlhFK5HDVU=", + "dev": true + }, + "snapdragon": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/snapdragon/-/snapdragon-0.8.2.tgz", + "integrity": "sha512-FtyOnWN/wCHTVXOMwvSv26d+ko5vWlIDD6zoUJ7LW8vh+ZBC8QdljveRP+crNrtBwioEUWy/4dMtbBjA4ioNlg==", + "dev": true, + "requires": { + "base": "^0.11.1", + "debug": "^2.2.0", + "define-property": "^0.2.5", + "extend-shallow": "^2.0.1", + "map-cache": "^0.2.2", + "source-map": "^0.5.6", + "source-map-resolve": "^0.5.0", + "use": "^3.1.0" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "^0.1.0" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + } + } + }, + "snapdragon-node": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/snapdragon-node/-/snapdragon-node-2.1.1.tgz", + "integrity": "sha512-O27l4xaMYt/RSQ5TR3vpWCAB5Kb/czIcqUFOM/C4fYcLnbZUc1PkjTAMjof2pBWaSTwOUd6qUHcFGVGj7aIwnw==", + "dev": true, + "requires": { + "define-property": "^1.0.0", + "isobject": "^3.0.0", + "snapdragon-util": "^3.0.1" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "dev": true, + "requires": { + "is-descriptor": "^1.0.0" + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + } + } + }, + "snapdragon-util": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/snapdragon-util/-/snapdragon-util-3.0.1.tgz", + "integrity": "sha512-mbKkMdQKsjX4BAL4bRYTj21edOf8cN7XHdYUJEe+Zn99hVEYcMvKPct1IqNe7+AZPirn8BCDOQBHQZknqmKlZQ==", + "dev": true, + "requires": { + "kind-of": "^3.2.0" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", + "dev": true + }, + "source-map-resolve": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/source-map-resolve/-/source-map-resolve-0.5.2.tgz", + "integrity": "sha512-MjqsvNwyz1s0k81Goz/9vRBe9SZdB09Bdw+/zYyO+3CuPk6fouTaxscHkgtE8jKvf01kVfl8riHzERQ/kefaSA==", + "dev": true, + "requires": { + "atob": "^2.1.1", + "decode-uri-component": "^0.2.0", + "resolve-url": "^0.2.1", + "source-map-url": "^0.4.0", + "urix": "^0.1.0" + } + }, + "source-map-support": { + "version": "0.5.12", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.12.tgz", + "integrity": "sha512-4h2Pbvyy15EE02G+JOZpUCmqWJuqrs+sEkzewTm++BPi7Hvn/HwcqLAcNxYAyI0x13CpPPn+kMjl+hplXMHITQ==", + "dev": true, + "requires": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + }, + "dependencies": { + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + } + } + }, + "source-map-url": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/source-map-url/-/source-map-url-0.4.0.tgz", + "integrity": "sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM=", + "dev": true + }, + "split-string": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/split-string/-/split-string-3.1.0.tgz", + "integrity": "sha512-NzNVhJDYpwceVVii8/Hu6DKfD2G+NrQHlS/V/qgv763EYudVwEcMQNxd2lh+0VrUByXN/oJkl5grOhYWvQUYiw==", + "dev": true, + "requires": { + "extend-shallow": "^3.0.0" + } + }, + "sshpk": { + "version": "1.16.1", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz", + "integrity": "sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg==", + "dev": true, + "requires": { + "asn1": "~0.2.3", + "assert-plus": "^1.0.0", + "bcrypt-pbkdf": "^1.0.0", + "dashdash": "^1.12.0", + "ecc-jsbn": "~0.1.1", + "getpass": "^0.1.1", + "jsbn": "~0.1.0", + "safer-buffer": "^2.0.2", + "tweetnacl": "~0.14.0" + } + }, + "stackframe": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/stackframe/-/stackframe-0.3.1.tgz", + "integrity": "sha1-M6qE8Rd6VUjIk1Uzy/6zQgl19aQ=", + "dev": true + }, + "static-extend": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/static-extend/-/static-extend-0.1.2.tgz", + "integrity": "sha1-YICcOcv/VTNyJv1eC1IPNB8ftcY=", + "dev": true, + "requires": { + "define-property": "^0.2.5", + "object-copy": "^0.1.0" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "^0.1.0" + } + } + } + }, + "string-width": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "dev": true, + "requires": { + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" + } + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dev": true, + "requires": { + "safe-buffer": "~5.1.0" + } + }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "dev": true, + "requires": { + "ansi-regex": "^2.0.0" + } + }, + "strip-bom": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-2.0.0.tgz", + "integrity": "sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4=", + "dev": true, + "requires": { + "is-utf8": "^0.2.0" + } + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + }, + "tar-stream": { + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-1.6.2.tgz", + "integrity": "sha512-rzS0heiNf8Xn7/mpdSVVSMAWAoy9bfb1WOTYC78Z0UQKeKa/CWS8FOq0lKGNa8DWKAn9gxjCvMLYc5PGXYlK2A==", + "dev": true, + "requires": { + "bl": "^1.0.0", + "buffer-alloc": "^1.2.0", + "end-of-stream": "^1.0.0", + "fs-constants": "^1.0.0", + "readable-stream": "^2.3.0", + "to-buffer": "^1.1.1", + "xtend": "^4.0.0" + } + }, + "testcafe": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/testcafe/-/testcafe-1.3.1.tgz", + "integrity": "sha512-5IkyFxKBdrUut9JEmGR8lU4qbxL9N9F/3yNJqfLF29bpRfrmJY2FZdAYQ1iHEayfCcSTxQxcqRCEkVsmRTaI4g==", + "dev": true, + "requires": { + "@types/node": "^10.12.19", + "async-exit-hook": "^1.1.2", + "babel-core": "^6.22.1", + "babel-plugin-transform-class-properties": "^6.24.1", + "babel-plugin-transform-for-of-as-array": "^1.1.1", + "babel-plugin-transform-runtime": "^6.22.0", + "babel-preset-env": "^1.1.8", + "babel-preset-flow": "^6.23.0", + "babel-preset-stage-2": "^6.22.0", + "babel-runtime": "^6.22.0", + "bin-v8-flags-filter": "^1.1.2", + "callsite": "^1.0.0", + "callsite-record": "^4.0.0", + "chai": "^4.1.2", + "chalk": "^1.1.0", + "chrome-emulated-devices-list": "^0.1.0", + "chrome-remote-interface": "^0.25.3", + "coffeescript": "^2.3.1", + "commander": "^2.8.1", + "debug": "^2.2.0", + "dedent": "^0.4.0", + "del": "^3.0.0", + "elegant-spinner": "^1.0.1", + "emittery": "^0.4.1", + "endpoint-utils": "^1.0.2", + "error-stack-parser": "^1.3.6", + "globby": "^9.2.0", + "graceful-fs": "^4.1.11", + "graphlib": "^2.1.5", + "import-lazy": "^3.1.0", + "indent-string": "^1.2.2", + "is-ci": "^1.0.10", + "is-docker": "^1.1.0", + "is-glob": "^2.0.1", + "is-stream": "^1.1.0", + "json5": "^2.1.0", + "lodash": "^4.17.11", + "log-update-async-hook": "^2.0.2", + "make-dir": "^1.3.0", + "map-reverse": "^1.0.1", + "moment": "^2.10.3", + "moment-duration-format-commonjs": "^1.0.0", + "mustache": "^2.1.2", + "nanoid": "^1.0.1", + "node-version": "^1.0.0", + "os-family": "^1.0.0", + "parse5": "^1.5.0", + "pify": "^2.3.0", + "pinkie": "^2.0.4", + "pngjs": "^3.3.1", + "promisify-event": "^1.0.0", + "qrcode-terminal": "^0.10.0", + "read-file-relative": "^1.2.0", + "replicator": "^1.0.3", + "resolve-cwd": "^1.0.0", + "resolve-from": "^4.0.0", + "sanitize-filename": "^1.6.0", + "source-map-support": "^0.5.5", + "strip-bom": "^2.0.0", + "testcafe-browser-tools": "1.6.8", + "testcafe-hammerhead": "14.6.10", + "testcafe-legacy-api": "3.1.11", + "testcafe-reporter-json": "^2.1.0", + "testcafe-reporter-list": "^2.1.0", + "testcafe-reporter-minimal": "^2.1.0", + "testcafe-reporter-spec": "^2.1.1", + "testcafe-reporter-xunit": "^2.1.0", + "time-limit-promise": "^1.0.2", + "tmp": "0.0.28", + "tree-kill": "^1.1.0", + "typescript": "^3.3.3", + "useragent": "^2.1.7" + }, + "dependencies": { + "@types/node": { + "version": "10.14.12", + "resolved": "https://registry.npmjs.org/@types/node/-/node-10.14.12.tgz", + "integrity": "sha512-QcAKpaO6nhHLlxWBvpc4WeLrTvPqlHOvaj0s5GriKkA1zq+bsFBPpfYCvQhLqLgYlIko8A9YrPdaMHCo5mBcpg==", + "dev": true + }, + "ansi-styles": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", + "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", + "dev": true + }, + "chalk": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", + "dev": true, + "requires": { + "ansi-styles": "^2.2.1", + "escape-string-regexp": "^1.0.2", + "has-ansi": "^2.0.0", + "strip-ansi": "^3.0.0", + "supports-color": "^2.0.0" + } + }, + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + }, + "supports-color": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", + "dev": true + } + } + }, + "testcafe-browser-provider-saucelabs": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/testcafe-browser-provider-saucelabs/-/testcafe-browser-provider-saucelabs-1.7.0.tgz", + "integrity": "sha512-M7sRL2MgWuFmnIUJi/sB7w39WP4zSHUl2pDLhTy0mSUwBahM65Berj5t+K5UkAbQFilfLgP4hnkt75c/9RaJ1g==", + "dev": true, + "requires": { + "babel-runtime": "^6.11.6", + "desired-capabilities": "^0.1.0", + "lodash": "^4.14.2", + "pify": "^2.3.0", + "pinkie": "^2.0.4", + "request": "^2.74.0", + "saucelabs-connector": "^0.3.0" + } + }, + "testcafe-browser-tools": { + "version": "1.6.8", + "resolved": "https://registry.npmjs.org/testcafe-browser-tools/-/testcafe-browser-tools-1.6.8.tgz", + "integrity": "sha512-xFgwmcAOutSJR6goqO8uUFGF5IF2xRC/Ssh4pB5QZ+bTjYsN5amnjgM+813bDBLelC+HmXKqylviz7Dzxbtbcw==", + "dev": true, + "requires": { + "array-find": "^1.0.0", + "babel-runtime": "^5.6.15", + "graceful-fs": "^4.1.11", + "linux-platform-info": "^0.0.3", + "mkdirp": "^0.5.1", + "mustache": "^2.1.2", + "os-family": "^1.0.0", + "pify": "^2.3.0", + "pinkie": "^2.0.1", + "read-file-relative": "^1.2.0", + "which-promise": "^1.0.0" + }, + "dependencies": { + "babel-runtime": { + "version": "5.8.38", + "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-5.8.38.tgz", + "integrity": "sha1-HAsC62MxL18If/IEUIJ7QlydTBk=", + "dev": true, + "requires": { + "core-js": "^1.0.0" + } + }, + "core-js": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-1.2.7.tgz", + "integrity": "sha1-ZSKUwUZR2yj6k70tX/KYOk8IxjY=", + "dev": true + } + } + }, + "testcafe-hammerhead": { + "version": "14.6.10", + "resolved": "https://registry.npmjs.org/testcafe-hammerhead/-/testcafe-hammerhead-14.6.10.tgz", + "integrity": "sha512-fG/YTz7wKs6Fd0Fl9WlzO4j/ovDSAGxDLvLAz4ydzIKAdnZMZ22QbjYpfahCVpe9nzq/UHCQpSFdThQTmlFEmA==", + "dev": true, + "requires": { + "acorn-hammerhead": "^0.2.0", + "bowser": "1.6.0", + "brotli": "^1.3.1", + "crypto-md5": "^1.0.0", + "css": "2.2.3", + "esotope-hammerhead": "^0.2.1", + "iconv-lite": "0.4.11", + "lodash": "4.17.11", + "lru-cache": "2.6.3", + "match-url-wildcard": "0.0.4", + "merge-stream": "^1.0.1", + "mime": "~1.4.1", + "mustache": "^2.1.1", + "nanoid": "^0.2.2", + "os-family": "^1.0.0", + "parse5": "2.2.3", + "pify": "^2.3.0", + "pinkie": "1.0.0", + "read-file-relative": "^1.2.0", + "semver": "5.5.0", + "tough-cookie": "2.3.3", + "tunnel-agent": "0.6.0", + "webauth": "^1.1.0" + }, + "dependencies": { + "nanoid": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-0.2.2.tgz", + "integrity": "sha512-GHoRrvNEKiwdkwQ/enKL8AhQkkrBC/2KxMZkDvQzp8OtkpX8ZAmoYJWFVl7l8F2+HcEJUfdg21Ab2wXXfrvACQ==", + "dev": true + }, + "parse5": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-2.2.3.tgz", + "integrity": "sha1-DE/EHBAAxea5PUiwP4CDg3g06fY=", + "dev": true + }, + "pinkie": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-1.0.0.tgz", + "integrity": "sha1-Wkfyi6EBXQIBvae/DzWOR77Ix+Q=", + "dev": true + }, + "semver": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.5.0.tgz", + "integrity": "sha512-4SJ3dm0WAwWy/NVeioZh5AntkdJoWKxHxcmyP622fOkgHa4z3R0TdBJICINyaSDE6uNwVc8gZr+ZinwZAH4xIA==", + "dev": true + } + } + }, + "testcafe-legacy-api": { + "version": "3.1.11", + "resolved": "https://registry.npmjs.org/testcafe-legacy-api/-/testcafe-legacy-api-3.1.11.tgz", + "integrity": "sha512-JWv8Exc9FAEBbKw+IP97Ebd+0FzA3nzgRv9iQCNh/+JlZyUox7NWiojs9BAXqgxIltl54rdo7TxPkNslxb+Ltw==", + "dev": true, + "requires": { + "async": "0.2.6", + "babel-runtime": "^5.8.34", + "dedent": "^0.6.0", + "highlight-es": "^1.0.0", + "is-jquery-obj": "^0.1.0", + "lodash": "^4.14.0", + "moment": "^2.14.1", + "mustache": "^2.2.1", + "os-family": "^1.0.0", + "parse5": "^2.1.5", + "pify": "^2.3.0", + "pinkie": "^2.0.1", + "strip-bom": "^2.0.0" + }, + "dependencies": { + "babel-runtime": { + "version": "5.8.38", + "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-5.8.38.tgz", + "integrity": "sha1-HAsC62MxL18If/IEUIJ7QlydTBk=", + "dev": true, + "requires": { + "core-js": "^1.0.0" + } + }, + "core-js": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-1.2.7.tgz", + "integrity": "sha1-ZSKUwUZR2yj6k70tX/KYOk8IxjY=", + "dev": true + }, + "dedent": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/dedent/-/dedent-0.6.0.tgz", + "integrity": "sha1-Dm2o8M5Sg471zsXI+TlrDBtko8s=", + "dev": true + }, + "parse5": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-2.2.3.tgz", + "integrity": "sha1-DE/EHBAAxea5PUiwP4CDg3g06fY=", + "dev": true + } + } + }, + "testcafe-reporter-json": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/testcafe-reporter-json/-/testcafe-reporter-json-2.2.0.tgz", + "integrity": "sha512-wfpNaZgGP2WoqdmnIXOyxcpwSzdH1HvzXSN397lJkXOrQrwhuGUThPDvyzPnZqxZSzXdDUvIPJm55tCMWbfymQ==", + "dev": true + }, + "testcafe-reporter-list": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/testcafe-reporter-list/-/testcafe-reporter-list-2.1.0.tgz", + "integrity": "sha1-n6ifcbl9Pf5ktDAtXiJ97mmuxrk=", + "dev": true + }, + "testcafe-reporter-minimal": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/testcafe-reporter-minimal/-/testcafe-reporter-minimal-2.1.0.tgz", + "integrity": "sha1-Z28DVHY0FDxurzq1KGgnOkvr9CE=", + "dev": true + }, + "testcafe-reporter-spec": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/testcafe-reporter-spec/-/testcafe-reporter-spec-2.1.1.tgz", + "integrity": "sha1-gVb87Q9RMkhlWa1WC8gGdkaSdew=", + "dev": true + }, + "testcafe-reporter-xunit": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/testcafe-reporter-xunit/-/testcafe-reporter-xunit-2.1.0.tgz", + "integrity": "sha1-5tZsVyzhWvJmcGrw/WELKoQd1EM=", + "dev": true + }, + "time-limit-promise": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/time-limit-promise/-/time-limit-promise-1.0.4.tgz", + "integrity": "sha512-FLHDDsIDducw7MBcRWlFtW2Tm50DoKOSFf0Nzx17qwXj8REXCte0eUkHrJl9QU3Bl9arG3XNYX0PcHpZ9xyuLw==", + "dev": true + }, + "tmp": { + "version": "0.0.28", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.28.tgz", + "integrity": "sha1-Fyc1t/YU6nrzlmT6hM8N5OUV0SA=", + "dev": true, + "requires": { + "os-tmpdir": "~1.0.1" + } + }, + "to-buffer": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/to-buffer/-/to-buffer-1.1.1.tgz", + "integrity": "sha512-lx9B5iv7msuFYE3dytT+KE5tap+rNYw+K4jVkb9R/asAb+pbBSM17jtunHplhBe6RRJdZx3Pn2Jph24O32mOVg==", + "dev": true + }, + "to-fast-properties": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", + "integrity": "sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4=", + "dev": true + }, + "to-object-path": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/to-object-path/-/to-object-path-0.3.0.tgz", + "integrity": "sha1-KXWIt7Dn4KwI4E5nL4XB9JmeF68=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "to-regex": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/to-regex/-/to-regex-3.0.2.tgz", + "integrity": "sha512-FWtleNAtZ/Ki2qtqej2CXTOayOH9bHDQF+Q48VpWyDXjbYxA4Yz8iDB31zXOBUlOHHKidDbqGVrTUvQMPmBGBw==", + "dev": true, + "requires": { + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "regex-not": "^1.0.2", + "safe-regex": "^1.1.0" + } + }, + "to-regex-range": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-2.1.1.tgz", + "integrity": "sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg=", + "dev": true, + "requires": { + "is-number": "^3.0.0", + "repeat-string": "^1.6.1" + } + }, + "tough-cookie": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.3.tgz", + "integrity": "sha1-C2GKVWW23qkL80JdBNVe3EdadWE=", + "dev": true, + "requires": { + "punycode": "^1.4.1" + } + }, + "tree-kill": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/tree-kill/-/tree-kill-1.2.1.tgz", + "integrity": "sha512-4hjqbObwlh2dLyW4tcz0Ymw0ggoaVDMveUB9w8kFSQScdRLo0gxO9J7WFcUBo+W3C1TLdFIEwNOWebgZZ0RH9Q==", + "dev": true + }, + "trim-right": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/trim-right/-/trim-right-1.0.1.tgz", + "integrity": "sha1-yy4SAwZ+DI3h9hQJS5/kVwTqYAM=", + "dev": true + }, + "truncate-utf8-bytes": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/truncate-utf8-bytes/-/truncate-utf8-bytes-1.0.2.tgz", + "integrity": "sha1-QFkjkJWS1W94pYGENLC3hInKXys=", + "dev": true, + "requires": { + "utf8-byte-length": "^1.0.1" + } + }, + "tunnel-agent": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", + "dev": true, + "requires": { + "safe-buffer": "^5.0.1" + } + }, + "tweetnacl": { + "version": "0.14.5", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", + "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", + "dev": true + }, + "type-detect": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", + "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", + "dev": true + }, + "typescript": { + "version": "3.5.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.5.2.tgz", + "integrity": "sha512-7KxJovlYhTX5RaRbUdkAXN1KUZ8PwWlTzQdHV6xNqvuFOs7+WBo10TQUqT19Q/Jz2hk5v9TQDIhyLhhJY4p5AA==", + "dev": true + }, + "uglify-js": { + "version": "3.5.15", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.5.15.tgz", + "integrity": "sha512-fe7aYFotptIddkwcm6YuA0HmknBZ52ZzOsUxZEdhhkSsz7RfjHDX2QDxwKTiv4JQ5t5NhfmpgAK+J7LiDhKSqg==", + "dev": true, + "requires": { + "commander": "~2.20.0", + "source-map": "~0.6.1" + }, + "dependencies": { + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + } + } + }, + "ultron": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ultron/-/ultron-1.1.1.tgz", + "integrity": "sha512-UIEXBNeYmKptWH6z8ZnqTeS8fV74zG0/eRU9VGkpzz+LIJNs8W/zM/L+7ctCkRrgbNnnR0xxw4bKOr0cW0N0Og==", + "dev": true + }, + "unicode-canonical-property-names-ecmascript": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-1.0.4.tgz", + "integrity": "sha512-jDrNnXWHd4oHiTZnx/ZG7gtUTVp+gCcTTKr8L0HjlwphROEW3+Him+IpvC+xcJEFegapiMZyZe02CyuOnRmbnQ==", + "dev": true + }, + "unicode-match-property-ecmascript": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/unicode-match-property-ecmascript/-/unicode-match-property-ecmascript-1.0.4.tgz", + "integrity": "sha512-L4Qoh15vTfntsn4P1zqnHulG0LdXgjSO035fEpdtp6YxXhMT51Q6vgM5lYdG/5X3MjS+k/Y9Xw4SFCY9IkR0rg==", + "dev": true, + "requires": { + "unicode-canonical-property-names-ecmascript": "^1.0.4", + "unicode-property-aliases-ecmascript": "^1.0.4" + } + }, + "unicode-match-property-value-ecmascript": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/unicode-match-property-value-ecmascript/-/unicode-match-property-value-ecmascript-1.1.0.tgz", + "integrity": "sha512-hDTHvaBk3RmFzvSl0UVrUmC3PuW9wKVnpoUDYH0JDkSIovzw+J5viQmeYHxVSBptubnr7PbH2e0fnpDRQnQl5g==", + "dev": true + }, + "unicode-property-aliases-ecmascript": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/unicode-property-aliases-ecmascript/-/unicode-property-aliases-ecmascript-1.0.5.tgz", + "integrity": "sha512-L5RAqCfXqAwR3RriF8pM0lU0w4Ryf/GgzONwi6KnL1taJQa7x1TCxdJnILX59WIGOwR57IVxn7Nej0fz1Ny6fw==", + "dev": true + }, + "union-value": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.0.tgz", + "integrity": "sha1-XHHDTLW61dzr4+oM0IIHulqhrqQ=", + "dev": true, + "requires": { + "arr-union": "^3.1.0", + "get-value": "^2.0.6", + "is-extendable": "^0.1.1", + "set-value": "^0.4.3" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + }, + "set-value": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/set-value/-/set-value-0.4.3.tgz", + "integrity": "sha1-fbCPnT0i3H945Trzw79GZuzfzPE=", + "dev": true, + "requires": { + "extend-shallow": "^2.0.1", + "is-extendable": "^0.1.1", + "is-plain-object": "^2.0.1", + "to-object-path": "^0.3.0" + } + } + } + }, + "unset-value": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unset-value/-/unset-value-1.0.0.tgz", + "integrity": "sha1-g3aHP30jNRef+x5vw6jtDfyKtVk=", + "dev": true, + "requires": { + "has-value": "^0.3.1", + "isobject": "^3.0.0" + }, + "dependencies": { + "has-value": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/has-value/-/has-value-0.3.1.tgz", + "integrity": "sha1-ex9YutpiyoJ+wKIHgCVlSEWZXh8=", + "dev": true, + "requires": { + "get-value": "^2.0.3", + "has-values": "^0.1.4", + "isobject": "^2.0.0" + }, + "dependencies": { + "isobject": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", + "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=", + "dev": true, + "requires": { + "isarray": "1.0.0" + } + } + } + }, + "has-values": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/has-values/-/has-values-0.1.4.tgz", + "integrity": "sha1-bWHeldkd/Km5oCCJrThL/49it3E=", + "dev": true + } + } + }, + "uri-js": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz", + "integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==", + "dev": true, + "requires": { + "punycode": "^2.1.0" + }, + "dependencies": { + "punycode": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", + "dev": true + } + } + }, + "urix": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/urix/-/urix-0.1.0.tgz", + "integrity": "sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI=", + "dev": true + }, + "use": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/use/-/use-3.1.1.tgz", + "integrity": "sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ==", + "dev": true + }, + "useragent": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/useragent/-/useragent-2.3.0.tgz", + "integrity": "sha512-4AoH4pxuSvHCjqLO04sU6U/uE65BYza8l/KKBS0b0hnUPWi+cQ2BpeTEwejCSx9SPV5/U03nniDTrWx5NrmKdw==", + "dev": true, + "requires": { + "lru-cache": "4.1.x", + "tmp": "0.0.x" + }, + "dependencies": { + "lru-cache": { + "version": "4.1.5", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.5.tgz", + "integrity": "sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==", + "dev": true, + "requires": { + "pseudomap": "^1.0.2", + "yallist": "^2.1.2" + } + } + } + }, + "utf8-byte-length": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/utf8-byte-length/-/utf8-byte-length-1.0.4.tgz", + "integrity": "sha1-9F8VDExm7uloGGUFq5P8u4rWv2E=", + "dev": true + }, + "util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", + "dev": true + }, + "uuid": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz", + "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==", + "dev": true + }, + "vargs": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/vargs/-/vargs-0.1.0.tgz", + "integrity": "sha1-a2GE2mUgzDIEzhtAfKwm2SYJ6/8=", + "dev": true + }, + "verror": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", + "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", + "dev": true, + "requires": { + "assert-plus": "^1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "^1.2.0" + } + }, + "wd": { + "version": "1.11.2", + "resolved": "https://registry.npmjs.org/wd/-/wd-1.11.2.tgz", + "integrity": "sha512-zXJY9ARjQQYN2LatLTRcW39EYzIVqKNhGpp4XWJmRgHBioG4FoenIOsoVbaO8lnFGgv31V99kAy5hB4eWGIwzA==", + "dev": true, + "requires": { + "archiver": "2.1.1", + "async": "2.0.1", + "lodash": "4.17.11", + "mkdirp": "^0.5.1", + "q": "1.4.1", + "request": "2.88.0", + "vargs": "0.1.0" + }, + "dependencies": { + "async": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/async/-/async-2.0.1.tgz", + "integrity": "sha1-twnMAoCpw28J9FNr6CPIOKkEniU=", + "dev": true, + "requires": { + "lodash": "^4.8.0" + } + } + } + }, + "webauth": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/webauth/-/webauth-1.1.0.tgz", + "integrity": "sha1-ZHBPa4AmmGYFvDymKZUubib90QA=", + "dev": true + }, + "which": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + }, + "which-promise": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/which-promise/-/which-promise-1.0.0.tgz", + "integrity": "sha1-ILch3wWzW3Bhdv+hCwkJq6RgMDU=", + "dev": true, + "requires": { + "pify": "^2.2.0", + "pinkie-promise": "^1.0.0", + "which": "^1.1.2" + }, + "dependencies": { + "pinkie": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-1.0.0.tgz", + "integrity": "sha1-Wkfyi6EBXQIBvae/DzWOR77Ix+Q=", + "dev": true + }, + "pinkie-promise": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-1.0.0.tgz", + "integrity": "sha1-0dpn9UglY7t89X8oauKCLs+/NnA=", + "dev": true, + "requires": { + "pinkie": "^1.0.0" + } + } + } + }, + "wrap-ansi": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", + "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=", + "dev": true, + "requires": { + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1" + } + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "dev": true + }, + "ws": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/ws/-/ws-3.3.3.tgz", + "integrity": "sha512-nnWLa/NwZSt4KQJu51MYlCcSQ5g7INpOrOMt4XV8j4dqTXdmlUmSHQ8/oLC069ckre0fRsgfvsKwbTdtKLCDkA==", + "dev": true, + "requires": { + "async-limiter": "~1.0.0", + "safe-buffer": "~5.1.0", + "ultron": "~1.1.0" + } + }, + "xtend": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", + "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=", + "dev": true + }, + "yallist": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", + "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=", + "dev": true + }, + "zip-stream": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/zip-stream/-/zip-stream-1.2.0.tgz", + "integrity": "sha1-qLxF9MG0lpnGuQGYuqyqzbzUugQ=", + "dev": true, + "requires": { + "archiver-utils": "^1.3.0", + "compress-commons": "^1.2.0", + "lodash": "^4.8.0", + "readable-stream": "^2.0.0" + } + } + } +} diff --git a/public/assets/libs/Sortable/package.json b/public/assets/libs/Sortable/package.json new file mode 100644 index 0000000..4344736 --- /dev/null +++ b/public/assets/libs/Sortable/package.json @@ -0,0 +1,56 @@ +{ + "name": "sortablejs", + "exportName": "Sortable", + "version": "1.10.2", + "devDependencies": { + "@babel/core": "^7.4.4", + "@babel/plugin-transform-object-assign": "^7.2.0", + "@babel/preset-env": "^7.4.4", + "rollup": "^1.11.3", + "rollup-plugin-babel": "^4.3.2", + "rollup-plugin-json": "^4.0.0", + "rollup-plugin-node-resolve": "^5.0.0", + "testcafe": "^1.3.1", + "testcafe-browser-provider-saucelabs": "^1.7.0", + "testcafe-reporter-xunit": "^2.1.0", + "uglify-js": "^3.5.12" + }, + "description": "JavaScript library for reorderable drag-and-drop lists on modern browsers and touch devices. No jQuery required. Supports Meteor, AngularJS, React, Polymer, Vue, Knockout and any CSS library, e.g. Bootstrap.", + "main": "./Sortable.js", + "module": "modular/sortable.esm.js", + "scripts": { + "build:umd": "NODE_ENV=umd rollup -c ./scripts/umd-build.js", + "build:umd:watch": "set NODE_ENV=umd&& rollup -w -c ./scripts/umd-build.js", + "build:es": "set NODE_ENV=es&& rollup -c ./scripts/esm-build.js", + "build:es:watch": "set NODE_ENV=es&& rollup -w -c ./scripts/esm-build.js", + "minify": "node ./scripts/minify.js", + "build": "npm run build:es && npm run build:umd && npm run minify", + "test:compat": "node ./scripts/test-compat.js", + "test": "node ./scripts/test.js" + }, + "maintainers": [ + "Konstantin Lebedev ", + "Owen Mills " + ], + "repository": { + "type": "git", + "url": "git://github.com/SortableJS/Sortable.git" + }, + "files": [ + "Sortable.js", + "Sortable.min.js", + "modular/" + ], + "keywords": [ + "sortable", + "reorder", + "drag", + "meteor", + "angular", + "ng-sortable", + "react", + "vue", + "mixin" + ], + "license": "MIT" +} diff --git a/public/assets/libs/Sortable/plugins/AutoScroll/AutoScroll.js b/public/assets/libs/Sortable/plugins/AutoScroll/AutoScroll.js new file mode 100644 index 0000000..3027bb3 --- /dev/null +++ b/public/assets/libs/Sortable/plugins/AutoScroll/AutoScroll.js @@ -0,0 +1,270 @@ +import { + on, + off, + css, + throttle, + cancelThrottle, + scrollBy, + getParentAutoScrollElement, + expando, + getRect, + getWindowScrollingElement +} from '../../src/utils.js'; + +import Sortable from '../../src/Sortable.js'; + +import { Edge, IE11OrLess, Safari } from '../../src/BrowserInfo.js'; + +let autoScrolls = [], + scrollEl, + scrollRootEl, + scrolling = false, + lastAutoScrollX, + lastAutoScrollY, + touchEvt, + pointerElemChangedInterval; + +function AutoScrollPlugin() { + + function AutoScroll() { + this.defaults = { + scroll: true, + scrollSensitivity: 30, + scrollSpeed: 10, + bubbleScroll: true + }; + + // Bind all private methods + for (let fn in this) { + if (fn.charAt(0) === '_' && typeof this[fn] === 'function') { + this[fn] = this[fn].bind(this); + } + } + } + + AutoScroll.prototype = { + dragStarted({ originalEvent }) { + if (this.sortable.nativeDraggable) { + on(document, 'dragover', this._handleAutoScroll); + } else { + if (this.options.supportPointer) { + on(document, 'pointermove', this._handleFallbackAutoScroll); + } else if (originalEvent.touches) { + on(document, 'touchmove', this._handleFallbackAutoScroll); + } else { + on(document, 'mousemove', this._handleFallbackAutoScroll); + } + } + }, + + dragOverCompleted({ originalEvent }) { + // For when bubbling is canceled and using fallback (fallback 'touchmove' always reached) + if (!this.options.dragOverBubble && !originalEvent.rootEl) { + this._handleAutoScroll(originalEvent); + } + }, + + drop() { + if (this.sortable.nativeDraggable) { + off(document, 'dragover', this._handleAutoScroll); + } else { + off(document, 'pointermove', this._handleFallbackAutoScroll); + off(document, 'touchmove', this._handleFallbackAutoScroll); + off(document, 'mousemove', this._handleFallbackAutoScroll); + } + + clearPointerElemChangedInterval(); + clearAutoScrolls(); + cancelThrottle(); + }, + + nulling() { + touchEvt = + scrollRootEl = + scrollEl = + scrolling = + pointerElemChangedInterval = + lastAutoScrollX = + lastAutoScrollY = null; + + autoScrolls.length = 0; + }, + + _handleFallbackAutoScroll(evt) { + this._handleAutoScroll(evt, true); + }, + + _handleAutoScroll(evt, fallback) { + const x = (evt.touches ? evt.touches[0] : evt).clientX, + y = (evt.touches ? evt.touches[0] : evt).clientY, + + elem = document.elementFromPoint(x, y); + + touchEvt = evt; + + // IE does not seem to have native autoscroll, + // Edge's autoscroll seems too conditional, + // MACOS Safari does not have autoscroll, + // Firefox and Chrome are good + if (fallback || Edge || IE11OrLess || Safari) { + autoScroll(evt, this.options, elem, fallback); + + // Listener for pointer element change + let ogElemScroller = getParentAutoScrollElement(elem, true); + if ( + scrolling && + ( + !pointerElemChangedInterval || + x !== lastAutoScrollX || + y !== lastAutoScrollY + ) + ) { + pointerElemChangedInterval && clearPointerElemChangedInterval(); + // Detect for pointer elem change, emulating native DnD behaviour + pointerElemChangedInterval = setInterval(() => { + let newElem = getParentAutoScrollElement(document.elementFromPoint(x, y), true); + if (newElem !== ogElemScroller) { + ogElemScroller = newElem; + clearAutoScrolls(); + } + autoScroll(evt, this.options, newElem, fallback); + }, 10); + lastAutoScrollX = x; + lastAutoScrollY = y; + } + } else { + // if DnD is enabled (and browser has good autoscrolling), first autoscroll will already scroll, so get parent autoscroll of first autoscroll + if (!this.options.bubbleScroll || getParentAutoScrollElement(elem, true) === getWindowScrollingElement()) { + clearAutoScrolls(); + return; + } + autoScroll(evt, this.options, getParentAutoScrollElement(elem, false), false); + } + } + }; + + return Object.assign(AutoScroll, { + pluginName: 'scroll', + initializeByDefault: true + }); +} + +function clearAutoScrolls() { + autoScrolls.forEach(function(autoScroll) { + clearInterval(autoScroll.pid); + }); + autoScrolls = []; +} + +function clearPointerElemChangedInterval() { + clearInterval(pointerElemChangedInterval); +} + + +const autoScroll = throttle(function(evt, options, rootEl, isFallback) { + // Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=505521 + if (!options.scroll) return; + const x = (evt.touches ? evt.touches[0] : evt).clientX, + y = (evt.touches ? evt.touches[0] : evt).clientY, + sens = options.scrollSensitivity, + speed = options.scrollSpeed, + winScroller = getWindowScrollingElement(); + + let scrollThisInstance = false, + scrollCustomFn; + + // New scroll root, set scrollEl + if (scrollRootEl !== rootEl) { + scrollRootEl = rootEl; + + clearAutoScrolls(); + + scrollEl = options.scroll; + scrollCustomFn = options.scrollFn; + + if (scrollEl === true) { + scrollEl = getParentAutoScrollElement(rootEl, true); + } + } + + + let layersOut = 0; + let currentParent = scrollEl; + do { + let el = currentParent, + rect = getRect(el), + + top = rect.top, + bottom = rect.bottom, + left = rect.left, + right = rect.right, + + width = rect.width, + height = rect.height, + + canScrollX, + canScrollY, + + scrollWidth = el.scrollWidth, + scrollHeight = el.scrollHeight, + + elCSS = css(el), + + scrollPosX = el.scrollLeft, + scrollPosY = el.scrollTop; + + + if (el === winScroller) { + canScrollX = width < scrollWidth && (elCSS.overflowX === 'auto' || elCSS.overflowX === 'scroll' || elCSS.overflowX === 'visible'); + canScrollY = height < scrollHeight && (elCSS.overflowY === 'auto' || elCSS.overflowY === 'scroll' || elCSS.overflowY === 'visible'); + } else { + canScrollX = width < scrollWidth && (elCSS.overflowX === 'auto' || elCSS.overflowX === 'scroll'); + canScrollY = height < scrollHeight && (elCSS.overflowY === 'auto' || elCSS.overflowY === 'scroll'); + } + + let vx = canScrollX && (Math.abs(right - x) <= sens && (scrollPosX + width) < scrollWidth) - (Math.abs(left - x) <= sens && !!scrollPosX); + let vy = canScrollY && (Math.abs(bottom - y) <= sens && (scrollPosY + height) < scrollHeight) - (Math.abs(top - y) <= sens && !!scrollPosY); + + + if (!autoScrolls[layersOut]) { + for (let i = 0; i <= layersOut; i++) { + if (!autoScrolls[i]) { + autoScrolls[i] = {}; + } + } + } + + if (autoScrolls[layersOut].vx != vx || autoScrolls[layersOut].vy != vy || autoScrolls[layersOut].el !== el) { + autoScrolls[layersOut].el = el; + autoScrolls[layersOut].vx = vx; + autoScrolls[layersOut].vy = vy; + + clearInterval(autoScrolls[layersOut].pid); + + if (vx != 0 || vy != 0) { + scrollThisInstance = true; + /* jshint loopfunc:true */ + autoScrolls[layersOut].pid = setInterval((function () { + // emulate drag over during autoscroll (fallback), emulating native DnD behaviour + if (isFallback && this.layer === 0) { + Sortable.active._onTouchMove(touchEvt); // To move ghost if it is positioned absolutely + } + let scrollOffsetY = autoScrolls[this.layer].vy ? autoScrolls[this.layer].vy * speed : 0; + let scrollOffsetX = autoScrolls[this.layer].vx ? autoScrolls[this.layer].vx * speed : 0; + + if (typeof(scrollCustomFn) === 'function') { + if (scrollCustomFn.call(Sortable.dragged.parentNode[expando], scrollOffsetX, scrollOffsetY, evt, touchEvt, autoScrolls[this.layer].el) !== 'continue') { + return; + } + } + + scrollBy(autoScrolls[this.layer].el, scrollOffsetX, scrollOffsetY); + }).bind({layer: layersOut}), 24); + } + } + layersOut++; + } while (options.bubbleScroll && currentParent !== winScroller && (currentParent = getParentAutoScrollElement(currentParent, false))); + scrolling = scrollThisInstance; // in case another function catches scrolling as false in between when it is not +}, 30); + +export default AutoScrollPlugin; diff --git a/public/assets/libs/Sortable/plugins/AutoScroll/README.md b/public/assets/libs/Sortable/plugins/AutoScroll/README.md new file mode 100644 index 0000000..1d8bee6 --- /dev/null +++ b/public/assets/libs/Sortable/plugins/AutoScroll/README.md @@ -0,0 +1,80 @@ +## AutoScroll +This plugin allows for the page to automatically scroll during dragging near a scrollable element's edge on mobile devices and IE9 (or whenever fallback is enabled), and also enhances most browser's native drag-and-drop autoscrolling. +Demo: + - `window`: https://jsbin.com/dosilir/edit?js,output + - `overflow: hidden`: https://jsbin.com/xecihez/edit?html,js,output + +**This plugin is a default plugin, and is included in the default UMD and ESM builds of Sortable** + + +--- + + +### Mounting +```js +import { Sortable, AutoScroll } from 'sortablejs'; + +Sortable.mount(new AutoScroll()); +``` + + +--- + + +### Options + +```js +new Sortable(el, { + scroll: true, // Enable the plugin. Can be HTMLElement. + scrollFn: function(offsetX, offsetY, originalEvent, touchEvt, hoverTargetEl) { ... }, // if you have custom scrollbar scrollFn may be used for autoscrolling + scrollSensitivity: 30, // px, how near the mouse must be to an edge to start scrolling. + scrollSpeed: 10, // px, speed of the scrolling + bubbleScroll: true // apply autoscroll to all parent elements, allowing for easier movement +}); +``` + + +--- + + +#### `scroll` option +Enables the plugin. Defaults to `true`. May also be set to an HTMLElement which will be where autoscrolling is rooted. + +Demo: + - `window`: https://jsbin.com/dosilir/edit?js,output + - `overflow: hidden`: https://jsbin.com/xecihez/edit?html,js,output + + +--- + + +#### `scrollFn` option +Defines function that will be used for autoscrolling. el.scrollTop/el.scrollLeft is used by default. +Useful when you have custom scrollbar with dedicated scroll function. +This function should return `'continue'` if it wishes to allow Sortable's native autoscrolling. + + +--- + + +#### `scrollSensitivity` option +Defines how near the mouse must be to an edge to start scrolling. + + +--- + + +#### `scrollSpeed` option +The speed at which the window should scroll once the mouse pointer gets within the `scrollSensitivity` distance. + + +--- + + +#### `bubbleScroll` option +If set to `true`, the normal `autoscroll` function will also be applied to all parent elements of the element the user is dragging over. + +Demo: https://jsbin.com/kesewor/edit?html,js,output + + +--- diff --git a/public/assets/libs/Sortable/plugins/AutoScroll/index.js b/public/assets/libs/Sortable/plugins/AutoScroll/index.js new file mode 100644 index 0000000..cc79f7e --- /dev/null +++ b/public/assets/libs/Sortable/plugins/AutoScroll/index.js @@ -0,0 +1 @@ +export { default } from './AutoScroll.js'; diff --git a/public/assets/libs/Sortable/plugins/MultiDrag/MultiDrag.js b/public/assets/libs/Sortable/plugins/MultiDrag/MultiDrag.js new file mode 100644 index 0000000..61f6901 --- /dev/null +++ b/public/assets/libs/Sortable/plugins/MultiDrag/MultiDrag.js @@ -0,0 +1,617 @@ +import { + toggleClass, + getRect, + index, + closest, + on, + off, + clone, + css, + setRect, + unsetRect, + matrix, + expando +} from '../../src/utils.js'; + +import dispatchEvent from '../../src/EventDispatcher.js'; + +let multiDragElements = [], + multiDragClones = [], + lastMultiDragSelect, // for selection with modifier key down (SHIFT) + multiDragSortable, + initialFolding = false, // Initial multi-drag fold when drag started + folding = false, // Folding any other time + dragStarted = false, + dragEl, + clonesFromRect, + clonesHidden; + +function MultiDragPlugin() { + function MultiDrag(sortable) { + // Bind all private methods + for (let fn in this) { + if (fn.charAt(0) === '_' && typeof this[fn] === 'function') { + this[fn] = this[fn].bind(this); + } + } + + if (sortable.options.supportPointer) { + on(document, 'pointerup', this._deselectMultiDrag); + } else { + on(document, 'mouseup', this._deselectMultiDrag); + on(document, 'touchend', this._deselectMultiDrag); + } + + on(document, 'keydown', this._checkKeyDown); + on(document, 'keyup', this._checkKeyUp); + + this.defaults = { + selectedClass: 'sortable-selected', + multiDragKey: null, + setData(dataTransfer, dragEl) { + let data = ''; + if (multiDragElements.length && multiDragSortable === sortable) { + multiDragElements.forEach((multiDragElement, i) => { + data += (!i ? '' : ', ') + multiDragElement.textContent; + }); + } else { + data = dragEl.textContent; + } + dataTransfer.setData('Text', data); + } + }; + } + + MultiDrag.prototype = { + multiDragKeyDown: false, + isMultiDrag: false, + + + delayStartGlobal({ dragEl: dragged }) { + dragEl = dragged; + }, + + delayEnded() { + this.isMultiDrag = ~multiDragElements.indexOf(dragEl); + }, + + setupClone({ sortable, cancel }) { + if (!this.isMultiDrag) return; + for (let i = 0; i < multiDragElements.length; i++) { + multiDragClones.push(clone(multiDragElements[i])); + + multiDragClones[i].sortableIndex = multiDragElements[i].sortableIndex; + + multiDragClones[i].draggable = false; + multiDragClones[i].style['will-change'] = ''; + + toggleClass(multiDragClones[i], this.options.selectedClass, false); + multiDragElements[i] === dragEl && toggleClass(multiDragClones[i], this.options.chosenClass, false); + } + + sortable._hideClone(); + cancel(); + }, + + clone({ sortable, rootEl, dispatchSortableEvent, cancel }) { + if (!this.isMultiDrag) return; + if (!this.options.removeCloneOnHide) { + if (multiDragElements.length && multiDragSortable === sortable) { + insertMultiDragClones(true, rootEl); + dispatchSortableEvent('clone'); + + cancel(); + } + } + }, + + showClone({ cloneNowShown, rootEl, cancel }) { + if (!this.isMultiDrag) return; + insertMultiDragClones(false, rootEl); + multiDragClones.forEach(clone => { + css(clone, 'display', ''); + }); + + cloneNowShown(); + clonesHidden = false; + cancel(); + }, + + hideClone({ sortable, cloneNowHidden, cancel }) { + if (!this.isMultiDrag) return; + multiDragClones.forEach(clone => { + css(clone, 'display', 'none'); + if (this.options.removeCloneOnHide && clone.parentNode) { + clone.parentNode.removeChild(clone); + } + }); + + cloneNowHidden(); + clonesHidden = true; + cancel(); + }, + + dragStartGlobal({ sortable }) { + if (!this.isMultiDrag && multiDragSortable) { + multiDragSortable.multiDrag._deselectMultiDrag(); + } + + multiDragElements.forEach(multiDragElement => { + multiDragElement.sortableIndex = index(multiDragElement); + }); + + // Sort multi-drag elements + multiDragElements = multiDragElements.sort(function(a, b) { + return a.sortableIndex - b.sortableIndex; + }); + dragStarted = true; + }, + + dragStarted({ sortable }) { + if (!this.isMultiDrag) return; + if (this.options.sort) { + // Capture rects, + // hide multi drag elements (by positioning them absolute), + // set multi drag elements rects to dragRect, + // show multi drag elements, + // animate to rects, + // unset rects & remove from DOM + + sortable.captureAnimationState(); + + if (this.options.animation) { + multiDragElements.forEach(multiDragElement => { + if (multiDragElement === dragEl) return; + css(multiDragElement, 'position', 'absolute'); + }); + + let dragRect = getRect(dragEl, false, true, true); + + multiDragElements.forEach(multiDragElement => { + if (multiDragElement === dragEl) return; + setRect(multiDragElement, dragRect); + }); + + folding = true; + initialFolding = true; + } + } + + sortable.animateAll(() => { + folding = false; + initialFolding = false; + + if (this.options.animation) { + multiDragElements.forEach(multiDragElement => { + unsetRect(multiDragElement); + }); + } + + // Remove all auxiliary multidrag items from el, if sorting enabled + if (this.options.sort) { + removeMultiDragElements(); + } + }); + }, + + dragOver({ target, completed, cancel }) { + if (folding && ~multiDragElements.indexOf(target)) { + completed(false); + cancel(); + } + }, + + revert({ fromSortable, rootEl, sortable, dragRect }) { + if (multiDragElements.length > 1) { + // Setup unfold animation + multiDragElements.forEach(multiDragElement => { + sortable.addAnimationState({ + target: multiDragElement, + rect: folding ? getRect(multiDragElement) : dragRect + }); + + unsetRect(multiDragElement); + + multiDragElement.fromRect = dragRect; + + fromSortable.removeAnimationState(multiDragElement); + }); + folding = false; + insertMultiDragElements(!this.options.removeCloneOnHide, rootEl); + } + }, + + dragOverCompleted({ sortable, isOwner, insertion, activeSortable, parentEl, putSortable }) { + let options = this.options; + if (insertion) { + // Clones must be hidden before folding animation to capture dragRectAbsolute properly + if (isOwner) { + activeSortable._hideClone(); + } + + initialFolding = false; + // If leaving sort:false root, or already folding - Fold to new location + if (options.animation && multiDragElements.length > 1 && (folding || !isOwner && !activeSortable.options.sort && !putSortable)) { + // Fold: Set all multi drag elements's rects to dragEl's rect when multi-drag elements are invisible + let dragRectAbsolute = getRect(dragEl, false, true, true); + + multiDragElements.forEach(multiDragElement => { + if (multiDragElement === dragEl) return; + setRect(multiDragElement, dragRectAbsolute); + + // Move element(s) to end of parentEl so that it does not interfere with multi-drag clones insertion if they are inserted + // while folding, and so that we can capture them again because old sortable will no longer be fromSortable + parentEl.appendChild(multiDragElement); + }); + + folding = true; + } + + // Clones must be shown (and check to remove multi drags) after folding when interfering multiDragElements are moved out + if (!isOwner) { + // Only remove if not folding (folding will remove them anyways) + if (!folding) { + removeMultiDragElements(); + } + + if (multiDragElements.length > 1) { + let clonesHiddenBefore = clonesHidden; + activeSortable._showClone(sortable); + + // Unfold animation for clones if showing from hidden + if (activeSortable.options.animation && !clonesHidden && clonesHiddenBefore) { + multiDragClones.forEach(clone => { + activeSortable.addAnimationState({ + target: clone, + rect: clonesFromRect + }); + + clone.fromRect = clonesFromRect; + clone.thisAnimationDuration = null; + }); + } + } else { + activeSortable._showClone(sortable); + } + } + } + }, + + dragOverAnimationCapture({ dragRect, isOwner, activeSortable }) { + multiDragElements.forEach(multiDragElement => { + multiDragElement.thisAnimationDuration = null; + }); + + if (activeSortable.options.animation && !isOwner && activeSortable.multiDrag.isMultiDrag) { + clonesFromRect = Object.assign({}, dragRect); + let dragMatrix = matrix(dragEl, true); + clonesFromRect.top -= dragMatrix.f; + clonesFromRect.left -= dragMatrix.e; + } + }, + + dragOverAnimationComplete() { + if (folding) { + folding = false; + removeMultiDragElements(); + } + }, + + drop({ originalEvent: evt, rootEl, parentEl, sortable, dispatchSortableEvent, oldIndex, putSortable }) { + let toSortable = (putSortable || this.sortable); + + if (!evt) return; + + let options = this.options, + children = parentEl.children; + + // Multi-drag selection + if (!dragStarted) { + if (options.multiDragKey && !this.multiDragKeyDown) { + this._deselectMultiDrag(); + } + toggleClass(dragEl, options.selectedClass, !~multiDragElements.indexOf(dragEl)); + + if (!~multiDragElements.indexOf(dragEl)) { + multiDragElements.push(dragEl); + dispatchEvent({ + sortable, + rootEl, + name: 'select', + targetEl: dragEl, + originalEvt: evt + }); + + // Modifier activated, select from last to dragEl + if (evt.shiftKey && lastMultiDragSelect && sortable.el.contains(lastMultiDragSelect)) { + let lastIndex = index(lastMultiDragSelect), + currentIndex = index(dragEl); + + if (~lastIndex && ~currentIndex && lastIndex !== currentIndex) { + // Must include lastMultiDragSelect (select it), in case modified selection from no selection + // (but previous selection existed) + let n, i; + if (currentIndex > lastIndex) { + i = lastIndex; + n = currentIndex; + } else { + i = currentIndex; + n = lastIndex + 1; + } + + for (; i < n; i++) { + if (~multiDragElements.indexOf(children[i])) continue; + toggleClass(children[i], options.selectedClass, true); + multiDragElements.push(children[i]); + + dispatchEvent({ + sortable, + rootEl, + name: 'select', + targetEl: children[i], + originalEvt: evt + }); + } + } + } else { + lastMultiDragSelect = dragEl; + } + + multiDragSortable = toSortable; + } else { + multiDragElements.splice(multiDragElements.indexOf(dragEl), 1); + lastMultiDragSelect = null; + dispatchEvent({ + sortable, + rootEl, + name: 'deselect', + targetEl: dragEl, + originalEvt: evt + }); + } + } + + // Multi-drag drop + if (dragStarted && this.isMultiDrag) { + // Do not "unfold" after around dragEl if reverted + if ((parentEl[expando].options.sort || parentEl !== rootEl) && multiDragElements.length > 1) { + let dragRect = getRect(dragEl), + multiDragIndex = index(dragEl, ':not(.' + this.options.selectedClass + ')'); + + if (!initialFolding && options.animation) dragEl.thisAnimationDuration = null; + + toSortable.captureAnimationState(); + + if (!initialFolding) { + if (options.animation) { + dragEl.fromRect = dragRect; + multiDragElements.forEach(multiDragElement => { + multiDragElement.thisAnimationDuration = null; + if (multiDragElement !== dragEl) { + let rect = folding ? getRect(multiDragElement) : dragRect; + multiDragElement.fromRect = rect; + + // Prepare unfold animation + toSortable.addAnimationState({ + target: multiDragElement, + rect: rect + }); + } + }); + } + + // Multi drag elements are not necessarily removed from the DOM on drop, so to reinsert + // properly they must all be removed + removeMultiDragElements(); + + multiDragElements.forEach(multiDragElement => { + if (children[multiDragIndex]) { + parentEl.insertBefore(multiDragElement, children[multiDragIndex]); + } else { + parentEl.appendChild(multiDragElement); + } + multiDragIndex++; + }); + + // If initial folding is done, the elements may have changed position because they are now + // unfolding around dragEl, even though dragEl may not have his index changed, so update event + // must be fired here as Sortable will not. + if (oldIndex === index(dragEl)) { + let update = false; + multiDragElements.forEach(multiDragElement => { + if (multiDragElement.sortableIndex !== index(multiDragElement)) { + update = true; + return; + } + }); + + if (update) { + dispatchSortableEvent('update'); + } + } + } + + // Must be done after capturing individual rects (scroll bar) + multiDragElements.forEach(multiDragElement => { + unsetRect(multiDragElement); + }); + + toSortable.animateAll(); + } + + multiDragSortable = toSortable; + } + + // Remove clones if necessary + if (rootEl === parentEl || (putSortable && putSortable.lastPutMode !== 'clone')) { + multiDragClones.forEach(clone => { + clone.parentNode && clone.parentNode.removeChild(clone); + }); + } + }, + + nullingGlobal() { + this.isMultiDrag = + dragStarted = false; + multiDragClones.length = 0; + }, + + destroyGlobal() { + this._deselectMultiDrag(); + off(document, 'pointerup', this._deselectMultiDrag); + off(document, 'mouseup', this._deselectMultiDrag); + off(document, 'touchend', this._deselectMultiDrag); + + off(document, 'keydown', this._checkKeyDown); + off(document, 'keyup', this._checkKeyUp); + }, + + _deselectMultiDrag(evt) { + if (typeof dragStarted !== "undefined" && dragStarted) return; + + // Only deselect if selection is in this sortable + if (multiDragSortable !== this.sortable) return; + + // Only deselect if target is not item in this sortable + if (evt && closest(evt.target, this.options.draggable, this.sortable.el, false)) return; + + // Only deselect if left click + if (evt && evt.button !== 0) return; + + while (multiDragElements.length) { + let el = multiDragElements[0]; + toggleClass(el, this.options.selectedClass, false); + multiDragElements.shift(); + dispatchEvent({ + sortable: this.sortable, + rootEl: this.sortable.el, + name: 'deselect', + targetEl: el, + originalEvt: evt + }); + } + }, + + _checkKeyDown(evt) { + if (evt.key === this.options.multiDragKey) { + this.multiDragKeyDown = true; + } + }, + + _checkKeyUp(evt) { + if (evt.key === this.options.multiDragKey) { + this.multiDragKeyDown = false; + } + } + }; + + return Object.assign(MultiDrag, { + // Static methods & properties + pluginName: 'multiDrag', + utils: { + /** + * Selects the provided multi-drag item + * @param {HTMLElement} el The element to be selected + */ + select(el) { + let sortable = el.parentNode[expando]; + if (!sortable || !sortable.options.multiDrag || ~multiDragElements.indexOf(el)) return; + if (multiDragSortable && multiDragSortable !== sortable) { + multiDragSortable.multiDrag._deselectMultiDrag(); + multiDragSortable = sortable; + } + toggleClass(el, sortable.options.selectedClass, true); + multiDragElements.push(el); + }, + /** + * Deselects the provided multi-drag item + * @param {HTMLElement} el The element to be deselected + */ + deselect(el) { + let sortable = el.parentNode[expando], + index = multiDragElements.indexOf(el); + if (!sortable || !sortable.options.multiDrag || !~index) return; + toggleClass(el, sortable.options.selectedClass, false); + multiDragElements.splice(index, 1); + } + }, + eventProperties() { + const oldIndicies = [], + newIndicies = []; + + multiDragElements.forEach(multiDragElement => { + oldIndicies.push({ + multiDragElement, + index: multiDragElement.sortableIndex + }); + + // multiDragElements will already be sorted if folding + let newIndex; + if (folding && multiDragElement !== dragEl) { + newIndex = -1; + } else if (folding) { + newIndex = index(multiDragElement, ':not(.' + this.options.selectedClass + ')'); + } else { + newIndex = index(multiDragElement); + } + newIndicies.push({ + multiDragElement, + index: newIndex + }); + }); + return { + items: [...multiDragElements], + clones: [...multiDragClones], + oldIndicies, + newIndicies + }; + }, + optionListeners: { + multiDragKey(key) { + key = key.toLowerCase(); + if (key === 'ctrl') { + key = 'Control'; + } else if (key.length > 1) { + key = key.charAt(0).toUpperCase() + key.substr(1); + } + return key; + } + } + }); +} + +function insertMultiDragElements(clonesInserted, rootEl) { + multiDragElements.forEach((multiDragElement, i) => { + let target = rootEl.children[multiDragElement.sortableIndex + (clonesInserted ? Number(i) : 0)]; + if (target) { + rootEl.insertBefore(multiDragElement, target); + } else { + rootEl.appendChild(multiDragElement); + } + }); +} + +/** + * Insert multi-drag clones + * @param {[Boolean]} elementsInserted Whether the multi-drag elements are inserted + * @param {HTMLElement} rootEl + */ +function insertMultiDragClones(elementsInserted, rootEl) { + multiDragClones.forEach((clone, i) => { + let target = rootEl.children[clone.sortableIndex + (elementsInserted ? Number(i) : 0)]; + if (target) { + rootEl.insertBefore(clone, target); + } else { + rootEl.appendChild(clone); + } + }); +} + +function removeMultiDragElements() { + multiDragElements.forEach(multiDragElement => { + if (multiDragElement === dragEl) return; + multiDragElement.parentNode && multiDragElement.parentNode.removeChild(multiDragElement); + }); +} + +export default MultiDragPlugin; diff --git a/public/assets/libs/Sortable/plugins/MultiDrag/README.md b/public/assets/libs/Sortable/plugins/MultiDrag/README.md new file mode 100644 index 0000000..a7cb4d5 --- /dev/null +++ b/public/assets/libs/Sortable/plugins/MultiDrag/README.md @@ -0,0 +1,96 @@ +## MultiDrag Plugin +This plugin allows users to select multiple items within a sortable at once, and drag them as one item. +Once placed, the items will unfold into their original order, but all beside each other at the new position. +[Read More](https://github.com/SortableJS/Sortable/wiki/Dragging-Multiple-Items-in-Sortable) + +Demo: https://jsbin.com/wopavom/edit?js,output + + +--- + + +### Mounting +```js +import { Sortable, MultiDrag } from 'sortablejs'; + +Sortable.mount(new MultiDrag()); +``` + + +--- + + +### Options + +```js +new Sortable(el, { + multiDrag: true, // Enable the plugin + selectedClass: "sortable-selected", // Class name for selected item + multiDragKey: null, // Key that must be down for items to be selected + + // Called when an item is selected + onSelect: function(/**Event*/evt) { + evt.item // The selected item + }, + + // Called when an item is deselected + onDeselect: function(/**Event*/evt) { + evt.item // The deselected item + } +}); +``` + + +--- + + +#### `multiDragKey` option +The key that must be down for multiple items to be selected. The default is `null`, meaning no key must be down. +For special keys, such as the CTRL key, simply specify the option as `'CTRL'` (casing does not matter). + + +--- + + +#### `selectedClass` option +Class name for the selected item(s) if multiDrag is enabled. Defaults to `sortable-selected`. + +```css +.selected { + background-color: #f9c7c8; + border: solid red 1px; +} +``` + +```js +Sortable.create(list, { + multiDrag: true, + selectedClass: "selected" +}); +``` + + +--- + + +### Event Properties + - items:`HTMLElement[]` — Array of selected items, or empty + - clones:`HTMLElement[]` — Array of clones, or empty + - oldIndicies:`Index[]` — Array containing information on the old indicies of the selected elements. + - newIndicies:`Index[]` — Array containing information on the new indicies of the selected elements. + +#### Index Object + - element:`HTMLElement` — The element whose index is being given + - index:`Number` — The index of the element + +#### Note on `newIndicies` +For any event that is fired during sorting, the index of any selected element that is not the main dragged element is given as `-1`. +This is because it has either been removed from the DOM, or because it is in a folding animation (folding to the dragged element) and will be removed after this animation is complete. + + +--- + + +### Sortable.utils +* select(el:`HTMLElement`) — select the given multi-drag item +* deselect(el:`HTMLElement`) — deselect the given multi-drag item diff --git a/public/assets/libs/Sortable/plugins/MultiDrag/index.js b/public/assets/libs/Sortable/plugins/MultiDrag/index.js new file mode 100644 index 0000000..2507117 --- /dev/null +++ b/public/assets/libs/Sortable/plugins/MultiDrag/index.js @@ -0,0 +1 @@ +export { default } from './MultiDrag.js'; diff --git a/public/assets/libs/Sortable/plugins/OnSpill/OnSpill.js b/public/assets/libs/Sortable/plugins/OnSpill/OnSpill.js new file mode 100644 index 0000000..e8c6439 --- /dev/null +++ b/public/assets/libs/Sortable/plugins/OnSpill/OnSpill.js @@ -0,0 +1,79 @@ +import { getChild } from '../../src/utils.js'; + + +const drop = function({ + originalEvent, + putSortable, + dragEl, + activeSortable, + dispatchSortableEvent, + hideGhostForTarget, + unhideGhostForTarget +}) { + if (!originalEvent) return; + let toSortable = putSortable || activeSortable; + hideGhostForTarget(); + let touch = originalEvent.changedTouches && originalEvent.changedTouches.length ? originalEvent.changedTouches[0] : originalEvent; + let target = document.elementFromPoint(touch.clientX, touch.clientY); + unhideGhostForTarget(); + if (toSortable && !toSortable.el.contains(target)) { + dispatchSortableEvent('spill'); + this.onSpill({ dragEl, putSortable }); + } +}; + +function Revert() {} + +Revert.prototype = { + startIndex: null, + dragStart({ oldDraggableIndex }) { + this.startIndex = oldDraggableIndex; + }, + onSpill({ dragEl, putSortable }) { + this.sortable.captureAnimationState(); + if (putSortable) { + putSortable.captureAnimationState(); + } + let nextSibling = getChild(this.sortable.el, this.startIndex, this.options); + + if (nextSibling) { + this.sortable.el.insertBefore(dragEl, nextSibling); + } else { + this.sortable.el.appendChild(dragEl); + } + this.sortable.animateAll(); + if (putSortable) { + putSortable.animateAll(); + } + }, + drop +}; + +Object.assign(Revert, { + pluginName: 'revertOnSpill' +}); + + +function Remove() {} + +Remove.prototype = { + onSpill({ dragEl, putSortable }) { + const parentSortable = putSortable || this.sortable; + parentSortable.captureAnimationState(); + dragEl.parentNode && dragEl.parentNode.removeChild(dragEl); + parentSortable.animateAll(); + }, + drop +}; + +Object.assign(Remove, { + pluginName: 'removeOnSpill' +}); + + +export default [Remove, Revert]; + +export { + Remove as RemoveOnSpill, + Revert as RevertOnSpill +}; diff --git a/public/assets/libs/Sortable/plugins/OnSpill/README.md b/public/assets/libs/Sortable/plugins/OnSpill/README.md new file mode 100644 index 0000000..816fd19 --- /dev/null +++ b/public/assets/libs/Sortable/plugins/OnSpill/README.md @@ -0,0 +1,60 @@ +# OnSpill Plugins +This file contains two seperate plugins, RemoveOnSpill and RevertOnSpill. They can be imported individually, or the default export (an array of both plugins) can be passed to `Sortable.mount` as well. + +**These plugins are default plugins, and are included in the default UMD and ESM builds of Sortable** + + +--- + + +### Mounting +```js +import { Sortable, OnSpill } from 'sortablejs/modular/sortable.core.esm'; + +Sortable.mount(OnSpill); +``` + + +--- + + +## RevertOnSpill Plugin +This plugin, when enabled, will cause the dragged item to be reverted to it's original position if it is spilled (ie. it is dropped outside of a valid Sortable drop target) + + + + +### Options + +```js +new Sortable(el, { + revertOnSpill: true, // Enable plugin + // Called when item is spilled + onSpill: function(/**Event*/evt) { + evt.item // The spilled item + } +}); +``` + + +--- + + +## RemoveOnSpill Plugin +This plugin, when enabled, will cause the dragged item to be removed from the DOM if it is spilled (ie. it is dropped outside of a valid Sortable drop target) + + +--- + + +### Options + +```js +new Sortable(el, { + removeOnSpill: true, // Enable plugin + // Called when item is spilled + onSpill: function(/**Event*/evt) { + evt.item // The spilled item + } +}); +``` diff --git a/public/assets/libs/Sortable/plugins/OnSpill/index.js b/public/assets/libs/Sortable/plugins/OnSpill/index.js new file mode 100644 index 0000000..4023b0f --- /dev/null +++ b/public/assets/libs/Sortable/plugins/OnSpill/index.js @@ -0,0 +1 @@ +export { default, RemoveOnSpill, RevertOnSpill } from './OnSpill.js'; diff --git a/public/assets/libs/Sortable/plugins/README.md b/public/assets/libs/Sortable/plugins/README.md new file mode 100644 index 0000000..1dbef58 --- /dev/null +++ b/public/assets/libs/Sortable/plugins/README.md @@ -0,0 +1,178 @@ +# Creating Sortable Plugins +Sortable plugins are plugins that can be directly mounted to the Sortable class. They are a powerful way of modifying the default behaviour of Sortable beyond what simply using events alone allows. To mount your plugin to Sortable, it must pass a constructor function to the `Sortable.mount` function. This constructor function will be called (with the `new` keyword in front of it) whenever a Sortable instance with your plugin enabled is initialized. The constructor function will be called with the parameters `sortable` and `el`, which is the HTMLElement that the Sortable is being initialized on. This means that there will be a new instance of your plugin each time it is enabled in a Sortable. + + +## Constructor Parameters + +`sortable: Sortable` — The sortable that the plugin is being initialized on + +`el: HTMLElement` — The element that the sortable is being initialized on + +`options: Object` — The options object that the user has passed into Sortable (not merged with defaults yet) + + +## Static Properties +The constructor function passed to `Sortable.mount` may contain several static properties and methods. The following static properties may be defined: + +`pluginName: String` (Required) +The name of the option that the user will use in their sortable's options to enable the plugin. Should start with a lower case and be camel-cased. For example: `'multiDrag'`. This is also the property name that the plugin's instance will be under in a sortable instance (ex. `sortableInstance.multiDrag`). + +`utils: Object` +Object containing functions that will be added to the `Sortable.utils` static object on the Sortable class. + +`eventOptions(eventName: String): Function` +A function that is called whenever Sortable fires an event. This function should return an object to be combined with the event object that Sortable will emit. The function will be called in the context of the instance of the plugin on the Sortable that is firing the event (ie. the `this` keyword will be the plugin instance). + +`initializeByDefault: Boolean` +Determines whether or not the plugin will always be initialized on every new Sortable instance. If this option is enabled, it does not mean that by default the plugin will be enabled on the Sortable - this must still be done in the options via the plugin's `pluginName`, or it can be enabled by default if your plugin specifies it's pluginName as a default option that is truthy. Since the plugin will already be initialized on every Sortable instance, it can also be enabled dynamically via `sortableInstance.option('pluginName', true)`. +It is a good idea to have this option set to `false` if the plugin modifies the behaviour of Sortable in such a way that enabling or disabling the plugin dynamically could cause it to break. Likewise, this option should be disabled if the plugin should only be instantiated on Sortables in which that plugin is enabled. +This option defaults to `true`. + +`optionListeners: Object` +An object that may contain event listeners that are fired when a specific option is updated. +These listeners are useful because the user's provided options are not necessarily unchanging once the plugin is initialized, and could be changed dynamically via the `option()` method. +The listener will be fired in the context of the instance of the plugin that it is being changed in (ie. the `this` keyword will be the instance of your plugin). +The name of the method should match the name of the option it listens for. The new value of the option will be passed in as an argument, and any returned value will be what the option is stored as. If no value is returned, the option will be stored as the value the user provided. + +Example: + +```js +Plugin.name = 'generateTitle'; +Plugin.optionListeners = { + // Listen for option 'generateTitle' + generateTitle: function(title) { + // Store the option in all caps + return title.toUpperCase(); + + // OR save it to this instance of your plugin as a private field. + // This way it can be accessed in events, but will not modify the user's options. + this.titleAllCaps = title.toUpperCase(); + } +}; + +``` + +## Plugin Options +Plugins may have custom default options or may override the defaults of other options. In order to do this, there must be a `defaults` object on the initialized plugin. This can be set in the plugin's prototype, or during the initialization of the plugin (when the `el` is available). For example: + +```js +function myPlugin(sortable, el, options) { + this.defaults = { + color: el.style.backgroundColor + }; +} + +Sortable.mount(myPlugin); +``` + + +## Plugin Events + +### Context +The events will be fired in the context of their own parent object (ie. context is not changed), however the plugin instance's Sortable instance is available under `this.sortable`. Likewise, the options are available under `this.options`. + +### Event List +The following table contains details on the events that a plugin may handle in the prototype of the plugin's constructor function. + +| Event Name | Description | Cancelable? | Cancel Behaviour | Event Type | Custom Event Object Properties | +|---------------------------|------------------------------------------------------------------------------------------------------------------|-------------|----------------------------------------------------|------------|-------------------------------------------------------------------------| +| filter | Fired when the element is filtered, and dragging is therefore canceled | No | - | Normal | None | +| delayStart | Fired when the delay starts, even if there is no delay | Yes | Cancels sorting | Normal | None | +| delayEnded | Fired when the delay ends, even if there is no delay | Yes | Cancels sorting | Normal | None | +| setupClone | Fired when Sortable clones the dragged element | Yes | Cancels normal clone setup | Normal | None | +| dragStart | Fired when the dragging is first started | Yes | Cancels sorting | Normal | None | +| clone | Fired when the clone is inserted into the DOM (if `removeCloneOnHide: false`). Tick after dragStart. | Yes | Cancels normal clone insertion & hiding | Normal | None | +| dragStarted | Fired tick after dragStart | No | - | Normal | None | +| dragOver | Fired when the user drags over a sortable | Yes | Cancels normal dragover behaviour | DragOver | None | +| dragOverValid | Fired when the user drags over a sortable that the dragged item can be inserted into | Yes | Cancels normal valid dragover behaviour | DragOver | None | +| revert | Fired when the dragged item is reverted to it's original position when entering it's `sort:false` root | Yes | Cancels normal reverting, but is still completed() | DragOver | None | +| dragOverCompleted | Fired when dragOver is completed (ie. bubbling is disabled). To check if inserted, use `inserted` even property. | No | - | DragOver | `insertion: Boolean` — Whether or not the dragged element was inserted | +| dragOverAnimationCapture | Fired right before the animation state is captured in dragOver | No | - | DragOver | None | +| dragOverAnimationComplete | Fired after the animation is completed after a dragOver insertion | No | - | DragOver | None | +| drop | Fired on drop | Yes | Cancels normal drop behavior | Normal | None | +| nulling | Fired when the plugin should preform cleanups, once all drop events have fired | No | - | Normal | None | +| destroy | Fired when Sortable is destroyed | No | - | Normal | None | + +### Global Events +Normally, an event will only be fired in a plugin if the plugin is enabled on the Sortable from which the event is being fired. However, it sometimes may be desirable for a plugin to listen in on an event from Sortables in which it is not enabled on. This is possible with global events. For an event to be global, simply add the suffix 'Global' to the event's name (casing matters) (eg. `dragStartGlobal`). +Please note that your plugin must be initialized on any Sortable from which it expects to recieve events, and that includes global events. In other words, you will want to keep the `initializeByDefault` option as it's default `true` value if your plugin needs to recieve events from Sortables it is not enabled on. +Please also note that if both normal and global event handlers are set, the global event handler will always be fired before the regular one. + +### Event Object +An object with the following properties is passed as an argument to each plugin event when it is fired. + +#### Properties: + +`dragEl: HTMLElement` — The element being dragged + +`parentEl: HTMLElement` — The element that the dragged element is currently in + +`ghostEl: HTMLElement|undefined` — If using fallback, the element dragged under the cursor (undefined until after `dragStarted` plugin event) + +`rootEl: HTMLElement` — The element that the dragged element originated from + +`nextEl: HTMLElement` — The original next sibling of dragEl + +`cloneEl: HTMLElement|undefined` — The clone element (undefined until after `setupClone` plugin event) + +`cloneHidden: Boolean` — Whether or not the clone is hidden + +`dragStarted: Boolean` — Boolean indicating whether or not the dragStart event has fired + +`putSortable: Sortable|undefined` — The element that dragEl is dragged into from it's root, otherwise undefined + +`activeSortable: Sortable` — The active Sortable instance + +`originalEvent: Event` — The original HTML event corresponding to the Sortable event + +`oldIndex: Number` — The old index of dragEl + +`oldDraggableIndex: Number` — The old index of dragEl, only counting draggable elements + +`newIndex: Number` — The new index of dragEl + +`newDraggableIndex: Number` — The new index of dragEl, only counting draggable elements + + +#### Methods: + +`cloneNowHidden()` — Function to be called if the plugin has hidden the clone + +`cloneNowShown()` — Function to be called if the plugin has shown the clone + +`hideGhostForTarget()` — Hides the fallback ghost element if CSS pointer-events are not available. Call this before using document.elementFromPoint at the mouse position. + +`unhideGhostForTarget()` — Unhides the ghost element. To be called after `hideGhostForTarget()`. + +`dispatchSortableEvent(eventName: String)` — Function that can be used to emit an event on the current sortable while sorting, with all usual event properties set (eg. indexes, rootEl, cloneEl, originalEvent, etc.). + + +### DragOverEvent Object +This event is passed to dragover events, and extends the normal event object. + +#### Properties: + +`isOwner: Boolean` — Whether or not the dragged over sortable currently contains the dragged element + +`axis: String` — Direction of the dragged over sortable, `'vertical'` or `'horizontal'` + +`revert: Boolean` — Whether or not the dragged element is being reverted to it's original position from another position + +`dragRect: DOMRect` — DOMRect of the dragged element + +`targetRect: DOMRect` — DOMRect of the target element + +`canSort: Boolean` — Whether or not sorting is enabled in the dragged over sortable + +`fromSortable: Sortable` — The sortable that the dragged element is coming from + +`target: HTMLElement` — The sortable item that is being dragged over + + +#### Methods: + +`onMove(target: HTMLElement, after: Boolean): Boolean|Number` — Calls the `onMove` function the user specified in the options + +`changed()` — Fires the `onChange` event with event properties preconfigured + +`completed(insertion: Boolean)` — Should be called when dragover has "completed", meaning bubbling should be stopped. If `insertion` is `true`, Sortable will treat it as if the dragged element was inserted into the sortable, and hide/show clone, set ghost class, animate, etc. diff --git a/public/assets/libs/Sortable/plugins/Swap/README.md b/public/assets/libs/Sortable/plugins/Swap/README.md new file mode 100644 index 0000000..7c6e399 --- /dev/null +++ b/public/assets/libs/Sortable/plugins/Swap/README.md @@ -0,0 +1,55 @@ +## Swap Plugin +This plugin modifies the behaviour of Sortable to allow for items to be swapped with eachother rather than sorted. Once dragging starts, the user can drag over other items and there will be no change in the elements. However, the item that the user drops on will be swapped with the originally dragged item. + +Demo: https://jsbin.com/yejehog/edit?html,js,output + + +--- + + +### Mounting +```js +import { Sortable, Swap } from 'sortablejs/modular/sortable.core.esm'; + +Sortable.mount(new Swap()); +``` + + +--- + + +### Options + +```js +new Sortable(el, { + swap: true, // Enable swap mode + swapClass: "sortable-swap-highlight" // Class name for swap item (if swap mode is enabled) +}); +``` + + +--- + + +#### `swapClass` option +Class name for the item to be swapped with, if swap mode is enabled. Defaults to `sortable-swap-highlight`. + +```css +.highlighted { + background-color: #9AB6F1; +} +``` + +```js +Sortable.create(list, { + swap: true, + swapClass: "highlighted" +}); +``` + + +--- + + +### Event Properties + - swapItem:`HTMLElement|undefined` — The element that the dragged element was swapped with diff --git a/public/assets/libs/Sortable/plugins/Swap/Swap.js b/public/assets/libs/Sortable/plugins/Swap/Swap.js new file mode 100644 index 0000000..3f0feb7 --- /dev/null +++ b/public/assets/libs/Sortable/plugins/Swap/Swap.js @@ -0,0 +1,90 @@ +import { + toggleClass, + index +} from '../../src/utils.js'; + +let lastSwapEl; + + +function SwapPlugin() { + function Swap() { + this.defaults = { + swapClass: 'sortable-swap-highlight' + }; + } + + Swap.prototype = { + dragStart({ dragEl }) { + lastSwapEl = dragEl; + }, + dragOverValid({ completed, target, onMove, activeSortable, changed, cancel }) { + if (!activeSortable.options.swap) return; + let el = this.sortable.el, + options = this.options; + if (target && target !== el) { + let prevSwapEl = lastSwapEl; + if (onMove(target) !== false) { + toggleClass(target, options.swapClass, true); + lastSwapEl = target; + } else { + lastSwapEl = null; + } + + if (prevSwapEl && prevSwapEl !== lastSwapEl) { + toggleClass(prevSwapEl, options.swapClass, false); + } + } + changed(); + + completed(true); + cancel(); + }, + drop({ activeSortable, putSortable, dragEl }) { + let toSortable = (putSortable || this.sortable); + let options = this.options; + lastSwapEl && toggleClass(lastSwapEl, options.swapClass, false); + if (lastSwapEl && (options.swap || putSortable && putSortable.options.swap)) { + if (dragEl !== lastSwapEl) { + toSortable.captureAnimationState(); + if (toSortable !== activeSortable) activeSortable.captureAnimationState(); + swapNodes(dragEl, lastSwapEl); + + toSortable.animateAll(); + if (toSortable !== activeSortable) activeSortable.animateAll(); + } + } + }, + nulling() { + lastSwapEl = null; + } + }; + + return Object.assign(Swap, { + pluginName: 'swap', + eventProperties() { + return { + swapItem: lastSwapEl + }; + } + }); +} + + +function swapNodes(n1, n2) { + let p1 = n1.parentNode, + p2 = n2.parentNode, + i1, i2; + + if (!p1 || !p2 || p1.isEqualNode(n2) || p2.isEqualNode(n1)) return; + + i1 = index(n1); + i2 = index(n2); + + if (p1.isEqualNode(p2) && i1 < i2) { + i2++; + } + p1.insertBefore(n2, p1.children[i1]); + p2.insertBefore(n1, p2.children[i2]); +} + +export default SwapPlugin; diff --git a/public/assets/libs/Sortable/plugins/Swap/index.js b/public/assets/libs/Sortable/plugins/Swap/index.js new file mode 100644 index 0000000..9799bc7 --- /dev/null +++ b/public/assets/libs/Sortable/plugins/Swap/index.js @@ -0,0 +1 @@ +export { default } from './Swap.js'; diff --git a/public/assets/libs/Sortable/scripts/banner.js b/public/assets/libs/Sortable/scripts/banner.js new file mode 100644 index 0000000..337928b --- /dev/null +++ b/public/assets/libs/Sortable/scripts/banner.js @@ -0,0 +1,8 @@ +import { version } from '../package.json'; + +export default `/**! + * Sortable ${ version } + * @author RubaXa + * @author owenm + * @license MIT + */`; diff --git a/public/assets/libs/Sortable/scripts/build.js b/public/assets/libs/Sortable/scripts/build.js new file mode 100644 index 0000000..11cf99d --- /dev/null +++ b/public/assets/libs/Sortable/scripts/build.js @@ -0,0 +1,17 @@ +import babel from 'rollup-plugin-babel'; +import json from 'rollup-plugin-json'; +import resolve from 'rollup-plugin-node-resolve'; +import banner from './banner.js'; + + +export default { + output: { + banner, + name: 'Sortable' + }, + plugins: [ + json(), + babel(), + resolve() + ] +}; diff --git a/public/assets/libs/Sortable/scripts/esm-build.js b/public/assets/libs/Sortable/scripts/esm-build.js new file mode 100644 index 0000000..9caff74 --- /dev/null +++ b/public/assets/libs/Sortable/scripts/esm-build.js @@ -0,0 +1,28 @@ +import build from './build.js'; + +export default ([ + { + input: 'entry/entry-core.js', + output: Object.assign({}, build.output, { + file: 'modular/sortable.core.esm.js', + format: 'esm' + }) + }, + { + input: 'entry/entry-defaults.js', + output: Object.assign({}, build.output, { + file: 'modular/sortable.esm.js', + format: 'esm' + }) + }, + { + input: 'entry/entry-complete.js', + output: Object.assign({}, build.output, { + file: 'modular/sortable.complete.esm.js', + format: 'esm' + }) + } +]).map(config => { + let buildCopy = { ...build }; + return Object.assign(buildCopy, config); +}); diff --git a/public/assets/libs/Sortable/scripts/minify.js b/public/assets/libs/Sortable/scripts/minify.js new file mode 100644 index 0000000..e2051a2 --- /dev/null +++ b/public/assets/libs/Sortable/scripts/minify.js @@ -0,0 +1,11 @@ +const UglifyJS = require('uglify-js'), + fs = require('fs'), + package = require('../package.json'); + +const banner = `/*! Sortable ${ package.version } - ${ package.license } | ${ package.repository.url } */\n`; + +fs.writeFileSync( + `./Sortable.min.js`, + banner + UglifyJS.minify(fs.readFileSync(`./Sortable.js`, 'utf8')).code, + 'utf8' +); diff --git a/public/assets/libs/Sortable/scripts/test-compat.js b/public/assets/libs/Sortable/scripts/test-compat.js new file mode 100644 index 0000000..f7408c7 --- /dev/null +++ b/public/assets/libs/Sortable/scripts/test-compat.js @@ -0,0 +1,30 @@ +const createTestCafe = require('testcafe'); +// Testcafe cannot test on IE < 11 +// Testcafe testing on Chrome Android is currently broken (https://github.com/DevExpress/testcafe/issues/3948) +const browsers = [ + 'saucelabs:Internet Explorer@11.285:Windows 10', + 'saucelabs:MicrosoftEdge@16.16299:Windows 10', + 'saucelabs:iPhone XS Simulator@12.2', + 'saucelabs:Safari@12.0:macOS 10.14', + 'chrome:headless', + 'firefox:headless' +]; + +let testcafe; +let runner; +let failedCount; + +createTestCafe(null, 8000, 8001).then((tc) => { + testcafe = tc; + runner = tc.createRunner(); + return runner + .src('./tests/Sortable.compat.test.js') + .browsers(browsers) + .run(); +}).then((actualFailedCount) => { + // https://testcafe-discuss.devexpress.com/t/why-circleci-marked-build-as-green-even-if-this-build-contain-failed-test/726/2 + failedCount = actualFailedCount; + return testcafe.close(); +}).then(() => process.exit(failedCount)); + + diff --git a/public/assets/libs/Sortable/scripts/test.js b/public/assets/libs/Sortable/scripts/test.js new file mode 100644 index 0000000..6c62b75 --- /dev/null +++ b/public/assets/libs/Sortable/scripts/test.js @@ -0,0 +1,21 @@ +const createTestCafe = require('testcafe'); + +let testcafe; +let runner; +let failedCount; + + +createTestCafe().then((tc) => { + testcafe = tc; + runner = tc.createRunner(); + return runner + .src('./tests/Sortable.test.js') + .browsers('chrome:headless') + .concurrency(3) + .run(); +}).then((actualFailedCount) => { + failedCount = actualFailedCount; + console.log('FAILED COUNT', actualFailedCount) + return testcafe.close(); +}).then(() => process.exit(failedCount)); + diff --git a/public/assets/libs/Sortable/scripts/umd-build.js b/public/assets/libs/Sortable/scripts/umd-build.js new file mode 100644 index 0000000..ec179fd --- /dev/null +++ b/public/assets/libs/Sortable/scripts/umd-build.js @@ -0,0 +1,15 @@ +import build from './build.js'; + + +export default ([ + { + input: 'entry/entry-complete.js', + output: Object.assign({}, build.output, { + file: './Sortable.js', + format: 'umd' + }) + } +]).map(config => { + let buildCopy = { ...build }; + return Object.assign(buildCopy, config); +}); diff --git a/public/assets/libs/Sortable/src/Animation.js b/public/assets/libs/Sortable/src/Animation.js new file mode 100644 index 0000000..1947991 --- /dev/null +++ b/public/assets/libs/Sortable/src/Animation.js @@ -0,0 +1,175 @@ +import { getRect, css, matrix, isRectEqual, indexOfObject } from './utils.js'; +import Sortable from './Sortable.js'; + +export default function AnimationStateManager() { + let animationStates = [], + animationCallbackId; + + return { + captureAnimationState() { + animationStates = []; + if (!this.options.animation) return; + let children = [].slice.call(this.el.children); + + children.forEach(child => { + if (css(child, 'display') === 'none' || child === Sortable.ghost) return; + animationStates.push({ + target: child, + rect: getRect(child) + }); + let fromRect = { ...animationStates[animationStates.length - 1].rect }; + + // If animating: compensate for current animation + if (child.thisAnimationDuration) { + let childMatrix = matrix(child, true); + if (childMatrix) { + fromRect.top -= childMatrix.f; + fromRect.left -= childMatrix.e; + } + } + + child.fromRect = fromRect; + }); + }, + + addAnimationState(state) { + animationStates.push(state); + }, + + removeAnimationState(target) { + animationStates.splice(indexOfObject(animationStates, { target }), 1); + }, + + animateAll(callback) { + if (!this.options.animation) { + clearTimeout(animationCallbackId); + if (typeof(callback) === 'function') callback(); + return; + } + + let animating = false, + animationTime = 0; + + animationStates.forEach((state) => { + let time = 0, + animatingThis = false, + target = state.target, + fromRect = target.fromRect, + toRect = getRect(target), + prevFromRect = target.prevFromRect, + prevToRect = target.prevToRect, + animatingRect = state.rect, + targetMatrix = matrix(target, true); + + + if (targetMatrix) { + // Compensate for current animation + toRect.top -= targetMatrix.f; + toRect.left -= targetMatrix.e; + } + + target.toRect = toRect; + + if (target.thisAnimationDuration) { + // Could also check if animatingRect is between fromRect and toRect + if ( + isRectEqual(prevFromRect, toRect) && + !isRectEqual(fromRect, toRect) && + // Make sure animatingRect is on line between toRect & fromRect + (animatingRect.top - toRect.top) / + (animatingRect.left - toRect.left) === + (fromRect.top - toRect.top) / + (fromRect.left - toRect.left) + ) { + // If returning to same place as started from animation and on same axis + time = calculateRealTime(animatingRect, prevFromRect, prevToRect, this.options); + } + } + + // if fromRect != toRect: animate + if (!isRectEqual(toRect, fromRect)) { + target.prevFromRect = fromRect; + target.prevToRect = toRect; + + if (!time) { + time = this.options.animation; + } + this.animate( + target, + animatingRect, + toRect, + time + ); + } + + if (time) { + animating = true; + animationTime = Math.max(animationTime, time); + clearTimeout(target.animationResetTimer); + target.animationResetTimer = setTimeout(function() { + target.animationTime = 0; + target.prevFromRect = null; + target.fromRect = null; + target.prevToRect = null; + target.thisAnimationDuration = null; + }, time); + target.thisAnimationDuration = time; + } + }); + + + clearTimeout(animationCallbackId); + if (!animating) { + if (typeof(callback) === 'function') callback(); + } else { + animationCallbackId = setTimeout(function() { + if (typeof(callback) === 'function') callback(); + }, animationTime); + } + animationStates = []; + }, + + animate(target, currentRect, toRect, duration) { + if (duration) { + css(target, 'transition', ''); + css(target, 'transform', ''); + let elMatrix = matrix(this.el), + scaleX = elMatrix && elMatrix.a, + scaleY = elMatrix && elMatrix.d, + translateX = (currentRect.left - toRect.left) / (scaleX || 1), + translateY = (currentRect.top - toRect.top) / (scaleY || 1); + + target.animatingX = !!translateX; + target.animatingY = !!translateY; + + css(target, 'transform', 'translate3d(' + translateX + 'px,' + translateY + 'px,0)'); + + repaint(target); // repaint + + css(target, 'transition', 'transform ' + duration + 'ms' + (this.options.easing ? ' ' + this.options.easing : '')); + css(target, 'transform', 'translate3d(0,0,0)'); + (typeof target.animated === 'number') && clearTimeout(target.animated); + target.animated = setTimeout(function () { + css(target, 'transition', ''); + css(target, 'transform', ''); + target.animated = false; + + target.animatingX = false; + target.animatingY = false; + }, duration); + } + } + }; +} + +function repaint(target) { + return target.offsetWidth; +} + + +function calculateRealTime(animatingRect, fromRect, toRect, options) { + return ( + Math.sqrt(Math.pow(fromRect.top - animatingRect.top, 2) + Math.pow(fromRect.left - animatingRect.left, 2)) / + Math.sqrt(Math.pow(fromRect.top - toRect.top, 2) + Math.pow(fromRect.left - toRect.left, 2)) + ) * options.animation; +} diff --git a/public/assets/libs/Sortable/src/BrowserInfo.js b/public/assets/libs/Sortable/src/BrowserInfo.js new file mode 100644 index 0000000..304a853 --- /dev/null +++ b/public/assets/libs/Sortable/src/BrowserInfo.js @@ -0,0 +1,12 @@ +function userAgent(pattern) { + if (typeof window !== 'undefined' && window.navigator) { + return !!/*@__PURE__*/navigator.userAgent.match(pattern); + } +} + +export const IE11OrLess = userAgent(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i); +export const Edge = userAgent(/Edge/i); +export const FireFox = userAgent(/firefox/i); +export const Safari = userAgent(/safari/i) && !userAgent(/chrome/i) && !userAgent(/android/i); +export const IOS = userAgent(/iP(ad|od|hone)/i); +export const ChromeForAndroid = userAgent(/chrome/i) && userAgent(/android/i); diff --git a/public/assets/libs/Sortable/src/EventDispatcher.js b/public/assets/libs/Sortable/src/EventDispatcher.js new file mode 100644 index 0000000..e47cb58 --- /dev/null +++ b/public/assets/libs/Sortable/src/EventDispatcher.js @@ -0,0 +1,57 @@ +import { IE11OrLess, Edge } from './BrowserInfo.js'; +import { expando } from './utils.js'; +import PluginManager from './PluginManager.js'; + +export default function dispatchEvent( + { + sortable, rootEl, name, + targetEl, cloneEl, toEl, fromEl, + oldIndex, newIndex, + oldDraggableIndex, newDraggableIndex, + originalEvent, putSortable, extraEventProperties + } +) { + sortable = (sortable || (rootEl && rootEl[expando])); + if (!sortable) return; + + let evt, + options = sortable.options, + onName = 'on' + name.charAt(0).toUpperCase() + name.substr(1); + // Support for new CustomEvent feature + if (window.CustomEvent && !IE11OrLess && !Edge) { + evt = new CustomEvent(name, { + bubbles: true, + cancelable: true + }); + } else { + evt = document.createEvent('Event'); + evt.initEvent(name, true, true); + } + + evt.to = toEl || rootEl; + evt.from = fromEl || rootEl; + evt.item = targetEl || rootEl; + evt.clone = cloneEl; + + evt.oldIndex = oldIndex; + evt.newIndex = newIndex; + + evt.oldDraggableIndex = oldDraggableIndex; + evt.newDraggableIndex = newDraggableIndex; + + evt.originalEvent = originalEvent; + evt.pullMode = putSortable ? putSortable.lastPutMode : undefined; + + let allEventProperties = { ...extraEventProperties, ...PluginManager.getEventProperties(name, sortable) }; + for (let option in allEventProperties) { + evt[option] = allEventProperties[option]; + } + + if (rootEl) { + rootEl.dispatchEvent(evt); + } + + if (options[onName]) { + options[onName].call(sortable, evt); + } +} diff --git a/public/assets/libs/Sortable/src/PluginManager.js b/public/assets/libs/Sortable/src/PluginManager.js new file mode 100644 index 0000000..623c26f --- /dev/null +++ b/public/assets/libs/Sortable/src/PluginManager.js @@ -0,0 +1,87 @@ +let plugins = []; + +const defaults = { + initializeByDefault: true +}; + +export default { + mount(plugin) { + // Set default static properties + for (let option in defaults) { + if (defaults.hasOwnProperty(option) && !(option in plugin)) { + plugin[option] = defaults[option]; + } + } + plugins.push(plugin); + }, + pluginEvent(eventName, sortable, evt) { + this.eventCanceled = false; + evt.cancel = () => { + this.eventCanceled = true; + }; + const eventNameGlobal = eventName + 'Global'; + plugins.forEach(plugin => { + if (!sortable[plugin.pluginName]) return; + // Fire global events if it exists in this sortable + if ( + sortable[plugin.pluginName][eventNameGlobal] + ) { + sortable[plugin.pluginName][eventNameGlobal]({ sortable, ...evt }); + } + + // Only fire plugin event if plugin is enabled in this sortable, + // and plugin has event defined + if ( + sortable.options[plugin.pluginName] && + sortable[plugin.pluginName][eventName] + ) { + sortable[plugin.pluginName][eventName]({ sortable, ...evt }); + } + }); + }, + initializePlugins(sortable, el, defaults, options) { + plugins.forEach(plugin => { + const pluginName = plugin.pluginName; + if (!sortable.options[pluginName] && !plugin.initializeByDefault) return; + + let initialized = new plugin(sortable, el, sortable.options); + initialized.sortable = sortable; + initialized.options = sortable.options; + sortable[pluginName] = initialized; + + // Add default options from plugin + Object.assign(defaults, initialized.defaults); + }); + + for (let option in sortable.options) { + if (!sortable.options.hasOwnProperty(option)) continue; + let modified = this.modifyOption(sortable, option, sortable.options[option]); + if (typeof(modified) !== 'undefined') { + sortable.options[option] = modified; + } + } + }, + getEventProperties(name, sortable) { + let eventProperties = {}; + plugins.forEach(plugin => { + if (typeof(plugin.eventProperties) !== 'function') return; + Object.assign(eventProperties, plugin.eventProperties.call(sortable[plugin.pluginName], name)); + }); + + return eventProperties; + }, + modifyOption(sortable, name, value) { + let modifiedValue; + plugins.forEach(plugin => { + // Plugin must exist on the Sortable + if (!sortable[plugin.pluginName]) return; + + // If static option listener exists for this option, call in the context of the Sortable's instance of this plugin + if (plugin.optionListeners && typeof(plugin.optionListeners[name]) === 'function') { + modifiedValue = plugin.optionListeners[name].call(sortable[plugin.pluginName], value); + } + }); + + return modifiedValue; + } +}; diff --git a/public/assets/libs/Sortable/src/Sortable.js b/public/assets/libs/Sortable/src/Sortable.js new file mode 100644 index 0000000..c791c4f --- /dev/null +++ b/public/assets/libs/Sortable/src/Sortable.js @@ -0,0 +1,1966 @@ +/**! + * Sortable + * @author RubaXa + * @author owenm + * @license MIT + */ + +import { version } from '../package.json'; + +import { IE11OrLess, Edge, FireFox, Safari, IOS, ChromeForAndroid } from './BrowserInfo.js'; + +import AnimationStateManager from './Animation.js'; + +import PluginManager from './PluginManager.js'; + +import dispatchEvent from './EventDispatcher.js'; + +import { + on, + off, + closest, + toggleClass, + css, + matrix, + find, + getWindowScrollingElement, + getRect, + isScrolledPast, + getChild, + lastChild, + index, + getRelativeScrollOffset, + extend, + throttle, + scrollBy, + clone, + expando +} from './utils.js'; + + +let pluginEvent = function(eventName, sortable, { evt: originalEvent, ...data } = {}) { + PluginManager.pluginEvent.bind(Sortable)(eventName, sortable, { + dragEl, + parentEl, + ghostEl, + rootEl, + nextEl, + lastDownEl, + cloneEl, + cloneHidden, + dragStarted: moved, + putSortable, + activeSortable: Sortable.active, + originalEvent, + + oldIndex, + oldDraggableIndex, + newIndex, + newDraggableIndex, + + hideGhostForTarget: _hideGhostForTarget, + unhideGhostForTarget: _unhideGhostForTarget, + + + cloneNowHidden() { + cloneHidden = true; + }, + cloneNowShown() { + cloneHidden = false; + }, + + dispatchSortableEvent(name) { + _dispatchEvent({ sortable, name, originalEvent }); + }, + + ...data + }); +}; + +function _dispatchEvent(info) { + dispatchEvent({ + putSortable, + cloneEl, + targetEl: dragEl, + rootEl, + oldIndex, + oldDraggableIndex, + newIndex, + newDraggableIndex, + ...info + }); +} + + +let dragEl, + parentEl, + ghostEl, + rootEl, + nextEl, + lastDownEl, + + cloneEl, + cloneHidden, + + oldIndex, + newIndex, + oldDraggableIndex, + newDraggableIndex, + + activeGroup, + putSortable, + + awaitingDragStarted = false, + ignoreNextClick = false, + sortables = [], + + tapEvt, + touchEvt, + lastDx, + lastDy, + tapDistanceLeft, + tapDistanceTop, + + moved, + + lastTarget, + lastDirection, + pastFirstInvertThresh = false, + isCircumstantialInvert = false, + + targetMoveDistance, + + // For positioning ghost absolutely + ghostRelativeParent, + ghostRelativeParentInitialScroll = [], // (left, top) + + _silent = false, + savedInputChecked = []; + + /** @const */ + const documentExists = typeof document !== 'undefined', + + PositionGhostAbsolutely = IOS, + + CSSFloatProperty = Edge || IE11OrLess ? 'cssFloat' : 'float', + + // This will not pass for IE9, because IE9 DnD only works on anchors + supportDraggable = documentExists && !ChromeForAndroid && !IOS && ('draggable' in document.createElement('div')), + + supportCssPointerEvents = (function() { + if (!documentExists) return; + // false when <= IE11 + if (IE11OrLess) { + return false; + } + let el = document.createElement('x'); + el.style.cssText = 'pointer-events:auto'; + return el.style.pointerEvents === 'auto'; + })(), + + _detectDirection = function(el, options) { + let elCSS = css(el), + elWidth = parseInt(elCSS.width) + - parseInt(elCSS.paddingLeft) + - parseInt(elCSS.paddingRight) + - parseInt(elCSS.borderLeftWidth) + - parseInt(elCSS.borderRightWidth), + child1 = getChild(el, 0, options), + child2 = getChild(el, 1, options), + firstChildCSS = child1 && css(child1), + secondChildCSS = child2 && css(child2), + firstChildWidth = firstChildCSS && parseInt(firstChildCSS.marginLeft) + parseInt(firstChildCSS.marginRight) + getRect(child1).width, + secondChildWidth = secondChildCSS && parseInt(secondChildCSS.marginLeft) + parseInt(secondChildCSS.marginRight) + getRect(child2).width; + + if (elCSS.display === 'flex') { + return elCSS.flexDirection === 'column' || elCSS.flexDirection === 'column-reverse' + ? 'vertical' : 'horizontal'; + } + + if (elCSS.display === 'grid') { + return elCSS.gridTemplateColumns.split(' ').length <= 1 ? 'vertical' : 'horizontal'; + } + + if (child1 && firstChildCSS.float && firstChildCSS.float !== 'none') { + let touchingSideChild2 = firstChildCSS.float === 'left' ? 'left' : 'right'; + + return child2 && (secondChildCSS.clear === 'both' || secondChildCSS.clear === touchingSideChild2) ? + 'vertical' : 'horizontal'; + } + + return (child1 && + ( + firstChildCSS.display === 'block' || + firstChildCSS.display === 'flex' || + firstChildCSS.display === 'table' || + firstChildCSS.display === 'grid' || + firstChildWidth >= elWidth && + elCSS[CSSFloatProperty] === 'none' || + child2 && + elCSS[CSSFloatProperty] === 'none' && + firstChildWidth + secondChildWidth > elWidth + ) ? + 'vertical' : 'horizontal' + ); + }, + + _dragElInRowColumn = function(dragRect, targetRect, vertical) { + let dragElS1Opp = vertical ? dragRect.left : dragRect.top, + dragElS2Opp = vertical ? dragRect.right : dragRect.bottom, + dragElOppLength = vertical ? dragRect.width : dragRect.height, + targetS1Opp = vertical ? targetRect.left : targetRect.top, + targetS2Opp = vertical ? targetRect.right : targetRect.bottom, + targetOppLength = vertical ? targetRect.width : targetRect.height; + + return ( + dragElS1Opp === targetS1Opp || + dragElS2Opp === targetS2Opp || + (dragElS1Opp + dragElOppLength / 2) === (targetS1Opp + targetOppLength / 2) + ); + }, + + /** + * Detects first nearest empty sortable to X and Y position using emptyInsertThreshold. + * @param {Number} x X position + * @param {Number} y Y position + * @return {HTMLElement} Element of the first found nearest Sortable + */ + _detectNearestEmptySortable = function(x, y) { + let ret; + sortables.some((sortable) => { + if (lastChild(sortable)) return; + + let rect = getRect(sortable), + threshold = sortable[expando].options.emptyInsertThreshold, + insideHorizontally = x >= (rect.left - threshold) && x <= (rect.right + threshold), + insideVertically = y >= (rect.top - threshold) && y <= (rect.bottom + threshold); + + if (threshold && insideHorizontally && insideVertically) { + return (ret = sortable); + } + }); + return ret; + }, + + _prepareGroup = function (options) { + function toFn(value, pull) { + return function(to, from, dragEl, evt) { + let sameGroup = to.options.group.name && + from.options.group.name && + to.options.group.name === from.options.group.name; + + if (value == null && (pull || sameGroup)) { + // Default pull value + // Default pull and put value if same group + return true; + } else if (value == null || value === false) { + return false; + } else if (pull && value === 'clone') { + return value; + } else if (typeof value === 'function') { + return toFn(value(to, from, dragEl, evt), pull)(to, from, dragEl, evt); + } else { + let otherGroup = (pull ? to : from).options.group.name; + + return (value === true || + (typeof value === 'string' && value === otherGroup) || + (value.join && value.indexOf(otherGroup) > -1)); + } + }; + } + + let group = {}; + let originalGroup = options.group; + + if (!originalGroup || typeof originalGroup != 'object') { + originalGroup = {name: originalGroup}; + } + + group.name = originalGroup.name; + group.checkPull = toFn(originalGroup.pull, true); + group.checkPut = toFn(originalGroup.put); + group.revertClone = originalGroup.revertClone; + + options.group = group; + }, + + _hideGhostForTarget = function() { + if (!supportCssPointerEvents && ghostEl) { + css(ghostEl, 'display', 'none'); + } + }, + + _unhideGhostForTarget = function() { + if (!supportCssPointerEvents && ghostEl) { + css(ghostEl, 'display', ''); + } + }; + + +// #1184 fix - Prevent click event on fallback if dragged but item not changed position +if (documentExists) { + document.addEventListener('click', function(evt) { + if (ignoreNextClick) { + evt.preventDefault(); + evt.stopPropagation && evt.stopPropagation(); + evt.stopImmediatePropagation && evt.stopImmediatePropagation(); + ignoreNextClick = false; + return false; + } + }, true); +} + +let nearestEmptyInsertDetectEvent = function(evt) { + if (dragEl) { + evt = evt.touches ? evt.touches[0] : evt; + let nearest = _detectNearestEmptySortable(evt.clientX, evt.clientY); + + if (nearest) { + // Create imitation event + let event = {}; + for (let i in evt) { + if (evt.hasOwnProperty(i)) { + event[i] = evt[i]; + } + } + event.target = event.rootEl = nearest; + event.preventDefault = void 0; + event.stopPropagation = void 0; + nearest[expando]._onDragOver(event); + } + } +}; + + +let _checkOutsideTargetEl = function(evt) { + if (dragEl) { + dragEl.parentNode[expando]._isOutsideThisEl(evt.target); + } +}; + + +/** + * @class Sortable + * @param {HTMLElement} el + * @param {Object} [options] + */ +function Sortable(el, options) { + if (!(el && el.nodeType && el.nodeType === 1)) { + throw `Sortable: \`el\` must be an HTMLElement, not ${ {}.toString.call(el) }`; + } + + this.el = el; // root element + this.options = options = Object.assign({}, options); + + + // Export instance + el[expando] = this; + + let defaults = { + group: null, + sort: true, + disabled: false, + store: null, + handle: null, + draggable: /^[uo]l$/i.test(el.nodeName) ? '>li' : '>*', + swapThreshold: 1, // percentage; 0 <= x <= 1 + invertSwap: false, // invert always + invertedSwapThreshold: null, // will be set to same as swapThreshold if default + removeCloneOnHide: true, + direction: function() { + return _detectDirection(el, this.options); + }, + ghostClass: 'sortable-ghost', + chosenClass: 'sortable-chosen', + dragClass: 'sortable-drag', + ignore: 'a, img', + filter: null, + preventOnFilter: true, + animation: 0, + easing: null, + setData: function (dataTransfer, dragEl) { + dataTransfer.setData('Text', dragEl.textContent); + }, + dropBubble: false, + dragoverBubble: false, + dataIdAttr: 'data-id', + delay: 0, + delayOnTouchOnly: false, + touchStartThreshold: (Number.parseInt ? Number : window).parseInt(window.devicePixelRatio, 10) || 1, + forceFallback: false, + fallbackClass: 'sortable-fallback', + fallbackOnBody: false, + fallbackTolerance: 0, + fallbackOffset: {x: 0, y: 0}, + supportPointer: Sortable.supportPointer !== false && ('PointerEvent' in window), + emptyInsertThreshold: 5 + }; + + PluginManager.initializePlugins(this, el, defaults); + + // Set default options + for (let name in defaults) { + !(name in options) && (options[name] = defaults[name]); + } + + _prepareGroup(options); + + // Bind all private methods + for (let fn in this) { + if (fn.charAt(0) === '_' && typeof this[fn] === 'function') { + this[fn] = this[fn].bind(this); + } + } + + // Setup drag mode + this.nativeDraggable = options.forceFallback ? false : supportDraggable; + + if (this.nativeDraggable) { + // Touch start threshold cannot be greater than the native dragstart threshold + this.options.touchStartThreshold = 1; + } + + // Bind events + if (options.supportPointer) { + on(el, 'pointerdown', this._onTapStart); + } else { + on(el, 'mousedown', this._onTapStart); + on(el, 'touchstart', this._onTapStart); + } + + if (this.nativeDraggable) { + on(el, 'dragover', this); + on(el, 'dragenter', this); + } + + sortables.push(this.el); + + // Restore sorting + options.store && options.store.get && this.sort(options.store.get(this) || []); + + // Add animation state manager + Object.assign(this, AnimationStateManager()); +} + +Sortable.prototype = /** @lends Sortable.prototype */ { + constructor: Sortable, + + _isOutsideThisEl: function(target) { + if (!this.el.contains(target) && target !== this.el) { + lastTarget = null; + } + }, + + _getDirection: function(evt, target) { + return (typeof this.options.direction === 'function') ? this.options.direction.call(this, evt, target, dragEl) : this.options.direction; + }, + + _onTapStart: function (/** Event|TouchEvent */evt) { + if (!evt.cancelable) return; + let _this = this, + el = this.el, + options = this.options, + preventOnFilter = options.preventOnFilter, + type = evt.type, + touch = (evt.touches && evt.touches[0]) || (evt.pointerType && evt.pointerType === 'touch' && evt), + target = (touch || evt).target, + originalTarget = evt.target.shadowRoot && ((evt.path && evt.path[0]) || (evt.composedPath && evt.composedPath()[0])) || target, + filter = options.filter; + + _saveInputCheckedState(el); + + + // Don't trigger start event when an element is been dragged, otherwise the evt.oldindex always wrong when set option.group. + if (dragEl) { + return; + } + + if (/mousedown|pointerdown/.test(type) && evt.button !== 0 || options.disabled) { + return; // only left button and enabled + } + + // cancel dnd if original target is content editable + if (originalTarget.isContentEditable) { + return; + } + + target = closest(target, options.draggable, el, false); + + + if (target && target.animated) { + return; + } + + if (lastDownEl === target) { + // Ignoring duplicate `down` + return; + } + + // Get the index of the dragged element within its parent + oldIndex = index(target); + oldDraggableIndex = index(target, options.draggable); + + // Check filter + if (typeof filter === 'function') { + if (filter.call(this, evt, target, this)) { + _dispatchEvent({ + sortable: _this, + rootEl: originalTarget, + name: 'filter', + targetEl: target, + toEl: el, + fromEl: el + }); + pluginEvent('filter', _this, { evt }); + preventOnFilter && evt.cancelable && evt.preventDefault(); + return; // cancel dnd + } + } + else if (filter) { + filter = filter.split(',').some(function (criteria) { + criteria = closest(originalTarget, criteria.trim(), el, false); + + if (criteria) { + _dispatchEvent({ + sortable: _this, + rootEl: criteria, + name: 'filter', + targetEl: target, + fromEl: el, + toEl: el + }); + pluginEvent('filter', _this, { evt }); + return true; + } + }); + + if (filter) { + preventOnFilter && evt.cancelable && evt.preventDefault(); + return; // cancel dnd + } + } + + if (options.handle && !closest(originalTarget, options.handle, el, false)) { + return; + } + + // Prepare `dragstart` + this._prepareDragStart(evt, touch, target); + }, + + _prepareDragStart: function (/** Event */evt, /** Touch */touch, /** HTMLElement */target) { + let _this = this, + el = _this.el, + options = _this.options, + ownerDocument = el.ownerDocument, + dragStartFn; + + if (target && !dragEl && (target.parentNode === el)) { + let dragRect = getRect(target); + rootEl = el; + dragEl = target; + parentEl = dragEl.parentNode; + nextEl = dragEl.nextSibling; + lastDownEl = target; + activeGroup = options.group; + + Sortable.dragged = dragEl; + + tapEvt = { + target: dragEl, + clientX: (touch || evt).clientX, + clientY: (touch || evt).clientY + }; + + tapDistanceLeft = tapEvt.clientX - dragRect.left; + tapDistanceTop = tapEvt.clientY - dragRect.top; + + this._lastX = (touch || evt).clientX; + this._lastY = (touch || evt).clientY; + + dragEl.style['will-change'] = 'all'; + + dragStartFn = function () { + pluginEvent('delayEnded', _this, { evt }); + if (Sortable.eventCanceled) { + _this._onDrop(); + return; + } + // Delayed drag has been triggered + // we can re-enable the events: touchmove/mousemove + _this._disableDelayedDragEvents(); + + if (!FireFox && _this.nativeDraggable) { + dragEl.draggable = true; + } + + // Bind the events: dragstart/dragend + _this._triggerDragStart(evt, touch); + + // Drag start event + _dispatchEvent({ + sortable: _this, + name: 'choose', + originalEvent: evt + }); + + // Chosen item + toggleClass(dragEl, options.chosenClass, true); + }; + + // Disable "draggable" + options.ignore.split(',').forEach(function (criteria) { + find(dragEl, criteria.trim(), _disableDraggable); + }); + + on(ownerDocument, 'dragover', nearestEmptyInsertDetectEvent); + on(ownerDocument, 'mousemove', nearestEmptyInsertDetectEvent); + on(ownerDocument, 'touchmove', nearestEmptyInsertDetectEvent); + + on(ownerDocument, 'mouseup', _this._onDrop); + on(ownerDocument, 'touchend', _this._onDrop); + on(ownerDocument, 'touchcancel', _this._onDrop); + + // Make dragEl draggable (must be before delay for FireFox) + if (FireFox && this.nativeDraggable) { + this.options.touchStartThreshold = 4; + dragEl.draggable = true; + } + + pluginEvent('delayStart', this, { evt }); + + // Delay is impossible for native DnD in Edge or IE + if (options.delay && (!options.delayOnTouchOnly || touch) && (!this.nativeDraggable || !(Edge || IE11OrLess))) { + if (Sortable.eventCanceled) { + this._onDrop(); + return; + } + // If the user moves the pointer or let go the click or touch + // before the delay has been reached: + // disable the delayed drag + on(ownerDocument, 'mouseup', _this._disableDelayedDrag); + on(ownerDocument, 'touchend', _this._disableDelayedDrag); + on(ownerDocument, 'touchcancel', _this._disableDelayedDrag); + on(ownerDocument, 'mousemove', _this._delayedDragTouchMoveHandler); + on(ownerDocument, 'touchmove', _this._delayedDragTouchMoveHandler); + options.supportPointer && on(ownerDocument, 'pointermove', _this._delayedDragTouchMoveHandler); + + _this._dragStartTimer = setTimeout(dragStartFn, options.delay); + } else { + dragStartFn(); + } + } + }, + + _delayedDragTouchMoveHandler: function (/** TouchEvent|PointerEvent **/e) { + let touch = e.touches ? e.touches[0] : e; + if (Math.max(Math.abs(touch.clientX - this._lastX), Math.abs(touch.clientY - this._lastY)) + >= Math.floor(this.options.touchStartThreshold / (this.nativeDraggable && window.devicePixelRatio || 1)) + ) { + this._disableDelayedDrag(); + } + }, + + _disableDelayedDrag: function () { + dragEl && _disableDraggable(dragEl); + clearTimeout(this._dragStartTimer); + + this._disableDelayedDragEvents(); + }, + + _disableDelayedDragEvents: function () { + let ownerDocument = this.el.ownerDocument; + off(ownerDocument, 'mouseup', this._disableDelayedDrag); + off(ownerDocument, 'touchend', this._disableDelayedDrag); + off(ownerDocument, 'touchcancel', this._disableDelayedDrag); + off(ownerDocument, 'mousemove', this._delayedDragTouchMoveHandler); + off(ownerDocument, 'touchmove', this._delayedDragTouchMoveHandler); + off(ownerDocument, 'pointermove', this._delayedDragTouchMoveHandler); + }, + + _triggerDragStart: function (/** Event */evt, /** Touch */touch) { + touch = touch || (evt.pointerType == 'touch' && evt); + + if (!this.nativeDraggable || touch) { + if (this.options.supportPointer) { + on(document, 'pointermove', this._onTouchMove); + } else if (touch) { + on(document, 'touchmove', this._onTouchMove); + } else { + on(document, 'mousemove', this._onTouchMove); + } + } else { + on(dragEl, 'dragend', this); + on(rootEl, 'dragstart', this._onDragStart); + } + + try { + if (document.selection) { + // Timeout neccessary for IE9 + _nextTick(function () { + document.selection.empty(); + }); + } else { + window.getSelection().removeAllRanges(); + } + } catch (err) { + } + }, + + _dragStarted: function (fallback, evt) { + let _this = this; + awaitingDragStarted = false; + if (rootEl && dragEl) { + pluginEvent('dragStarted', this, { evt }); + + if (this.nativeDraggable) { + on(document, 'dragover', _checkOutsideTargetEl); + } + let options = this.options; + + // Apply effect + !fallback && toggleClass(dragEl, options.dragClass, false); + toggleClass(dragEl, options.ghostClass, true); + + Sortable.active = this; + + fallback && this._appendGhost(); + + // Drag start event + _dispatchEvent({ + sortable: this, + name: 'start', + originalEvent: evt + }); + } else { + this._nulling(); + } + }, + + _emulateDragOver: function () { + if (touchEvt) { + this._lastX = touchEvt.clientX; + this._lastY = touchEvt.clientY; + + _hideGhostForTarget(); + + let target = document.elementFromPoint(touchEvt.clientX, touchEvt.clientY); + let parent = target; + + while (target && target.shadowRoot) { + target = target.shadowRoot.elementFromPoint(touchEvt.clientX, touchEvt.clientY); + if (target === parent) break; + parent = target; + } + + dragEl.parentNode[expando]._isOutsideThisEl(target); + + if (parent) { + do { + if (parent[expando]) { + let inserted; + + inserted = parent[expando]._onDragOver({ + clientX: touchEvt.clientX, + clientY: touchEvt.clientY, + target: target, + rootEl: parent + }); + + if (inserted && !this.options.dragoverBubble) { + break; + } + } + + target = parent; // store last element + } + /* jshint boss:true */ + while (parent = parent.parentNode); + } + + _unhideGhostForTarget(); + } + }, + + + _onTouchMove: function (/**TouchEvent*/evt) { + if (tapEvt) { + let options = this.options, + fallbackTolerance = options.fallbackTolerance, + fallbackOffset = options.fallbackOffset, + touch = evt.touches ? evt.touches[0] : evt, + ghostMatrix = ghostEl && matrix(ghostEl, true), + scaleX = ghostEl && ghostMatrix && ghostMatrix.a, + scaleY = ghostEl && ghostMatrix && ghostMatrix.d, + relativeScrollOffset = PositionGhostAbsolutely && ghostRelativeParent && getRelativeScrollOffset(ghostRelativeParent), + dx = ((touch.clientX - tapEvt.clientX) + + fallbackOffset.x) / (scaleX || 1) + + (relativeScrollOffset ? (relativeScrollOffset[0] - ghostRelativeParentInitialScroll[0]) : 0) / (scaleX || 1), + dy = ((touch.clientY - tapEvt.clientY) + + fallbackOffset.y) / (scaleY || 1) + + (relativeScrollOffset ? (relativeScrollOffset[1] - ghostRelativeParentInitialScroll[1]) : 0) / (scaleY || 1); + + // only set the status to dragging, when we are actually dragging + if (!Sortable.active && !awaitingDragStarted) { + if (fallbackTolerance && + Math.max(Math.abs(touch.clientX - this._lastX), Math.abs(touch.clientY - this._lastY)) < fallbackTolerance + ) { + return; + } + this._onDragStart(evt, true); + } + + if (ghostEl) { + if (ghostMatrix) { + ghostMatrix.e += dx - (lastDx || 0); + ghostMatrix.f += dy - (lastDy || 0); + } else { + ghostMatrix = { + a: 1, + b: 0, + c: 0, + d: 1, + e: dx, + f: dy + }; + } + + let cssMatrix = `matrix(${ghostMatrix.a},${ghostMatrix.b},${ghostMatrix.c},${ghostMatrix.d},${ghostMatrix.e},${ghostMatrix.f})`; + + css(ghostEl, 'webkitTransform', cssMatrix); + css(ghostEl, 'mozTransform', cssMatrix); + css(ghostEl, 'msTransform', cssMatrix); + css(ghostEl, 'transform', cssMatrix); + + lastDx = dx; + lastDy = dy; + + touchEvt = touch; + } + + evt.cancelable && evt.preventDefault(); + } + }, + + _appendGhost: function () { + // Bug if using scale(): https://stackoverflow.com/questions/2637058 + // Not being adjusted for + if (!ghostEl) { + let container = this.options.fallbackOnBody ? document.body : rootEl, + rect = getRect(dragEl, true, PositionGhostAbsolutely, true, container), + options = this.options; + + // Position absolutely + if (PositionGhostAbsolutely) { + // Get relatively positioned parent + ghostRelativeParent = container; + + while ( + css(ghostRelativeParent, 'position') === 'static' && + css(ghostRelativeParent, 'transform') === 'none' && + ghostRelativeParent !== document + ) { + ghostRelativeParent = ghostRelativeParent.parentNode; + } + + if (ghostRelativeParent !== document.body && ghostRelativeParent !== document.documentElement) { + if (ghostRelativeParent === document) ghostRelativeParent = getWindowScrollingElement(); + + rect.top += ghostRelativeParent.scrollTop; + rect.left += ghostRelativeParent.scrollLeft; + } else { + ghostRelativeParent = getWindowScrollingElement(); + } + ghostRelativeParentInitialScroll = getRelativeScrollOffset(ghostRelativeParent); + } + + + ghostEl = dragEl.cloneNode(true); + + toggleClass(ghostEl, options.ghostClass, false); + toggleClass(ghostEl, options.fallbackClass, true); + toggleClass(ghostEl, options.dragClass, true); + + css(ghostEl, 'transition', ''); + css(ghostEl, 'transform', ''); + + css(ghostEl, 'box-sizing', 'border-box'); + css(ghostEl, 'margin', 0); + css(ghostEl, 'top', rect.top); + css(ghostEl, 'left', rect.left); + css(ghostEl, 'width', rect.width); + css(ghostEl, 'height', rect.height); + css(ghostEl, 'opacity', '0.8'); + css(ghostEl, 'position', (PositionGhostAbsolutely ? 'absolute' : 'fixed')); + css(ghostEl, 'zIndex', '100000'); + css(ghostEl, 'pointerEvents', 'none'); + + + Sortable.ghost = ghostEl; + + container.appendChild(ghostEl); + + // Set transform-origin + css(ghostEl, 'transform-origin', (tapDistanceLeft / parseInt(ghostEl.style.width) * 100) + '% ' + (tapDistanceTop / parseInt(ghostEl.style.height) * 100) + '%'); + } + }, + + _onDragStart: function (/**Event*/evt, /**boolean*/fallback) { + let _this = this; + let dataTransfer = evt.dataTransfer; + let options = _this.options; + + pluginEvent('dragStart', this, { evt }); + if (Sortable.eventCanceled) { + this._onDrop(); + return; + } + + pluginEvent('setupClone', this); + if (!Sortable.eventCanceled) { + cloneEl = clone(dragEl); + + cloneEl.draggable = false; + cloneEl.style['will-change'] = ''; + + this._hideClone(); + + toggleClass(cloneEl, this.options.chosenClass, false); + Sortable.clone = cloneEl; + } + + + // #1143: IFrame support workaround + _this.cloneId = _nextTick(function() { + pluginEvent('clone', _this); + if (Sortable.eventCanceled) return; + + if (!_this.options.removeCloneOnHide) { + rootEl.insertBefore(cloneEl, dragEl); + } + _this._hideClone(); + + _dispatchEvent({ + sortable: _this, + name: 'clone' + }); + }); + + + !fallback && toggleClass(dragEl, options.dragClass, true); + + // Set proper drop events + if (fallback) { + ignoreNextClick = true; + _this._loopId = setInterval(_this._emulateDragOver, 50); + } else { + // Undo what was set in _prepareDragStart before drag started + off(document, 'mouseup', _this._onDrop); + off(document, 'touchend', _this._onDrop); + off(document, 'touchcancel', _this._onDrop); + + if (dataTransfer) { + dataTransfer.effectAllowed = 'move'; + options.setData && options.setData.call(_this, dataTransfer, dragEl); + } + + on(document, 'drop', _this); + + // #1276 fix: + css(dragEl, 'transform', 'translateZ(0)'); + } + + awaitingDragStarted = true; + + _this._dragStartId = _nextTick(_this._dragStarted.bind(_this, fallback, evt)); + on(document, 'selectstart', _this); + + moved = true; + + if (Safari) { + css(document.body, 'user-select', 'none'); + } + }, + + + // Returns true - if no further action is needed (either inserted or another condition) + _onDragOver: function (/**Event*/evt) { + let el = this.el, + target = evt.target, + dragRect, + targetRect, + revert, + options = this.options, + group = options.group, + activeSortable = Sortable.active, + isOwner = (activeGroup === group), + canSort = options.sort, + fromSortable = (putSortable || activeSortable), + vertical, + _this = this, + completedFired = false; + + if (_silent) return; + + function dragOverEvent(name, extra) { + pluginEvent(name, _this, { + evt, + isOwner, + axis: vertical ? 'vertical' : 'horizontal', + revert, + dragRect, + targetRect, + canSort, + fromSortable, + target, + completed, + onMove(target, after) { + return onMove(rootEl, el, dragEl, dragRect, target, getRect(target), evt, after); + }, + changed, + ...extra + }); + } + + // Capture animation state + function capture() { + dragOverEvent('dragOverAnimationCapture'); + + _this.captureAnimationState(); + if (_this !== fromSortable) { + fromSortable.captureAnimationState(); + } + } + + // Return invocation when dragEl is inserted (or completed) + function completed(insertion) { + dragOverEvent('dragOverCompleted', { insertion }); + + if (insertion) { + // Clones must be hidden before folding animation to capture dragRectAbsolute properly + if (isOwner) { + activeSortable._hideClone(); + } else { + activeSortable._showClone(_this); + } + + if (_this !== fromSortable) { + // Set ghost class to new sortable's ghost class + toggleClass(dragEl, putSortable ? putSortable.options.ghostClass : activeSortable.options.ghostClass, false); + toggleClass(dragEl, options.ghostClass, true); + } + + if (putSortable !== _this && _this !== Sortable.active) { + putSortable = _this; + } else if (_this === Sortable.active && putSortable) { + putSortable = null; + } + + // Animation + if (fromSortable === _this) { + _this._ignoreWhileAnimating = target; + } + _this.animateAll(function() { + dragOverEvent('dragOverAnimationComplete'); + _this._ignoreWhileAnimating = null; + }); + if (_this !== fromSortable) { + fromSortable.animateAll(); + fromSortable._ignoreWhileAnimating = null; + } + } + + + // Null lastTarget if it is not inside a previously swapped element + if ((target === dragEl && !dragEl.animated) || (target === el && !target.animated)) { + lastTarget = null; + } + + // no bubbling and not fallback + if (!options.dragoverBubble && !evt.rootEl && target !== document) { + dragEl.parentNode[expando]._isOutsideThisEl(evt.target); + + // Do not detect for empty insert if already inserted + !insertion && nearestEmptyInsertDetectEvent(evt); + } + + !options.dragoverBubble && evt.stopPropagation && evt.stopPropagation(); + + return (completedFired = true); + } + + // Call when dragEl has been inserted + function changed() { + newIndex = index(dragEl); + newDraggableIndex = index(dragEl, options.draggable); + _dispatchEvent({ + sortable: _this, + name: 'change', + toEl: el, + newIndex, + newDraggableIndex, + originalEvent: evt + }); + } + + + if (evt.preventDefault !== void 0) { + evt.cancelable && evt.preventDefault(); + } + + + target = closest(target, options.draggable, el, true); + + dragOverEvent('dragOver'); + if (Sortable.eventCanceled) return completedFired; + + if ( + dragEl.contains(evt.target) || + target.animated && target.animatingX && target.animatingY || + _this._ignoreWhileAnimating === target + ) { + return completed(false); + } + + ignoreNextClick = false; + + if (activeSortable && !options.disabled && + (isOwner + ? canSort || (revert = !rootEl.contains(dragEl)) // Reverting item into the original list + : ( + putSortable === this || + ( + (this.lastPutMode = activeGroup.checkPull(this, activeSortable, dragEl, evt)) && + group.checkPut(this, activeSortable, dragEl, evt) + ) + ) + ) + ) { + vertical = this._getDirection(evt, target) === 'vertical'; + + dragRect = getRect(dragEl); + + dragOverEvent('dragOverValid'); + if (Sortable.eventCanceled) return completedFired; + + if (revert) { + parentEl = rootEl; // actualization + capture(); + + this._hideClone(); + + dragOverEvent('revert'); + + if (!Sortable.eventCanceled) { + if (nextEl) { + rootEl.insertBefore(dragEl, nextEl); + } else { + rootEl.appendChild(dragEl); + } + } + + return completed(true); + } + + let elLastChild = lastChild(el, options.draggable); + + if (!elLastChild || _ghostIsLast(evt, vertical, this) && !elLastChild.animated) { + // If already at end of list: Do not insert + if (elLastChild === dragEl) { + return completed(false); + } + + // assign target only if condition is true + if (elLastChild && el === evt.target) { + target = elLastChild; + } + + if (target) { + targetRect = getRect(target); + } + + if (onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, !!target) !== false) { + capture(); + el.appendChild(dragEl); + parentEl = el; // actualization + + changed(); + return completed(true); + } + } + else if (target.parentNode === el) { + targetRect = getRect(target); + let direction = 0, + targetBeforeFirstSwap, + differentLevel = dragEl.parentNode !== el, + differentRowCol = !_dragElInRowColumn(dragEl.animated && dragEl.toRect || dragRect, target.animated && target.toRect || targetRect, vertical), + side1 = vertical ? 'top' : 'left', + scrolledPastTop = isScrolledPast(target, 'top', 'top') || isScrolledPast(dragEl, 'top', 'top'), + scrollBefore = scrolledPastTop ? scrolledPastTop.scrollTop : void 0; + + + if (lastTarget !== target) { + targetBeforeFirstSwap = targetRect[side1]; + pastFirstInvertThresh = false; + isCircumstantialInvert = (!differentRowCol && options.invertSwap) || differentLevel; + } + + direction = _getSwapDirection( + evt, target, targetRect, vertical, + differentRowCol ? 1 : options.swapThreshold, + options.invertedSwapThreshold == null ? options.swapThreshold : options.invertedSwapThreshold, + isCircumstantialInvert, + lastTarget === target + ); + + let sibling; + + if (direction !== 0) { + // Check if target is beside dragEl in respective direction (ignoring hidden elements) + let dragIndex = index(dragEl); + + do { + dragIndex -= direction; + sibling = parentEl.children[dragIndex]; + } while (sibling && (css(sibling, 'display') === 'none' || sibling === ghostEl)); + } + // If dragEl is already beside target: Do not insert + if ( + direction === 0 || + sibling === target + ) { + return completed(false); + } + + lastTarget = target; + + lastDirection = direction; + + let nextSibling = target.nextElementSibling, + after = false; + + after = direction === 1; + + let moveVector = onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, after); + + if (moveVector !== false) { + if (moveVector === 1 || moveVector === -1) { + after = (moveVector === 1); + } + + _silent = true; + setTimeout(_unsilent, 30); + + capture(); + + if (after && !nextSibling) { + el.appendChild(dragEl); + } else { + target.parentNode.insertBefore(dragEl, after ? nextSibling : target); + } + + // Undo chrome's scroll adjustment (has no effect on other browsers) + if (scrolledPastTop) { + scrollBy(scrolledPastTop, 0, scrollBefore - scrolledPastTop.scrollTop); + } + + parentEl = dragEl.parentNode; // actualization + + // must be done before animation + if (targetBeforeFirstSwap !== undefined && !isCircumstantialInvert) { + targetMoveDistance = Math.abs(targetBeforeFirstSwap - getRect(target)[side1]); + } + changed(); + + return completed(true); + } + } + + if (el.contains(dragEl)) { + return completed(false); + } + } + + return false; + }, + + _ignoreWhileAnimating: null, + + _offMoveEvents: function() { + off(document, 'mousemove', this._onTouchMove); + off(document, 'touchmove', this._onTouchMove); + off(document, 'pointermove', this._onTouchMove); + off(document, 'dragover', nearestEmptyInsertDetectEvent); + off(document, 'mousemove', nearestEmptyInsertDetectEvent); + off(document, 'touchmove', nearestEmptyInsertDetectEvent); + }, + + _offUpEvents: function () { + let ownerDocument = this.el.ownerDocument; + + off(ownerDocument, 'mouseup', this._onDrop); + off(ownerDocument, 'touchend', this._onDrop); + off(ownerDocument, 'pointerup', this._onDrop); + off(ownerDocument, 'touchcancel', this._onDrop); + off(document, 'selectstart', this); + }, + + _onDrop: function (/**Event*/evt) { + let el = this.el, + options = this.options; + + // Get the index of the dragged element within its parent + newIndex = index(dragEl); + newDraggableIndex = index(dragEl, options.draggable); + + pluginEvent('drop', this, { + evt + }); + + parentEl = dragEl && dragEl.parentNode; + + // Get again after plugin event + newIndex = index(dragEl); + newDraggableIndex = index(dragEl, options.draggable); + + if (Sortable.eventCanceled) { + this._nulling(); + return; + } + + awaitingDragStarted = false; + isCircumstantialInvert = false; + pastFirstInvertThresh = false; + + clearInterval(this._loopId); + + clearTimeout(this._dragStartTimer); + + _cancelNextTick(this.cloneId); + _cancelNextTick(this._dragStartId); + + // Unbind events + if (this.nativeDraggable) { + off(document, 'drop', this); + off(el, 'dragstart', this._onDragStart); + } + this._offMoveEvents(); + this._offUpEvents(); + + + if (Safari) { + css(document.body, 'user-select', ''); + } + + css(dragEl, 'transform', ''); + + if (evt) { + if (moved) { + evt.cancelable && evt.preventDefault(); + !options.dropBubble && evt.stopPropagation(); + } + + ghostEl && ghostEl.parentNode && ghostEl.parentNode.removeChild(ghostEl); + + if (rootEl === parentEl || (putSortable && putSortable.lastPutMode !== 'clone')) { + // Remove clone(s) + cloneEl && cloneEl.parentNode && cloneEl.parentNode.removeChild(cloneEl); + } + + if (dragEl) { + if (this.nativeDraggable) { + off(dragEl, 'dragend', this); + } + + _disableDraggable(dragEl); + dragEl.style['will-change'] = ''; + + // Remove classes + // ghostClass is added in dragStarted + if (moved && !awaitingDragStarted) { + toggleClass(dragEl, putSortable ? putSortable.options.ghostClass : this.options.ghostClass, false); + } + toggleClass(dragEl, this.options.chosenClass, false); + + // Drag stop event + _dispatchEvent({ + sortable: this, + name: 'unchoose', + toEl: parentEl, + newIndex: null, + newDraggableIndex: null, + originalEvent: evt + }); + + + if (rootEl !== parentEl) { + + if (newIndex >= 0) { + // Add event + _dispatchEvent({ + rootEl: parentEl, + name: 'add', + toEl: parentEl, + fromEl: rootEl, + originalEvent: evt + }); + + // Remove event + _dispatchEvent({ + sortable: this, + name: 'remove', + toEl: parentEl, + originalEvent: evt + }); + + // drag from one list and drop into another + _dispatchEvent({ + rootEl: parentEl, + name: 'sort', + toEl: parentEl, + fromEl: rootEl, + originalEvent: evt + }); + + _dispatchEvent({ + sortable: this, + name: 'sort', + toEl: parentEl, + originalEvent: evt + }); + } + + putSortable && putSortable.save(); + } else { + if (newIndex !== oldIndex) { + if (newIndex >= 0) { + // drag & drop within the same list + _dispatchEvent({ + sortable: this, + name: 'update', + toEl: parentEl, + originalEvent: evt + }); + + _dispatchEvent({ + sortable: this, + name: 'sort', + toEl: parentEl, + originalEvent: evt + }); + } + } + } + + if (Sortable.active) { + /* jshint eqnull:true */ + if (newIndex == null || newIndex === -1) { + newIndex = oldIndex; + newDraggableIndex = oldDraggableIndex; + } + + _dispatchEvent({ + sortable: this, + name: 'end', + toEl: parentEl, + originalEvent: evt + }); + + // Save sorting + this.save(); + } + } + + } + this._nulling(); + }, + + _nulling: function() { + pluginEvent('nulling', this); + + rootEl = + dragEl = + parentEl = + ghostEl = + nextEl = + cloneEl = + lastDownEl = + cloneHidden = + + tapEvt = + touchEvt = + + moved = + newIndex = + newDraggableIndex = + oldIndex = + oldDraggableIndex = + + lastTarget = + lastDirection = + + putSortable = + activeGroup = + Sortable.dragged = + Sortable.ghost = + Sortable.clone = + Sortable.active = null; + + savedInputChecked.forEach(function (el) { + el.checked = true; + }); + + savedInputChecked.length = + lastDx = + lastDy = 0; + }, + + handleEvent: function (/**Event*/evt) { + switch (evt.type) { + case 'drop': + case 'dragend': + this._onDrop(evt); + break; + + case 'dragenter': + case 'dragover': + if (dragEl) { + this._onDragOver(evt); + _globalDragOver(evt); + } + break; + + case 'selectstart': + evt.preventDefault(); + break; + } + }, + + + /** + * Serializes the item into an array of string. + * @returns {String[]} + */ + toArray: function () { + let order = [], + el, + children = this.el.children, + i = 0, + n = children.length, + options = this.options; + + for (; i < n; i++) { + el = children[i]; + if (closest(el, options.draggable, this.el, false)) { + order.push(el.getAttribute(options.dataIdAttr) || _generateId(el)); + } + } + + return order; + }, + + + /** + * Sorts the elements according to the array. + * @param {String[]} order order of the items + */ + sort: function (order) { + let items = {}, rootEl = this.el; + + this.toArray().forEach(function (id, i) { + let el = rootEl.children[i]; + + if (closest(el, this.options.draggable, rootEl, false)) { + items[id] = el; + } + }, this); + + order.forEach(function (id) { + if (items[id]) { + rootEl.removeChild(items[id]); + rootEl.appendChild(items[id]); + } + }); + }, + + + /** + * Save the current sorting + */ + save: function () { + let store = this.options.store; + store && store.set && store.set(this); + }, + + + /** + * For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree. + * @param {HTMLElement} el + * @param {String} [selector] default: `options.draggable` + * @returns {HTMLElement|null} + */ + closest: function (el, selector) { + return closest(el, selector || this.options.draggable, this.el, false); + }, + + + /** + * Set/get option + * @param {string} name + * @param {*} [value] + * @returns {*} + */ + option: function (name, value) { + let options = this.options; + + if (value === void 0) { + return options[name]; + } else { + let modifiedValue = PluginManager.modifyOption(this, name, value); + if (typeof modifiedValue !== 'undefined') { + options[name] = modifiedValue; + } else { + options[name] = value; + } + + if (name === 'group') { + _prepareGroup(options); + } + } + }, + + + /** + * Destroy + */ + destroy: function () { + pluginEvent('destroy', this); + let el = this.el; + + el[expando] = null; + + off(el, 'mousedown', this._onTapStart); + off(el, 'touchstart', this._onTapStart); + off(el, 'pointerdown', this._onTapStart); + + if (this.nativeDraggable) { + off(el, 'dragover', this); + off(el, 'dragenter', this); + } + // Remove draggable attributes + Array.prototype.forEach.call(el.querySelectorAll('[draggable]'), function (el) { + el.removeAttribute('draggable'); + }); + + this._onDrop(); + + this._disableDelayedDragEvents(); + + sortables.splice(sortables.indexOf(this.el), 1); + + this.el = el = null; + }, + + _hideClone: function() { + if (!cloneHidden) { + pluginEvent('hideClone', this); + if (Sortable.eventCanceled) return; + + + css(cloneEl, 'display', 'none'); + if (this.options.removeCloneOnHide && cloneEl.parentNode) { + cloneEl.parentNode.removeChild(cloneEl); + } + cloneHidden = true; + } + }, + + _showClone: function(putSortable) { + if (putSortable.lastPutMode !== 'clone') { + this._hideClone(); + return; + } + + + if (cloneHidden) { + pluginEvent('showClone', this); + if (Sortable.eventCanceled) return; + + // show clone at dragEl or original position + if (rootEl.contains(dragEl) && !this.options.group.revertClone) { + rootEl.insertBefore(cloneEl, dragEl); + } else if (nextEl) { + rootEl.insertBefore(cloneEl, nextEl); + } else { + rootEl.appendChild(cloneEl); + } + + if (this.options.group.revertClone) { + this.animate(dragEl, cloneEl); + } + + css(cloneEl, 'display', ''); + cloneHidden = false; + } + } +}; + +function _globalDragOver(/**Event*/evt) { + if (evt.dataTransfer) { + evt.dataTransfer.dropEffect = 'move'; + } + evt.cancelable && evt.preventDefault(); +} + +function onMove(fromEl, toEl, dragEl, dragRect, targetEl, targetRect, originalEvent, willInsertAfter) { + let evt, + sortable = fromEl[expando], + onMoveFn = sortable.options.onMove, + retVal; + // Support for new CustomEvent feature + if (window.CustomEvent && !IE11OrLess && !Edge) { + evt = new CustomEvent('move', { + bubbles: true, + cancelable: true + }); + } else { + evt = document.createEvent('Event'); + evt.initEvent('move', true, true); + } + + evt.to = toEl; + evt.from = fromEl; + evt.dragged = dragEl; + evt.draggedRect = dragRect; + evt.related = targetEl || toEl; + evt.relatedRect = targetRect || getRect(toEl); + evt.willInsertAfter = willInsertAfter; + + evt.originalEvent = originalEvent; + + fromEl.dispatchEvent(evt); + + if (onMoveFn) { + retVal = onMoveFn.call(sortable, evt, originalEvent); + } + + return retVal; +} + +function _disableDraggable(el) { + el.draggable = false; +} + +function _unsilent() { + _silent = false; +} + + +function _ghostIsLast(evt, vertical, sortable) { + let rect = getRect(lastChild(sortable.el, sortable.options.draggable)); + const spacer = 10; + + return vertical ? + (evt.clientX > rect.right + spacer || evt.clientX <= rect.right && evt.clientY > rect.bottom && evt.clientX >= rect.left) : + (evt.clientX > rect.right && evt.clientY > rect.top || evt.clientX <= rect.right && evt.clientY > rect.bottom + spacer); +} + +function _getSwapDirection(evt, target, targetRect, vertical, swapThreshold, invertedSwapThreshold, invertSwap, isLastTarget) { + let mouseOnAxis = vertical ? evt.clientY : evt.clientX, + targetLength = vertical ? targetRect.height : targetRect.width, + targetS1 = vertical ? targetRect.top : targetRect.left, + targetS2 = vertical ? targetRect.bottom : targetRect.right, + invert = false; + + + if (!invertSwap) { + // Never invert or create dragEl shadow when target movemenet causes mouse to move past the end of regular swapThreshold + if (isLastTarget && targetMoveDistance < targetLength * swapThreshold) { // multiplied only by swapThreshold because mouse will already be inside target by (1 - threshold) * targetLength / 2 + // check if past first invert threshold on side opposite of lastDirection + if (!pastFirstInvertThresh && + (lastDirection === 1 ? + ( + mouseOnAxis > targetS1 + targetLength * invertedSwapThreshold / 2 + ) : + ( + mouseOnAxis < targetS2 - targetLength * invertedSwapThreshold / 2 + ) + ) + ) + { + // past first invert threshold, do not restrict inverted threshold to dragEl shadow + pastFirstInvertThresh = true; + } + + if (!pastFirstInvertThresh) { + // dragEl shadow (target move distance shadow) + if ( + lastDirection === 1 ? + ( + mouseOnAxis < targetS1 + targetMoveDistance // over dragEl shadow + ) : + ( + mouseOnAxis > targetS2 - targetMoveDistance + ) + ) + { + return -lastDirection; + } + } else { + invert = true; + } + } else { + // Regular + if ( + mouseOnAxis > targetS1 + (targetLength * (1 - swapThreshold) / 2) && + mouseOnAxis < targetS2 - (targetLength * (1 - swapThreshold) / 2) + ) { + return _getInsertDirection(target); + } + } + } + + invert = invert || invertSwap; + + if (invert) { + // Invert of regular + if ( + mouseOnAxis < targetS1 + (targetLength * invertedSwapThreshold / 2) || + mouseOnAxis > targetS2 - (targetLength * invertedSwapThreshold / 2) + ) + { + return ((mouseOnAxis > targetS1 + targetLength / 2) ? 1 : -1); + } + } + + return 0; +} + +/** + * Gets the direction dragEl must be swapped relative to target in order to make it + * seem that dragEl has been "inserted" into that element's position + * @param {HTMLElement} target The target whose position dragEl is being inserted at + * @return {Number} Direction dragEl must be swapped + */ +function _getInsertDirection(target) { + if (index(dragEl) < index(target)) { + return 1; + } else { + return -1; + } +} + + +/** + * Generate id + * @param {HTMLElement} el + * @returns {String} + * @private + */ +function _generateId(el) { + let str = el.tagName + el.className + el.src + el.href + el.textContent, + i = str.length, + sum = 0; + + while (i--) { + sum += str.charCodeAt(i); + } + + return sum.toString(36); +} + +function _saveInputCheckedState(root) { + savedInputChecked.length = 0; + + let inputs = root.getElementsByTagName('input'); + let idx = inputs.length; + + while (idx--) { + let el = inputs[idx]; + el.checked && savedInputChecked.push(el); + } +} + +function _nextTick(fn) { + return setTimeout(fn, 0); +} + +function _cancelNextTick(id) { + return clearTimeout(id); +} + +// Fixed #973: +if (documentExists) { + on(document, 'touchmove', function(evt) { + if ((Sortable.active || awaitingDragStarted) && evt.cancelable) { + evt.preventDefault(); + } + }); +} + + +// Export utils +Sortable.utils = { + on: on, + off: off, + css: css, + find: find, + is: function (el, selector) { + return !!closest(el, selector, el, false); + }, + extend: extend, + throttle: throttle, + closest: closest, + toggleClass: toggleClass, + clone: clone, + index: index, + nextTick: _nextTick, + cancelNextTick: _cancelNextTick, + detectDirection: _detectDirection, + getChild: getChild +}; + + +/** + * Get the Sortable instance of an element + * @param {HTMLElement} element The element + * @return {Sortable|undefined} The instance of Sortable + */ +Sortable.get = function(element) { + return element[expando]; +}; + +/** + * Mount a plugin to Sortable + * @param {...SortablePlugin|SortablePlugin[]} plugins Plugins being mounted + */ +Sortable.mount = function(...plugins) { + if (plugins[0].constructor === Array) plugins = plugins[0]; + + plugins.forEach((plugin) => { + if (!plugin.prototype || !plugin.prototype.constructor) { + throw `Sortable: Mounted plugin must be a constructor function, not ${ {}.toString.call(plugin) }`; + } + if (plugin.utils) Sortable.utils = { ...Sortable.utils, ...plugin.utils }; + + PluginManager.mount(plugin); + }); +}; + + + +/** + * Create sortable instance + * @param {HTMLElement} el + * @param {Object} [options] + */ +Sortable.create = function (el, options) { + return new Sortable(el, options); +}; + + +// Export +Sortable.version = version; + + +export default Sortable; diff --git a/public/assets/libs/Sortable/src/utils.js b/public/assets/libs/Sortable/src/utils.js new file mode 100644 index 0000000..5dcc81e --- /dev/null +++ b/public/assets/libs/Sortable/src/utils.js @@ -0,0 +1,556 @@ +import { IE11OrLess } from './BrowserInfo.js'; +import Sortable from './Sortable.js'; + +const captureMode = { + capture: false, + passive: false +}; + +function on(el, event, fn) { + el.addEventListener(event, fn, !IE11OrLess && captureMode); +} + + +function off(el, event, fn) { + el.removeEventListener(event, fn, !IE11OrLess && captureMode); +} + +function matches(/**HTMLElement*/el, /**String*/selector) { + if (!selector) return; + + selector[0] === '>' && (selector = selector.substring(1)); + + if (el) { + try { + if (el.matches) { + return el.matches(selector); + } else if (el.msMatchesSelector) { + return el.msMatchesSelector(selector); + } else if (el.webkitMatchesSelector) { + return el.webkitMatchesSelector(selector); + } + } catch(_) { + return false; + } + } + + return false; +} + +function getParentOrHost(el) { + return (el.host && el !== document && el.host.nodeType) + ? el.host + : el.parentNode; +} + +function closest(/**HTMLElement*/el, /**String*/selector, /**HTMLElement*/ctx, includeCTX) { + if (el) { + ctx = ctx || document; + + do { + if ( + selector != null && + ( + selector[0] === '>' ? + el.parentNode === ctx && matches(el, selector) : + matches(el, selector) + ) || + includeCTX && el === ctx + ) { + return el; + } + + if (el === ctx) break; + /* jshint boss:true */ + } while (el = getParentOrHost(el)); + } + + return null; +} + +const R_SPACE = /\s+/g; + +function toggleClass(el, name, state) { + if (el && name) { + if (el.classList) { + el.classList[state ? 'add' : 'remove'](name); + } + else { + let className = (' ' + el.className + ' ').replace(R_SPACE, ' ').replace(' ' + name + ' ', ' '); + el.className = (className + (state ? ' ' + name : '')).replace(R_SPACE, ' '); + } + } +} + + +function css(el, prop, val) { + let style = el && el.style; + + if (style) { + if (val === void 0) { + if (document.defaultView && document.defaultView.getComputedStyle) { + val = document.defaultView.getComputedStyle(el, ''); + } + else if (el.currentStyle) { + val = el.currentStyle; + } + + return prop === void 0 ? val : val[prop]; + } + else { + if (!(prop in style) && prop.indexOf('webkit') === -1) { + prop = '-webkit-' + prop; + } + + style[prop] = val + (typeof val === 'string' ? '' : 'px'); + } + } +} + +function matrix(el, selfOnly) { + let appliedTransforms = ''; + if (typeof(el) === 'string') { + appliedTransforms = el; + } else { + do { + let transform = css(el, 'transform'); + + if (transform && transform !== 'none') { + appliedTransforms = transform + ' ' + appliedTransforms; + } + /* jshint boss:true */ + } while (!selfOnly && (el = el.parentNode)); + } + + const matrixFn = window.DOMMatrix || window.WebKitCSSMatrix || window.CSSMatrix || window.MSCSSMatrix; + /*jshint -W056 */ + return matrixFn && (new matrixFn(appliedTransforms)); +} + + +function find(ctx, tagName, iterator) { + if (ctx) { + let list = ctx.getElementsByTagName(tagName), i = 0, n = list.length; + + if (iterator) { + for (; i < n; i++) { + iterator(list[i], i); + } + } + + return list; + } + + return []; +} + + + +function getWindowScrollingElement() { + let scrollingElement = document.scrollingElement; + + if (scrollingElement) { + return scrollingElement + } else { + return document.documentElement + } +} + + +/** + * Returns the "bounding client rect" of given element + * @param {HTMLElement} el The element whose boundingClientRect is wanted + * @param {[Boolean]} relativeToContainingBlock Whether the rect should be relative to the containing block of (including) the container + * @param {[Boolean]} relativeToNonStaticParent Whether the rect should be relative to the relative parent of (including) the contaienr + * @param {[Boolean]} undoScale Whether the container's scale() should be undone + * @param {[HTMLElement]} container The parent the element will be placed in + * @return {Object} The boundingClientRect of el, with specified adjustments + */ +function getRect(el, relativeToContainingBlock, relativeToNonStaticParent, undoScale, container) { + if (!el.getBoundingClientRect && el !== window) return; + + let elRect, + top, + left, + bottom, + right, + height, + width; + + if (el !== window && el !== getWindowScrollingElement()) { + elRect = el.getBoundingClientRect(); + top = elRect.top; + left = elRect.left; + bottom = elRect.bottom; + right = elRect.right; + height = elRect.height; + width = elRect.width; + } else { + top = 0; + left = 0; + bottom = window.innerHeight; + right = window.innerWidth; + height = window.innerHeight; + width = window.innerWidth; + } + + if ((relativeToContainingBlock || relativeToNonStaticParent) && el !== window) { + // Adjust for translate() + container = container || el.parentNode; + + // solves #1123 (see: https://stackoverflow.com/a/37953806/6088312) + // Not needed on <= IE11 + if (!IE11OrLess) { + do { + if ( + container && + container.getBoundingClientRect && + ( + css(container, 'transform') !== 'none' || + relativeToNonStaticParent && + css(container, 'position') !== 'static' + ) + ) { + let containerRect = container.getBoundingClientRect(); + + // Set relative to edges of padding box of container + top -= containerRect.top + parseInt(css(container, 'border-top-width')); + left -= containerRect.left + parseInt(css(container, 'border-left-width')); + bottom = top + elRect.height; + right = left + elRect.width; + + break; + } + /* jshint boss:true */ + } while (container = container.parentNode); + } + } + + if (undoScale && el !== window) { + // Adjust for scale() + let elMatrix = matrix(container || el), + scaleX = elMatrix && elMatrix.a, + scaleY = elMatrix && elMatrix.d; + + if (elMatrix) { + top /= scaleY; + left /= scaleX; + + width /= scaleX; + height /= scaleY; + + bottom = top + height; + right = left + width; + } + } + + return { + top: top, + left: left, + bottom: bottom, + right: right, + width: width, + height: height + }; +} + +/** + * Checks if a side of an element is scrolled past a side of its parents + * @param {HTMLElement} el The element who's side being scrolled out of view is in question + * @param {String} elSide Side of the element in question ('top', 'left', 'right', 'bottom') + * @param {String} parentSide Side of the parent in question ('top', 'left', 'right', 'bottom') + * @return {HTMLElement} The parent scroll element that the el's side is scrolled past, or null if there is no such element + */ +function isScrolledPast(el, elSide, parentSide) { + let parent = getParentAutoScrollElement(el, true), + elSideVal = getRect(el)[elSide]; + + /* jshint boss:true */ + while (parent) { + let parentSideVal = getRect(parent)[parentSide], + visible; + + if (parentSide === 'top' || parentSide === 'left') { + visible = elSideVal >= parentSideVal; + } else { + visible = elSideVal <= parentSideVal; + } + + if (!visible) return parent; + + if (parent === getWindowScrollingElement()) break; + + parent = getParentAutoScrollElement(parent, false); + } + + return false; +} + + + +/** + * Gets nth child of el, ignoring hidden children, sortable's elements (does not ignore clone if it's visible) + * and non-draggable elements + * @param {HTMLElement} el The parent element + * @param {Number} childNum The index of the child + * @param {Object} options Parent Sortable's options + * @return {HTMLElement} The child at index childNum, or null if not found + */ +function getChild(el, childNum, options) { + let currentChild = 0, + i = 0, + children = el.children; + + while (i < children.length) { + if ( + children[i].style.display !== 'none' && + children[i] !== Sortable.ghost && + children[i] !== Sortable.dragged && + closest(children[i], options.draggable, el, false) + ) { + if (currentChild === childNum) { + return children[i]; + } + currentChild++; + } + + i++; + } + return null; +} + +/** + * Gets the last child in the el, ignoring ghostEl or invisible elements (clones) + * @param {HTMLElement} el Parent element + * @param {selector} selector Any other elements that should be ignored + * @return {HTMLElement} The last child, ignoring ghostEl + */ +function lastChild(el, selector) { + let last = el.lastElementChild; + + while ( + last && + ( + last === Sortable.ghost || + css(last, 'display') === 'none' || + selector && !matches(last, selector) + ) + ) { + last = last.previousElementSibling; + } + + return last || null; +} + + +/** + * Returns the index of an element within its parent for a selected set of + * elements + * @param {HTMLElement} el + * @param {selector} selector + * @return {number} + */ +function index(el, selector) { + let index = 0; + + if (!el || !el.parentNode) { + return -1; + } + + /* jshint boss:true */ + while (el = el.previousElementSibling) { + if ((el.nodeName.toUpperCase() !== 'TEMPLATE') && el !== Sortable.clone && (!selector || matches(el, selector))) { + index++; + } + } + + return index; +} + +/** + * Returns the scroll offset of the given element, added with all the scroll offsets of parent elements. + * The value is returned in real pixels. + * @param {HTMLElement} el + * @return {Array} Offsets in the format of [left, top] + */ +function getRelativeScrollOffset(el) { + let offsetLeft = 0, + offsetTop = 0, + winScroller = getWindowScrollingElement(); + + if (el) { + do { + let elMatrix = matrix(el), + scaleX = elMatrix.a, + scaleY = elMatrix.d; + + offsetLeft += el.scrollLeft * scaleX; + offsetTop += el.scrollTop * scaleY; + } while (el !== winScroller && (el = el.parentNode)); + } + + return [offsetLeft, offsetTop]; +} + +/** + * Returns the index of the object within the given array + * @param {Array} arr Array that may or may not hold the object + * @param {Object} obj An object that has a key-value pair unique to and identical to a key-value pair in the object you want to find + * @return {Number} The index of the object in the array, or -1 + */ +function indexOfObject(arr, obj) { + for (let i in arr) { + if (!arr.hasOwnProperty(i)) continue; + for (let key in obj) { + if (obj.hasOwnProperty(key) && obj[key] === arr[i][key]) return Number(i); + } + } + return -1; +} + + +function getParentAutoScrollElement(el, includeSelf) { + // skip to window + if (!el || !el.getBoundingClientRect) return getWindowScrollingElement(); + + let elem = el; + let gotSelf = false; + do { + // we don't need to get elem css if it isn't even overflowing in the first place (performance) + if (elem.clientWidth < elem.scrollWidth || elem.clientHeight < elem.scrollHeight) { + let elemCSS = css(elem); + if ( + elem.clientWidth < elem.scrollWidth && (elemCSS.overflowX == 'auto' || elemCSS.overflowX == 'scroll') || + elem.clientHeight < elem.scrollHeight && (elemCSS.overflowY == 'auto' || elemCSS.overflowY == 'scroll') + ) { + if (!elem.getBoundingClientRect || elem === document.body) return getWindowScrollingElement(); + + if (gotSelf || includeSelf) return elem; + gotSelf = true; + } + } + /* jshint boss:true */ + } while (elem = elem.parentNode); + + return getWindowScrollingElement(); +} + +function extend(dst, src) { + if (dst && src) { + for (let key in src) { + if (src.hasOwnProperty(key)) { + dst[key] = src[key]; + } + } + } + + return dst; +} + + +function isRectEqual(rect1, rect2) { + return Math.round(rect1.top) === Math.round(rect2.top) && + Math.round(rect1.left) === Math.round(rect2.left) && + Math.round(rect1.height) === Math.round(rect2.height) && + Math.round(rect1.width) === Math.round(rect2.width); +} + + +let _throttleTimeout; +function throttle(callback, ms) { + return function () { + if (!_throttleTimeout) { + let args = arguments, + _this = this; + + if (args.length === 1) { + callback.call(_this, args[0]); + } else { + callback.apply(_this, args); + } + + _throttleTimeout = setTimeout(function () { + _throttleTimeout = void 0; + }, ms); + } + }; +} + + +function cancelThrottle() { + clearTimeout(_throttleTimeout); + _throttleTimeout = void 0; +} + + +function scrollBy(el, x, y) { + el.scrollLeft += x; + el.scrollTop += y; +} + + +function clone(el) { + let Polymer = window.Polymer; + let $ = window.jQuery || window.Zepto; + + if (Polymer && Polymer.dom) { + return Polymer.dom(el).cloneNode(true); + } + else if ($) { + return $(el).clone(true)[0]; + } + else { + return el.cloneNode(true); + } +} + + +function setRect(el, rect) { + css(el, 'position', 'absolute'); + css(el, 'top', rect.top); + css(el, 'left', rect.left); + css(el, 'width', rect.width); + css(el, 'height', rect.height); +} + +function unsetRect(el) { + css(el, 'position', ''); + css(el, 'top', ''); + css(el, 'left', ''); + css(el, 'width', ''); + css(el, 'height', ''); +} + + +const expando = 'Sortable' + (new Date).getTime(); + + +export { + on, + off, + matches, + getParentOrHost, + closest, + toggleClass, + css, + matrix, + find, + getWindowScrollingElement, + getRect, + isScrolledPast, + getChild, + lastChild, + index, + getRelativeScrollOffset, + indexOfObject, + getParentAutoScrollElement, + extend, + isRectEqual, + throttle, + cancelThrottle, + scrollBy, + clone, + setRect, + unsetRect, + expando +}; diff --git a/public/assets/libs/Sortable/st/app.js b/public/assets/libs/Sortable/st/app.js new file mode 100644 index 0000000..3c9e93d --- /dev/null +++ b/public/assets/libs/Sortable/st/app.js @@ -0,0 +1,222 @@ +var example1 = document.getElementById('example1'), + example2Left = document.getElementById('example2-left'), + example2Right = document.getElementById('example2-right'), + example3Left = document.getElementById('example3-left'), + example3Right = document.getElementById('example3-right'), + example4Left = document.getElementById('example4-left'), + example4Right = document.getElementById('example4-right'), + example5 = document.getElementById('example5'), + example6 = document.getElementById('example6'), + example7 = document.getElementById('example7'), + gridDemo = document.getElementById('gridDemo'), + multiDragDemo = document.getElementById('multiDragDemo'), + swapDemo = document.getElementById('swapDemo'); + +// Example 1 - Simple list +new Sortable(example1, { + animation: 150, + ghostClass: 'blue-background-class' +}); + + +// Example 2 - Shared lists +new Sortable(example2Left, { + group: 'shared', // set both lists to same group + animation: 150 +}); + +new Sortable(example2Right, { + group: 'shared', + animation: 150 +}); + +// Example 3 - Cloning +new Sortable(example3Left, { + group: { + name: 'shared', + pull: 'clone' // To clone: set pull to 'clone' + }, + animation: 150 +}); + +new Sortable(example3Right, { + group: { + name: 'shared', + pull: 'clone' + }, + animation: 150 +}); + + +// Example 4 - No Sorting +new Sortable(example4Left, { + group: { + name: 'shared', + pull: 'clone', + put: false // Do not allow items to be put into this list + }, + animation: 150, + sort: false // To disable sorting: set sort to false +}); + +new Sortable(example4Right, { + group: 'shared', + animation: 150 +}); + + +// Example 5 - Handle +new Sortable(example5, { + handle: '.handle', // handle class + animation: 150 +}); + +// Example 6 - Filter +new Sortable(example6, { + filter: '.filtered', + animation: 150 +}); + +// Example 7 - Thresholds +var example7Sortable = new Sortable(example7, { + animation: 150 +}); + + +var example7SwapThreshold = 1; +var example7SwapThresholdInput = document.getElementById('example7SwapThresholdInput'); +var example7SwapThresholdCode = document.getElementById('example7SwapThresholdCode'); +var example7SwapThresholdIndicators = [].slice.call(document.querySelectorAll('.swap-threshold-indicator')); + +var example7InvertSwapInput = document.getElementById('example7InvertSwapInput'); +var example7InvertSwapCode = document.getElementById('example7InvertSwapCode'); +var example7InvertedSwapThresholdIndicators = [].slice.call(document.querySelectorAll('.inverted-swap-threshold-indicator')); + +var example7Squares = [].slice.call(document.querySelectorAll('.square')); + +var activeIndicators = example7SwapThresholdIndicators; + +var example7DirectionInput = document.getElementById('example7DirectionInput'); +var example7SizeProperty = 'width'; + + +function renderThresholdWidth(evt) { + example7SwapThreshold = Number(evt.target.value); + example7SwapThresholdCode.innerHTML = evt.target.value.indexOf('.') > -1 ? evt.target.value.padEnd(4, '0') : evt.target.value; + + for (var i = 0; i < activeIndicators.length; i++) { + activeIndicators[i].style[example7SizeProperty] = (evt.target.value * 100) / + (activeIndicators == example7SwapThresholdIndicators ? 1 : 2) + '%'; + } + + example7Sortable.option('swapThreshold', example7SwapThreshold); +} + +example7SwapThresholdInput.addEventListener('input', renderThresholdWidth); + +example7InvertSwapInput.addEventListener('input', function(evt) { + example7Sortable.option('invertSwap', evt.target.checked); + + + for (var i = 0; i < activeIndicators.length; i++) { + activeIndicators[i].style.display = 'none'; + } + + if (evt.target.checked) { + + example7InvertSwapCode.style.display = ''; + + activeIndicators = example7InvertedSwapThresholdIndicators; + } else { + example7InvertSwapCode.style.display = 'none'; + activeIndicators = example7SwapThresholdIndicators; + } + + renderThresholdWidth({ + target: example7SwapThresholdInput + }); + + for (i = 0; i < activeIndicators.length; i++) { + activeIndicators[i].style.display = ''; + } +}); + +function renderDirection(evt) { + for (var i = 0; i < example7Squares.length; i++) { + example7Squares[i].style.display = evt.target.value === 'h' ? 'inline-block' : 'block'; + } + + for (i = 0; i < example7InvertedSwapThresholdIndicators.length; i++) { + /* jshint expr:true */ + evt.target.value === 'h' && (example7InvertedSwapThresholdIndicators[i].style.height = '100%'); + evt.target.value === 'v' && (example7InvertedSwapThresholdIndicators[i].style.width = '100%'); + } + + for (i = 0; i < example7SwapThresholdIndicators.length; i++) { + if (evt.target.value === 'h') { + example7SwapThresholdIndicators[i].style.height = '100%'; + example7SwapThresholdIndicators[i].style.marginLeft = '50%'; + example7SwapThresholdIndicators[i].style.transform = 'translateX(-50%)'; + + example7SwapThresholdIndicators[i].style.marginTop = '0'; + } else { + example7SwapThresholdIndicators[i].style.width = '100%'; + example7SwapThresholdIndicators[i].style.marginTop = '50%'; + example7SwapThresholdIndicators[i].style.transform = 'translateY(-50%)'; + + example7SwapThresholdIndicators[i].style.marginLeft = '0'; + } + } + + if (evt.target.value === 'h') { + example7SizeProperty = 'width'; + example7Sortable.option('direction', 'horizontal'); + } else { + example7SizeProperty = 'height'; + example7Sortable.option('direction', 'vertical'); + } + + renderThresholdWidth({ + target: example7SwapThresholdInput + }); +} +example7DirectionInput.addEventListener('input', renderDirection); + +renderDirection({ + target: example7DirectionInput +}); + + +// Grid demo +new Sortable(gridDemo, { + animation: 150, + ghostClass: 'blue-background-class' +}); + +// Nested demo +var nestedSortables = [].slice.call(document.querySelectorAll('.nested-sortable')); + +// Loop through each nested sortable element +for (var i = 0; i < nestedSortables.length; i++) { + new Sortable(nestedSortables[i], { + group: 'nested', + animation: 150, + fallbackOnBody: true, + swapThreshold: 0.65 + }); +} + +// MultiDrag demo +new Sortable(multiDragDemo, { + multiDrag: true, + selectedClass: 'selected', + animation: 150 +}); + + +// Swap demo +new Sortable(swapDemo, { + swap: true, + swapClass: 'highlight', + animation: 150 +}); diff --git a/public/assets/libs/Sortable/st/iframe/frame.html b/public/assets/libs/Sortable/st/iframe/frame.html new file mode 100644 index 0000000..677eeef --- /dev/null +++ b/public/assets/libs/Sortable/st/iframe/frame.html @@ -0,0 +1,32 @@ + + + + + + + + + + + + +
+
+ 14 + + Drag me by the handle +
+
+ 2 + + You can also select text +
+
+ 1 + + Best of both worlds! +
+
+ + + diff --git a/public/assets/libs/Sortable/st/iframe/index.html b/public/assets/libs/Sortable/st/iframe/index.html new file mode 100644 index 0000000..fcd0898 --- /dev/null +++ b/public/assets/libs/Sortable/st/iframe/index.html @@ -0,0 +1,49 @@ + + + + + IFrame playground + + + + + + + + + + + + + +
+
This is Sortable
+
It works with Bootstrap...
+
...out of the box.
+
It has support for touch devices.
+
Just drag some elements around.
+
+ + + + + diff --git a/public/assets/libs/Sortable/st/logo.png b/public/assets/libs/Sortable/st/logo.png new file mode 100644 index 0000000..76cc77c Binary files /dev/null and b/public/assets/libs/Sortable/st/logo.png differ diff --git a/public/assets/libs/Sortable/st/og-image.png b/public/assets/libs/Sortable/st/og-image.png new file mode 100644 index 0000000..7d7a51d Binary files /dev/null and b/public/assets/libs/Sortable/st/og-image.png differ diff --git a/public/assets/libs/Sortable/st/prettify/prettify.css b/public/assets/libs/Sortable/st/prettify/prettify.css new file mode 100644 index 0000000..e6fe342 --- /dev/null +++ b/public/assets/libs/Sortable/st/prettify/prettify.css @@ -0,0 +1 @@ +.pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.clo,.opn,.pun{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.kwd,.tag,.typ{font-weight:700}.str{color:#060}.kwd{color:#006}.com{color:#600;font-style:italic}.typ{color:#404}.lit{color:#044}.clo,.opn,.pun{color:#440}.tag{color:#006}.atn{color:#404}.atv{color:#060}}pre.prettyprint{padding:2px;border:1px solid #888}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee} \ No newline at end of file diff --git a/public/assets/libs/Sortable/st/prettify/prettify.js b/public/assets/libs/Sortable/st/prettify/prettify.js new file mode 100644 index 0000000..477f03d --- /dev/null +++ b/public/assets/libs/Sortable/st/prettify/prettify.js @@ -0,0 +1,46 @@ +!function(){/* + + Copyright (C) 2006 Google Inc. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ +"undefined"!==typeof window&&(window.PR_SHOULD_USE_CONTINUATION=!0); +(function(){function T(a){function d(e){var a=e.charCodeAt(0);if(92!==a)return a;var c=e.charAt(1);return(a=w[c])?a:"0"<=c&&"7">=c?parseInt(e.substring(1),8):"u"===c||"x"===c?parseInt(e.substring(2),16):e.charCodeAt(1)}function f(e){if(32>e)return(16>e?"\\x0":"\\x")+e.toString(16);e=String.fromCharCode(e);return"\\"===e||"-"===e||"]"===e||"^"===e?"\\"+e:e}function c(e){var c=e.substring(1,e.length-1).match(RegExp("\\\\u[0-9A-Fa-f]{4}|\\\\x[0-9A-Fa-f]{2}|\\\\[0-3][0-7]{0,2}|\\\\[0-7]{1,2}|\\\\[\\s\\S]|-|[^-\\\\]","g")); +e=[];var a="^"===c[0],b=["["];a&&b.push("^");for(var a=a?1:0,g=c.length;ak||122k||90k||122h[0]&&(h[1]+1>h[0]&&b.push("-"),b.push(f(h[1])));b.push("]");return b.join("")}function m(e){for(var a=e.source.match(RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g")),b=a.length,d=[],g=0,h=0;g/,null])):d.push(["com",/^#[^\r\n]*/,null,"#"]));a.cStyleComments&&(f.push(["com",/^\/\/[^\r\n]*/,null]),f.push(["com",/^\/\*[\s\S]*?(?:\*\/|$)/,null]));if(c=a.regexLiterals){var m=(c=1|\\/=?|::?|<>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*("+ +("/(?=[^/*"+c+"])(?:[^/\\x5B\\x5C"+c+"]|\\x5C"+m+"|\\x5B(?:[^\\x5C\\x5D"+c+"]|\\x5C"+m+")*(?:\\x5D|$))+/")+")")])}(c=a.types)&&f.push(["typ",c]);c=(""+a.keywords).replace(/^ | $/g,"");c.length&&f.push(["kwd",new RegExp("^(?:"+c.replace(/[\s,]+/g,"|")+")\\b"),null]);d.push(["pln",/^\s+/,null," \r\n\t\u00a0"]);c="^.[^\\s\\w.$@'\"`/\\\\]*";a.regexLiterals&&(c+="(?!s*/)");f.push(["lit",/^@[a-z_$][a-z_$@0-9]*/i,null],["typ",/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],["pln",/^[a-z_$][a-z_$@0-9]*/i, +null],["lit",/^(?:0x[a-f0-9]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+\-]?\d+)?)[a-z]*/i,null,"0123456789"],["pln",/^\\[\s\S]?/,null],["pun",new RegExp(c),null]);return G(d,f)}function L(a,d,f){function c(a){var b=a.nodeType;if(1==b&&!t.test(a.className))if("br"===a.nodeName.toLowerCase())m(a),a.parentNode&&a.parentNode.removeChild(a);else for(a=a.firstChild;a;a=a.nextSibling)c(a);else if((3==b||4==b)&&f){var e=a.nodeValue,d=e.match(q);d&&(b=e.substring(0,d.index),a.nodeValue=b,(e=e.substring(d.index+ +d[0].length))&&a.parentNode.insertBefore(l.createTextNode(e),a.nextSibling),m(a),b||a.parentNode.removeChild(a))}}function m(a){function c(a,b){var e=b?a.cloneNode(!1):a,k=a.parentNode;if(k){var k=c(k,1),d=a.nextSibling;k.appendChild(e);for(var f=d;f;f=d)d=f.nextSibling,k.appendChild(f)}return e}for(;!a.nextSibling;)if(a=a.parentNode,!a)return;a=c(a.nextSibling,0);for(var e;(e=a.parentNode)&&1===e.nodeType;)a=e;b.push(a)}for(var t=/(?:^|\s)nocode(?:\s|$)/,q=/\r\n?|\n/,l=a.ownerDocument,n=l.createElement("li");a.firstChild;)n.appendChild(a.firstChild); +for(var b=[n],p=0;p=+m[1],d=/\n/g,t=a.a,q=t.length,f=0,l=a.c,n=l.length,c=0,b=a.g,p=b.length,w=0;b[p]=q;var r,e;for(e=r=0;e=h&&(c+=2);f>=k&&(w+=2)}}finally{g&&(g.style.display=a)}}catch(y){D.console&&console.log(y&&y.stack||y)}}var D="undefined"!==typeof window? +window:{},B=["break,continue,do,else,for,if,return,while"],F=[[B,"auto,case,char,const,default,double,enum,extern,float,goto,inline,int,long,register,restrict,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],H=[F,"alignas,alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,delegate,dynamic_cast,explicit,export,friend,generic,late_check,mutable,namespace,noexcept,noreturn,nullptr,property,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"], +O=[F,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],P=[F,"abstract,add,alias,as,ascending,async,await,base,bool,by,byte,checked,decimal,delegate,descending,dynamic,event,finally,fixed,foreach,from,get,global,group,implicit,in,interface,internal,into,is,join,let,lock,null,object,out,override,orderby,params,partial,readonly,ref,remove,sbyte,sealed,select,set,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,value,var,virtual,where,yield"], +F=[F,"abstract,async,await,constructor,debugger,enum,eval,export,from,function,get,import,implements,instanceof,interface,let,null,of,set,undefined,var,with,yield,Infinity,NaN"],Q=[B,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],R=[B,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"], +B=[B,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],S=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,W=/\S/,X=x({keywords:[H,P,O,F,"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",Q,R,B],hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0}), +I={};t(X,["default-code"]);t(G([],[["pln",/^[^]*(?:>|$)/],["com",/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],["pun",/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),"default-markup htm html mxml xhtml xml xsl".split(" "));t(G([["pln",/^[\s]+/, +null," \t\r\n"],["atv",/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,"\"'"]],[["tag",/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],["atn",/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],["pun",/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]); +t(G([],[["atv",/^[\s\S]+/]]),["uq.val"]);t(x({keywords:H,hashComments:!0,cStyleComments:!0,types:S}),"c cc cpp cxx cyc m".split(" "));t(x({keywords:"null,true,false"}),["json"]);t(x({keywords:P,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:S}),["cs"]);t(x({keywords:O,cStyleComments:!0}),["java"]);t(x({keywords:B,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]);t(x({keywords:Q,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]);t(x({keywords:"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END", +hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]);t(x({keywords:R,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]);t(x({keywords:F,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]);t(x({keywords:"all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,throw,true,try,unless,until,when,while,yes",hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0, +regexLiterals:!0}),["coffee"]);t(G([],[["str",/^[\s\S]+/]]),["regex"]);var Y=D.PR={createSimpleLexer:G,registerLangHandler:t,sourceDecorator:x,PR_ATTRIB_NAME:"atn",PR_ATTRIB_VALUE:"atv",PR_COMMENT:"com",PR_DECLARATION:"dec",PR_KEYWORD:"kwd",PR_LITERAL:"lit",PR_NOCODE:"nocode",PR_PLAIN:"pln",PR_PUNCTUATION:"pun",PR_SOURCE:"src",PR_STRING:"str",PR_TAG:"tag",PR_TYPE:"typ",prettyPrintOne:D.prettyPrintOne=function(a,d,f){f=f||!1;d=d||null;var c=document.createElement("div");c.innerHTML="
"+a+"
"; +c=c.firstChild;f&&L(c,f,!0);M({j:d,m:f,h:c,l:1,a:null,i:null,c:null,g:null});return c.innerHTML},prettyPrint:D.prettyPrint=function(a,d){function f(){for(var c=D.PR_SHOULD_USE_CONTINUATION?b.now()+250:Infinity;p=c?parseInt(e.substring(1),8):"u"===c||"x"===c?parseInt(e.substring(2),16):e.charCodeAt(1)}function f(e){if(32>e)return(16>e?"\\x0":"\\x")+e.toString(16);e=String.fromCharCode(e); +return"\\"===e||"-"===e||"]"===e||"^"===e?"\\"+e:e}function c(e){var c=e.substring(1,e.length-1).match(RegExp("\\\\u[0-9A-Fa-f]{4}|\\\\x[0-9A-Fa-f]{2}|\\\\[0-3][0-7]{0,2}|\\\\[0-7]{1,2}|\\\\[\\s\\S]|-|[^-\\\\]","g"));e=[];var a="^"===c[0],b=["["];a&&b.push("^");for(var a=a?1:0,h=c.length;ap||122p||90p||122m[0]&&(m[1]+1>m[0]&&b.push("-"),b.push(f(m[1])));b.push("]");return b.join("")}function g(e){for(var a=e.source.match(RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)", +"g")),b=a.length,d=[],h=0,m=0;h/,null])):d.push(["com",/^#[^\r\n]*/,null,"#"]));a.cStyleComments&&(f.push(["com",/^\/\/[^\r\n]*/,null]),f.push(["com",/^\/\*[\s\S]*?(?:\*\/|$)/, +null]));if(c=a.regexLiterals){var g=(c=1|\\/=?|::?|<>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*("+("/(?=[^/*"+c+"])(?:[^/\\x5B\\x5C"+c+"]|\\x5C"+g+"|\\x5B(?:[^\\x5C\\x5D"+c+"]|\\x5C"+g+")*(?:\\x5D|$))+/")+")")])}(c=a.types)&&f.push(["typ",c]);c=(""+a.keywords).replace(/^ | $/g,"");c.length&&f.push(["kwd", +new RegExp("^(?:"+c.replace(/[\s,]+/g,"|")+")\\b"),null]);d.push(["pln",/^\s+/,null," \r\n\t\u00a0"]);c="^.[^\\s\\w.$@'\"`/\\\\]*";a.regexLiterals&&(c+="(?!s*/)");f.push(["lit",/^@[a-z_$][a-z_$@0-9]*/i,null],["typ",/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],["pln",/^[a-z_$][a-z_$@0-9]*/i,null],["lit",/^(?:0x[a-f0-9]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+\-]?\d+)?)[a-z]*/i,null,"0123456789"],["pln",/^\\[\s\S]?/,null],["pun",new RegExp(c),null]);return E(d,f)}function B(a,d,f){function c(a){var b= +a.nodeType;if(1==b&&!r.test(a.className))if("br"===a.nodeName.toLowerCase())g(a),a.parentNode&&a.parentNode.removeChild(a);else for(a=a.firstChild;a;a=a.nextSibling)c(a);else if((3==b||4==b)&&f){var e=a.nodeValue,d=e.match(n);d&&(b=e.substring(0,d.index),a.nodeValue=b,(e=e.substring(d.index+d[0].length))&&a.parentNode.insertBefore(q.createTextNode(e),a.nextSibling),g(a),b||a.parentNode.removeChild(a))}}function g(a){function c(a,b){var e=b?a.cloneNode(!1):a,p=a.parentNode;if(p){var p=c(p,1),d=a.nextSibling; +p.appendChild(e);for(var f=d;f;f=d)d=f.nextSibling,p.appendChild(f)}return e}for(;!a.nextSibling;)if(a=a.parentNode,!a)return;a=c(a.nextSibling,0);for(var e;(e=a.parentNode)&&1===e.nodeType;)a=e;b.push(a)}for(var r=/(?:^|\s)nocode(?:\s|$)/,n=/\r\n?|\n/,q=a.ownerDocument,k=q.createElement("li");a.firstChild;)k.appendChild(a.firstChild);for(var b=[k],t=0;t=+g[1],d=/\n/g,r=a.a,k=r.length,f=0,q=a.c,n=q.length,c=0,b=a.g,t=b.length,v=0;b[t]=k;var u,e;for(e=u=0;e=m&&(c+=2);f>=p&&(v+=2)}}finally{h&&(h.style.display=a)}}catch(y){Q.console&&console.log(y&&y.stack||y)}}var Q="undefined"!==typeof window?window:{},J=["break,continue,do,else,for,if,return,while"],K=[[J,"auto,case,char,const,default,double,enum,extern,float,goto,inline,int,long,register,restrict,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"], +"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],R=[K,"alignas,alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,delegate,dynamic_cast,explicit,export,friend,generic,late_check,mutable,namespace,noexcept,noreturn,nullptr,property,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],L=[K,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"], +M=[K,"abstract,add,alias,as,ascending,async,await,base,bool,by,byte,checked,decimal,delegate,descending,dynamic,event,finally,fixed,foreach,from,get,global,group,implicit,in,interface,internal,into,is,join,let,lock,null,object,out,override,orderby,params,partial,readonly,ref,remove,sbyte,sealed,select,set,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,value,var,virtual,where,yield"],K=[K,"abstract,async,await,constructor,debugger,enum,eval,export,from,function,get,import,implements,instanceof,interface,let,null,of,set,undefined,var,with,yield,Infinity,NaN"], +N=[J,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],O=[J,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],J=[J,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],P=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/, +S=/\S/,T=v({keywords:[R,M,L,K,"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",N,O,J],hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0}),V={};n(T,["default-code"]);n(E([],[["pln",/^[^]*(?:>|$)/],["com",/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],["pun",/^(?:<[%?]|[%?]>)/],["lang-", +/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),"default-markup htm html mxml xhtml xml xsl".split(" "));n(E([["pln",/^[\s]+/,null," \t\r\n"],["atv",/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,"\"'"]],[["tag",/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],["atn",/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/], +["pun",/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]);n(E([],[["atv",/^[\s\S]+/]]),["uq.val"]);n(v({keywords:R,hashComments:!0,cStyleComments:!0,types:P}),"c cc cpp cxx cyc m".split(" "));n(v({keywords:"null,true,false"}),["json"]);n(v({keywords:M,hashComments:!0,cStyleComments:!0, +verbatimStrings:!0,types:P}),["cs"]);n(v({keywords:L,cStyleComments:!0}),["java"]);n(v({keywords:J,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]);n(v({keywords:N,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]);n(v({keywords:"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",hashComments:!0,multiLineStrings:!0,regexLiterals:2}), +["perl","pl","pm"]);n(v({keywords:O,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]);n(v({keywords:K,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]);n(v({keywords:"all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,throw,true,try,unless,until,when,while,yes",hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]);n(E([],[["str",/^[\s\S]+/]]), +["regex"]);var U=Q.PR={createSimpleLexer:E,registerLangHandler:n,sourceDecorator:v,PR_ATTRIB_NAME:"atn",PR_ATTRIB_VALUE:"atv",PR_COMMENT:"com",PR_DECLARATION:"dec",PR_KEYWORD:"kwd",PR_LITERAL:"lit",PR_NOCODE:"nocode",PR_PLAIN:"pln",PR_PUNCTUATION:"pun",PR_SOURCE:"src",PR_STRING:"str",PR_TAG:"tag",PR_TYPE:"typ",prettyPrintOne:function(a,d,f){f=f||!1;d=d||null;var c=document.createElement("div");c.innerHTML="
"+a+"
";c=c.firstChild;f&&B(c,f,!0);H({j:d,m:f,h:c,l:1,a:null,i:null,c:null,g:null}); +return c.innerHTML},prettyPrint:g=function(a,d){function f(){for(var c=Q.PR_SHOULD_USE_CONTINUATION?b.now()+250:Infinity;tPowered by Sauce Labs badges grayvTESTING POWERED BY \ No newline at end of file diff --git a/public/assets/libs/Sortable/st/theme.css b/public/assets/libs/Sortable/st/theme.css new file mode 100644 index 0000000..87b2434 --- /dev/null +++ b/public/assets/libs/Sortable/st/theme.css @@ -0,0 +1,254 @@ +body { + font-family: Helvetica Neue, Helvetica, Arial; + background: rgb(244,215,201); /* Old browsers */ + background: -moz-linear-gradient(top, rgb(244,215,201) 0%, rgb(244,226,201) 100%); /* FF3.6-15 */ + background: -webkit-linear-gradient(top, rgb(244,215,201) 0%,rgb(244,226,201) 100%); /* Chrome10-25,Safari5.1-6 */ + background: linear-gradient(to bottom, rgb(244,215,201) 0%,rgb(244,226,201) 100%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */ + margin-bottom: 100px; +} + +.header { + margin-top: 30px; +} + +.header h1 { + margin-top: 10px; +} + +h4 { + padding-bottom: 10px; +} + +.prettyprinted { + margin-top: 5px; + border-top: none !important; + border-bottom: none !important; + border-right: none !important; + border-left: 1px solid rgba(0,0,0,.1) !important; + padding-left: 15px !important; + word-wrap: break-word !important; + overflow: default !important; + text-overflow: default !important; +} + +.tinted { + background-color: #fff6b2; +} + +.handle { + cursor: grab; +} + +code { + color: #606; +} + +.toc { + background-color: rgb(255,255,255,0.5); + border: solid #444 1px; + padding: 20px; + margin-left: auto; + margin-right: auto; + list-style: none; +} + +.toc h5 { + margin-top: 8px; +} + +.list-group-item:hover { + z-index: 0; +} + +.input-section { + background-color: rgb(255,255,255,0.5); + padding: 20px; +} + +.square-section { + background-color: rgb(255,255,255,0.5); +} + + +.square { + width: 20vw; + height: 20vw; + background-color: #00a2ff; + margin-top: 2vw; + margin-left: 2vw; + display: inline-block; + position: relative; +} + +.swap-threshold-indicator { + background-color: #0079bf; + height: 100%; + display: inline-block; +} + +.inverted-swap-threshold-indicator { + background-color: #0079bf; + height: 100%; + position: absolute; +} + +.indicator-left { + left: 0; + top: 0; +} + +.indicator-right { + right: 0; + bottom: 0; +} + +.num-indicator { + position: absolute; + font-size: 50px; + width: 25px; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + color: white; +} + +.grid-square { + width: 100px; + height: 100px; + display: inline-block; + background-color: #fff; + border: solid 1px rgb(0,0,0,0.2); + padding: 10px; + margin: 12px; +} + +.nested-sortable, .nested-1, .nested-2, .nested-3 { + margin-top: 5px; +} + +.nested-1 { + background-color: #e6e6e6; +} + +.nested-2 { + background-color: #cccccc; +} + +.nested-3 { + background-color: #b3b3b3; +} + +.frameworks { + background-color: rgb(255,255,255,0.5); + border: solid rgb(0,0,0,0.3) 1px; + padding: 20px; +} + +.frameworks h3 { + margin-top: 5px; +} + +input[type=range] { + -webkit-appearance: none; + width: 100%; + margin: 3.8px 0; +} +input[type=range]:focus { + outline: none; +} +input[type=range]::-webkit-slider-runnable-track { + width: 100%; + height: 8.4px; + cursor: pointer; + box-shadow: 1px 1px 1px #000000, 0px 0px 1px #0d0d0d; + background: rgba(48, 113, 169, 0); + border-radius: 1.3px; + border: 0.2px solid #010101; +} +input[type=range]::-webkit-slider-thumb { + box-shadow: 0px 0px 0.9px #000000, 0px 0px 0px #0d0d0d; + border: 1.3px solid rgba(0, 0, 0, 0.7); + height: 16px; + width: 16px; + border-radius: 49px; + background: #ffffff; + cursor: pointer; + -webkit-appearance: none; + margin-top: -4px; +} +input[type=range]:focus::-webkit-slider-runnable-track { + background: rgba(54, 126, 189, 0); +} +input[type=range]::-moz-range-track { + width: 100%; + height: 8.4px; + cursor: pointer; + box-shadow: 1px 1px 1px #000000, 0px 0px 1px #0d0d0d; + background: rgba(48, 113, 169, 0); + border-radius: 1.3px; + border: 0.2px solid #010101; +} +input[type=range]::-moz-range-thumb { + box-shadow: 0px 0px 0.9px #000000, 0px 0px 0px #0d0d0d; + border: 1.3px solid rgba(0, 0, 0, 0.7); + height: 16px; + width: 16px; + border-radius: 49px; + background: #ffffff; + cursor: pointer; +} +input[type=range]::-ms-track { + width: 100%; + height: 8.4px; + cursor: pointer; + background: transparent; + border-color: transparent; + color: transparent; +} +input[type=range]::-ms-fill-lower { + background: rgba(42, 100, 149, 0); + border: 0.2px solid #010101; + border-radius: 2.6px; + box-shadow: 1px 1px 1px #000000, 0px 0px 1px #0d0d0d; +} +input[type=range]::-ms-fill-upper { + background: rgba(48, 113, 169, 0); + border: 0.2px solid #010101; + border-radius: 2.6px; + box-shadow: 1px 1px 1px #000000, 0px 0px 1px #0d0d0d; +} +input[type=range]::-ms-thumb { + box-shadow: 0px 0px 0.9px #000000, 0px 0px 0px #0d0d0d; + border: 1.3px solid rgba(0, 0, 0, 0.7); + height: 16px; + width: 16px; + border-radius: 49px; + background: #ffffff; + cursor: pointer; + height: 8.4px; +} +input[type=range]:focus::-ms-fill-lower { + background: rgba(48, 113, 169, 0); +} +input[type=range]:focus::-ms-fill-upper { + background: rgba(54, 126, 189, 0); +} + +.blue-background-class { + background-color: #C8EBFB; +} + +.col { + padding-right: 0; + margin-right: 15px; +} + +.selected { + background-color: #f9c7c8; + border: solid red 1px !important; + z-index: 1 !important; +} + +.highlight { + background-color: #B7F8C7; +} diff --git a/public/assets/libs/art-template/.bower.json b/public/assets/libs/art-template/.bower.json new file mode 100644 index 0000000..ca505c7 --- /dev/null +++ b/public/assets/libs/art-template/.bower.json @@ -0,0 +1,14 @@ +{ + "name": "art-template", + "homepage": "https://github.com/aui/artTemplate", + "version": "3.1.3", + "_release": "3.1.3", + "_resolution": { + "type": "version", + "tag": "v3.1.3", + "commit": "b1085f546f6d3abbf74d10a5f69d24a63e932e86" + }, + "_source": "https://github.com/aui/artTemplate.git", + "_target": "~3.1.3", + "_originalSource": "art-template" +} \ No newline at end of file diff --git a/public/assets/libs/art-template/.gitignore b/public/assets/libs/art-template/.gitignore new file mode 100644 index 0000000..10283d8 --- /dev/null +++ b/public/assets/libs/art-template/.gitignore @@ -0,0 +1,4 @@ +.DS_Store +node_modules +.vscode +coverage \ No newline at end of file diff --git a/public/assets/libs/art-template/.npmignore b/public/assets/libs/art-template/.npmignore new file mode 100644 index 0000000..6db059f --- /dev/null +++ b/public/assets/libs/art-template/.npmignore @@ -0,0 +1,3 @@ +test +demo +doc \ No newline at end of file diff --git a/public/assets/libs/art-template/Gruntfile.js b/public/assets/libs/art-template/Gruntfile.js new file mode 100644 index 0000000..88c304c --- /dev/null +++ b/public/assets/libs/art-template/Gruntfile.js @@ -0,0 +1,99 @@ +module.exports = function (grunt) { + + var sources_native = [ + 'src/intro.js', + 'src/template.js', + 'src/config.js', + 'src/cache.js', + 'src/render.js', + 'src/renderFile.js', + 'src/get.js', + 'src/utils.js', + 'src/helper.js', + 'src/onerror.js', + 'src/compile.js', + //<<<< 'src/syntax.js', + 'src/outro.js' + ]; + + var sources_simple = Array.apply(null, sources_native); + sources_simple.splice(sources_native.length - 1, 0, 'src/syntax.js'); + + + grunt.initConfig({ + pkg: grunt.file.readJSON('package.json'), + meta: { + banner: '/*!<%= pkg.name %> - Template Engine | <%= pkg.homepage %>*/\n' + }, + concat: { + options: { + separator: '' + }, + + 'native': { + src: sources_native, + dest: 'dist/template-native-debug.js' + }, + + simple: { + src: sources_simple, + dest: 'dist/template-debug.js' + } + }, + uglify: { + options: { + banner: '<%= meta.banner %>' + }, + 'native': { + src: '<%= concat.native.dest %>', + dest: 'dist/template-native.js' + }, + simple: { + src: '<%= concat.simple.dest %>', + dest: 'dist/template.js' + } + }, + qunit: { + files: ['test/**/*.html'] + }, + jshint: { + files: [ + 'dist/template-native.js', + 'dist/template.js' + ], + options: { + curly: true, + eqeqeq: true, + immed: true, + latedef: true, + newcap: true, + noarg: true, + sub: true, + undef: true, + boss: true, + eqnull: true, + browser: true + }, + globals: { + console: true, + define: true, + global: true, + module: true + } + }, + watch: { + files: '', + tasks: 'lint qunit' + } + }); + + grunt.loadNpmTasks('grunt-contrib-uglify'); + grunt.loadNpmTasks('grunt-contrib-jshint'); + //grunt.loadNpmTasks('grunt-contrib-qunit'); + //grunt.loadNpmTasks('grunt-contrib-watch'); + grunt.loadNpmTasks('grunt-contrib-concat'); + + + grunt.registerTask('default', ['concat', /*'jshint',*/ 'uglify']); + +}; \ No newline at end of file diff --git a/public/assets/libs/art-template/README.md b/public/assets/libs/art-template/README.md new file mode 100644 index 0000000..9530369 --- /dev/null +++ b/public/assets/libs/art-template/README.md @@ -0,0 +1,303 @@ +# artTemplate-3.0 + +新一代 javascript 模板引擎 + +> 后会无期。2016-12-22 + +## 目录 + +* [特性](#特性) +* [快速上手](#快速上手) +* [模板语法](#模板语法) +* [下载](#下载) +* [方法](#方法) +* [NodeJS](#nodejs) +* [使用预编译](#使用预编译) +* [更新日志](#更新日志) +* [授权协议](#授权协议) + +## 特性 + +1. 性能卓越,执行速度通常是 Mustache 与 tmpl 的 20 多倍([性能测试](http://aui.github.com/artTemplate/test/test-speed.html)) +2. 支持运行时调试,可精确定位异常模板所在语句([演示](http://aui.github.io/artTemplate/demo/debug.html)) +3. 对 NodeJS Express 友好支持 +4. 安全,默认对输出进行转义、在沙箱中运行编译后的代码(Node版本可以安全执行用户上传的模板) +5. 支持``include``语句 +6. 可在浏览器端实现按路径加载模板([详情](#使用预编译)) +7. 支持预编译,可将模板转换成为非常精简的 js 文件 +8. 模板语句简洁,无需前缀引用数据,有简洁版本与原生语法版本可选 +9. 支持所有流行的浏览器 + +## 快速上手 + +### 编写模板 + +使用一个``type="text/html"``的``script``标签存放模板: + + + +### 渲染模板 + + var data = { + title: '标签', + list: ['文艺', '博客', '摄影', '电影', '民谣', '旅行', '吉他'] + }; + var html = template('test', data); + document.getElementById('content').innerHTML = html; + + +[演示](http://aui.github.com/artTemplate/demo/basic.html) + +## 模板语法 + +有两个版本的模板语法可以选择。 + +### 简洁语法 + +推荐使用,语法简单实用,利于读写。 + + {{if admin}} + {{include 'admin_content'}} + + {{each list}} +
{{$index}}. {{$value.user}}
+ {{/each}} + {{/if}} + +[查看语法与演示](https://github.com/aui/artTemplate/wiki/syntax:simple) + +### 原生语法 + + <%if (admin){%> + <%include('admin_content')%> + + <%for (var i=0;i +
<%=i%>. <%=list[i].user%>
+ <%}%> + <%}%> + +[查看语法与演示](https://github.com/aui/artTemplate/wiki/syntax:native) + +## 下载 + +* [template.js](https://raw.github.com/aui/artTemplate/master/dist/template.js) *(简洁语法版, 2.7kb)* +* [template-native.js](https://raw.github.com/aui/artTemplate/master/dist/template-native.js) *(原生语法版, 2.3kb)* + +## 方法 + +### template(id, data) + +根据 id 渲染模板。内部会根据``document.getElementById(id)``查找模板。 + +如果没有 data 参数,那么将返回一渲染函数。 + +### template.``compile``(source, options) + +将返回一个渲染函数。[演示](http://aui.github.com/artTemplate/demo/compile.html) + +### template.``render``(source, options) + +将返回渲染结果。 + +### template.``helper``(name, callback) + +添加辅助方法。 + +例如时间格式器:[演示](http://aui.github.com/artTemplate/demo/helper.html) + +### template.``config``(name, value) + +更改引擎的默认配置。 + +字段 | 类型 | 默认值| 说明 +------------ | ------------- | ------------ | ------------ +openTag | String | ``'{{'`` | 逻辑语法开始标签 +closeTag | String | ``"}}"`` | 逻辑语法结束标签 +escape | Boolean | ``true`` | 是否编码输出 HTML 字符 +cache | Boolean | ``true`` | 是否开启缓存(依赖 options 的 filename 字段) +compress | Boolean | ``false`` | 是否压缩 HTML 多余空白字符 + +## 使用预编译 + +可突破浏览器限制,让前端模板拥有后端模板一样的同步“文件”加载能力: + +一、**按文件与目录组织模板** + +``` +template('tpl/home/main', data) +``` + +二、**模板支持引入子模板** + + + {{include '../public/header'}} + +### 基于预编译: + +* 可将模板转换成为非常精简的 js 文件(不依赖引擎) +* 使用同步模板加载接口 +* 支持多种 js 模块输出:AMD、CMD、CommonJS +* 支持作为 GruntJS 插件构建 +* 前端模板可共享给 NodeJS 执行 +* 自动压缩打包模板 + +预编译工具:[TmodJS](http://github.com/aui/tmodjs/) + +## NodeJS + +### 安装 + + npm install art-template + +### 使用 + + var template = require('art-template'); + var data = {list: ["aui", "test"]}; + + var html = template(__dirname + '/index/main', data); + +### 配置 + +NodeJS 版本新增了如下默认配置: + +字段 | 类型 | 默认值| 说明 +------------ | ------------- | ------------ | ------------ +base | String | ``''`` | 指定模板目录 +extname | String | ``'.html'`` | 指定模板后缀名 +encoding | String | ``'utf-8'`` | 指定模板编码 + +配置``base``指定模板目录可以缩短模板的路径,并且能够避免``include``语句越级访问任意路径引发安全隐患,例如: + + template.config('base', __dirname); + var html = template('index/main', data) + +### NodeJS + Express + + var template = require('art-template'); + template.config('base', ''); + template.config('extname', '.html'); + app.engine('.html', template.__express); + app.set('view engine', 'html'); + //app.set('views', __dirname + '/views'); + +运行 demo: + + node demo/node-template-express.js + +> 若使用 js 原生语法作为模板语法,请改用 ``require('art-template/node/template-native.js')`` + +## 升级参考 + +为了适配 NodeJS express,artTemplate v3.0.0 接口有调整。 + +### 接口变更 + +1. 默认使用简洁语法 +2. ``template.render()``方法的第一个参数不再是 id,而是模板字符串 +3. 使用新的配置接口``template.config()``并且字段名有修改 +4. ``template.compile()``方法不支持 id 参数 +5. helper 方法不再强制原文输出,是否编码取决于模板语句 +6. ``template.helpers`` 中的``$string``、``$escape``、``$each``已迁移到``template.utils``中 +7. ``template()``方法不支持传入模板直接编译 + +### 升级方法 + +1. 如果想继续使用 js 原生语法作为模板语言,请使用 [template-native.js](https://raw.github.com/aui/artTemplate/master/dist/template-native.js) +2. 查找项目```template.render```替换为```template``` +3. 使用``template.config(name, value)``来替换以前的配置 +4. ``template()``方法直接传入的模板改用``template.compile()``(v2初期版本) + +## 更新日志 + +### v3.1.0 + +1. 修复``template.runder()``方法与文档表现不一致的问题 +2. 去掉鸡肋的``fs.watch``特性 + +### v3.0.3 + +1. 解决``template.helper()``方法传入的数据被转成字符串的问题 #96 +2. 解决``{{value || value2}}``被识别为管道语句的问题 #105 + +### v3.0.2 + +1. ~~解决管道语法必须使用空格分隔的问题~~ + +### v3.0.1 + +1. 适配 express3.x 与 4.x,修复路径 BUG + +### v3.0.0 + +1. 提供 NodeJS 专属版本,支持使用路径加载模板,并且模板的``include``语句也支持相对路径 +2. 适配 [express](http://expressjs.com) 框架 +3. 内置``print``语句支持传入多个参数 +4. 支持全局缓存配置 +5. 简洁语法版支持管道风格的 helper 调用,例如:``{{time | dateFormat:'yyyy年 MM月 dd日 hh:mm:ss'}}`` + +当前版本接口有调整,请阅读 [升级参考](#升级参考) + +> artTemplate 预编译工具 [TmodJS](https://github.com/aui/tmodjs) 已更新 + +### v2.0.4 + +1. 修复低版本安卓浏览器编译后可能产生语法错误的问题(因为此版本浏览器 js 引擎存在 BUG) + +### v2.0.3 + +1. 优化辅助方法性能 +2. NodeJS 用户可以通过 npm 获取 artTemplate:``$ npm install art-template -g`` +3. 不转义输出语句推荐使用``<%=#value%>``(兼容 v2.0.3 版本之前使用的``<%==value%>``),而简版语法则可以使用``{{#value}}`` +4. 提供简版语法的合并版本 dist/[template-simple.js](https://raw.github.com/aui/artTemplate/master/dist/template-simple.js) + +### v2.0.2 + +1. 优化自定义语法扩展,减少体积 +2. [重要]为了最大化兼容第三方库,自定义语法扩展默认界定符修改为``{{``与``}}``。 +3. 修复合并工具的BUG [#25](https://github.com/aui/artTemplate/issues/25) +4. 公开了内部缓存,可以通过``template.cache``访问到编译后的函数 +5. 公开了辅助方法缓存,可以通过``template.helpers``访问到 +6. 优化了调试信息 + +### v2.0.1 + +1. 修复模板变量静态分析的[BUG](https://github.com/aui/artTemplate/pull/22) + +### v2.0 release + +1. ~~编译工具更名为 atc,成为 artTemplate 的子项目单独维护:~~ + +### v2.0 beta5 + +1. 修复编译工具可能存在重复依赖的问题。感谢 @warmhug +2. 修复预编译``include``内部实现可能产生上下文不一致的问题。感谢 @warmhug +3. 编译工具支持使用拖拽文件进行单独编译 + +### v2.0 beta4 + +1. 修复编译工具在压缩模板可能导致 HTML 意外截断的问题。感谢 @warmhug +2. 完善编译工具对``include``支持支持,可以支持不同目录之间模板嵌套 +3. 修复编译工具没能正确处理自定义语法插件的辅助方法 + +### v2.0 beta1 + +1. 对非 String、Number 类型的数据不输出,而 Function 类型求值后输出。 +2. 默认对 html 进行转义输出,原文输出可使用``<%==value%>``(备注:v2.0.3 推荐使用``<%=#value%>``),也可以关闭默认的转义功能``template.defaults.escape = false``。 +3. 增加批处理工具支持把模板编译成不依赖模板引擎的 js 文件,可通过 RequireJS、SeaJS 等模块加载器进行异步加载。 + +## 授权协议 + +Released under the MIT, BSD, and GPL Licenses + +============ + +[所有演示例子](http://aui.github.com/artTemplate/demo/index.html) | [引擎原理](http://cdc.tencent.com/?p=5723) + +© tencent.com diff --git a/public/assets/libs/art-template/demo/basic.html b/public/assets/libs/art-template/demo/basic.html new file mode 100644 index 0000000..8340311 --- /dev/null +++ b/public/assets/libs/art-template/demo/basic.html @@ -0,0 +1,34 @@ + + + + +basic-demo + + + + +
+ + + + + \ No newline at end of file diff --git a/public/assets/libs/art-template/demo/compile.html b/public/assets/libs/art-template/demo/compile.html new file mode 100644 index 0000000..35c682a --- /dev/null +++ b/public/assets/libs/art-template/demo/compile.html @@ -0,0 +1,27 @@ + + + + +compile-demo + + + + +

在javascript中存放模板

+
+ + + \ No newline at end of file diff --git a/public/assets/libs/art-template/demo/debug-syntax.html b/public/assets/libs/art-template/demo/debug-syntax.html new file mode 100644 index 0000000..4dc733a --- /dev/null +++ b/public/assets/libs/art-template/demo/debug-syntax.html @@ -0,0 +1,24 @@ + + + + +debug-demo + + + + +

错误捕获(请打开控制台)

+ + + + + + + + diff --git a/public/assets/libs/art-template/demo/debug.html b/public/assets/libs/art-template/demo/debug.html new file mode 100644 index 0000000..23c1882 --- /dev/null +++ b/public/assets/libs/art-template/demo/debug.html @@ -0,0 +1,29 @@ + + + + +debug-demo + + + + +

错误捕获(请打开控制台)

+ + + + + + + + diff --git a/public/assets/libs/art-template/demo/helper.html b/public/assets/libs/art-template/demo/helper.html new file mode 100644 index 0000000..45530f8 --- /dev/null +++ b/public/assets/libs/art-template/demo/helper.html @@ -0,0 +1,87 @@ + + + + +helper-demo + + + + +

辅助方法

+
+ + + + + + + + diff --git a/public/assets/libs/art-template/demo/include.html b/public/assets/libs/art-template/demo/include.html new file mode 100644 index 0000000..d3dcbb2 --- /dev/null +++ b/public/assets/libs/art-template/demo/include.html @@ -0,0 +1,32 @@ + + + + +include-demo + + + + +
+ + + + + + \ No newline at end of file diff --git a/public/assets/libs/art-template/demo/index.html b/public/assets/libs/art-template/demo/index.html new file mode 100644 index 0000000..20d9e94 --- /dev/null +++ b/public/assets/libs/art-template/demo/index.html @@ -0,0 +1,21 @@ + + + + +demo + + + +

演示

+ + + + diff --git a/public/assets/libs/art-template/demo/no-escape.html b/public/assets/libs/art-template/demo/no-escape.html new file mode 100644 index 0000000..b245b0f --- /dev/null +++ b/public/assets/libs/art-template/demo/no-escape.html @@ -0,0 +1,25 @@ + + + + +no escape-demo + + + + +

不转义HTML

+
+ + + + + \ No newline at end of file diff --git a/public/assets/libs/art-template/demo/node-template-express.js b/public/assets/libs/art-template/demo/node-template-express.js new file mode 100644 index 0000000..0be91db --- /dev/null +++ b/public/assets/libs/art-template/demo/node-template-express.js @@ -0,0 +1,48 @@ +var express = require('express'); +var template = require('../node/template.js'); + + +var app = module.exports = express(); + +template.config('extname', '.html'); +app.engine('.html', template.__express); +app.set('view engine', 'html'); +app.set('views', __dirname + '/node-template'); + + +var demoData = { + title: '国内要闻', + time: (new Date).toString(), + list: [ + { + title: '<油价>调整周期缩至10个工作日 无4%幅度限制', + url: 'http://finance.qq.com/zt2013/2013yj/index.htm' + }, + { + title: '明起汽油价格每吨下调310元 单价回归7元时代', + url: 'http://finance.qq.com/a/20130326/007060.htm' + }, + { + title: '广东副县长疑因抛弃情妇遭6女子围殴 纪检调查', + url: 'http://news.qq.com/a/20130326/001254.htm' + }, + { + title: '湖南27岁副县长回应质疑:父亲已不是领导', + url: 'http://news.qq.com/a/20130326/000959.htm' + }, + { + title: '朝军进入战斗工作状态 称随时准备导弹攻击美国', + url: 'http://news.qq.com/a/20130326/001307.htm' + } + ] +}; + +app.get('/', function(req, res){ + res.render('./index', demoData); +}); + +/* istanbul ignore next */ +if (!module.parent) { + app.listen(3000); + console.log('Express started on port 3000'); +} \ No newline at end of file diff --git a/public/assets/libs/art-template/demo/node-template.js b/public/assets/libs/art-template/demo/node-template.js new file mode 100644 index 0000000..6ca505a --- /dev/null +++ b/public/assets/libs/art-template/demo/node-template.js @@ -0,0 +1,35 @@ +var template = require('../node/template.js'); +//console.log(template); +template.config('base', __dirname);// 设置模板根目录,默认为引擎所在目录 +template.config('compress', true);// 压缩输出 + +var html = template('node-template/index', { + title: '国内要闻', + time: (new Date).toString(), + list: [ + { + title: '<油价>调整周期缩至10个工作日 无4%幅度限制', + url: 'http://finance.qq.com/zt2013/2013yj/index.htm' + }, + { + title: '明起汽油价格每吨下调310元 单价回归7元时代', + url: 'http://finance.qq.com/a/20130326/007060.htm' + }, + { + title: '广东副县长疑因抛弃情妇遭6女子围殴 纪检调查', + url: 'http://news.qq.com/a/20130326/001254.htm' + }, + { + title: '湖南27岁副县长回应质疑:父亲已不是领导', + url: 'http://news.qq.com/a/20130326/000959.htm' + }, + { + title: '朝军进入战斗工作状态 称随时准备导弹攻击美国', + url: 'http://news.qq.com/a/20130326/001307.htm' + } + ] +}); + + +console.log(html); +//console.log(template.cache) \ No newline at end of file diff --git a/public/assets/libs/art-template/demo/node-template/copyright.html b/public/assets/libs/art-template/demo/node-template/copyright.html new file mode 100644 index 0000000..4c65dfa --- /dev/null +++ b/public/assets/libs/art-template/demo/node-template/copyright.html @@ -0,0 +1 @@ +(c) 2013 \ No newline at end of file diff --git a/public/assets/libs/art-template/demo/node-template/index.html b/public/assets/libs/art-template/demo/node-template/index.html new file mode 100644 index 0000000..c259213 --- /dev/null +++ b/public/assets/libs/art-template/demo/node-template/index.html @@ -0,0 +1,12 @@ +{{include './public/header'}} + +
+

{{title}}

+ +
+ +{{include './public/footer'}} \ No newline at end of file diff --git a/public/assets/libs/art-template/demo/node-template/public/footer.html b/public/assets/libs/art-template/demo/node-template/public/footer.html new file mode 100644 index 0000000..956c23e --- /dev/null +++ b/public/assets/libs/art-template/demo/node-template/public/footer.html @@ -0,0 +1,6 @@ + \ No newline at end of file diff --git a/public/assets/libs/art-template/demo/node-template/public/header.html b/public/assets/libs/art-template/demo/node-template/public/header.html new file mode 100644 index 0000000..d93e780 --- /dev/null +++ b/public/assets/libs/art-template/demo/node-template/public/header.html @@ -0,0 +1,11 @@ + + + \ No newline at end of file diff --git a/public/assets/libs/art-template/demo/node-template/public/logo.html b/public/assets/libs/art-template/demo/node-template/public/logo.html new file mode 100644 index 0000000..b02f7cb --- /dev/null +++ b/public/assets/libs/art-template/demo/node-template/public/logo.html @@ -0,0 +1,7 @@ + +

+ + 腾讯网 + +

+ \ No newline at end of file diff --git a/public/assets/libs/art-template/demo/print.html b/public/assets/libs/art-template/demo/print.html new file mode 100644 index 0000000..65f5b2c --- /dev/null +++ b/public/assets/libs/art-template/demo/print.html @@ -0,0 +1,29 @@ + + + + +print-demo + + + + +

print

+ + + + + \ No newline at end of file diff --git a/public/assets/libs/art-template/demo/template-native/basic.html b/public/assets/libs/art-template/demo/template-native/basic.html new file mode 100644 index 0000000..ddf8fde --- /dev/null +++ b/public/assets/libs/art-template/demo/template-native/basic.html @@ -0,0 +1,34 @@ + + + + +basic-demo + + + + +
+ + + + + \ No newline at end of file diff --git a/public/assets/libs/art-template/demo/template-native/compile.html b/public/assets/libs/art-template/demo/template-native/compile.html new file mode 100644 index 0000000..c6fe296 --- /dev/null +++ b/public/assets/libs/art-template/demo/template-native/compile.html @@ -0,0 +1,27 @@ + + + + +compile-demo + + + + +

在javascript中存放模板

+
+ + + \ No newline at end of file diff --git a/public/assets/libs/art-template/demo/template-native/debug-syntax.html b/public/assets/libs/art-template/demo/template-native/debug-syntax.html new file mode 100644 index 0000000..66847d0 --- /dev/null +++ b/public/assets/libs/art-template/demo/template-native/debug-syntax.html @@ -0,0 +1,35 @@ + + + + +debug-demo + + + + +

错误捕获(请打开控制台)

+ + + + + + + + diff --git a/public/assets/libs/art-template/demo/template-native/debug.html b/public/assets/libs/art-template/demo/template-native/debug.html new file mode 100644 index 0000000..d4b4675 --- /dev/null +++ b/public/assets/libs/art-template/demo/template-native/debug.html @@ -0,0 +1,35 @@ + + + + +debug-demo + + + + +

错误捕获(请打开控制台)

+ + + + + + + + diff --git a/public/assets/libs/art-template/demo/template-native/helper.html b/public/assets/libs/art-template/demo/template-native/helper.html new file mode 100644 index 0000000..05e3b7a --- /dev/null +++ b/public/assets/libs/art-template/demo/template-native/helper.html @@ -0,0 +1,76 @@ + + + + +helper-demo + + + + +

辅助方法

+
+ + + + + + + + diff --git a/public/assets/libs/art-template/demo/template-native/include.html b/public/assets/libs/art-template/demo/template-native/include.html new file mode 100644 index 0000000..ded2f8e --- /dev/null +++ b/public/assets/libs/art-template/demo/template-native/include.html @@ -0,0 +1,32 @@ + + + + +include-demo + + + + +
+ + + + + + \ No newline at end of file diff --git a/public/assets/libs/art-template/demo/template-native/index.html b/public/assets/libs/art-template/demo/template-native/index.html new file mode 100644 index 0000000..9ad7294 --- /dev/null +++ b/public/assets/libs/art-template/demo/template-native/index.html @@ -0,0 +1,22 @@ + + + + +demo + + + +

演示

+ + + + diff --git a/public/assets/libs/art-template/demo/template-native/no-escape.html b/public/assets/libs/art-template/demo/template-native/no-escape.html new file mode 100644 index 0000000..810ee6f --- /dev/null +++ b/public/assets/libs/art-template/demo/template-native/no-escape.html @@ -0,0 +1,25 @@ + + + + +no escape-demo + + + + +

不转义HTML

+
+ + + + + \ No newline at end of file diff --git a/public/assets/libs/art-template/demo/template-native/print.html b/public/assets/libs/art-template/demo/template-native/print.html new file mode 100644 index 0000000..75047eb --- /dev/null +++ b/public/assets/libs/art-template/demo/template-native/print.html @@ -0,0 +1,30 @@ + + + + +print-demo + + + + +

print

+ + + + + \ No newline at end of file diff --git a/public/assets/libs/art-template/demo/template-native/tag.html b/public/assets/libs/art-template/demo/template-native/tag.html new file mode 100644 index 0000000..afd0601 --- /dev/null +++ b/public/assets/libs/art-template/demo/template-native/tag.html @@ -0,0 +1,42 @@ + + + + +tag-demo + + + + +

自定义界定符

+ + + + + \ No newline at end of file diff --git a/public/assets/libs/art-template/dist/template-debug.js b/public/assets/libs/art-template/dist/template-debug.js new file mode 100644 index 0000000..9403bef --- /dev/null +++ b/public/assets/libs/art-template/dist/template-debug.js @@ -0,0 +1,739 @@ +/*! + * artTemplate - Template Engine + * https://github.com/aui/artTemplate + * Released under the MIT, BSD, and GPL Licenses + */ + +!(function () { + + +/** + * 模板引擎 + * @name template + * @param {String} 模板名 + * @param {Object, String} 数据。如果为字符串则编译并缓存编译结果 + * @return {String, Function} 渲染好的HTML字符串或者渲染方法 + */ +var template = function (filename, content) { + return typeof content === 'string' + ? compile(content, { + filename: filename + }) + : renderFile(filename, content); +}; + + +template.version = '3.0.0'; + + +/** + * 设置全局配置 + * @name template.config + * @param {String} 名称 + * @param {Any} 值 + */ +template.config = function (name, value) { + defaults[name] = value; +}; + + + +var defaults = template.defaults = { + openTag: '<%', // 逻辑语法开始标签 + closeTag: '%>', // 逻辑语法结束标签 + escape: true, // 是否编码输出变量的 HTML 字符 + cache: true, // 是否开启缓存(依赖 options 的 filename 字段) + compress: false, // 是否压缩输出 + parser: null // 自定义语法格式器 @see: template-syntax.js +}; + + +var cacheStore = template.cache = {}; + + +/** + * 渲染模板 + * @name template.render + * @param {String} 模板 + * @param {Object} 数据 + * @return {String} 渲染好的字符串 + */ +template.render = function (source, options) { + return compile(source)(options); +}; + + +/** + * 渲染模板(根据模板名) + * @name template.render + * @param {String} 模板名 + * @param {Object} 数据 + * @return {String} 渲染好的字符串 + */ +var renderFile = template.renderFile = function (filename, data) { + var fn = template.get(filename) || showDebugInfo({ + filename: filename, + name: 'Render Error', + message: 'Template not found' + }); + return data ? fn(data) : fn; +}; + + +/** + * 获取编译缓存(可由外部重写此方法) + * @param {String} 模板名 + * @param {Function} 编译好的函数 + */ +template.get = function (filename) { + + var cache; + + if (cacheStore[filename]) { + // 使用内存缓存 + cache = cacheStore[filename]; + } else if (typeof document === 'object') { + // 加载模板并编译 + var elem = document.getElementById(filename); + + if (elem) { + var source = (elem.value || elem.innerHTML) + .replace(/^\s*|\s*$/g, ''); + cache = compile(source, { + filename: filename + }); + } + } + + return cache; +}; + + +var toString = function (value, type) { + + if (typeof value !== 'string') { + + type = typeof value; + if (type === 'number') { + value += ''; + } else if (type === 'function') { + value = toString(value.call(value)); + } else { + value = ''; + } + } + + return value; + +}; + + +var escapeMap = { + "<": "<", + ">": ">", + '"': """, + "'": "'", + "&": "&" +}; + + +var escapeFn = function (s) { + return escapeMap[s]; +}; + +var escapeHTML = function (content) { + return toString(content) + .replace(/&(?![\w#]+;)|[<>"']/g, escapeFn); +}; + + +var isArray = Array.isArray || function (obj) { + return ({}).toString.call(obj) === '[object Array]'; +}; + + +var each = function (data, callback) { + var i, len; + if (isArray(data)) { + for (i = 0, len = data.length; i < len; i++) { + callback.call(data, data[i], i, data); + } + } else { + for (i in data) { + callback.call(data, data[i], i); + } + } +}; + + +var utils = template.utils = { + + $helpers: {}, + + $include: renderFile, + + $string: toString, + + $escape: escapeHTML, + + $each: each + +};/** + * 添加模板辅助方法 + * @name template.helper + * @param {String} 名称 + * @param {Function} 方法 + */ +template.helper = function (name, helper) { + helpers[name] = helper; +}; + +var helpers = template.helpers = utils.$helpers; + + + + +/** + * 模板错误事件(可由外部重写此方法) + * @name template.onerror + * @event + */ +template.onerror = function (e) { + var message = 'Template Error\n\n'; + for (var name in e) { + message += '<' + name + '>\n' + e[name] + '\n\n'; + } + + if (typeof console === 'object') { + console.error(message); + } +}; + + +// 模板调试器 +var showDebugInfo = function (e) { + + template.onerror(e); + + return function () { + return '{Template Error}'; + }; +}; + + +/** + * 编译模板 + * 2012-6-6 @TooBug: define 方法名改为 compile,与 Node Express 保持一致 + * @name template.compile + * @param {String} 模板字符串 + * @param {Object} 编译选项 + * + * - openTag {String} + * - closeTag {String} + * - filename {String} + * - escape {Boolean} + * - compress {Boolean} + * - debug {Boolean} + * - cache {Boolean} + * - parser {Function} + * + * @return {Function} 渲染方法 + */ +var compile = template.compile = function (source, options) { + + // 合并默认配置 + options = options || {}; + for (var name in defaults) { + if (options[name] === undefined) { + options[name] = defaults[name]; + } + } + + + var filename = options.filename; + + + try { + + var Render = compiler(source, options); + + } catch (e) { + + e.filename = filename || 'anonymous'; + e.name = 'Syntax Error'; + + return showDebugInfo(e); + + } + + + // 对编译结果进行一次包装 + + function render (data) { + + try { + + return new Render(data, filename) + ''; + + } catch (e) { + + // 运行时出错后自动开启调试模式重新编译 + if (!options.debug) { + options.debug = true; + return compile(source, options)(data); + } + + return showDebugInfo(e)(); + + } + + } + + + render.prototype = Render.prototype; + render.toString = function () { + return Render.toString(); + }; + + + if (filename && options.cache) { + cacheStore[filename] = render; + } + + + return render; + +}; + + + + +// 数组迭代 +var forEach = utils.$each; + + +// 静态分析模板变量 +var KEYWORDS = + // 关键字 + 'break,case,catch,continue,debugger,default,delete,do,else,false' + + ',finally,for,function,if,in,instanceof,new,null,return,switch,this' + + ',throw,true,try,typeof,var,void,while,with' + + // 保留字 + + ',abstract,boolean,byte,char,class,const,double,enum,export,extends' + + ',final,float,goto,implements,import,int,interface,long,native' + + ',package,private,protected,public,short,static,super,synchronized' + + ',throws,transient,volatile' + + // ECMA 5 - use strict + + ',arguments,let,yield' + + + ',undefined'; + +var REMOVE_RE = /\/\*[\w\W]*?\*\/|\/\/[^\n]*\n|\/\/[^\n]*$|"(?:[^"\\]|\\[\w\W])*"|'(?:[^'\\]|\\[\w\W])*'|\s*\.\s*[$\w\.]+/g; +var SPLIT_RE = /[^\w$]+/g; +var KEYWORDS_RE = new RegExp(["\\b" + KEYWORDS.replace(/,/g, '\\b|\\b') + "\\b"].join('|'), 'g'); +var NUMBER_RE = /^\d[^,]*|,\d[^,]*/g; +var BOUNDARY_RE = /^,+|,+$/g; +var SPLIT2_RE = /^$|,+/; + + +// 获取变量 +function getVariable (code) { + return code + .replace(REMOVE_RE, '') + .replace(SPLIT_RE, ',') + .replace(KEYWORDS_RE, '') + .replace(NUMBER_RE, '') + .replace(BOUNDARY_RE, '') + .split(SPLIT2_RE); +}; + + +// 字符串转义 +function stringify (code) { + return "'" + code + // 单引号与反斜杠转义 + .replace(/('|\\)/g, '\\$1') + // 换行符转义(windows + linux) + .replace(/\r/g, '\\r') + .replace(/\n/g, '\\n') + "'"; +} + + +function compiler (source, options) { + + var debug = options.debug; + var openTag = options.openTag; + var closeTag = options.closeTag; + var parser = options.parser; + var compress = options.compress; + var escape = options.escape; + + + + var line = 1; + var uniq = {$data:1,$filename:1,$utils:1,$helpers:1,$out:1,$line:1}; + + + + var isNewEngine = ''.trim;// '__proto__' in {} + var replaces = isNewEngine + ? ["$out='';", "$out+=", ";", "$out"] + : ["$out=[];", "$out.push(", ");", "$out.join('')"]; + + var concat = isNewEngine + ? "$out+=text;return $out;" + : "$out.push(text);"; + + var print = "function(){" + + "var text=''.concat.apply('',arguments);" + + concat + + "}"; + + var include = "function(filename,data){" + + "data=data||$data;" + + "var text=$utils.$include(filename,data,$filename);" + + concat + + "}"; + + var headerCode = "'use strict';" + + "var $utils=this,$helpers=$utils.$helpers," + + (debug ? "$line=0," : ""); + + var mainCode = replaces[0]; + + var footerCode = "return new String(" + replaces[3] + ");" + + // html与逻辑语法分离 + forEach(source.split(openTag), function (code) { + code = code.split(closeTag); + + var $0 = code[0]; + var $1 = code[1]; + + // code: [html] + if (code.length === 1) { + + mainCode += html($0); + + // code: [logic, html] + } else { + + mainCode += logic($0); + + if ($1) { + mainCode += html($1); + } + } + + + }); + + var code = headerCode + mainCode + footerCode; + + // 调试语句 + if (debug) { + code = "try{" + code + "}catch(e){" + + "throw {" + + "filename:$filename," + + "name:'Render Error'," + + "message:e.message," + + "line:$line," + + "source:" + stringify(source) + + ".split(/\\n/)[$line-1].replace(/^\\s+/,'')" + + "};" + + "}"; + } + + + + try { + + + var Render = new Function("$data", "$filename", code); + Render.prototype = utils; + + return Render; + + } catch (e) { + e.temp = "function anonymous($data,$filename) {" + code + "}"; + throw e; + } + + + + + // 处理 HTML 语句 + function html (code) { + + // 记录行号 + line += code.split(/\n/).length - 1; + + // 压缩多余空白与注释 + if (compress) { + code = code + .replace(/\s+/g, ' ') + .replace(//g, ''); + } + + if (code) { + code = replaces[1] + stringify(code) + replaces[2] + "\n"; + } + + return code; + } + + + // 处理逻辑语句 + function logic (code) { + + var thisLine = line; + + if (parser) { + + // 语法转换插件钩子 + code = parser(code, options); + + } else if (debug) { + + // 记录行号 + code = code.replace(/\n/g, function () { + line ++; + return "$line=" + line + ";"; + }); + + } + + + // 输出语句. 编码: <%=value%> 不编码:<%=#value%> + // <%=#value%> 等同 v2.0.3 之前的 <%==value%> + if (code.indexOf('=') === 0) { + + var escapeSyntax = escape && !/^=[=#]/.test(code); + + code = code.replace(/^=[=#]?|[\s;]*$/g, ''); + + // 对内容编码 + if (escapeSyntax) { + + var name = code.replace(/\s*\([^\)]+\)/, ''); + + // 排除 utils.* | include | print + + if (!utils[name] && !/^(include|print)$/.test(name)) { + code = "$escape(" + code + ")"; + } + + // 不编码 + } else { + code = "$string(" + code + ")"; + } + + + code = replaces[1] + code + replaces[2]; + + } + + if (debug) { + code = "$line=" + thisLine + ";" + code; + } + + // 提取模板中的变量名 + forEach(getVariable(code), function (name) { + + // name 值可能为空,在安卓低版本浏览器下 + if (!name || uniq[name]) { + return; + } + + var value; + + // 声明模板变量 + // 赋值优先级: + // [include, print] > utils > helpers > data + if (name === 'print') { + + value = print; + + } else if (name === 'include') { + + value = include; + + } else if (utils[name]) { + + value = "$utils." + name; + + } else if (helpers[name]) { + + value = "$helpers." + name; + + } else { + + value = "$data." + name; + } + + headerCode += name + "=" + value + ","; + uniq[name] = true; + + + }); + + return code + "\n"; + } + + +}; + + + +// 定义模板引擎的语法 + + +defaults.openTag = '{{'; +defaults.closeTag = '}}'; + + +var filtered = function (js, filter) { + var parts = filter.split(':'); + var name = parts.shift(); + var args = parts.join(':') || ''; + + if (args) { + args = ', ' + args; + } + + return '$helpers.' + name + '(' + js + args + ')'; +} + + +defaults.parser = function (code, options) { + + // var match = code.match(/([\w\$]*)(\b.*)/); + // var key = match[1]; + // var args = match[2]; + // var split = args.split(' '); + // split.shift(); + + code = code.replace(/^\s/, ''); + + var split = code.split(' '); + var key = split.shift(); + var args = split.join(' '); + + + + switch (key) { + + case 'if': + + code = 'if(' + args + '){'; + break; + + case 'else': + + if (split.shift() === 'if') { + split = ' if(' + split.join(' ') + ')'; + } else { + split = ''; + } + + code = '}else' + split + '{'; + break; + + case '/if': + + code = '}'; + break; + + case 'each': + + var object = split[0] || '$data'; + var as = split[1] || 'as'; + var value = split[2] || '$value'; + var index = split[3] || '$index'; + + var param = value + ',' + index; + + if (as !== 'as') { + object = '[]'; + } + + code = '$each(' + object + ',function(' + param + '){'; + break; + + case '/each': + + code = '});'; + break; + + case 'echo': + + code = 'print(' + args + ');'; + break; + + case 'print': + case 'include': + + code = key + '(' + split.join(',') + ');'; + break; + + default: + + // 过滤器(辅助方法) + // {{value | filterA:'abcd' | filterB}} + // >>> $helpers.filterB($helpers.filterA(value, 'abcd')) + // TODO: {{ddd||aaa}} 不包含空格 + if (/^\s*\|\s*[\w\$]/.test(args)) { + + var escape = true; + + // {{#value | link}} + if (code.indexOf('#') === 0) { + code = code.substr(1); + escape = false; + } + + var i = 0; + var array = code.split('|'); + var len = array.length; + var val = array[i++]; + + for (; i < len; i ++) { + val = filtered(val, array[i]); + } + + code = (escape ? '=' : '=#') + val; + + // 即将弃用 {{helperName value}} + } else if (template.helpers[key]) { + + code = '=#' + key + '(' + split.join(',') + ');'; + + // 内容直接输出 {{value}} + } else { + + code = '=' + code; + } + + break; + } + + + return code; +}; + + +// CommonJs +if (typeof exports === 'object' && typeof module !== 'undefined') { + module.exports = template; +// RequireJS && SeaJS +} else if (typeof define === 'function') { + define(function() { + return template; + }); +} else { + this.template = template; +} + +})(); diff --git a/public/assets/libs/art-template/dist/template-native-debug.js b/public/assets/libs/art-template/dist/template-native-debug.js new file mode 100644 index 0000000..cfdf124 --- /dev/null +++ b/public/assets/libs/art-template/dist/template-native-debug.js @@ -0,0 +1,602 @@ +/*! + * artTemplate - Template Engine + * https://github.com/aui/artTemplate + * Released under the MIT, BSD, and GPL Licenses + */ + +!(function () { + + +/** + * 模板引擎 + * @name template + * @param {String} 模板名 + * @param {Object, String} 数据。如果为字符串则编译并缓存编译结果 + * @return {String, Function} 渲染好的HTML字符串或者渲染方法 + */ +var template = function (filename, content) { + return typeof content === 'string' + ? compile(content, { + filename: filename + }) + : renderFile(filename, content); +}; + + +template.version = '3.0.0'; + + +/** + * 设置全局配置 + * @name template.config + * @param {String} 名称 + * @param {Any} 值 + */ +template.config = function (name, value) { + defaults[name] = value; +}; + + + +var defaults = template.defaults = { + openTag: '<%', // 逻辑语法开始标签 + closeTag: '%>', // 逻辑语法结束标签 + escape: true, // 是否编码输出变量的 HTML 字符 + cache: true, // 是否开启缓存(依赖 options 的 filename 字段) + compress: false, // 是否压缩输出 + parser: null // 自定义语法格式器 @see: template-syntax.js +}; + + +var cacheStore = template.cache = {}; + + +/** + * 渲染模板 + * @name template.render + * @param {String} 模板 + * @param {Object} 数据 + * @return {String} 渲染好的字符串 + */ +template.render = function (source, options) { + return compile(source)(options); +}; + + +/** + * 渲染模板(根据模板名) + * @name template.render + * @param {String} 模板名 + * @param {Object} 数据 + * @return {String} 渲染好的字符串 + */ +var renderFile = template.renderFile = function (filename, data) { + var fn = template.get(filename) || showDebugInfo({ + filename: filename, + name: 'Render Error', + message: 'Template not found' + }); + return data ? fn(data) : fn; +}; + + +/** + * 获取编译缓存(可由外部重写此方法) + * @param {String} 模板名 + * @param {Function} 编译好的函数 + */ +template.get = function (filename) { + + var cache; + + if (cacheStore[filename]) { + // 使用内存缓存 + cache = cacheStore[filename]; + } else if (typeof document === 'object') { + // 加载模板并编译 + var elem = document.getElementById(filename); + + if (elem) { + var source = (elem.value || elem.innerHTML) + .replace(/^\s*|\s*$/g, ''); + cache = compile(source, { + filename: filename + }); + } + } + + return cache; +}; + + +var toString = function (value, type) { + + if (typeof value !== 'string') { + + type = typeof value; + if (type === 'number') { + value += ''; + } else if (type === 'function') { + value = toString(value.call(value)); + } else { + value = ''; + } + } + + return value; + +}; + + +var escapeMap = { + "<": "<", + ">": ">", + '"': """, + "'": "'", + "&": "&" +}; + + +var escapeFn = function (s) { + return escapeMap[s]; +}; + +var escapeHTML = function (content) { + return toString(content) + .replace(/&(?![\w#]+;)|[<>"']/g, escapeFn); +}; + + +var isArray = Array.isArray || function (obj) { + return ({}).toString.call(obj) === '[object Array]'; +}; + + +var each = function (data, callback) { + var i, len; + if (isArray(data)) { + for (i = 0, len = data.length; i < len; i++) { + callback.call(data, data[i], i, data); + } + } else { + for (i in data) { + callback.call(data, data[i], i); + } + } +}; + + +var utils = template.utils = { + + $helpers: {}, + + $include: renderFile, + + $string: toString, + + $escape: escapeHTML, + + $each: each + +};/** + * 添加模板辅助方法 + * @name template.helper + * @param {String} 名称 + * @param {Function} 方法 + */ +template.helper = function (name, helper) { + helpers[name] = helper; +}; + +var helpers = template.helpers = utils.$helpers; + + + + +/** + * 模板错误事件(可由外部重写此方法) + * @name template.onerror + * @event + */ +template.onerror = function (e) { + var message = 'Template Error\n\n'; + for (var name in e) { + message += '<' + name + '>\n' + e[name] + '\n\n'; + } + + if (typeof console === 'object') { + console.error(message); + } +}; + + +// 模板调试器 +var showDebugInfo = function (e) { + + template.onerror(e); + + return function () { + return '{Template Error}'; + }; +}; + + +/** + * 编译模板 + * 2012-6-6 @TooBug: define 方法名改为 compile,与 Node Express 保持一致 + * @name template.compile + * @param {String} 模板字符串 + * @param {Object} 编译选项 + * + * - openTag {String} + * - closeTag {String} + * - filename {String} + * - escape {Boolean} + * - compress {Boolean} + * - debug {Boolean} + * - cache {Boolean} + * - parser {Function} + * + * @return {Function} 渲染方法 + */ +var compile = template.compile = function (source, options) { + + // 合并默认配置 + options = options || {}; + for (var name in defaults) { + if (options[name] === undefined) { + options[name] = defaults[name]; + } + } + + + var filename = options.filename; + + + try { + + var Render = compiler(source, options); + + } catch (e) { + + e.filename = filename || 'anonymous'; + e.name = 'Syntax Error'; + + return showDebugInfo(e); + + } + + + // 对编译结果进行一次包装 + + function render (data) { + + try { + + return new Render(data, filename) + ''; + + } catch (e) { + + // 运行时出错后自动开启调试模式重新编译 + if (!options.debug) { + options.debug = true; + return compile(source, options)(data); + } + + return showDebugInfo(e)(); + + } + + } + + + render.prototype = Render.prototype; + render.toString = function () { + return Render.toString(); + }; + + + if (filename && options.cache) { + cacheStore[filename] = render; + } + + + return render; + +}; + + + + +// 数组迭代 +var forEach = utils.$each; + + +// 静态分析模板变量 +var KEYWORDS = + // 关键字 + 'break,case,catch,continue,debugger,default,delete,do,else,false' + + ',finally,for,function,if,in,instanceof,new,null,return,switch,this' + + ',throw,true,try,typeof,var,void,while,with' + + // 保留字 + + ',abstract,boolean,byte,char,class,const,double,enum,export,extends' + + ',final,float,goto,implements,import,int,interface,long,native' + + ',package,private,protected,public,short,static,super,synchronized' + + ',throws,transient,volatile' + + // ECMA 5 - use strict + + ',arguments,let,yield' + + + ',undefined'; + +var REMOVE_RE = /\/\*[\w\W]*?\*\/|\/\/[^\n]*\n|\/\/[^\n]*$|"(?:[^"\\]|\\[\w\W])*"|'(?:[^'\\]|\\[\w\W])*'|\s*\.\s*[$\w\.]+/g; +var SPLIT_RE = /[^\w$]+/g; +var KEYWORDS_RE = new RegExp(["\\b" + KEYWORDS.replace(/,/g, '\\b|\\b') + "\\b"].join('|'), 'g'); +var NUMBER_RE = /^\d[^,]*|,\d[^,]*/g; +var BOUNDARY_RE = /^,+|,+$/g; +var SPLIT2_RE = /^$|,+/; + + +// 获取变量 +function getVariable (code) { + return code + .replace(REMOVE_RE, '') + .replace(SPLIT_RE, ',') + .replace(KEYWORDS_RE, '') + .replace(NUMBER_RE, '') + .replace(BOUNDARY_RE, '') + .split(SPLIT2_RE); +}; + + +// 字符串转义 +function stringify (code) { + return "'" + code + // 单引号与反斜杠转义 + .replace(/('|\\)/g, '\\$1') + // 换行符转义(windows + linux) + .replace(/\r/g, '\\r') + .replace(/\n/g, '\\n') + "'"; +} + + +function compiler (source, options) { + + var debug = options.debug; + var openTag = options.openTag; + var closeTag = options.closeTag; + var parser = options.parser; + var compress = options.compress; + var escape = options.escape; + + + + var line = 1; + var uniq = {$data:1,$filename:1,$utils:1,$helpers:1,$out:1,$line:1}; + + + + var isNewEngine = ''.trim;// '__proto__' in {} + var replaces = isNewEngine + ? ["$out='';", "$out+=", ";", "$out"] + : ["$out=[];", "$out.push(", ");", "$out.join('')"]; + + var concat = isNewEngine + ? "$out+=text;return $out;" + : "$out.push(text);"; + + var print = "function(){" + + "var text=''.concat.apply('',arguments);" + + concat + + "}"; + + var include = "function(filename,data){" + + "data=data||$data;" + + "var text=$utils.$include(filename,data,$filename);" + + concat + + "}"; + + var headerCode = "'use strict';" + + "var $utils=this,$helpers=$utils.$helpers," + + (debug ? "$line=0," : ""); + + var mainCode = replaces[0]; + + var footerCode = "return new String(" + replaces[3] + ");" + + // html与逻辑语法分离 + forEach(source.split(openTag), function (code) { + code = code.split(closeTag); + + var $0 = code[0]; + var $1 = code[1]; + + // code: [html] + if (code.length === 1) { + + mainCode += html($0); + + // code: [logic, html] + } else { + + mainCode += logic($0); + + if ($1) { + mainCode += html($1); + } + } + + + }); + + var code = headerCode + mainCode + footerCode; + + // 调试语句 + if (debug) { + code = "try{" + code + "}catch(e){" + + "throw {" + + "filename:$filename," + + "name:'Render Error'," + + "message:e.message," + + "line:$line," + + "source:" + stringify(source) + + ".split(/\\n/)[$line-1].replace(/^\\s+/,'')" + + "};" + + "}"; + } + + + + try { + + + var Render = new Function("$data", "$filename", code); + Render.prototype = utils; + + return Render; + + } catch (e) { + e.temp = "function anonymous($data,$filename) {" + code + "}"; + throw e; + } + + + + + // 处理 HTML 语句 + function html (code) { + + // 记录行号 + line += code.split(/\n/).length - 1; + + // 压缩多余空白与注释 + if (compress) { + code = code + .replace(/\s+/g, ' ') + .replace(//g, ''); + } + + if (code) { + code = replaces[1] + stringify(code) + replaces[2] + "\n"; + } + + return code; + } + + + // 处理逻辑语句 + function logic (code) { + + var thisLine = line; + + if (parser) { + + // 语法转换插件钩子 + code = parser(code, options); + + } else if (debug) { + + // 记录行号 + code = code.replace(/\n/g, function () { + line ++; + return "$line=" + line + ";"; + }); + + } + + + // 输出语句. 编码: <%=value%> 不编码:<%=#value%> + // <%=#value%> 等同 v2.0.3 之前的 <%==value%> + if (code.indexOf('=') === 0) { + + var escapeSyntax = escape && !/^=[=#]/.test(code); + + code = code.replace(/^=[=#]?|[\s;]*$/g, ''); + + // 对内容编码 + if (escapeSyntax) { + + var name = code.replace(/\s*\([^\)]+\)/, ''); + + // 排除 utils.* | include | print + + if (!utils[name] && !/^(include|print)$/.test(name)) { + code = "$escape(" + code + ")"; + } + + // 不编码 + } else { + code = "$string(" + code + ")"; + } + + + code = replaces[1] + code + replaces[2]; + + } + + if (debug) { + code = "$line=" + thisLine + ";" + code; + } + + // 提取模板中的变量名 + forEach(getVariable(code), function (name) { + + // name 值可能为空,在安卓低版本浏览器下 + if (!name || uniq[name]) { + return; + } + + var value; + + // 声明模板变量 + // 赋值优先级: + // [include, print] > utils > helpers > data + if (name === 'print') { + + value = print; + + } else if (name === 'include') { + + value = include; + + } else if (utils[name]) { + + value = "$utils." + name; + + } else if (helpers[name]) { + + value = "$helpers." + name; + + } else { + + value = "$data." + name; + } + + headerCode += name + "=" + value + ","; + uniq[name] = true; + + + }); + + return code + "\n"; + } + + +}; + + + +// CommonJs +if (typeof exports === 'object' && typeof module !== 'undefined') { + module.exports = template; +// RequireJS && SeaJS +} else if (typeof define === 'function') { + define(function() { + return template; + }); +} else { + this.template = template; +} + +})(); diff --git a/public/assets/libs/art-template/dist/template-native.js b/public/assets/libs/art-template/dist/template-native.js new file mode 100644 index 0000000..1944fdc --- /dev/null +++ b/public/assets/libs/art-template/dist/template-native.js @@ -0,0 +1,2 @@ +/*!art-template - Template Engine | http://aui.github.com/artTemplate/*/ +!function(){function a(a){return a.replace(t,"").replace(u,",").replace(v,"").replace(w,"").replace(x,"").split(y)}function b(a){return"'"+a.replace(/('|\\)/g,"\\$1").replace(/\r/g,"\\r").replace(/\n/g,"\\n")+"'"}function c(c,d){function e(a){return m+=a.split(/\n/).length-1,k&&(a=a.replace(/\s+/g," ").replace(//g,"")),a&&(a=s[1]+b(a)+s[2]+"\n"),a}function f(b){var c=m;if(j?b=j(b,d):g&&(b=b.replace(/\n/g,function(){return m++,"$line="+m+";"})),0===b.indexOf("=")){var e=l&&!/^=[=#]/.test(b);if(b=b.replace(/^=[=#]?|[\s;]*$/g,""),e){var f=b.replace(/\s*\([^\)]+\)/,"");n[f]||/^(include|print)$/.test(f)||(b="$escape("+b+")")}else b="$string("+b+")";b=s[1]+b+s[2]}return g&&(b="$line="+c+";"+b),r(a(b),function(a){if(a&&!p[a]){var b;b="print"===a?u:"include"===a?v:n[a]?"$utils."+a:o[a]?"$helpers."+a:"$data."+a,w+=a+"="+b+",",p[a]=!0}}),b+"\n"}var g=d.debug,h=d.openTag,i=d.closeTag,j=d.parser,k=d.compress,l=d.escape,m=1,p={$data:1,$filename:1,$utils:1,$helpers:1,$out:1,$line:1},q="".trim,s=q?["$out='';","$out+=",";","$out"]:["$out=[];","$out.push(",");","$out.join('')"],t=q?"$out+=text;return $out;":"$out.push(text);",u="function(){var text=''.concat.apply('',arguments);"+t+"}",v="function(filename,data){data=data||$data;var text=$utils.$include(filename,data,$filename);"+t+"}",w="'use strict';var $utils=this,$helpers=$utils.$helpers,"+(g?"$line=0,":""),x=s[0],y="return new String("+s[3]+");";r(c.split(h),function(a){a=a.split(i);var b=a[0],c=a[1];1===a.length?x+=e(b):(x+=f(b),c&&(x+=e(c)))});var z=w+x+y;g&&(z="try{"+z+"}catch(e){throw {filename:$filename,name:'Render Error',message:e.message,line:$line,source:"+b(c)+".split(/\\n/)[$line-1].replace(/^\\s+/,'')};}");try{var A=new Function("$data","$filename",z);return A.prototype=n,A}catch(a){throw a.temp="function anonymous($data,$filename) {"+z+"}",a}}var d=function(a,b){return"string"==typeof b?q(b,{filename:a}):g(a,b)};d.version="3.0.0",d.config=function(a,b){e[a]=b};var e=d.defaults={openTag:"<%",closeTag:"%>",escape:!0,cache:!0,compress:!1,parser:null},f=d.cache={};d.render=function(a,b){return q(a)(b)};var g=d.renderFile=function(a,b){var c=d.get(a)||p({filename:a,name:"Render Error",message:"Template not found"});return b?c(b):c};d.get=function(a){var b;if(f[a])b=f[a];else if("object"==typeof document){var c=document.getElementById(a);if(c){var d=(c.value||c.innerHTML).replace(/^\s*|\s*$/g,"");b=q(d,{filename:a})}}return b};var h=function(a,b){return"string"!=typeof a&&(b=typeof a,"number"===b?a+="":a="function"===b?h(a.call(a)):""),a},i={"<":"<",">":">",'"':""","'":"'","&":"&"},j=function(a){return i[a]},k=function(a){return h(a).replace(/&(?![\w#]+;)|[<>"']/g,j)},l=Array.isArray||function(a){return"[object Array]"==={}.toString.call(a)},m=function(a,b){var c,d;if(l(a))for(c=0,d=a.length;c\n"+a[c]+"\n\n";"object"==typeof console&&console.error(b)};var p=function(a){return d.onerror(a),function(){return"{Template Error}"}},q=d.compile=function(a,b){function d(c){try{return new i(c,h)+""}catch(d){return b.debug?p(d)():(b.debug=!0,q(a,b)(c))}}b=b||{};for(var g in e)void 0===b[g]&&(b[g]=e[g]);var h=b.filename;try{var i=c(a,b)}catch(a){return a.filename=h||"anonymous",a.name="Syntax Error",p(a)}return d.prototype=i.prototype,d.toString=function(){return i.toString()},h&&b.cache&&(f[h]=d),d},r=n.$each,s="break,case,catch,continue,debugger,default,delete,do,else,false,finally,for,function,if,in,instanceof,new,null,return,switch,this,throw,true,try,typeof,var,void,while,with,abstract,boolean,byte,char,class,const,double,enum,export,extends,final,float,goto,implements,import,int,interface,long,native,package,private,protected,public,short,static,super,synchronized,throws,transient,volatile,arguments,let,yield,undefined",t=/\/\*[\w\W]*?\*\/|\/\/[^\n]*\n|\/\/[^\n]*$|"(?:[^"\\]|\\[\w\W])*"|'(?:[^'\\]|\\[\w\W])*'|\s*\.\s*[$\w\.]+/g,u=/[^\w$]+/g,v=new RegExp(["\\b"+s.replace(/,/g,"\\b|\\b")+"\\b"].join("|"),"g"),w=/^\d[^,]*|,\d[^,]*/g,x=/^,+|,+$/g,y=/^$|,+/;"object"==typeof exports&&"undefined"!=typeof module?module.exports=d:"function"==typeof define?define(function(){return d}):this.template=d}(); \ No newline at end of file diff --git a/public/assets/libs/art-template/dist/template.js b/public/assets/libs/art-template/dist/template.js new file mode 100644 index 0000000..9e3ab27 --- /dev/null +++ b/public/assets/libs/art-template/dist/template.js @@ -0,0 +1,2 @@ +/*!art-template - Template Engine | http://aui.github.com/artTemplate/*/ +!function(){function a(a){return a.replace(t,"").replace(u,",").replace(v,"").replace(w,"").replace(x,"").split(y)}function b(a){return"'"+a.replace(/('|\\)/g,"\\$1").replace(/\r/g,"\\r").replace(/\n/g,"\\n")+"'"}function c(c,d){function e(a){return m+=a.split(/\n/).length-1,k&&(a=a.replace(/\s+/g," ").replace(//g,"")),a&&(a=s[1]+b(a)+s[2]+"\n"),a}function f(b){var c=m;if(j?b=j(b,d):g&&(b=b.replace(/\n/g,function(){return m++,"$line="+m+";"})),0===b.indexOf("=")){var e=l&&!/^=[=#]/.test(b);if(b=b.replace(/^=[=#]?|[\s;]*$/g,""),e){var f=b.replace(/\s*\([^\)]+\)/,"");n[f]||/^(include|print)$/.test(f)||(b="$escape("+b+")")}else b="$string("+b+")";b=s[1]+b+s[2]}return g&&(b="$line="+c+";"+b),r(a(b),function(a){if(a&&!p[a]){var b;b="print"===a?u:"include"===a?v:n[a]?"$utils."+a:o[a]?"$helpers."+a:"$data."+a,w+=a+"="+b+",",p[a]=!0}}),b+"\n"}var g=d.debug,h=d.openTag,i=d.closeTag,j=d.parser,k=d.compress,l=d.escape,m=1,p={$data:1,$filename:1,$utils:1,$helpers:1,$out:1,$line:1},q="".trim,s=q?["$out='';","$out+=",";","$out"]:["$out=[];","$out.push(",");","$out.join('')"],t=q?"$out+=text;return $out;":"$out.push(text);",u="function(){var text=''.concat.apply('',arguments);"+t+"}",v="function(filename,data){data=data||$data;var text=$utils.$include(filename,data,$filename);"+t+"}",w="'use strict';var $utils=this,$helpers=$utils.$helpers,"+(g?"$line=0,":""),x=s[0],y="return new String("+s[3]+");";r(c.split(h),function(a){a=a.split(i);var b=a[0],c=a[1];1===a.length?x+=e(b):(x+=f(b),c&&(x+=e(c)))});var z=w+x+y;g&&(z="try{"+z+"}catch(e){throw {filename:$filename,name:'Render Error',message:e.message,line:$line,source:"+b(c)+".split(/\\n/)[$line-1].replace(/^\\s+/,'')};}");try{var A=new Function("$data","$filename",z);return A.prototype=n,A}catch(a){throw a.temp="function anonymous($data,$filename) {"+z+"}",a}}var d=function(a,b){return"string"==typeof b?q(b,{filename:a}):g(a,b)};d.version="3.0.0",d.config=function(a,b){e[a]=b};var e=d.defaults={openTag:"<%",closeTag:"%>",escape:!0,cache:!0,compress:!1,parser:null},f=d.cache={};d.render=function(a,b){return q(a)(b)};var g=d.renderFile=function(a,b){var c=d.get(a)||p({filename:a,name:"Render Error",message:"Template not found"});return b?c(b):c};d.get=function(a){var b;if(f[a])b=f[a];else if("object"==typeof document){var c=document.getElementById(a);if(c){var d=(c.value||c.innerHTML).replace(/^\s*|\s*$/g,"");b=q(d,{filename:a})}}return b};var h=function(a,b){return"string"!=typeof a&&(b=typeof a,"number"===b?a+="":a="function"===b?h(a.call(a)):""),a},i={"<":"<",">":">",'"':""","'":"'","&":"&"},j=function(a){return i[a]},k=function(a){return h(a).replace(/&(?![\w#]+;)|[<>"']/g,j)},l=Array.isArray||function(a){return"[object Array]"==={}.toString.call(a)},m=function(a,b){var c,d;if(l(a))for(c=0,d=a.length;c\n"+a[c]+"\n\n";"object"==typeof console&&console.error(b)};var p=function(a){return d.onerror(a),function(){return"{Template Error}"}},q=d.compile=function(a,b){function d(c){try{return new i(c,h)+""}catch(d){return b.debug?p(d)():(b.debug=!0,q(a,b)(c))}}b=b||{};for(var g in e)void 0===b[g]&&(b[g]=e[g]);var h=b.filename;try{var i=c(a,b)}catch(a){return a.filename=h||"anonymous",a.name="Syntax Error",p(a)}return d.prototype=i.prototype,d.toString=function(){return i.toString()},h&&b.cache&&(f[h]=d),d},r=n.$each,s="break,case,catch,continue,debugger,default,delete,do,else,false,finally,for,function,if,in,instanceof,new,null,return,switch,this,throw,true,try,typeof,var,void,while,with,abstract,boolean,byte,char,class,const,double,enum,export,extends,final,float,goto,implements,import,int,interface,long,native,package,private,protected,public,short,static,super,synchronized,throws,transient,volatile,arguments,let,yield,undefined",t=/\/\*[\w\W]*?\*\/|\/\/[^\n]*\n|\/\/[^\n]*$|"(?:[^"\\]|\\[\w\W])*"|'(?:[^'\\]|\\[\w\W])*'|\s*\.\s*[$\w\.]+/g,u=/[^\w$]+/g,v=new RegExp(["\\b"+s.replace(/,/g,"\\b|\\b")+"\\b"].join("|"),"g"),w=/^\d[^,]*|,\d[^,]*/g,x=/^,+|,+$/g,y=/^$|,+/;e.openTag="{{",e.closeTag="}}";var z=function(a,b){var c=b.split(":"),d=c.shift(),e=c.join(":")||"";return e&&(e=", "+e),"$helpers."+d+"("+a+e+")"};e.parser=function(a,b){a=a.replace(/^\s/,"");var c=a.split(" "),e=c.shift(),f=c.join(" ");switch(e){case"if":a="if("+f+"){";break;case"else":c="if"===c.shift()?" if("+c.join(" ")+")":"",a="}else"+c+"{";break;case"/if":a="}";break;case"each":var g=c[0]||"$data",h=c[1]||"as",i=c[2]||"$value",j=c[3]||"$index",k=i+","+j;"as"!==h&&(g="[]"),a="$each("+g+",function("+k+"){";break;case"/each":a="});";break;case"echo":a="print("+f+");";break;case"print":case"include":a=e+"("+c.join(",")+");";break;default:if(/^\s*\|\s*[\w\$]/.test(f)){var l=!0;0===a.indexOf("#")&&(a=a.substr(1),l=!1);for(var m=0,n=a.split("|"),o=n.length,p=n[m++];m + +[下载](https://raw.github.com/aui/artTemplate/master/dist/template-native.js) + +## 表达式 + +``<%`` 与 ``%>`` 符号包裹起来的语句则为模板的逻辑表达式。 + +### 输出表达式 + +对内容编码输出: + + <%=content%> + +不编码输出: + + <%=#content%> + +编码可以防止数据中含有 HTML 字符串,避免引起 XSS 攻击。 + +### 逻辑 + +支持使用 js 原生语法 + +

<%=title%>

+
    + <%for(i = 0; i < list.length; i ++) {%> +
  • 条目内容 <%=i + 1%> :<%=list[i]%>
  • + <%}%> +
+ +> 模板不能访问全局对象,公用的方法请参见文档[辅助方法](#辅助方法)章节 + +### 模板包含表达式 + +用于嵌入子模板。 + + <% include('template_name') %> + +子模板默认共享当前数据,亦可以指定数据: + + <% include('template_name', news_list) %> + +## 辅助方法 + +使用``template.helper(name, callback)``注册公用辅助方法: + + template.helper('dateFormat', function (date, format) { + // .. + return value; + }); + +模板中使用的方式: + + <%=dateFormat(content) %> + +## 演示例子 + +* [基本例子](http://aui.github.io/artTemplate/demo/template-native/basic.html) +* [不转义HTML](http://aui.github.io/artTemplate/demo/template-native/no-escape.html) +* [在javascript中存放模板](http://aui.github.io/artTemplate/demo/template-native/compile.html) +* [嵌入子模板(include)](http://aui.github.io/artTemplate/demo/template-native/include.html) +* [访问外部公用函数(辅助方法)](http://aui.github.io/artTemplate/demo/template-native/helper.html) + +---------------------------------------------- + +本文档针对 artTemplate v3.0.0 编写 \ No newline at end of file diff --git a/public/assets/libs/art-template/doc/syntax-simple.md b/public/assets/libs/art-template/doc/syntax-simple.md new file mode 100644 index 0000000..cd3ac40 --- /dev/null +++ b/public/assets/libs/art-template/doc/syntax-simple.md @@ -0,0 +1,90 @@ +# artTemplate 简洁语法版 + +## 使用 + +引用简洁语法的引擎版本,例如: + + + + [下载](https://raw.github.com/aui/artTemplate/master/dist/template.js) + +## 表达式 + +``{{`` 与 ``}}`` 符号包裹起来的语句则为模板的逻辑表达式。 + +### 输出表达式 + +对内容编码输出: + + {{content}} + +不编码输出: + + {{#content}} + +编码可以防止数据中含有 HTML 字符串,避免引起 XSS 攻击。 + +### 条件表达式 + + {{if admin}} +

admin

+ {{else if code > 0}} +

master

+ {{else}} +

error!

+ {{/if}} + +### 遍历表达式 + +无论数组或者对象都可以用 each 进行遍历。 + + {{each list as value index}} +
  • {{index}} - {{value.user}}
  • + {{/each}} + +亦可以被简写: + + {{each list}} +
  • {{$index}} - {{$value.user}}
  • + {{/each}} + +### 模板包含表达式 + +用于嵌入子模板。 + + {{include 'template_name'}} + +子模板默认共享当前数据,亦可以指定数据: + + {{include 'template_name' news_list}} + +## 辅助方法 + +使用``template.helper(name, callback)``注册公用辅助方法: + +``` +template.helper('dateFormat', function (date, format) { + // .. + return value; +}); +``` + +模板中使用的方式: + + {{time | dateFormat:'yyyy-MM-dd hh:mm:ss'}} + +支持传入参数与嵌套使用: + + {{time | say:'cd' | ubb | link}} + +## 演示例子 + +* [基本例子](http://aui.github.io/artTemplate/demo/basic.html) +* [不转义HTML](http://aui.github.io/artTemplate/demo/no-escape.html) +* [在javascript中存放模板](http://aui.github.io/artTemplate/demo/compile.html) +* [嵌入子模板(include)](http://aui.github.io/artTemplate/demo/include.html) +* [访问外部公用函数(辅助方法)](http://aui.github.io/artTemplate/demo/helper.html) + +---------------------------------------------- + +本文档针对 artTemplate v3.0.0+ 编写 \ No newline at end of file diff --git a/public/assets/libs/art-template/loader/index.js b/public/assets/libs/art-template/loader/index.js new file mode 100644 index 0000000..cf8a1cf --- /dev/null +++ b/public/assets/libs/art-template/loader/index.js @@ -0,0 +1,18 @@ +var template = require('art-template/dist/template'); + +module.exports = function(source) { + this.cacheable && this.cacheable() + + var ANONYMOUS_RE = /^function\s+anonymous/ + + template.onerror = function(e) { + var message = 'Template Error\n\n'; + for (var name in e) { + message += '<' + name + '>\n' + e[name] + '\n\n'; + } + throw new SyntaxError(message) + } + + var render = template.compile(source, {}).toString().replace(ANONYMOUS_RE, 'function'); + return 'module.exports = require("art-template/loader/runtime")(' + render + ');'; +} \ No newline at end of file diff --git a/public/assets/libs/art-template/loader/package.json b/public/assets/libs/art-template/loader/package.json new file mode 100644 index 0000000..9b093c1 --- /dev/null +++ b/public/assets/libs/art-template/loader/package.json @@ -0,0 +1,14 @@ +{ + "name": "t-loader", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "", + "license": "ISC", + "dependencies": { + "art-template": "^3.1.3" + } +} diff --git a/public/assets/libs/art-template/loader/runtime.js b/public/assets/libs/art-template/loader/runtime.js new file mode 100644 index 0000000..53a9d1d --- /dev/null +++ b/public/assets/libs/art-template/loader/runtime.js @@ -0,0 +1,129 @@ +function template(content) { + return compile(content); +}; + +var String = this.String; + +function toString(value, type) { + + if (typeof value !== 'string') { + + type = typeof value; + if (type === 'number') { + value += ''; + } else if (type === 'function') { + value = toString(value.call(value)); + } else { + value = ''; + } + } + + return value; + +}; + + +var escapeMap = { + "<": "<", + ">": ">", + '"': """, + "'": "'", + "&": "&" +}; + + +function escapeFn(s) { + return escapeMap[s]; +} + + +function escapeHTML(content) { + return toString(content) + .replace(/&(?![\w#]+;)|[<>"']/g, escapeFn); +}; + + +var isArray = Array.isArray || function (obj) { + return ({}).toString.call(obj) === '[object Array]'; +}; + + +function each(data, callback) { + if (isArray(data)) { + for (var i = 0, len = data.length; i < len; i++) { + callback.call(data, data[i], i, data); + } + } else { + for (i in data) { + callback.call(data, data[i], i); + } + } +}; + + +var utils = template.utils = { + + $helpers: {}, + + $include: function () { + throw new Error('art-template/loader: not support `include`.'); + }, + + $string: toString, + + $escape: escapeHTML, + + $each: each + +}; + + +var helpers = template.helpers = utils.$helpers; + + +function compile(fn) { + var render = function (data) { + try { + return new fn(data) + ''; + } catch (e) { + return showDebugInfo(e)(); + } + }; + + render.prototype = fn.prototype = utils; + render.toString = function () { + return fn + ''; + }; + + return render; +}; + + +function showDebugInfo(e) { + + var type = "{Template Error}"; + var message = e.stack || ''; + + if (message) { + // 利用报错堆栈信息 + message = message.split('\n').slice(0, 2).join('\n'); + } else { + // 调试版本,直接给出模板语句行 + for (var name in e) { + message += "<" + name + ">\n" + e[name] + "\n\n"; + } + } + + return function () { + if (typeof console === "object") { + console.error(type + "\n\n" + message); + } + return type; + }; +}; + +template.helper = function (name, helper) { + helpers[name] = helper; +}; + +module.exports = template; \ No newline at end of file diff --git a/public/assets/libs/art-template/node/_node.js b/public/assets/libs/art-template/node/_node.js new file mode 100644 index 0000000..673a2ce --- /dev/null +++ b/public/assets/libs/art-template/node/_node.js @@ -0,0 +1,90 @@ +var fs = require('fs'); +var path = require('path'); + +module.exports = function (template) { + + var cacheStore = template.cache; + var defaults = template.defaults; + var rExtname; + + // 提供新的配置字段 + defaults.base = ''; + defaults.extname = '.html'; + defaults.encoding = 'utf-8'; + + function compileFromFS(filename) { + // 加载模板并编译 + var source = readTemplate(filename); + + if (typeof source === 'string') { + return template.compile(source, { + filename: filename + }); + } + } + + // 重写引擎编译结果获取方法 + template.get = function (filename) { + + var fn; + + + if (cacheStore.hasOwnProperty(filename)) { + // 使用内存缓存 + fn = cacheStore[filename]; + } else { + fn = compileFromFS(filename); + } + + return fn; + }; + + + function readTemplate (id) { + id = path.join(defaults.base, id + defaults.extname); + + if (id.indexOf(defaults.base) !== 0) { + // 安全限制:禁止超出模板目录之外调用文件 + throw new Error('"' + id + '" is not in the template directory'); + } else { + try { + return fs.readFileSync(id, defaults.encoding); + } catch (e) {} + } + } + + + // 重写模板`include``语句实现方法,转换模板为绝对路径 + template.utils.$include = function (filename, data, from) { + + from = path.dirname(from); + filename = path.join(from, filename); + + return template.renderFile(filename, data); + } + + + // express support + template.__express = function (file, options, fn) { + + if (typeof options === 'function') { + fn = options; + options = {}; + } + + + if (!rExtname) { + // 去掉 express 传入的路径 + rExtname = new RegExp((defaults.extname + '$').replace(/\./g, '\\.')); + } + + + file = file.replace(rExtname, ''); + + options.filename = file; + fn(null, template.renderFile(file, options)); + }; + + + return template; +} \ No newline at end of file diff --git a/public/assets/libs/art-template/node/template-native.js b/public/assets/libs/art-template/node/template-native.js new file mode 100644 index 0000000..046e37f --- /dev/null +++ b/public/assets/libs/art-template/node/template-native.js @@ -0,0 +1,9 @@ +/*! + * artTemplate[NodeJS] + * https://github.com/aui/artTemplate + * Released under the MIT, BSD, and GPL Licenses + */ + +var node = require('./_node.js'); +var template = require('../dist/template-native-debug.js'); +module.exports = node(template); \ No newline at end of file diff --git a/public/assets/libs/art-template/node/template.js b/public/assets/libs/art-template/node/template.js new file mode 100644 index 0000000..ce46a0a --- /dev/null +++ b/public/assets/libs/art-template/node/template.js @@ -0,0 +1,9 @@ +/*! + * artTemplate[NodeJS] + * https://github.com/aui/artTemplate + * Released under the MIT, BSD, and GPL Licenses + */ + +var node = require('./_node.js'); +var template = require('../dist/template-debug.js'); +module.exports = node(template); \ No newline at end of file diff --git a/public/assets/libs/art-template/package.json b/public/assets/libs/art-template/package.json new file mode 100644 index 0000000..9c771fe --- /dev/null +++ b/public/assets/libs/art-template/package.json @@ -0,0 +1,29 @@ +{ + "name": "art-template", + "description": "JavaScript Template Engine", + "version": "3.1.3", + "homepage": "http://aui.github.com/artTemplate/", + "keywords": [ + "util", + "functional", + "template" + ], + "author": "tangbin ", + "repository": { + "type": "git", + "url": "git://github.com/aui/artTemplate.git" + }, + "main": "./node/template.js", + "devDependencies": { + "express": "~4.4.3", + "grunt-cli": "*", + "grunt": "*", + "grunt-contrib-jshint": "*", + "grunt-contrib-concat": "*", + "grunt-contrib-uglify": "*" + }, + "scripts": { + "build": "grunt" + }, + "license": "BSD" +} diff --git a/public/assets/libs/art-template/src/cache.js b/public/assets/libs/art-template/src/cache.js new file mode 100644 index 0000000..c663e1a --- /dev/null +++ b/public/assets/libs/art-template/src/cache.js @@ -0,0 +1,3 @@ +var cacheStore = template.cache = {}; + + diff --git a/public/assets/libs/art-template/src/compile.js b/public/assets/libs/art-template/src/compile.js new file mode 100644 index 0000000..7873f19 --- /dev/null +++ b/public/assets/libs/art-template/src/compile.js @@ -0,0 +1,366 @@ +/** + * 编译模板 + * 2012-6-6 @TooBug: define 方法名改为 compile,与 Node Express 保持一致 + * @name template.compile + * @param {String} 模板字符串 + * @param {Object} 编译选项 + * + * - openTag {String} + * - closeTag {String} + * - filename {String} + * - escape {Boolean} + * - compress {Boolean} + * - debug {Boolean} + * - cache {Boolean} + * - parser {Function} + * + * @return {Function} 渲染方法 + */ +var compile = template.compile = function (source, options) { + + // 合并默认配置 + options = options || {}; + for (var name in defaults) { + if (options[name] === undefined) { + options[name] = defaults[name]; + } + } + + + var filename = options.filename; + + + try { + + var Render = compiler(source, options); + + } catch (e) { + + e.filename = filename || 'anonymous'; + e.name = 'Syntax Error'; + + return showDebugInfo(e); + + } + + + // 对编译结果进行一次包装 + + function render (data) { + + try { + + return new Render(data, filename) + ''; + + } catch (e) { + + // 运行时出错后自动开启调试模式重新编译 + if (!options.debug) { + options.debug = true; + return compile(source, options)(data); + } + + return showDebugInfo(e)(); + + } + + } + + + render.prototype = Render.prototype; + render.toString = function () { + return Render.toString(); + }; + + + if (filename && options.cache) { + cacheStore[filename] = render; + } + + + return render; + +}; + + + + +// 数组迭代 +var forEach = utils.$each; + + +// 静态分析模板变量 +var KEYWORDS = + // 关键字 + 'break,case,catch,continue,debugger,default,delete,do,else,false' + + ',finally,for,function,if,in,instanceof,new,null,return,switch,this' + + ',throw,true,try,typeof,var,void,while,with' + + // 保留字 + + ',abstract,boolean,byte,char,class,const,double,enum,export,extends' + + ',final,float,goto,implements,import,int,interface,long,native' + + ',package,private,protected,public,short,static,super,synchronized' + + ',throws,transient,volatile' + + // ECMA 5 - use strict + + ',arguments,let,yield' + + + ',undefined'; + +var REMOVE_RE = /\/\*[\w\W]*?\*\/|\/\/[^\n]*\n|\/\/[^\n]*$|"(?:[^"\\]|\\[\w\W])*"|'(?:[^'\\]|\\[\w\W])*'|\s*\.\s*[$\w\.]+/g; +var SPLIT_RE = /[^\w$]+/g; +var KEYWORDS_RE = new RegExp(["\\b" + KEYWORDS.replace(/,/g, '\\b|\\b') + "\\b"].join('|'), 'g'); +var NUMBER_RE = /^\d[^,]*|,\d[^,]*/g; +var BOUNDARY_RE = /^,+|,+$/g; +var SPLIT2_RE = /^$|,+/; + + +// 获取变量 +function getVariable (code) { + return code + .replace(REMOVE_RE, '') + .replace(SPLIT_RE, ',') + .replace(KEYWORDS_RE, '') + .replace(NUMBER_RE, '') + .replace(BOUNDARY_RE, '') + .split(SPLIT2_RE); +}; + + +// 字符串转义 +function stringify (code) { + return "'" + code + // 单引号与反斜杠转义 + .replace(/('|\\)/g, '\\$1') + // 换行符转义(windows + linux) + .replace(/\r/g, '\\r') + .replace(/\n/g, '\\n') + "'"; +} + + +function compiler (source, options) { + + var debug = options.debug; + var openTag = options.openTag; + var closeTag = options.closeTag; + var parser = options.parser; + var compress = options.compress; + var escape = options.escape; + + + + var line = 1; + var uniq = {$data:1,$filename:1,$utils:1,$helpers:1,$out:1,$line:1}; + + + + var isNewEngine = ''.trim;// '__proto__' in {} + var replaces = isNewEngine + ? ["$out='';", "$out+=", ";", "$out"] + : ["$out=[];", "$out.push(", ");", "$out.join('')"]; + + var concat = isNewEngine + ? "$out+=text;return $out;" + : "$out.push(text);"; + + var print = "function(){" + + "var text=''.concat.apply('',arguments);" + + concat + + "}"; + + var include = "function(filename,data){" + + "data=data||$data;" + + "var text=$utils.$include(filename,data,$filename);" + + concat + + "}"; + + var headerCode = "'use strict';" + + "var $utils=this,$helpers=$utils.$helpers," + + (debug ? "$line=0," : ""); + + var mainCode = replaces[0]; + + var footerCode = "return new String(" + replaces[3] + ");" + + // html与逻辑语法分离 + forEach(source.split(openTag), function (code) { + code = code.split(closeTag); + + var $0 = code[0]; + var $1 = code[1]; + + // code: [html] + if (code.length === 1) { + + mainCode += html($0); + + // code: [logic, html] + } else { + + mainCode += logic($0); + + if ($1) { + mainCode += html($1); + } + } + + + }); + + var code = headerCode + mainCode + footerCode; + + // 调试语句 + if (debug) { + code = "try{" + code + "}catch(e){" + + "throw {" + + "filename:$filename," + + "name:'Render Error'," + + "message:e.message," + + "line:$line," + + "source:" + stringify(source) + + ".split(/\\n/)[$line-1].replace(/^\\s+/,'')" + + "};" + + "}"; + } + + + + try { + + + var Render = new Function("$data", "$filename", code); + Render.prototype = utils; + + return Render; + + } catch (e) { + e.temp = "function anonymous($data,$filename) {" + code + "}"; + throw e; + } + + + + + // 处理 HTML 语句 + function html (code) { + + // 记录行号 + line += code.split(/\n/).length - 1; + + // 压缩多余空白与注释 + if (compress) { + code = code + .replace(/\s+/g, ' ') + .replace(//g, ''); + } + + if (code) { + code = replaces[1] + stringify(code) + replaces[2] + "\n"; + } + + return code; + } + + + // 处理逻辑语句 + function logic (code) { + + var thisLine = line; + + if (parser) { + + // 语法转换插件钩子 + code = parser(code, options); + + } else if (debug) { + + // 记录行号 + code = code.replace(/\n/g, function () { + line ++; + return "$line=" + line + ";"; + }); + + } + + + // 输出语句. 编码: <%=value%> 不编码:<%=#value%> + // <%=#value%> 等同 v2.0.3 之前的 <%==value%> + if (code.indexOf('=') === 0) { + + var escapeSyntax = escape && !/^=[=#]/.test(code); + + code = code.replace(/^=[=#]?|[\s;]*$/g, ''); + + // 对内容编码 + if (escapeSyntax) { + + var name = code.replace(/\s*\([^\)]+\)/, ''); + + // 排除 utils.* | include | print + + if (!utils[name] && !/^(include|print)$/.test(name)) { + code = "$escape(" + code + ")"; + } + + // 不编码 + } else { + code = "$string(" + code + ")"; + } + + + code = replaces[1] + code + replaces[2]; + + } + + if (debug) { + code = "$line=" + thisLine + ";" + code; + } + + // 提取模板中的变量名 + forEach(getVariable(code), function (name) { + + // name 值可能为空,在安卓低版本浏览器下 + if (!name || uniq[name]) { + return; + } + + var value; + + // 声明模板变量 + // 赋值优先级: + // [include, print] > utils > helpers > data + if (name === 'print') { + + value = print; + + } else if (name === 'include') { + + value = include; + + } else if (utils[name]) { + + value = "$utils." + name; + + } else if (helpers[name]) { + + value = "$helpers." + name; + + } else { + + value = "$data." + name; + } + + headerCode += name + "=" + value + ","; + uniq[name] = true; + + + }); + + return code + "\n"; + } + + +}; + + + diff --git a/public/assets/libs/art-template/src/config.js b/public/assets/libs/art-template/src/config.js new file mode 100644 index 0000000..c978311 --- /dev/null +++ b/public/assets/libs/art-template/src/config.js @@ -0,0 +1,22 @@ +/** + * 设置全局配置 + * @name template.config + * @param {String} 名称 + * @param {Any} 值 + */ +template.config = function (name, value) { + defaults[name] = value; +}; + + + +var defaults = template.defaults = { + openTag: '<%', // 逻辑语法开始标签 + closeTag: '%>', // 逻辑语法结束标签 + escape: true, // 是否编码输出变量的 HTML 字符 + cache: true, // 是否开启缓存(依赖 options 的 filename 字段) + compress: false, // 是否压缩输出 + parser: null // 自定义语法格式器 @see: template-syntax.js +}; + + diff --git a/public/assets/libs/art-template/src/get.js b/public/assets/libs/art-template/src/get.js new file mode 100644 index 0000000..d91deb1 --- /dev/null +++ b/public/assets/libs/art-template/src/get.js @@ -0,0 +1,29 @@ +/** + * 获取编译缓存(可由外部重写此方法) + * @param {String} 模板名 + * @param {Function} 编译好的函数 + */ +template.get = function (filename) { + + var cache; + + if (cacheStore[filename]) { + // 使用内存缓存 + cache = cacheStore[filename]; + } else if (typeof document === 'object') { + // 加载模板并编译 + var elem = document.getElementById(filename); + + if (elem) { + var source = (elem.value || elem.innerHTML) + .replace(/^\s*|\s*$/g, ''); + cache = compile(source, { + filename: filename + }); + } + } + + return cache; +}; + + diff --git a/public/assets/libs/art-template/src/helper.js b/public/assets/libs/art-template/src/helper.js new file mode 100644 index 0000000..dd99afd --- /dev/null +++ b/public/assets/libs/art-template/src/helper.js @@ -0,0 +1,15 @@ +/** + * 添加模板辅助方法 + * @name template.helper + * @param {String} 名称 + * @param {Function} 方法 + */ +template.helper = function (name, helper) { + helpers[name] = helper; +}; + +var helpers = template.helpers = utils.$helpers; + + + + diff --git a/public/assets/libs/art-template/src/intro.js b/public/assets/libs/art-template/src/intro.js new file mode 100644 index 0000000..f5afc93 --- /dev/null +++ b/public/assets/libs/art-template/src/intro.js @@ -0,0 +1,9 @@ +/*! + * artTemplate - Template Engine + * https://github.com/aui/artTemplate + * Released under the MIT, BSD, and GPL Licenses + */ + +!(function () { + + diff --git a/public/assets/libs/art-template/src/onerror.js b/public/assets/libs/art-template/src/onerror.js new file mode 100644 index 0000000..c08e37c --- /dev/null +++ b/public/assets/libs/art-template/src/onerror.js @@ -0,0 +1,28 @@ +/** + * 模板错误事件(可由外部重写此方法) + * @name template.onerror + * @event + */ +template.onerror = function (e) { + var message = 'Template Error\n\n'; + for (var name in e) { + message += '<' + name + '>\n' + e[name] + '\n\n'; + } + + if (typeof console === 'object') { + console.error(message); + } +}; + + +// 模板调试器 +var showDebugInfo = function (e) { + + template.onerror(e); + + return function () { + return '{Template Error}'; + }; +}; + + diff --git a/public/assets/libs/art-template/src/outro.js b/public/assets/libs/art-template/src/outro.js new file mode 100644 index 0000000..4ee8e47 --- /dev/null +++ b/public/assets/libs/art-template/src/outro.js @@ -0,0 +1,13 @@ +// CommonJs +if (typeof exports === 'object' && typeof module !== 'undefined') { + module.exports = template; +// RequireJS && SeaJS +} else if (typeof define === 'function') { + define(function() { + return template; + }); +} else { + this.template = template; +} + +})(); diff --git a/public/assets/libs/art-template/src/render.js b/public/assets/libs/art-template/src/render.js new file mode 100644 index 0000000..b90b01a --- /dev/null +++ b/public/assets/libs/art-template/src/render.js @@ -0,0 +1,12 @@ +/** + * 渲染模板 + * @name template.render + * @param {String} 模板 + * @param {Object} 数据 + * @return {String} 渲染好的字符串 + */ +template.render = function (source, options) { + return compile(source)(options); +}; + + diff --git a/public/assets/libs/art-template/src/renderFile.js b/public/assets/libs/art-template/src/renderFile.js new file mode 100644 index 0000000..ae9faac --- /dev/null +++ b/public/assets/libs/art-template/src/renderFile.js @@ -0,0 +1,17 @@ +/** + * 渲染模板(根据模板名) + * @name template.render + * @param {String} 模板名 + * @param {Object} 数据 + * @return {String} 渲染好的字符串 + */ +var renderFile = template.renderFile = function (filename, data) { + var fn = template.get(filename) || showDebugInfo({ + filename: filename, + name: 'Render Error', + message: 'Template not found' + }); + return data ? fn(data) : fn; +}; + + diff --git a/public/assets/libs/art-template/src/syntax.js b/public/assets/libs/art-template/src/syntax.js new file mode 100644 index 0000000..7aff672 --- /dev/null +++ b/public/assets/libs/art-template/src/syntax.js @@ -0,0 +1,137 @@ +// 定义模板引擎的语法 + + +defaults.openTag = '{{'; +defaults.closeTag = '}}'; + + +var filtered = function (js, filter) { + var parts = filter.split(':'); + var name = parts.shift(); + var args = parts.join(':') || ''; + + if (args) { + args = ', ' + args; + } + + return '$helpers.' + name + '(' + js + args + ')'; +} + + +defaults.parser = function (code, options) { + + // var match = code.match(/([\w\$]*)(\b.*)/); + // var key = match[1]; + // var args = match[2]; + // var split = args.split(' '); + // split.shift(); + + code = code.replace(/^\s/, ''); + + var split = code.split(' '); + var key = split.shift(); + var args = split.join(' '); + + + + switch (key) { + + case 'if': + + code = 'if(' + args + '){'; + break; + + case 'else': + + if (split.shift() === 'if') { + split = ' if(' + split.join(' ') + ')'; + } else { + split = ''; + } + + code = '}else' + split + '{'; + break; + + case '/if': + + code = '}'; + break; + + case 'each': + + var object = split[0] || '$data'; + var as = split[1] || 'as'; + var value = split[2] || '$value'; + var index = split[3] || '$index'; + + var param = value + ',' + index; + + if (as !== 'as') { + object = '[]'; + } + + code = '$each(' + object + ',function(' + param + '){'; + break; + + case '/each': + + code = '});'; + break; + + case 'echo': + + code = 'print(' + args + ');'; + break; + + case 'print': + case 'include': + + code = key + '(' + split.join(',') + ');'; + break; + + default: + + // 过滤器(辅助方法) + // {{value | filterA:'abcd' | filterB}} + // >>> $helpers.filterB($helpers.filterA(value, 'abcd')) + // TODO: {{ddd||aaa}} 不包含空格 + if (/^\s*\|\s*[\w\$]/.test(args)) { + + var escape = true; + + // {{#value | link}} + if (code.indexOf('#') === 0) { + code = code.substr(1); + escape = false; + } + + var i = 0; + var array = code.split('|'); + var len = array.length; + var val = array[i++]; + + for (; i < len; i ++) { + val = filtered(val, array[i]); + } + + code = (escape ? '=' : '=#') + val; + + // 即将弃用 {{helperName value}} + } else if (template.helpers[key]) { + + code = '=#' + key + '(' + split.join(',') + ');'; + + // 内容直接输出 {{value}} + } else { + + code = '=' + code; + } + + break; + } + + + return code; +}; + + diff --git a/public/assets/libs/art-template/src/template.js b/public/assets/libs/art-template/src/template.js new file mode 100644 index 0000000..52e46c4 --- /dev/null +++ b/public/assets/libs/art-template/src/template.js @@ -0,0 +1,19 @@ +/** + * 模板引擎 + * @name template + * @param {String} 模板名 + * @param {Object, String} 数据。如果为字符串则编译并缓存编译结果 + * @return {String, Function} 渲染好的HTML字符串或者渲染方法 + */ +var template = function (filename, content) { + return typeof content === 'string' + ? compile(content, { + filename: filename + }) + : renderFile(filename, content); +}; + + +template.version = '3.0.0'; + + diff --git a/public/assets/libs/art-template/src/utils.js b/public/assets/libs/art-template/src/utils.js new file mode 100644 index 0000000..bf48b4c --- /dev/null +++ b/public/assets/libs/art-template/src/utils.js @@ -0,0 +1,70 @@ +var toString = function (value, type) { + + if (typeof value !== 'string') { + + type = typeof value; + if (type === 'number') { + value += ''; + } else if (type === 'function') { + value = toString(value.call(value)); + } else { + value = ''; + } + } + + return value; + +}; + + +var escapeMap = { + "<": "<", + ">": ">", + '"': """, + "'": "'", + "&": "&" +}; + + +var escapeFn = function (s) { + return escapeMap[s]; +}; + +var escapeHTML = function (content) { + return toString(content) + .replace(/&(?![\w#]+;)|[<>"']/g, escapeFn); +}; + + +var isArray = Array.isArray || function (obj) { + return ({}).toString.call(obj) === '[object Array]'; +}; + + +var each = function (data, callback) { + var i, len; + if (isArray(data)) { + for (i = 0, len = data.length; i < len; i++) { + callback.call(data, data[i], i, data); + } + } else { + for (i in data) { + callback.call(data, data[i], i); + } + } +}; + + +var utils = template.utils = { + + $helpers: {}, + + $include: renderFile, + + $string: toString, + + $escape: escapeHTML, + + $each: each + +}; \ No newline at end of file diff --git a/public/assets/libs/art-template/test/js/baiduTemplate.js b/public/assets/libs/art-template/test/js/baiduTemplate.js new file mode 100644 index 0000000..2f05969 --- /dev/null +++ b/public/assets/libs/art-template/test/js/baiduTemplate.js @@ -0,0 +1,216 @@ +/** + * baiduTemplate简单好用的Javascript模板引擎 1.0.6 版本 + * http://baidufe.github.com/BaiduTemplate + * 开源协议:BSD License + * 浏览器环境占用命名空间 baidu.template ,nodejs环境直接安装 npm install baidutemplate + * @param str{String} dom结点ID,或者模板string + * @param data{Object} 需要渲染的json对象,可以为空。当data为{}时,仍然返回html。 + * @return 如果无data,直接返回编译后的函数;如果有data,返回html。 + * @author wangxiao + * @email 1988wangxiao@gmail.com +*/ + +;(function(window){ + + //取得浏览器环境的baidu命名空间,非浏览器环境符合commonjs规范exports出去 + //修正在nodejs环境下,采用baidu.template变量名 + var baidu = typeof module === 'undefined' ? (window.baidu = window.baidu || {}) : module.exports; + + //模板函数(放置于baidu.template命名空间下) + baidu.template = function(str, data){ + + //检查是否有该id的元素存在,如果有元素则获取元素的innerHTML/value,否则认为字符串为模板 + var fn = (function(){ + + //判断如果没有document,则为非浏览器环境 + if(!window.document){ + return bt._compile(str); + }; + + //HTML5规定ID可以由任何不包含空格字符的字符串组成 + var element = document.getElementById(str); + if (element) { + + //取到对应id的dom,缓存其编译后的HTML模板函数 + if (bt.cache[str]) { + return bt.cache[str]; + }; + + //textarea或input则取value,其它情况取innerHTML + var html = /^(textarea|input)$/i.test(element.nodeName) ? element.value : element.innerHTML; + return bt._compile(html); + + }else{ + + //是模板字符串,则生成一个函数 + //如果直接传入字符串作为模板,则可能变化过多,因此不考虑缓存 + return bt._compile(str); + }; + + })(); + + //有数据则返回HTML字符串,没有数据则返回函数 支持data={}的情况 + var result = bt._isObject(data) ? fn( data ) : fn; + fn = null; + + return result; + }; + + //取得命名空间 baidu.template + var bt = baidu.template; + + //标记当前版本 + bt.versions = bt.versions || []; + bt.versions.push('1.0.6'); + + //缓存 将对应id模板生成的函数缓存下来。 + bt.cache = {}; + + //自定义分隔符,可以含有正则中的字符,可以是HTML注释开头 + bt.LEFT_DELIMITER = bt.LEFT_DELIMITER||'<%'; + bt.RIGHT_DELIMITER = bt.RIGHT_DELIMITER||'%>'; + + //自定义默认是否转义,默认为默认自动转义 + bt.ESCAPE = true; + + //HTML转义 + bt._encodeHTML = function (source) { + return String(source) + .replace(/&/g,'&') + .replace(//g,'>') + .replace(/\\/g,'\') + .replace(/"/g,'"') + .replace(/'/g,'''); + }; + + //转义影响正则的字符 + bt._encodeReg = function (source) { + return String(source).replace(/([.*+?^=!:${}()|[\]/\\])/g,'\\$1'); + }; + + //转义UI UI变量使用在HTML页面标签onclick等事件函数参数中 + bt._encodeEventHTML = function (source) { + return String(source) + .replace(/&/g,'&') + .replace(//g,'>') + .replace(/"/g,'"') + .replace(/'/g,''') + .replace(/\\\\/g,'\\') + .replace(/\\\//g,'\/') + .replace(/\\n/g,'\n') + .replace(/\\r/g,'\r'); + }; + + //将字符串拼接生成函数,即编译过程(compile) + bt._compile = function(str){ + var funBody = "var _template_fun_array=[];\nvar fn=(function(__data__){\nvar _template_varName='';\nfor(name in __data__){\n_template_varName+=('var '+name+'=__data__[\"'+name+'\"];');\n};\neval(_template_varName);\n_template_fun_array.push('"+bt._analysisStr(str)+"');\n_template_varName=null;\n})(_template_object);\nfn = null;\nreturn _template_fun_array.join('');\n"; + return new Function("_template_object",funBody); + }; + + //判断是否是Object类型 + bt._isObject = function (source) { + return 'function' === typeof source || !!(source && 'object' === typeof source); + }; + + //解析模板字符串 + bt._analysisStr = function(str){ + + //取得分隔符 + var _left_ = bt.LEFT_DELIMITER; + var _right_ = bt.RIGHT_DELIMITER; + + //对分隔符进行转义,支持正则中的元字符,可以是HTML注释 + var _left = bt._encodeReg(_left_); + var _right = bt._encodeReg(_right_); + + str = String(str) + + //去掉分隔符中js注释 + .replace(new RegExp("("+_left+"[^"+_right+"]*)//.*\n","g"), "$1") + + //去掉注释内容 <%* 这里可以任意的注释 *%> + //默认支持HTML注释,将HTML注释匹配掉的原因是用户有可能用 来做分割符 + .replace(new RegExp("", "g"),"") + .replace(new RegExp(_left+"\\*.*?\\*"+_right, "g"),"") + + //把所有换行去掉 \r回车符 \t制表符 \n换行符 + .replace(new RegExp("[\\r\\t\\n]","g"), "") + + //用来处理非分隔符内部的内容中含有 斜杠 \ 单引号 ‘ ,处理办法为HTML转义 + .replace(new RegExp(_left+"(?:(?!"+_right+")[\\s\\S])*"+_right+"|((?:(?!"+_left+")[\\s\\S])+)","g"),function (item, $1) { + var str = ''; + if($1){ + + //将 斜杠 单引 HTML转义 + str = $1.replace(/\\/g,"\").replace(/'/g,'''); + while(/<[^<]*?'[^<]*?>/g.test(str)){ + + //将标签内的单引号转义为\r 结合最后一步,替换为\' + str = str.replace(/(<[^<]*?)'([^<]*?>)/g,'$1\r$2') + }; + }else{ + str = item; + } + return str ; + }); + + + str = str + //定义变量,如果没有分号,需要容错 <%var val='test'%> + .replace(new RegExp("("+_left+"[\\s]*?var[\\s]*?.*?[\\s]*?[^;])[\\s]*?"+_right,"g"),"$1;"+_right_) + + //对变量后面的分号做容错(包括转义模式 如<%:h=value%>) <%=value;%> 排除掉函数的情况 <%fun1();%> 排除定义变量情况 <%var val='test';%> + .replace(new RegExp("("+_left+":?[hvu]?[\\s]*?=[\\s]*?[^;|"+_right+"]*?);[\\s]*?"+_right,"g"),"$1"+_right_) + + //按照 <% 分割为一个个数组,再用 \t 和在一起,相当于将 <% 替换为 \t + //将模板按照<%分为一段一段的,再在每段的结尾加入 \t,即用 \t 将每个模板片段前面分隔开 + .split(_left_).join("\t"); + + //支持用户配置默认是否自动转义 + if(bt.ESCAPE){ + str = str + + //找到 \t=任意一个字符%> 替换为 ‘,任意字符,' + //即替换简单变量 \t=data%> 替换为 ',data,' + //默认HTML转义 也支持HTML转义写法<%:h=value%> + .replace(new RegExp("\\t=(.*?)"+_right,"g"),"',typeof($1) === 'undefined'?'':baidu.template._encodeHTML($1),'"); + }else{ + str = str + + //默认不转义HTML转义 + .replace(new RegExp("\\t=(.*?)"+_right,"g"),"',typeof($1) === 'undefined'?'':$1,'"); + }; + + str = str + + //支持HTML转义写法<%:h=value%> + .replace(new RegExp("\\t:h=(.*?)"+_right,"g"),"',typeof($1) === 'undefined'?'':baidu.template._encodeHTML($1),'") + + //支持不转义写法 <%:=value%>和<%-value%> + .replace(new RegExp("\\t(?::=|-)(.*?)"+_right,"g"),"',typeof($1)==='undefined'?'':$1,'") + + //支持url转义 <%:u=value%> + .replace(new RegExp("\\t:u=(.*?)"+_right,"g"),"',typeof($1)==='undefined'?'':encodeURIComponent($1),'") + + //支持UI 变量使用在HTML页面标签onclick等事件函数参数中 <%:v=value%> + .replace(new RegExp("\\t:v=(.*?)"+_right,"g"),"',typeof($1)==='undefined'?'':baidu.template._encodeEventHTML($1),'") + + //将字符串按照 \t 分成为数组,在用'); 将其合并,即替换掉结尾的 \t 为 '); + //在if,for等语句前面加上 '); ,形成 ');if ');for 的形式 + .split("\t").join("');") + + //将 %> 替换为_template_fun_array.push(' + //即去掉结尾符,生成函数中的push方法 + //如:if(list.length=5){%>

    ',list[4],'

    ');} + //会被替换为 if(list.length=5){_template_fun_array.push('

    ',list[4],'

    ');} + .split(_right_).join("_template_fun_array.push('") + + //将 \r 替换为 \ + .split("\r").join("\\'"); + + return str; + }; + +})(window); diff --git a/public/assets/libs/art-template/test/js/doT.js b/public/assets/libs/art-template/test/js/doT.js new file mode 100644 index 0000000..12ecd42 --- /dev/null +++ b/public/assets/libs/art-template/test/js/doT.js @@ -0,0 +1,101 @@ +// doT.js +// 2011, Laura Doktorova +// https://github.com/olado/doT +// +// doT.js is an open source component of http://bebedo.com +// +// doT is a custom blend of templating functions from jQote2.js +// (jQuery plugin) by aefxx (http://aefxx.com/jquery-plugins/jqote2/) +// and underscore.js (http://documentcloud.github.com/underscore/) +// plus extensions. +// +// Licensed under the MIT license. +// +(function() { + var doT = { version : '0.1.7' }; + + if (typeof module !== 'undefined' && module.exports) { + module.exports = doT; + } else { + this.doT = doT; + } + + doT.templateSettings = { + evaluate: /\{\{([\s\S]+?)\}\}/g, + interpolate: /\{\{=([\s\S]+?)\}\}/g, + encode: /\{\{!([\s\S]+?)\}\}/g, + use: /\{\{#([\s\S]+?)\}\}/g, //compile time evaluation + define: /\{\{##\s*([\w\.$]+)\s*(\:|=)([\s\S]+?)#\}\}/g, //compile time defs + conditionalStart: /\{\{\?([\s\S]+?)\}\}/g, + conditionalEnd: /\{\{\?\}\}/g, + varname: 'it', + strip : true, + append: true + }; + + function resolveDefs(c, block, def) { + return ((typeof block === 'string') ? block : block.toString()) + .replace(c.define, function (match, code, assign, value) { + if (code.indexOf('def.') === 0) { + code = code.substring(4); + } + if (!(code in def)) { + if (assign === ':') { + def[code]= value; + } else { + eval("def[code]=" + value); + } + } + return ''; + }) + .replace(c.use, function(match, code) { + var v = eval(code); + return v ? resolveDefs(c, v, def) : v; + }); + } + + doT.template = function(tmpl, c, def) { + c = c || doT.templateSettings; + var cstart = c.append ? "'+(" : "';out+=(", // optimal choice depends on platform/size of templates + cend = c.append ? ")+'" : ");out+='"; + var str = (c.use || c.define) ? resolveDefs(c, tmpl, def || {}) : tmpl; + + str = ("var out='" + + ((c.strip) ? str.replace(/\s*\s*|[\r\n\t]|(\/\*[\s\S]*?\*\/)/g, ''): str) + .replace(/\\/g, '\\\\') + .replace(/'/g, "\\'") + .replace(c.interpolate, function(match, code) { + return cstart + code.replace(/\\'/g, "'").replace(/\\\\/g,"\\").replace(/[\r\t\n]/g, ' ') + cend; + }) + .replace(c.encode, function(match, code) { + return cstart + code.replace(/\\'/g, "'").replace(/\\\\/g, "\\").replace(/[\r\t\n]/g, ' ') + ").toString().replace(/&(?!\\w+;)/g, '&').split('<').join('<').split('>').join('>').split('" + '"' + "').join('"').split(" + '"' + "'" + '"' + ").join(''').split('/').join('/'" + cend; + }) + .replace(c.conditionalEnd, function(match, expression) { + return "';}out+='"; + }) + .replace(c.conditionalStart, function(match, expression) { + var code = "if(" + expression + "){"; + return "';" + code.replace(/\\'/g, "'").replace(/\\\\/g,"\\").replace(/[\r\t\n]/g, ' ') + "out+='"; + }) + .replace(c.evaluate, function(match, code) { + return "';" + code.replace(/\\'/g, "'").replace(/\\\\/g,"\\").replace(/[\r\t\n]/g, ' ') + "out+='"; + }) + + "';return out;") + .replace(/\n/g, '\\n') + .replace(/\t/g, '\\t') + .replace(/\r/g, '\\r') + .split("out+='';").join('') + .split("var out='';out+=").join('var out='); + + try { + return new Function(c.varname, str); + } catch (e) { + if (typeof console !== 'undefined') console.log("Could not create a template function: " + str); + throw e; + } + }; + + doT.compile = function(tmpl, def) { + return doT.template(tmpl, null, def); + }; +}()); \ No newline at end of file diff --git a/public/assets/libs/art-template/test/js/easytemplate.js b/public/assets/libs/art-template/test/js/easytemplate.js new file mode 100644 index 0000000..2bfdd94 --- /dev/null +++ b/public/assets/libs/art-template/test/js/easytemplate.js @@ -0,0 +1,55 @@ +var easyTemplate = function(s,d){ + if(!s){return '';} + if(s!==easyTemplate.template){ + easyTemplate.template = s; + easyTemplate.aStatement = easyTemplate.parsing(easyTemplate.separate(s)); + } + var aST = easyTemplate.aStatement; + var process = function(d2){ + if(d2){d = d2;} + return arguments.callee; + }; + process.toString = function(){ + return (new Function(aST[0],aST[1]))(d); + }; + return process; +}; +easyTemplate.separate = function(s){ + var r = /\\'/g; + var sRet = s.replace(/(<(\/?)#(.*?(?:\(.*?\))*)>)|(')|([\r\n\t])|(\$\{([^\}]*?)\})/g,function(a,b,c,d,e,f,g,h){ + if(b){return '{|}'+(c?'-':'+')+d+'{|}';} + if(e){return '\\\'';} + if(f){return '';} + if(g){return '\'+('+h.replace(r,'\'')+')+\'';} + }); + return sRet; +}; +easyTemplate.parsing = function(s){ + var mName,vName,sTmp,aTmp,sFL,sEl,aList,aStm = ['var aRet = [];']; + aList = s.split(/\{\|\}/); + var r = /\s/; + while(aList.length){ + sTmp = aList.shift(); + if(!sTmp){continue;} + sFL = sTmp.charAt(0); + if(sFL!=='+'&&sFL!=='-'){ + sTmp = '\''+sTmp+'\'';aStm.push('aRet.push('+sTmp+');'); + continue; + } + aTmp = sTmp.split(r); + switch(aTmp[0]){ + case '+macro':mName = aTmp[1];vName = aTmp[2];aStm.push('aRet.push(" 和 变量替换串:${...} 的解析 + * + * @inner + * @param {string} source 要解析的文本 + * @param {string} open 包含块开头 + * @param {string} close 包含块结束 + * @param {boolean} greedy 是否贪婪匹配 + * @param {function({string})} onInBlock 包含块内文本的处理函数 + * @param {function({string})} onOutBlock 非包含块内文本的处理函数 + */ + function parseTextBlock( source, open, close, greedy, onInBlock, onOutBlock ) { + var closeLen = close.length; + var texts = source.split( open ); + var level = 0; + var buf = []; + + for ( var i = 0, len = texts.length; i < len; i++ ) { + var text = texts[ i ]; + + if ( i ) { + var openBegin = 1; + level++; + while ( 1 ) { + var closeIndex = text.indexOf( close ); + if ( closeIndex < 0 ) { + buf.push( level > 1 && openBegin ? open : '', text ); + break; + } + + level = greedy ? level - 1 : 0; + buf.push( + level > 0 && openBegin ? open : '', + text.slice( 0, closeIndex ), + level > 0 ? close : '' + ); + text = text.slice( closeIndex + closeLen ); + openBegin = 0; + + if ( level === 0 ) { + break; + } + } + + if ( level === 0 ) { + onInBlock( buf.join( '' ) ); + onOutBlock( text ); + buf = []; + } + } + else { + text && onOutBlock( text ); + } + } + + if ( level > 0 && buf.length > 0 ) { + onOutBlock( open ); + onOutBlock( buf.join( '' ) ); + } + } + + /** + * 编译变量访问和变量替换的代码 + * 用于普通文本或if、var、filter等命令生成编译代码 + * + * @inner + * @param {string} source 源代码 + * @param {Engine} engine 引擎实例 + * @param {boolean} forText 是否为输出文本的变量替换 + * @return {string} + */ + function compileVariable( source, engine, forText ) { + var code = []; + var options = engine.options; + + var toStringHead = ''; + var toStringFoot = ''; + var wrapHead = ''; + var wrapFoot = ''; + + // 默认的filter,当forText模式时有效 + var defaultFilter; + + if ( forText ) { + toStringHead = 'ts('; + toStringFoot = ')'; + wrapHead = RENDER_STRING_ADD_START; + wrapFoot = RENDER_STRING_ADD_END; + defaultFilter = options.defaultFilter + } + + parseTextBlock( + source, options.variableOpen, options.variableClose, 1, + + function ( text ) { + // 加入默认filter + // 只有当处理forText时,需要加入默认filter + // 处理if/var/use等command时,不需要加入默认filter + if ( forText && text.indexOf( '|' ) < 0 && defaultFilter ) { + text += '|' + defaultFilter; + } + + // variableCode是一个gv调用,然后通过循环,在外面包filter的调用 + // 形成filter["b"](filter["a"](gv(...))) + // + // 当forText模式,处理的是文本中的变量替换时 + // 传递给filter的需要是字符串形式,所以gv外需要包一层ts调用 + // 形成filter["b"](filter["a"](ts(gv(...)))) + // + // 当variableName以*起始时,忽略ts调用,直接传递原值给filter + var filterCharIndex = text.indexOf( '|' ); + var variableName = (filterCharIndex > 0 + ? text.slice( 0, filterCharIndex ) + : text).replace( /^\s+/, '' ).replace( /\s+$/, '' ); + var filterSource = filterCharIndex > 0 + ? text.slice( filterCharIndex + 1 ) + : ''; + + var variableRawValue = variableName.indexOf( '*' ) === 0; + var variableCode = [ + variableRawValue ? '' : toStringHead, + toGetVariableLiteral( variableName ), + variableRawValue ? '' : toStringFoot + ]; + + if ( filterSource ) { + filterSource = compileVariable( filterSource, engine ); + var filterSegs = filterSource.split( '|' ); + for ( var i = 0, len = filterSegs.length; i < len; i++ ) { + var seg = filterSegs[ i ]; + + if ( /^\s*([a-z0-9_-]+)(\((.*)\))?\s*$/i.test( seg ) ) { + variableCode.unshift( 'fs["' + RegExp.$1 + '"](' ); + + if ( RegExp.$3 ) { + variableCode.push( + ',', + RegExp.$3 + ); + } + + variableCode.push( ')' ); + } + } + } + + code.push( + wrapHead, + variableCode.join( '' ), + wrapFoot + ); + }, + + function ( text ) { + code.push( + wrapHead, + forText ? stringLiteralize( text ) : text, + wrapFoot + ); + } + ); + + return code.join( '' ); + } + + /** + * 文本节点类 + * + * @inner + * @constructor + * @param {string} value 文本节点的内容文本 + * @param {Engine} engine 引擎实例 + */ + function TextNode( value, engine ) { + this.value = value; + this.engine = engine; + } + + TextNode.prototype = { + /** + * 获取renderer body的生成代码 + * + * @return {string} + */ + getRendererBody: function () { + var value = this.value; + var options = this.engine.options; + + if ( !value || ( options.strip && /^\s*$/.test( value ) ) ) { + return ''; + } + + return compileVariable( value, this.engine, 1 ); + }, + + /** + * 获取内容 + * + * @return {string} + */ + getContent: function () { + return this.value; + } + }; + + /** + * 命令节点类 + * + * @inner + * @constructor + * @param {string} value 命令节点的value + * @param {Engine} engine 引擎实例 + */ + function Command( value, engine ) { + this.value = value; + this.engine = engine; + this.children = []; + } + + Command.prototype = { + /** + * 添加子节点 + * + * @param {TextNode|Command} node 子节点 + */ + addChild: function ( node ) { + this.children.push( node ); + }, + + /** + * 节点open,解析开始 + * + * @param {Object} context 语法分析环境对象 + */ + open: function ( context ) { + var parent = context.stack.top(); + this.parent = parent; + parent && parent.addChild( this ); + context.stack.push( this ); + }, + + /** + * 节点闭合,解析结束 + * + * @param {Object} context 语法分析环境对象 + */ + close: function ( context ) { + while (context.stack.pop().constructor !== this.constructor) {} + }, + + /** + * 添加文本节点 + * + * @param {TextNode} node 节点 + */ + addTextNode: function ( node ) { + this.addChild( node ); + }, + + /** + * 获取renderer body的生成代码 + * + * @return {string} + */ + getRendererBody: function () { + var buf = []; + var children = this.children; + for ( var i = 0; i < children.length; i++ ) { + buf.push( children[ i ].getRendererBody() ); + } + + return buf.join( '' ); + } + }; + + /** + * 命令自动闭合 + * + * @inner + * @param {Object} context 语法分析环境对象 + * @param {Function=} CommandType 自闭合的节点类型 + */ + function autoCloseCommand( context, CommandType ) { + var stack = context.stack; + var closeEnd = CommandType + ? stack.find( function ( item ) { + return item instanceof CommandType; + } ) + : stack.bottom(); + + if ( closeEnd ) { + var node; + + do { + node = stack.top(); + + // 如果节点对象不包含autoClose方法 + // 则认为该节点不支持自动闭合,需要抛出错误 + // for等节点不支持自动闭合 + if ( !node.autoClose ) { + throw new Error( node.type + ' must be closed manually: ' + node.value ); + } + node.autoClose( context ); + } while ( node !== closeEnd ); + } + + return closeEnd; + } + + /** + * renderer body起始代码段 + * + * @inner + * @const + * @type {string} + */ + var RENDERER_BODY_START = '' + + 'data=data||{};' + + 'var v={},fs=engine.filters,hg=typeof data.get=="function",' + + 'gv=function(n,ps){' + + 'var p=ps[0],d=v[p];' + + 'if(d==null){' + + 'if(hg){return data.get(n);}' + + 'd=data[p];' + + '}' + + 'for(var i=1,l=ps.length;i= TMNodeState.APPLIED ) { + return 1; + } + + var masterNode = this.engine.masters[ this.master ]; + if ( masterNode && masterNode.applyMaster() ) { + this.children = []; + + for ( var i = 0, len = masterNode.children.length; i < len; i++ ) { + var child = masterNode.children[ i ]; + + if ( child instanceof ContentPlaceHolderCommand ) { + this.children.push.apply( + this.children, + (this.contents[ child.name ] || child).children + ); + } + else { + this.children.push( child ); + } + } + + this.state = TMNodeState.APPLIED; + return 1; + } + }; + + /** + * 判断target是否ready + * 包括是否成功应用母版,以及import和use语句依赖的target是否ready + * + * @return {boolean} + */ + TargetCommand.prototype.isReady = function () { + if ( this.state >= TMNodeState.READY ) { + return 1; + } + + var engine = this.engine; + var readyState = 1; + + /** + * 递归检查节点的ready状态 + * + * @inner + * @param {Command|TextNode} node 目标节点 + */ + function checkReadyState( node ) { + for ( var i = 0, len = node.children.length; i < len; i++ ) { + var child = node.children[ i ]; + if ( child instanceof ImportCommand ) { + var target = engine.targets[ child.name ]; + readyState = readyState + && target && target.isReady( engine ); + } + else if ( child instanceof Command ) { + checkReadyState( child ); + } + } + } + + if ( this.applyMaster() ) { + checkReadyState( this ); + readyState && (this.state = TMNodeState.READY); + return readyState; + } + }; + + /** + * 获取target的renderer函数 + * + * @return {function(Object):string} + */ + TargetCommand.prototype.getRenderer = function () { + if ( this.renderer ) { + return this.renderer; + } + + if ( this.isReady() ) { + // console.log( this.name + ' ------------------' ); + // console.log(RENDERER_BODY_START +RENDER_STRING_DECLATION + // + this.getRendererBody() + // + RENDER_STRING_RETURN); + + var realRenderer = new Function( + 'data', 'engine', + [ + RENDERER_BODY_START, + RENDER_STRING_DECLATION, + this.getRendererBody(), + RENDER_STRING_RETURN + ].join( '\n' ) + ); + + var engine = this.engine; + this.renderer = function ( data ) { + return realRenderer( data, engine ); + }; + + return this.renderer; + } + + return null; + }; + + /** + * 获取内容 + * + * @return {string} + */ + TargetCommand.prototype.getContent = function () { + if ( this.isReady() ) { + var buf = []; + var children = this.children; + for ( var i = 0; i < children.length; i++ ) { + buf.push( children[ i ].getContent() ); + } + + return buf.join( '' ); + } + + return ''; + }; + + /** + * 将target或master节点对象添加到语法分析环境中 + * + * @inner + * @param {TargetCommand|MasterCommand} targetOrMaster target或master节点对象 + * @param {Object} context 语法分析环境对象 + */ + function addTargetOrMasterToContext( targetOrMaster, context ) { + context.targetOrMaster = targetOrMaster; + + var engine = context.engine; + var name = targetOrMaster.name; + var isTarget = targetOrMaster instanceof TargetCommand; + var prop = isTarget ? 'targets' : 'masters'; + + if ( engine[ prop ][ name ] ) { + switch ( engine.options.namingConflict ) { + case 'override': + engine[ prop ][ name ] = targetOrMaster; + isTarget && context.targets.push( name ); + case 'ignore': + break; + default: + throw new Error( ( isTarget ? 'Target' :'Master' ) + + ' is exists: ' + name ); + } + } + else { + engine[ prop ][ name ] = targetOrMaster; + isTarget && context.targets.push( name ); + } + } + + /** + * target节点open,解析开始 + * + * @param {Object} context 语法分析环境对象 + */ + TargetCommand.prototype.open = + + /** + * master节点open,解析开始 + * + * @param {Object} context 语法分析环境对象 + */ + MasterCommand.prototype.open = function ( context ) { + autoCloseCommand( context ); + Command.prototype.open.call( this, context ); + this.state = TMNodeState.READING; + addTargetOrMasterToContext( this, context ); + }; + + /** + * Import节点open,解析开始 + * + * @param {Object} context 语法分析环境对象 + */ + ImportCommand.prototype.open = + + /** + * Var节点open,解析开始 + * + * @param {Object} context 语法分析环境对象 + */ + VarCommand.prototype.open = + + /** + * Use节点open,解析开始 + * + * @param {Object} context 语法分析环境对象 + */ + UseCommand.prototype.open = function ( context ) { + var parent = context.stack.top(); + this.parent = parent; + parent.addChild( this ); + }; + + + /** + * 节点open前的处理动作:节点不在target中时,自动创建匿名target + * + * @param {Object} context 语法分析环境对象 + */ + UseCommand.prototype.beforeOpen = + + /** + * 节点open前的处理动作:节点不在target中时,自动创建匿名target + * + * @param {Object} context 语法分析环境对象 + */ + ImportCommand.prototype.beforeOpen = + + /** + * 节点open前的处理动作:节点不在target中时,自动创建匿名target + * + * @param {Object} context 语法分析环境对象 + */ + VarCommand.prototype.beforeOpen = + + /** + * 节点open前的处理动作:节点不在target中时,自动创建匿名target + * + * @param {Object} context 语法分析环境对象 + */ + ForCommand.prototype.beforeOpen = + + /** + * 节点open前的处理动作:节点不在target中时,自动创建匿名target + * + * @param {Object} context 语法分析环境对象 + */ + FilterCommand.prototype.beforeOpen = + + /** + * 节点open前的处理动作:节点不在target中时,自动创建匿名target + * + * @param {Object} context 语法分析环境对象 + */ + IfCommand.prototype.beforeOpen = + + /** + * 文本节点被添加到分析环境前的处理动作:节点不在target中时,自动创建匿名target + * + * @param {Object} context 语法分析环境对象 + */ + TextNode.prototype.beforeAdd = function ( context ) { + if ( context.stack.bottom() ) { + return; + } + + var target = new TargetCommand( generateGUID(), context.engine ); + target.open( context ); + }; + + /** + * 节点解析结束 + * 由于use节点无需闭合,处理时不会入栈,所以将close置为空函数 + * + * @param {Object} context 语法分析环境对象 + */ + UseCommand.prototype.close = + + /** + * 节点解析结束 + * 由于import节点无需闭合,处理时不会入栈,所以将close置为空函数 + * + * @param {Object} context 语法分析环境对象 + */ + ImportCommand.prototype.close = + + /** + * 节点解析结束 + * 由于else节点无需闭合,处理时不会入栈,闭合由if负责。所以将close置为空函数 + * + * @param {Object} context 语法分析环境对象 + */ + ElseCommand.prototype.close = + + /** + * 节点解析结束 + * 由于var节点无需闭合,处理时不会入栈,所以将close置为空函数 + * + * @param {Object} context 语法分析环境对象 + */ + VarCommand.prototype.close = function () {}; + + /** + * 获取内容 + * + * @return {string} + */ + ImportCommand.prototype.getContent = function () { + var target = this.engine.targets[ this.name ]; + return target.getContent(); + }; + + /** + * 获取renderer body的生成代码 + * + * @return {string} + */ + ImportCommand.prototype.getRendererBody = function () { + var target = this.engine.targets[ this.name ]; + return target.getRendererBody(); + }; + + /** + * 获取renderer body的生成代码 + * + * @return {string} + */ + UseCommand.prototype.getRendererBody = function () { + return stringFormat( + '{0}engine.render({2},{{3}}){1}', + RENDER_STRING_ADD_START, + RENDER_STRING_ADD_END, + stringLiteralize( this.name ), + compileVariable( this.args, this.engine ).replace( + /(^|,)\s*([a-z0-9_]+)\s*=/ig, + function ( match, start, argName ) { + return (start || '') + stringLiteralize( argName ) + ':'; + } + ) + ); + }; + + /** + * 获取renderer body的生成代码 + * + * @return {string} + */ + VarCommand.prototype.getRendererBody = function () { + if ( this.expr ) { + return stringFormat( + 'v[{0}]={1};', + stringLiteralize( this.name ), + compileVariable( this.expr, this.engine ) + ); + } + + return ''; + }; + + /** + * 获取renderer body的生成代码 + * + * @return {string} + */ + IfCommand.prototype.getRendererBody = function () { + var rendererBody = stringFormat( + 'if({0}){{1}}', + compileVariable( this.value, this.engine ), + Command.prototype.getRendererBody.call( this ) + ); + + var elseCommand = this[ 'else' ]; + if ( elseCommand ) { + return [ + rendererBody, + stringFormat( + 'else{{0}}', + elseCommand.getRendererBody() + ) + ].join( '' ); + } + + return rendererBody; + }; + + /** + * 获取renderer body的生成代码 + * + * @return {string} + */ + ForCommand.prototype.getRendererBody = function () { + return stringFormat( + '' + + 'var {0}={1};' + + 'if({0} instanceof Array)' + + 'for (var {4}=0,{5}={0}.length;{4}<{5};{4}++){v[{2}]={4};v[{3}]={0}[{4}];{6}}' + + 'else if(typeof {0}==="object")' + + 'for(var {4} in {0}){v[{2}]={4};v[{3}]={0}[{4}];{6}}', + generateGUID(), + compileVariable( this.list, this.engine ), + stringLiteralize( this.index || generateGUID() ), + stringLiteralize( this.item ), + generateGUID(), + generateGUID(), + Command.prototype.getRendererBody.call( this ) + ); + }; + + /** + * 获取renderer body的生成代码 + * + * @return {string} + */ + FilterCommand.prototype.getRendererBody = function () { + var args = this.args; + return stringFormat( + '{2}fs[{5}]((function(){{0}{4}{1}})(){6}){3}', + RENDER_STRING_DECLATION, + RENDER_STRING_RETURN, + RENDER_STRING_ADD_START, + RENDER_STRING_ADD_END, + Command.prototype.getRendererBody.call( this ), + stringLiteralize( this.name ), + args ? ',' + compileVariable( args, this.engine ) : '' + ); + }; + + /** + * content节点open,解析开始 + * + * @param {Object} context 语法分析环境对象 + */ + ContentCommand.prototype.open = function ( context ) { + autoCloseCommand( context, ContentCommand ); + Command.prototype.open.call( this, context ); + context.targetOrMaster.contents[ this.name ] = this; + }; + + /** + * content节点open,解析开始 + * + * @param {Object} context 语法分析环境对象 + */ + ContentPlaceHolderCommand.prototype.open = function ( context ) { + autoCloseCommand( context, ContentPlaceHolderCommand ); + Command.prototype.open.call( this, context ); + }; + + /** + * 节点自动闭合,解析结束 + * + * @param {Object} context 语法分析环境对象 + */ + ContentCommand.prototype.autoClose = + + /** + * 节点自动闭合,解析结束 + * + * @param {Object} context 语法分析环境对象 + */ + IfCommand.prototype.autoClose = Command.prototype.close; + + /** + * 节点自动闭合,解析结束 + * contentplaceholder的自动结束逻辑为,在其开始位置后马上结束 + * 所以,其自动结束时children应赋予其所属的parent,也就是master + * + * @param {Object} context 语法分析环境对象 + */ + ContentPlaceHolderCommand.prototype.autoClose = function ( context ) { + var parentChildren = this.parent.children; + parentChildren.push.apply( parentChildren, this.children ); + this.children.length = 0; + this.close( context ); + }; + + /** + * 添加子节点 + * + * @param {TextNode|Command} node 子节点 + */ + IfCommand.prototype.addChild = function ( node ) { + var elseCommand = this[ 'else' ]; + ( elseCommand + ? elseCommand.children + : this.children + ).push( node ); + }; + + /** + * elif节点open,解析开始 + * + * @param {Object} context 语法分析环境对象 + */ + ElifCommand.prototype.open = function ( context ) { + var elseCommand = new ElseCommand(); + elseCommand.open( context ); + + var ifCommand = autoCloseCommand( context, IfCommand ); + ifCommand.addChild( this ); + context.stack.push( this ); + }; + + /** + * else节点open,解析开始 + * + * @param {Object} context 语法分析环境对象 + */ + ElseCommand.prototype.open = function ( context ) { + var ifCommand = autoCloseCommand( context, IfCommand ); + + ifCommand[ 'else' ] = this; + context.stack.push( ifCommand ); + }; + + /** + * 命令类型集合 + * + * @type {Object} + */ + var commandTypes = {}; + + /** + * 添加命令类型 + * + * @inner + * @param {string} name 命令名称 + * @param {Function} Type 处理命令用到的类 + */ + function addCommandType( name, Type ) { + commandTypes[ name ] = Type; + Type.prototype.type = name; + } + + addCommandType( 'target', TargetCommand ); + addCommandType( 'master', MasterCommand ); + addCommandType( 'content', ContentCommand ); + addCommandType( 'contentplaceholder', ContentPlaceHolderCommand ); + addCommandType( 'import', ImportCommand ); + addCommandType( 'use', UseCommand ); + addCommandType( 'var', VarCommand ); + addCommandType( 'for', ForCommand ); + addCommandType( 'if', IfCommand ); + addCommandType( 'elif', ElifCommand ); + addCommandType( 'else', ElseCommand ); + addCommandType( 'filter', FilterCommand ); + + + /** + * etpl引擎类 + * + * @constructor + * @param {Object=} options 引擎参数 + * @param {string=} options.commandOpen 命令语法起始串 + * @param {string=} options.commandClose 命令语法结束串 + * @param {string=} options.defaultFilter 默认变量替换的filter + * @param {boolean=} options.strip 是否清除命令标签前后的空白字符 + * @param {string=} options.namingConflict target或master名字冲突时的处理策略 + */ + function Engine( options ) { + this.options = { + commandOpen: '', + variableOpen: '${', + variableClose: '}', + defaultFilter: 'html' + }; + + this.config( options ); + this.masters = {}; + this.targets = {}; + this.filters = extend({}, DEFAULT_FILTERS); + } + + /** + * 配置引擎参数,设置的参数将被合并到现有参数中 + * + * @param {Object} options 参数对象 + * @param {string=} options.commandOpen 命令语法起始串 + * @param {string=} options.commandClose 命令语法结束串 + * @param {string=} options.defaultFilter 默认变量替换的filter + * @param {boolean=} options.strip 是否清除命令标签前后的空白字符 + * @param {string=} options.namingConflict target或master名字冲突时的处理策略 + */ + Engine.prototype.config = function ( options ) { + extend( this.options, options ); + }; + + /** + * 解析模板并编译,返回第一个target编译后的renderer函数。 + * + * @param {string} source 模板源代码 + * @return {function(Object):string} + */ + Engine.prototype.compile = + + /** + * 解析模板并编译,返回第一个target编译后的renderer函数。 + * 该方法的存在为了兼容老模板引擎 + * + * @param {string} source 模板源代码 + * @return {function(Object):string} + */ + Engine.prototype.parse = function ( source ) { + if ( source ) { + var targetNames = parseSource( source, this ); + if ( targetNames.length ) { + return this.targets[ targetNames[ 0 ] ].getRenderer(); + } + } + + return new Function('return ""'); + }; + + /** + * 根据target名称获取编译后的renderer函数 + * + * @param {string} name target名称 + * @return {function(Object):string} + */ + Engine.prototype.getRenderer = function ( name ) { + var target = this.targets[ name ]; + if ( target ) { + return target.getRenderer(); + } + }; + + /** + * 根据target名称获取模板内容 + * + * @param {string} name target名称 + * @return {string} + */ + Engine.prototype.get = function ( name ) { + var target = this.targets[ name ]; + if ( target ) { + return target.getContent(); + } + + return ''; + }; + + /** + * 执行模板渲染,返回渲染后的字符串。 + * + * @param {string} name target名称 + * @param {Object=} data 模板数据。 + * 可以是plain object, + * 也可以是带有 {string}get({string}name) 方法的对象 + * @return {string} + */ + Engine.prototype.render = function ( name, data ) { + var renderer = this.getRenderer( name ); + if ( renderer ) { + return renderer( data ); + } + + return ''; + }; + + /** + * 增加过滤器 + * + * @param {string} name 过滤器名称 + * @param {Function} filter 过滤函数 + */ + Engine.prototype.addFilter = function ( name, filter ) { + if ( typeof filter == 'function' ) { + this.filters[ name ] = filter; + } + }; + + /** + * 解析源代码 + * + * @inner + * @param {string} source 模板源代码 + * @param {Engine} engine 引擎实例 + * @return {Array} target名称列表 + */ + function parseSource( source, engine ) { + var commandOpen = engine.options.commandOpen; + var commandClose = engine.options.commandClose; + + var stack = new Stack(); + var analyseContext = { + engine: engine, + targets: [], + stack: stack + }; + + // text节点内容缓冲区,用于合并多text + var textBuf = []; + + /** + * 将缓冲区中的text节点内容写入 + * + * @inner + */ + function flushTextBuf() { + if ( textBuf.length > 0 ) { + var text = textBuf.join( '' ); + var textNode = new TextNode( text, engine ); + textNode.beforeAdd( analyseContext ); + + stack.top().addTextNode( textNode ); + textBuf = []; + + if ( engine.options.strip + && analyseContext.current instanceof Command + ) { + textNode.value = text.replace( /^[\x20\t\r]*\n/, '' ); + } + analyseContext.current = textNode; + } + } + + var NodeType; + + /** + * 判断节点是否是NodeType类型的实例 + * 用于在stack中find提供filter + * + * @inner + * @param {Command} node 目标节点 + * @return {boolean} + */ + function isInstanceofNodeType( node ) { + return node instanceof NodeType; + } + + parseTextBlock( + source, commandOpen, commandClose, 0, + + function ( text ) { // 内文本的处理函数 + var match = /^\s*(\/)?([a-z]+)\s*(:([\s\S]*))?$/.exec( text ); + + // 符合command规则,并且存在相应的Command类,说明是合法有含义的Command + // 否则,为不具有command含义的普通文本 + if ( match + && ( NodeType = commandTypes[ match[2].toLowerCase() ] ) + && typeof NodeType == 'function' + ) { + // 先将缓冲区中的text节点内容写入 + flushTextBuf(); + + var currentNode = analyseContext.current; + if ( engine.options.strip && currentNode instanceof TextNode ) { + currentNode.value = currentNode.value + .replace( /\r?\n[\x20\t]*$/, '\n' ); + } + + if ( match[1] ) { + currentNode = stack.find( isInstanceofNodeType ); + currentNode && currentNode.close( analyseContext ); + } + else { + currentNode = new NodeType( match[4], engine ); + if ( typeof currentNode.beforeOpen == 'function' ) { + currentNode.beforeOpen( analyseContext ); + } + currentNode.open( analyseContext ); + } + + analyseContext.current = currentNode; + } + else if ( !/^\s*\/\//.test( text ) ) { + // 如果不是模板注释,则作为普通文本,写入缓冲区 + textBuf.push( commandOpen, text, commandClose ); + } + + NodeType = null; + }, + + function ( text ) { // 外,普通文本的处理函数 + // 普通文本直接写入缓冲区 + textBuf.push( text ); + } + ); + + + flushTextBuf(); // 将缓冲区中的text节点内容写入 + autoCloseCommand( analyseContext ); + + return analyseContext.targets; + } + + var etpl = new Engine(); + etpl.Engine = Engine; + + if ( typeof exports == 'object' && typeof module == 'object' ) { + // For CommonJS + exports = module.exports = etpl; + } + else if ( typeof define == 'function' && define.amd ) { + // For AMD + define( etpl ); + } + else { + // For + */ + // notice: timestamp + var baseReg = /^(.*)(seed|kissy)(-aio)?(-min)?\.js[^/]*/i, + baseTestReg = /(seed|kissy)(-aio)?(-min)?\.js/i; + + function getBaseUrl(script) { + var src = utils.absoluteFilePath(script.src), + prefix = script.getAttribute('data-combo-prefix') || '??', + sep = script.getAttribute('data-combo-sep') || ',', + parts = src.split(sep), + base, + part0 = parts[0], + index = part0.indexOf(prefix); + // no combo + if (index == -1) { + base = src.replace(baseReg, '$1'); + } else { + base = part0.substring(0, index); + var part01 = part0.substring(index + 2, part0.length); + // combo first + // notice use match better than test + if (part01.match(baseTestReg)) { + base += part01.replace(baseReg, '$1'); + } + // combo after first + else { + S.each(parts, function (part) { + if (part.match(baseTestReg)) { + base += part.replace(baseReg, '$1'); + return false; + } + }); + } + } + return base; + } + + /** + * Initializes loader. + */ + S.__initLoader = function () { + var self = this; + self.Env.mods = self.Env.mods || {}; // all added mods + }; + + S.Env._loadQueue = {}; // information for loading and loaded mods + S.__initLoader(); + + (function () { + // get base from current script file path + var scripts = document.getElementsByTagName('script'), + currentScript = scripts[scripts.length - 1], + base = getBaseUrl(currentScript); + S.Config.base = utils.normalBasePath(base); + // the default timeout for getScript + S.Config.timeout = 10; + })(); + + S.mix(S.configs, { + base:function (base) { + S.Config.base = utils.normalBasePath(base); + }, + timeout:function (v) { + S.Config.timeout = v; + }, + debug:function (v) { + S.Config.debug = v; + } + }); + + // for S.app working properly + S.each(loader, function (v, k) { + S.__APP_MEMBERS.push(k); + }); + + S.__APP_INIT_METHODS.push('__initLoader'); + +})(KISSY, KISSY.__loader, KISSY.__loaderUtils);/** + * @module web.js + * @author lifesinger@gmail.com,yiminghe@gmail.com + * @description this code can only run at browser environment + */ +(function(S, undefined) { + + var win = S.__HOST, + doc = win['document'], + + docElem = doc.documentElement, + + EMPTY = '', + + // Is the DOM ready to be used? Set to true once it occurs. + isReady = false, + + // The functions to execute on DOM ready. + readyList = [], + + // The number of poll times. + POLL_RETRYS = 500, + + // The poll interval in milliseconds. + POLL_INTERVAL = 40, + + // #id or id + RE_IDSTR = /^#?([\w-]+)$/, + + RE_NOT_WHITE = /\S/; + S.mix(S, { + + + /** + * A crude way of determining if an object is a window + */ + isWindow: function(o) { + return S.type(o) === 'object' + && 'setInterval' in o + && 'document' in o + && o.document.nodeType == 9; + }, + + + parseXML: function(data) { + var xml; + try { + // Standard + if (window.DOMParser) { + xml = new DOMParser().parseFromString(data, "text/xml"); + } else { // IE + xml = new ActiveXObject("Microsoft.XMLDOM"); + xml.async = "false"; + xml.loadXML(data); + } + } catch(e) { + S.log("parseXML error : "); + S.log(e); + xml = undefined; + } + if (!xml || !xml.documentElement || xml.getElementsByTagName("parsererror").length) { + S.error("Invalid XML: " + data); + } + return xml; + }, + + /** + * Evalulates a script in a global context. + */ + globalEval: function(data) { + if (data && RE_NOT_WHITE.test(data)) { + // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context + ( window.execScript || function(data) { + window[ "eval" ].call(window, data); + } )(data); + } + }, + + /** + * Specify a function to execute when the DOM is fully loaded. + * @param fn {Function} A function to execute after the DOM is ready + * + * KISSY.ready(function(S){ }); + * + * @return {KISSY} + */ + ready: function(fn) { + + // If the DOM is already ready + if (isReady) { + // Execute the function immediately + fn.call(win, this); + } else { + // Remember the function for later + readyList.push(fn); + } + + return this; + }, + + /** + * Executes the supplied callback when the item with the supplied id is found. + * @param id The id of the element, or an array of ids to look for. + * @param fn What to execute when the element is found. + */ + available: function(id, fn) { + id = (id + EMPTY).match(RE_IDSTR)[1]; + if (!id || !S.isFunction(fn)) { + return; + } + + var retryCount = 1, + node, + timer = S.later(function() { + if ((node = doc.getElementById(id)) && (fn(node) || 1) || + ++retryCount > POLL_RETRYS) { + timer.cancel(); + } + }, POLL_INTERVAL, true); + } + }); + + + /** + * Binds ready events. + */ + function _bindReady() { + var doScroll = docElem.doScroll, + eventType = doScroll ? 'onreadystatechange' : 'DOMContentLoaded', + COMPLETE = 'complete', + fire = function() { + _fireReady(); + }; + + // Catch cases where ready() is called after the + // browser event has already occurred. + if (doc.readyState === COMPLETE) { + return fire(); + } + + // w3c mode + if (doc.addEventListener) { + function domReady() { + doc.removeEventListener(eventType, domReady, false); + fire(); + } + + doc.addEventListener(eventType, domReady, false); + + // A fallback to window.onload, that will always work + win.addEventListener('load', fire, false); + } + // IE event model is used + else { + function stateChange() { + if (doc.readyState === COMPLETE) { + doc.detachEvent(eventType, stateChange); + fire(); + } + } + + // ensure firing before onload, maybe late but safe also for iframes + doc.attachEvent(eventType, stateChange); + + // A fallback to window.onload, that will always work. + win.attachEvent('onload', fire); + + // If IE and not a frame + // continually check to see if the document is ready + var notframe = false; + + try { + notframe = (win['frameElement'] === null); + } catch(e) { + S.log("frameElement error : "); + S.log(e); + } + + if (doScroll && notframe) { + function readyScroll() { + try { + // Ref: http://javascript.nwbox.com/IEContentLoaded/ + doScroll('left'); + fire(); + } catch(ex) { + //S.log("detect document ready : " + ex); + setTimeout(readyScroll, POLL_INTERVAL); + } + } + + readyScroll(); + } + } + return 0; + } + + /** + * Executes functions bound to ready event. + */ + function _fireReady() { + if (isReady) { + return; + } + + // Remember that the DOM is ready + isReady = true; + + // If there are functions bound, to execute + if (readyList) { + // Execute all of them + var fn, i = 0; + while (fn = readyList[i++]) { + fn.call(win, S); + } + + // Reset the list of functions + readyList = null; + } + } + + // If url contains '?ks-debug', debug mode will turn on automatically. + if (location && (location.search || EMPTY).indexOf('ks-debug') !== -1) { + S.Config.debug = true; + } + + /** + * bind on start + * in case when you bind but the DOMContentLoaded has triggered + * then you has to wait onload + * worst case no callback at all + */ + _bindReady(); + +})(KISSY, undefined); +/** + * 声明 kissy 核心中所包含的模块,动态加载时将直接从 core.js 中加载核心模块 + * @description: 为了和 1.1.7 及以前版本保持兼容,务实与创新,兼容与革新 ! + * @author yiminghe@gmail.com + */ +(function (S) { + S.config({ + 'combines':{ + 'core':['dom', 'ua', 'event', 'node', 'json', 'ajax', 'anim', 'base', 'cookie'] + } + }); +})(KISSY); +/** + combined files : + +D:\code\kissy_git\kissy1.2\src\ua\base.js +D:\code\kissy_git\kissy1.2\src\ua\extra.js +D:\code\kissy_git\kissy1.2\src\ua.js +D:\code\kissy_git\kissy1.2\src\dom\base.js +D:\code\kissy_git\kissy1.2\src\dom\attr.js +D:\code\kissy_git\kissy1.2\src\dom\class.js +D:\code\kissy_git\kissy1.2\src\dom\create.js +D:\code\kissy_git\kissy1.2\src\dom\data.js +D:\code\kissy_git\kissy1.2\src\dom\insertion.js +D:\code\kissy_git\kissy1.2\src\dom\offset.js +D:\code\kissy_git\kissy1.2\src\dom\style.js +D:\code\kissy_git\kissy1.2\src\dom\selector.js +D:\code\kissy_git\kissy1.2\src\dom\style-ie.js +D:\code\kissy_git\kissy1.2\src\dom\traversal.js +D:\code\kissy_git\kissy1.2\src\dom.js +D:\code\kissy_git\kissy1.2\src\event\keycodes.js +D:\code\kissy_git\kissy1.2\src\event\object.js +D:\code\kissy_git\kissy1.2\src\event\utils.js +D:\code\kissy_git\kissy1.2\src\event\base.js +D:\code\kissy_git\kissy1.2\src\event\target.js +D:\code\kissy_git\kissy1.2\src\event\focusin.js +D:\code\kissy_git\kissy1.2\src\event\hashchange.js +D:\code\kissy_git\kissy1.2\src\event\valuechange.js +D:\code\kissy_git\kissy1.2\src\event\delegate.js +D:\code\kissy_git\kissy1.2\src\event\mouseenter.js +D:\code\kissy_git\kissy1.2\src\event\submit.js +D:\code\kissy_git\kissy1.2\src\event\change.js +D:\code\kissy_git\kissy1.2\src\event\mousewheel.js +D:\code\kissy_git\kissy1.2\src\event.js +D:\code\kissy_git\kissy1.2\src\node\base.js +D:\code\kissy_git\kissy1.2\src\node\attach.js +D:\code\kissy_git\kissy1.2\src\node\override.js +D:\code\kissy_git\kissy1.2\src\anim\easing.js +D:\code\kissy_git\kissy1.2\src\anim\manager.js +D:\code\kissy_git\kissy1.2\src\anim\fx.js +D:\code\kissy_git\kissy1.2\src\anim\queue.js +D:\code\kissy_git\kissy1.2\src\anim\base.js +D:\code\kissy_git\kissy1.2\src\anim\color.js +D:\code\kissy_git\kissy1.2\src\anim.js +D:\code\kissy_git\kissy1.2\src\node\anim.js +D:\code\kissy_git\kissy1.2\src\node.js +D:\code\kissy_git\kissy1.2\src\json\json2.js +D:\code\kissy_git\kissy1.2\src\json.js +D:\code\kissy_git\kissy1.2\src\ajax\form-serializer.js +D:\code\kissy_git\kissy1.2\src\ajax\xhrobject.js +D:\code\kissy_git\kissy1.2\src\ajax\base.js +D:\code\kissy_git\kissy1.2\src\ajax\xhrbase.js +D:\code\kissy_git\kissy1.2\src\ajax\subdomain.js +D:\code\kissy_git\kissy1.2\src\ajax\xdr.js +D:\code\kissy_git\kissy1.2\src\ajax\xhr.js +D:\code\kissy_git\kissy1.2\src\ajax\script.js +D:\code\kissy_git\kissy1.2\src\ajax\jsonp.js +D:\code\kissy_git\kissy1.2\src\ajax\form.js +D:\code\kissy_git\kissy1.2\src\ajax\iframe-upload.js +D:\code\kissy_git\kissy1.2\src\ajax.js +D:\code\kissy_git\kissy1.2\src\base\attribute.js +D:\code\kissy_git\kissy1.2\src\base\base.js +D:\code\kissy_git\kissy1.2\src\base.js +D:\code\kissy_git\kissy1.2\src\cookie\base.js +D:\code\kissy_git\kissy1.2\src\cookie.js +D:\code\kissy_git\kissy1.2\src\core.js +**/ + +/** + * @module ua + * @author lifesinger@gmail.com + */ +KISSY.add('ua/base', function() { + + var ua = navigator.userAgent, + EMPTY = '', MOBILE = 'mobile', + core = EMPTY, shell = EMPTY, m, + IE_DETECT_RANGE = [6, 9], v, end, + VERSION_PLACEHOLDER = '{{version}}', + IE_DETECT_TPL = '', + div = document.createElement('div'), s, + o = { + // browser core type + //webkit: 0, + //trident: 0, + //gecko: 0, + //presto: 0, + + // browser type + //chrome: 0, + //safari: 0, + //firefox: 0, + //ie: 0, + //opera: 0 + + //mobile: '', + //core: '', + //shell: '' + }, + numberify = function(s) { + var c = 0; + // convert '1.2.3.4' to 1.234 + return parseFloat(s.replace(/\./g, function() { + return (c++ === 0) ? '.' : ''; + })); + }; + + // try to use IE-Conditional-Comment detect IE more accurately + // IE10 doesn't support this method, @ref: http://blogs.msdn.com/b/ie/archive/2011/07/06/html5-parsing-in-ie10.aspx + div.innerHTML = IE_DETECT_TPL.replace(VERSION_PLACEHOLDER, ''); + s = div.getElementsByTagName('s'); + + if (s.length > 0) { + + shell = 'ie'; + o[core = 'trident'] = 0.1; // Trident detected, look for revision + + // Get the Trident's accurate version + if ((m = ua.match(/Trident\/([\d.]*)/)) && m[1]) { + o[core] = numberify(m[1]); + } + + // Detect the accurate version + // 注意: + // o.shell = ie, 表示外壳是 ie + // 但 o.ie = 7, 并不代表外壳是 ie7, 还有可能是 ie8 的兼容模式 + // 对于 ie8 的兼容模式,还要通过 documentMode 去判断。但此处不能让 o.ie = 8, 否则 + // 很多脚本判断会失误。因为 ie8 的兼容模式表现行为和 ie7 相同,而不是和 ie8 相同 + for (v = IE_DETECT_RANGE[0],end = IE_DETECT_RANGE[1]; v <= end; v++) { + div.innerHTML = IE_DETECT_TPL.replace(VERSION_PLACEHOLDER, v); + if (s.length > 0) { + o[shell] = v; + break; + } + } + + } else { + + // WebKit + if ((m = ua.match(/AppleWebKit\/([\d.]*)/)) && m[1]) { + o[core = 'webkit'] = numberify(m[1]); + + // Chrome + if ((m = ua.match(/Chrome\/([\d.]*)/)) && m[1]) { + o[shell = 'chrome'] = numberify(m[1]); + } + // Safari + else if ((m = ua.match(/\/([\d.]*) Safari/)) && m[1]) { + o[shell = 'safari'] = numberify(m[1]); + } + + // Apple Mobile + if (/ Mobile\//.test(ua)) { + o[MOBILE] = 'apple'; // iPad, iPhone or iPod Touch + } + // Other WebKit Mobile Browsers + else if ((m = ua.match(/NokiaN[^\/]*|Android \d\.\d|webOS\/\d\.\d/))) { + o[MOBILE] = m[0].toLowerCase(); // Nokia N-series, Android, webOS, ex: NokiaN95 + } + } + // NOT WebKit + else { + // Presto + // ref: http://www.useragentstring.com/pages/useragentstring.php + if ((m = ua.match(/Presto\/([\d.]*)/)) && m[1]) { + o[core = 'presto'] = numberify(m[1]); + + // Opera + if ((m = ua.match(/Opera\/([\d.]*)/)) && m[1]) { + o[shell = 'opera'] = numberify(m[1]); // Opera detected, look for revision + + if ((m = ua.match(/Opera\/.* Version\/([\d.]*)/)) && m[1]) { + o[shell] = numberify(m[1]); + } + + // Opera Mini + if ((m = ua.match(/Opera Mini[^;]*/)) && m) { + o[MOBILE] = m[0].toLowerCase(); // ex: Opera Mini/2.0.4509/1316 + } + // Opera Mobile + // ex: Opera/9.80 (Windows NT 6.1; Opera Mobi/49; U; en) Presto/2.4.18 Version/10.00 + // issue: 由于 Opera Mobile 有 Version/ 字段,可能会与 Opera 混淆,同时对于 Opera Mobile 的版本号也比较混乱 + else if ((m = ua.match(/Opera Mobi[^;]*/)) && m) { + o[MOBILE] = m[0]; + } + } + + // NOT WebKit or Presto + } else { + // MSIE + // 由于最开始已经使用了 IE 条件注释判断,因此落到这里的唯一可能性只有 IE10+ + if ((m = ua.match(/MSIE\s([^;]*)/)) && m[1]) { + o[core = 'trident'] = 0.1; // Trident detected, look for revision + o[shell = 'ie'] = numberify(m[1]); + + // Get the Trident's accurate version + if ((m = ua.match(/Trident\/([\d.]*)/)) && m[1]) { + o[core] = numberify(m[1]); + } + + // NOT WebKit, Presto or IE + } else { + // Gecko + if ((m = ua.match(/Gecko/))) { + o[core = 'gecko'] = 0.1; // Gecko detected, look for revision + if ((m = ua.match(/rv:([\d.]*)/)) && m[1]) { + o[core] = numberify(m[1]); + } + + // Firefox + if ((m = ua.match(/Firefox\/([\d.]*)/)) && m[1]) { + o[shell = 'firefox'] = numberify(m[1]); + } + } + } + } + } + } + + o.core = core; + o.shell = shell; + o._numberify = numberify; + return o; +}); + +/** + * NOTES: + * + * 2011.11.08 + * - ie < 10 使用条件注释判断内核,更精确 by gonghaocn@gmail.com + * + * 2010.03 + * - jQuery, YUI 等类库都推荐用特性探测替代浏览器嗅探。特性探测的好处是能自动适应未来设备和未知设备,比如 + * if(document.addEventListener) 假设 IE9 支持标准事件,则代码不用修改,就自适应了“未来浏览器”。 + * 对于未知浏览器也是如此。但是,这并不意味着浏览器嗅探就得彻底抛弃。当代码很明确就是针对已知特定浏览器的, + * 同时并非是某个特性探测可以解决时,用浏览器嗅探反而能带来代码的简洁,同时也也不会有什么后患。总之,一切 + * 皆权衡。 + * - UA.ie && UA.ie < 8 并不意味着浏览器就不是 IE8, 有可能是 IE8 的兼容模式。进一步的判断需要使用 documentMode. + * + * TODO: + * - test mobile + * - 3Q 大战后,360 去掉了 UA 信息中的 360 信息,需采用 res 方法去判断 + * + */ + +/** + * @module ua-extra + * @author gonghao + */ +KISSY.add('ua/extra', function(S, UA) { + var ua = navigator.userAgent, + m, external, shell, + o = { }, + numberify = UA._numberify; + + /** + * 说明: + * @子涯总结的各国产浏览器的判断依据: http://spreadsheets0.google.com/ccc?key=tluod2VGe60_ceDrAaMrfMw&hl=zh_CN#gid=0 + * 根据 CNZZ 2009 年度浏览器占用率报告,优化了判断顺序:http://www.tanmi360.com/post/230.htm + * 如果检测出浏览器,但是具体版本号未知用 0.1 作为标识 + * 世界之窗 & 360 浏览器,在 3.x 以下的版本都无法通过 UA 或者特性检测进行判断,所以目前只要检测到 UA 关键字就认为起版本号为 3 + */ + + // 360Browser + if (m = ua.match(/360SE/)) { + o[shell = 'se360'] = 3; // issue: 360Browser 2.x cannot be recognised, so if recognised default set verstion number to 3 + } + // Maxthon + else if ((m = ua.match(/Maxthon/)) && (external = window.external)) { + // issue: Maxthon 3.x in IE-Core cannot be recognised and it doesn't have exact version number + // but other maxthon versions all have exact version number + shell = 'maxthon'; + try { + o[shell] = numberify(external['max_version']); + } catch(ex) { + o[shell] = 0.1; + } + } + // TT + else if (m = ua.match(/TencentTraveler\s([\d.]*)/)) { + o[shell = 'tt'] = m[1] ? numberify(m[1]) : 0.1; + } + // TheWorld + else if (m = ua.match(/TheWorld/)) { + o[shell = 'theworld'] = 3; // issue: TheWorld 2.x cannot be recognised, so if recognised default set verstion number to 3 + } + // Sougou + else if (m = ua.match(/SE\s([\d.]*)/)) { + o[shell = 'sougou'] = m[1] ? numberify(m[1]) : 0.1; + } + + // If the browser has shell(no matter IE-core or Webkit-core or others), set the shell key + shell && (o.shell = shell); + + S.mix(UA, o); + return UA; +}, { + requires:["ua/base"] +}); + +KISSY.add("ua", function(S,UA) { + return UA; +}, { + requires:["ua/extra"] +}); + +/** + * @module dom + * @author yiminghe@gmail.com,lifesinger@gmail.com + */ +KISSY.add('dom/base', function(S, UA, undefined) { + + function nodeTypeIs(node, val) { + return node && node.nodeType === val; + } + + + var NODE_TYPE = { + /** + * enumeration of dom node type + * @type Number + */ + ELEMENT_NODE : 1, + "ATTRIBUTE_NODE" : 2, + TEXT_NODE:3, + "CDATA_SECTION_NODE" : 4, + "ENTITY_REFERENCE_NODE": 5, + "ENTITY_NODE" : 6, + "PROCESSING_INSTRUCTION_NODE" :7, + COMMENT_NODE : 8, + DOCUMENT_NODE : 9, + "DOCUMENT_TYPE_NODE" : 10, + DOCUMENT_FRAGMENT_NODE : 11, + "NOTATION_NODE" : 12 + }; + var DOM = { + + _isCustomDomain :function (win) { + win = win || window; + var domain = win.document.domain, + hostname = win.location.hostname; + return domain != hostname && + domain != ( '[' + hostname + ']' ); // IPv6 IP support + }, + + _genEmptyIframeSrc:function(win) { + win = win || window; + if (UA['ie'] && DOM._isCustomDomain(win)) { + return 'javascript:void(function(){' + encodeURIComponent("" + + "document.open();" + + "document.domain='" + + win.document.domain + + "';" + + "document.close();") + "}())"; + } + }, + + _NODE_TYPE:NODE_TYPE, + + + /** + * 是不是 element node + */ + _isElementNode: function(elem) { + return nodeTypeIs(elem, DOM.ELEMENT_NODE); + }, + + /** + * elem 为 window 时,直接返回 + * elem 为 document 时,返回关联的 window + * elem 为 undefined 时,返回当前 window + * 其它值,返回 false + */ + _getWin: function(elem) { + return (elem && ('scrollTo' in elem) && elem['document']) ? + elem : + nodeTypeIs(elem, DOM.DOCUMENT_NODE) ? + elem.defaultView || elem.parentWindow : + (elem === undefined || elem === null) ? + window : false; + }, + + _nodeTypeIs: nodeTypeIs, + + // Ref: http://lifesinger.github.com/lab/2010/nodelist.html + _isNodeList:function(o) { + // 注1:ie 下,有 window.item, typeof node.item 在 ie 不同版本下,返回值不同 + // 注2:select 等元素也有 item, 要用 !node.nodeType 排除掉 + // 注3:通过 namedItem 来判断不可靠 + // 注4:getElementsByTagName 和 querySelectorAll 返回的集合不同 + // 注5: 考虑 iframe.contentWindow + return o && !o.nodeType && o.item && !o.setTimeout; + }, + + _nodeName:function(e, name) { + return e && e.nodeName.toLowerCase() === name.toLowerCase(); + } + }; + + S.mix(DOM, NODE_TYPE); + + return DOM; + +}, { + requires:['ua'] +}); + +/** + * 2011-08 + * - 添加键盘枚举值,方便依赖程序清晰 + */ + +/** + * @module dom-attr + * @author yiminghe@gmail.com,lifesinger@gmail.com + */ +KISSY.add('dom/attr', function(S, DOM, UA, undefined) { + + var doc = document, + docElement = doc.documentElement, + oldIE = !docElement.hasAttribute, + TEXT = docElement.textContent === undefined ? + 'innerText' : 'textContent', + EMPTY = '', + nodeName = DOM._nodeName, + isElementNode = DOM._isElementNode, + rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i, + rfocusable = /^(?:button|input|object|select|textarea)$/i, + rclickable = /^a(?:rea)?$/i, + rinvalidChar = /:|^on/, + rreturn = /\r/g, + attrFix = { + }, + attrFn = { + val: 1, + css: 1, + html: 1, + text: 1, + data: 1, + width: 1, + height: 1, + offset: 1, + scrollTop:1, + scrollLeft:1 + }, + attrHooks = { + // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ + tabindex:{ + get:function(el) { + // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set + var attributeNode = el.getAttributeNode("tabindex"); + return attributeNode && attributeNode.specified ? + parseInt(attributeNode.value, 10) : + rfocusable.test(el.nodeName) || rclickable.test(el.nodeName) && el.href ? + 0 : + undefined; + } + }, + // 在标准浏览器下,用 getAttribute 获取 style 值 + // IE7- 下,需要用 cssText 来获取 + // 统一使用 cssText + style:{ + get:function(el) { + return el.style.cssText; + }, + set:function(el, val) { + el.style.cssText = val; + } + } + }, + propFix = { + tabindex: "tabIndex", + readonly: "readOnly", + "for": "htmlFor", + "class": "className", + maxlength: "maxLength", + cellspacing: "cellSpacing", + "cellpadding": "cellPadding", + rowspan: "rowSpan", + colspan: "colSpan", + usemap: "useMap", + frameborder: "frameBorder", + "contenteditable": "contentEditable" + }, + // Hook for boolean attributes + // if bool is false + // - standard browser returns null + // - ie<8 return false + // - so norm to undefined + boolHook = { + get: function(elem, name) { + // 转发到 prop 方法 + return DOM.prop(elem, name) ? + // 根据 w3c attribute , true 时返回属性名字符串 + name.toLowerCase() : + undefined; + }, + set: function(elem, value, name) { + var propName; + if (value === false) { + // Remove boolean attributes when set to false + DOM.removeAttr(elem, name); + } else { + // 直接设置 true,因为这是 bool 类属性 + propName = propFix[ name ] || name; + if (propName in elem) { + // Only set the IDL specifically if it already exists on the element + elem[ propName ] = true; + } + elem.setAttribute(name, name.toLowerCase()); + } + return name; + } + }, + propHooks = {}, + // get attribute value from attribute node , only for ie + attrNodeHook = { + }, + valHooks = { + option: { + get: function(elem) { + // 当没有设定 value 时,标准浏览器 option.value === option.text + // ie7- 下,没有设定 value 时,option.value === '', 需要用 el.attributes.value 来判断是否有设定 value + var val = elem.attributes.value; + return !val || val.specified ? elem.value : elem.text; + } + }, + select: { + // 对于 select, 特别是 multiple type, 存在很严重的兼容性问题 + get: function(elem) { + var index = elem.selectedIndex, + options = elem.options, + one = elem.type === "select-one"; + + // Nothing was selected + if (index < 0) { + return null; + } else if (one) { + return DOM.val(options[index]); + } + + // Loop through all the selected options + var ret = [], i = 0, len = options.length; + for (; i < len; ++i) { + if (options[i].selected) { + ret.push(DOM.val(options[i])); + } + } + // Multi-Selects return an array + return ret; + }, + + set: function(elem, value) { + var values = S.makeArray(value), + opts = elem.options; + S.each(opts, function(opt) { + opt.selected = S.inArray(DOM.val(opt), values); + }); + + if (!values.length) { + elem.selectedIndex = -1; + } + return values; + } + }}; + + function isTextNode(elem) { + return DOM._nodeTypeIs(elem, DOM.TEXT_NODE); + } + + if (oldIE) { + + // get attribute value from attribute node for ie + attrNodeHook = { + get: function(elem, name) { + var ret; + ret = elem.getAttributeNode(name); + // Return undefined if nodeValue is empty string + return ret && ret.nodeValue !== "" ? + ret.nodeValue : + undefined; + }, + set: function(elem, value, name) { + // Check form objects in IE (multiple bugs related) + // Only use nodeValue if the attribute node exists on the form + var ret = elem.getAttributeNode(name); + if (ret) { + ret.nodeValue = value; + } else { + try { + var attr = elem.ownerDocument.createAttribute(name); + attr.value = value; + elem.setAttributeNode(attr); + } + catch (e) { + // It's a real failure only if setAttribute also fails. + return elem.setAttribute(name, value, 0); + } + } + } + }; + + + // ie6,7 不区分 attribute 与 property + attrFix = propFix; + // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ + attrHooks.tabIndex = attrHooks.tabindex; + // fix ie bugs + // 不光是 href, src, 还有 rowspan 等非 mapping 属性,也需要用第 2 个参数来获取原始值 + // 注意 colSpan rowSpan 已经由 propFix 转为大写 + S.each([ "href", "src", "width", "height","colSpan","rowSpan" ], function(name) { + attrHooks[ name ] = { + get: function(elem) { + var ret = elem.getAttribute(name, 2); + return ret === null ? undefined : ret; + } + }; + }); + // button 元素的 value 属性和其内容冲突 + // + valHooks.button = attrHooks.value = attrNodeHook; + } + + // Radios and checkboxes getter/setter + + S.each([ "radio", "checkbox" ], function(r) { + valHooks[ r ] = { + get: function(elem) { + // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified + return elem.getAttribute("value") === null ? "on" : elem.value; + }, + set: function(elem, value) { + if (S.isArray(value)) { + return elem.checked = S.inArray(DOM.val(elem), value); + } + } + + }; + }); + + function getProp(elem, name) { + name = propFix[ name ] || name; + var hook = propHooks[ name ]; + if (hook && hook.get) { + return hook.get(elem, name); + + } else { + return elem[ name ]; + } + } + + S.mix(DOM, { + + /** + * 自定义属性不推荐使用,使用 .data + * @param selector + * @param name + * @param value + */ + prop: function(selector, name, value) { + // suports hash + if (S.isPlainObject(name)) { + for (var k in name) { + DOM.prop(selector, k, name[k]); + } + return; + } + var elems = DOM.query(selector); + // Try to normalize/fix the name + name = propFix[ name ] || name; + var hook = propHooks[ name ]; + if (value !== undefined) { + elems.each(function(elem) { + if (hook && hook.set) { + hook.set(elem, value, name); + } else { + elem[ name ] = value; + } + }); + } else { + if (elems.length) { + return getProp(elems[0], name); + } + } + }, + + /** + * 是否其中一个元素包含指定 property + * @param selector + * @param name + */ + hasProp:function(selector, name) { + var elems = DOM.query(selector); + for (var i = 0; i < elems.length; i++) { + var el = elems[i]; + if (getProp(el, name) !== undefined) { + return true; + } + } + return false; + }, + + /** + * 不推荐使用,使用 .data .removeData + * @param selector + * @param name + */ + removeProp:function(selector, name) { + name = propFix[ name ] || name; + DOM.query(selector).each(function(el) { + try { + el[ name ] = undefined; + delete el[ name ]; + } catch(e) { + S.log("delete el property error : "); + S.log(e); + } + }); + }, + + /** + * Gets the value of an attribute for the first element in the set of matched elements or + * Sets an attribute for the set of matched elements. + */ + attr:function(selector, name, val, pass) { + /* + Hazards From Caja Note: + + - In IE[67], el.setAttribute doesn't work for attributes like + 'class' or 'for'. IE[67] expects you to set 'className' or + 'htmlFor'. Caja use setAttributeNode solves this problem. + + - In IE[67], elements can shadow attributes. If el is a + form that contains an named x, then el.setAttribute(x, y) + will set x's value rather than setting el's attribute. Using + setAttributeNode solves this problem. + + - In IE[67], the style attribute can only be modified by setting + el.style.cssText. Neither setAttribute nor setAttributeNode will + work. el.style.cssText isn't bullet-proof, since it can be + shadowed by elements. + + - In IE[67], you can never change the type of an ' + this.options.header + '' : ''; + var searchbox = this.options.liveSearch ? + '' + : ''; + var actionsbox = this.multiple && this.options.actionsBox ? + '
    ' + + '
    ' + + '' + + '' + + '
    ' + + '
    ' + : ''; + var donebutton = this.multiple && this.options.doneButton ? + '
    ' + + '
    ' + + '' + + '
    ' + + '
    ' + : ''; + var drop = + '
    ' + + '' + + '' + + '
    '; + + return $(drop); + }, + + createView: function () { + var $drop = this.createDropdown(), + li = this.createLi(); + + $drop.find('ul')[0].innerHTML = li; + return $drop; + }, + + reloadLi: function () { + //Remove all children. + this.destroyLi(); + //Re build + var li = this.createLi(); + this.$menuInner[0].innerHTML = li; + }, + + destroyLi: function () { + this.$menu.find('li').remove(); + }, + + createLi: function () { + var that = this, + _li = [], + optID = 0, + titleOption = document.createElement('option'), + liIndex = -1; // increment liIndex whenever a new
  • element is created to ensure liObj is correct + + // Helper functions + /** + * @param content + * @param [index] + * @param [classes] + * @param [optgroup] + * @returns {string} + */ + var generateLI = function (content, index, classes, optgroup) { + return '' + content + '
  • '; + }; + + /** + * @param text + * @param [classes] + * @param [inline] + * @param [tokens] + * @returns {string} + */ + var generateA = function (text, classes, inline, tokens) { + return '' + text + + '' + + ''; + }; + + if (this.options.title && !this.multiple) { + // this option doesn't create a new
  • element, but does add a new option, so liIndex is decreased + // since liObj is recalculated on every refresh, liIndex needs to be decreased even if the titleOption is already appended + liIndex--; + + if (!this.$element.find('.bs-title-option').length) { + // Use native JS to prepend option (faster) + var element = this.$element[0]; + titleOption.className = 'bs-title-option'; + titleOption.appendChild(document.createTextNode(this.options.title)); + titleOption.value = ''; + element.insertBefore(titleOption, element.firstChild); + // Check if selected or data-selected attribute is already set on an option. If not, select the titleOption option. + // the selected item may have been changed by user or programmatically before the bootstrap select plugin runs, + // if so, the select will have the data-selected attribute + var $opt = $(element.options[element.selectedIndex]); + if ($opt.attr('selected') === undefined && this.$element.data('selected') === undefined) { + titleOption.selected = true; + } + } + } + + this.$element.find('option').each(function (index) { + var $this = $(this); + + liIndex++; + + if ($this.hasClass('bs-title-option')) return; + + // Get the class and text for the option + var optionClass = this.className || '', + inline = this.style.cssText, + text = $this.data('content') ? $this.data('content') : $this.html(), + tokens = $this.data('tokens') ? $this.data('tokens') : null, + subtext = typeof $this.data('subtext') !== 'undefined' ? '' + $this.data('subtext') + '' : '', + icon = typeof $this.data('icon') !== 'undefined' ? ' ' : '', + $parent = $this.parent(), + isOptgroup = $parent[0].tagName === 'OPTGROUP', + isOptgroupDisabled = isOptgroup && $parent[0].disabled, + isDisabled = this.disabled || isOptgroupDisabled; + + if (icon !== '' && isDisabled) { + icon = '' + icon + ''; + } + + if (that.options.hideDisabled && (isDisabled && !isOptgroup || isOptgroupDisabled)) { + liIndex--; + return; + } + + if (!$this.data('content')) { + // Prepend any icon and append any subtext to the main text. + text = icon + '' + text + subtext + ''; + } + + if (isOptgroup && $this.data('divider') !== true) { + if (that.options.hideDisabled && isDisabled) { + if ($parent.data('allOptionsDisabled') === undefined) { + var $options = $parent.children(); + $parent.data('allOptionsDisabled', $options.filter(':disabled').length === $options.length); + } + + if ($parent.data('allOptionsDisabled')) { + liIndex--; + return; + } + } + + var optGroupClass = ' ' + $parent[0].className || ''; + + if ($this.index() === 0) { // Is it the first option of the optgroup? + optID += 1; + + // Get the opt group label + var label = $parent[0].label, + labelSubtext = typeof $parent.data('subtext') !== 'undefined' ? '' + $parent.data('subtext') + '' : '', + labelIcon = $parent.data('icon') ? ' ' : ''; + + label = labelIcon + '' + label + labelSubtext + ''; + + if (index !== 0 && _li.length > 0) { // Is it NOT the first option of the select && are there elements in the dropdown? + liIndex++; + _li.push(generateLI('', null, 'divider', optID + 'div')); + } + liIndex++; + _li.push(generateLI(label, null, 'dropdown-header' + optGroupClass, optID)); + } + + if (that.options.hideDisabled && isDisabled) { + liIndex--; + return; + } + + _li.push(generateLI(generateA(text, 'opt ' + optionClass + optGroupClass, inline, tokens), index, '', optID)); + } else if ($this.data('divider') === true) { + _li.push(generateLI('', index, 'divider')); + } else if ($this.data('hidden') === true) { + _li.push(generateLI(generateA(text, optionClass, inline, tokens), index, 'hidden is-hidden')); + } else { + var showDivider = this.previousElementSibling && this.previousElementSibling.tagName === 'OPTGROUP'; + + // if previous element is not an optgroup and hideDisabled is true + if (!showDivider && that.options.hideDisabled) { + // get previous elements + var $prev = $(this).prevAll(); + + for (var i = 0; i < $prev.length; i++) { + // find the first element in the previous elements that is an optgroup + if ($prev[i].tagName === 'OPTGROUP') { + var optGroupDistance = 0; + + // loop through the options in between the current option and the optgroup + // and check if they are hidden or disabled + for (var d = 0; d < i; d++) { + var prevOption = $prev[d]; + if (prevOption.disabled || $(prevOption).data('hidden') === true) optGroupDistance++; + } + + // if all of the options between the current option and the optgroup are hidden or disabled, show the divider + if (optGroupDistance === i) showDivider = true; + + break; + } + } + } + + if (showDivider) { + liIndex++; + _li.push(generateLI('', null, 'divider', optID + 'div')); + } + _li.push(generateLI(generateA(text, optionClass, inline, tokens), index)); + } + + that.liObj[index] = liIndex; + }); + + //If we are not multiple, we don't have a selected item, and we don't have a title, select the first element so something is set in the button + if (!this.multiple && this.$element.find('option:selected').length === 0 && !this.options.title) { + this.$element.find('option').eq(0).prop('selected', true).attr('selected', 'selected'); + } + + return _li.join(''); + }, + + findLis: function () { + if (this.$lis == null) this.$lis = this.$menu.find('li'); + return this.$lis; + }, + + /** + * @param [updateLi] defaults to true + */ + render: function (updateLi) { + var that = this, + notDisabled; + + //Update the LI to match the SELECT + if (updateLi !== false) { + this.$element.find('option').each(function (index) { + var $lis = that.findLis().eq(that.liObj[index]); + + that.setDisabled(index, this.disabled || this.parentNode.tagName === 'OPTGROUP' && this.parentNode.disabled, $lis); + that.setSelected(index, this.selected, $lis); + }); + } + + this.togglePlaceholder(); + + this.tabIndex(); + + var selectedItems = this.$element.find('option').map(function () { + if (this.selected) { + if (that.options.hideDisabled && (this.disabled || this.parentNode.tagName === 'OPTGROUP' && this.parentNode.disabled)) return; + + var $this = $(this), + icon = $this.data('icon') && that.options.showIcon ? ' ' : '', + subtext; + + if (that.options.showSubtext && $this.data('subtext') && !that.multiple) { + subtext = ' ' + $this.data('subtext') + ''; + } else { + subtext = ''; + } + if (typeof $this.attr('title') !== 'undefined') { + return $this.attr('title'); + } else if ($this.data('content') && that.options.showContent) { + return $this.data('content'); + } else { + return icon + $this.html() + subtext; + } + } + }).toArray(); + + //Fixes issue in IE10 occurring when no default option is selected and at least one option is disabled + //Convert all the values into a comma delimited string + var title = !this.multiple ? selectedItems[0] : selectedItems.join(this.options.multipleSeparator); + + //If this is multi select, and the selectText type is count, the show 1 of 2 selected etc.. + if (this.multiple && this.options.selectedTextFormat.indexOf('count') > -1) { + var max = this.options.selectedTextFormat.split('>'); + if ((max.length > 1 && selectedItems.length > max[1]) || (max.length == 1 && selectedItems.length >= 2)) { + notDisabled = this.options.hideDisabled ? ', [disabled]' : ''; + var totalCount = this.$element.find('option').not('[data-divider="true"], [data-hidden="true"]' + notDisabled).length, + tr8nText = (typeof this.options.countSelectedText === 'function') ? this.options.countSelectedText(selectedItems.length, totalCount) : this.options.countSelectedText; + title = tr8nText.replace('{0}', selectedItems.length.toString()).replace('{1}', totalCount.toString()); + } + } + + if (this.options.title == undefined) { + this.options.title = this.$element.attr('title'); + } + + if (this.options.selectedTextFormat == 'static') { + title = this.options.title; + } + + //If we dont have a title, then use the default, or if nothing is set at all, use the not selected text + if (!title) { + title = typeof this.options.title !== 'undefined' ? this.options.title : this.options.noneSelectedText; + } + + //strip all html-tags and trim the result + this.$button.attr('title', $.trim(title.replace(/<[^>]*>?/g, ''))); + this.$button.children('.filter-option').html(title); + + this.$element.trigger('rendered.bs.select'); + }, + + /** + * @param [style] + * @param [status] + */ + setStyle: function (style, status) { + if (this.$element.attr('class')) { + this.$newElement.addClass(this.$element.attr('class').replace(/selectpicker|mobile-device|bs-select-hidden|validate\[.*\]/gi, '')); + } + + var buttonClass = style ? style : this.options.style; + + if (status == 'add') { + this.$button.addClass(buttonClass); + } else if (status == 'remove') { + this.$button.removeClass(buttonClass); + } else { + this.$button.removeClass(this.options.style); + this.$button.addClass(buttonClass); + } + }, + + liHeight: function (refresh) { + if (!refresh && (this.options.size === false || this.sizeInfo)) return; + + var newElement = document.createElement('div'), + menu = document.createElement('div'), + menuInner = document.createElement('ul'), + divider = document.createElement('li'), + li = document.createElement('li'), + a = document.createElement('a'), + text = document.createElement('span'), + header = this.options.header && this.$menu.find('.popover-title').length > 0 ? this.$menu.find('.popover-title')[0].cloneNode(true) : null, + search = this.options.liveSearch ? document.createElement('div') : null, + actions = this.options.actionsBox && this.multiple && this.$menu.find('.bs-actionsbox').length > 0 ? this.$menu.find('.bs-actionsbox')[0].cloneNode(true) : null, + doneButton = this.options.doneButton && this.multiple && this.$menu.find('.bs-donebutton').length > 0 ? this.$menu.find('.bs-donebutton')[0].cloneNode(true) : null; + + text.className = 'text'; + newElement.className = this.$menu[0].parentNode.className + ' open'; + menu.className = 'dropdown-menu open'; + menuInner.className = 'dropdown-menu inner'; + divider.className = 'divider'; + + text.appendChild(document.createTextNode('Inner text')); + a.appendChild(text); + li.appendChild(a); + menuInner.appendChild(li); + menuInner.appendChild(divider); + if (header) menu.appendChild(header); + if (search) { + // create a span instead of input as creating an input element is slower + var input = document.createElement('span'); + search.className = 'bs-searchbox'; + input.className = 'form-control'; + search.appendChild(input); + menu.appendChild(search); + } + if (actions) menu.appendChild(actions); + menu.appendChild(menuInner); + if (doneButton) menu.appendChild(doneButton); + newElement.appendChild(menu); + + document.body.appendChild(newElement); + + var liHeight = a.offsetHeight, + headerHeight = header ? header.offsetHeight : 0, + searchHeight = search ? search.offsetHeight : 0, + actionsHeight = actions ? actions.offsetHeight : 0, + doneButtonHeight = doneButton ? doneButton.offsetHeight : 0, + dividerHeight = $(divider).outerHeight(true), + // fall back to jQuery if getComputedStyle is not supported + menuStyle = typeof getComputedStyle === 'function' ? getComputedStyle(menu) : false, + $menu = menuStyle ? null : $(menu), + menuPadding = { + vert: parseInt(menuStyle ? menuStyle.paddingTop : $menu.css('paddingTop')) + + parseInt(menuStyle ? menuStyle.paddingBottom : $menu.css('paddingBottom')) + + parseInt(menuStyle ? menuStyle.borderTopWidth : $menu.css('borderTopWidth')) + + parseInt(menuStyle ? menuStyle.borderBottomWidth : $menu.css('borderBottomWidth')), + horiz: parseInt(menuStyle ? menuStyle.paddingLeft : $menu.css('paddingLeft')) + + parseInt(menuStyle ? menuStyle.paddingRight : $menu.css('paddingRight')) + + parseInt(menuStyle ? menuStyle.borderLeftWidth : $menu.css('borderLeftWidth')) + + parseInt(menuStyle ? menuStyle.borderRightWidth : $menu.css('borderRightWidth')) + }, + menuExtras = { + vert: menuPadding.vert + + parseInt(menuStyle ? menuStyle.marginTop : $menu.css('marginTop')) + + parseInt(menuStyle ? menuStyle.marginBottom : $menu.css('marginBottom')) + 2, + horiz: menuPadding.horiz + + parseInt(menuStyle ? menuStyle.marginLeft : $menu.css('marginLeft')) + + parseInt(menuStyle ? menuStyle.marginRight : $menu.css('marginRight')) + 2 + } + + document.body.removeChild(newElement); + + this.sizeInfo = { + liHeight: liHeight, + headerHeight: headerHeight, + searchHeight: searchHeight, + actionsHeight: actionsHeight, + doneButtonHeight: doneButtonHeight, + dividerHeight: dividerHeight, + menuPadding: menuPadding, + menuExtras: menuExtras + }; + }, + + setSize: function () { + this.findLis(); + this.liHeight(); + + if (this.options.header) this.$menu.css('padding-top', 0); + if (this.options.size === false) return; + + var that = this, + $menu = this.$menu, + $menuInner = this.$menuInner, + $window = $(window), + selectHeight = this.$newElement[0].offsetHeight, + selectWidth = this.$newElement[0].offsetWidth, + liHeight = this.sizeInfo['liHeight'], + headerHeight = this.sizeInfo['headerHeight'], + searchHeight = this.sizeInfo['searchHeight'], + actionsHeight = this.sizeInfo['actionsHeight'], + doneButtonHeight = this.sizeInfo['doneButtonHeight'], + divHeight = this.sizeInfo['dividerHeight'], + menuPadding = this.sizeInfo['menuPadding'], + menuExtras = this.sizeInfo['menuExtras'], + notDisabled = this.options.hideDisabled ? '.disabled' : '', + menuHeight, + menuWidth, + getHeight, + getWidth, + selectOffsetTop, + selectOffsetBot, + selectOffsetLeft, + selectOffsetRight, + getPos = function() { + var pos = that.$newElement.offset(), + $container = $(that.options.container), + containerPos; + + if (that.options.container && !$container.is('body')) { + containerPos = $container.offset(); + containerPos.top += parseInt($container.css('borderTopWidth')); + containerPos.left += parseInt($container.css('borderLeftWidth')); + } else { + containerPos = { top: 0, left: 0 }; + } + + selectOffsetTop = pos.top - containerPos.top - $window.scrollTop(); + selectOffsetBot = $window.height() - selectOffsetTop - selectHeight - containerPos.top; + selectOffsetLeft = pos.left - containerPos.left - $window.scrollLeft(); + selectOffsetRight = $window.width() - selectOffsetLeft - selectWidth - containerPos.left; + }; + + getPos(); + + if (this.options.size === 'auto') { + var getSize = function () { + var minHeight, + hasClass = function (className, include) { + return function (element) { + if (include) { + return (element.classList ? element.classList.contains(className) : $(element).hasClass(className)); + } else { + return !(element.classList ? element.classList.contains(className) : $(element).hasClass(className)); + } + }; + }, + lis = that.$menuInner[0].getElementsByTagName('li'), + lisVisible = Array.prototype.filter ? Array.prototype.filter.call(lis, hasClass('hidden', false)) : that.$lis.not('.hidden'), + optGroup = Array.prototype.filter ? Array.prototype.filter.call(lisVisible, hasClass('dropdown-header', true)) : lisVisible.filter('.dropdown-header'); + + getPos(); + menuHeight = selectOffsetBot - menuExtras.vert; + menuWidth = selectOffsetRight - menuExtras.horiz; + + if (that.options.container) { + if (!$menu.data('height')) $menu.data('height', $menu.height()); + getHeight = $menu.data('height'); + + if (!$menu.data('width')) $menu.data('width', $menu.width()); + getWidth = $menu.data('width'); + } else { + getHeight = $menu.height(); + getWidth = $menu.width(); + } + + if (that.options.dropupAuto) { + that.$newElement.toggleClass('dropup', selectOffsetTop > selectOffsetBot && (menuHeight - menuExtras.vert) < getHeight); + } + + if (that.$newElement.hasClass('dropup')) { + menuHeight = selectOffsetTop - menuExtras.vert; + } + + if (that.options.dropdownAlignRight === 'auto') { + $menu.toggleClass('dropdown-menu-right', selectOffsetLeft > selectOffsetRight && (menuWidth - menuExtras.horiz) < (getWidth - selectWidth)); + } + + if ((lisVisible.length + optGroup.length) > 3) { + minHeight = liHeight * 3 + menuExtras.vert - 2; + } else { + minHeight = 0; + } + + $menu.css({ + 'max-height': menuHeight + 'px', + 'overflow': 'hidden', + 'min-height': minHeight + headerHeight + searchHeight + actionsHeight + doneButtonHeight + 'px' + }); + $menuInner.css({ + 'max-height': menuHeight - headerHeight - searchHeight - actionsHeight - doneButtonHeight - menuPadding.vert + 'px', + 'overflow-y': 'auto', + 'min-height': Math.max(minHeight - menuPadding.vert, 0) + 'px' + }); + }; + getSize(); + this.$searchbox.off('input.getSize propertychange.getSize').on('input.getSize propertychange.getSize', getSize); + $window.off('resize.getSize scroll.getSize').on('resize.getSize scroll.getSize', getSize); + } else if (this.options.size && this.options.size != 'auto' && this.$lis.not(notDisabled).length > this.options.size) { + var optIndex = this.$lis.not('.divider').not(notDisabled).children().slice(0, this.options.size).last().parent().index(), + divLength = this.$lis.slice(0, optIndex + 1).filter('.divider').length; + menuHeight = liHeight * this.options.size + divLength * divHeight + menuPadding.vert; + + if (that.options.container) { + if (!$menu.data('height')) $menu.data('height', $menu.height()); + getHeight = $menu.data('height'); + } else { + getHeight = $menu.height(); + } + + if (that.options.dropupAuto) { + //noinspection JSUnusedAssignment + this.$newElement.toggleClass('dropup', selectOffsetTop > selectOffsetBot && (menuHeight - menuExtras.vert) < getHeight); + } + $menu.css({ + 'max-height': menuHeight + headerHeight + searchHeight + actionsHeight + doneButtonHeight + 'px', + 'overflow': 'hidden', + 'min-height': '' + }); + $menuInner.css({ + 'max-height': menuHeight - menuPadding.vert + 'px', + 'overflow-y': 'auto', + 'min-height': '' + }); + } + }, + + setWidth: function () { + if (this.options.width === 'auto') { + this.$menu.css('min-width', '0'); + + // Get correct width if element is hidden + var $selectClone = this.$menu.parent().clone().appendTo('body'), + $selectClone2 = this.options.container ? this.$newElement.clone().appendTo('body') : $selectClone, + ulWidth = $selectClone.children('.dropdown-menu').outerWidth(), + btnWidth = $selectClone2.css('width', 'auto').children('button').outerWidth(); + + $selectClone.remove(); + $selectClone2.remove(); + + // Set width to whatever's larger, button title or longest option + this.$newElement.css('width', Math.max(ulWidth, btnWidth) + 'px'); + } else if (this.options.width === 'fit') { + // Remove inline min-width so width can be changed from 'auto' + this.$menu.css('min-width', ''); + this.$newElement.css('width', '').addClass('fit-width'); + } else if (this.options.width) { + // Remove inline min-width so width can be changed from 'auto' + this.$menu.css('min-width', ''); + this.$newElement.css('width', this.options.width); + } else { + // Remove inline min-width/width so width can be changed + this.$menu.css('min-width', ''); + this.$newElement.css('width', ''); + } + // Remove fit-width class if width is changed programmatically + if (this.$newElement.hasClass('fit-width') && this.options.width !== 'fit') { + this.$newElement.removeClass('fit-width'); + } + }, + + selectPosition: function () { + this.$bsContainer = $('
    '); + + var that = this, + $container = $(this.options.container), + pos, + containerPos, + actualHeight, + getPlacement = function ($element) { + that.$bsContainer.addClass($element.attr('class').replace(/form-control|fit-width/gi, '')).toggleClass('dropup', $element.hasClass('dropup')); + pos = $element.offset(); + + if (!$container.is('body')) { + containerPos = $container.offset(); + containerPos.top += parseInt($container.css('borderTopWidth')) - $container.scrollTop(); + containerPos.left += parseInt($container.css('borderLeftWidth')) - $container.scrollLeft(); + } else { + containerPos = { top: 0, left: 0 }; + } + + actualHeight = $element.hasClass('dropup') ? 0 : $element[0].offsetHeight; + + that.$bsContainer.css({ + 'top': pos.top - containerPos.top + actualHeight, + 'left': pos.left - containerPos.left, + 'width': $element[0].offsetWidth + }); + }; + + this.$button.on('click', function () { + var $this = $(this); + + if (that.isDisabled()) { + return; + } + + getPlacement(that.$newElement); + + that.$bsContainer + .appendTo(that.options.container) + .toggleClass('open', !$this.hasClass('open')) + .append(that.$menu); + }); + + $(window).on('resize scroll', function () { + getPlacement(that.$newElement); + }); + + this.$element.on('hide.bs.select', function () { + that.$menu.data('height', that.$menu.height()); + that.$bsContainer.detach(); + }); + }, + + /** + * @param {number} index - the index of the option that is being changed + * @param {boolean} selected - true if the option is being selected, false if being deselected + * @param {JQuery} $lis - the 'li' element that is being modified + */ + setSelected: function (index, selected, $lis) { + if (!$lis) { + this.togglePlaceholder(); // check if setSelected is being called by changing the value of the select + $lis = this.findLis().eq(this.liObj[index]); + } + + $lis.toggleClass('selected', selected).find('a').attr('aria-selected', selected); + }, + + /** + * @param {number} index - the index of the option that is being disabled + * @param {boolean} disabled - true if the option is being disabled, false if being enabled + * @param {JQuery} $lis - the 'li' element that is being modified + */ + setDisabled: function (index, disabled, $lis) { + if (!$lis) { + $lis = this.findLis().eq(this.liObj[index]); + } + + if (disabled) { + $lis.addClass('disabled').children('a').attr('href', '#').attr('tabindex', -1).attr('aria-disabled', true); + } else { + $lis.removeClass('disabled').children('a').removeAttr('href').attr('tabindex', 0).attr('aria-disabled', false); + } + }, + + isDisabled: function () { + return this.$element[0].disabled; + }, + + checkDisabled: function () { + var that = this; + + if (this.isDisabled()) { + this.$newElement.addClass('disabled'); + this.$button.addClass('disabled').attr('tabindex', -1); + } else { + if (this.$button.hasClass('disabled')) { + this.$newElement.removeClass('disabled'); + this.$button.removeClass('disabled'); + } + + if (this.$button.attr('tabindex') == -1 && !this.$element.data('tabindex')) { + this.$button.removeAttr('tabindex'); + } + } + + this.$button.click(function () { + return !that.isDisabled(); + }); + }, + + togglePlaceholder: function () { + var value = this.$element.val(); + this.$button.toggleClass('bs-placeholder', value === null || value === ''); + }, + + tabIndex: function () { + if (this.$element.data('tabindex') !== this.$element.attr('tabindex') && + (this.$element.attr('tabindex') !== -98 && this.$element.attr('tabindex') !== '-98')) { + this.$element.data('tabindex', this.$element.attr('tabindex')); + this.$button.attr('tabindex', this.$element.data('tabindex')); + } + + this.$element.attr('tabindex', -98); + }, + + clickListener: function () { + var that = this, + $document = $(document); + + this.$newElement.on('touchstart.dropdown', '.dropdown-menu', function (e) { + e.stopPropagation(); + }); + + $document.data('spaceSelect', false); + + this.$button.on('keyup', function (e) { + if (/(32)/.test(e.keyCode.toString(10)) && $document.data('spaceSelect')) { + e.preventDefault(); + $document.data('spaceSelect', false); + } + }); + + this.$button.on('click', function () { + that.setSize(); + }); + + this.$element.on('shown.bs.select', function () { + if (!that.options.liveSearch && !that.multiple) { + that.$menuInner.find('.selected a').focus(); + } else if (!that.multiple) { + var selectedIndex = that.liObj[that.$element[0].selectedIndex]; + + if (typeof selectedIndex !== 'number' || that.options.size === false) return; + + // scroll to selected option + var offset = that.$lis.eq(selectedIndex)[0].offsetTop - that.$menuInner[0].offsetTop; + offset = offset - that.$menuInner[0].offsetHeight/2 + that.sizeInfo.liHeight/2; + that.$menuInner[0].scrollTop = offset; + } + }); + + this.$menuInner.on('click', 'li a', function (e) { + var $this = $(this), + clickedIndex = $this.parent().data('originalIndex'), + prevValue = that.$element.val(), + prevIndex = that.$element.prop('selectedIndex'), + triggerChange = true; + + // Don't close on multi choice menu + if (that.multiple && that.options.maxOptions !== 1) { + e.stopPropagation(); + } + + e.preventDefault(); + + //Don't run if we have been disabled + if (!that.isDisabled() && !$this.parent().hasClass('disabled')) { + var $options = that.$element.find('option'), + $option = $options.eq(clickedIndex), + state = $option.prop('selected'), + $optgroup = $option.parent('optgroup'), + maxOptions = that.options.maxOptions, + maxOptionsGrp = $optgroup.data('maxOptions') || false; + + if (!that.multiple) { // Deselect all others if not multi select box + $options.prop('selected', false); + $option.prop('selected', true); + that.$menuInner.find('.selected').removeClass('selected').find('a').attr('aria-selected', false); + that.setSelected(clickedIndex, true); + } else { // Toggle the one we have chosen if we are multi select. + $option.prop('selected', !state); + that.setSelected(clickedIndex, !state); + $this.blur(); + + if (maxOptions !== false || maxOptionsGrp !== false) { + var maxReached = maxOptions < $options.filter(':selected').length, + maxReachedGrp = maxOptionsGrp < $optgroup.find('option:selected').length; + + if ((maxOptions && maxReached) || (maxOptionsGrp && maxReachedGrp)) { + if (maxOptions && maxOptions == 1) { + $options.prop('selected', false); + $option.prop('selected', true); + that.$menuInner.find('.selected').removeClass('selected'); + that.setSelected(clickedIndex, true); + } else if (maxOptionsGrp && maxOptionsGrp == 1) { + $optgroup.find('option:selected').prop('selected', false); + $option.prop('selected', true); + var optgroupID = $this.parent().data('optgroup'); + that.$menuInner.find('[data-optgroup="' + optgroupID + '"]').removeClass('selected'); + that.setSelected(clickedIndex, true); + } else { + var maxOptionsText = typeof that.options.maxOptionsText === 'string' ? [that.options.maxOptionsText, that.options.maxOptionsText] : that.options.maxOptionsText, + maxOptionsArr = typeof maxOptionsText === 'function' ? maxOptionsText(maxOptions, maxOptionsGrp) : maxOptionsText, + maxTxt = maxOptionsArr[0].replace('{n}', maxOptions), + maxTxtGrp = maxOptionsArr[1].replace('{n}', maxOptionsGrp), + $notify = $('
    '); + // If {var} is set in array, replace it + /** @deprecated */ + if (maxOptionsArr[2]) { + maxTxt = maxTxt.replace('{var}', maxOptionsArr[2][maxOptions > 1 ? 0 : 1]); + maxTxtGrp = maxTxtGrp.replace('{var}', maxOptionsArr[2][maxOptionsGrp > 1 ? 0 : 1]); + } + + $option.prop('selected', false); + + that.$menu.append($notify); + + if (maxOptions && maxReached) { + $notify.append($('
    ' + maxTxt + '
    ')); + triggerChange = false; + that.$element.trigger('maxReached.bs.select'); + } + + if (maxOptionsGrp && maxReachedGrp) { + $notify.append($('
    ' + maxTxtGrp + '
    ')); + triggerChange = false; + that.$element.trigger('maxReachedGrp.bs.select'); + } + + setTimeout(function () { + that.setSelected(clickedIndex, false); + }, 10); + + $notify.delay(750).fadeOut(300, function () { + $(this).remove(); + }); + } + } + } + } + + if (!that.multiple || (that.multiple && that.options.maxOptions === 1)) { + that.$button.focus(); + } else if (that.options.liveSearch) { + that.$searchbox.focus(); + } + + // Trigger select 'change' + if (triggerChange) { + if ((prevValue != that.$element.val() && that.multiple) || (prevIndex != that.$element.prop('selectedIndex') && !that.multiple)) { + // $option.prop('selected') is current option state (selected/unselected). state is previous option state. + changed_arguments = [clickedIndex, $option.prop('selected'), state]; + that.$element + .triggerNative('change'); + } + } + } + }); + + this.$menu.on('click', 'li.disabled a, .popover-title, .popover-title :not(.close)', function (e) { + if (e.currentTarget == this) { + e.preventDefault(); + e.stopPropagation(); + if (that.options.liveSearch && !$(e.target).hasClass('close')) { + that.$searchbox.focus(); + } else { + that.$button.focus(); + } + } + }); + + this.$menuInner.on('click', '.divider, .dropdown-header', function (e) { + e.preventDefault(); + e.stopPropagation(); + if (that.options.liveSearch) { + that.$searchbox.focus(); + } else { + that.$button.focus(); + } + }); + + this.$menu.on('click', '.popover-title .close', function () { + that.$button.click(); + }); + + this.$searchbox.on('click', function (e) { + e.stopPropagation(); + }); + + this.$menu.on('click', '.actions-btn', function (e) { + if (that.options.liveSearch) { + that.$searchbox.focus(); + } else { + that.$button.focus(); + } + + e.preventDefault(); + e.stopPropagation(); + + if ($(this).hasClass('bs-select-all')) { + that.selectAll(); + } else { + that.deselectAll(); + } + }); + + this.$element.change(function () { + that.render(false); + that.$element.trigger('changed.bs.select', changed_arguments); + changed_arguments = null; + }); + }, + + liveSearchListener: function () { + var that = this, + $no_results = $('
  • '); + + this.$button.on('click.dropdown.data-api touchstart.dropdown.data-api', function () { + that.$menuInner.find('.active').removeClass('active'); + if (!!that.$searchbox.val()) { + that.$searchbox.val(''); + that.$lis.not('.is-hidden').removeClass('hidden'); + if (!!$no_results.parent().length) $no_results.remove(); + } + if (!that.multiple) that.$menuInner.find('.selected').addClass('active'); + setTimeout(function () { + that.$searchbox.focus(); + }, 10); + }); + + this.$searchbox.on('click.dropdown.data-api focus.dropdown.data-api touchend.dropdown.data-api', function (e) { + e.stopPropagation(); + }); + + this.$searchbox.on('input propertychange', function () { + if (that.$searchbox.val()) { + var $searchBase = that.$lis.not('.is-hidden').removeClass('hidden').children('a'); + if (that.options.liveSearchNormalize) { + $searchBase = $searchBase.not(':a' + that._searchStyle() + '("' + normalizeToBase(that.$searchbox.val()) + '")'); + } else { + $searchBase = $searchBase.not(':' + that._searchStyle() + '("' + that.$searchbox.val() + '")'); + } + $searchBase.parent().addClass('hidden'); + + that.$lis.filter('.dropdown-header').each(function () { + var $this = $(this), + optgroup = $this.data('optgroup'); + + if (that.$lis.filter('[data-optgroup=' + optgroup + ']').not($this).not('.hidden').length === 0) { + $this.addClass('hidden'); + that.$lis.filter('[data-optgroup=' + optgroup + 'div]').addClass('hidden'); + } + }); + + var $lisVisible = that.$lis.not('.hidden'); + + // hide divider if first or last visible, or if followed by another divider + $lisVisible.each(function (index) { + var $this = $(this); + + if ($this.hasClass('divider') && ( + $this.index() === $lisVisible.first().index() || + $this.index() === $lisVisible.last().index() || + $lisVisible.eq(index + 1).hasClass('divider'))) { + $this.addClass('hidden'); + } + }); + + if (!that.$lis.not('.hidden, .no-results').length) { + if (!!$no_results.parent().length) { + $no_results.remove(); + } + $no_results.html(that.options.noneResultsText.replace('{0}', '"' + htmlEscape(that.$searchbox.val()) + '"')).show(); + that.$menuInner.append($no_results); + } else if (!!$no_results.parent().length) { + $no_results.remove(); + } + } else { + that.$lis.not('.is-hidden').removeClass('hidden'); + if (!!$no_results.parent().length) { + $no_results.remove(); + } + } + + that.$lis.filter('.active').removeClass('active'); + if (that.$searchbox.val()) that.$lis.not('.hidden, .divider, .dropdown-header').eq(0).addClass('active').children('a').focus(); + $(this).focus(); + }); + }, + + _searchStyle: function () { + var styles = { + begins: 'ibegins', + startsWith: 'ibegins' + }; + + return styles[this.options.liveSearchStyle] || 'icontains'; + }, + + val: function (value) { + if (typeof value !== 'undefined') { + this.$element.val(value); + this.render(); + + return this.$element; + } else { + return this.$element.val(); + } + }, + + changeAll: function (status) { + if (!this.multiple) return; + if (typeof status === 'undefined') status = true; + + this.findLis(); + + var $options = this.$element.find('option'), + $lisVisible = this.$lis.not('.divider, .dropdown-header, .disabled, .hidden'), + lisVisLen = $lisVisible.length, + selectedOptions = []; + + if (status) { + if ($lisVisible.filter('.selected').length === $lisVisible.length) return; + } else { + if ($lisVisible.filter('.selected').length === 0) return; + } + + $lisVisible.toggleClass('selected', status); + + for (var i = 0; i < lisVisLen; i++) { + var origIndex = $lisVisible[i].getAttribute('data-original-index'); + selectedOptions[selectedOptions.length] = $options.eq(origIndex)[0]; + } + + $(selectedOptions).prop('selected', status); + + this.render(false); + + this.togglePlaceholder(); + + this.$element + .triggerNative('change'); + }, + + selectAll: function () { + return this.changeAll(true); + }, + + deselectAll: function () { + return this.changeAll(false); + }, + + toggle: function (e) { + e = e || window.event; + + if (e) e.stopPropagation(); + + this.$button.trigger('click'); + }, + + keydown: function (e) { + var $this = $(this), + $parent = $this.is('input') ? $this.parent().parent() : $this.parent(), + $items, + that = $parent.data('this'), + index, + next, + first, + last, + prev, + nextPrev, + prevIndex, + isActive, + selector = ':not(.disabled, .hidden, .dropdown-header, .divider)', + keyCodeMap = { + 32: ' ', + 48: '0', + 49: '1', + 50: '2', + 51: '3', + 52: '4', + 53: '5', + 54: '6', + 55: '7', + 56: '8', + 57: '9', + 59: ';', + 65: 'a', + 66: 'b', + 67: 'c', + 68: 'd', + 69: 'e', + 70: 'f', + 71: 'g', + 72: 'h', + 73: 'i', + 74: 'j', + 75: 'k', + 76: 'l', + 77: 'm', + 78: 'n', + 79: 'o', + 80: 'p', + 81: 'q', + 82: 'r', + 83: 's', + 84: 't', + 85: 'u', + 86: 'v', + 87: 'w', + 88: 'x', + 89: 'y', + 90: 'z', + 96: '0', + 97: '1', + 98: '2', + 99: '3', + 100: '4', + 101: '5', + 102: '6', + 103: '7', + 104: '8', + 105: '9' + }; + + if (that.options.liveSearch) $parent = $this.parent().parent(); + + if (that.options.container) $parent = that.$menu; + + $items = $('[role="listbox"] li', $parent); + + isActive = that.$newElement.hasClass('open'); + + if (!isActive && (e.keyCode >= 48 && e.keyCode <= 57 || e.keyCode >= 96 && e.keyCode <= 105 || e.keyCode >= 65 && e.keyCode <= 90)) { + if (!that.options.container) { + that.setSize(); + that.$menu.parent().addClass('open'); + isActive = true; + } else { + that.$button.trigger('click'); + } + that.$searchbox.focus(); + return; + } + + if (that.options.liveSearch) { + if (/(^9$|27)/.test(e.keyCode.toString(10)) && isActive) { + e.preventDefault(); + e.stopPropagation(); + that.$button.click().focus(); + } + // $items contains li elements when liveSearch is enabled + $items = $('[role="listbox"] li' + selector, $parent); + if (!$this.val() && !/(38|40)/.test(e.keyCode.toString(10))) { + if ($items.filter('.active').length === 0) { + $items = that.$menuInner.find('li'); + if (that.options.liveSearchNormalize) { + $items = $items.filter(':a' + that._searchStyle() + '(' + normalizeToBase(keyCodeMap[e.keyCode]) + ')'); + } else { + $items = $items.filter(':' + that._searchStyle() + '(' + keyCodeMap[e.keyCode] + ')'); + } + } + } + } + + if (!$items.length) return; + + if (/(38|40)/.test(e.keyCode.toString(10))) { + index = $items.index($items.find('a').filter(':focus').parent()); + first = $items.filter(selector).first().index(); + last = $items.filter(selector).last().index(); + next = $items.eq(index).nextAll(selector).eq(0).index(); + prev = $items.eq(index).prevAll(selector).eq(0).index(); + nextPrev = $items.eq(next).prevAll(selector).eq(0).index(); + + if (that.options.liveSearch) { + $items.each(function (i) { + if (!$(this).hasClass('disabled')) { + $(this).data('index', i); + } + }); + index = $items.index($items.filter('.active')); + first = $items.first().data('index'); + last = $items.last().data('index'); + next = $items.eq(index).nextAll().eq(0).data('index'); + prev = $items.eq(index).prevAll().eq(0).data('index'); + nextPrev = $items.eq(next).prevAll().eq(0).data('index'); + } + + prevIndex = $this.data('prevIndex'); + + if (e.keyCode == 38) { + if (that.options.liveSearch) index--; + if (index != nextPrev && index > prev) index = prev; + if (index < first) index = first; + if (index == prevIndex) index = last; + } else if (e.keyCode == 40) { + if (that.options.liveSearch) index++; + if (index == -1) index = 0; + if (index != nextPrev && index < next) index = next; + if (index > last) index = last; + if (index == prevIndex) index = first; + } + + $this.data('prevIndex', index); + + if (!that.options.liveSearch) { + $items.eq(index).children('a').focus(); + } else { + e.preventDefault(); + if (!$this.hasClass('dropdown-toggle')) { + $items.removeClass('active').eq(index).addClass('active').children('a').focus(); + $this.focus(); + } + } + + } else if (!$this.is('input')) { + var keyIndex = [], + count, + prevKey; + + $items.each(function () { + if (!$(this).hasClass('disabled')) { + if ($.trim($(this).children('a').text().toLowerCase()).substring(0, 1) == keyCodeMap[e.keyCode]) { + keyIndex.push($(this).index()); + } + } + }); + + count = $(document).data('keycount'); + count++; + $(document).data('keycount', count); + + prevKey = $.trim($(':focus').text().toLowerCase()).substring(0, 1); + + if (prevKey != keyCodeMap[e.keyCode]) { + count = 1; + $(document).data('keycount', count); + } else if (count >= keyIndex.length) { + $(document).data('keycount', 0); + if (count > keyIndex.length) count = 1; + } + + $items.eq(keyIndex[count - 1]).children('a').focus(); + } + + // Select focused option if "Enter", "Spacebar" or "Tab" (when selectOnTab is true) are pressed inside the menu. + if ((/(13|32)/.test(e.keyCode.toString(10)) || (/(^9$)/.test(e.keyCode.toString(10)) && that.options.selectOnTab)) && isActive) { + if (!/(32)/.test(e.keyCode.toString(10))) e.preventDefault(); + if (!that.options.liveSearch) { + var elem = $(':focus'); + elem.click(); + // Bring back focus for multiselects + elem.focus(); + // Prevent screen from scrolling if the user hit the spacebar + e.preventDefault(); + // Fixes spacebar selection of dropdown items in FF & IE + $(document).data('spaceSelect', true); + } else if (!/(32)/.test(e.keyCode.toString(10))) { + that.$menuInner.find('.active a').click(); + $this.focus(); + } + $(document).data('keycount', 0); + } + + if ((/(^9$|27)/.test(e.keyCode.toString(10)) && isActive && (that.multiple || that.options.liveSearch)) || (/(27)/.test(e.keyCode.toString(10)) && !isActive)) { + that.$menu.parent().removeClass('open'); + if (that.options.container) that.$newElement.removeClass('open'); + that.$button.focus(); + } + }, + + mobile: function () { + this.$element.addClass('mobile-device'); + }, + + refresh: function () { + this.$lis = null; + this.liObj = {}; + this.reloadLi(); + this.render(); + this.checkDisabled(); + this.liHeight(true); + this.setStyle(); + this.setWidth(); + if (this.$lis) this.$searchbox.trigger('propertychange'); + + this.$element.trigger('refreshed.bs.select'); + }, + + hide: function () { + this.$newElement.hide(); + }, + + show: function () { + this.$newElement.show(); + }, + + remove: function () { + this.$newElement.remove(); + this.$element.remove(); + }, + + destroy: function () { + this.$newElement.before(this.$element).remove(); + + if (this.$bsContainer) { + this.$bsContainer.remove(); + } else { + this.$menu.remove(); + } + + this.$element + .off('.bs.select') + .removeData('selectpicker') + .removeClass('bs-select-hidden selectpicker'); + } + }; + + // SELECTPICKER PLUGIN DEFINITION + // ============================== + function Plugin(option, event) { + // get the args of the outer function.. + var args = arguments; + // The arguments of the function are explicitly re-defined from the argument list, because the shift causes them + // to get lost/corrupted in android 2.3 and IE9 #715 #775 + var _option = option, + _event = event; + [].shift.apply(args); + + var value; + var chain = this.each(function () { + var $this = $(this); + if ($this.is('select')) { + var data = $this.data('selectpicker'), + options = typeof _option == 'object' && _option; + + if (!data) { + var config = $.extend({}, Selectpicker.DEFAULTS, $.fn.selectpicker.defaults || {}, $this.data(), options); + config.template = $.extend({}, Selectpicker.DEFAULTS.template, ($.fn.selectpicker.defaults ? $.fn.selectpicker.defaults.template : {}), $this.data().template, options.template); + $this.data('selectpicker', (data = new Selectpicker(this, config, _event))); + } else if (options) { + for (var i in options) { + if (options.hasOwnProperty(i)) { + data.options[i] = options[i]; + } + } + } + + if (typeof _option == 'string') { + if (data[_option] instanceof Function) { + value = data[_option].apply(data, args); + } else { + value = data.options[_option]; + } + } + } + }); + + if (typeof value !== 'undefined') { + //noinspection JSUnusedAssignment + return value; + } else { + return chain; + } + } + + var old = $.fn.selectpicker; + $.fn.selectpicker = Plugin; + $.fn.selectpicker.Constructor = Selectpicker; + + // SELECTPICKER NO CONFLICT + // ======================== + $.fn.selectpicker.noConflict = function () { + $.fn.selectpicker = old; + return this; + }; + + $(document) + .data('keycount', 0) + .on('keydown.bs.select', '.bootstrap-select [data-toggle=dropdown], .bootstrap-select [role="listbox"], .bs-searchbox input', Selectpicker.prototype.keydown) + .on('focusin.modal', '.bootstrap-select [data-toggle=dropdown], .bootstrap-select [role="listbox"], .bs-searchbox input', function (e) { + e.stopPropagation(); + }); + + // SELECTPICKER DATA-API + // ===================== + $(window).on('load.bs.select.data-api', function () { + $('.selectpicker').each(function () { + var $selectpicker = $(this); + Plugin.call($selectpicker, $selectpicker.data()); + }) + }); +})(jQuery); diff --git a/public/assets/libs/bootstrap-select/js/i18n/defaults-ar_AR.js b/public/assets/libs/bootstrap-select/js/i18n/defaults-ar_AR.js new file mode 100644 index 0000000..07f14dc --- /dev/null +++ b/public/assets/libs/bootstrap-select/js/i18n/defaults-ar_AR.js @@ -0,0 +1,23 @@ +/*! + * Translated default messages for bootstrap-select. + * Locale: AR (Arabic) + * Author: Yasser Lotfy + */ +(function ($) { + $.fn.selectpicker.defaults = { + noneSelectedText: 'لم يتم إختيار شئ', + noneResultsText: 'لا توجد نتائج مطابقة لـ {0}', + countSelectedText: function (numSelected, numTotal) { + return (numSelected == 1) ? "{0} خيار تم إختياره" : "{0} خيارات تمت إختيارها"; + }, + maxOptionsText: function (numAll, numGroup) { + return [ + (numAll == 1) ? 'تخطى الحد المسموح ({n} خيار بحد أقصى)' : 'تخطى الحد المسموح ({n} خيارات بحد أقصى)', + (numGroup == 1) ? 'تخطى الحد المسموح للمجموعة ({n} خيار بحد أقصى)' : 'تخطى الحد المسموح للمجموعة ({n} خيارات بحد أقصى)' + ]; + }, + selectAllText: 'إختيار الجميع', + deselectAllText: 'إلغاء إختيار الجميع', + multipleSeparator: '، ' + }; +})(jQuery); diff --git a/public/assets/libs/bootstrap-select/js/i18n/defaults-bg_BG.js b/public/assets/libs/bootstrap-select/js/i18n/defaults-bg_BG.js new file mode 100644 index 0000000..4d99b60 --- /dev/null +++ b/public/assets/libs/bootstrap-select/js/i18n/defaults-bg_BG.js @@ -0,0 +1,23 @@ +/* + * Translated default messages for bootstrap-select. + * Locale: BG (Bulgaria) + * Region: BG (Bulgaria) + */ +(function ($) { + $.fn.selectpicker.defaults = { + noneSelectedText: 'Нищо избрано', + noneResultsText: 'Няма резултат за {0}', + countSelectedText: function (numSelected, numTotal) { + return (numSelected == 1) ? "{0} избран елемент" : "{0} избрани елемента"; + }, + maxOptionsText: function (numAll, numGroup) { + return [ + (numAll == 1) ? 'Лимита е достигнат ({n} елемент максимум)' : 'Лимита е достигнат ({n} елемента максимум)', + (numGroup == 1) ? 'Груповия лимит е достигнат ({n} елемент максимум)' : 'Груповия лимит е достигнат ({n} елемента максимум)' + ]; + }, + selectAllText: 'Избери всички', + deselectAllText: 'Размаркирай всички', + multipleSeparator: ', ' + }; +})(jQuery); diff --git a/public/assets/libs/bootstrap-select/js/i18n/defaults-cro_CRO.js b/public/assets/libs/bootstrap-select/js/i18n/defaults-cro_CRO.js new file mode 100644 index 0000000..5719895 --- /dev/null +++ b/public/assets/libs/bootstrap-select/js/i18n/defaults-cro_CRO.js @@ -0,0 +1,23 @@ +/* + * Translated default messages for bootstrap-select. + * Locale: CRO (Croatia) + * Region: CRO (Croatia) + */ +(function ($) { + $.fn.selectpicker.defaults = { + noneSelectedText: 'Odaberite stavku', + noneResultsText: 'Nema rezultata pretrage {0}', + countSelectedText: function (numSelected, numTotal) { + return (numSelected == 1) ? "{0} stavka selektirana" : "{0} stavke selektirane"; + }, + maxOptionsText: function (numAll, numGroup) { + return [ + (numAll == 1) ? 'Limit je postignut ({n} stvar maximalno)' : 'Limit je postignut ({n} stavke maksimalno)', + (numGroup == 1) ? 'Grupni limit je postignut ({n} stvar maksimalno)' : 'Grupni limit je postignut ({n} stavke maksimalno)' + ]; + }, + selectAllText: 'Selektiraj sve', + deselectAllText: 'Deselektiraj sve', + multipleSeparator: ', ' + }; +})(jQuery); diff --git a/public/assets/libs/bootstrap-select/js/i18n/defaults-cs_CZ.js b/public/assets/libs/bootstrap-select/js/i18n/defaults-cs_CZ.js new file mode 100644 index 0000000..d457279 --- /dev/null +++ b/public/assets/libs/bootstrap-select/js/i18n/defaults-cs_CZ.js @@ -0,0 +1,14 @@ +/* + * Translated default messages for bootstrap-select. + * Locale: CS + * Region: CZ (Czech Republic) + */ +(function ($) { + $.fn.selectpicker.defaults = { + noneSelectedText: 'Nic není vybráno', + noneResultsText: 'Žádné výsledky {0}', + countSelectedText: 'Označeno {0} z {1}', + maxOptionsText: ['Limit překročen ({n} {var} max)', 'Limit skupiny překročen ({n} {var} max)', ['položek', 'položka']], + multipleSeparator: ', ' + }; +})(jQuery); diff --git a/public/assets/libs/bootstrap-select/js/i18n/defaults-da_DK.js b/public/assets/libs/bootstrap-select/js/i18n/defaults-da_DK.js new file mode 100644 index 0000000..5376021 --- /dev/null +++ b/public/assets/libs/bootstrap-select/js/i18n/defaults-da_DK.js @@ -0,0 +1,23 @@ +/* + * Translated default messages for bootstrap-select. + * Locale: DA (Danish) + * Region: DK (Denmark) + */ +(function ($) { + $.fn.selectpicker.defaults = { + noneSelectedText: 'Intet valgt', + noneResultsText: 'Ingen resultater fundet {0}', + countSelectedText: function (numSelected, numTotal) { + return (numSelected == 1) ? "{0} valgt" : "{0} valgt"; + }, + maxOptionsText: function (numAll, numGroup) { + return [ + (numAll == 1) ? 'Begrænsning nået (max {n} valgt)' : 'Begrænsning nået (max {n} valgte)', + (numGroup == 1) ? 'Gruppe-begrænsning nået (max {n} valgt)' : 'Gruppe-begrænsning nået (max {n} valgte)' + ]; + }, + selectAllText: 'Markér alle', + deselectAllText: 'Afmarkér alle', + multipleSeparator: ', ' + }; +})(jQuery); diff --git a/public/assets/libs/bootstrap-select/js/i18n/defaults-de_DE.js b/public/assets/libs/bootstrap-select/js/i18n/defaults-de_DE.js new file mode 100644 index 0000000..d5f5729 --- /dev/null +++ b/public/assets/libs/bootstrap-select/js/i18n/defaults-de_DE.js @@ -0,0 +1,23 @@ +/* + * Translated default messages for bootstrap-select. + * Locale: DE (German, deutsch) + * Region: DE (Germany, Deutschland) + */ +(function ($) { + $.fn.selectpicker.defaults = { + noneSelectedText: 'Bitte wählen...', + noneResultsText: 'Keine Ergebnisse für {0}', + countSelectedText: function (numSelected, numTotal) { + return (numSelected == 1) ? "{0} Element ausgewählt" : "{0} Elemente ausgewählt"; + }, + maxOptionsText: function (numAll, numGroup) { + return [ + (numAll == 1) ? 'Limit erreicht ({n} Element max.)' : 'Limit erreicht ({n} Elemente max.)', + (numGroup == 1) ? 'Gruppen-Limit erreicht ({n} Element max.)' : 'Gruppen-Limit erreicht ({n} Elemente max.)' + ]; + }, + selectAllText: 'Alles auswählen', + deselectAllText: 'Nichts auswählen', + multipleSeparator: ', ' + }; +})(jQuery); diff --git a/public/assets/libs/bootstrap-select/js/i18n/defaults-en_US.js b/public/assets/libs/bootstrap-select/js/i18n/defaults-en_US.js new file mode 100644 index 0000000..acb9035 --- /dev/null +++ b/public/assets/libs/bootstrap-select/js/i18n/defaults-en_US.js @@ -0,0 +1,23 @@ +/* + * Translated default messages for bootstrap-select. + * Locale: EN (English) + * Region: US (United States) + */ +(function ($) { + $.fn.selectpicker.defaults = { + noneSelectedText: 'Nothing selected', + noneResultsText: 'No results match {0}', + countSelectedText: function (numSelected, numTotal) { + return (numSelected == 1) ? "{0} item selected" : "{0} items selected"; + }, + maxOptionsText: function (numAll, numGroup) { + return [ + (numAll == 1) ? 'Limit reached ({n} item max)' : 'Limit reached ({n} items max)', + (numGroup == 1) ? 'Group limit reached ({n} item max)' : 'Group limit reached ({n} items max)' + ]; + }, + selectAllText: 'Select All', + deselectAllText: 'Deselect All', + multipleSeparator: ', ' + }; +})(jQuery); diff --git a/public/assets/libs/bootstrap-select/js/i18n/defaults-es_CL.js b/public/assets/libs/bootstrap-select/js/i18n/defaults-es_CL.js new file mode 100644 index 0000000..ed17a5f --- /dev/null +++ b/public/assets/libs/bootstrap-select/js/i18n/defaults-es_CL.js @@ -0,0 +1,14 @@ +/* + * Translated default messages for bootstrap-select. + * Locale: ES (Spanish) + * Region: CL (Chile) + */ +(function ($) { + $.fn.selectpicker.defaults = { + noneSelectedText: 'No hay selección', + noneResultsText: 'No hay resultados {0}', + countSelectedText: 'Seleccionados {0} de {1}', + maxOptionsText: ['Límite alcanzado ({n} {var} max)', 'Límite del grupo alcanzado({n} {var} max)', ['elementos', 'element']], + multipleSeparator: ', ' + }; +})(jQuery); diff --git a/public/assets/libs/bootstrap-select/js/i18n/defaults-eu.js b/public/assets/libs/bootstrap-select/js/i18n/defaults-eu.js new file mode 100644 index 0000000..037c7d7 --- /dev/null +++ b/public/assets/libs/bootstrap-select/js/i18n/defaults-eu.js @@ -0,0 +1,14 @@ +/* + * Translated default messages for bootstrap-select. + * Locale: EU (Basque) + * Region: + */ +(function ($) { + $.fn.selectpicker.defaults = { + noneSelectedText: 'Hautapenik ez', + noneResultsText: 'Emaitzarik ez {0}', + countSelectedText: '{1}(e)tik {0} hautatuta', + maxOptionsText: ['Mugara iritsita ({n} {var} gehienez)', 'Taldearen mugara iritsita ({n} {var} gehienez)', ['elementu', 'elementu']], + multipleSeparator: ', ' + }; +})(jQuery); diff --git a/public/assets/libs/bootstrap-select/js/i18n/defaults-fa_IR.js b/public/assets/libs/bootstrap-select/js/i18n/defaults-fa_IR.js new file mode 100644 index 0000000..00b1798 --- /dev/null +++ b/public/assets/libs/bootstrap-select/js/i18n/defaults-fa_IR.js @@ -0,0 +1,16 @@ +/* + * Translated default messages for bootstrap-select. + * Locale: FA (Farsi) + * Region: IR (Iran) + */ +(function ($) { + $.fn.selectpicker.defaults = { + noneSelectedText: 'چیزی انتخاب نشده است', + noneResultsText: 'هیج مشابهی برای {0} پیدا نشد', + countSelectedText: "{0} از {1} مورد انتخاب شده", + maxOptionsText: ['بیشتر ممکن نیست {حداکثر {n} عدد}', 'بیشتر ممکن نیست {حداکثر {n} عدد}'], + selectAllText: 'انتخاب همه', + deselectAllText: 'انتخاب هیچ کدام', + multipleSeparator: ', ' + }; +})(jQuery); diff --git a/public/assets/libs/bootstrap-select/js/i18n/defaults-fi_FI.js b/public/assets/libs/bootstrap-select/js/i18n/defaults-fi_FI.js new file mode 100644 index 0000000..c526cd7 --- /dev/null +++ b/public/assets/libs/bootstrap-select/js/i18n/defaults-fi_FI.js @@ -0,0 +1,23 @@ +/* + * Translated default messages for bootstrap-select. + * Locale: FI (Finnish) + * Region: FI (Finland) + */ +(function ($) { + $.fn.selectpicker.defaults = { + noneSelectedText: 'Ei valintoja', + noneResultsText: 'Ei hakutuloksia {0}', + countSelectedText: function (numSelected, numTotal) { + return (numSelected == 1) ? "{0} valittu" : "{0} valitut"; + }, + maxOptionsText: function (numAll, numGroup) { + return [ + (numAll == 1) ? 'Valintojen maksimimäärä ({n} saavutettu)' : 'Valintojen maksimimäärä ({n} saavutettu)', + (numGroup == 1) ? 'Ryhmän maksimimäärä ({n} saavutettu)' : 'Ryhmän maksimimäärä ({n} saavutettu)' + ]; + }, + selectAllText: 'Valitse kaikki', + deselectAllText: 'Poista kaikki', + multipleSeparator: ', ' + }; +})(jQuery); diff --git a/public/assets/libs/bootstrap-select/js/i18n/defaults-fr_FR.js b/public/assets/libs/bootstrap-select/js/i18n/defaults-fr_FR.js new file mode 100644 index 0000000..30d8c40 --- /dev/null +++ b/public/assets/libs/bootstrap-select/js/i18n/defaults-fr_FR.js @@ -0,0 +1,23 @@ +/* + * Translated default messages for bootstrap-select. + * Locale: FR (French; Français) + * Region: FR (France) + */ +(function ($) { + $.fn.selectpicker.defaults = { + noneSelectedText: 'Aucune sélection', + noneResultsText: 'Aucun résultat pour {0}', + countSelectedText: function (numSelected, numTotal) { + return (numSelected > 1) ? "{0} éléments sélectionnés" : "{0} élément sélectionné"; + }, + maxOptionsText: function (numAll, numGroup) { + return [ + (numAll > 1) ? 'Limite atteinte ({n} éléments max)' : 'Limite atteinte ({n} élément max)', + (numGroup > 1) ? 'Limite du groupe atteinte ({n} éléments max)' : 'Limite du groupe atteinte ({n} élément max)' + ]; + }, + multipleSeparator: ', ', + selectAllText: 'Tout Sélectionner', + deselectAllText: 'Tout Dé-selectionner', + }; +})(jQuery); diff --git a/public/assets/libs/bootstrap-select/js/i18n/defaults-hu_HU.js b/public/assets/libs/bootstrap-select/js/i18n/defaults-hu_HU.js new file mode 100644 index 0000000..99bc644 --- /dev/null +++ b/public/assets/libs/bootstrap-select/js/i18n/defaults-hu_HU.js @@ -0,0 +1,23 @@ +/* + * Translated default messages for bootstrap-select. + * Locale: HU (Hungarian) + * Region: HU (Hungary) + */ +(function ($) { + $.fn.selectpicker.defaults = { + noneSelectedText: 'Válasszon!', + noneResultsText: 'Nincs találat {0}', + countSelectedText: function (numSelected, numTotal) { + return '{0} elem kiválasztva'; + }, + maxOptionsText: function (numAll, numGroup) { + return [ + 'Legfeljebb {n} elem választható', + 'A csoportban legfeljebb {n} elem választható' + ]; + }, + selectAllText: 'Mind', + deselectAllText: 'Egyik sem', + multipleSeparator: ', ' + }; +})(jQuery); diff --git a/public/assets/libs/bootstrap-select/js/i18n/defaults-id_ID.js b/public/assets/libs/bootstrap-select/js/i18n/defaults-id_ID.js new file mode 100644 index 0000000..e7018b6 --- /dev/null +++ b/public/assets/libs/bootstrap-select/js/i18n/defaults-id_ID.js @@ -0,0 +1,16 @@ +/* + * Translated default messages for bootstrap-select. + * Locale: ID (Indonesian; Bahasa Indonesia) + * Region: ID (Indonesia) + */ +(function ($) { + $.fn.selectpicker.defaults = { + noneSelectedText: 'Tidak ada yang dipilih', + noneResultsText: 'Tidak ada yang cocok {0}', + countSelectedText: '{0} terpilih', + maxOptionsText: ['Mencapai batas (maksimum {n})', 'Mencapai batas grup (maksimum {n})'], + selectAllText: 'Pilih Semua', + deselectAllText: 'Hapus Semua', + multipleSeparator: ', ' + }; +})(jQuery); diff --git a/public/assets/libs/bootstrap-select/js/i18n/defaults-it_IT.js b/public/assets/libs/bootstrap-select/js/i18n/defaults-it_IT.js new file mode 100644 index 0000000..3cf2e13 --- /dev/null +++ b/public/assets/libs/bootstrap-select/js/i18n/defaults-it_IT.js @@ -0,0 +1,15 @@ +/* + * Translated default messages for bootstrap-select. + * Locale: IT (Italian; italiano) + * Region: IT (Italy; Italia) + * Author: Michele Beltrame + */ +(function ($) { + $.fn.selectpicker.defaults = { + noneSelectedText: 'Nessuna selezione', + noneResultsText: 'Nessun risultato per {0}', + countSelectedText: 'Selezionati {0} di {1}', + maxOptionsText: ['Limite raggiunto ({n} {var} max)', 'Limite del gruppo raggiunto ({n} {var} max)', ['elementi', 'elemento']], + multipleSeparator: ', ' + }; +})(jQuery); diff --git a/public/assets/libs/bootstrap-select/js/i18n/defaults-ko_KR.js b/public/assets/libs/bootstrap-select/js/i18n/defaults-ko_KR.js new file mode 100644 index 0000000..9583cc5 --- /dev/null +++ b/public/assets/libs/bootstrap-select/js/i18n/defaults-ko_KR.js @@ -0,0 +1,23 @@ +/* + * Translated default messages for bootstrap-select. + * Locale: KO (Korean) + * Region: KR (South Korea) + */ +(function ($) { + $.fn.selectpicker.defaults = { + noneSelectedText: '항목을 선택해주세요', + noneResultsText: '{0} 검색 결과가 없습니다', + countSelectedText: function (numSelected, numTotal) { + return "{0}개를 선택하였습니다"; + }, + maxOptionsText: function (numAll, numGroup) { + return [ + '{n}개까지 선택 가능합니다', + '해당 그룹은 {n}개까지 선택 가능합니다' + ]; + }, + selectAllText: '전체선택', + deselectAllText: '전체해제', + multipleSeparator: ', ' + }; +})(jQuery); diff --git a/public/assets/libs/bootstrap-select/js/i18n/defaults-lt_LT.js b/public/assets/libs/bootstrap-select/js/i18n/defaults-lt_LT.js new file mode 100644 index 0000000..1a299a9 --- /dev/null +++ b/public/assets/libs/bootstrap-select/js/i18n/defaults-lt_LT.js @@ -0,0 +1,23 @@ +/* + * Translated default messages for bootstrap-select. + * Locale: LT (Lithuanian) + * Region: LT (Lithuania) + */ +(function ($) { + $.fn.selectpicker.defaults = { + noneSelectedText: 'Niekas nepasirinkta', + noneResultsText: 'Niekas nesutapo su {0}', + countSelectedText: function (numSelected, numTotal) { + return (numSelected == 1) ? "{0} elementas pasirinktas" : "{0} elementai(-ų) pasirinkta"; + }, + maxOptionsText: function (numAll, numGroup) { + return [ + (numAll == 1) ? 'Pasiekta riba ({n} elementas daugiausiai)' : 'Riba pasiekta ({n} elementai(-ų) daugiausiai)', + (numGroup == 1) ? 'Grupės riba pasiekta ({n} elementas daugiausiai)' : 'Grupės riba pasiekta ({n} elementai(-ų) daugiausiai)' + ]; + }, + selectAllText: 'Pasirinkti visus', + deselectAllText: 'Atmesti visus', + multipleSeparator: ', ' + }; +})(jQuery); diff --git a/public/assets/libs/bootstrap-select/js/i18n/defaults-nb_NO.js b/public/assets/libs/bootstrap-select/js/i18n/defaults-nb_NO.js new file mode 100644 index 0000000..e5bb914 --- /dev/null +++ b/public/assets/libs/bootstrap-select/js/i18n/defaults-nb_NO.js @@ -0,0 +1,23 @@ +/* + * Translated default messages for bootstrap-select. + * Locale: NB (Norwegian; Bokmål) + * Region: NO (Norway) + */ +(function ($) { + $.fn.selectpicker.defaults = { + noneSelectedText: 'Ingen valgt', + noneResultsText: 'Søket gir ingen treff {0}', + countSelectedText: function (numSelected, numTotal) { + return (numSelected == 1) ? "{0} alternativ valgt" : "{0} alternativer valgt"; + }, + maxOptionsText: function (numAll, numGroup) { + return [ + (numAll == 1) ? 'Grense nådd (maks {n} valg)' : 'Grense nådd (maks {n} valg)', + (numGroup == 1) ? 'Grense for grupper nådd (maks {n} grupper)' : 'Grense for grupper nådd (maks {n} grupper)' + ]; + }, + selectAllText: 'Merk alle', + deselectAllText: 'Fjern alle', + multipleSeparator: ', ' + }; +})(jQuery); diff --git a/public/assets/libs/bootstrap-select/js/i18n/defaults-nl_NL.js b/public/assets/libs/bootstrap-select/js/i18n/defaults-nl_NL.js new file mode 100644 index 0000000..96b857a --- /dev/null +++ b/public/assets/libs/bootstrap-select/js/i18n/defaults-nl_NL.js @@ -0,0 +1,15 @@ +/* + * Translated default messages for bootstrap-select. + * Locale: NL (Dutch; Nederlands) + * Region: NL (Europe) + * Author: Daan Rosbergen (Badmuts) + */ +(function ($) { + $.fn.selectpicker.defaults = { + noneSelectedText: 'Niets geselecteerd', + noneResultsText: 'Geen resultaten gevonden voor {0}', + countSelectedText: '{0} van {1} geselecteerd', + maxOptionsText: ['Limiet bereikt ({n} {var} max)', 'Groep limiet bereikt ({n} {var} max)', ['items', 'item']], + multipleSeparator: ', ' + }; +})(jQuery); diff --git a/public/assets/libs/bootstrap-select/js/i18n/defaults-pl_PL.js b/public/assets/libs/bootstrap-select/js/i18n/defaults-pl_PL.js new file mode 100644 index 0000000..e7eccaf --- /dev/null +++ b/public/assets/libs/bootstrap-select/js/i18n/defaults-pl_PL.js @@ -0,0 +1,16 @@ +/* + * Translated default messages for bootstrap-select. + * Locale: PL (Polish) + * Region: EU (Europe) + */ +(function ($) { + $.fn.selectpicker.defaults = { + noneSelectedText: 'Nic nie zaznaczono', + noneResultsText: 'Brak wyników wyszukiwania {0}', + countSelectedText: 'Zaznaczono {0} z {1}', + maxOptionsText: ['Osiągnięto limit ({n} {var} max)', 'Limit grupy osiągnięty ({n} {var} max)', ['elementy', 'element']], + selectAll: 'Zaznacz wszystkie', + deselectAll: 'Odznacz wszystkie', + multipleSeparator: ', ' + }; +})(jQuery); diff --git a/public/assets/libs/bootstrap-select/js/i18n/defaults-pt_BR.js b/public/assets/libs/bootstrap-select/js/i18n/defaults-pt_BR.js new file mode 100644 index 0000000..610871b --- /dev/null +++ b/public/assets/libs/bootstrap-select/js/i18n/defaults-pt_BR.js @@ -0,0 +1,15 @@ +/* + * Translated default messages for bootstrap-select. + * Locale: PT (Portuguese; português) + * Region: BR (Brazil; Brasil) + * Author: Rodrigo de Avila + */ +(function ($) { + $.fn.selectpicker.defaults = { + noneSelectedText: 'Nada selecionado', + noneResultsText: 'Nada encontrado contendo {0}', + countSelectedText: 'Selecionado {0} de {1}', + maxOptionsText: ['Limite excedido (máx. {n} {var})', 'Limite do grupo excedido (máx. {n} {var})', ['itens', 'item']], + multipleSeparator: ', ' + }; +})(jQuery); diff --git a/public/assets/libs/bootstrap-select/js/i18n/defaults-pt_PT.js b/public/assets/libs/bootstrap-select/js/i18n/defaults-pt_PT.js new file mode 100644 index 0000000..2d07e87 --- /dev/null +++ b/public/assets/libs/bootstrap-select/js/i18n/defaults-pt_PT.js @@ -0,0 +1,15 @@ +/* +* Translated default messages for bootstrap-select. +* Locale: PT (Portuguese; português) +* Region: PT (Portugal; Portugal) +* Author: Burnspirit +*/ +(function ($) { +$.fn.selectpicker.defaults = { +noneSelectedText: 'Nenhum seleccionado', +noneResultsText: 'Sem resultados contendo {0}', +countSelectedText: 'Selecionado {0} de {1}', +maxOptionsText: ['Limite ultrapassado (máx. {n} {var})', 'Limite de seleções ultrapassado (máx. {n} {var})', ['itens', 'item']], +multipleSeparator: ', ' +}; +})(jQuery); diff --git a/public/assets/libs/bootstrap-select/js/i18n/defaults-ro_RO.js b/public/assets/libs/bootstrap-select/js/i18n/defaults-ro_RO.js new file mode 100644 index 0000000..c6ddf6f --- /dev/null +++ b/public/assets/libs/bootstrap-select/js/i18n/defaults-ro_RO.js @@ -0,0 +1,15 @@ +/* + * Translated default messages for bootstrap-select. + * Locale: RO (Romanian) + * Region: RO (Romania) + * Alex Florea + */ +(function ($) { + $.fn.selectpicker.defaults = { + noneSelectedText: 'Nu a fost selectat nimic', + noneResultsText: 'Nu exista niciun rezultat {0}', + countSelectedText: '{0} din {1} selectat(e)', + maxOptionsText: ['Limita a fost atinsa ({n} {var} max)', 'Limita de grup a fost atinsa ({n} {var} max)', ['iteme', 'item']], + multipleSeparator: ', ' + }; +})(jQuery); diff --git a/public/assets/libs/bootstrap-select/js/i18n/defaults-ru_RU.js b/public/assets/libs/bootstrap-select/js/i18n/defaults-ru_RU.js new file mode 100644 index 0000000..c354f8c --- /dev/null +++ b/public/assets/libs/bootstrap-select/js/i18n/defaults-ru_RU.js @@ -0,0 +1,15 @@ +/* + * Translated default messages for bootstrap-select. + * Locale: RU (Russian; Русский) + * Region: RU (Russian Federation) + */ +(function ($) { + $.fn.selectpicker.defaults = { + noneSelectedText: 'Ничего не выбрано', + noneResultsText: 'Совпадений не найдено {0}', + countSelectedText: 'Выбрано {0} из {1}', + maxOptionsText: ['Достигнут предел ({n} {var} максимум)', 'Достигнут предел в группе ({n} {var} максимум)', ['items', 'item']], + doneButtonText: 'Закрыть', + multipleSeparator: ', ' + }; +})(jQuery); diff --git a/public/assets/libs/bootstrap-select/js/i18n/defaults-sk_SK.js b/public/assets/libs/bootstrap-select/js/i18n/defaults-sk_SK.js new file mode 100644 index 0000000..e96762d --- /dev/null +++ b/public/assets/libs/bootstrap-select/js/i18n/defaults-sk_SK.js @@ -0,0 +1,16 @@ +/* + * Translated default messages for bootstrap-select. + * Locale: SK + * Region: SK (Slovak Republic) + */ +(function ($) { + $.fn.selectpicker.defaults = { + noneSelectedText: 'Vyberte zo zoznamu', + noneResultsText: 'Pre výraz {0} neboli nájdené žiadne výsledky', + countSelectedText: 'Vybrané {0} z {1}', + maxOptionsText: ['Limit prekročený ({n} {var} max)', 'Limit skupiny prekročený ({n} {var} max)', ['položiek', 'položka']], + selectAllText: 'Vybrať všetky', + deselectAllText: 'Zrušiť výber', + multipleSeparator: ', ' + }; +})(jQuery); diff --git a/public/assets/libs/bootstrap-select/js/i18n/defaults-sl_SI.js b/public/assets/libs/bootstrap-select/js/i18n/defaults-sl_SI.js new file mode 100644 index 0000000..a328c8c --- /dev/null +++ b/public/assets/libs/bootstrap-select/js/i18n/defaults-sl_SI.js @@ -0,0 +1,23 @@ +/* + * Translated default messages for bootstrap-select. + * Locale: SL (Slovenian) + * Region: SI (Slovenia) + */ +(function ($) { + $.fn.selectpicker.defaults = { + noneSelectedText: 'Nič izbranega', + noneResultsText: 'Ni zadetkov za {0}', + countSelectedText: function (numSelected, numTotal) { + "Število izbranih: {0}"; + }, + maxOptionsText: function (numAll, numGroup) { + return [ + 'Omejitev dosežena (max. izbranih: {n})', + 'Omejitev skupine dosežena (max. izbranih: {n})' + ]; + }, + selectAllText: 'Izberi vse', + deselectAllText: 'Počisti izbor', + multipleSeparator: ', ' + }; +})(jQuery); diff --git a/public/assets/libs/bootstrap-select/js/i18n/defaults-sv_SE.js b/public/assets/libs/bootstrap-select/js/i18n/defaults-sv_SE.js new file mode 100644 index 0000000..89128e9 --- /dev/null +++ b/public/assets/libs/bootstrap-select/js/i18n/defaults-sv_SE.js @@ -0,0 +1,23 @@ +/* + * Translated default messages for bootstrap-select. + * Locale: SV (Swedish) + * Region: SE (Sweden) + */ +(function ($) { + $.fn.selectpicker.defaults = { + noneSelectedText: 'Inget valt', + noneResultsText: 'Inget sökresultat matchar {0}', + countSelectedText: function (numSelected, numTotal) { + return (numSelected === 1) ? "{0} alternativ valt" : "{0} alternativ valda"; + }, + maxOptionsText: function (numAll, numGroup) { + return [ + 'Gräns uppnåd (max {n} alternativ)', + 'Gräns uppnåd (max {n} gruppalternativ)' + ]; + }, + selectAllText: 'Markera alla', + deselectAllText: 'Avmarkera alla', + multipleSeparator: ', ' + }; +})(jQuery); diff --git a/public/assets/libs/bootstrap-select/js/i18n/defaults-tr_TR.js b/public/assets/libs/bootstrap-select/js/i18n/defaults-tr_TR.js new file mode 100644 index 0000000..fe43937 --- /dev/null +++ b/public/assets/libs/bootstrap-select/js/i18n/defaults-tr_TR.js @@ -0,0 +1,24 @@ +/* + * Translated default messages for bootstrap-select. + * Locale: TR (Turkey) + * Region: TR (Europe) + * Author: Serhan Güney + */ +(function ($) { + $.fn.selectpicker.defaults = { + noneSelectedText: 'Hiçbiri seçilmedi', + noneResultsText: 'Hiçbir sonuç bulunamadı {0}', + countSelectedText: function (numSelected, numTotal) { + return (numSelected == 1) ? "{0} öğe seçildi" : "{0} öğe seçildi"; + }, + maxOptionsText: function (numAll, numGroup) { + return [ + (numAll == 1) ? 'Limit aşıldı (maksimum {n} sayıda öğe )' : 'Limit aşıldı (maksimum {n} sayıda öğe)', + (numGroup == 1) ? 'Grup limiti aşıldı (maksimum {n} sayıda öğe)' : 'Grup limiti aşıldı (maksimum {n} sayıda öğe)' + ]; + }, + selectAllText: 'Tümünü Seç', + deselectAllText: 'Seçiniz', + multipleSeparator: ', ' + }; +})(jQuery); diff --git a/public/assets/libs/bootstrap-select/js/i18n/defaults-ua_UA.js b/public/assets/libs/bootstrap-select/js/i18n/defaults-ua_UA.js new file mode 100644 index 0000000..e1d3958 --- /dev/null +++ b/public/assets/libs/bootstrap-select/js/i18n/defaults-ua_UA.js @@ -0,0 +1,14 @@ +/* + * Translated default messages for bootstrap-select. + * Locale: UA (Ukrainian; Українська) + * Region: UA (Ukraine) + */ +(function ($) { + $.fn.selectpicker.defaults = { + noneSelectedText: 'Нічого не вибрано', + noneResultsText: 'Збігів не знайдено {0}', + countSelectedText: 'Вибрано {0} із {1}', + maxOptionsText: ['Досягнута межа ({n} {var} максимум)', 'Досягнута межа в групі ({n} {var} максимум)', ['items', 'item']], + multipleSeparator: ', ' + }; +})(jQuery); diff --git a/public/assets/libs/bootstrap-select/js/i18n/defaults-zh_CN.js b/public/assets/libs/bootstrap-select/js/i18n/defaults-zh_CN.js new file mode 100644 index 0000000..ad1c132 --- /dev/null +++ b/public/assets/libs/bootstrap-select/js/i18n/defaults-zh_CN.js @@ -0,0 +1,14 @@ +/* + * Translated default messages for bootstrap-select. + * Locale: ZH (Chinese) + * Region: CN (China) + */ +(function ($) { + $.fn.selectpicker.defaults = { + noneSelectedText: '没有选中任何项', + noneResultsText: '没有找到匹配项', + countSelectedText: '选中{1}中的{0}项', + maxOptionsText: ['超出限制 (最多选择{n}项)', '组选择超出限制(最多选择{n}组)'], + multipleSeparator: ', ' + }; +})(jQuery); diff --git a/public/assets/libs/bootstrap-select/js/i18n/defaults-zh_TW.js b/public/assets/libs/bootstrap-select/js/i18n/defaults-zh_TW.js new file mode 100644 index 0000000..c05add3 --- /dev/null +++ b/public/assets/libs/bootstrap-select/js/i18n/defaults-zh_TW.js @@ -0,0 +1,16 @@ +/* + * Translated default messages for bootstrap-select. + * Locale: ZH (Chinese) + * Region: TW (Taiwan) + */ +(function ($) { + $.fn.selectpicker.defaults = { + noneSelectedText: '沒有選取任何項目', + noneResultsText: '沒有找到符合的結果', + countSelectedText: '已經選取{0}個項目', + maxOptionsText: ['超過限制 (最多選擇{n}項)', '超過限制(最多選擇{n}組)'], + selectAllText: '選取全部', + deselectAllText: '全部取消', + multipleSeparator: ', ' + }; +})(jQuery); diff --git a/public/assets/libs/bootstrap-select/less/bootstrap-select.less b/public/assets/libs/bootstrap-select/less/bootstrap-select.less new file mode 100644 index 0000000..7be681f --- /dev/null +++ b/public/assets/libs/bootstrap-select/less/bootstrap-select.less @@ -0,0 +1,367 @@ +@import "variables"; + +// Mixins +.cursor-disabled() { + cursor: not-allowed; +} + +// Rules +select.bs-select-hidden, +select.selectpicker { + display: none !important; +} + +.bootstrap-select { + width: 220px \0; /*IE9 and below*/ + + // The selectpicker button + > .dropdown-toggle { + width: 100%; + padding-right: 25px; + z-index: 1; + + &.bs-placeholder, + &.bs-placeholder:hover, + &.bs-placeholder:focus, + &.bs-placeholder:active { color: @input-color-placeholder; } + } + + > select { + position: absolute !important; + bottom: 0; + left: 50%; + display: block !important; + width: 0.5px !important; + height: 100% !important; + padding: 0 !important; + opacity: 0 !important; + border: none; + + &.mobile-device { + top: 0; + left: 0; + display: block !important; + width: 100% !important; + z-index: 2; + } + } + + // Error display + .has-error & .dropdown-toggle, + .error & .dropdown-toggle { + border-color: @color-red-error; + } + + &.fit-width { + width: auto !important; + } + + &:not([class*="col-"]):not([class*="form-control"]):not(.input-group-btn) { + width: @width-default; + } + + .dropdown-toggle:focus { + outline: thin dotted #333333 !important; + outline: 5px auto -webkit-focus-ring-color !important; + outline-offset: -2px; + } +} + +.bootstrap-select.form-control { + margin-bottom: 0; + padding: 0; + border: none; + + &:not([class*="col-"]) { + width: 100%; + } + + &.input-group-btn { + z-index: auto; + + &:not(:first-child):not(:last-child) { + > .btn { + border-radius: 0; + } + } + } +} + +// The selectpicker components +.bootstrap-select.btn-group { + &:not(.input-group-btn), + &[class*="col-"] { + float: none; + display: inline-block; + margin-left: 0; + } + + // Forces the pull to the right, if necessary + &, + &[class*="col-"], + .row &[class*="col-"] { + &.dropdown-menu-right { + float: right; + } + } + + .form-inline &, + .form-horizontal &, + .form-group & { + margin-bottom: 0; + } + + .form-group-lg &.form-control, + .form-group-sm &.form-control { + padding: 0; + } + + // Set the width of the live search (and any other form control within an inline form) + // see https://github.com/silviomoreto/bootstrap-select/issues/685 + .form-inline & .form-control { + width: 100%; + } + + &.disabled, + > .disabled { + .cursor-disabled(); + + &:focus { + outline: none !important; + } + } + + &.bs-container { + position: absolute; + height: 0 !important; + padding: 0 !important; + + .dropdown-menu { + z-index: @zindex-select-dropdown; + } + } + + // The selectpicker button + .dropdown-toggle { + .filter-option { + display: inline-block; + overflow: hidden; + width: 100%; + text-align: left; + } + + .caret { + position: absolute; + top: 50%; + right: 12px; + margin-top: -2px; + vertical-align: middle; + } + } + + &[class*="col-"] .dropdown-toggle { + width: 100%; + } + + // The selectpicker dropdown + .dropdown-menu { + min-width: 100%; + box-sizing: border-box; + + &.inner { + position: static; + float: none; + border: 0; + padding: 0; + margin: 0; + border-radius: 0; + box-shadow: none; + } + + li { + position: relative; + + &.active small { + color: #fff; + } + + &.disabled a { + .cursor-disabled(); + } + + a { + cursor: pointer; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + + &.opt { + position: relative; + padding-left: 2.25em; + } + + span.check-mark { + display: none; + } + + span.text { + display: inline-block; + } + } + + small { + padding-left: 0.5em; + } + } + + .notify { + position: absolute; + bottom: 5px; + width: 96%; + margin: 0 2%; + min-height: 26px; + padding: 3px 5px; + background: rgb(245, 245, 245); + border: 1px solid rgb(227, 227, 227); + box-shadow: inset 0 1px 1px fade(rgb(0, 0, 0), 5%); + pointer-events: none; + opacity: 0.9; + box-sizing: border-box; + } + } + + .no-results { + padding: 3px; + background: #f5f5f5; + margin: 0 5px; + white-space: nowrap; + } + + &.fit-width .dropdown-toggle { + .filter-option { + position: static; + } + + .caret { + position: static; + top: auto; + margin-top: -1px; + } + } + + &.show-tick .dropdown-menu li { + &.selected a span.check-mark { + position: absolute; + display: inline-block; + right: 15px; + margin-top: 5px; + } + + a span.text { + margin-right: 34px; + } + } +} + +.bootstrap-select.show-menu-arrow { + &.open > .dropdown-toggle { + z-index: (@zindex-select-dropdown + 1); + } + + .dropdown-toggle { + &:before { + content: ''; + border-left: 7px solid transparent; + border-right: 7px solid transparent; + border-bottom: 7px solid @color-grey-arrow; + position: absolute; + bottom: -4px; + left: 9px; + display: none; + } + + &:after { + content: ''; + border-left: 6px solid transparent; + border-right: 6px solid transparent; + border-bottom: 6px solid white; + position: absolute; + bottom: -4px; + left: 10px; + display: none; + } + } + + &.dropup .dropdown-toggle { + &:before { + bottom: auto; + top: -3px; + border-top: 7px solid @color-grey-arrow; + border-bottom: 0; + } + + &:after { + bottom: auto; + top: -3px; + border-top: 6px solid white; + border-bottom: 0; + } + } + + &.pull-right .dropdown-toggle { + &:before { + right: 12px; + left: auto; + } + + &:after { + right: 13px; + left: auto; + } + } + + &.open > .dropdown-toggle { + &:before, + &:after { + display: block; + } + } +} + +.bs-searchbox, +.bs-actionsbox, +.bs-donebutton { + padding: 4px 8px; +} + +.bs-actionsbox { + width: 100%; + box-sizing: border-box; + + & .btn-group button { + width: 50%; + } +} + +.bs-donebutton { + float: left; + width: 100%; + box-sizing: border-box; + + & .btn-group button { + width: 100%; + } +} + +.bs-searchbox { + & + .bs-actionsbox { + padding: 0 8px 4px; + } + + & .form-control { + margin-bottom: 0; + width: 100%; + float: none; + } +} diff --git a/public/assets/libs/bootstrap-select/less/variables.less b/public/assets/libs/bootstrap-select/less/variables.less new file mode 100644 index 0000000..2514a85 --- /dev/null +++ b/public/assets/libs/bootstrap-select/less/variables.less @@ -0,0 +1,9 @@ +@color-red-error: rgb(185, 74, 72); +@color-grey-arrow: rgba(204, 204, 204, 0.2); + +@width-default: 220px; // 3 960px-grid columns + +@zindex-select-dropdown: 1060; // must be higher than a modal background (1050) + +//** Placeholder text color +@input-color-placeholder: #999; \ No newline at end of file diff --git a/public/assets/libs/bootstrap-select/nuget/MyGet.ps1 b/public/assets/libs/bootstrap-select/nuget/MyGet.ps1 new file mode 100644 index 0000000..aba127f --- /dev/null +++ b/public/assets/libs/bootstrap-select/nuget/MyGet.ps1 @@ -0,0 +1,20 @@ +# set env vars usually set by MyGet (enable for local testing) +#$env:SourcesPath = '..' +#$env:NuGet = "./nuget.exe" #https://dist.nuget.org/win-x86-commandline/latest/nuget.exe + +$nuget = $env:NuGet + +# parse the version number out of package.json +$bsversionParts = ((Get-Content $env:SourcesPath\package.json) -join "`n" | ConvertFrom-Json).version.split('-', 2) # split the version on the '-' +$bsversion = $bsversionParts[0] + +if ($bsversionParts.Length -gt 1) +{ + $bsversion += '-' + $bsversionParts[1].replace('.', '').replace('-', '_') # strip out invalid chars from the PreRelease part +} + +# update sourceMappingURL in bootstrap-select.min.js +(Get-Content $env:SourcesPath\dist\js\bootstrap-select.min.js).replace("sourceMappingURL=", "sourceMappingURL=Scripts/") | Set-Content $env:SourcesPath\dist\js\bootstrap-select.min.js + +# create packages +& $nuget pack "$env:SourcesPath\nuget\bootstrap-select.nuspec" -Verbosity detailed -NonInteractive -NoPackageAnalysis -BasePath $env:SourcesPath -Version $bsversion \ No newline at end of file diff --git a/public/assets/libs/bootstrap-select/nuget/bootstrap-select.nuspec b/public/assets/libs/bootstrap-select/nuget/bootstrap-select.nuspec new file mode 100644 index 0000000..0494620 --- /dev/null +++ b/public/assets/libs/bootstrap-select/nuget/bootstrap-select.nuspec @@ -0,0 +1,22 @@ + + + + bootstrap-select + 1.11.2 + bootstrap-select + Silvio Moreto,Ana Carolina,caseyjhol,Matt Bryson,and t0xicCode. + Silvio Moreto + https://github.com/silviomoreto/bootstrap-select + Bootstrap-select is a jQuery plugin that utilizes Bootstrap's dropdown.js to style and bring additional functionality to standard select elements. + bootstrap dropdown select + false + + + + + + + + + + \ No newline at end of file diff --git a/public/assets/libs/bootstrap-select/sass/bootstrap-select.scss b/public/assets/libs/bootstrap-select/sass/bootstrap-select.scss new file mode 100644 index 0000000..7f54f71 --- /dev/null +++ b/public/assets/libs/bootstrap-select/sass/bootstrap-select.scss @@ -0,0 +1,385 @@ +@import "variables"; + +// Mixins +@mixin cursor-disabled() { + cursor: not-allowed; +} + +@mixin box-sizing($fmt) { + -webkit-box-sizing: $fmt; + -moz-box-sizing: $fmt; + box-sizing: $fmt; +} + +@mixin box-shadow($fmt) { + -webkit-box-shadow: $fmt; + box-shadow: $fmt; +} + +@function fade($color, $amnt) { + @if $amnt > 1 { + $amnt: $amnt / 100; // convert to percentage if int + } + @return rgba($color, $amnt); +} + +// Rules +select.bs-select-hidden, +select.selectpicker { + display: none !important; +} + +.bootstrap-select { + width: 220px \0; /*IE9 and below*/ + + // The selectpicker button + > .dropdown-toggle { + width: 100%; + padding-right: 25px; + z-index: 1; + + &.bs-placeholder, + &.bs-placeholder:hover, + &.bs-placeholder:focus, + &.bs-placeholder:active { color: $input-color-placeholder; } + } + + > select { + position: absolute !important; + bottom: 0; + left: 50%; + display: block !important; + width: 0.5px !important; + height: 100% !important; + padding: 0 !important; + opacity: 0 !important; + border: none; + + &.mobile-device { + top: 0; + left: 0; + display: block !important; + width: 100% !important; + z-index: 2; + } + } + + // Error display + .has-error & .dropdown-toggle, + .error & .dropdown-toggle { + border-color: $color-red-error; + } + + &.fit-width { + width: auto !important; + } + + &:not([class*="col-"]):not([class*="form-control"]):not(.input-group-btn) { + width: $width-default; + } + + .dropdown-toggle:focus { + outline: thin dotted #333333 !important; + outline: 5px auto -webkit-focus-ring-color !important; + outline-offset: -2px; + } +} + +.bootstrap-select.form-control { + margin-bottom: 0; + padding: 0; + border: none; + + &:not([class*="col-"]) { + width: 100%; + } + + &.input-group-btn { + z-index: auto; + + &:not(:first-child):not(:last-child) { + > .btn { + border-radius: 0; + } + } + } +} + +// The selectpicker components +.bootstrap-select.btn-group { + &:not(.input-group-btn), + &[class*="col-"] { + float: none; + display: inline-block; + margin-left: 0; + } + + // Forces the pull to the right, if necessary + &, + &[class*="col-"], + .row &[class*="col-"] { + &.dropdown-menu-right { + float: right; + } + } + + .form-inline &, + .form-horizontal &, + .form-group & { + margin-bottom: 0; + } + + .form-group-lg &.form-control, + .form-group-sm &.form-control { + padding: 0; + } + + // Set the width of the live search (and any other form control within an inline form) + // see https://github.com/silviomoreto/bootstrap-select/issues/685 + .form-inline & .form-control { + width: 100%; + } + + &.disabled, + > .disabled { + @include cursor-disabled(); + + &:focus { + outline: none !important; + } + } + + &.bs-container { + position: absolute; + height: 0 !important; + padding: 0 !important; + + .dropdown-menu { + z-index: $zindex-select-dropdown; + } + } + + // The selectpicker button + .dropdown-toggle { + .filter-option { + display: inline-block; + overflow: hidden; + width: 100%; + text-align: left; + } + + .caret { + position: absolute; + top: 50%; + right: 12px; + margin-top: -2px; + vertical-align: middle; + } + } + + &[class*="col-"] .dropdown-toggle { + width: 100%; + } + + // The selectpicker dropdown + .dropdown-menu { + min-width: 100%; + @include box-sizing(border-box); + + &.inner { + position: static; + float: none; + border: 0; + padding: 0; + margin: 0; + border-radius: 0; + box-shadow: none; + } + + li { + position: relative; + + &.active small { + color: #fff; + } + + &.disabled a { + @include cursor-disabled(); + } + + a { + cursor: pointer; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + + &.opt { + position: relative; + padding-left: 2.25em; + } + + span.check-mark { + display: none; + } + + span.text { + display: inline-block; + } + } + + small { + padding-left: 0.5em; + } + } + + .notify { + position: absolute; + bottom: 5px; + width: 96%; + margin: 0 2%; + min-height: 26px; + padding: 3px 5px; + background: rgb(245, 245, 245); + border: 1px solid rgb(227, 227, 227); + @include box-shadow(inset 0 1px 1px fade(rgb(0, 0, 0), 5)); + pointer-events: none; + opacity: 0.9; + @include box-sizing(border-box); + } + } + + .no-results { + padding: 3px; + background: #f5f5f5; + margin: 0 5px; + white-space: nowrap; + } + + &.fit-width .dropdown-toggle { + .filter-option { + position: static; + } + + .caret { + position: static; + top: auto; + margin-top: -1px; + } + } + + &.show-tick .dropdown-menu li { + &.selected a span.check-mark { + position: absolute; + display: inline-block; + right: 15px; + margin-top: 5px; + } + + a span.text { + margin-right: 34px; + } + } +} + +.bootstrap-select.show-menu-arrow { + &.open > .dropdown-toggle { + z-index: ($zindex-select-dropdown + 1); + } + + .dropdown-toggle { + &:before { + content: ''; + border-left: 7px solid transparent; + border-right: 7px solid transparent; + border-bottom: 7px solid $color-grey-arrow; + position: absolute; + bottom: -4px; + left: 9px; + display: none; + } + + &:after { + content: ''; + border-left: 6px solid transparent; + border-right: 6px solid transparent; + border-bottom: 6px solid white; + position: absolute; + bottom: -4px; + left: 10px; + display: none; + } + } + + &.dropup .dropdown-toggle { + &:before { + bottom: auto; + top: -3px; + border-top: 7px solid $color-grey-arrow; + border-bottom: 0; + } + + &:after { + bottom: auto; + top: -3px; + border-top: 6px solid white; + border-bottom: 0; + } + } + + &.pull-right .dropdown-toggle { + &:before { + right: 12px; + left: auto; + } + + &:after { + right: 13px; + left: auto; + } + } + + &.open > .dropdown-toggle { + &:before, + &:after { + display: block; + } + } +} + +.bs-searchbox, +.bs-actionsbox, +.bs-donebutton { + padding: 4px 8px; +} + +.bs-actionsbox { + width: 100%; + @include box-sizing(border-box); + + & .btn-group button { + width: 50%; + } +} + +.bs-donebutton { + float: left; + width: 100%; + @include box-sizing(border-box); + + & .btn-group button { + width: 100%; + } +} + +.bs-searchbox { + & + .bs-actionsbox { + padding: 0 8px 4px; + } + + & .form-control { + margin-bottom: 0; + width: 100%; + float: none; + } +} diff --git a/public/assets/libs/bootstrap-select/sass/variables.scss b/public/assets/libs/bootstrap-select/sass/variables.scss new file mode 100644 index 0000000..8ba1fc0 --- /dev/null +++ b/public/assets/libs/bootstrap-select/sass/variables.scss @@ -0,0 +1,9 @@ +$color-red-error: rgb(185, 74, 72); +$color-grey-arrow: rgba(204, 204, 204, 0.2); + +$width-default: 220px; // 3 960px-grid columns + +$zindex-select-dropdown: 1060; // must be higher than a modal background (1050) + +//** Placeholder text color +$input-color-placeholder: #999; \ No newline at end of file diff --git a/public/assets/libs/bootstrap-slider/.bower.json b/public/assets/libs/bootstrap-slider/.bower.json new file mode 100644 index 0000000..c3bd208 --- /dev/null +++ b/public/assets/libs/bootstrap-slider/.bower.json @@ -0,0 +1,33 @@ +{ + "name": "bootstrap-slider", + "main": [ + "bootstrap-slider.js", + "slider.css" + ], + "homepage": "https://github.com/pammacdotnet/bootstrap-slider", + "authors": [ + "pammacdotnet" + ], + "description": "Eyecon Slider for Bootstrap", + "keywords": [ + "slider", + "bootstrap" + ], + "license": "Apache", + "ignore": [ + "**/.*", + "node_modules", + "bower_components", + "test", + "tests" + ], + "_release": "879a98dcd0", + "_resolution": { + "type": "branch", + "branch": "master", + "commit": "879a98dcd0923107363861e56423f3cc1c2472e7" + }, + "_source": "https://github.com/pammacdotnet/bootstrap-slider.git", + "_target": "*", + "_originalSource": "bootstrap-slider" +} \ No newline at end of file diff --git a/public/assets/libs/bootstrap-slider/README.md b/public/assets/libs/bootstrap-slider/README.md new file mode 100644 index 0000000..2a073ef --- /dev/null +++ b/public/assets/libs/bootstrap-slider/README.md @@ -0,0 +1,26 @@ +Bootstrap Slider +============= + +Fork of eyecon's [bootstrap-slider](http://www.eyecon.ro/bootstrap-slider/). + +Specially remastered for iLIME Project @ UNIR Research. More info: +[http://blogs.unir.net/elearning/telsock-research-group/](http://) + +![ScreenShot](https://raw.github.com/pammacdotnet/bootstrap-slider/master/locks.png) + +Changes +---------- +Current changes include: + ++ Better responsive support ++ Updated look and feel ++ Minor layout tweaks ++ Removed built-in handle types ++ Bower install ++ Limits and locks + + + + + + diff --git a/public/assets/libs/bootstrap-slider/bootstrap-slider.js b/public/assets/libs/bootstrap-slider/bootstrap-slider.js new file mode 100644 index 0000000..2191faf --- /dev/null +++ b/public/assets/libs/bootstrap-slider/bootstrap-slider.js @@ -0,0 +1,427 @@ +/* ========================================================= + * bootstrap-slider.js v2.0.0 + * http://www.eyecon.ro/bootstrap-slider + * ========================================================= + * Copyright 2012 Stefan Petre + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ========================================================= */ + +!function( $ ) { + + var Slider = function(element, options) { + this.dragLocked = false; + this.limit = 100000; + this.element = $(element).hide(); + this.picker = $('
    '+ + '
    '+ + '
    '+ + '
    '+ + '
    '+ + '
    '+ + '
    '+ + '
    ') + .insertBefore(this.element) + .append(this.element); + this.id = this.element.data('slider-id')||options.id; + if (this.id) { + this.picker[0].id = this.id; + } + + if (typeof Modernizr !== 'undefined' && Modernizr.touch) { + this.touchCapable = true; + } + + var tooltip = this.element.data('slider-tooltip')||options.tooltip; + + this.tooltip = this.picker.find('.tooltip'); + this.tooltipInner = this.tooltip.find('div.tooltip-inner'); + + this.orientation = this.element.data('slider-orientation')||options.orientation; + switch(this.orientation) { + case 'vertical': + this.picker.addClass('slider-vertical'); + this.stylePos = 'top'; + this.mousePos = 'pageY'; + this.sizePos = 'offsetHeight'; + this.tooltip.addClass('right')[0].style.left = '100%'; + break; + default: + this.picker + .addClass('slider-horizontal') + .css('width', this.element.outerWidth()); + this.orientation = 'horizontal'; + this.stylePos = 'left'; + this.mousePos = 'pageX'; + this.sizePos = 'offsetWidth'; + this.tooltip.addClass('top')[0].style.top = -this.tooltip.outerHeight() - 14 + 'px'; + break; + } + + this.min = this.element.data('slider-min')||options.min; + this.max = this.element.data('slider-max')||options.max; + this.step = this.element.data('slider-step')||options.step; + this.value = this.element.data('slider-value')||options.value; + if (this.value[1]) { + this.range = true; + } + + this.selection = this.element.data('slider-selection')||options.selection; + this.selectionEl = this.picker.find('.slider-selection'); + if (this.selection === 'none') { + this.selectionEl.addClass('hide'); + } + this.selectionElStyle = this.selectionEl[0].style; + + + this.handle1 = this.picker.find('.slider-handle:first'); + this.handle1Stype = this.handle1[0].style; + this.handle2 = this.picker.find('.slider-handle:last'); + this.handle2Stype = this.handle2[0].style; + + var handle = this.element.data('slider-handle')||options.handle; + switch(handle) { + case 'round': + this.handle1.addClass('round'); + this.handle2.addClass('round'); + break + case 'triangle': + this.handle1.addClass('triangle'); + this.handle2.addClass('triangle'); + break + } + + if (this.range) { + this.value[0] = Math.max(this.min, Math.min(this.max, this.value[0])); + this.value[1] = Math.max(this.min, Math.min(this.max, this.value[1])); + } else { + this.value = [ Math.max(this.min, Math.min(this.max, this.value))]; + this.handle2.addClass('hide'); + if (this.selection == 'after') { + this.value[1] = this.max; + } else { + this.value[1] = this.min; + } + } + this.diff = this.max - this.min; + this.percentage = [ + (this.value[0]-this.min)*100/this.diff, + (this.value[1]-this.min)*100/this.diff, + this.step*100/this.diff + ]; + + this.offset = this.picker.offset(); + this.size = this.picker[0][this.sizePos]; + + this.formater = options.formater; + this.reversed = this.element.data('slider-reversed')||options.reversed; + + this.layout(); + + if (this.touchCapable) { + // Touch: Bind touch events: + this.picker.on({ + touchstart: $.proxy(this.mousedown, this) + }); + } else { + this.picker.on({ + mousedown: $.proxy(this.mousedown, this) + }); + } + + if (tooltip === 'show') { + this.picker.on({ + mouseenter: $.proxy(this.showTooltip, this), + mouseleave: $.proxy(this.hideTooltip, this) + }); + } else { + this.tooltip.addClass('hide'); + } + }; + + Slider.prototype = { + constructor: Slider, + + over: false, + inDrag: false, + + showTooltip: function(){ + this.tooltip.addClass('in'); + //var left = Math.round(this.percent*this.width); + //this.tooltip.css('left', left - this.tooltip.outerWidth()/2); + this.over = true; + }, + + hideTooltip: function(){ + if (this.inDrag === false) { + this.tooltip.removeClass('in'); + } + this.over = false; + }, + + layout: function(){ + var positionPercentages; + + if(this.reversed) { + positionPercentages = [ this.percentage[1] - this.percentage[0], this.percentage[1] ]; + } else { + positionPercentages = [ this.percentage[0], this.percentage[1] ]; + } + + this.handle1Stype[this.stylePos] = positionPercentages[0]+'%'; + this.handle2Stype[this.stylePos] = positionPercentages[1]+'%'; + if (this.orientation == 'vertical') { + this.selectionElStyle.top = Math.min(positionPercentages[0], positionPercentages[1]) +'%'; + this.selectionElStyle.height = Math.abs(positionPercentages[0] - positionPercentages[1]) +'%'; + } else { + this.selectionElStyle.left = Math.min(positionPercentages[0], positionPercentages[1]) +'%'; + this.selectionElStyle.width = Math.abs(positionPercentages[0] - positionPercentages[1]) +'%'; + } + + if (this.range) { + this.tooltipInner.text( + this.formater(this.value[0]) + + ' : ' + + this.formater(this.value[1]) + ); + this.tooltip[0].style[this.stylePos] = this.size * (positionPercentages[0] + (positionPercentages[1] - positionPercentages[0])/2)/100 - (this.orientation === 'vertical' ? this.tooltip.outerHeight()/2 : this.tooltip.outerWidth()/2) +'px'; + } else { + this.tooltipInner.text( + this.formater(this.value[0]) + ); + this.tooltip[0].style[this.stylePos] = this.size * positionPercentages[0]/100 - (this.orientation === 'vertical' ? this.tooltip.outerHeight()/2 : this.tooltip.outerWidth()/2) +'px'; + } + }, + + mousedown: function(ev) { + + if (!this.dragLocked){ + // Touch: Get the original event: + if (this.touchCapable && ev.type === 'touchstart') { + ev = ev.originalEvent; + } + + this.offset = this.picker.offset(); + this.size = this.picker[0][this.sizePos]; + + var percentage = this.getPercentage(ev); + + if (this.range) { + var diff1 = Math.abs(this.percentage[0] - percentage); + var diff2 = Math.abs(this.percentage[1] - percentage); + this.dragged = (diff1 < diff2) ? 0 : 1; + } else { + this.dragged = 0; + } + + this.percentage[this.dragged] = this.reversed ? this.percentage[1] - percentage : percentage; + this.layout(); + + if (this.touchCapable) { + // Touch: Bind touch events: + $(document).on({ + touchmove: $.proxy(this.mousemove, this), + touchend: $.proxy(this.mouseup, this) + }); + } else { + $(document).on({ + mousemove: $.proxy(this.mousemove, this), + mouseup: $.proxy(this.mouseup, this) + }); + } + + this.inDrag = true; + var val = this.calculateValue(); + + this.setValue(val); + this.element.trigger({ + type: 'slideStart', + value: val + }).trigger({ + type: 'slide', + value: val + }); + return false; + } + }, + + mousemove: function(ev) { + // Touch: Get the original event: + if (!this.dragLocked){ + if (this.touchCapable && ev.type === 'touchmove') { + ev = ev.originalEvent; + } + + var percentage = this.getPercentage(ev); + if (this.range) { + if (this.dragged === 0 && this.percentage[1] < percentage) { + this.percentage[0] = this.percentage[1]; + this.dragged = 1; + } else if (this.dragged === 1 && this.percentage[0] > percentage) { + this.percentage[1] = this.percentage[0]; + this.dragged = 0; + } + } + x = this.reversed ? this.percentage[1] - percentage : percentage; + if (x > this.limit) { + return ; + } + this.percentage[this.dragged] = x; + this.layout(); + var val = this.calculateValue(); + this.setValue(val); + + this.element + .trigger({ + type: 'slide', + value: val + }) + .data('value', val) + .prop('value', val); + return false; + } + }, + + mouseup: function(ev) { + if (this.touchCapable) { + // Touch: Bind touch events: + $(document).off({ + touchmove: this.mousemove, + touchend: this.mouseup + }); + } else { + $(document).off({ + mousemove: this.mousemove, + mouseup: this.mouseup + }); + } + + this.inDrag = false; + if (this.over == false) { + this.hideTooltip(); + } + this.element; + var val = this.calculateValue(); + this.layout(); + this.element + .trigger({ + type: 'slideStop', + value: val + }) + .data('value', val) + .prop('value', val); + return false; + }, + + calculateValue: function() { + var val; + if (this.range) { + val = [ + (this.min + Math.round((this.diff * this.percentage[0]/100)/this.step)*this.step), + (this.min + Math.round((this.diff * this.percentage[1]/100)/this.step)*this.step) + ]; + this.value = val; + } else { + val = (this.min + Math.round((this.diff * this.percentage[0]/100)/this.step)*this.step); + this.value = [val, this.value[1]]; + } + return val; + }, + + getPercentage: function(ev) { + if (this.touchCapable) { + ev = ev.touches[0]; + } + var percentage = (ev[this.mousePos] - this.offset[this.stylePos])*100/this.size; + percentage = Math.round(percentage/this.percentage[2])*this.percentage[2]; + return Math.max(0, Math.min(100, percentage)); + }, + + getValue: function() { + if (this.range) { + return this.value; + } + return this.value[0]; + }, + setLimit: function(val) { + this.limit = val; + }, + setDragLocked: function(val) { + this.dragLocked = val; + }, + getDragLocked: function(val) { + return this.dragLocked; + }, + setValue: function(val) { + this.value = val; + + if (this.range) { + this.value[0] = Math.max(this.min, Math.min(this.max, this.value[0])); + this.value[1] = Math.max(this.min, Math.min(this.max, this.value[1])); + } else { + this.value = [ Math.max(this.min, Math.min(this.max, this.value))]; + this.handle2.addClass('hide'); + if (this.selection == 'after') { + this.value[1] = this.max; + } else { + this.value[1] = this.min; + } + } + this.diff = this.max - this.min; + this.percentage = [ + (this.value[0]-this.min)*100/this.diff, + (this.value[1]-this.min)*100/this.diff, + this.step*100/this.diff + ]; + this.layout(); + }, + destroy: function(){ + this.element.show().insertBefore(this.picker); + this.picker.remove(); + }, + }; + + $.fn.slider = function ( option, val ) { + return this.each(function () { + var $this = $(this), + data = $this.data('slider'), + options = typeof option === 'object' && option; + if (!data) { + $this.data('slider', (data = new Slider(this, $.extend({}, $.fn.slider.defaults,options)))); + } + if (typeof option == 'string') { + data[option](val); + } + }) + }; + + $.fn.slider.defaults = { + min: 0, + max: 10, + step: 1, + orientation: 'horizontal', + value: 5, + selection: 'before', + tooltip: 'show', + handle: 'round', + reversed : false, + limit: 100000, + dragLocked: false, + formater: function(value) { + return value; + } + }; + + $.fn.slider.Constructor = Slider; + +}( window.jQuery ); diff --git a/public/assets/libs/bootstrap-slider/bower.json b/public/assets/libs/bootstrap-slider/bower.json new file mode 100644 index 0000000..4f0242c --- /dev/null +++ b/public/assets/libs/bootstrap-slider/bower.json @@ -0,0 +1,22 @@ +{ + "name": "bootstrap-slider", + "main": ["bootstrap-slider.js", "slider.css"], + "version": "2.0.0", + "homepage": "https://github.com/pammacdotnet/bootstrap-slider", + "authors": [ + "pammacdotnet" + ], + "description": "Eyecon Slider for Bootstrap", + "keywords": [ + "slider", + "bootstrap" + ], + "license": "Apache", + "ignore": [ + "**/.*", + "node_modules", + "bower_components", + "test", + "tests" + ] +} diff --git a/public/assets/libs/bootstrap-slider/locks.png b/public/assets/libs/bootstrap-slider/locks.png new file mode 100644 index 0000000..b29baf4 Binary files /dev/null and b/public/assets/libs/bootstrap-slider/locks.png differ diff --git a/public/assets/libs/bootstrap-slider/slider.css b/public/assets/libs/bootstrap-slider/slider.css new file mode 100644 index 0000000..1447d08 --- /dev/null +++ b/public/assets/libs/bootstrap-slider/slider.css @@ -0,0 +1,178 @@ +/*! + * Slider for Bootstrap + * + * Copyright 2012 Stefan Petre + * Licensed under the Apache License v2.0 + * http://www.apache.org/licenses/LICENSE-2.0 + * + */ +.slider { + display: inline-block; + vertical-align: middle; + position: relative; + margin-bottom: 10px +} + +.slider[class*="span"] { + float: none; + margin-left: 0; +} + +.slider-horizontal { + width: 210px; + height: 20px; +} + +.slider-horizontal .slider-handle-container, +.slider-horizontal .slider-track { + height: 10px; + margin-top: -5px; + top: 50%; +} + +.slider-horizontal .slider-track { + left: 0; + right: 0; +} + +.slider-horizontal .slider-handle-container { + left: 10px; + right: 10px; +} + +.slider-horizontal .slider-selection { + height: 100%; + top: 0; + bottom: 0; +} + +.slider-horizontal .slider-handle { + margin-left: -10px; + margin-top: -5px; +} + +.slider-vertical { + height: 210px; + width: 20px; +} + +.slider-vertical .slider-handle-container, +.slider-vertical .slider-track { + width: 10px; + margin-left: -5px; + left: 50%; +} + +.slider-vertical .slider-track { + top: 0; + bottom: 0; +} + +.slider-vertical .slider-handle-container { + top: 10px; + bottom: 10px; +} +.slider-vertical .slider-selection { + width: 100%; + left: 0; + top: 0; + bottom: 0; +} + +.slider-vertical .slider-handle { + margin-left: -5px; + margin-top: -10px; +} + +.slider input, +.slider input[class*="span"] { + display: none; +} + +.slider .tooltip-inner { + white-space: nowrap; +} + +.slider-handle-container { + position: absolute; +} + +.slider-track { + position: absolute; + cursor: pointer; + background-color: #f7f7f7; + background-image: -moz-linear-gradient(top, #f5f5f5, #f9f9f9); + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#f5f5f5), to(#f9f9f9)); + background-image: -webkit-linear-gradient(top, #f5f5f5, #f9f9f9); + background-image: -o-linear-gradient(top, #f5f5f5, #f9f9f9); + background-image: linear-gradient(to bottom, #f5f5f5, #f9f9f9); + background-repeat: repeat-x; + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + border-radius: 4px; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5', endColorstr='#fff9f9f9', GradientType=0); + -webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1); + -moz-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1); + box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1); +} + +.slider-selection { + position: absolute; + background-color: #e6e6e6; + background-image: -moz-linear-gradient(top, #f0f0f0, #e0e0e0); + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#f0f0f0), to(#e0e0e0)); + background-image: -webkit-linear-gradient(top, #f0f0f0, #e0e0e0); + background-image: -o-linear-gradient(top, #f0f0f0, #e0e0e0); + background-image: linear-gradient(to bottom, #f0f0f0, #e0e0e0); + background-repeat: repeat-x; + -webkit-box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.15); + -moz-box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.15); + box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.15); + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + -webkit-border-radius: 20px; + -moz-border-radius: 20px; + border-radius: 20px; +} + +.slider-handle { + position: absolute; + width: 20px; + height: 20px; + cursor: pointer; +} + +.slider-knob { + width: 20px; + height: 20px; + background-color: #f5f5f5; + background-image: -moz-linear-gradient(top, #e6e6e6, #ffffff); + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#e6e6e6), to(#ffffff)); + background-image: -webkit-linear-gradient(top, #e6e6e6, #ffffff); + background-image: -o-linear-gradient(top, #e6e6e6, #ffffff); + background-image: linear-gradient(to bottom, #e6e6e6, #ffffff); + background-repeat: repeat-x; + border: 1px solid #bbbbbb; + border-color: #e6e6e6 #e6e6e6 #bfbfbf; + border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); + border-bottom-color: #a2a2a2; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffe6e6e6', GradientType=0); + filter: progid:DXImageTransform.Microsoft.gradient(enabled=false); + -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); + -moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); + box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); + -webkit-border-radius: 20px; + -moz-border-radius: 20px; + border-radius: 20px; +} + +.slider-handle:active .slider-knob, +.slider-handle:hover .slider-knob { + background-color: #e6e6e6; + background-position: 0 5px; + -webkit-transition: background-position 0.1s linear; + -moz-transition: background-position 0.1s linear; + -o-transition: background-position 0.1s linear; + transition: background-position 0.1s linear; +} \ No newline at end of file diff --git a/public/assets/libs/bootstrap-table/.bower.json b/public/assets/libs/bootstrap-table/.bower.json new file mode 100644 index 0000000..804e5b1 --- /dev/null +++ b/public/assets/libs/bootstrap-table/.bower.json @@ -0,0 +1,37 @@ +{ + "name": "bootstrap-table", + "homepage": "https://github.com/wenzhixin/bootstrap-table", + "authors": [ + "zhixin " + ], + "description": "An extended Bootstrap table with radio, checkbox, sort, pagination, and other added features.", + "main": [ + "src/bootstrap-table.js", + "src/bootstrap-table.css" + ], + "keywords": [ + "bootstrap", + "table", + "bootstrap table" + ], + "license": "MIT", + "ignore": [ + "**/.*", + "node_modules", + "bower_components", + "test", + "tests", + "docs", + "assets" + ], + "version": "1.11.7", + "_release": "1.11.7", + "_resolution": { + "type": "version", + "tag": "v1.11.7", + "commit": "def428fa5104d9f69970fea940d24f6ea1943b3f" + }, + "_source": "https://github.com/karsonzhang/fastadmin-bootstraptable.git", + "_target": "~1.11.5", + "_originalSource": "fastadmin-bootstraptable" +} \ No newline at end of file diff --git a/public/assets/libs/bootstrap-table/Gruntfile.js b/public/assets/libs/bootstrap-table/Gruntfile.js new file mode 100644 index 0000000..2124249 --- /dev/null +++ b/public/assets/libs/bootstrap-table/Gruntfile.js @@ -0,0 +1,132 @@ +'use strict'; + +var fs = require('fs'); + +module.exports = function(grunt) { + + // Project configuration. + grunt.initConfig({ + // Metadata. + pkg: grunt.file.readJSON('bootstrap-table.jquery.json'), + banner: '/*\n' + + '* <%= pkg.name %> - v<%= pkg.version %> - <%= grunt.template.today("yyyy-mm-dd") %>\n' + + '<%= pkg.homepage ? "* " + pkg.homepage : "" %>\n' + + '* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>\n' + + '* Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %>\n' + + '*/\n', + // Task configuration. + clean: ['dist', 'docs/dist'], + concat: { + //basic_target: { + // src: ['src/<%= pkg.name %>.js', 'src/extensions/**/*.js'], + // dest: 'dist/<%= pkg.name %>-all.js' + //}, + locale_target: { + src: ['src/locale/**/*.js'], + dest: 'dist/<%= pkg.name %>-locale-all.js' + } + }, + uglify: { + options: { + banner: '<%= banner %>' + }, + basic_target: { + files: { + 'dist/<%= pkg.name %>.min.js': ['src/<%=pkg.name %>.js'], + //'dist/<%= pkg.name %>-all.min.js': ['dist/<%=pkg.name %>-all.js'], + 'dist/<%= pkg.name %>-locale-all.min.js': ['dist/<%=pkg.name %>-locale-all.js'] + } + }, + locale_target: { + files: [{ + expand: true, + cwd: 'src/locale', + src: '**/*.js', + dest: 'dist/locale', + ext: '.min.js' // replace .js to .min.js + }] + }, + extensions_target: { + files: [{ + expand: true, + cwd: 'src/extensions', + src: '**/*.js', + dest: 'dist/extensions', + ext: '.min.js' // replace .js to .min.js + }] + } + }, + cssmin: { + add_banner: { + options: { + banner: '<%= banner %>' + }, + files: { + 'dist/<%= pkg.name %>.min.css': ['src/<%=pkg.name %>.css'] + } + } + }, + copy: { + source: { + cwd: 'src', // set working folder / root to copy + src: ['**/*.js', '**/*.css'], // copy all files and subfolders + dest: 'dist', // destination folder + expand: true // required when using cwd + }, + files: { + cwd: 'dist', // set working folder / root to copy + src: '**/*', // copy all files and subfolders + dest: 'docs/dist', // destination folder + expand: true // required when using cwd + } + }, + release: { + options: { + additionalFiles: ['bootstrap-table.jquery.json'], + beforeRelease: ['docs', 'default'] + } + } + }); + + var bumpVersion = function (path, version, startWith) { + var lines = fs.readFileSync(path, 'utf8').split('\n'); + lines.forEach(function (line, i) { + if (line.indexOf(startWith) === 0) { + lines[i] = startWith + version; + } + }); + fs.writeFileSync(path, lines.join('\n'), 'utf8'); + + grunt.log.ok('bumped version of ' + path + ' to ' + version); + }; + + grunt.registerTask('docs', 'build the docs', function () { + var version = require('./package.json').version; + bumpVersion('./_config.yml', version, 'current_version: '); + bumpVersion('./src/bootstrap-table.js', version, ' * version: '); + bumpVersion('./src/bootstrap-table.css', version, ' * version: '); + + var changeLog = fs.readFileSync('./CHANGELOG.md', 'utf8'); + var latestLogs = changeLog.split('### ')[1]; + var date = new Date(); + + var lines = [ + '### Latest release (' + + [date.getFullYear(), date.getMonth() + 1, date.getDate()].join('-') + ')', + '', + '#### v' + latestLogs + ]; + fs.writeFileSync('./docs/_includes/latest-release.md', lines.join('\n'), 'utf8'); + + grunt.log.ok('updated the latest-release.md to ' + version); + }); + + grunt.loadNpmTasks('grunt-contrib-clean'); + grunt.loadNpmTasks('grunt-contrib-concat'); + grunt.loadNpmTasks('grunt-contrib-uglify'); + grunt.loadNpmTasks('grunt-contrib-cssmin'); + grunt.loadNpmTasks('grunt-contrib-copy'); + grunt.loadNpmTasks('grunt-release'); + + grunt.registerTask('default', ['clean', 'concat', 'uglify', 'cssmin', 'copy']); +}; diff --git a/public/assets/libs/bootstrap-table/LICENSE b/public/assets/libs/bootstrap-table/LICENSE new file mode 100644 index 0000000..58a155e --- /dev/null +++ b/public/assets/libs/bootstrap-table/LICENSE @@ -0,0 +1,21 @@ +(The MIT License) + +Copyright (c) 2012-2017 Zhixin Wen + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/public/assets/libs/bootstrap-table/README.md b/public/assets/libs/bootstrap-table/README.md new file mode 100644 index 0000000..35250e5 --- /dev/null +++ b/public/assets/libs/bootstrap-table/README.md @@ -0,0 +1,8 @@ +# fastamin-bootstraptable +FastAdmin Bootstrap-table表格组件 + +## 使用方法 +https://f4nniu.gitee.io/bootstrap-table-home/zh-cn/home/ + +## 特别感谢 +https://github.com/wenzhixin/bootstrap-table \ No newline at end of file diff --git a/public/assets/libs/bootstrap-table/bower.json b/public/assets/libs/bootstrap-table/bower.json new file mode 100644 index 0000000..6d1e164 --- /dev/null +++ b/public/assets/libs/bootstrap-table/bower.json @@ -0,0 +1,27 @@ +{ + "name": "bootstrap-table", + "homepage": "https://github.com/wenzhixin/bootstrap-table", + "authors": [ + "zhixin " + ], + "description": "An extended Bootstrap table with radio, checkbox, sort, pagination, and other added features.", + "main": [ + "src/bootstrap-table.js", + "src/bootstrap-table.css" + ], + "keywords": [ + "bootstrap", + "table", + "bootstrap table" + ], + "license": "MIT", + "ignore": [ + "**/.*", + "node_modules", + "bower_components", + "test", + "tests", + "docs", + "assets" + ] +} diff --git a/public/assets/libs/bootstrap-table/composer.json b/public/assets/libs/bootstrap-table/composer.json new file mode 100644 index 0000000..d494d73 --- /dev/null +++ b/public/assets/libs/bootstrap-table/composer.json @@ -0,0 +1,17 @@ +{ + "name": "karsonzhang/fastadmin-bootstraptable", + "description": "An extended Bootstrap table with radio, checkbox, sort, pagination and other features.", + "keywords": ["bootstrap","table","tablesort","pagination"], + "type": "component", + "homepage": "https://github.com/karsonzhang/fastadmin-bootstraptable", + "license": "MIT", + "require": { + "twitter/bootstrap": ">=3.3.0" + }, + "authors": [ + { + "name": "wenzhixin2010", + "email": "wenzhixin2010@gmail.com" + } + ] +} diff --git a/public/assets/libs/bootstrap-table/dist/bootstrap-table-locale-all.js b/public/assets/libs/bootstrap-table/dist/bootstrap-table-locale-all.js new file mode 100644 index 0000000..bfa5780 --- /dev/null +++ b/public/assets/libs/bootstrap-table/dist/bootstrap-table-locale-all.js @@ -0,0 +1,1928 @@ +/** + * Bootstrap Table Afrikaans translation + * Author: Phillip Kruger + */ +(function ($) { + 'use strict'; + + $.fn.bootstrapTable.locales['af-ZA'] = { + formatLoadingMessage: function () { + return 'Besig om te laai, wag asseblief ...'; + }, + formatRecordsPerPage: function (pageNumber) { + return pageNumber + ' rekords per bladsy'; + }, + formatShowingRows: function (pageFrom, pageTo, totalRows) { + return 'Resultate ' + pageFrom + ' tot ' + pageTo + ' van ' + totalRows + ' rye'; + }, + formatSearch: function () { + return 'Soek'; + }, + formatNoMatches: function () { + return 'Geen rekords gevind nie'; + }, + formatPaginationSwitch: function () { + return 'Wys/verberg bladsy nummering'; + }, + formatRefresh: function () { + return 'Herlaai'; + }, + formatToggle: function () { + return 'Wissel'; + }, + formatColumns: function () { + return 'Kolomme'; + } + }; + + $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales['af-ZA']); + +})(jQuery); + +/** + * Bootstrap Table English translation + * Author: Zhixin Wen + */ +(function ($) { + 'use strict'; + + $.fn.bootstrapTable.locales['ar-SA'] = { + formatLoadingMessage: function () { + return 'جاري التحميل, يرجى الإنتظار...'; + }, + formatRecordsPerPage: function (pageNumber) { + return pageNumber + ' سجل لكل صفحة'; + }, + formatShowingRows: function (pageFrom, pageTo, totalRows) { + return 'الظاهر ' + pageFrom + ' إلى ' + pageTo + ' من ' + totalRows + ' سجل'; + }, + formatSearch: function () { + return 'بحث'; + }, + formatNoMatches: function () { + return 'لا توجد نتائج مطابقة للبحث'; + }, + formatPaginationSwitch: function () { + return 'إخفاء\إظهار ترقيم الصفحات'; + }, + formatRefresh: function () { + return 'تحديث'; + }, + formatToggle: function () { + return 'تغيير'; + }, + formatColumns: function () { + return 'أعمدة'; + } + }; + + $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales['ar-SA']); + +})(jQuery); + +/** + * Bootstrap Table Catalan translation + * Authors: Marc Pina + * Claudi Martinez + */ +(function ($) { + 'use strict'; + + $.fn.bootstrapTable.locales['ca-ES'] = { + formatLoadingMessage: function () { + return 'Espereu, si us plau...'; + }, + formatRecordsPerPage: function (pageNumber) { + return pageNumber + ' resultats per pàgina'; + }, + formatShowingRows: function (pageFrom, pageTo, totalRows) { + return 'Mostrant de ' + pageFrom + ' fins ' + pageTo + ' - total ' + totalRows + ' resultats'; + }, + formatSearch: function () { + return 'Cerca'; + }, + formatNoMatches: function () { + return 'No s\'han trobat resultats'; + }, + formatPaginationSwitch: function () { + return 'Amaga/Mostra paginació'; + }, + formatRefresh: function () { + return 'Refresca'; + }, + formatToggle: function () { + return 'Alterna formatació'; + }, + formatColumns: function () { + return 'Columnes'; + }, + formatAllRows: function () { + return 'Tots'; + } + }; + + $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales['ca-ES']); + +})(jQuery); + +/** + * Bootstrap Table Czech translation + * Author: Lukas Kral (monarcha@seznam.cz) + * Author: Jakub Svestka + */ +(function ($) { + 'use strict'; + + $.fn.bootstrapTable.locales['cs-CZ'] = { + formatLoadingMessage: function () { + return 'Čekejte, prosím...'; + }, + formatRecordsPerPage: function (pageNumber) { + return pageNumber + ' položek na stránku'; + }, + formatShowingRows: function (pageFrom, pageTo, totalRows) { + return 'Zobrazena ' + pageFrom + '. - ' + pageTo + '. položka z celkových ' + totalRows; + }, + formatSearch: function () { + return 'Vyhledávání'; + }, + formatNoMatches: function () { + return 'Nenalezena žádná vyhovující položka'; + }, + formatPaginationSwitch: function () { + return 'Skrýt/Zobrazit stránkování'; + }, + formatRefresh: function () { + return 'Aktualizovat'; + }, + formatToggle: function () { + return 'Přepni'; + }, + formatColumns: function () { + return 'Sloupce'; + }, + formatAllRows: function () { + return 'Vše'; + } + }; + + $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales['cs-CZ']); + +})(jQuery); + +/** + * Bootstrap Table danish translation + * Author: Your Name Jan Borup Coyle, github@coyle.dk + */ +(function ($) { + 'use strict'; + + $.fn.bootstrapTable.locales['da-DK'] = { + formatLoadingMessage: function () { + return 'Indlæser, vent venligst...'; + }, + formatRecordsPerPage: function (pageNumber) { + return pageNumber + ' poster pr side'; + }, + formatShowingRows: function (pageFrom, pageTo, totalRows) { + return 'Viser ' + pageFrom + ' til ' + pageTo + ' af ' + totalRows + ' rækker'; + }, + formatSearch: function () { + return 'Søg'; + }, + formatNoMatches: function () { + return 'Ingen poster fundet'; + }, + formatRefresh: function () { + return 'Opdater'; + }, + formatToggle: function () { + return 'Skift'; + }, + formatColumns: function () { + return 'Kolonner'; + } + }; + + $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales['da-DK']); + +})(jQuery); +/** +* Bootstrap Table German translation +* Author: Paul Mohr - Sopamo +*/ +(function ($) { + 'use strict'; + + $.fn.bootstrapTable.locales['de-DE'] = { + formatLoadingMessage: function () { + return 'Lade, bitte warten...'; + }, + formatRecordsPerPage: function (pageNumber) { + return pageNumber + ' Einträge pro Seite.'; + }, + formatShowingRows: function (pageFrom, pageTo, totalRows) { + return 'Zeige Zeile ' + pageFrom + ' bis ' + pageTo + ' von ' + totalRows + ' Zeile' + ((totalRows > 1) ? "n" : "")+"."; + }, + formatDetailPagination: function (totalRows) { + return 'Zeige ' + totalRows + ' Zeile' + ((totalRows > 1) ? "n" : "")+"."; + }, + formatSearch: function () { + return 'Suchen ...'; + }, + formatNoMatches: function () { + return 'Keine passenden Ergebnisse gefunden.'; + }, + formatRefresh: function () { + return 'Neu laden'; + }, + formatToggle: function () { + return 'Umschalten'; + }, + formatColumns: function () { + return 'Spalten'; + }, + formatAllRows: function () { + return 'Alle'; + } + }; + + $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales['de-DE']); + +})(jQuery); + +/** + * Bootstrap Table Greek translation + * Author: giannisdallas + */ +(function ($) { + 'use strict'; + + $.fn.bootstrapTable.locales['el-GR'] = { + formatLoadingMessage: function () { + return 'Φορτώνει, παρακαλώ περιμένετε...'; + }, + formatRecordsPerPage: function (pageNumber) { + return pageNumber + ' αποτελέσματα ανά σελίδα'; + }, + formatShowingRows: function (pageFrom, pageTo, totalRows) { + return 'Εμφανίζονται από την ' + pageFrom + ' ως την ' + pageTo + ' από σύνολο ' + totalRows + ' σειρών'; + }, + formatSearch: function () { + return 'Αναζητήστε'; + }, + formatNoMatches: function () { + return 'Δεν βρέθηκαν αποτελέσματα'; + } + }; + + $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales['el-GR']); + +})(jQuery); + +/** + * Bootstrap Table English translation + * Author: Zhixin Wen + */ +(function ($) { + 'use strict'; + + $.fn.bootstrapTable.locales['en-US'] = { + formatLoadingMessage: function () { + return 'Loading, please wait...'; + }, + formatRecordsPerPage: function (pageNumber) { + return pageNumber + ' rows per page'; + }, + formatShowingRows: function (pageFrom, pageTo, totalRows) { + return 'Showing ' + pageFrom + ' to ' + pageTo + ' of ' + totalRows + ' rows'; + }, + formatSearch: function () { + return 'Search'; + }, + formatNoMatches: function () { + return 'No matching records found'; + }, + formatPaginationSwitch: function () { + return 'Hide/Show pagination'; + }, + formatRefresh: function () { + return 'Refresh'; + }, + formatToggle: function () { + return 'Toggle'; + }, + formatColumns: function () { + return 'Columns'; + }, + formatAllRows: function () { + return 'All'; + }, + formatExport: function () { + return 'Export data'; + }, + formatClearFilters: function () { + return 'Clear filters'; + } + }; + + $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales['en-US']); + +})(jQuery); + +/** + * Bootstrap Table Spanish (Argentina) translation + * Author: Felix Vera (felix.vera@gmail.com) + */ +(function ($) { + 'use strict'; + + $.fn.bootstrapTable.locales['es-AR'] = { + formatLoadingMessage: function () { + return 'Cargando, espere por favor...'; + }, + formatRecordsPerPage: function (pageNumber) { + return pageNumber + ' registros por página'; + }, + formatShowingRows: function (pageFrom, pageTo, totalRows) { + return 'Mostrando ' + pageFrom + ' a ' + pageTo + ' de ' + totalRows + ' filas'; + }, + formatSearch: function () { + return 'Buscar'; + }, + formatNoMatches: function () { + return 'No se encontraron registros'; + }, + formatAllRows: function () { + return 'Todo'; + } + }; + + $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales['es-AR']); + +})(jQuery); +/** + * Traducción de librería Bootstrap Table a Español (Chile) + * @author Brian Álvarez Azócar + * email brianalvarezazocar@gmail.com + */ +(function($) { + 'use strict'; + + $.fn.bootstrapTable.locales['es-CL'] = { + formatLoadingMessage: function() { + return 'Cargando, espere por favor...'; + }, + formatRecordsPerPage: function(pageNumber) { + return pageNumber + ' filas por p\u00E1gina'; + }, + formatShowingRows: function(pageFrom, pageTo, totalRows) { + return 'Mostrando ' + pageFrom + ' a ' + pageTo + ' de ' + totalRows + ' filas'; + }, + formatSearch: function() { + return 'Buscar'; + }, + formatNoMatches: function() { + return 'No se encontraron registros'; + }, + formatPaginationSwitch: function() { + return 'Ocultar/Mostrar paginaci\u00F3n'; + }, + formatRefresh: function() { + return 'Refrescar'; + }, + formatToggle: function() { + return 'Cambiar'; + }, + formatColumns: function() { + return 'Columnas'; + }, + formatAllRows: function() { + return 'Todo'; + } + }; + + $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales['es-CL']); + +})(jQuery); + +/** + * Bootstrap Table Spanish (Costa Rica) translation + * Author: Dennis Hernández (http://djhvscf.github.io/Blog/) + */ +(function ($) { + 'use strict'; + + $.fn.bootstrapTable.locales['es-CR'] = { + formatLoadingMessage: function () { + return 'Cargando, por favor espere...'; + }, + formatRecordsPerPage: function (pageNumber) { + return pageNumber + ' registros por página'; + }, + formatShowingRows: function (pageFrom, pageTo, totalRows) { + return 'Mostrando de ' + pageFrom + ' a ' + pageTo + ' registros de ' + totalRows + ' registros en total'; + }, + formatSearch: function () { + return 'Buscar'; + }, + formatNoMatches: function () { + return 'No se encontraron registros'; + }, + formatRefresh: function () { + return 'Refrescar'; + }, + formatToggle: function () { + return 'Alternar'; + }, + formatColumns: function () { + return 'Columnas'; + }, + formatAllRows: function () { + return 'Todo'; + } + }; + + $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales['es-CR']); + +})(jQuery); + +/** + * Bootstrap Table Spanish Spain translation + * Author: Marc Pina + */ +(function ($) { + 'use strict'; + + $.fn.bootstrapTable.locales['es-ES'] = { + formatLoadingMessage: function () { + return 'Por favor espere...'; + }, + formatRecordsPerPage: function (pageNumber) { + return pageNumber + ' resultados por página'; + }, + formatShowingRows: function (pageFrom, pageTo, totalRows) { + return 'Mostrando desde ' + pageFrom + ' hasta ' + pageTo + ' - En total ' + totalRows + ' resultados'; + }, + formatSearch: function () { + return 'Buscar'; + }, + formatNoMatches: function () { + return 'No se encontraron resultados'; + }, + formatPaginationSwitch: function () { + return 'Ocultar/Mostrar paginación'; + }, + formatRefresh: function () { + return 'Refrescar'; + }, + formatToggle: function () { + return 'Ocultar/Mostrar'; + }, + formatColumns: function () { + return 'Columnas'; + }, + formatAllRows: function () { + return 'Todos'; + } + }; + + $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales['es-ES']); + +})(jQuery); + +/** + * Bootstrap Table Spanish (México) translation (Obtenido de traducción de Argentina) + * Author: Felix Vera (felix.vera@gmail.com) + * Copiado: Mauricio Vera (mauricioa.vera@gmail.com) + */ +(function ($) { + 'use strict'; + + $.fn.bootstrapTable.locales['es-MX'] = { + formatLoadingMessage: function () { + return 'Cargando, espere por favor...'; + }, + formatRecordsPerPage: function (pageNumber) { + return pageNumber + ' registros por página'; + }, + formatShowingRows: function (pageFrom, pageTo, totalRows) { + return 'Mostrando ' + pageFrom + ' a ' + pageTo + ' de ' + totalRows + ' filas'; + }, + formatSearch: function () { + return 'Buscar'; + }, + formatNoMatches: function () { + return 'No se encontraron registros'; + }, + formatAllRows: function () { + return 'Todo'; + } + }; + + $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales['es-MX']); + +})(jQuery); + +/** + * Bootstrap Table Spanish (Nicaragua) translation + * Author: Dennis Hernández (http://djhvscf.github.io/Blog/) + */ +(function ($) { + 'use strict'; + + $.fn.bootstrapTable.locales['es-NI'] = { + formatLoadingMessage: function () { + return 'Cargando, por favor espere...'; + }, + formatRecordsPerPage: function (pageNumber) { + return pageNumber + ' registros por página'; + }, + formatShowingRows: function (pageFrom, pageTo, totalRows) { + return 'Mostrando de ' + pageFrom + ' a ' + pageTo + ' registros de ' + totalRows + ' registros en total'; + }, + formatSearch: function () { + return 'Buscar'; + }, + formatNoMatches: function () { + return 'No se encontraron registros'; + }, + formatRefresh: function () { + return 'Refrescar'; + }, + formatToggle: function () { + return 'Alternar'; + }, + formatColumns: function () { + return 'Columnas'; + }, + formatAllRows: function () { + return 'Todo'; + } + }; + + $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales['es-NI']); + +})(jQuery); + +/** + * Bootstrap Table Spanish (España) translation + * Author: Antonio Pérez + */ + (function ($) { + 'use strict'; + + $.fn.bootstrapTable.locales['es-SP'] = { + formatLoadingMessage: function () { + return 'Cargando, por favor espera...'; + }, + formatRecordsPerPage: function (pageNumber) { + return pageNumber + ' registros por página.'; + }, + formatShowingRows: function (pageFrom, pageTo, totalRows) { + return pageFrom + ' - ' + pageTo + ' de ' + totalRows + ' registros.'; + }, + formatSearch: function () { + return 'Buscar'; + }, + formatNoMatches: function () { + return 'No se han encontrado registros.'; + }, + formatRefresh: function () { + return 'Actualizar'; + }, + formatToggle: function () { + return 'Alternar'; + }, + formatColumns: function () { + return 'Columnas'; + }, + formatAllRows: function () { + return 'Todo'; + } + }; + + $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales['es-SP']); + +})(jQuery); +/** + * Bootstrap Table Estonian translation + * Author: kristjan@logist.it> + */ +(function ($) { + 'use strict'; + + $.fn.bootstrapTable.locales['et-EE'] = { + formatLoadingMessage: function () { + return 'Päring käib, palun oota...'; + }, + formatRecordsPerPage: function (pageNumber) { + return pageNumber + ' rida lehe kohta'; + }, + formatShowingRows: function (pageFrom, pageTo, totalRows) { + return 'Näitan tulemusi ' + pageFrom + ' kuni ' + pageTo + ' - kokku ' + totalRows + ' tulemust'; + }, + formatSearch: function () { + return 'Otsi'; + }, + formatNoMatches: function () { + return 'Päringu tingimustele ei vastanud ühtegi tulemust'; + }, + formatPaginationSwitch: function () { + return 'Näita/Peida lehtedeks jagamine'; + }, + formatRefresh: function () { + return 'Värskenda'; + }, + formatToggle: function () { + return 'Lülita'; + }, + formatColumns: function () { + return 'Veerud'; + }, + formatAllRows: function () { + return 'Kõik'; + } + }; + + $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales['et-EE']); + +})(jQuery); +/** + * Bootstrap Table Persian translation + * Author: MJ Vakili + */ +(function ($) { + 'use strict'; + + $.fn.bootstrapTable.locales['fa-IR'] = { + formatLoadingMessage: function () { + return 'در حال بارگذاری, لطفا صبر کنید...'; + }, + formatRecordsPerPage: function (pageNumber) { + return pageNumber + ' رکورد در صفحه'; + }, + formatShowingRows: function (pageFrom, pageTo, totalRows) { + return 'نمایش ' + pageFrom + ' تا ' + pageTo + ' از ' + totalRows + ' ردیف'; + }, + formatSearch: function () { + return 'جستجو'; + }, + formatNoMatches: function () { + return 'رکوردی یافت نشد.'; + }, + formatPaginationSwitch: function () { + return 'نمایش/مخفی صفحه بندی'; + }, + formatRefresh: function () { + return 'به روز رسانی'; + }, + formatToggle: function () { + return 'تغییر نمایش'; + }, + formatColumns: function () { + return 'سطر ها'; + }, + formatAllRows: function () { + return 'همه'; + } + }; + + $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales['fa-IR']); + +})(jQuery); +/** + * Bootstrap Table French (Belgium) translation + * Author: Julien Bisconti (julien.bisconti@gmail.com) + */ +(function ($) { + 'use strict'; + + $.fn.bootstrapTable.locales['fr-BE'] = { + formatLoadingMessage: function () { + return 'Chargement en cours...'; + }, + formatRecordsPerPage: function (pageNumber) { + return pageNumber + ' entrées par page'; + }, + formatShowingRows: function (pageFrom, pageTo, totalRows) { + return 'Affiche de' + pageFrom + ' à ' + pageTo + ' sur ' + totalRows + ' lignes'; + }, + formatSearch: function () { + return 'Recherche'; + }, + formatNoMatches: function () { + return 'Pas de fichiers trouvés'; + } + }; + + $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales['fr-BE']); + +})(jQuery); + +/** + * Bootstrap Table French (France) translation + * Author: Dennis Hernández (http://djhvscf.github.io/Blog/) + * Modification: Tidalf (https://github.com/TidalfFR) + */ +(function ($) { + 'use strict'; + + $.fn.bootstrapTable.locales['fr-FR'] = { + formatLoadingMessage: function () { + return 'Chargement en cours, patientez, s´il vous plaît ...'; + }, + formatRecordsPerPage: function (pageNumber) { + return pageNumber + ' lignes par page'; + }, + formatShowingRows: function (pageFrom, pageTo, totalRows) { + return 'Affichage des lignes ' + pageFrom + ' à ' + pageTo + ' sur ' + totalRows + ' lignes au total'; + }, + formatSearch: function () { + return 'Rechercher'; + }, + formatNoMatches: function () { + return 'Aucun résultat trouvé'; + }, + formatRefresh: function () { + return 'Rafraîchir'; + }, + formatToggle: function () { + return 'Alterner'; + }, + formatColumns: function () { + return 'Colonnes'; + }, + formatAllRows: function () { + return 'Tous'; + } + }; + + $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales['fr-FR']); + +})(jQuery); + +/** + * Bootstrap Table Hebrew translation + * Author: legshooter + */ +(function ($) { + 'use strict'; + + $.fn.bootstrapTable.locales['he-IL'] = { + formatLoadingMessage: function () { + return 'טוען, נא להמתין...'; + }, + formatRecordsPerPage: function (pageNumber) { + return pageNumber + ' שורות בעמוד'; + }, + formatShowingRows: function (pageFrom, pageTo, totalRows) { + return 'מציג ' + pageFrom + ' עד ' + pageTo + ' מ-' + totalRows + ' שורות'; + }, + formatSearch: function () { + return 'חיפוש'; + }, + formatNoMatches: function () { + return 'לא נמצאו רשומות תואמות'; + }, + formatPaginationSwitch: function () { + return 'הסתר/הצג מספור דפים'; + }, + formatRefresh: function () { + return 'רענן'; + }, + formatToggle: function () { + return 'החלף תצוגה'; + }, + formatColumns: function () { + return 'עמודות'; + }, + formatAllRows: function () { + return 'הכל'; + } + }; + + $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales['he-IL']); + +})(jQuery); + +/** + * Bootstrap Table Croatian translation + * Author: Petra Štrbenac (petra.strbenac@gmail.com) + * Author: Petra Štrbenac (petra.strbenac@gmail.com) + */ +(function ($) { + 'use strict'; + + $.fn.bootstrapTable.locales['hr-HR'] = { + formatLoadingMessage: function () { + return 'Molimo pričekajte ...'; + }, + formatRecordsPerPage: function (pageNumber) { + return pageNumber + ' broj zapisa po stranici'; + }, + formatShowingRows: function (pageFrom, pageTo, totalRows) { + return 'Prikazujem ' + pageFrom + '. - ' + pageTo + '. od ukupnog broja zapisa ' + totalRows; + }, + formatSearch: function () { + return 'Pretraži'; + }, + formatNoMatches: function () { + return 'Nije pronađen niti jedan zapis'; + }, + formatPaginationSwitch: function () { + return 'Prikaži/sakrij stranice'; + }, + formatRefresh: function () { + return 'Osvježi'; + }, + formatToggle: function () { + return 'Promijeni prikaz'; + }, + formatColumns: function () { + return 'Kolone'; + }, + formatAllRows: function () { + return 'Sve'; + } + }; + + $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales['hr-HR']); + +})(jQuery); + +/** + * Bootstrap Table Hungarian translation + * Author: Nagy Gergely + */ +(function ($) { + 'use strict'; + + $.fn.bootstrapTable.locales['hu-HU'] = { + formatLoadingMessage: function () { + return 'Betöltés, kérem várjon...'; + }, + formatRecordsPerPage: function (pageNumber) { + return pageNumber + ' rekord per oldal'; + }, + formatShowingRows: function (pageFrom, pageTo, totalRows) { + return 'Megjelenítve ' + pageFrom + ' - ' + pageTo + ' / ' + totalRows + ' összesen'; + }, + formatSearch: function () { + return 'Keresés'; + }, + formatNoMatches: function () { + return 'Nincs találat'; + }, + formatPaginationSwitch: function () { + return 'Lapozó elrejtése/megjelenítése'; + }, + formatRefresh: function () { + return 'Frissítés'; + }, + formatToggle: function () { + return 'Összecsuk/Kinyit'; + }, + formatColumns: function () { + return 'Oszlopok'; + }, + formatAllRows: function () { + return 'Összes'; + } + }; + + $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales['hu-HU']); + +})(jQuery); + +/** + * Bootstrap Table Indonesian translation + * Author: Andre Gardiner + */ +(function ($) { + 'use strict'; + + $.fn.bootstrapTable.locales['id-ID'] = { + formatLoadingMessage: function () { + return 'Memuat, mohon tunggu...'; + }, + formatRecordsPerPage: function (pageNumber) { + return pageNumber + ' baris per halaman'; + }, + formatShowingRows: function (pageFrom, pageTo, totalRows) { + return 'Menampilkan ' + pageFrom + ' sampai ' + pageTo + ' dari ' + totalRows + ' baris'; + }, + formatSearch: function () { + return 'Pencarian'; + }, + formatNoMatches: function () { + return 'Tidak ditemukan data yang cocok'; + }, + formatPaginationSwitch: function () { + return 'Sembunyikan/Tampilkan halaman'; + }, + formatRefresh: function () { + return 'Muat ulang'; + }, + formatToggle: function () { + return 'Beralih'; + }, + formatColumns: function () { + return 'kolom'; + }, + formatAllRows: function () { + return 'Semua'; + }, + formatExport: function () { + return 'Ekspor data'; + }, + formatClearFilters: function () { + return 'Bersihkan filter'; + } + }; + + $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales['id-ID']); + +})(jQuery); + +/** + * Bootstrap Table Italian translation + * Author: Davide Renzi + * Author: Davide Borsatto + * Author: Alessio Felicioni + */ +(function ($) { + 'use strict'; + + $.fn.bootstrapTable.locales['it-IT'] = { + formatLoadingMessage: function () { + return 'Caricamento in corso...'; + }, + formatRecordsPerPage: function (pageNumber) { + return pageNumber + ' elementi per pagina'; + }, + formatShowingRows: function (pageFrom, pageTo, totalRows) { + return 'Elementi mostrati da ' + pageFrom + ' a ' + pageTo + ' (Numero totali di elementi ' + totalRows + ')'; + }, + formatSearch: function () { + return 'Cerca'; + }, + formatNoMatches: function () { + return 'Nessun elemento trovato'; + }, + formatPaginationSwitch: function () { + return 'Nascondi/Mostra paginazione'; + }, + formatRefresh: function () { + return 'Aggiorna'; + }, + formatToggle: function () { + return 'Attiva/Disattiva'; + }, + formatColumns: function () { + return 'Colonne'; + }, + formatAllRows: function () { + return 'Tutto'; + }, + formatExport: function () { + return 'Esporta dati'; + }, + formatClearFilters: function () { + return 'Pulisci filtri'; + } + + }; + + $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales['it-IT']); + +})(jQuery); + +/** + * Bootstrap Table Japanese translation + * Author: Azamshul Azizy + */ +(function ($) { + 'use strict'; + + $.fn.bootstrapTable.locales['ja-JP'] = { + formatLoadingMessage: function () { + return '読み込み中です。少々お待ちください。'; + }, + formatRecordsPerPage: function (pageNumber) { + return 'ページ当たり最大' + pageNumber + '件'; + }, + formatShowingRows: function (pageFrom, pageTo, totalRows) { + return '全' + totalRows + '件から、'+ pageFrom + 'から' + pageTo + '件目まで表示しています'; + }, + formatSearch: function () { + return '検索'; + }, + formatNoMatches: function () { + return '該当するレコードが見つかりません'; + }, + formatPaginationSwitch: function () { + return 'ページ数を表示・非表示'; + }, + formatRefresh: function () { + return '更新'; + }, + formatToggle: function () { + return 'トグル'; + }, + formatColumns: function () { + return '列'; + }, + formatAllRows: function () { + return 'すべて'; + } + }; + + $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales['ja-JP']); + +})(jQuery); +/** + * Bootstrap Table Georgian translation + * Author: Levan Lotuashvili + */ +(function ($) { + 'use strict'; + + $.fn.bootstrapTable.locales['ka-GE'] = { + formatLoadingMessage: function() { + return 'იტვირთება, გთხოვთ მოიცადოთ...'; + }, + formatRecordsPerPage: function(pageNumber) { + return pageNumber + ' ჩანაწერი თითო გვერდზე'; + }, + formatShowingRows: function(pageFrom, pageTo, totalRows) { + return 'ნაჩვენებია ' + pageFrom + '-დან ' + pageTo + '-მდე ჩანაწერი ჯამური ' + totalRows + '-დან'; + }, + formatSearch: function() { + return 'ძებნა'; + }, + formatNoMatches: function() { + return 'მონაცემები არ არის'; + }, + formatPaginationSwitch: function() { + return 'გვერდების გადამრთველის დამალვა/გამოჩენა'; + }, + formatRefresh: function() { + return 'განახლება'; + }, + formatToggle: function() { + return 'ჩართვა/გამორთვა'; + }, + formatColumns: function() { + return 'სვეტები'; + } + }; + + $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales['ka-GE']); + +})(jQuery); + +/** + * Bootstrap Table Korean translation + * Author: Yi Tae-Hyeong (jsonobject@gmail.com) + */ +(function ($) { + 'use strict'; + + $.fn.bootstrapTable.locales['ko-KR'] = { + formatLoadingMessage: function () { + return '데이터를 불러오는 중입니다...'; + }, + formatRecordsPerPage: function (pageNumber) { + return '페이지 당 ' + pageNumber + '개 데이터 출력'; + }, + formatShowingRows: function (pageFrom, pageTo, totalRows) { + return '전체 ' + totalRows + '개 중 ' + pageFrom + '~' + pageTo + '번째 데이터 출력,'; + }, + formatSearch: function () { + return '검색'; + }, + formatNoMatches: function () { + return '조회된 데이터가 없습니다.'; + }, + formatRefresh: function () { + return '새로 고침'; + }, + formatToggle: function () { + return '전환'; + }, + formatColumns: function () { + return '컬럼 필터링'; + } + }; + + $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales['ko-KR']); + +})(jQuery); +/** + * Bootstrap Table Malay translation + * Author: Azamshul Azizy + */ +(function ($) { + 'use strict'; + + $.fn.bootstrapTable.locales['ms-MY'] = { + formatLoadingMessage: function () { + return 'Permintaan sedang dimuatkan. Sila tunggu sebentar...'; + }, + formatRecordsPerPage: function (pageNumber) { + return pageNumber + ' rekod setiap muka surat'; + }, + formatShowingRows: function (pageFrom, pageTo, totalRows) { + return 'Sedang memaparkan rekod ' + pageFrom + ' hingga ' + pageTo + ' daripada jumlah ' + totalRows + ' rekod'; + }, + formatSearch: function () { + return 'Cari'; + }, + formatNoMatches: function () { + return 'Tiada rekod yang menyamai permintaan'; + }, + formatPaginationSwitch: function () { + return 'Tunjuk/sembunyi muka surat'; + }, + formatRefresh: function () { + return 'Muatsemula'; + }, + formatToggle: function () { + return 'Tukar'; + }, + formatColumns: function () { + return 'Lajur'; + }, + formatAllRows: function () { + return 'Semua'; + } + }; + + $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales['ms-MY']); + +})(jQuery); + +/** + * Bootstrap Table norwegian translation + * Author: Jim Nordbø, jim@nordb.no + */ +(function ($) { + 'use strict'; + + $.fn.bootstrapTable.locales['nb-NO'] = { + formatLoadingMessage: function () { + return 'Oppdaterer, vennligst vent...'; + }, + formatRecordsPerPage: function (pageNumber) { + return pageNumber + ' poster pr side'; + }, + formatShowingRows: function (pageFrom, pageTo, totalRows) { + return 'Viser ' + pageFrom + ' til ' + pageTo + ' av ' + totalRows + ' rekker'; + }, + formatSearch: function () { + return 'Søk'; + }, + formatNoMatches: function () { + return 'Ingen poster funnet'; + }, + formatRefresh: function () { + return 'Oppdater'; + }, + formatToggle: function () { + return 'Endre'; + }, + formatColumns: function () { + return 'Kolonner'; + } + }; + + $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales['nb-NO']); + +})(jQuery); +/** + * Bootstrap Table Dutch translation + * Author: Your Name + */ +(function($) { + 'use strict'; + + $.fn.bootstrapTable.locales['nl-NL'] = { + formatLoadingMessage: function() { + return 'Laden, even geduld...'; + }, + formatRecordsPerPage: function(pageNumber) { + return pageNumber + ' records per pagina'; + }, + formatShowingRows: function(pageFrom, pageTo, totalRows) { + return 'Toon ' + pageFrom + ' tot ' + pageTo + ' van ' + totalRows + ' record' + ((totalRows > 1) ? 's' : ''); + }, + formatDetailPagination: function(totalRows) { + return 'Toon ' + totalRows + ' record' + ((totalRows > 1) ? 's' : ''); + }, + formatSearch: function() { + return 'Zoeken'; + }, + formatNoMatches: function() { + return 'Geen resultaten gevonden'; + }, + formatRefresh: function() { + return 'Vernieuwen'; + }, + formatToggle: function() { + return 'Omschakelen'; + }, + formatColumns: function() { + return 'Kolommen'; + }, + formatAllRows: function() { + return 'Alle'; + }, + formatPaginationSwitch: function() { + return 'Verberg/Toon paginatie'; + }, + formatExport: function() { + return 'Exporteer data'; + }, + formatClearFilters: function() { + return 'Verwijder filters'; + } + }; + + $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales['nl-NL']); + +})(jQuery); + +/** + * Bootstrap Table Polish translation + * Author: zergu + */ +(function ($) { + 'use strict'; + + $.fn.bootstrapTable.locales['pl-PL'] = { + formatLoadingMessage: function () { + return 'Ładowanie, proszę czekać...'; + }, + formatRecordsPerPage: function (pageNumber) { + return pageNumber + ' rekordów na stronę'; + }, + formatShowingRows: function (pageFrom, pageTo, totalRows) { + return 'Wyświetlanie rekordów od ' + pageFrom + ' do ' + pageTo + ' z ' + totalRows; + }, + formatSearch: function () { + return 'Szukaj'; + }, + formatNoMatches: function () { + return 'Niestety, nic nie znaleziono'; + }, + formatRefresh: function () { + return 'Odśwież'; + }, + formatToggle: function () { + return 'Przełącz'; + }, + formatColumns: function () { + return 'Kolumny'; + } + }; + + $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales['pl-PL']); + +})(jQuery); + +/** + * Bootstrap Table Brazilian Portuguese Translation + * Author: Eduardo Cerqueira + * Update: João Mello + */ +(function ($) { + 'use strict'; + + $.fn.bootstrapTable.locales['pt-BR'] = { + formatLoadingMessage: function () { + return 'Carregando, aguarde...'; + }, + formatRecordsPerPage: function (pageNumber) { + return pageNumber + ' registros por página'; + }, + formatShowingRows: function (pageFrom, pageTo, totalRows) { + return 'Exibindo ' + pageFrom + ' até ' + pageTo + ' de ' + totalRows + ' linhas'; + }, + formatSearch: function () { + return 'Pesquisar'; + }, + formatRefresh: function () { + return 'Recarregar'; + }, + formatToggle: function () { + return 'Alternar'; + }, + formatColumns: function () { + return 'Colunas'; + }, + formatPaginationSwitch: function () { + return 'Ocultar/Exibir paginação'; + }, + formatNoMatches: function () { + return 'Nenhum registro encontrado'; + } + }; + + $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales['pt-BR']); + +})(jQuery); + +/** + * Bootstrap Table Portuguese Portugal Translation + * Author: Burnspirit + */ +(function ($) { + 'use strict'; + + $.fn.bootstrapTable.locales['pt-PT'] = { + formatLoadingMessage: function () { + return 'A carregar, por favor aguarde...'; + }, + formatRecordsPerPage: function (pageNumber) { + return pageNumber + ' registos por página'; + }, + formatShowingRows: function (pageFrom, pageTo, totalRows) { + return 'A mostrar ' + pageFrom + ' até ' + pageTo + ' de ' + totalRows + ' linhas'; + }, + formatSearch: function () { + return 'Pesquisa'; + }, + formatNoMatches: function () { + return 'Nenhum registo encontrado'; + }, + formatPaginationSwitch: function () { + return 'Esconder/Mostrar paginação'; + }, + formatRefresh: function () { + return 'Atualizar'; + }, + formatToggle: function () { + return 'Alternar'; + }, + formatColumns: function () { + return 'Colunas'; + }, + formatAllRows: function () { + return 'Tudo'; + } + }; + + $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales['pt-PT']); + +})(jQuery); + +/** + * Bootstrap Table Romanian translation + * Author: cristake + */ +(function ($) { + 'use strict'; + + $.fn.bootstrapTable.locales['ro-RO'] = { + formatLoadingMessage: function () { + return 'Se incarca, va rugam asteptati...'; + }, + formatRecordsPerPage: function (pageNumber) { + return pageNumber + ' inregistrari pe pagina'; + }, + formatShowingRows: function (pageFrom, pageTo, totalRows) { + return 'Arata de la ' + pageFrom + ' pana la ' + pageTo + ' din ' + totalRows + ' randuri'; + }, + formatSearch: function () { + return 'Cauta'; + }, + formatNoMatches: function () { + return 'Nu au fost gasite inregistrari'; + }, + formatPaginationSwitch: function () { + return 'Ascunde/Arata paginatia'; + }, + formatRefresh: function () { + return 'Reincarca'; + }, + formatToggle: function () { + return 'Comuta'; + }, + formatColumns: function () { + return 'Coloane'; + }, + formatAllRows: function () { + return 'Toate'; + } + }; + + $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales['ro-RO']); + +})(jQuery); +/** + * Bootstrap Table Russian translation + * Author: Dunaevsky Maxim + */ +(function ($) { + 'use strict'; + $.fn.bootstrapTable.locales['ru-RU'] = { + formatLoadingMessage: function () { + return 'Пожалуйста, подождите, идёт загрузка...'; + }, + formatRecordsPerPage: function (pageNumber) { + return pageNumber + ' записей на страницу'; + }, + formatShowingRows: function (pageFrom, pageTo, totalRows) { + return 'Записи с ' + pageFrom + ' по ' + pageTo + ' из ' + totalRows; + }, + formatSearch: function () { + return 'Поиск'; + }, + formatNoMatches: function () { + return 'Ничего не найдено'; + }, + formatRefresh: function () { + return 'Обновить'; + }, + formatToggle: function () { + return 'Переключить'; + }, + formatColumns: function () { + return 'Колонки'; + }, + formatClearFilters: function () { + return 'Очистить фильтры'; + }, + formatMultipleSort: function () { + return 'Множественная сортировка'; + }, + formatAddLevel: function () { + return 'Добавить уровень'; + }, + formatDeleteLevel: function () { + return 'Удалить уровень'; + }, + formatColumn: function () { + return 'Колонка'; + }, + formatOrder: function () { + return 'Порядок'; + }, + formatSortBy: function () { + return 'Сортировать по'; + }, + formatThenBy: function () { + return 'затем по'; + }, + formatSort: function () { + return 'Сортировать'; + }, + formatCancel: function () { + return 'Отмена'; + }, + formatDuplicateAlertTitle: function () { + return 'Дублирование колонок!'; + }, + formatDuplicateAlertDescription: function () { + return 'Удалите, пожалуйста, дублирующую колонку, или замените ее на другую.'; + } + }; + + $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales['ru-RU']); + +})(jQuery); + +/** + * Bootstrap Table Slovak translation + * Author: Jozef Dúc + */ +(function ($) { + 'use strict'; + + $.fn.bootstrapTable.locales['sk-SK'] = { + formatLoadingMessage: function () { + return 'Prosím čakajte ...'; + }, + formatRecordsPerPage: function (pageNumber) { + return pageNumber + ' záznamov na stranu'; + }, + formatShowingRows: function (pageFrom, pageTo, totalRows) { + return 'Zobrazená ' + pageFrom + '. - ' + pageTo + '. položka z celkových ' + totalRows; + }, + formatSearch: function () { + return 'Vyhľadávanie'; + }, + formatNoMatches: function () { + return 'Nenájdená žiadna vyhovujúca položka'; + }, + formatRefresh: function () { + return 'Obnoviť'; + }, + formatToggle: function () { + return 'Prepni'; + }, + formatColumns: function () { + return 'Stĺpce'; + } + }; + + $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales['sk-SK']); + +})(jQuery); + +/** + * Bootstrap Table Swedish translation + * Author: C Bratt + */ +(function ($) { + 'use strict'; + + $.fn.bootstrapTable.locales['sv-SE'] = { + formatLoadingMessage: function () { + return 'Laddar, vänligen vänta...'; + }, + formatRecordsPerPage: function (pageNumber) { + return pageNumber + ' rader per sida'; + }, + formatShowingRows: function (pageFrom, pageTo, totalRows) { + return 'Visa ' + pageFrom + ' till ' + pageTo + ' av ' + totalRows + ' rader'; + }, + formatSearch: function () { + return 'Sök'; + }, + formatNoMatches: function () { + return 'Inga matchande resultat funna.'; + }, + formatRefresh: function () { + return 'Uppdatera'; + }, + formatToggle: function () { + return 'Skifta'; + }, + formatColumns: function () { + return 'kolumn'; + } + }; + + $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales['sv-SE']); + +})(jQuery); + +/** + * Bootstrap Table Thai translation + * Author: Monchai S. + */ +(function ($) { + 'use strict'; + + $.fn.bootstrapTable.locales['th-TH'] = { + formatLoadingMessage: function () { + return 'กำลังโหลดข้อมูล, กรุณารอสักครู่...'; + }, + formatRecordsPerPage: function (pageNumber) { + return pageNumber + ' รายการต่อหน้า'; + }, + formatShowingRows: function (pageFrom, pageTo, totalRows) { + return 'รายการที่ ' + pageFrom + ' ถึง ' + pageTo + ' จากทั้งหมด ' + totalRows + ' รายการ'; + }, + formatSearch: function () { + return 'ค้นหา'; + }, + formatNoMatches: function () { + return 'ไม่พบรายการที่ค้นหา !'; + }, + formatRefresh: function () { + return 'รีเฟรส'; + }, + formatToggle: function () { + return 'สลับมุมมอง'; + }, + formatColumns: function () { + return 'คอลัมน์'; + } + }; + + $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales['th-TH']); + +})(jQuery); + +/** + * Bootstrap Table Turkish translation + * Author: Emin Şen + * Author: Sercan Cakir + */ +(function ($) { + 'use strict'; + + $.fn.bootstrapTable.locales['tr-TR'] = { + formatLoadingMessage: function () { + return 'Yükleniyor, lütfen bekleyin...'; + }, + formatRecordsPerPage: function (pageNumber) { + return 'Sayfa başına ' + pageNumber + ' kayıt.'; + }, + formatShowingRows: function (pageFrom, pageTo, totalRows) { + return totalRows + ' kayıttan ' + pageFrom + '-' + pageTo + ' arası gösteriliyor.'; + }, + formatSearch: function () { + return 'Ara'; + }, + formatNoMatches: function () { + return 'Eşleşen kayıt bulunamadı.'; + }, + formatRefresh: function () { + return 'Yenile'; + }, + formatToggle: function () { + return 'Değiştir'; + }, + formatColumns: function () { + return 'Sütunlar'; + }, + formatAllRows: function () { + return 'Tüm Satırlar'; + } + }; + + $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales['tr-TR']); + +})(jQuery); + +/** + * Bootstrap Table Ukrainian translation + * Author: Vitaliy Timchenko + */ + (function ($) { + 'use strict'; + + $.fn.bootstrapTable.locales['uk-UA'] = { + formatLoadingMessage: function () { + return 'Завантаження, будь ласка, зачекайте...'; + }, + formatRecordsPerPage: function (pageNumber) { + return pageNumber + ' записів на сторінку'; + }, + formatShowingRows: function (pageFrom, pageTo, totalRows) { + return 'Показано з ' + pageFrom + ' по ' + pageTo + '. Всього: ' + totalRows; + }, + formatSearch: function () { + return 'Пошук'; + }, + formatNoMatches: function () { + return 'Не знайдено жодного запису'; + }, + formatRefresh: function () { + return 'Оновити'; + }, + formatToggle: function () { + return 'Змінити'; + }, + formatColumns: function () { + return 'Стовпці'; + }, + formatClearFilters: function () { + return 'Очистити фільтри'; + }, + formatMultipleSort: function () { + return 'Сортування за кількома стовпцями'; + }, + formatAddLevel: function () { + return 'Додати рівень'; + }, + formatDeleteLevel: function () { + return 'Видалити рівень'; + }, + formatColumn: function () { + return 'Стовпець'; + }, + formatOrder: function () { + return 'Порядок'; + }, + formatSortBy: function () { + return 'Сортувати за'; + }, + formatThenBy: function () { + return 'потім за'; + }, + formatSort: function () { + return 'Сортувати'; + }, + formatCancel: function () { + return 'Скасувати'; + }, + formatDuplicateAlertTitle: function () { + return 'Дублювання стовпців!'; + }, + formatDuplicateAlertDescription: function () { + return 'Видаліть, будь ласка, дублюючий стовпець, або замініть його на інший.'; + } + }; + + $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales['uk-UA']); + +})(jQuery); + +/** + * Bootstrap Table Urdu translation + * Author: Malik + */ +(function ($) { + 'use strict'; + + $.fn.bootstrapTable.locales['ur-PK'] = { + formatLoadingMessage: function () { + return 'براۓ مہربانی انتظار کیجئے'; + }, + formatRecordsPerPage: function (pageNumber) { + return pageNumber + ' ریکارڈز فی صفہ '; + }, + formatShowingRows: function (pageFrom, pageTo, totalRows) { + return 'دیکھیں ' + pageFrom + ' سے ' + pageTo + ' کے ' + totalRows + 'ریکارڈز'; + }, + formatSearch: function () { + return 'تلاش'; + }, + formatNoMatches: function () { + return 'کوئی ریکارڈ نہیں ملا'; + }, + formatRefresh: function () { + return 'تازہ کریں'; + }, + formatToggle: function () { + return 'تبدیل کریں'; + }, + formatColumns: function () { + return 'کالم'; + } + }; + + $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales['ur-PK']); + +})(jQuery); + +/** + * Bootstrap Table Uzbek translation + * Author: Nabijon Masharipov + */ +(function ($) { + 'use strict'; + + $.fn.bootstrapTable.locales['uz-Latn-UZ'] = { + formatLoadingMessage: function () { + return 'Yuklanyapti, iltimos kuting...'; + }, + formatRecordsPerPage: function (pageNumber) { + return pageNumber + ' qator har sahifada'; + }, + formatShowingRows: function (pageFrom, pageTo, totalRows) { + return 'Ko\'rsatypati ' + pageFrom + ' dan ' + pageTo + ' gacha ' + totalRows + ' qatorlarni'; + }, + formatSearch: function () { + return 'Qidirish'; + }, + formatNoMatches: function () { + return 'Hech narsa topilmadi'; + }, + formatPaginationSwitch: function () { + return 'Sahifalashni yashirish/ko\'rsatish'; + }, + formatRefresh: function () { + return 'Yangilash'; + }, + formatToggle: function () { + return 'Ko\'rinish'; + }, + formatColumns: function () { + return 'Ustunlar'; + }, + formatAllRows: function () { + return 'Hammasi'; + }, + formatExport: function () { + return 'Eksport'; + }, + formatClearFilters: function () { + return 'Filtrlarni tozalash'; + } + }; + + $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales['uz-Latn-UZ']); + +})(jQuery); + +/** + * Bootstrap Table Vietnamese translation + * Author: Duc N. PHAM + */ +(function ($) { + 'use strict'; + + $.fn.bootstrapTable.locales['vi-VN'] = { + formatLoadingMessage: function () { + return 'Đang tải...'; + }, + formatRecordsPerPage: function (pageNumber) { + return pageNumber + ' bản ghi mỗi trang'; + }, + formatShowingRows: function (pageFrom, pageTo, totalRows) { + return 'Hiển thị từ trang ' + pageFrom + ' đến ' + pageTo + ' của ' + totalRows + ' bảng ghi'; + }, + formatSearch: function () { + return 'Tìm kiếm'; + }, + formatNoMatches: function () { + return 'Không có dữ liệu'; + } + }; + + $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales['vi-VN']); + +})(jQuery); +/** + * Bootstrap Table Chinese translation + * Author: Zhixin Wen + */ +(function ($) { + 'use strict'; + + $.fn.bootstrapTable.locales['zh-CN'] = { + formatLoadingMessage: function () { + return '正在努力地加载数据中,请稍候……'; + }, + formatRecordsPerPage: function (pageNumber) { + return '每页显示 ' + pageNumber + ' 条记录'; + }, + formatShowingRows: function (pageFrom, pageTo, totalRows) { + return '显示第 ' + pageFrom + ' 到第 ' + pageTo + ' 条记录,总共 ' + totalRows + ' 条记录'; + }, + formatSearch: function () { + return '搜索'; + }, + formatNoMatches: function () { + return '没有找到匹配的记录'; + }, + formatPaginationSwitch: function () { + return '隐藏/显示分页'; + }, + formatRefresh: function () { + return '刷新'; + }, + formatToggle: function () { + return '切换'; + }, + formatColumns: function () { + return '列'; + }, + formatExport: function () { + return '导出数据'; + }, + formatClearFilters: function () { + return '清空过滤'; + } + }; + + $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales['zh-CN']); + +})(jQuery); + +/** + * Bootstrap Table Chinese translation + * Author: Zhixin Wen + */ +(function ($) { + 'use strict'; + + $.fn.bootstrapTable.locales['zh-TW'] = { + formatLoadingMessage: function () { + return '正在努力地載入資料,請稍候……'; + }, + formatRecordsPerPage: function (pageNumber) { + return '每頁顯示 ' + pageNumber + ' 項記錄'; + }, + formatShowingRows: function (pageFrom, pageTo, totalRows) { + return '顯示第 ' + pageFrom + ' 到第 ' + pageTo + ' 項記錄,總共 ' + totalRows + ' 項記錄'; + }, + formatSearch: function () { + return '搜尋'; + }, + formatNoMatches: function () { + return '沒有找到符合的結果'; + }, + formatPaginationSwitch: function () { + return '隱藏/顯示分頁'; + }, + formatRefresh: function () { + return '重新整理'; + }, + formatToggle: function () { + return '切換'; + }, + formatColumns: function () { + return '列'; + } + }; + + $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales['zh-TW']); + +})(jQuery); diff --git a/public/assets/libs/bootstrap-table/dist/bootstrap-table-locale-all.min.js b/public/assets/libs/bootstrap-table/dist/bootstrap-table-locale-all.min.js new file mode 100644 index 0000000..176ef0d --- /dev/null +++ b/public/assets/libs/bootstrap-table/dist/bootstrap-table-locale-all.min.js @@ -0,0 +1,7 @@ +/* +* bootstrap-table - v1.11.1 - 2017-02-22 +* https://github.com/wenzhixin/bootstrap-table +* Copyright (c) 2017 zhixin wen +* Licensed MIT License +*/ +!function(a){"use strict";a.fn.bootstrapTable.locales["af-ZA"]={formatLoadingMessage:function(){return"Besig om te laai, wag asseblief ..."},formatRecordsPerPage:function(a){return a+" rekords per bladsy"},formatShowingRows:function(a,b,c){return"Resultate "+a+" tot "+b+" van "+c+" rye"},formatSearch:function(){return"Soek"},formatNoMatches:function(){return"Geen rekords gevind nie"},formatPaginationSwitch:function(){return"Wys/verberg bladsy nummering"},formatRefresh:function(){return"Herlaai"},formatToggle:function(){return"Wissel"},formatColumns:function(){return"Kolomme"}},a.extend(a.fn.bootstrapTable.defaults,a.fn.bootstrapTable.locales["af-ZA"])}(jQuery),function(a){"use strict";a.fn.bootstrapTable.locales["ar-SA"]={formatLoadingMessage:function(){return"جاري التحميل, يرجى الإنتظار..."},formatRecordsPerPage:function(a){return a+" سجل لكل صفحة"},formatShowingRows:function(a,b,c){return"الظاهر "+a+" إلى "+b+" من "+c+" سجل"},formatSearch:function(){return"بحث"},formatNoMatches:function(){return"لا توجد نتائج مطابقة للبحث"},formatPaginationSwitch:function(){return"إخفاءإظهار ترقيم الصفحات"},formatRefresh:function(){return"تحديث"},formatToggle:function(){return"تغيير"},formatColumns:function(){return"أعمدة"}},a.extend(a.fn.bootstrapTable.defaults,a.fn.bootstrapTable.locales["ar-SA"])}(jQuery),function(a){"use strict";a.fn.bootstrapTable.locales["ca-ES"]={formatLoadingMessage:function(){return"Espereu, si us plau..."},formatRecordsPerPage:function(a){return a+" resultats per pàgina"},formatShowingRows:function(a,b,c){return"Mostrant de "+a+" fins "+b+" - total "+c+" resultats"},formatSearch:function(){return"Cerca"},formatNoMatches:function(){return"No s'han trobat resultats"},formatPaginationSwitch:function(){return"Amaga/Mostra paginació"},formatRefresh:function(){return"Refresca"},formatToggle:function(){return"Alterna formatació"},formatColumns:function(){return"Columnes"},formatAllRows:function(){return"Tots"}},a.extend(a.fn.bootstrapTable.defaults,a.fn.bootstrapTable.locales["ca-ES"])}(jQuery),function(a){"use strict";a.fn.bootstrapTable.locales["cs-CZ"]={formatLoadingMessage:function(){return"Čekejte, prosím..."},formatRecordsPerPage:function(a){return a+" položek na stránku"},formatShowingRows:function(a,b,c){return"Zobrazena "+a+". - "+b+". položka z celkových "+c},formatSearch:function(){return"Vyhledávání"},formatNoMatches:function(){return"Nenalezena žádná vyhovující položka"},formatPaginationSwitch:function(){return"Skrýt/Zobrazit stránkování"},formatRefresh:function(){return"Aktualizovat"},formatToggle:function(){return"Přepni"},formatColumns:function(){return"Sloupce"},formatAllRows:function(){return"Vše"}},a.extend(a.fn.bootstrapTable.defaults,a.fn.bootstrapTable.locales["cs-CZ"])}(jQuery),function(a){"use strict";a.fn.bootstrapTable.locales["da-DK"]={formatLoadingMessage:function(){return"Indlæser, vent venligst..."},formatRecordsPerPage:function(a){return a+" poster pr side"},formatShowingRows:function(a,b,c){return"Viser "+a+" til "+b+" af "+c+" rækker"},formatSearch:function(){return"Søg"},formatNoMatches:function(){return"Ingen poster fundet"},formatRefresh:function(){return"Opdater"},formatToggle:function(){return"Skift"},formatColumns:function(){return"Kolonner"}},a.extend(a.fn.bootstrapTable.defaults,a.fn.bootstrapTable.locales["da-DK"])}(jQuery),function(a){"use strict";a.fn.bootstrapTable.locales["de-DE"]={formatLoadingMessage:function(){return"Lade, bitte warten..."},formatRecordsPerPage:function(a){return a+" Einträge pro Seite."},formatShowingRows:function(a,b,c){return"Zeige Zeile "+a+" bis "+b+" von "+c+" Zeile"+(c>1?"n":"")+"."},formatDetailPagination:function(a){return"Zeige "+a+" Zeile"+(a>1?"n":"")+"."},formatSearch:function(){return"Suchen ..."},formatNoMatches:function(){return"Keine passenden Ergebnisse gefunden."},formatRefresh:function(){return"Neu laden"},formatToggle:function(){return"Umschalten"},formatColumns:function(){return"Spalten"},formatAllRows:function(){return"Alle"}},a.extend(a.fn.bootstrapTable.defaults,a.fn.bootstrapTable.locales["de-DE"])}(jQuery),function(a){"use strict";a.fn.bootstrapTable.locales["el-GR"]={formatLoadingMessage:function(){return"Φορτώνει, παρακαλώ περιμένετε..."},formatRecordsPerPage:function(a){return a+" αποτελέσματα ανά σελίδα"},formatShowingRows:function(a,b,c){return"Εμφανίζονται από την "+a+" ως την "+b+" από σύνολο "+c+" σειρών"},formatSearch:function(){return"Αναζητήστε"},formatNoMatches:function(){return"Δεν βρέθηκαν αποτελέσματα"}},a.extend(a.fn.bootstrapTable.defaults,a.fn.bootstrapTable.locales["el-GR"])}(jQuery),function(a){"use strict";a.fn.bootstrapTable.locales["en-US"]={formatLoadingMessage:function(){return"Loading, please wait..."},formatRecordsPerPage:function(a){return a+" rows per page"},formatShowingRows:function(a,b,c){return"Showing "+a+" to "+b+" of "+c+" rows"},formatSearch:function(){return"Search"},formatNoMatches:function(){return"No matching records found"},formatPaginationSwitch:function(){return"Hide/Show pagination"},formatRefresh:function(){return"Refresh"},formatToggle:function(){return"Toggle"},formatColumns:function(){return"Columns"},formatAllRows:function(){return"All"},formatExport:function(){return"Export data"},formatClearFilters:function(){return"Clear filters"}},a.extend(a.fn.bootstrapTable.defaults,a.fn.bootstrapTable.locales["en-US"])}(jQuery),function(a){"use strict";a.fn.bootstrapTable.locales["es-AR"]={formatLoadingMessage:function(){return"Cargando, espere por favor..."},formatRecordsPerPage:function(a){return a+" registros por página"},formatShowingRows:function(a,b,c){return"Mostrando "+a+" a "+b+" de "+c+" filas"},formatSearch:function(){return"Buscar"},formatNoMatches:function(){return"No se encontraron registros"},formatAllRows:function(){return"Todo"}},a.extend(a.fn.bootstrapTable.defaults,a.fn.bootstrapTable.locales["es-AR"])}(jQuery),function(a){"use strict";a.fn.bootstrapTable.locales["es-CL"]={formatLoadingMessage:function(){return"Cargando, espere por favor..."},formatRecordsPerPage:function(a){return a+" filas por página"},formatShowingRows:function(a,b,c){return"Mostrando "+a+" a "+b+" de "+c+" filas"},formatSearch:function(){return"Buscar"},formatNoMatches:function(){return"No se encontraron registros"},formatPaginationSwitch:function(){return"Ocultar/Mostrar paginación"},formatRefresh:function(){return"Refrescar"},formatToggle:function(){return"Cambiar"},formatColumns:function(){return"Columnas"},formatAllRows:function(){return"Todo"}},a.extend(a.fn.bootstrapTable.defaults,a.fn.bootstrapTable.locales["es-CL"])}(jQuery),function(a){"use strict";a.fn.bootstrapTable.locales["es-CR"]={formatLoadingMessage:function(){return"Cargando, por favor espere..."},formatRecordsPerPage:function(a){return a+" registros por página"},formatShowingRows:function(a,b,c){return"Mostrando de "+a+" a "+b+" registros de "+c+" registros en total"},formatSearch:function(){return"Buscar"},formatNoMatches:function(){return"No se encontraron registros"},formatRefresh:function(){return"Refrescar"},formatToggle:function(){return"Alternar"},formatColumns:function(){return"Columnas"},formatAllRows:function(){return"Todo"}},a.extend(a.fn.bootstrapTable.defaults,a.fn.bootstrapTable.locales["es-CR"])}(jQuery),function(a){"use strict";a.fn.bootstrapTable.locales["es-ES"]={formatLoadingMessage:function(){return"Por favor espere..."},formatRecordsPerPage:function(a){return a+" resultados por página"},formatShowingRows:function(a,b,c){return"Mostrando desde "+a+" hasta "+b+" - En total "+c+" resultados"},formatSearch:function(){return"Buscar"},formatNoMatches:function(){return"No se encontraron resultados"},formatPaginationSwitch:function(){return"Ocultar/Mostrar paginación"},formatRefresh:function(){return"Refrescar"},formatToggle:function(){return"Ocultar/Mostrar"},formatColumns:function(){return"Columnas"},formatAllRows:function(){return"Todos"}},a.extend(a.fn.bootstrapTable.defaults,a.fn.bootstrapTable.locales["es-ES"])}(jQuery),function(a){"use strict";a.fn.bootstrapTable.locales["es-MX"]={formatLoadingMessage:function(){return"Cargando, espere por favor..."},formatRecordsPerPage:function(a){return a+" registros por página"},formatShowingRows:function(a,b,c){return"Mostrando "+a+" a "+b+" de "+c+" filas"},formatSearch:function(){return"Buscar"},formatNoMatches:function(){return"No se encontraron registros"},formatAllRows:function(){return"Todo"}},a.extend(a.fn.bootstrapTable.defaults,a.fn.bootstrapTable.locales["es-MX"])}(jQuery),function(a){"use strict";a.fn.bootstrapTable.locales["es-NI"]={formatLoadingMessage:function(){return"Cargando, por favor espere..."},formatRecordsPerPage:function(a){return a+" registros por página"},formatShowingRows:function(a,b,c){return"Mostrando de "+a+" a "+b+" registros de "+c+" registros en total"},formatSearch:function(){return"Buscar"},formatNoMatches:function(){return"No se encontraron registros"},formatRefresh:function(){return"Refrescar"},formatToggle:function(){return"Alternar"},formatColumns:function(){return"Columnas"},formatAllRows:function(){return"Todo"}},a.extend(a.fn.bootstrapTable.defaults,a.fn.bootstrapTable.locales["es-NI"])}(jQuery),function(a){"use strict";a.fn.bootstrapTable.locales["es-SP"]={formatLoadingMessage:function(){return"Cargando, por favor espera..."},formatRecordsPerPage:function(a){return a+" registros por página."},formatShowingRows:function(a,b,c){return a+" - "+b+" de "+c+" registros."},formatSearch:function(){return"Buscar"},formatNoMatches:function(){return"No se han encontrado registros."},formatRefresh:function(){return"Actualizar"},formatToggle:function(){return"Alternar"},formatColumns:function(){return"Columnas"},formatAllRows:function(){return"Todo"}},a.extend(a.fn.bootstrapTable.defaults,a.fn.bootstrapTable.locales["es-SP"])}(jQuery),function(a){"use strict";a.fn.bootstrapTable.locales["et-EE"]={formatLoadingMessage:function(){return"Päring käib, palun oota..."},formatRecordsPerPage:function(a){return a+" rida lehe kohta"},formatShowingRows:function(a,b,c){return"Näitan tulemusi "+a+" kuni "+b+" - kokku "+c+" tulemust"},formatSearch:function(){return"Otsi"},formatNoMatches:function(){return"Päringu tingimustele ei vastanud ühtegi tulemust"},formatPaginationSwitch:function(){return"Näita/Peida lehtedeks jagamine"},formatRefresh:function(){return"Värskenda"},formatToggle:function(){return"Lülita"},formatColumns:function(){return"Veerud"},formatAllRows:function(){return"Kõik"}},a.extend(a.fn.bootstrapTable.defaults,a.fn.bootstrapTable.locales["et-EE"])}(jQuery),function(a){"use strict";a.fn.bootstrapTable.locales["fa-IR"]={formatLoadingMessage:function(){return"در حال بارگذاری, لطفا صبر کنید..."},formatRecordsPerPage:function(a){return a+" رکورد در صفحه"},formatShowingRows:function(a,b,c){return"نمایش "+a+" تا "+b+" از "+c+" ردیف"},formatSearch:function(){return"جستجو"},formatNoMatches:function(){return"رکوردی یافت نشد."},formatPaginationSwitch:function(){return"نمایش/مخفی صفحه بندی"},formatRefresh:function(){return"به روز رسانی"},formatToggle:function(){return"تغییر نمایش"},formatColumns:function(){return"سطر ها"},formatAllRows:function(){return"همه"}},a.extend(a.fn.bootstrapTable.defaults,a.fn.bootstrapTable.locales["fa-IR"])}(jQuery),function(a){"use strict";a.fn.bootstrapTable.locales["fr-BE"]={formatLoadingMessage:function(){return"Chargement en cours..."},formatRecordsPerPage:function(a){return a+" entrées par page"},formatShowingRows:function(a,b,c){return"Affiche de"+a+" à "+b+" sur "+c+" lignes"},formatSearch:function(){return"Recherche"},formatNoMatches:function(){return"Pas de fichiers trouvés"}},a.extend(a.fn.bootstrapTable.defaults,a.fn.bootstrapTable.locales["fr-BE"])}(jQuery),function(a){"use strict";a.fn.bootstrapTable.locales["fr-FR"]={formatLoadingMessage:function(){return"Chargement en cours, patientez, s´il vous plaît ..."},formatRecordsPerPage:function(a){return a+" lignes par page"},formatShowingRows:function(a,b,c){return"Affichage des lignes "+a+" à "+b+" sur "+c+" lignes au total"},formatSearch:function(){return"Rechercher"},formatNoMatches:function(){return"Aucun résultat trouvé"},formatRefresh:function(){return"Rafraîchir"},formatToggle:function(){return"Alterner"},formatColumns:function(){return"Colonnes"},formatAllRows:function(){return"Tous"}},a.extend(a.fn.bootstrapTable.defaults,a.fn.bootstrapTable.locales["fr-FR"])}(jQuery),function(a){"use strict";a.fn.bootstrapTable.locales["he-IL"]={formatLoadingMessage:function(){return"טוען, נא להמתין..."},formatRecordsPerPage:function(a){return a+" שורות בעמוד"},formatShowingRows:function(a,b,c){return"מציג "+a+" עד "+b+" מ-"+c+" שורות"},formatSearch:function(){return"חיפוש"},formatNoMatches:function(){return"לא נמצאו רשומות תואמות"},formatPaginationSwitch:function(){return"הסתר/הצג מספור דפים"},formatRefresh:function(){return"רענן"},formatToggle:function(){return"החלף תצוגה"},formatColumns:function(){return"עמודות"},formatAllRows:function(){return"הכל"}},a.extend(a.fn.bootstrapTable.defaults,a.fn.bootstrapTable.locales["he-IL"])}(jQuery),function(a){"use strict";a.fn.bootstrapTable.locales["hr-HR"]={formatLoadingMessage:function(){return"Molimo pričekajte ..."},formatRecordsPerPage:function(a){return a+" broj zapisa po stranici"},formatShowingRows:function(a,b,c){return"Prikazujem "+a+". - "+b+". od ukupnog broja zapisa "+c},formatSearch:function(){return"Pretraži"},formatNoMatches:function(){return"Nije pronađen niti jedan zapis"},formatPaginationSwitch:function(){return"Prikaži/sakrij stranice"},formatRefresh:function(){return"Osvježi"},formatToggle:function(){return"Promijeni prikaz"},formatColumns:function(){return"Kolone"},formatAllRows:function(){return"Sve"}},a.extend(a.fn.bootstrapTable.defaults,a.fn.bootstrapTable.locales["hr-HR"])}(jQuery),function(a){"use strict";a.fn.bootstrapTable.locales["hu-HU"]={formatLoadingMessage:function(){return"Betöltés, kérem várjon..."},formatRecordsPerPage:function(a){return a+" rekord per oldal"},formatShowingRows:function(a,b,c){return"Megjelenítve "+a+" - "+b+" / "+c+" összesen"},formatSearch:function(){return"Keresés"},formatNoMatches:function(){return"Nincs találat"},formatPaginationSwitch:function(){return"Lapozó elrejtése/megjelenítése"},formatRefresh:function(){return"Frissítés"},formatToggle:function(){return"Összecsuk/Kinyit"},formatColumns:function(){return"Oszlopok"},formatAllRows:function(){return"Összes"}},a.extend(a.fn.bootstrapTable.defaults,a.fn.bootstrapTable.locales["hu-HU"])}(jQuery),function(a){"use strict";a.fn.bootstrapTable.locales["id-ID"]={formatLoadingMessage:function(){return"Memuat, mohon tunggu..."},formatRecordsPerPage:function(a){return a+" baris per halaman"},formatShowingRows:function(a,b,c){return"Menampilkan "+a+" sampai "+b+" dari "+c+" baris"},formatSearch:function(){return"Pencarian"},formatNoMatches:function(){return"Tidak ditemukan data yang cocok"},formatPaginationSwitch:function(){return"Sembunyikan/Tampilkan halaman"},formatRefresh:function(){return"Muat ulang"},formatToggle:function(){return"Beralih"},formatColumns:function(){return"kolom"},formatAllRows:function(){return"Semua"},formatExport:function(){return"Ekspor data"},formatClearFilters:function(){return"Bersihkan filter"}},a.extend(a.fn.bootstrapTable.defaults,a.fn.bootstrapTable.locales["id-ID"])}(jQuery),function(a){"use strict";a.fn.bootstrapTable.locales["it-IT"]={formatLoadingMessage:function(){return"Caricamento in corso..."},formatRecordsPerPage:function(a){return a+" elementi per pagina"},formatShowingRows:function(a,b,c){return"Elementi mostrati da "+a+" a "+b+" (Numero totali di elementi "+c+")"},formatSearch:function(){return"Cerca"},formatNoMatches:function(){return"Nessun elemento trovato"},formatPaginationSwitch:function(){return"Nascondi/Mostra paginazione"},formatRefresh:function(){return"Aggiorna"},formatToggle:function(){return"Attiva/Disattiva"},formatColumns:function(){return"Colonne"},formatAllRows:function(){return"Tutto"},formatExport:function(){return"Esporta dati"},formatClearFilters:function(){return"Pulisci filtri"}},a.extend(a.fn.bootstrapTable.defaults,a.fn.bootstrapTable.locales["it-IT"])}(jQuery),function(a){"use strict";a.fn.bootstrapTable.locales["ja-JP"]={formatLoadingMessage:function(){return"読み込み中です。少々お待ちください。"},formatRecordsPerPage:function(a){return"ページ当たり最大"+a+"件"},formatShowingRows:function(a,b,c){return"全"+c+"件から、"+a+"から"+b+"件目まで表示しています"},formatSearch:function(){return"検索"},formatNoMatches:function(){return"該当するレコードが見つかりません"},formatPaginationSwitch:function(){return"ページ数を表示・非表示"},formatRefresh:function(){return"更新"},formatToggle:function(){return"トグル"},formatColumns:function(){return"列"},formatAllRows:function(){return"すべて"}},a.extend(a.fn.bootstrapTable.defaults,a.fn.bootstrapTable.locales["ja-JP"])}(jQuery),function(a){"use strict";a.fn.bootstrapTable.locales["ka-GE"]={formatLoadingMessage:function(){return"იტვირთება, გთხოვთ მოიცადოთ..."},formatRecordsPerPage:function(a){return a+" ჩანაწერი თითო გვერდზე"},formatShowingRows:function(a,b,c){return"ნაჩვენებია "+a+"-დან "+b+"-მდე ჩანაწერი ჯამური "+c+"-დან"},formatSearch:function(){return"ძებნა"},formatNoMatches:function(){return"მონაცემები არ არის"},formatPaginationSwitch:function(){return"გვერდების გადამრთველის დამალვა/გამოჩენა"},formatRefresh:function(){return"განახლება"},formatToggle:function(){return"ჩართვა/გამორთვა"},formatColumns:function(){return"სვეტები"}},a.extend(a.fn.bootstrapTable.defaults,a.fn.bootstrapTable.locales["ka-GE"])}(jQuery),function(a){"use strict";a.fn.bootstrapTable.locales["ko-KR"]={formatLoadingMessage:function(){return"데이터를 불러오는 중입니다..."},formatRecordsPerPage:function(a){return"페이지 당 "+a+"개 데이터 출력"},formatShowingRows:function(a,b,c){return"전체 "+c+"개 중 "+a+"~"+b+"번째 데이터 출력,"},formatSearch:function(){return"검색"},formatNoMatches:function(){return"조회된 데이터가 없습니다."},formatRefresh:function(){return"새로 고침"},formatToggle:function(){return"전환"},formatColumns:function(){return"컬럼 필터링"}},a.extend(a.fn.bootstrapTable.defaults,a.fn.bootstrapTable.locales["ko-KR"])}(jQuery),function(a){"use strict";a.fn.bootstrapTable.locales["ms-MY"]={formatLoadingMessage:function(){return"Permintaan sedang dimuatkan. Sila tunggu sebentar..."},formatRecordsPerPage:function(a){return a+" rekod setiap muka surat"},formatShowingRows:function(a,b,c){return"Sedang memaparkan rekod "+a+" hingga "+b+" daripada jumlah "+c+" rekod"},formatSearch:function(){return"Cari"},formatNoMatches:function(){return"Tiada rekod yang menyamai permintaan"},formatPaginationSwitch:function(){return"Tunjuk/sembunyi muka surat"},formatRefresh:function(){return"Muatsemula"},formatToggle:function(){return"Tukar"},formatColumns:function(){return"Lajur"},formatAllRows:function(){return"Semua"}},a.extend(a.fn.bootstrapTable.defaults,a.fn.bootstrapTable.locales["ms-MY"])}(jQuery),function(a){"use strict";a.fn.bootstrapTable.locales["nb-NO"]={formatLoadingMessage:function(){return"Oppdaterer, vennligst vent..."},formatRecordsPerPage:function(a){return a+" poster pr side"},formatShowingRows:function(a,b,c){return"Viser "+a+" til "+b+" av "+c+" rekker"},formatSearch:function(){return"Søk"},formatNoMatches:function(){return"Ingen poster funnet"},formatRefresh:function(){return"Oppdater"},formatToggle:function(){return"Endre"},formatColumns:function(){return"Kolonner"}},a.extend(a.fn.bootstrapTable.defaults,a.fn.bootstrapTable.locales["nb-NO"])}(jQuery),function(a){"use strict";a.fn.bootstrapTable.locales["nl-NL"]={formatLoadingMessage:function(){return"Laden, even geduld..."},formatRecordsPerPage:function(a){return a+" records per pagina"},formatShowingRows:function(a,b,c){return"Toon "+a+" tot "+b+" van "+c+" record"+(c>1?"s":"")},formatDetailPagination:function(a){return"Toon "+a+" record"+(a>1?"s":"")},formatSearch:function(){return"Zoeken"},formatNoMatches:function(){return"Geen resultaten gevonden"},formatRefresh:function(){return"Vernieuwen"},formatToggle:function(){return"Omschakelen"},formatColumns:function(){return"Kolommen"},formatAllRows:function(){return"Alle"},formatPaginationSwitch:function(){return"Verberg/Toon paginatie"},formatExport:function(){return"Exporteer data"},formatClearFilters:function(){return"Verwijder filters"}},a.extend(a.fn.bootstrapTable.defaults,a.fn.bootstrapTable.locales["nl-NL"])}(jQuery),function(a){"use strict";a.fn.bootstrapTable.locales["pl-PL"]={formatLoadingMessage:function(){return"Ładowanie, proszę czekać..."},formatRecordsPerPage:function(a){return a+" rekordów na stronę"},formatShowingRows:function(a,b,c){return"Wyświetlanie rekordów od "+a+" do "+b+" z "+c},formatSearch:function(){return"Szukaj"},formatNoMatches:function(){return"Niestety, nic nie znaleziono"},formatRefresh:function(){return"Odśwież"},formatToggle:function(){return"Przełącz"},formatColumns:function(){return"Kolumny"}},a.extend(a.fn.bootstrapTable.defaults,a.fn.bootstrapTable.locales["pl-PL"])}(jQuery),function(a){"use strict";a.fn.bootstrapTable.locales["pt-BR"]={formatLoadingMessage:function(){return"Carregando, aguarde..."},formatRecordsPerPage:function(a){return a+" registros por página"},formatShowingRows:function(a,b,c){return"Exibindo "+a+" até "+b+" de "+c+" linhas"},formatSearch:function(){return"Pesquisar"},formatRefresh:function(){return"Recarregar"},formatToggle:function(){return"Alternar"},formatColumns:function(){return"Colunas"},formatPaginationSwitch:function(){return"Ocultar/Exibir paginação"},formatNoMatches:function(){return"Nenhum registro encontrado"}},a.extend(a.fn.bootstrapTable.defaults,a.fn.bootstrapTable.locales["pt-BR"])}(jQuery),function(a){"use strict";a.fn.bootstrapTable.locales["pt-PT"]={formatLoadingMessage:function(){return"A carregar, por favor aguarde..."},formatRecordsPerPage:function(a){return a+" registos por página"},formatShowingRows:function(a,b,c){return"A mostrar "+a+" até "+b+" de "+c+" linhas"},formatSearch:function(){return"Pesquisa"},formatNoMatches:function(){return"Nenhum registo encontrado"},formatPaginationSwitch:function(){return"Esconder/Mostrar paginação"},formatRefresh:function(){return"Atualizar"},formatToggle:function(){return"Alternar"},formatColumns:function(){return"Colunas"},formatAllRows:function(){return"Tudo"}},a.extend(a.fn.bootstrapTable.defaults,a.fn.bootstrapTable.locales["pt-PT"])}(jQuery),function(a){"use strict";a.fn.bootstrapTable.locales["ro-RO"]={formatLoadingMessage:function(){return"Se incarca, va rugam asteptati..."},formatRecordsPerPage:function(a){return a+" inregistrari pe pagina"},formatShowingRows:function(a,b,c){return"Arata de la "+a+" pana la "+b+" din "+c+" randuri"},formatSearch:function(){return"Cauta"},formatNoMatches:function(){return"Nu au fost gasite inregistrari"},formatPaginationSwitch:function(){return"Ascunde/Arata paginatia"},formatRefresh:function(){return"Reincarca"},formatToggle:function(){return"Comuta"},formatColumns:function(){return"Coloane"},formatAllRows:function(){return"Toate"}},a.extend(a.fn.bootstrapTable.defaults,a.fn.bootstrapTable.locales["ro-RO"])}(jQuery),function(a){"use strict";a.fn.bootstrapTable.locales["ru-RU"]={formatLoadingMessage:function(){return"Пожалуйста, подождите, идёт загрузка..."},formatRecordsPerPage:function(a){return a+" записей на страницу"},formatShowingRows:function(a,b,c){return"Записи с "+a+" по "+b+" из "+c},formatSearch:function(){return"Поиск"},formatNoMatches:function(){return"Ничего не найдено"},formatRefresh:function(){return"Обновить"},formatToggle:function(){return"Переключить"},formatColumns:function(){return"Колонки"},formatClearFilters:function(){return"Очистить фильтры"},formatMultipleSort:function(){return"Множественная сортировка"},formatAddLevel:function(){return"Добавить уровень"},formatDeleteLevel:function(){return"Удалить уровень"},formatColumn:function(){return"Колонка"},formatOrder:function(){return"Порядок"},formatSortBy:function(){return"Сортировать по"},formatThenBy:function(){return"затем по"},formatSort:function(){return"Сортировать"},formatCancel:function(){return"Отмена"},formatDuplicateAlertTitle:function(){return"Дублирование колонок!"},formatDuplicateAlertDescription:function(){return"Удалите, пожалуйста, дублирующую колонку, или замените ее на другую."}},a.extend(a.fn.bootstrapTable.defaults,a.fn.bootstrapTable.locales["ru-RU"])}(jQuery),function(a){"use strict";a.fn.bootstrapTable.locales["sk-SK"]={formatLoadingMessage:function(){return"Prosím čakajte ..."},formatRecordsPerPage:function(a){return a+" záznamov na stranu"},formatShowingRows:function(a,b,c){return"Zobrazená "+a+". - "+b+". položka z celkových "+c},formatSearch:function(){return"Vyhľadávanie"},formatNoMatches:function(){return"Nenájdená žiadna vyhovujúca položka"},formatRefresh:function(){return"Obnoviť"},formatToggle:function(){return"Prepni"},formatColumns:function(){return"Stĺpce"}},a.extend(a.fn.bootstrapTable.defaults,a.fn.bootstrapTable.locales["sk-SK"])}(jQuery),function(a){"use strict";a.fn.bootstrapTable.locales["sv-SE"]={formatLoadingMessage:function(){return"Laddar, vänligen vänta..."},formatRecordsPerPage:function(a){return a+" rader per sida"},formatShowingRows:function(a,b,c){return"Visa "+a+" till "+b+" av "+c+" rader"},formatSearch:function(){return"Sök"},formatNoMatches:function(){return"Inga matchande resultat funna."},formatRefresh:function(){return"Uppdatera"},formatToggle:function(){return"Skifta"},formatColumns:function(){return"kolumn"}},a.extend(a.fn.bootstrapTable.defaults,a.fn.bootstrapTable.locales["sv-SE"])}(jQuery),function(a){"use strict";a.fn.bootstrapTable.locales["th-TH"]={formatLoadingMessage:function(){return"กำลังโหลดข้อมูล, กรุณารอสักครู่..."},formatRecordsPerPage:function(a){return a+" รายการต่อหน้า"},formatShowingRows:function(a,b,c){return"รายการที่ "+a+" ถึง "+b+" จากทั้งหมด "+c+" รายการ"},formatSearch:function(){return"ค้นหา"},formatNoMatches:function(){return"ไม่พบรายการที่ค้นหา !"},formatRefresh:function(){return"รีเฟรส"},formatToggle:function(){return"สลับมุมมอง"},formatColumns:function(){return"คอลัมน์"}},a.extend(a.fn.bootstrapTable.defaults,a.fn.bootstrapTable.locales["th-TH"])}(jQuery),function(a){"use strict";a.fn.bootstrapTable.locales["tr-TR"]={formatLoadingMessage:function(){return"Yükleniyor, lütfen bekleyin..."},formatRecordsPerPage:function(a){return"Sayfa başına "+a+" kayıt."},formatShowingRows:function(a,b,c){return c+" kayıttan "+a+"-"+b+" arası gösteriliyor."},formatSearch:function(){return"Ara"},formatNoMatches:function(){return"Eşleşen kayıt bulunamadı."},formatRefresh:function(){return"Yenile"},formatToggle:function(){return"Değiştir"},formatColumns:function(){return"Sütunlar"},formatAllRows:function(){return"Tüm Satırlar"}},a.extend(a.fn.bootstrapTable.defaults,a.fn.bootstrapTable.locales["tr-TR"])}(jQuery),function(a){"use strict";a.fn.bootstrapTable.locales["uk-UA"]={formatLoadingMessage:function(){return"Завантаження, будь ласка, зачекайте..."},formatRecordsPerPage:function(a){return a+" записів на сторінку"},formatShowingRows:function(a,b,c){return"Показано з "+a+" по "+b+". Всього: "+c},formatSearch:function(){return"Пошук"},formatNoMatches:function(){return"Не знайдено жодного запису"},formatRefresh:function(){return"Оновити"},formatToggle:function(){return"Змінити"},formatColumns:function(){return"Стовпці"},formatClearFilters:function(){return"Очистити фільтри"},formatMultipleSort:function(){return"Сортування за кількома стовпцями"},formatAddLevel:function(){return"Додати рівень"},formatDeleteLevel:function(){return"Видалити рівень"},formatColumn:function(){return"Стовпець"},formatOrder:function(){return"Порядок"},formatSortBy:function(){return"Сортувати за"},formatThenBy:function(){return"потім за"},formatSort:function(){return"Сортувати"},formatCancel:function(){return"Скасувати"},formatDuplicateAlertTitle:function(){return"Дублювання стовпців!"},formatDuplicateAlertDescription:function(){return"Видаліть, будь ласка, дублюючий стовпець, або замініть його на інший."}},a.extend(a.fn.bootstrapTable.defaults,a.fn.bootstrapTable.locales["uk-UA"])}(jQuery),function(a){"use strict";a.fn.bootstrapTable.locales["ur-PK"]={formatLoadingMessage:function(){return"براۓ مہربانی انتظار کیجئے"},formatRecordsPerPage:function(a){return a+" ریکارڈز فی صفہ "},formatShowingRows:function(a,b,c){return"دیکھیں "+a+" سے "+b+" کے "+c+"ریکارڈز"},formatSearch:function(){return"تلاش"},formatNoMatches:function(){return"کوئی ریکارڈ نہیں ملا"},formatRefresh:function(){return"تازہ کریں"},formatToggle:function(){return"تبدیل کریں"},formatColumns:function(){return"کالم"}},a.extend(a.fn.bootstrapTable.defaults,a.fn.bootstrapTable.locales["ur-PK"])}(jQuery),function(a){"use strict";a.fn.bootstrapTable.locales["uz-Latn-UZ"]={formatLoadingMessage:function(){return"Yuklanyapti, iltimos kuting..."},formatRecordsPerPage:function(a){return a+" qator har sahifada"},formatShowingRows:function(a,b,c){return"Ko'rsatypati "+a+" dan "+b+" gacha "+c+" qatorlarni"},formatSearch:function(){return"Qidirish"},formatNoMatches:function(){return"Hech narsa topilmadi"},formatPaginationSwitch:function(){return"Sahifalashni yashirish/ko'rsatish"},formatRefresh:function(){return"Yangilash"},formatToggle:function(){return"Ko'rinish"},formatColumns:function(){return"Ustunlar"},formatAllRows:function(){return"Hammasi"},formatExport:function(){return"Eksport"},formatClearFilters:function(){return"Filtrlarni tozalash"}},a.extend(a.fn.bootstrapTable.defaults,a.fn.bootstrapTable.locales["uz-Latn-UZ"])}(jQuery),function(a){"use strict";a.fn.bootstrapTable.locales["vi-VN"]={formatLoadingMessage:function(){return"Đang tải..."},formatRecordsPerPage:function(a){return a+" bản ghi mỗi trang"},formatShowingRows:function(a,b,c){return"Hiển thị từ trang "+a+" đến "+b+" của "+c+" bảng ghi"},formatSearch:function(){return"Tìm kiếm"},formatNoMatches:function(){return"Không có dữ liệu"}},a.extend(a.fn.bootstrapTable.defaults,a.fn.bootstrapTable.locales["vi-VN"])}(jQuery),function(a){"use strict";a.fn.bootstrapTable.locales["zh-CN"]={formatLoadingMessage:function(){return"正在努力地加载数据中,请稍候……"},formatRecordsPerPage:function(a){return"每页显示 "+a+" 条记录"},formatShowingRows:function(a,b,c){return"显示第 "+a+" 到第 "+b+" 条记录,总共 "+c+" 条记录"},formatSearch:function(){return"搜索"},formatNoMatches:function(){return"没有找到匹配的记录"},formatPaginationSwitch:function(){return"隐藏/显示分页"},formatRefresh:function(){return"刷新"},formatToggle:function(){return"切换"},formatColumns:function(){return"列"},formatExport:function(){return"导出数据"},formatClearFilters:function(){return"清空过滤"}},a.extend(a.fn.bootstrapTable.defaults,a.fn.bootstrapTable.locales["zh-CN"])}(jQuery),function(a){"use strict";a.fn.bootstrapTable.locales["zh-TW"]={formatLoadingMessage:function(){return"正在努力地載入資料,請稍候……"},formatRecordsPerPage:function(a){return"每頁顯示 "+a+" 項記錄"},formatShowingRows:function(a,b,c){return"顯示第 "+a+" 到第 "+b+" 項記錄,總共 "+c+" 項記錄"},formatSearch:function(){return"搜尋"},formatNoMatches:function(){return"沒有找到符合的結果"},formatPaginationSwitch:function(){return"隱藏/顯示分頁"},formatRefresh:function(){return"重新整理"},formatToggle:function(){return"切換"},formatColumns:function(){return"列"}},a.extend(a.fn.bootstrapTable.defaults,a.fn.bootstrapTable.locales["zh-TW"])}(jQuery); \ No newline at end of file diff --git a/public/assets/libs/bootstrap-table/dist/bootstrap-table.css b/public/assets/libs/bootstrap-table/dist/bootstrap-table.css new file mode 100644 index 0000000..ebf5e95 --- /dev/null +++ b/public/assets/libs/bootstrap-table/dist/bootstrap-table.css @@ -0,0 +1,313 @@ +/** + * @author zhixin wen + * version: 1.11.1 + * https://github.com/wenzhixin/bootstrap-table/ + */ + +.bootstrap-table .table { + margin-bottom: 0 !important; + border-bottom: 1px solid #dddddd; + border-collapse: collapse !important; + border-radius: 1px; +} + +.bootstrap-table .table:not(.table-condensed), +.bootstrap-table .table:not(.table-condensed) > tbody > tr > th, +.bootstrap-table .table:not(.table-condensed) > tfoot > tr > th, +.bootstrap-table .table:not(.table-condensed) > thead > tr > td, +.bootstrap-table .table:not(.table-condensed) > tbody > tr > td, +.bootstrap-table .table:not(.table-condensed) > tfoot > tr > td { + padding: 8px; +} + +.bootstrap-table .table.table-no-bordered > thead > tr > th, +.bootstrap-table .table.table-no-bordered > tbody > tr > td { + border-right: 2px solid transparent; +} + +.bootstrap-table .table.table-no-bordered > tbody > tr > td:last-child { + border-right: none; +} + +.fixed-table-container { + position: relative; + clear: both; + border: 1px solid #dddddd; + border-radius: 4px; + -webkit-border-radius: 4px; + -moz-border-radius: 4px; +} + +.fixed-table-container.table-no-bordered { + border: 1px solid transparent; +} + +.fixed-table-footer, +.fixed-table-header { + overflow: hidden; +} + +.fixed-table-footer { + border-top: 1px solid #dddddd; +} + +.fixed-table-body { + overflow-x: auto; + overflow-y: auto; + height: 100%; +} + +.fixed-table-container table { + width: 100%; +} + +.fixed-table-container thead th { + height: 0; + padding: 0; + margin: 0; + border-left: 1px solid #dddddd; +} + +.fixed-table-container thead th:focus { + outline: 0 solid transparent; +} + +.fixed-table-container thead th:first-child { + border-left: none; + border-top-left-radius: 4px; + -webkit-border-top-left-radius: 4px; + -moz-border-radius-topleft: 4px; +} + +.fixed-table-container thead th .th-inner, +.fixed-table-container tbody td .th-inner { + padding: 8px; + line-height: 24px; + vertical-align: top; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +.fixed-table-container thead th .sortable { + cursor: pointer; + background-position: right; + background-repeat: no-repeat; + padding-right: 30px; +} + +.fixed-table-container thead th .both { + background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAATCAQAAADYWf5HAAAAkElEQVQoz7X QMQ5AQBCF4dWQSJxC5wwax1Cq1e7BAdxD5SL+Tq/QCM1oNiJidwox0355mXnG/DrEtIQ6azioNZQxI0ykPhTQIwhCR+BmBYtlK7kLJYwWCcJA9M4qdrZrd8pPjZWPtOqdRQy320YSV17OatFC4euts6z39GYMKRPCTKY9UnPQ6P+GtMRfGtPnBCiqhAeJPmkqAAAAAElFTkSuQmCC'); +} + +.fixed-table-container thead th .asc { + background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAATCAYAAAByUDbMAAAAZ0lEQVQ4y2NgGLKgquEuFxBPAGI2ahhWCsS/gDibUoO0gPgxEP8H4ttArEyuQYxAPBdqEAxPBImTY5gjEL9DM+wTENuQahAvEO9DMwiGdwAxOymGJQLxTyD+jgWDxCMZRsEoGAVoAADeemwtPcZI2wAAAABJRU5ErkJggg=='); +} + +.fixed-table-container thead th .desc { + background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAATCAYAAAByUDbMAAAAZUlEQVQ4y2NgGAWjYBSggaqGu5FA/BOIv2PBIPFEUgxjB+IdQPwfC94HxLykus4GiD+hGfQOiB3J8SojEE9EM2wuSJzcsFMG4ttQgx4DsRalkZENxL+AuJQaMcsGxBOAmGvopk8AVz1sLZgg0bsAAAAASUVORK5CYII= '); +} + +.fixed-table-container th.detail { + width: 30px; +} + +.fixed-table-container tbody td { + border-left: 1px solid #dddddd; +} + +.fixed-table-container tbody tr:first-child td { + border-top: none; +} + +.fixed-table-container tbody td:first-child { + border-left: none; +} + +/* the same color with .active */ +.fixed-table-container tbody .selected td { + background-color: #f5f5f5; +} + +.fixed-table-container .bs-checkbox { + text-align: center; +} + +.fixed-table-container .bs-checkbox .th-inner { + padding: 8px 0; +} + +.fixed-table-container input[type="radio"], +.fixed-table-container input[type="checkbox"] { + margin: 0 auto !important; +} + +.fixed-table-container .no-records-found { + text-align: center; +} + +.fixed-table-pagination div.pagination, +.fixed-table-pagination .pagination-detail { + margin-top: 10px; + margin-bottom: 10px; +} + +.fixed-table-pagination div.pagination .pagination { + margin: 0; +} + +.fixed-table-pagination .pagination a { + padding: 6px 12px; + line-height: 1.428571429; +} + +.fixed-table-pagination .pagination-info { + line-height: 34px; + margin-right: 5px; +} + +.fixed-table-pagination .btn-group { + position: relative; + display: inline-block; + vertical-align: middle; +} + +.fixed-table-pagination .dropup .dropdown-menu { + margin-bottom: 0; +} + +.fixed-table-pagination .page-list { + display: inline-block; +} + +.fixed-table-toolbar .columns-left { + margin-right: 5px; +} + +.fixed-table-toolbar .columns-right { + margin-left: 5px; +} + +.fixed-table-toolbar .columns label { + display: block; + padding: 3px 20px; + clear: both; + font-weight: normal; + line-height: 1.428571429; +} + +.fixed-table-toolbar .bs-bars, +.fixed-table-toolbar .search, +.fixed-table-toolbar .columns { + position: relative; + margin-top: 10px; + margin-bottom: 10px; + line-height: 34px; +} + +.fixed-table-pagination li.disabled a { + pointer-events: none; + cursor: default; +} + +.fixed-table-loading { + display: none; + position: absolute; + top: 42px; + right: 0; + bottom: 0; + left: 0; + z-index: 99; + background-color: #fff; + text-align: center; +} + +.fixed-table-body .card-view .title { + font-weight: bold; + display: inline-block; + min-width: 30%; + text-align: left !important; +} + +/* support bootstrap 2 */ +.fixed-table-body thead th .th-inner { + box-sizing: border-box; +} + +.table th, .table td { + vertical-align: middle; + box-sizing: border-box; +} + +.fixed-table-toolbar .dropdown-menu { + text-align: left; + max-height: 300px; + overflow: auto; +} + +.fixed-table-toolbar .btn-group > .btn-group { + display: inline-block; + margin-left: -1px !important; +} + +.fixed-table-toolbar .btn-group > .btn-group > .btn { + border-radius: 0; +} + +.fixed-table-toolbar .btn-group > .btn-group:first-child > .btn { + border-top-left-radius: 4px; + border-bottom-left-radius: 4px; +} + +.fixed-table-toolbar .btn-group > .btn-group:last-child > .btn { + border-top-right-radius: 4px; + border-bottom-right-radius: 4px; +} + +.bootstrap-table .table > thead > tr > th { + vertical-align: bottom; + border-bottom: 1px solid #ddd; +} + +/* support bootstrap 3 */ +.bootstrap-table .table thead > tr > th { + padding: 0; + margin: 0; +} + +.bootstrap-table .fixed-table-footer tbody > tr > td { + padding: 0 !important; +} + +.bootstrap-table .fixed-table-footer .table { + border-bottom: none; + border-radius: 0; + padding: 0 !important; +} + +.bootstrap-table .pull-right .dropdown-menu { + right: 0; + left: auto; +} + +/* calculate scrollbar width */ +p.fixed-table-scroll-inner { + width: 100%; + height: 200px; +} + +div.fixed-table-scroll-outer { + top: 0; + left: 0; + visibility: hidden; + width: 200px; + height: 150px; + overflow: hidden; +} + +/* for get correct heights */ +.fixed-table-toolbar:after, .fixed-table-pagination:after { + content: ""; + display: block; + clear: both; +} diff --git a/public/assets/libs/bootstrap-table/dist/bootstrap-table.js b/public/assets/libs/bootstrap-table/dist/bootstrap-table.js new file mode 100644 index 0000000..7888f60 --- /dev/null +++ b/public/assets/libs/bootstrap-table/dist/bootstrap-table.js @@ -0,0 +1,3100 @@ +/** + * @author zhixin wen + * version: 1.11.2 + * https://github.com/wenzhixin/bootstrap-table/ + */ + +(function ($) { + 'use strict'; + + // TOOLS DEFINITION + // ====================== + + var cachedWidth = null; + + // it only does '%s', and return '' when arguments are undefined + var sprintf = function (str) { + var args = arguments, + flag = true, + i = 1; + + str = str.replace(/%s/g, function () { + var arg = args[i++]; + + if (typeof arg === 'undefined') { + flag = false; + return ''; + } + return arg; + }); + return flag ? str : ''; + }; + + var getPropertyFromOther = function (list, from, to, value) { + var result = ''; + $.each(list, function (i, item) { + if (item[from] === value) { + result = item[to]; + return false; + } + return true; + }); + return result; + }; + + var getFieldIndex = function (columns, field) { + var index = -1; + + $.each(columns, function (i, column) { + if (column.field === field) { + index = i; + return false; + } + return true; + }); + return index; + }; + + // http://jsfiddle.net/wenyi/47nz7ez9/3/ + var setFieldIndex = function (columns) { + var i, j, k, + totalCol = 0, + flag = []; + + for (i = 0; i < columns[0].length; i++) { + totalCol += columns[0][i].colspan || 1; + } + + for (i = 0; i < columns.length; i++) { + flag[i] = []; + for (j = 0; j < totalCol; j++) { + flag[i][j] = false; + } + } + + for (i = 0; i < columns.length; i++) { + for (j = 0; j < columns[i].length; j++) { + var r = columns[i][j], + rowspan = r.rowspan || 1, + colspan = r.colspan || 1, + index = $.inArray(false, flag[i]); + + if (colspan === 1) { + r.fieldIndex = index; + // when field is undefined, use index instead + if (typeof r.field === 'undefined') { + r.field = index; + } + } + + for (k = 0; k < rowspan; k++) { + flag[i + k][index] = true; + } + for (k = 0; k < colspan; k++) { + flag[i][index + k] = true; + } + } + } + }; + + var getScrollBarWidth = function () { + if (cachedWidth === null) { + var inner = $('

    ').addClass('fixed-table-scroll-inner'), + outer = $('

    ').addClass('fixed-table-scroll-outer'), + w1, w2; + + outer.append(inner); + $('body').append(outer); + + w1 = inner[0].offsetWidth; + outer.css('overflow', 'scroll'); + w2 = inner[0].offsetWidth; + + if (w1 === w2) { + w2 = outer[0].clientWidth; + } + + outer.remove(); + cachedWidth = w1 - w2; + } + return cachedWidth; + }; + + var calculateObjectValue = function (self, name, args, defaultValue) { + var func = name; + + if (typeof name === 'string') { + // support obj.func1.func2 + var names = name.split('.'); + + if (names.length > 1) { + func = window; + $.each(names, function (i, f) { + func = func[f]; + }); + } else { + func = window[name]; + } + } + if (typeof func === 'object') { + return func; + } + if (typeof func === 'function') { + return func.apply(self, args || []); + } + if (!func && typeof name === 'string' && sprintf.apply(this, [name].concat(args))) { + return sprintf.apply(this, [name].concat(args)); + } + return defaultValue; + }; + + var compareObjects = function (objectA, objectB, compareLength) { + // Create arrays of property names + var objectAProperties = Object.getOwnPropertyNames(objectA), + objectBProperties = Object.getOwnPropertyNames(objectB), + propName = ''; + + if (compareLength) { + // If number of properties is different, objects are not equivalent + if (objectAProperties.length !== objectBProperties.length) { + return false; + } + } + + for (var i = 0; i < objectAProperties.length; i++) { + propName = objectAProperties[i]; + + // If the property is not in the object B properties, continue with the next property + if ($.inArray(propName, objectBProperties) > -1) { + // If values of same property are not equal, objects are not equivalent + if (objectA[propName] !== objectB[propName]) { + return false; + } + } + } + + // If we made it this far, objects are considered equivalent + return true; + }; + + var escapeHTML = function (text) { + if (typeof text === 'string') { + return text + .replace(/&/g, '&') + .replace(//g, '>') + .replace(/"/g, '"') + .replace(/'/g, ''') + .replace(/`/g, '`'); + } + return text; + }; + + var getRealDataAttr = function (dataAttr) { + for (var attr in dataAttr) { + var auxAttr = attr.split(/(?=[A-Z])/).join('-').toLowerCase(); + if (auxAttr !== attr) { + dataAttr[auxAttr] = dataAttr[attr]; + delete dataAttr[attr]; + } + } + + return dataAttr; + }; + + var getItemField = function (item, field, escape) { + var value = item; + + if (typeof field !== 'string' || item.hasOwnProperty(field)) { + return escape ? escapeHTML(item[field]) : item[field]; + } + var props = field.split('.'); + for (var p in props) { + if (props.hasOwnProperty(p)) { + value = value && value[props[p]]; + } + } + return escape ? escapeHTML(value) : value; + }; + + var isIEBrowser = function () { + return !!(navigator.userAgent.indexOf("MSIE ") > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./)); + }; + + var objectKeys = function () { + // From https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys + if (!Object.keys) { + Object.keys = (function() { + var hasOwnProperty = Object.prototype.hasOwnProperty, + hasDontEnumBug = !({ toString: null }).propertyIsEnumerable('toString'), + dontEnums = [ + 'toString', + 'toLocaleString', + 'valueOf', + 'hasOwnProperty', + 'isPrototypeOf', + 'propertyIsEnumerable', + 'constructor' + ], + dontEnumsLength = dontEnums.length; + + return function(obj) { + if (typeof obj !== 'object' && (typeof obj !== 'function' || obj === null)) { + throw new TypeError('Object.keys called on non-object'); + } + + var result = [], prop, i; + + for (prop in obj) { + if (hasOwnProperty.call(obj, prop)) { + result.push(prop); + } + } + + if (hasDontEnumBug) { + for (i = 0; i < dontEnumsLength; i++) { + if (hasOwnProperty.call(obj, dontEnums[i])) { + result.push(dontEnums[i]); + } + } + } + return result; + }; + }()); + } + }; + + // BOOTSTRAP TABLE CLASS DEFINITION + // ====================== + + var BootstrapTable = function (el, options) { + this.options = options; + this.$el = $(el); + this.$el_ = this.$el.clone(); + this.timeoutId_ = 0; + this.timeoutFooter_ = 0; + + this.init(); + }; + + BootstrapTable.DEFAULTS = { + classes: 'table table-hover', + sortClass: undefined, + locale: undefined, + height: undefined, + undefinedText: '-', + sortName: undefined, + sortOrder: 'asc', + sortStable: false, + striped: false, + columns: [[]], + data: [], + totalField: 'total', + dataField: 'rows', + method: 'get', + url: undefined, + ajax: undefined, + cache: true, + contentType: 'application/json', + dataType: 'json', + ajaxOptions: {}, + queryParams: function (params) { + return params; + }, + queryParamsType: 'limit', // undefined + responseHandler: function (res) { + return res; + }, + pagination: false, + onlyInfoPagination: false, + paginationLoop: true, + sidePagination: 'client', // client or server + totalRows: 0, // server side need to set + pageNumber: 1, + pageSize: 10, + pageList: [10, 25, 50, 100], + paginationHAlign: 'right', //right, left + paginationVAlign: 'bottom', //bottom, top, both + paginationDetailHAlign: 'left', //right, left + paginationPreText: '‹', + paginationNextText: '›', + search: false, + searchOnEnterKey: false, + strictSearch: false, + searchAlign: 'right', + selectItemName: 'btSelectItem', + showHeader: true, + showFooter: false, + showColumns: false, + showPaginationSwitch: false, + showRefresh: false, + showToggle: false, + buttonsAlign: 'right', + smartDisplay: true, + escape: false, + minimumCountColumns: 1, + idField: undefined, + uniqueId: undefined, + cardView: false, + detailView: false, + detailFormatter: function (index, row) { + return ''; + }, + trimOnSearch: true, + clickToSelect: false, + singleSelect: false, + toolbar: undefined, + toolbarAlign: 'left', + checkboxHeader: true, + sortable: true, + silentSort: true, + maintainSelected: false, + searchTimeOut: 500, + searchText: '', + iconSize: undefined, + buttonsClass: 'default', + iconsPrefix: 'glyphicon', // glyphicon of fa (font awesome) + icons: { + paginationSwitchDown: 'glyphicon-collapse-down icon-chevron-down', + paginationSwitchUp: 'glyphicon-collapse-up icon-chevron-up', + refresh: 'glyphicon-refresh icon-refresh', + toggle: 'glyphicon-list-alt icon-list-alt', + columns: 'glyphicon-th icon-th', + detailOpen: 'glyphicon-plus icon-plus', + detailClose: 'glyphicon-minus icon-minus' + }, + + customSearch: $.noop, + + customSort: $.noop, + + rowStyle: function (row, index) { + return {}; + }, + + rowAttributes: function (row, index) { + return {}; + }, + + footerStyle: function (row, index) { + return {}; + }, + + onAll: function (name, args) { + return false; + }, + onClickCell: function (field, value, row, $element) { + return false; + }, + onDblClickCell: function (field, value, row, $element) { + return false; + }, + onClickRow: function (item, $element) { + return false; + }, + onDblClickRow: function (item, $element) { + return false; + }, + onSort: function (name, order) { + return false; + }, + onCheck: function (row) { + return false; + }, + onUncheck: function (row) { + return false; + }, + onCheckAll: function (rows) { + return false; + }, + onUncheckAll: function (rows) { + return false; + }, + onCheckSome: function (rows) { + return false; + }, + onUncheckSome: function (rows) { + return false; + }, + onLoadSuccess: function (data) { + return false; + }, + onLoadError: function (status) { + return false; + }, + onColumnSwitch: function (field, checked) { + return false; + }, + onPageChange: function (number, size) { + return false; + }, + onSearch: function (text) { + return false; + }, + onToggle: function (cardView) { + return false; + }, + onPreBody: function (data) { + return false; + }, + onPostBody: function () { + return false; + }, + onPostHeader: function () { + return false; + }, + onExpandRow: function (index, row, $detail) { + return false; + }, + onCollapseRow: function (index, row) { + return false; + }, + onRefreshOptions: function (options) { + return false; + }, + onRefresh: function (params) { + return false; + }, + onResetView: function () { + return false; + } + }; + + BootstrapTable.LOCALES = {}; + + BootstrapTable.LOCALES['en-US'] = BootstrapTable.LOCALES.en = { + formatLoadingMessage: function () { + return 'Loading, please wait...'; + }, + formatRecordsPerPage: function (pageNumber) { + return sprintf('%s rows per page', pageNumber); + }, + formatShowingRows: function (pageFrom, pageTo, totalRows) { + return sprintf('Showing %s to %s of %s rows', pageFrom, pageTo, totalRows); + }, + formatDetailPagination: function (totalRows) { + return sprintf('Showing %s rows', totalRows); + }, + formatSearch: function () { + return 'Search'; + }, + formatNoMatches: function () { + return 'No matching records found'; + }, + formatPaginationSwitch: function () { + return 'Hide/Show pagination'; + }, + formatRefresh: function () { + return 'Refresh'; + }, + formatToggle: function () { + return 'Toggle'; + }, + formatColumns: function () { + return 'Columns'; + }, + formatAllRows: function () { + return 'All'; + } + }; + + $.extend(BootstrapTable.DEFAULTS, BootstrapTable.LOCALES['en-US']); + + BootstrapTable.COLUMN_DEFAULTS = { + radio: false, + checkbox: false, + checkboxEnabled: true, + field: undefined, + title: undefined, + titleTooltip: undefined, + 'class': undefined, + align: undefined, // left, right, center + halign: undefined, // left, right, center + falign: undefined, // left, right, center + valign: undefined, // top, middle, bottom + width: undefined, + sortable: false, + order: 'asc', // asc, desc + visible: true, + switchable: true, + clickToSelect: true, + formatter: undefined, + footerFormatter: undefined, + events: undefined, + sorter: undefined, + sortName: undefined, + cellStyle: undefined, + searchable: true, + searchFormatter: true, + cardVisible: true, + escape : false + }; + + BootstrapTable.EVENTS = { + 'all.bs.table': 'onAll', + 'click-cell.bs.table': 'onClickCell', + 'dbl-click-cell.bs.table': 'onDblClickCell', + 'click-row.bs.table': 'onClickRow', + 'dbl-click-row.bs.table': 'onDblClickRow', + 'sort.bs.table': 'onSort', + 'check.bs.table': 'onCheck', + 'uncheck.bs.table': 'onUncheck', + 'check-all.bs.table': 'onCheckAll', + 'uncheck-all.bs.table': 'onUncheckAll', + 'check-some.bs.table': 'onCheckSome', + 'uncheck-some.bs.table': 'onUncheckSome', + 'load-success.bs.table': 'onLoadSuccess', + 'load-error.bs.table': 'onLoadError', + 'column-switch.bs.table': 'onColumnSwitch', + 'page-change.bs.table': 'onPageChange', + 'search.bs.table': 'onSearch', + 'toggle.bs.table': 'onToggle', + 'pre-body.bs.table': 'onPreBody', + 'post-body.bs.table': 'onPostBody', + 'post-header.bs.table': 'onPostHeader', + 'expand-row.bs.table': 'onExpandRow', + 'collapse-row.bs.table': 'onCollapseRow', + 'refresh-options.bs.table': 'onRefreshOptions', + 'reset-view.bs.table': 'onResetView', + 'refresh.bs.table': 'onRefresh' + }; + + BootstrapTable.prototype.init = function () { + this.initLocale(); + this.initContainer(); + this.initTable(); + this.initHeader(); + this.initData(); + this.initHiddenRows(); + this.initFooter(); + this.initToolbar(); + this.initPagination(); + this.initBody(); + this.initSearchText(); + this.initServer(); + }; + + BootstrapTable.prototype.initLocale = function () { + if (this.options.locale) { + var parts = this.options.locale.split(/-|_/); + parts[0].toLowerCase(); + if (parts[1]) parts[1].toUpperCase(); + if ($.fn.bootstrapTable.locales[this.options.locale]) { + // locale as requested + $.extend(this.options, $.fn.bootstrapTable.locales[this.options.locale]); + } else if ($.fn.bootstrapTable.locales[parts.join('-')]) { + // locale with sep set to - (in case original was specified with _) + $.extend(this.options, $.fn.bootstrapTable.locales[parts.join('-')]); + } else if ($.fn.bootstrapTable.locales[parts[0]]) { + // short locale language code (i.e. 'en') + $.extend(this.options, $.fn.bootstrapTable.locales[parts[0]]); + } + } + }; + + BootstrapTable.prototype.initContainer = function () { + this.$container = $([ + '
    ', + '
    ', + this.options.paginationVAlign === 'top' || this.options.paginationVAlign === 'both' ? + '
    ' : + '', + '
    ', + '
    ', + '
    ', + '
    ', + this.options.formatLoadingMessage(), + '
    ', + '
    ', + '', + this.options.paginationVAlign === 'bottom' || this.options.paginationVAlign === 'both' ? + '
    ' : + '', + '
    ', + '
    ' + ].join('')); + + this.$container.insertAfter(this.$el); + this.$tableContainer = this.$container.find('.fixed-table-container'); + this.$tableHeader = this.$container.find('.fixed-table-header'); + this.$tableBody = this.$container.find('.fixed-table-body'); + this.$tableLoading = this.$container.find('.fixed-table-loading'); + this.$tableFooter = this.$container.find('.fixed-table-footer'); + this.$toolbar = this.$container.find('.fixed-table-toolbar'); + this.$pagination = this.$container.find('.fixed-table-pagination'); + + this.$tableBody.append(this.$el); + this.$container.after('
    '); + + this.$el.addClass(this.options.classes); + if (this.options.striped) { + this.$el.addClass('table-striped'); + } + if ($.inArray('table-no-bordered', this.options.classes.split(' ')) !== -1) { + this.$tableContainer.addClass('table-no-bordered'); + } + }; + + BootstrapTable.prototype.initTable = function () { + var that = this, + columns = [], + data = []; + + this.$header = this.$el.find('>thead'); + if (!this.$header.length) { + this.$header = $('').appendTo(this.$el); + } + this.$header.find('tr').each(function () { + var column = []; + + $(this).find('th').each(function () { + // Fix #2014 - getFieldIndex and elsewhere assume this is string, causes issues if not + if (typeof $(this).data('field') !== 'undefined') { + $(this).data('field', $(this).data('field') + ''); + } + column.push($.extend({}, { + title: $(this).html(), + 'class': $(this).attr('class'), + titleTooltip: $(this).attr('title'), + rowspan: $(this).attr('rowspan') ? +$(this).attr('rowspan') : undefined, + colspan: $(this).attr('colspan') ? +$(this).attr('colspan') : undefined + }, $(this).data())); + }); + columns.push(column); + }); + if (!$.isArray(this.options.columns[0])) { + this.options.columns = [this.options.columns]; + } + this.options.columns = $.extend(true, [], columns, this.options.columns); + this.columns = []; + + setFieldIndex(this.options.columns); + $.each(this.options.columns, function (i, columns) { + $.each(columns, function (j, column) { + column = $.extend({}, BootstrapTable.COLUMN_DEFAULTS, column); + + if (typeof column.fieldIndex !== 'undefined') { + that.columns[column.fieldIndex] = column; + } + + that.options.columns[i][j] = column; + }); + }); + + // if options.data is setting, do not process tbody data + if (this.options.data.length) { + return; + } + + var m = []; + this.$el.find('>tbody>tr').each(function (y) { + var row = {}; + + // save tr's id, class and data-* attributes + row._id = $(this).attr('id'); + row._class = $(this).attr('class'); + row._data = getRealDataAttr($(this).data()); + + $(this).find('>td').each(function (x) { + var $this = $(this), + cspan = +$this.attr('colspan') || 1, + rspan = +$this.attr('rowspan') || 1, + tx, ty; + + for (; m[y] && m[y][x]; x++); //skip already occupied cells in current row + + for (tx = x; tx < x + cspan; tx++) { //mark matrix elements occupied by current cell with true + for (ty = y; ty < y + rspan; ty++) { + if (!m[ty]) { //fill missing rows + m[ty] = []; + } + m[ty][tx] = true; + } + } + + var field = that.columns[x].field; + + row[field] = $(this).html(); + // save td's id, class and data-* attributes + row['_' + field + '_id'] = $(this).attr('id'); + row['_' + field + '_class'] = $(this).attr('class'); + row['_' + field + '_rowspan'] = $(this).attr('rowspan'); + row['_' + field + '_colspan'] = $(this).attr('colspan'); + row['_' + field + '_title'] = $(this).attr('title'); + row['_' + field + '_data'] = getRealDataAttr($(this).data()); + }); + data.push(row); + }); + this.options.data = data; + if (data.length) this.fromHtml = true; + }; + + BootstrapTable.prototype.initHeader = function () { + var that = this, + visibleColumns = {}, + html = []; + + this.header = { + fields: [], + styles: [], + classes: [], + formatters: [], + events: [], + sorters: [], + sortNames: [], + cellStyles: [], + searchables: [] + }; + + $.each(this.options.columns, function (i, columns) { + html.push(''); + + if (i === 0 && !that.options.cardView && that.options.detailView) { + html.push(sprintf('
    ', + that.options.columns.length)); + } + + $.each(columns, function (j, column) { + var text = '', + halign = '', // header align style + align = '', // body align style + style = '', + class_ = sprintf(' class="%s"', column['class']), + order = that.options.sortOrder || column.order, + unitWidth = 'px', + width = column.width; + + if (column.width !== undefined && (!that.options.cardView)) { + if (typeof column.width === 'string') { + if (column.width.indexOf('%') !== -1) { + unitWidth = '%'; + } + } + } + if (column.width && typeof column.width === 'string') { + width = column.width.replace('%', '').replace('px', ''); + } + + halign = sprintf('text-align: %s; ', column.halign ? column.halign : column.align); + align = sprintf('text-align: %s; ', column.align); + style = sprintf('vertical-align: %s; ', column.valign); + style += sprintf('width: %s; ', (column.checkbox || column.radio) && !width ? + '36px' : (width ? width + unitWidth : undefined)); + + if (typeof column.fieldIndex !== 'undefined') { + that.header.fields[column.fieldIndex] = column.field; + that.header.styles[column.fieldIndex] = align + style; + that.header.classes[column.fieldIndex] = class_; + that.header.formatters[column.fieldIndex] = column.formatter; + that.header.events[column.fieldIndex] = column.events; + that.header.sorters[column.fieldIndex] = column.sorter; + that.header.sortNames[column.fieldIndex] = column.sortName; + that.header.cellStyles[column.fieldIndex] = column.cellStyle; + that.header.searchables[column.fieldIndex] = column.searchable; + + if (!column.visible) { + return; + } + + if (that.options.cardView && (!column.cardVisible)) { + return; + } + + visibleColumns[column.field] = column; + } + + html.push(''); + + html.push(sprintf('
    ', that.options.sortable && column.sortable ? + 'sortable both' : '')); + + text = that.options.escape ? escapeHTML(column.title) : column.title; + + if (column.checkbox) { + if (!that.options.singleSelect && that.options.checkboxHeader) { + text = ''; + } + that.header.stateField = column.field; + } + if (column.radio) { + text = ''; + that.header.stateField = column.field; + that.options.singleSelect = true; + } + + html.push(text); + html.push('
    '); + html.push('
    '); + html.push('
    '); + html.push(''); + }); + html.push(''); + }); + + this.$header.html(html.join('')); + this.$header.find('th[data-field]').each(function (i) { + $(this).data(visibleColumns[$(this).data('field')]); + }); + this.$container.off('click', '.th-inner').on('click', '.th-inner', function (event) { + var target = $(this); + + if (that.options.detailView) { + if (target.closest('.bootstrap-table')[0] !== that.$container[0]) + return false; + } + + if (that.options.sortable && target.parent().data().sortable) { + that.onSort(event); + } + }); + + this.$header.children().children().off('keypress').on('keypress', function (event) { + if (that.options.sortable && $(this).data().sortable) { + var code = event.keyCode || event.which; + if (code == 13) { //Enter keycode + that.onSort(event); + } + } + }); + + $(window).off('resize.bootstrap-table'); + if (!this.options.showHeader || this.options.cardView) { + this.$header.hide(); + this.$tableHeader.hide(); + this.$tableLoading.css('top', 0); + } else { + this.$header.show(); + this.$tableHeader.show(); + this.$tableLoading.css('top', this.$header.outerHeight() + 1); + // Assign the correct sortable arrow + this.getCaret(); + $(window).on('resize.bootstrap-table', $.proxy(this.resetWidth, this)); + } + + this.$selectAll = this.$header.find('[name="btSelectAll"]'); + this.$selectAll.off('click').on('click', function () { + var checked = $(this).prop('checked'); + that[checked ? 'checkAll' : 'uncheckAll'](); + that.updateSelected(); + }); + }; + + BootstrapTable.prototype.initFooter = function () { + if (!this.options.showFooter || this.options.cardView) { + this.$tableFooter.hide(); + } else { + this.$tableFooter.show(); + } + }; + + /** + * @param data + * @param type: append / prepend + */ + BootstrapTable.prototype.initData = function (data, type) { + if (type === 'append') { + this.data = this.data.concat(data); + } else if (type === 'prepend') { + this.data = [].concat(data).concat(this.data); + } else { + this.data = data || this.options.data; + } + + // Fix #839 Records deleted when adding new row on filtered table + if (type === 'append') { + this.options.data = this.options.data.concat(data); + } else if (type === 'prepend') { + this.options.data = [].concat(data).concat(this.options.data); + } else { + this.options.data = this.data; + } + + if (this.options.sidePagination === 'server') { + return; + } + this.initSort(); + }; + + BootstrapTable.prototype.initSort = function () { + var that = this, + name = this.options.sortName, + order = this.options.sortOrder === 'desc' ? -1 : 1, + index = $.inArray(this.options.sortName, this.header.fields), + timeoutId = 0; + + if (this.options.customSort !== $.noop) { + this.options.customSort.apply(this, [this.options.sortName, this.options.sortOrder]); + return; + } + + if (index !== -1) { + if (this.options.sortStable) { + $.each(this.data, function (i, row) { + if (!row.hasOwnProperty('_position')) row._position = i; + }); + } + + this.data.sort(function (a, b) { + if (that.header.sortNames[index]) { + name = that.header.sortNames[index]; + } + var aa = getItemField(a, name, that.options.escape), + bb = getItemField(b, name, that.options.escape), + value = calculateObjectValue(that.header, that.header.sorters[index], [aa, bb]); + + if (value !== undefined) { + return order * value; + } + + // Fix #161: undefined or null string sort bug. + if (aa === undefined || aa === null) { + aa = ''; + } + if (bb === undefined || bb === null) { + bb = ''; + } + + if (that.options.sortStable && aa === bb) { + aa = a._position; + bb = b._position; + } + + // IF both values are numeric, do a numeric comparison + if ($.isNumeric(aa) && $.isNumeric(bb)) { + // Convert numerical values form string to float. + aa = parseFloat(aa); + bb = parseFloat(bb); + if (aa < bb) { + return order * -1; + } + return order; + } + + if (aa === bb) { + return 0; + } + + // If value is not a string, convert to string + if (typeof aa !== 'string') { + aa = aa.toString(); + } + + if (aa.localeCompare(bb) === -1) { + return order * -1; + } + + return order; + }); + + if (this.options.sortClass !== undefined) { + clearTimeout(timeoutId); + timeoutId = setTimeout(function () { + that.$el.removeClass(that.options.sortClass); + var index = that.$header.find(sprintf('[data-field="%s"]', + that.options.sortName).index() + 1); + that.$el.find(sprintf('tr td:nth-child(%s)', index)) + .addClass(that.options.sortClass); + }, 250); + } + } + }; + + BootstrapTable.prototype.onSort = function (event) { + var $this = event.type === "keypress" ? $(event.currentTarget) : $(event.currentTarget).parent(), + $this_ = this.$header.find('th').eq($this.index()); + + this.$header.add(this.$header_).find('span.order').remove(); + + if (this.options.sortName === $this.data('field')) { + this.options.sortOrder = this.options.sortOrder === 'asc' ? 'desc' : 'asc'; + } else { + this.options.sortName = $this.data('field'); + this.options.sortOrder = $this.data('order') === 'asc' ? 'desc' : 'asc'; + } + this.trigger('sort', this.options.sortName, this.options.sortOrder); + + $this.add($this_).data('order', this.options.sortOrder); + + // Assign the correct sortable arrow + this.getCaret(); + + if (this.options.sidePagination === 'server') { + this.initServer(this.options.silentSort); + return; + } + + this.initSort(); + this.initBody(); + }; + + BootstrapTable.prototype.initToolbar = function () { + var that = this, + html = [], + timeoutId = 0, + $keepOpen, + $search, + switchableCount = 0; + + if (this.$toolbar.find('.bs-bars').children().length) { + $('body').append($(this.options.toolbar)); + } + this.$toolbar.html(''); + + if (typeof this.options.toolbar === 'string' || typeof this.options.toolbar === 'object') { + $(sprintf('
    ', this.options.toolbarAlign)) + .appendTo(this.$toolbar) + .append($(this.options.toolbar)); + } + + // showColumns, showToggle, showRefresh + html = [sprintf('
    ', + this.options.buttonsAlign, this.options.buttonsAlign)]; + + if (typeof this.options.icons === 'string') { + this.options.icons = calculateObjectValue(null, this.options.icons); + } + + if (this.options.showPaginationSwitch) { + html.push(sprintf(''); + } + + if (this.options.showRefresh) { + html.push(sprintf(''); + } + + if (this.options.showToggle) { + html.push(sprintf(''); + } + + if (this.options.showColumns) { + html.push(sprintf('
    ', + this.options.formatColumns()), + '', + '', + '
    '); + } + + html.push('
    '); + + // Fix #188: this.showToolbar is for extensions + if (this.showToolbar || html.length > 2) { + this.$toolbar.append(html.join('')); + } + + if (this.options.showPaginationSwitch) { + this.$toolbar.find('button[name="paginationSwitch"]') + .off('click').on('click', $.proxy(this.togglePagination, this)); + } + + if (this.options.showRefresh) { + this.$toolbar.find('button[name="refresh"]') + .off('click').on('click', $.proxy(this.refresh, this)); + } + + if (this.options.showToggle) { + this.$toolbar.find('button[name="toggle"]') + .off('click').on('click', function () { + that.toggleView(); + }); + } + + if (this.options.showColumns) { + $keepOpen = this.$toolbar.find('.keep-open'); + + if (switchableCount <= this.options.minimumCountColumns) { + $keepOpen.find('input').prop('disabled', true); + } + + $keepOpen.find('li').off('click').on('click', function (event) { + event.stopImmediatePropagation(); + }); + $keepOpen.find('input').off('click').on('click', function () { + var $this = $(this); + + that.toggleColumn($(this).val(), $this.prop('checked'), false); + that.trigger('column-switch', $(this).data('field'), $this.prop('checked')); + }); + } + + if (this.options.search) { + html = []; + html.push( + ''); + + this.$toolbar.append(html.join('')); + $search = this.$toolbar.find('.search input'); + $search.off('keyup drop blur').on('keyup drop blur', function (event) { + if (that.options.searchOnEnterKey && event.keyCode !== 13) { + return; + } + + if ($.inArray(event.keyCode, [37, 38, 39, 40]) > -1) { + return; + } + + clearTimeout(timeoutId); // doesn't matter if it's 0 + timeoutId = setTimeout(function () { + that.onSearch(event); + }, that.options.searchTimeOut); + }); + + if (isIEBrowser()) { + $search.off('mouseup').on('mouseup', function (event) { + clearTimeout(timeoutId); // doesn't matter if it's 0 + timeoutId = setTimeout(function () { + that.onSearch(event); + }, that.options.searchTimeOut); + }); + } + } + }; + + BootstrapTable.prototype.onSearch = function (event) { + var text = $.trim($(event.currentTarget).val()); + + // trim search input + if (this.options.trimOnSearch && $(event.currentTarget).val() !== text) { + $(event.currentTarget).val(text); + } + + if (text === this.searchText) { + return; + } + this.searchText = text; + this.options.searchText = text; + + this.options.pageNumber = 1; + this.initSearch(); + this.updatePagination(); + this.trigger('search', text); + }; + + BootstrapTable.prototype.initSearch = function () { + var that = this; + + if (this.options.sidePagination !== 'server') { + if (this.options.customSearch !== $.noop) { + this.options.customSearch.apply(this, [this.searchText]); + return; + } + + var s = this.searchText && (this.options.escape ? + escapeHTML(this.searchText) : this.searchText).toLowerCase(); + var f = $.isEmptyObject(this.filterColumns) ? null : this.filterColumns; + + // Check filter + this.data = f ? $.grep(this.options.data, function (item, i) { + for (var key in f) { + if ($.isArray(f[key]) && $.inArray(item[key], f[key]) === -1 || + !$.isArray(f[key]) && item[key] !== f[key]) { + return false; + } + } + return true; + }) : this.options.data; + + this.data = s ? $.grep(this.data, function (item, i) { + for (var j = 0; j < that.header.fields.length; j++) { + + if (!that.header.searchables[j]) { + continue; + } + + var key = $.isNumeric(that.header.fields[j]) ? parseInt(that.header.fields[j], 10) : that.header.fields[j]; + var column = that.columns[getFieldIndex(that.columns, key)]; + var value; + + if (typeof key === 'string') { + value = item; + var props = key.split('.'); + for (var prop_index = 0; prop_index < props.length; prop_index++) { + value = value[props[prop_index]]; + } + + // Fix #142: respect searchForamtter boolean + if (column && column.searchFormatter) { + value = calculateObjectValue(column, + that.header.formatters[j], [value, item, i], value); + } + } else { + value = item[key]; + } + + if (typeof value === 'string' || typeof value === 'number') { + if (that.options.strictSearch) { + if ((value + '').toLowerCase() === s) { + return true; + } + } else { + if ((value + '').toLowerCase().indexOf(s) !== -1) { + return true; + } + } + } + } + return false; + }) : this.data; + } + }; + + BootstrapTable.prototype.initPagination = function () { + if (!this.options.pagination) { + this.$pagination.hide(); + return; + } else { + this.$pagination.show(); + } + + var that = this, + html = [], + $allSelected = false, + i, from, to, + $pageList, + $first, $pre, + $next, $last, + $number, + data = this.getData(), + pageList = this.options.pageList; + + if (this.options.sidePagination !== 'server') { + this.options.totalRows = data.length; + } + + this.totalPages = 0; + if (this.options.totalRows) { + if (this.options.pageSize === this.options.formatAllRows()) { + this.options.pageSize = this.options.totalRows; + $allSelected = true; + } else if (this.options.pageSize === this.options.totalRows) { + // Fix #667 Table with pagination, + // multiple pages and a search that matches to one page throws exception + var pageLst = typeof this.options.pageList === 'string' ? + this.options.pageList.replace('[', '').replace(']', '') + .replace(/ /g, '').toLowerCase().split(',') : this.options.pageList; + if ($.inArray(this.options.formatAllRows().toLowerCase(), pageLst) > -1) { + $allSelected = true; + } + } + + this.totalPages = ~~((this.options.totalRows - 1) / this.options.pageSize) + 1; + + this.options.totalPages = this.totalPages; + } + if (this.totalPages > 0 && this.options.pageNumber > this.totalPages) { + this.options.pageNumber = this.totalPages; + } + + this.pageFrom = (this.options.pageNumber - 1) * this.options.pageSize + 1; + this.pageTo = this.options.pageNumber * this.options.pageSize; + if (this.pageTo > this.options.totalRows) { + this.pageTo = this.options.totalRows; + } + + html.push( + '
    ', + '', + this.options.onlyInfoPagination ? this.options.formatDetailPagination(this.options.totalRows) : + this.options.formatShowingRows(this.pageFrom, this.pageTo, this.options.totalRows), + ''); + + if (!this.options.onlyInfoPagination) { + html.push(''); + + var pageNumber = [ + sprintf('', + this.options.paginationVAlign === 'top' || this.options.paginationVAlign === 'both' ? + 'dropdown' : 'dropup'), + '', + ''); + + html.push(this.options.formatRecordsPerPage(pageNumber.join(''))); + html.push(''); + + html.push('
    ', + ''); + } + this.$pagination.html(html.join('')); + + if (!this.options.onlyInfoPagination) { + $pageList = this.$pagination.find('.page-list a'); + $first = this.$pagination.find('.page-first'); + $pre = this.$pagination.find('.page-pre'); + $next = this.$pagination.find('.page-next'); + $last = this.$pagination.find('.page-last'); + $number = this.$pagination.find('.page-number'); + + if (this.options.smartDisplay) { + if (this.totalPages <= 1) { + this.$pagination.find('div.pagination').hide(); + } + if (pageList.length < 2 || this.options.totalRows <= pageList[0]) { + this.$pagination.find('span.page-list').hide(); + } + + // when data is empty, hide the pagination + this.$pagination[this.getData().length ? 'show' : 'hide'](); + } + + if (!this.options.paginationLoop) { + if (this.options.pageNumber === 1) { + $pre.addClass('disabled'); + } + if (this.options.pageNumber === this.totalPages) { + $next.addClass('disabled'); + } + } + + if ($allSelected) { + this.options.pageSize = this.options.formatAllRows(); + } + $pageList.off('click').on('click', $.proxy(this.onPageListChange, this)); + $first.off('click').on('click', $.proxy(this.onPageFirst, this)); + $pre.off('click').on('click', $.proxy(this.onPagePre, this)); + $next.off('click').on('click', $.proxy(this.onPageNext, this)); + $last.off('click').on('click', $.proxy(this.onPageLast, this)); + $number.off('click').on('click', $.proxy(this.onPageNumber, this)); + } + }; + + BootstrapTable.prototype.updatePagination = function (event) { + // Fix #171: IE disabled button can be clicked bug. + if (event && $(event.currentTarget).hasClass('disabled')) { + return; + } + + if (!this.options.maintainSelected) { + this.resetRows(); + } + + this.initPagination(); + if (this.options.sidePagination === 'server') { + this.initServer(); + } else { + this.initBody(); + } + + this.trigger('page-change', this.options.pageNumber, this.options.pageSize); + }; + + BootstrapTable.prototype.onPageListChange = function (event) { + var $this = $(event.currentTarget); + + $this.parent().addClass('active').siblings().removeClass('active'); + this.options.pageSize = $this.text().toUpperCase() === this.options.formatAllRows().toUpperCase() ? + this.options.formatAllRows() : +$this.text(); + this.$toolbar.find('.page-size').text(this.options.pageSize); + + this.updatePagination(event); + return false; + }; + + BootstrapTable.prototype.onPageFirst = function (event) { + this.options.pageNumber = 1; + this.updatePagination(event); + return false; + }; + + BootstrapTable.prototype.onPagePre = function (event) { + if ((this.options.pageNumber - 1) === 0) { + this.options.pageNumber = this.options.totalPages; + } else { + this.options.pageNumber--; + } + this.updatePagination(event); + return false; + }; + + BootstrapTable.prototype.onPageNext = function (event) { + if ((this.options.pageNumber + 1) > this.options.totalPages) { + this.options.pageNumber = 1; + } else { + this.options.pageNumber++; + } + this.updatePagination(event); + return false; + }; + + BootstrapTable.prototype.onPageLast = function (event) { + this.options.pageNumber = this.totalPages; + this.updatePagination(event); + return false; + }; + + BootstrapTable.prototype.onPageNumber = function (event) { + if (this.options.pageNumber === +$(event.currentTarget).text()) { + return; + } + this.options.pageNumber = +$(event.currentTarget).text(); + this.updatePagination(event); + return false; + }; + + BootstrapTable.prototype.initRow = function(item, i, data, parentDom) { + var that=this, + key, + html = [], + style = {}, + csses = [], + data_ = '', + attributes = {}, + htmlAttributes = []; + + if ($.inArray(item, this.hiddenRows) > -1) { + return; + } + + style = calculateObjectValue(this.options, this.options.rowStyle, [item, i], style); + + if (style && style.css) { + for (key in style.css) { + csses.push(key + ': ' + style.css[key]); + } + } + + attributes = calculateObjectValue(this.options, + this.options.rowAttributes, [item, i], attributes); + + if (attributes) { + for (key in attributes) { + htmlAttributes.push(sprintf('%s="%s"', key, escapeHTML(attributes[key]))); + } + } + + if (item._data && !$.isEmptyObject(item._data)) { + $.each(item._data, function(k, v) { + // ignore data-index + if (k === 'index') { + return; + } + data_ += sprintf(' data-%s="%s"', k, v); + }); + } + + html.push('' + ); + + if (this.options.cardView) { + html.push(sprintf('
    ', this.header.fields.length)); + } + + if (!this.options.cardView && this.options.detailView) { + html.push('', + '', + sprintf('', this.options.iconsPrefix, this.options.icons.detailOpen), + '', + ''); + } + + $.each(this.header.fields, function(j, field) { + var text = '', + value_ = getItemField(item, field, that.options.escape), + value = '', + type = '', + cellStyle = {}, + id_ = '', + class_ = that.header.classes[j], + data_ = '', + rowspan_ = '', + colspan_ = '', + title_ = '', + column = that.columns[j]; + + if (that.fromHtml && typeof value_ === 'undefined') { + return; + } + + if (!column.visible) { + return; + } + + if (that.options.cardView && (!column.cardVisible)) { + return; + } + + if (column.escape) { + value_ = escapeHTML(value_); + } + + style = sprintf('style="%s"', csses.concat(that.header.styles[j]).join('; ')); + + // handle td's id and class + if (item['_' + field + '_id']) { + id_ = sprintf(' id="%s"', item['_' + field + '_id']); + } + if (item['_' + field + '_class']) { + class_ = sprintf(' class="%s"', item['_' + field + '_class']); + } + if (item['_' + field + '_rowspan']) { + rowspan_ = sprintf(' rowspan="%s"', item['_' + field + '_rowspan']); + } + if (item['_' + field + '_colspan']) { + colspan_ = sprintf(' colspan="%s"', item['_' + field + '_colspan']); + } + if (item['_' + field + '_title']) { + title_ = sprintf(' title="%s"', item['_' + field + '_title']); + } + cellStyle = calculateObjectValue(that.header, + that.header.cellStyles[j], [value_, item, i, field], cellStyle); + if (cellStyle.classes) { + class_ = sprintf(' class="%s"', cellStyle.classes); + } + if (cellStyle.css) { + var csses_ = []; + for (var key in cellStyle.css) { + csses_.push(key + ': ' + cellStyle.css[key]); + } + style = sprintf('style="%s"', csses_.concat(that.header.styles[j]).join('; ')); + } + + value = calculateObjectValue(column, + that.header.formatters[j], [value_, item, i], value_); + + if (item['_' + field + '_data'] && !$.isEmptyObject(item['_' + field + '_data'])) { + $.each(item['_' + field + '_data'], function(k, v) { + // ignore data-index + if (k === 'index') { + return; + } + data_ += sprintf(' data-%s="%s"', k, v); + }); + } + + if (column.checkbox || column.radio) { + type = column.checkbox ? 'checkbox' : type; + type = column.radio ? 'radio' : type; + + text = [sprintf(that.options.cardView ? + '
    ' : '', column['class'] || ''), + '', + that.header.formatters[j] && typeof value === 'string' ? value : '', + that.options.cardView ? '
    ' : '' + ].join(''); + + item[that.header.stateField] = value === true || (value && value.checked); + } else { + value = typeof value === 'undefined' || value === null ? + that.options.undefinedText : value; + + text = that.options.cardView ? ['
    ', + that.options.showHeader ? sprintf('%s', style, + getPropertyFromOther(that.columns, 'field', 'title', field)) : '', + sprintf('%s', value), + '
    ' + ].join('') : [sprintf('', + id_, class_, style, data_, rowspan_, colspan_, title_), + value, + '' + ].join(''); + + // Hide empty data on Card view when smartDisplay is set to true. + if (that.options.cardView && that.options.smartDisplay && value === '') { + // Should set a placeholder for event binding correct fieldIndex + text = '
    '; + } + } + + html.push(text); + }); + + if (this.options.cardView) { + html.push('
    '); + } + html.push(''); + + return html.join(' '); + }; + + BootstrapTable.prototype.initBody = function (fixedScroll) { + var that = this, + html = [], + data = this.getData(); + + this.trigger('pre-body', data); + + this.$body = this.$el.find('>tbody'); + if (!this.$body.length) { + this.$body = $('').appendTo(this.$el); + } + + //Fix #389 Bootstrap-table-flatJSON is not working + + if (!this.options.pagination || this.options.sidePagination === 'server') { + this.pageFrom = 1; + this.pageTo = data.length; + } + + var trFragments = $(document.createDocumentFragment()); + var hasTr; + + for (var i = this.pageFrom - 1; i < this.pageTo; i++) { + var item = data[i]; + var tr = this.initRow(item, i, data, trFragments); + hasTr = hasTr || !!tr; + if (tr&&tr!==true) { + trFragments.append(tr); + } + } + + // show no records + if (!hasTr) { + trFragments.append('' + + sprintf('%s', + this.$header.find('th').length, + this.options.formatNoMatches()) + + ''); + } + + this.$body.html(trFragments); + + if (!fixedScroll) { + this.scrollTo(0); + } + + // click to select by column + this.$body.find('> tr[data-index] > td').off('click dblclick').on('click dblclick', function (e) { + var $td = $(this), + $tr = $td.parent(), + item = that.data[$tr.data('index')], + index = $td[0].cellIndex, + fields = that.getVisibleFields(), + field = fields[that.options.detailView && !that.options.cardView ? index - 1 : index], + column = that.columns[getFieldIndex(that.columns, field)], + value = getItemField(item, field, that.options.escape); + + if ($td.find('.detail-icon').length) { + return; + } + + that.trigger(e.type === 'click' ? 'click-cell' : 'dbl-click-cell', field, value, item, $td); + that.trigger(e.type === 'click' ? 'click-row' : 'dbl-click-row', item, $tr, field); + + // if click to select - then trigger the checkbox/radio click + if (e.type === 'click' && that.options.clickToSelect && column.clickToSelect) { + var $selectItem = $tr.find(sprintf('[name="%s"]', that.options.selectItemName)); + if ($selectItem.length) { + $selectItem[0].click(); // #144: .trigger('click') bug + } + } + }); + + this.$body.find('> tr[data-index] > td > .detail-icon').off('click').on('click', function () { + var $this = $(this), + $tr = $this.parent().parent(), + index = $tr.data('index'), + row = data[index]; // Fix #980 Detail view, when searching, returns wrong row + + // remove and update + if ($tr.next().is('tr.detail-view')) { + $this.find('i').attr('class', sprintf('%s %s', that.options.iconsPrefix, that.options.icons.detailOpen)); + that.trigger('collapse-row', index, row); + $tr.next().remove(); + } else { + $this.find('i').attr('class', sprintf('%s %s', that.options.iconsPrefix, that.options.icons.detailClose)); + $tr.after(sprintf('', $tr.find('td').length)); + var $element = $tr.next().find('td'); + var content = calculateObjectValue(that.options, that.options.detailFormatter, [index, row, $element], ''); + if($element.length === 1) { + $element.append(content); + } + that.trigger('expand-row', index, row, $element); + } + that.resetView(); + return false; + }); + + this.$selectItem = this.$body.find(sprintf('[name="%s"]', this.options.selectItemName)); + this.$selectItem.off('click').on('click', function (event) { + event.stopImmediatePropagation(); + + var $this = $(this), + checked = $this.prop('checked'), + row = that.data[$this.data('index')]; + + if (that.options.maintainSelected && $(this).is(':radio')) { + $.each(that.options.data, function (i, row) { + row[that.header.stateField] = false; + }); + } + + row[that.header.stateField] = checked; + + if (that.options.singleSelect) { + that.$selectItem.not(this).each(function () { + that.data[$(this).data('index')][that.header.stateField] = false; + }); + that.$selectItem.filter(':checked').not(this).prop('checked', false); + } + + that.updateSelected(); + that.trigger(checked ? 'check' : 'uncheck', row, $this); + }); + + $.each(this.header.events, function (i, events) { + if (!events) { + return; + } + // fix bug, if events is defined with namespace + if (typeof events === 'string') { + events = calculateObjectValue(null, events); + } + + var field = that.header.fields[i], + fieldIndex = $.inArray(field, that.getVisibleFields()); + + if (that.options.detailView && !that.options.cardView) { + fieldIndex += 1; + } + + for (var key in events) { + that.$body.find('>tr:not(.no-records-found)').each(function () { + var $tr = $(this), + $td = $tr.find(that.options.cardView ? '.card-view' : 'td').eq(fieldIndex), + index = key.indexOf(' '), + name = key.substring(0, index), + el = key.substring(index + 1), + func = events[key]; + + $td.find(el).off(name).on(name, function (e) { + var index = $tr.data('index'), + row = that.data[index], + value = row[field]; + var props = field.split('.'); + if(props.length > 1) { + value = row; + for (var prop_index = 0; prop_index < props.length; prop_index++) { + value = value[props[prop_index]]; + } + } + func.apply(this, [e, value, row, index]); + }); + }); + } + }); + + this.updateSelected(); + this.resetView(); + + this.trigger('post-body', data); + }; + + BootstrapTable.prototype.initServer = function (silent, query, url) { + var that = this, + data = {}, + params = { + searchText: this.searchText, + sortName: this.options.sortName, + sortOrder: this.options.sortOrder + }, + request; + + if (this.options.pagination) { + params.pageSize = this.options.pageSize === this.options.formatAllRows() ? + this.options.totalRows : this.options.pageSize; + params.pageNumber = this.options.pageNumber; + } + + if (!(url || this.options.url) && !this.options.ajax) { + return; + } + + if (this.options.queryParamsType === 'limit') { + params = { + search: params.searchText, + sort: params.sortName, + order: params.sortOrder + }; + + if (this.options.pagination) { + params.offset = this.options.pageSize === this.options.formatAllRows() ? + 0 : this.options.pageSize * (this.options.pageNumber - 1); + params.limit = this.options.pageSize === this.options.formatAllRows() ? + this.options.totalRows : this.options.pageSize; + } + } + + if (!($.isEmptyObject(this.filterColumnsPartial))) { + params.filter = JSON.stringify(this.filterColumnsPartial, null); + } + + data = calculateObjectValue(this.options, this.options.queryParams, [params], data); + + $.extend(data, query || {}); + + // false to stop request + if (data === false) { + return; + } + + if (!silent) { + this.$tableLoading.show(); + } + request = $.extend({}, calculateObjectValue(null, this.options.ajaxOptions), { + type: this.options.method, + url: url || this.options.url, + data: this.options.contentType === 'application/json' && this.options.method === 'post' ? + JSON.stringify(data) : data, + cache: this.options.cache, + contentType: this.options.contentType, + dataType: this.options.dataType, + success: function (res) { + res = calculateObjectValue(that.options, that.options.responseHandler, [res], res); + + that.load(res); + that.trigger('load-success', res); + if (!silent) that.$tableLoading.hide(); + }, + error: function (res) { + that.trigger('load-error', res.status, res); + if (!silent) that.$tableLoading.hide(); + } + }); + + if (this.options.ajax) { + calculateObjectValue(this, this.options.ajax, [request], null); + } else { + if (this._xhr && this._xhr.readyState !== 4) { + this._xhr.abort(); + } + this._xhr = $.ajax(request); + } + }; + + BootstrapTable.prototype.initSearchText = function () { + if (this.options.search) { + if (this.options.searchText !== '') { + var $search = this.$toolbar.find('.search input'); + $search.val(this.options.searchText); + this.onSearch({currentTarget: $search}); + } + } + }; + + BootstrapTable.prototype.getCaret = function () { + var that = this; + + $.each(this.$header.find('th'), function (i, th) { + $(th).find('.sortable').removeClass('desc asc').addClass($(th).data('field') === that.options.sortName ? that.options.sortOrder : 'both'); + }); + }; + + BootstrapTable.prototype.updateSelected = function () { + var checkAll = this.$selectItem.filter(':enabled').length && + this.$selectItem.filter(':enabled').length === + this.$selectItem.filter(':enabled').filter(':checked').length; + + this.$selectAll.add(this.$selectAll_).prop('checked', checkAll); + + this.$selectItem.each(function () { + $(this).closest('tr')[$(this).prop('checked') ? 'addClass' : 'removeClass']('selected'); + }); + }; + + BootstrapTable.prototype.updateRows = function () { + var that = this; + + this.$selectItem.each(function () { + that.data[$(this).data('index')][that.header.stateField] = $(this).prop('checked'); + }); + }; + + BootstrapTable.prototype.resetRows = function () { + var that = this; + + $.each(this.data, function (i, row) { + that.$selectAll.prop('checked', false); + that.$selectItem.prop('checked', false); + if (that.header.stateField) { + row[that.header.stateField] = false; + } + }); + this.initHiddenRows(); + }; + + BootstrapTable.prototype.trigger = function (name) { + var args = Array.prototype.slice.call(arguments, 1); + + name += '.bs.table'; + this.options[BootstrapTable.EVENTS[name]].apply(this.options, args); + this.$el.trigger($.Event(name), args); + + this.options.onAll(name, args); + this.$el.trigger($.Event('all.bs.table'), [name, args]); + }; + + BootstrapTable.prototype.resetHeader = function () { + // fix #61: the hidden table reset header bug. + // fix bug: get $el.css('width') error sometime (height = 500) + clearTimeout(this.timeoutId_); + this.timeoutId_ = setTimeout($.proxy(this.fitHeader, this), this.$el.is(':hidden') ? 100 : 0); + }; + + BootstrapTable.prototype.fitHeader = function () { + var that = this, + fixedBody, + scrollWidth, + focused, + focusedTemp; + + if (that.$el.is(':hidden')) { + that.timeoutId_ = setTimeout($.proxy(that.fitHeader, that), 100); + return; + } + fixedBody = this.$tableBody.get(0); + + scrollWidth = fixedBody.scrollWidth > fixedBody.clientWidth && + fixedBody.scrollHeight > fixedBody.clientHeight + this.$header.outerHeight() ? + getScrollBarWidth() : 0; + + this.$el.css('margin-top', -this.$header.outerHeight()); + + focused = $(':focus'); + if (focused.length > 0) { + var $th = focused.parents('th'); + if ($th.length > 0) { + var dataField = $th.attr('data-field'); + if (dataField !== undefined) { + var $headerTh = this.$header.find("[data-field='" + dataField + "']"); + if ($headerTh.length > 0) { + $headerTh.find(":input").addClass("focus-temp"); + } + } + } + } + + this.$header_ = this.$header.clone(true, true); + this.$selectAll_ = this.$header_.find('[name="btSelectAll"]'); + this.$tableHeader.css({ + 'margin-right': scrollWidth + }).find('table').css('width', this.$el.outerWidth()) + .html('').attr('class', this.$el.attr('class')) + .append(this.$header_); + + + focusedTemp = $('.focus-temp:visible:eq(0)'); + if (focusedTemp.length > 0) { + focusedTemp.focus(); + this.$header.find('.focus-temp').removeClass('focus-temp'); + } + + // fix bug: $.data() is not working as expected after $.append() + this.$header.find('th[data-field]').each(function (i) { + that.$header_.find(sprintf('th[data-field="%s"]', $(this).data('field'))).data($(this).data()); + }); + + var visibleFields = this.getVisibleFields(), + $ths = this.$header_.find('th'); + + this.$body.find('>tr:first-child:not(.no-records-found) > *').each(function (i) { + var $this = $(this), + index = i; + + if (that.options.detailView && !that.options.cardView) { + if (i === 0) { + that.$header_.find('th.detail').find('.fht-cell').width($this.innerWidth()); + } + index = i - 1; + } + + var $th = that.$header_.find(sprintf('th[data-field="%s"]', visibleFields[index])); + if ($th.length > 1) { + $th = $($ths[$this[0].cellIndex]); + } + + $th.find('.fht-cell').width($this.innerWidth()); + }); + // horizontal scroll event + // TODO: it's probably better improving the layout than binding to scroll event + this.$tableBody.off('scroll').on('scroll', function () { + that.$tableHeader.scrollLeft($(this).scrollLeft()); + + if (that.options.showFooter && !that.options.cardView) { + that.$tableFooter.scrollLeft($(this).scrollLeft()); + } + }); + that.trigger('post-header'); + }; + + BootstrapTable.prototype.resetFooter = function () { + var that = this, + data = that.getData(), + html = []; + + if (!this.options.showFooter || this.options.cardView) { //do nothing + return; + } + + if (!this.options.cardView && this.options.detailView) { + html.push('
     
    '); + } + + $.each(this.columns, function (i, column) { + var key, + falign = '', // footer align style + valign = '', + csses = [], + style = {}, + class_ = sprintf(' class="%s"', column['class']); + + if (!column.visible) { + return; + } + + if (that.options.cardView && (!column.cardVisible)) { + return; + } + + falign = sprintf('text-align: %s; ', column.falign ? column.falign : column.align); + valign = sprintf('vertical-align: %s; ', column.valign); + + style = calculateObjectValue(null, that.options.footerStyle); + + if (style && style.css) { + for (key in style.css) { + csses.push(key + ': ' + style.css[key]); + } + } + + html.push(''); + html.push('
    '); + + html.push(calculateObjectValue(column, column.footerFormatter, [data], ' ') || ' '); + + html.push('
    '); + html.push('
    '); + html.push(''); + html.push(''); + }); + + this.$tableFooter.find('tr').html(html.join('')); + this.$tableFooter.show(); + clearTimeout(this.timeoutFooter_); + this.timeoutFooter_ = setTimeout($.proxy(this.fitFooter, this), + this.$el.is(':hidden') ? 100 : 0); + }; + + BootstrapTable.prototype.fitFooter = function () { + var that = this, + $footerTd, + elWidth, + scrollWidth; + + clearTimeout(this.timeoutFooter_); + if (this.$el.is(':hidden')) { + this.timeoutFooter_ = setTimeout($.proxy(this.fitFooter, this), 100); + return; + } + + elWidth = this.$el.css('width'); + scrollWidth = elWidth > this.$tableBody.width() ? getScrollBarWidth() : 0; + + this.$tableFooter.css({ + 'margin-right': scrollWidth + }).find('table').css('width', elWidth) + .attr('class', this.$el.attr('class')); + + $footerTd = this.$tableFooter.find('td'); + + this.$body.find('>tr:first-child:not(.no-records-found) > *').each(function (i) { + var $this = $(this); + + $footerTd.eq(i).find('.fht-cell').width($this.innerWidth()); + }); + }; + + BootstrapTable.prototype.toggleColumn = function (index, checked, needUpdate) { + if (index === -1) { + return; + } + this.columns[index].visible = checked; + this.initHeader(); + this.initSearch(); + this.initPagination(); + this.initBody(); + + if (this.options.showColumns) { + var $items = this.$toolbar.find('.keep-open input').prop('disabled', false); + + if (needUpdate) { + $items.filter(sprintf('[value="%s"]', index)).prop('checked', checked); + } + + if ($items.filter(':checked').length <= this.options.minimumCountColumns) { + $items.filter(':checked').prop('disabled', true); + } + } + }; + + BootstrapTable.prototype.getVisibleFields = function () { + var that = this, + visibleFields = []; + + $.each(this.header.fields, function (j, field) { + var column = that.columns[getFieldIndex(that.columns, field)]; + + if (!column.visible) { + return; + } + visibleFields.push(field); + }); + return visibleFields; + }; + + // PUBLIC FUNCTION DEFINITION + // ======================= + + BootstrapTable.prototype.resetView = function (params) { + var padding = 0; + + if (params && params.height) { + this.options.height = params.height; + } + + this.$selectAll.prop('checked', this.$selectItem.length > 0 && + this.$selectItem.length === this.$selectItem.filter(':checked').length); + + if (this.options.height) { + var toolbarHeight = this.$toolbar.outerHeight(true), + paginationHeight = this.$pagination.outerHeight(true), + height = this.options.height - toolbarHeight - paginationHeight; + + this.$tableContainer.css('height', height + 'px'); + } + + if (this.options.cardView) { + // remove the element css + this.$el.css('margin-top', '0'); + this.$tableContainer.css('padding-bottom', '0'); + this.$tableFooter.hide(); + return; + } + + if (this.options.showHeader && this.options.height) { + this.$tableHeader.show(); + this.resetHeader(); + padding += this.$header.outerHeight(); + } else { + this.$tableHeader.hide(); + this.trigger('post-header'); + } + + if (this.options.showFooter) { + this.resetFooter(); + if (this.options.height) { + padding += this.$tableFooter.outerHeight() + 1; + } + } + + // Assign the correct sortable arrow + this.getCaret(); + this.$tableContainer.css('padding-bottom', padding + 'px'); + this.trigger('reset-view'); + }; + + BootstrapTable.prototype.getData = function (useCurrentPage) { + return (this.searchText || !$.isEmptyObject(this.filterColumns) || !$.isEmptyObject(this.filterColumnsPartial)) ? + (useCurrentPage ? this.data.slice(this.pageFrom - 1, this.pageTo) : this.data) : + (useCurrentPage ? this.options.data.slice(this.pageFrom - 1, this.pageTo) : this.options.data); + }; + + BootstrapTable.prototype.load = function (data) { + var fixedScroll = false; + + // #431: support pagination + if (this.options.sidePagination === 'server') { + this.options.totalRows = data[this.options.totalField]; + fixedScroll = data.fixedScroll; + data = data[this.options.dataField]; + } else if (!$.isArray(data)) { // support fixedScroll + fixedScroll = data.fixedScroll; + data = data.data; + } + + this.initData(data); + this.initSearch(); + this.initPagination(); + this.initBody(fixedScroll); + }; + + BootstrapTable.prototype.append = function (data) { + this.initData(data, 'append'); + this.initSearch(); + this.initPagination(); + this.initSort(); + this.initBody(true); + }; + + BootstrapTable.prototype.prepend = function (data) { + this.initData(data, 'prepend'); + this.initSearch(); + this.initPagination(); + this.initSort(); + this.initBody(true); + }; + + BootstrapTable.prototype.remove = function (params) { + var len = this.options.data.length, + i, row; + + if (!params.hasOwnProperty('field') || !params.hasOwnProperty('values')) { + return; + } + + for (i = len - 1; i >= 0; i--) { + row = this.options.data[i]; + + if (!row.hasOwnProperty(params.field)) { + continue; + } + if ($.inArray(row[params.field], params.values) !== -1) { + this.options.data.splice(i, 1); + if (this.options.sidePagination === 'server') { + this.options.totalRows -= 1; + } + } + } + + if (len === this.options.data.length) { + return; + } + + this.initSearch(); + this.initPagination(); + this.initSort(); + this.initBody(true); + }; + + BootstrapTable.prototype.removeAll = function () { + if (this.options.data.length > 0) { + this.options.data.splice(0, this.options.data.length); + this.initSearch(); + this.initPagination(); + this.initBody(true); + } + }; + + BootstrapTable.prototype.getRowByUniqueId = function (id) { + var uniqueId = this.options.uniqueId, + len = this.options.data.length, + dataRow = null, + i, row, rowUniqueId; + + for (i = len - 1; i >= 0; i--) { + row = this.options.data[i]; + + if (row.hasOwnProperty(uniqueId)) { // uniqueId is a column + rowUniqueId = row[uniqueId]; + } else if(row._data.hasOwnProperty(uniqueId)) { // uniqueId is a row data property + rowUniqueId = row._data[uniqueId]; + } else { + continue; + } + + if (typeof rowUniqueId === 'string') { + id = id.toString(); + } else if (typeof rowUniqueId === 'number') { + if ((Number(rowUniqueId) === rowUniqueId) && (rowUniqueId % 1 === 0)) { + id = parseInt(id); + } else if ((rowUniqueId === Number(rowUniqueId)) && (rowUniqueId !== 0)) { + id = parseFloat(id); + } + } + + if (rowUniqueId === id) { + dataRow = row; + break; + } + } + + return dataRow; + }; + + BootstrapTable.prototype.removeByUniqueId = function (id) { + var len = this.options.data.length, + row = this.getRowByUniqueId(id); + + if (row) { + this.options.data.splice(this.options.data.indexOf(row), 1); + } + + if (len === this.options.data.length) { + return; + } + + this.initSearch(); + this.initPagination(); + this.initBody(true); + }; + + BootstrapTable.prototype.updateByUniqueId = function (params) { + var that = this; + var allParams = $.isArray(params) ? params : [ params ]; + + $.each(allParams, function(i, params) { + var rowId; + + if (!params.hasOwnProperty('id') || !params.hasOwnProperty('row')) { + return; + } + + rowId = $.inArray(that.getRowByUniqueId(params.id), that.options.data); + + if (rowId === -1) { + return; + } + $.extend(that.options.data[rowId], params.row); + }); + + this.initSearch(); + this.initPagination(); + this.initSort(); + this.initBody(true); + }; + + BootstrapTable.prototype.insertRow = function (params) { + if (!params.hasOwnProperty('index') || !params.hasOwnProperty('row')) { + return; + } + this.data.splice(params.index, 0, params.row); + this.initSearch(); + this.initPagination(); + this.initSort(); + this.initBody(true); + }; + + BootstrapTable.prototype.updateRow = function (params) { + var that = this; + var allParams = $.isArray(params) ? params : [ params ]; + + $.each(allParams, function(i, params) { + if (!params.hasOwnProperty('index') || !params.hasOwnProperty('row')) { + return; + } + $.extend(that.options.data[params.index], params.row); + }); + + this.initSearch(); + this.initPagination(); + this.initSort(); + this.initBody(true); + }; + + BootstrapTable.prototype.initHiddenRows = function () { + this.hiddenRows = []; + }; + + BootstrapTable.prototype.showRow = function (params) { + this.toggleRow(params, true); + }; + + BootstrapTable.prototype.hideRow = function (params) { + this.toggleRow(params, false); + }; + + BootstrapTable.prototype.toggleRow = function (params, visible) { + var row, index; + + if (params.hasOwnProperty('index')) { + row = this.getData()[params.index]; + } else if (params.hasOwnProperty('uniqueId')) { + row = this.getRowByUniqueId(params.uniqueId); + } + + if (!row) { + return; + } + + index = $.inArray(row, this.hiddenRows); + + if (!visible && index === -1) { + this.hiddenRows.push(row); + } else if (visible && index > -1) { + this.hiddenRows.splice(index, 1); + } + this.initBody(true); + }; + + BootstrapTable.prototype.getHiddenRows = function (show) { + var that = this, + data = this.getData(), + rows = []; + + $.each(data, function (i, row) { + if ($.inArray(row, that.hiddenRows) > -1) { + rows.push(row); + } + }); + this.hiddenRows = rows; + return rows; + }; + + BootstrapTable.prototype.mergeCells = function (options) { + var row = options.index, + col = $.inArray(options.field, this.getVisibleFields()), + rowspan = options.rowspan || 1, + colspan = options.colspan || 1, + i, j, + $tr = this.$body.find('>tr'), + $td; + + if (this.options.detailView && !this.options.cardView) { + col += 1; + } + + $td = $tr.eq(row).find('>td').eq(col); + + if (row < 0 || col < 0 || row >= this.data.length) { + return; + } + + for (i = row; i < row + rowspan; i++) { + for (j = col; j < col + colspan; j++) { + $tr.eq(i).find('>td').eq(j).hide(); + } + } + + $td.attr('rowspan', rowspan).attr('colspan', colspan).show(); + }; + + BootstrapTable.prototype.updateCell = function (params) { + if (!params.hasOwnProperty('index') || + !params.hasOwnProperty('field') || + !params.hasOwnProperty('value')) { + return; + } + this.data[params.index][params.field] = params.value; + + if (params.reinit === false) { + return; + } + this.initSort(); + this.initBody(true); + }; + + BootstrapTable.prototype.getOptions = function () { + return this.options; + }; + + BootstrapTable.prototype.getSelections = function () { + var that = this; + + return $.grep(this.options.data, function (row) { + // fix #2424: from html with checkbox + return row[that.header.stateField] === true; + }); + }; + + BootstrapTable.prototype.getAllSelections = function () { + var that = this; + + return $.grep(this.options.data, function (row) { + return row[that.header.stateField]; + }); + }; + + BootstrapTable.prototype.checkAll = function () { + this.checkAll_(true); + }; + + BootstrapTable.prototype.uncheckAll = function () { + this.checkAll_(false); + }; + + BootstrapTable.prototype.checkInvert = function () { + var that = this; + var rows = that.$selectItem.filter(':enabled'); + var checked = rows.filter(':checked'); + rows.each(function() { + $(this).prop('checked', !$(this).prop('checked')); + }); + that.updateRows(); + that.updateSelected(); + that.trigger('uncheck-some', checked); + checked = that.getSelections(); + that.trigger('check-some', checked); + }; + + BootstrapTable.prototype.checkAll_ = function (checked) { + var rows; + if (!checked) { + rows = this.getSelections(); + } + this.$selectAll.add(this.$selectAll_).prop('checked', checked); + this.$selectItem.filter(':enabled').prop('checked', checked); + this.updateRows(); + if (checked) { + rows = this.getSelections(); + } + this.trigger(checked ? 'check-all' : 'uncheck-all', rows); + }; + + BootstrapTable.prototype.check = function (index) { + this.check_(true, index); + }; + + BootstrapTable.prototype.uncheck = function (index) { + this.check_(false, index); + }; + + BootstrapTable.prototype.check_ = function (checked, index) { + var $el = this.$selectItem.filter(sprintf('[data-index="%s"]', index)).prop('checked', checked); + this.data[index][this.header.stateField] = checked; + this.updateSelected(); + this.trigger(checked ? 'check' : 'uncheck', this.data[index], $el); + }; + + BootstrapTable.prototype.checkBy = function (obj) { + this.checkBy_(true, obj); + }; + + BootstrapTable.prototype.uncheckBy = function (obj) { + this.checkBy_(false, obj); + }; + + BootstrapTable.prototype.checkBy_ = function (checked, obj) { + if (!obj.hasOwnProperty('field') || !obj.hasOwnProperty('values')) { + return; + } + + var that = this, + rows = []; + $.each(this.options.data, function (index, row) { + if (!row.hasOwnProperty(obj.field)) { + return false; + } + if ($.inArray(row[obj.field], obj.values) !== -1) { + var $el = that.$selectItem.filter(':enabled') + .filter(sprintf('[data-index="%s"]', index)).prop('checked', checked); + row[that.header.stateField] = checked; + rows.push(row); + that.trigger(checked ? 'check' : 'uncheck', row, $el); + } + }); + this.updateSelected(); + this.trigger(checked ? 'check-some' : 'uncheck-some', rows); + }; + + BootstrapTable.prototype.destroy = function () { + this.$el.insertBefore(this.$container); + $(this.options.toolbar).insertBefore(this.$el); + this.$container.next().remove(); + this.$container.remove(); + this.$el.html(this.$el_.html()) + .css('margin-top', '0') + .attr('class', this.$el_.attr('class') || ''); // reset the class + }; + + BootstrapTable.prototype.showLoading = function () { + this.$tableLoading.show(); + }; + + BootstrapTable.prototype.hideLoading = function () { + this.$tableLoading.hide(); + }; + + BootstrapTable.prototype.togglePagination = function () { + this.options.pagination = !this.options.pagination; + var button = this.$toolbar.find('button[name="paginationSwitch"] i'); + if (this.options.pagination) { + button.attr("class", this.options.iconsPrefix + " " + this.options.icons.paginationSwitchDown); + } else { + button.attr("class", this.options.iconsPrefix + " " + this.options.icons.paginationSwitchUp); + } + this.updatePagination(); + }; + + BootstrapTable.prototype.refresh = function (params) { + if (params && params.url) { + this.options.url = params.url; + } + if (params && params.pageNumber) { + this.options.pageNumber = params.pageNumber; + } + if (params && params.pageSize) { + this.options.pageSize = params.pageSize; + } + this.initServer(params && params.silent, + params && params.query, params && params.url); + this.trigger('refresh', params); + }; + + BootstrapTable.prototype.resetWidth = function () { + if (this.options.showHeader && this.options.height) { + this.fitHeader(); + } + if (this.options.showFooter) { + this.fitFooter(); + } + }; + + BootstrapTable.prototype.showColumn = function (field) { + this.toggleColumn(getFieldIndex(this.columns, field), true, true); + }; + + BootstrapTable.prototype.hideColumn = function (field) { + this.toggleColumn(getFieldIndex(this.columns, field), false, true); + }; + + BootstrapTable.prototype.getHiddenColumns = function () { + return $.grep(this.columns, function (column) { + return !column.visible; + }); + }; + + BootstrapTable.prototype.getVisibleColumns = function () { + return $.grep(this.columns, function (column) { + return column.visible; + }); + }; + + BootstrapTable.prototype.toggleAllColumns = function (visible) { + $.each(this.columns, function (i, column) { + this.columns[i].visible = visible; + }); + + this.initHeader(); + this.initSearch(); + this.initPagination(); + this.initBody(); + if (this.options.showColumns) { + var $items = this.$toolbar.find('.keep-open input').prop('disabled', false); + + if ($items.filter(':checked').length <= this.options.minimumCountColumns) { + $items.filter(':checked').prop('disabled', true); + } + } + }; + + BootstrapTable.prototype.showAllColumns = function () { + this.toggleAllColumns(true); + }; + + BootstrapTable.prototype.hideAllColumns = function () { + this.toggleAllColumns(false); + }; + + BootstrapTable.prototype.filterBy = function (columns) { + this.filterColumns = $.isEmptyObject(columns) ? {} : columns; + this.options.pageNumber = 1; + this.initSearch(); + this.updatePagination(); + }; + + BootstrapTable.prototype.scrollTo = function (value) { + if (typeof value === 'string') { + value = value === 'bottom' ? this.$tableBody[0].scrollHeight : 0; + } + if (typeof value === 'number') { + this.$tableBody.scrollTop(value); + } + if (typeof value === 'undefined') { + return this.$tableBody.scrollTop(); + } + }; + + BootstrapTable.prototype.getScrollPosition = function () { + return this.scrollTo(); + }; + + BootstrapTable.prototype.selectPage = function (page) { + if (page > 0 && page <= this.options.totalPages) { + this.options.pageNumber = page; + this.updatePagination(); + } + }; + + BootstrapTable.prototype.prevPage = function () { + if (this.options.pageNumber > 1) { + this.options.pageNumber--; + this.updatePagination(); + } + }; + + BootstrapTable.prototype.nextPage = function () { + if (this.options.pageNumber < this.options.totalPages) { + this.options.pageNumber++; + this.updatePagination(); + } + }; + + BootstrapTable.prototype.toggleView = function () { + this.options.cardView = !this.options.cardView; + this.initHeader(); + // Fixed remove toolbar when click cardView button. + //that.initToolbar(); + this.initBody(); + this.trigger('toggle', this.options.cardView); + }; + + BootstrapTable.prototype.refreshOptions = function (options) { + //If the objects are equivalent then avoid the call of destroy / init methods + if (compareObjects(this.options, options, true)) { + return; + } + this.options = $.extend(this.options, options); + this.trigger('refresh-options', this.options); + this.destroy(); + this.init(); + }; + + BootstrapTable.prototype.resetSearch = function (text) { + var $search = this.$toolbar.find('.search input'); + $search.val(text || ''); + this.onSearch({currentTarget: $search}); + }; + + BootstrapTable.prototype.expandRow_ = function (expand, index) { + var $tr = this.$body.find(sprintf('> tr[data-index="%s"]', index)); + if ($tr.next().is('tr.detail-view') === (expand ? false : true)) { + $tr.find('> td > .detail-icon').click(); + } + }; + + BootstrapTable.prototype.expandRow = function (index) { + this.expandRow_(true, index); + }; + + BootstrapTable.prototype.collapseRow = function (index) { + this.expandRow_(false, index); + }; + + BootstrapTable.prototype.expandAllRows = function (isSubTable) { + if (isSubTable) { + var $tr = this.$body.find(sprintf('> tr[data-index="%s"]', 0)), + that = this, + detailIcon = null, + executeInterval = false, + idInterval = -1; + + if (!$tr.next().is('tr.detail-view')) { + $tr.find('> td > .detail-icon').click(); + executeInterval = true; + } else if (!$tr.next().next().is('tr.detail-view')) { + $tr.next().find(".detail-icon").click(); + executeInterval = true; + } + + if (executeInterval) { + try { + idInterval = setInterval(function () { + detailIcon = that.$body.find("tr.detail-view").last().find(".detail-icon"); + if (detailIcon.length > 0) { + detailIcon.click(); + } else { + clearInterval(idInterval); + } + }, 1); + } catch (ex) { + clearInterval(idInterval); + } + } + } else { + var trs = this.$body.children(); + for (var i = 0; i < trs.length; i++) { + this.expandRow_(true, $(trs[i]).data("index")); + } + } + }; + + BootstrapTable.prototype.collapseAllRows = function (isSubTable) { + if (isSubTable) { + this.expandRow_(false, 0); + } else { + var trs = this.$body.children(); + for (var i = 0; i < trs.length; i++) { + this.expandRow_(false, $(trs[i]).data("index")); + } + } + }; + + BootstrapTable.prototype.updateFormatText = function (name, text) { + if (this.options[sprintf('format%s', name)]) { + if (typeof text === 'string') { + this.options[sprintf('format%s', name)] = function () { + return text; + }; + } else if (typeof text === 'function') { + this.options[sprintf('format%s', name)] = text; + } + } + this.initToolbar(); + this.initPagination(); + this.initBody(); + }; + + // BOOTSTRAP TABLE PLUGIN DEFINITION + // ======================= + + var allowedMethods = [ + 'getOptions', + 'getSelections', 'getAllSelections', 'getData', + 'load', 'append', 'prepend', 'remove', 'removeAll', + 'insertRow', 'updateRow', 'updateCell', 'updateByUniqueId', 'removeByUniqueId', + 'getRowByUniqueId', 'showRow', 'hideRow', 'getHiddenRows', + 'mergeCells', + 'checkAll', 'uncheckAll', 'checkInvert', + 'check', 'uncheck', + 'checkBy', 'uncheckBy', + 'refresh', + 'resetView', + 'resetWidth', + 'destroy', + 'showLoading', 'hideLoading', + 'showColumn', 'hideColumn', 'getHiddenColumns', 'getVisibleColumns', + 'showAllColumns', 'hideAllColumns', + 'filterBy', + 'scrollTo', + 'getScrollPosition', + 'selectPage', 'prevPage', 'nextPage', + 'togglePagination', + 'toggleView', + 'refreshOptions', + 'resetSearch', + 'expandRow', 'collapseRow', 'expandAllRows', 'collapseAllRows', + 'updateFormatText' + ]; + + $.fn.bootstrapTable = function (option) { + var value, + args = Array.prototype.slice.call(arguments, 1); + + this.each(function () { + var $this = $(this), + data = $this.data('bootstrap.table'), + options = $.extend({}, BootstrapTable.DEFAULTS, $this.data(), + typeof option === 'object' && option); + + if (typeof option === 'string') { + if ($.inArray(option, allowedMethods) < 0) { + throw new Error("Unknown method: " + option); + } + + if (!data) { + return; + } + + value = data[option].apply(data, args); + + if (option === 'destroy') { + $this.removeData('bootstrap.table'); + } + } + + if (!data) { + $this.data('bootstrap.table', (data = new BootstrapTable(this, options))); + } + }); + + return typeof value === 'undefined' ? this : value; + }; + + $.fn.bootstrapTable.Constructor = BootstrapTable; + $.fn.bootstrapTable.defaults = BootstrapTable.DEFAULTS; + $.fn.bootstrapTable.columnDefaults = BootstrapTable.COLUMN_DEFAULTS; + $.fn.bootstrapTable.locales = BootstrapTable.LOCALES; + $.fn.bootstrapTable.methods = allowedMethods; + $.fn.bootstrapTable.utils = { + sprintf: sprintf, + getFieldIndex: getFieldIndex, + compareObjects: compareObjects, + calculateObjectValue: calculateObjectValue, + getItemField: getItemField, + objectKeys: objectKeys, + isIEBrowser: isIEBrowser + }; + + // BOOTSTRAP TABLE INIT + // ======================= + + $(function () { + $('[data-toggle="table"]').bootstrapTable(); + }); +})(jQuery); diff --git a/public/assets/libs/bootstrap-table/dist/bootstrap-table.min.css b/public/assets/libs/bootstrap-table/dist/bootstrap-table.min.css new file mode 100644 index 0000000..f65b308 --- /dev/null +++ b/public/assets/libs/bootstrap-table/dist/bootstrap-table.min.css @@ -0,0 +1 @@ +.fixed-table-container .bs-checkbox,.fixed-table-container .no-records-found{text-align:center}.fixed-table-body thead th .th-inner,.table td,.table th{box-sizing:border-box}.bootstrap-table .table{margin-bottom:0!important;border-bottom:1px solid #ddd;border-collapse:collapse!important;border-radius:1px}.bootstrap-table .table:not(.table-condensed),.bootstrap-table .table:not(.table-condensed)>tbody>tr>td,.bootstrap-table .table:not(.table-condensed)>tbody>tr>th,.bootstrap-table .table:not(.table-condensed)>tfoot>tr>td,.bootstrap-table .table:not(.table-condensed)>tfoot>tr>th,.bootstrap-table .table:not(.table-condensed)>thead>tr>td{padding:8px}.bootstrap-table .table.table-no-bordered>tbody>tr>td,.bootstrap-table .table.table-no-bordered>thead>tr>th{border-right:2px solid transparent}.bootstrap-table .table.table-no-bordered>tbody>tr>td:last-child{border-right:none}.fixed-table-container{position:relative;clear:both;border:1px solid #ddd;border-radius:4px;-webkit-border-radius:4px;-moz-border-radius:4px}.fixed-table-container.table-no-bordered{border:1px solid transparent}.fixed-table-footer,.fixed-table-header{overflow:hidden}.fixed-table-footer{border-top:1px solid #ddd}.fixed-table-body{overflow-x:auto;overflow-y:auto;height:100%}.fixed-table-container table{width:100%}.fixed-table-container thead th{height:0;padding:0;margin:0;border-left:1px solid #ddd}.fixed-table-container thead th:focus{outline:transparent solid 0}.fixed-table-container thead th:first-child{border-left:none;border-top-left-radius:4px;-webkit-border-top-left-radius:4px;-moz-border-radius-topleft:4px}.fixed-table-container tbody td .th-inner,.fixed-table-container thead th .th-inner{padding:8px;line-height:24px;vertical-align:top;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.fixed-table-container thead th .sortable{cursor:pointer;background-position:right;background-repeat:no-repeat;padding-right:30px}.fixed-table-container thead th .both{background-image:url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAATCAQAAADYWf5HAAAAkElEQVQoz7X QMQ5AQBCF4dWQSJxC5wwax1Cq1e7BAdxD5SL+Tq/QCM1oNiJidwox0355mXnG/DrEtIQ6azioNZQxI0ykPhTQIwhCR+BmBYtlK7kLJYwWCcJA9M4qdrZrd8pPjZWPtOqdRQy320YSV17OatFC4euts6z39GYMKRPCTKY9UnPQ6P+GtMRfGtPnBCiqhAeJPmkqAAAAAElFTkSuQmCC')}.fixed-table-container thead th .asc{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAATCAYAAAByUDbMAAAAZ0lEQVQ4y2NgGLKgquEuFxBPAGI2ahhWCsS/gDibUoO0gPgxEP8H4ttArEyuQYxAPBdqEAxPBImTY5gjEL9DM+wTENuQahAvEO9DMwiGdwAxOymGJQLxTyD+jgWDxCMZRsEoGAVoAADeemwtPcZI2wAAAABJRU5ErkJggg==)}.fixed-table-container thead th .desc{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAATCAYAAAByUDbMAAAAZUlEQVQ4y2NgGAWjYBSggaqGu5FA/BOIv2PBIPFEUgxjB+IdQPwfC94HxLykus4GiD+hGfQOiB3J8SojEE9EM2wuSJzcsFMG4ttQgx4DsRalkZENxL+AuJQaMcsGxBOAmGvopk8AVz1sLZgg0bsAAAAASUVORK5CYII=)}.fixed-table-container th.detail{width:30px}.fixed-table-container tbody td{border-left:1px solid #ddd}.fixed-table-container tbody tr:first-child td{border-top:none}.fixed-table-container tbody td:first-child{border-left:none}.fixed-table-container tbody .selected td{background-color:#f5f5f5}.fixed-table-container .bs-checkbox .th-inner{padding:8px 0}.fixed-table-container input[type=radio],.fixed-table-container input[type=checkbox]{margin:0 auto!important}.fixed-table-pagination .pagination-detail,.fixed-table-pagination div.pagination{margin-top:10px;margin-bottom:10px}.fixed-table-pagination div.pagination .pagination{margin:0}.fixed-table-pagination .pagination a{padding:6px 12px;line-height:1.428571429}.fixed-table-pagination .pagination-info{line-height:34px;margin-right:5px}.fixed-table-pagination .btn-group{position:relative;display:inline-block;vertical-align:middle}.fixed-table-pagination .dropup .dropdown-menu{margin-bottom:0}.fixed-table-pagination .page-list{display:inline-block}.fixed-table-toolbar .columns-left{margin-right:5px}.fixed-table-toolbar .columns-right{margin-left:5px}.fixed-table-toolbar .columns label{display:block;padding:3px 20px;clear:both;font-weight:400;line-height:1.428571429}.fixed-table-toolbar .bs-bars,.fixed-table-toolbar .columns,.fixed-table-toolbar .search{position:relative;margin-top:10px;margin-bottom:10px;line-height:34px}.fixed-table-pagination li.disabled a{pointer-events:none;cursor:default}.fixed-table-loading{display:none;position:absolute;top:42px;right:0;bottom:0;left:0;z-index:99;background-color:#fff;text-align:center}.fixed-table-body .card-view .title{font-weight:700;display:inline-block;min-width:30%;text-align:left!important}.table td,.table th{vertical-align:middle}.fixed-table-toolbar .dropdown-menu{text-align:left;max-height:300px;overflow:auto}.fixed-table-toolbar .btn-group>.btn-group{display:inline-block;margin-left:-1px!important}.fixed-table-toolbar .btn-group>.btn-group>.btn{border-radius:0}.fixed-table-toolbar .btn-group>.btn-group:first-child>.btn{border-top-left-radius:4px;border-bottom-left-radius:4px}.fixed-table-toolbar .btn-group>.btn-group:last-child>.btn{border-top-right-radius:4px;border-bottom-right-radius:4px}.bootstrap-table .table>thead>tr>th{vertical-align:bottom;border-bottom:1px solid #ddd}.bootstrap-table .table thead>tr>th{padding:0;margin:0}.bootstrap-table .fixed-table-footer tbody>tr>td{padding:0!important}.bootstrap-table .fixed-table-footer .table{border-bottom:none;border-radius:0;padding:0!important}.bootstrap-table .pull-right .dropdown-menu{right:0;left:auto}p.fixed-table-scroll-inner{width:100%;height:200px}div.fixed-table-scroll-outer{top:0;left:0;visibility:hidden;width:200px;height:150px;overflow:hidden}.fixed-table-pagination:after,.fixed-table-toolbar:after{content:"";display:block;clear:both} \ No newline at end of file diff --git a/public/assets/libs/bootstrap-table/dist/bootstrap-table.min.js b/public/assets/libs/bootstrap-table/dist/bootstrap-table.min.js new file mode 100644 index 0000000..55bd9f2 --- /dev/null +++ b/public/assets/libs/bootstrap-table/dist/bootstrap-table.min.js @@ -0,0 +1 @@ +(function($){"use strict";var cachedWidth=null;var sprintf=function(str){var args=arguments,flag=true,i=1;str=str.replace(/%s/g,function(){var arg=args[i++];if(typeof arg==="undefined"){flag=false;return""}return arg});return flag?str:""};var getPropertyFromOther=function(list,from,to,value){var result="";$.each(list,function(i,item){if(item[from]===value){result=item[to];return false}return true});return result};var getFieldIndex=function(columns,field){var index=-1;$.each(columns,function(i,column){if(column.field===field){index=i;return false}return true});return index};var setFieldIndex=function(columns){var i,j,k,totalCol=0,flag=[];for(i=0;i").addClass("fixed-table-scroll-inner"),outer=$("
    ").addClass("fixed-table-scroll-outer"),w1,w2;outer.append(inner);$("body").append(outer);w1=inner[0].offsetWidth;outer.css("overflow","scroll");w2=inner[0].offsetWidth;if(w1===w2){w2=outer[0].clientWidth}outer.remove();cachedWidth=w1-w2}return cachedWidth};var calculateObjectValue=function(self,name,args,defaultValue){var func=name;if(typeof name==="string"){var names=name.split(".");if(names.length>1){func=window;$.each(names,function(i,f){func=func[f]})}else{func=window[name]}}if(typeof func==="object"){return func}if(typeof func==="function"){return func.apply(self,args||[])}if(!func&&typeof name==="string"&&sprintf.apply(this,[name].concat(args))){return sprintf.apply(this,[name].concat(args))}return defaultValue};var compareObjects=function(objectA,objectB,compareLength){var objectAProperties=Object.getOwnPropertyNames(objectA),objectBProperties=Object.getOwnPropertyNames(objectB),propName="";if(compareLength){if(objectAProperties.length!==objectBProperties.length){return false}}for(var i=0;i-1){if(objectA[propName]!==objectB[propName]){return false}}}return true};var escapeHTML=function(text){if(typeof text==="string"){return text.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'").replace(/`/g,"`")}return text};var getRealDataAttr=function(dataAttr){for(var attr in dataAttr){var auxAttr=attr.split(/(?=[A-Z])/).join("-").toLowerCase();if(auxAttr!==attr){dataAttr[auxAttr]=dataAttr[attr];delete dataAttr[attr]}}return dataAttr};var getItemField=function(item,field,escape){var value=item;if(typeof field!=="string"||item.hasOwnProperty(field)){return escape?escapeHTML(item[field]):item[field]}var props=field.split(".");for(var p in props){if(props.hasOwnProperty(p)){value=value&&value[props[p]]}}return escape?escapeHTML(value):value};var isIEBrowser=function(){return!!(navigator.userAgent.indexOf("MSIE ")>0||!!navigator.userAgent.match(/Trident.*rv\:11\./))};var objectKeys=function(){if(!Object.keys){Object.keys=function(){var hasOwnProperty=Object.prototype.hasOwnProperty,hasDontEnumBug=!{toString:null}.propertyIsEnumerable("toString"),dontEnums=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],dontEnumsLength=dontEnums.length;return function(obj){if(typeof obj!=="object"&&(typeof obj!=="function"||obj===null)){throw new TypeError("Object.keys called on non-object")}var result=[],prop,i;for(prop in obj){if(hasOwnProperty.call(obj,prop)){result.push(prop)}}if(hasDontEnumBug){for(i=0;i','
    ',this.options.paginationVAlign==="top"||this.options.paginationVAlign==="both"?'
    ':"",'
    ','
    ','
    ','
    ',this.options.formatLoadingMessage(),"
    ","
    ",'',this.options.paginationVAlign==="bottom"||this.options.paginationVAlign==="both"?'
    ':"","
    ","
    "].join(""));this.$container.insertAfter(this.$el);this.$tableContainer=this.$container.find(".fixed-table-container");this.$tableHeader=this.$container.find(".fixed-table-header");this.$tableBody=this.$container.find(".fixed-table-body");this.$tableLoading=this.$container.find(".fixed-table-loading");this.$tableFooter=this.$container.find(".fixed-table-footer");this.$toolbar=this.$container.find(".fixed-table-toolbar");this.$pagination=this.$container.find(".fixed-table-pagination");this.$tableBody.append(this.$el);this.$container.after('
    ');this.$el.addClass(this.options.classes);if(this.options.striped){this.$el.addClass("table-striped")}if($.inArray("table-no-bordered",this.options.classes.split(" "))!==-1){this.$tableContainer.addClass("table-no-bordered")}};BootstrapTable.prototype.initTable=function(){var that=this,columns=[],data=[];this.$header=this.$el.find(">thead");if(!this.$header.length){this.$header=$("").appendTo(this.$el)}this.$header.find("tr").each(function(){var column=[];$(this).find("th").each(function(){if(typeof $(this).data("field")!=="undefined"){$(this).data("field",$(this).data("field")+"")}column.push($.extend({},{title:$(this).html(),class:$(this).attr("class"),titleTooltip:$(this).attr("title"),rowspan:$(this).attr("rowspan")?+$(this).attr("rowspan"):undefined,colspan:$(this).attr("colspan")?+$(this).attr("colspan"):undefined},$(this).data()))});columns.push(column)});if(!$.isArray(this.options.columns[0])){this.options.columns=[this.options.columns]}this.options.columns=$.extend(true,[],columns,this.options.columns);this.columns=[];setFieldIndex(this.options.columns);$.each(this.options.columns,function(i,columns){$.each(columns,function(j,column){column=$.extend({},BootstrapTable.COLUMN_DEFAULTS,column);if(typeof column.fieldIndex!=="undefined"){that.columns[column.fieldIndex]=column}that.options.columns[i][j]=column})});if(this.options.data.length){return}var m=[];this.$el.find(">tbody>tr").each(function(y){var row={};row._id=$(this).attr("id");row._class=$(this).attr("class");row._data=getRealDataAttr($(this).data());$(this).find(">td").each(function(x){var $this=$(this),cspan=+$this.attr("colspan")||1,rspan=+$this.attr("rowspan")||1,tx,ty;for(;m[y]&&m[y][x];x++);for(tx=x;tx");if(i===0&&!that.options.cardView&&that.options.detailView){html.push(sprintf('
    ',that.options.columns.length))}$.each(columns,function(j,column){var text="",halign="",align="",style="",class_=sprintf(' class="%s"',column["class"]),order=that.options.sortOrder||column.order,unitWidth="px",width=column.width;if(column.width!==undefined&&!that.options.cardView){if(typeof column.width==="string"){if(column.width.indexOf("%")!==-1){unitWidth="%"}}}if(column.width&&typeof column.width==="string"){width=column.width.replace("%","").replace("px","")}halign=sprintf("text-align: %s; ",column.halign?column.halign:column.align);align=sprintf("text-align: %s; ",column.align);style=sprintf("vertical-align: %s; ",column.valign);style+=sprintf("width: %s; ",(column.checkbox||column.radio)&&!width?"36px":width?width+unitWidth:undefined);if(typeof column.fieldIndex!=="undefined"){that.header.fields[column.fieldIndex]=column.field;that.header.styles[column.fieldIndex]=align+style;that.header.classes[column.fieldIndex]=class_;that.header.formatters[column.fieldIndex]=column.formatter;that.header.events[column.fieldIndex]=column.events;that.header.sorters[column.fieldIndex]=column.sorter;that.header.sortNames[column.fieldIndex]=column.sortName;that.header.cellStyles[column.fieldIndex]=column.cellStyle;that.header.searchables[column.fieldIndex]=column.searchable;if(!column.visible){return}if(that.options.cardView&&!column.cardVisible){return}visibleColumns[column.field]=column}html.push("");html.push(sprintf('
    ',that.options.sortable&&column.sortable?"sortable both":""));text=that.options.escape?escapeHTML(column.title):column.title;if(column.checkbox){if(!that.options.singleSelect&&that.options.checkboxHeader){text=''}that.header.stateField=column.field}if(column.radio){text="";that.header.stateField=column.field;that.options.singleSelect=true}html.push(text);html.push("
    ");html.push('
    ');html.push("");html.push("")});html.push("")});this.$header.html(html.join(""));this.$header.find("th[data-field]").each(function(i){$(this).data(visibleColumns[$(this).data("field")])});this.$container.off("click",".th-inner").on("click",".th-inner",function(event){var target=$(this);if(that.options.detailView){if(target.closest(".bootstrap-table")[0]!==that.$container[0])return false}if(that.options.sortable&&target.parent().data().sortable){that.onSort(event)}});this.$header.children().children().off("keypress").on("keypress",function(event){if(that.options.sortable&&$(this).data().sortable){var code=event.keyCode||event.which;if(code==13){that.onSort(event)}}});$(window).off("resize.bootstrap-table");if(!this.options.showHeader||this.options.cardView){this.$header.hide();this.$tableHeader.hide();this.$tableLoading.css("top",0)}else{this.$header.show();this.$tableHeader.show();this.$tableLoading.css("top",this.$header.outerHeight()+1);this.getCaret();$(window).on("resize.bootstrap-table",$.proxy(this.resetWidth,this))}this.$selectAll=this.$header.find('[name="btSelectAll"]');this.$selectAll.off("click").on("click",function(){var checked=$(this).prop("checked");that[checked?"checkAll":"uncheckAll"]();that.updateSelected()})};BootstrapTable.prototype.initFooter=function(){if(!this.options.showFooter||this.options.cardView){this.$tableFooter.hide()}else{this.$tableFooter.show()}};BootstrapTable.prototype.initData=function(data,type){if(type==="append"){this.data=this.data.concat(data)}else if(type==="prepend"){this.data=[].concat(data).concat(this.data)}else{this.data=data||this.options.data}if(type==="append"){this.options.data=this.options.data.concat(data)}else if(type==="prepend"){this.options.data=[].concat(data).concat(this.options.data)}else{this.options.data=this.data}if(this.options.sidePagination==="server"){return}this.initSort()};BootstrapTable.prototype.initSort=function(){var that=this,name=this.options.sortName,order=this.options.sortOrder==="desc"?-1:1,index=$.inArray(this.options.sortName,this.header.fields),timeoutId=0;if(this.options.customSort!==$.noop){this.options.customSort.apply(this,[this.options.sortName,this.options.sortOrder]);return}if(index!==-1){if(this.options.sortStable){$.each(this.data,function(i,row){if(!row.hasOwnProperty("_position"))row._position=i})}this.data.sort(function(a,b){if(that.header.sortNames[index]){name=that.header.sortNames[index]}var aa=getItemField(a,name,that.options.escape),bb=getItemField(b,name,that.options.escape),value=calculateObjectValue(that.header,that.header.sorters[index],[aa,bb]);if(value!==undefined){return order*value}if(aa===undefined||aa===null){aa=""}if(bb===undefined||bb===null){bb=""}if(that.options.sortStable&&aa===bb){aa=a._position;bb=b._position}if($.isNumeric(aa)&&$.isNumeric(bb)){aa=parseFloat(aa);bb=parseFloat(bb);if(aa',this.options.toolbarAlign)).appendTo(this.$toolbar).append($(this.options.toolbar))}html=[sprintf('
    ',this.options.buttonsAlign,this.options.buttonsAlign)];if(typeof this.options.icons==="string"){this.options.icons=calculateObjectValue(null,this.options.icons)}if(this.options.showPaginationSwitch){html.push(sprintf('")}if(this.options.showRefresh){html.push(sprintf('")}if(this.options.showToggle){html.push(sprintf('")}if(this.options.showColumns){html.push(sprintf('
    ',this.options.formatColumns()),'",'","
    ")}html.push("
    ");if(this.showToolbar||html.length>2){this.$toolbar.append(html.join(""))}if(this.options.showPaginationSwitch){this.$toolbar.find('button[name="paginationSwitch"]').off("click").on("click",$.proxy(this.togglePagination,this))}if(this.options.showRefresh){this.$toolbar.find('button[name="refresh"]').off("click").on("click",$.proxy(this.refresh,this))}if(this.options.showToggle){this.$toolbar.find('button[name="toggle"]').off("click").on("click",function(){that.toggleView()})}if(this.options.showColumns){$keepOpen=this.$toolbar.find(".keep-open");if(switchableCount<=this.options.minimumCountColumns){$keepOpen.find("input").prop("disabled",true)}$keepOpen.find("li").off("click").on("click",function(event){event.stopImmediatePropagation()});$keepOpen.find("input").off("click").on("click",function(){var $this=$(this);that.toggleColumn($(this).val(),$this.prop("checked"),false);that.trigger("column-switch",$(this).data("field"),$this.prop("checked"))})}if(this.options.search){html=[];html.push('");this.$toolbar.append(html.join(""));$search=this.$toolbar.find(".search input");$search.off("keyup drop blur").on("keyup drop blur",function(event){if(that.options.searchOnEnterKey&&event.keyCode!==13){return}if($.inArray(event.keyCode,[37,38,39,40])>-1){return}clearTimeout(timeoutId);timeoutId=setTimeout(function(){that.onSearch(event)},that.options.searchTimeOut)});if(isIEBrowser()){$search.off("mouseup").on("mouseup",function(event){clearTimeout(timeoutId);timeoutId=setTimeout(function(){that.onSearch(event)},that.options.searchTimeOut)})}}};BootstrapTable.prototype.onSearch=function(event){var text=$.trim($(event.currentTarget).val());if(this.options.trimOnSearch&&$(event.currentTarget).val()!==text){$(event.currentTarget).val(text)}if(text===this.searchText){return}this.searchText=text;this.options.searchText=text;this.options.pageNumber=1;this.initSearch();this.updatePagination();this.trigger("search",text)};BootstrapTable.prototype.initSearch=function(){var that=this;if(this.options.sidePagination!=="server"){if(this.options.customSearch!==$.noop){this.options.customSearch.apply(this,[this.searchText]);return}var s=this.searchText&&(this.options.escape?escapeHTML(this.searchText):this.searchText).toLowerCase();var f=$.isEmptyObject(this.filterColumns)?null:this.filterColumns;this.data=f?$.grep(this.options.data,function(item,i){for(var key in f){if($.isArray(f[key])&&$.inArray(item[key],f[key])===-1||!$.isArray(f[key])&&item[key]!==f[key]){return false}}return true}):this.options.data;this.data=s?$.grep(this.data,function(item,i){for(var j=0;j-1){$allSelected=true}}this.totalPages=~~((this.options.totalRows-1)/this.options.pageSize)+1;this.options.totalPages=this.totalPages}if(this.totalPages>0&&this.options.pageNumber>this.totalPages){this.options.pageNumber=this.totalPages}this.pageFrom=(this.options.pageNumber-1)*this.options.pageSize+1;this.pageTo=this.options.pageNumber*this.options.pageSize;if(this.pageTo>this.options.totalRows){this.pageTo=this.options.totalRows}html.push('
    ','',this.options.onlyInfoPagination?this.options.formatDetailPagination(this.options.totalRows):this.options.formatShowingRows(this.pageFrom,this.pageTo,this.options.totalRows),"");if(!this.options.onlyInfoPagination){html.push('');var pageNumber=[sprintf('',this.options.paginationVAlign==="top"||this.options.paginationVAlign==="both"?"dropdown":"dropup"),'",'");html.push(this.options.formatRecordsPerPage(pageNumber.join("")));html.push("");html.push("
    ",'")}this.$pagination.html(html.join(""));if(!this.options.onlyInfoPagination){$pageList=this.$pagination.find(".page-list a");$first=this.$pagination.find(".page-first");$pre=this.$pagination.find(".page-pre");$next=this.$pagination.find(".page-next");$last=this.$pagination.find(".page-last");$number=this.$pagination.find(".page-number");if(this.options.smartDisplay){if(this.totalPages<=1){this.$pagination.find("div.pagination").hide()}if(pageList.length<2||this.options.totalRows<=pageList[0]){this.$pagination.find("span.page-list").hide()}this.$pagination[this.getData().length?"show":"hide"]()}if(!this.options.paginationLoop){if(this.options.pageNumber===1){$pre.addClass("disabled")}if(this.options.pageNumber===this.totalPages){$next.addClass("disabled")}}if($allSelected){this.options.pageSize=this.options.formatAllRows()}$pageList.off("click").on("click",$.proxy(this.onPageListChange,this));$first.off("click").on("click",$.proxy(this.onPageFirst,this));$pre.off("click").on("click",$.proxy(this.onPagePre,this));$next.off("click").on("click",$.proxy(this.onPageNext,this));$last.off("click").on("click",$.proxy(this.onPageLast,this));$number.off("click").on("click",$.proxy(this.onPageNumber,this))}};BootstrapTable.prototype.updatePagination=function(event){if(event&&$(event.currentTarget).hasClass("disabled")){return}if(!this.options.maintainSelected){this.resetRows()}this.initPagination();if(this.options.sidePagination==="server"){this.initServer()}else{this.initBody()}this.trigger("page-change",this.options.pageNumber,this.options.pageSize)};BootstrapTable.prototype.onPageListChange=function(event){var $this=$(event.currentTarget);$this.parent().addClass("active").siblings().removeClass("active");this.options.pageSize=$this.text().toUpperCase()===this.options.formatAllRows().toUpperCase()?this.options.formatAllRows():+$this.text();this.$toolbar.find(".page-size").text(this.options.pageSize);this.updatePagination(event);return false};BootstrapTable.prototype.onPageFirst=function(event){this.options.pageNumber=1;this.updatePagination(event);return false};BootstrapTable.prototype.onPagePre=function(event){if(this.options.pageNumber-1===0){this.options.pageNumber=this.options.totalPages}else{this.options.pageNumber--}this.updatePagination(event);return false};BootstrapTable.prototype.onPageNext=function(event){if(this.options.pageNumber+1>this.options.totalPages){this.options.pageNumber=1}else{this.options.pageNumber++}this.updatePagination(event);return false};BootstrapTable.prototype.onPageLast=function(event){this.options.pageNumber=this.totalPages;this.updatePagination(event);return false};BootstrapTable.prototype.onPageNumber=function(event){if(this.options.pageNumber===+$(event.currentTarget).text()){return}this.options.pageNumber=+$(event.currentTarget).text();this.updatePagination(event);return false};BootstrapTable.prototype.initRow=function(item,i,data,parentDom){var that=this,key,html=[],style={},csses=[],data_="",attributes={},htmlAttributes=[];if($.inArray(item,this.hiddenRows)>-1){return}style=calculateObjectValue(this.options,this.options.rowStyle,[item,i],style);if(style&&style.css){for(key in style.css){csses.push(key+": "+style.css[key])}}attributes=calculateObjectValue(this.options,this.options.rowAttributes,[item,i],attributes);if(attributes){for(key in attributes){htmlAttributes.push(sprintf('%s="%s"',key,escapeHTML(attributes[key])))}}if(item._data&&!$.isEmptyObject(item._data)){$.each(item._data,function(k,v){if(k==="index"){return}data_+=sprintf(' data-%s="%s"',k,v)})}html.push("");if(this.options.cardView){html.push(sprintf('
    ',this.header.fields.length))}if(!this.options.cardView&&this.options.detailView){html.push("",'',sprintf('',this.options.iconsPrefix,this.options.icons.detailOpen),"","")}$.each(this.header.fields,function(j,field){var text="",value_=getItemField(item,field,that.options.escape),value="",type="",cellStyle={},id_="",class_=that.header.classes[j],data_="",rowspan_="",colspan_="",title_="",column=that.columns[j];if(that.fromHtml&&typeof value_==="undefined"){return}if(!column.visible){return}if(that.options.cardView&&!column.cardVisible){return}if(column.escape){value_=escapeHTML(value_)}style=sprintf('style="%s"',csses.concat(that.header.styles[j]).join("; "));if(item["_"+field+"_id"]){id_=sprintf(' id="%s"',item["_"+field+"_id"])}if(item["_"+field+"_class"]){class_=sprintf(' class="%s"',item["_"+field+"_class"])}if(item["_"+field+"_rowspan"]){rowspan_=sprintf(' rowspan="%s"',item["_"+field+"_rowspan"])}if(item["_"+field+"_colspan"]){colspan_=sprintf(' colspan="%s"',item["_"+field+"_colspan"])}if(item["_"+field+"_title"]){title_=sprintf(' title="%s"',item["_"+field+"_title"])}cellStyle=calculateObjectValue(that.header,that.header.cellStyles[j],[value_,item,i,field],cellStyle);if(cellStyle.classes){class_=sprintf(' class="%s"',cellStyle.classes)}if(cellStyle.css){var csses_=[];for(var key in cellStyle.css){csses_.push(key+": "+cellStyle.css[key])}style=sprintf('style="%s"',csses_.concat(that.header.styles[j]).join("; "))}value=calculateObjectValue(column,that.header.formatters[j],[value_,item,i],value_);if(item["_"+field+"_data"]&&!$.isEmptyObject(item["_"+field+"_data"])){$.each(item["_"+field+"_data"],function(k,v){if(k==="index"){return}data_+=sprintf(' data-%s="%s"',k,v)})}if(column.checkbox||column.radio){type=column.checkbox?"checkbox":type;type=column.radio?"radio":type;text=[sprintf(that.options.cardView?'
    ':'',column["class"]||""),"",that.header.formatters[j]&&typeof value==="string"?value:"",that.options.cardView?"
    ":""].join("");item[that.header.stateField]=value===true||value&&value.checked}else{value=typeof value==="undefined"||value===null?that.options.undefinedText:value;text=that.options.cardView?['
    ',that.options.showHeader?sprintf('%s',style,getPropertyFromOther(that.columns,"field","title",field)):"",sprintf('%s',value),"
    "].join(""):[sprintf("",id_,class_,style,data_,rowspan_,colspan_,title_),value,""].join("");if(that.options.cardView&&that.options.smartDisplay&&value===""){text='
    '}}html.push(text)});if(this.options.cardView){html.push("
    ")}html.push("");return html.join(" ")};BootstrapTable.prototype.initBody=function(fixedScroll){var that=this,html=[],data=this.getData();this.trigger("pre-body",data);this.$body=this.$el.find(">tbody");if(!this.$body.length){this.$body=$("").appendTo(this.$el)}if(!this.options.pagination||this.options.sidePagination==="server"){this.pageFrom=1;this.pageTo=data.length}var trFragments=$(document.createDocumentFragment());var hasTr;for(var i=this.pageFrom-1;i'+sprintf('%s',this.$header.find("th").length,this.options.formatNoMatches())+"")}this.$body.html(trFragments);if(!fixedScroll){this.scrollTo(0)}this.$body.find("> tr[data-index] > td").off("click dblclick").on("click dblclick",function(e){var $td=$(this),$tr=$td.parent(),item=that.data[$tr.data("index")],index=$td[0].cellIndex,fields=that.getVisibleFields(),field=fields[that.options.detailView&&!that.options.cardView?index-1:index],column=that.columns[getFieldIndex(that.columns,field)],value=getItemField(item,field,that.options.escape);if($td.find(".detail-icon").length){return}that.trigger(e.type==="click"?"click-cell":"dbl-click-cell",field,value,item,$td);that.trigger(e.type==="click"?"click-row":"dbl-click-row",item,$tr,field);if(e.type==="click"&&that.options.clickToSelect&&column.clickToSelect){var $selectItem=$tr.find(sprintf('[name="%s"]',that.options.selectItemName));if($selectItem.length){$selectItem[0].click()}}});this.$body.find("> tr[data-index] > td > .detail-icon").off("click").on("click",function(){var $this=$(this),$tr=$this.parent().parent(),index=$tr.data("index"),row=data[index];if($tr.next().is("tr.detail-view")){$this.find("i").attr("class",sprintf("%s %s",that.options.iconsPrefix,that.options.icons.detailOpen));that.trigger("collapse-row",index,row);$tr.next().remove()}else{$this.find("i").attr("class",sprintf("%s %s",that.options.iconsPrefix,that.options.icons.detailClose));$tr.after(sprintf('',$tr.find("td").length));var $element=$tr.next().find("td");var content=calculateObjectValue(that.options,that.options.detailFormatter,[index,row,$element],"");if($element.length===1){$element.append(content)}that.trigger("expand-row",index,row,$element)}that.resetView();return false});this.$selectItem=this.$body.find(sprintf('[name="%s"]',this.options.selectItemName));this.$selectItem.off("click").on("click",function(event){event.stopImmediatePropagation();var $this=$(this),checked=$this.prop("checked"),row=that.data[$this.data("index")];if(that.options.maintainSelected&&$(this).is(":radio")){$.each(that.options.data,function(i,row){row[that.header.stateField]=false})}row[that.header.stateField]=checked;if(that.options.singleSelect){that.$selectItem.not(this).each(function(){that.data[$(this).data("index")][that.header.stateField]=false});that.$selectItem.filter(":checked").not(this).prop("checked",false)}that.updateSelected();that.trigger(checked?"check":"uncheck",row,$this)});$.each(this.header.events,function(i,events){if(!events){return}if(typeof events==="string"){events=calculateObjectValue(null,events)}var field=that.header.fields[i],fieldIndex=$.inArray(field,that.getVisibleFields());if(that.options.detailView&&!that.options.cardView){fieldIndex+=1}for(var key in events){that.$body.find(">tr:not(.no-records-found)").each(function(){var $tr=$(this),$td=$tr.find(that.options.cardView?".card-view":"td").eq(fieldIndex),index=key.indexOf(" "),name=key.substring(0,index),el=key.substring(index+1),func=events[key];$td.find(el).off(name).on(name,function(e){var index=$tr.data("index"),row=that.data[index],value=row[field];var props=field.split(".");if(props.length>1){value=row;for(var prop_index=0;prop_indexfixedBody.clientWidth&&fixedBody.scrollHeight>fixedBody.clientHeight+this.$header.outerHeight()?getScrollBarWidth():0;this.$el.css("margin-top",-this.$header.outerHeight());focused=$(":focus");if(focused.length>0){var $th=focused.parents("th");if($th.length>0){var dataField=$th.attr("data-field");if(dataField!==undefined){var $headerTh=this.$header.find("[data-field='"+dataField+"']");if($headerTh.length>0){$headerTh.find(":input").addClass("focus-temp")}}}}this.$header_=this.$header.clone(true,true);this.$selectAll_=this.$header_.find('[name="btSelectAll"]');this.$tableHeader.css({"margin-right":scrollWidth}).find("table").css("width",this.$el.outerWidth()).html("").attr("class",this.$el.attr("class")).append(this.$header_);focusedTemp=$(".focus-temp:visible:eq(0)");if(focusedTemp.length>0){focusedTemp.focus();this.$header.find(".focus-temp").removeClass("focus-temp")}this.$header.find("th[data-field]").each(function(i){that.$header_.find(sprintf('th[data-field="%s"]',$(this).data("field"))).data($(this).data())});var visibleFields=this.getVisibleFields(),$ths=this.$header_.find("th");this.$body.find(">tr:first-child:not(.no-records-found) > *").each(function(i){var $this=$(this),index=i;if(that.options.detailView&&!that.options.cardView){if(i===0){that.$header_.find("th.detail").find(".fht-cell").width($this.innerWidth())}index=i-1}var $th=that.$header_.find(sprintf('th[data-field="%s"]',visibleFields[index]));if($th.length>1){$th=$($ths[$this[0].cellIndex])}$th.find(".fht-cell").width($this.innerWidth())});this.$tableBody.off("scroll").on("scroll",function(){that.$tableHeader.scrollLeft($(this).scrollLeft());if(that.options.showFooter&&!that.options.cardView){that.$tableFooter.scrollLeft($(this).scrollLeft())}});that.trigger("post-header")};BootstrapTable.prototype.resetFooter=function(){var that=this,data=that.getData(),html=[];if(!this.options.showFooter||this.options.cardView){return}if(!this.options.cardView&&this.options.detailView){html.push('
     
    ')}$.each(this.columns,function(i,column){var key,falign="",valign="",csses=[],style={},class_=sprintf(' class="%s"',column["class"]);if(!column.visible){return}if(that.options.cardView&&!column.cardVisible){return}falign=sprintf("text-align: %s; ",column.falign?column.falign:column.align);valign=sprintf("vertical-align: %s; ",column.valign);style=calculateObjectValue(null,that.options.footerStyle);if(style&&style.css){for(key in style.css){csses.push(key+": "+style.css[key])}}html.push("");html.push('
    ');html.push(calculateObjectValue(column,column.footerFormatter,[data]," ")||" ");html.push("
    ");html.push('
    ');html.push("");html.push("")});this.$tableFooter.find("tr").html(html.join(""));this.$tableFooter.show();clearTimeout(this.timeoutFooter_);this.timeoutFooter_=setTimeout($.proxy(this.fitFooter,this),this.$el.is(":hidden")?100:0)};BootstrapTable.prototype.fitFooter=function(){var that=this,$footerTd,elWidth,scrollWidth;clearTimeout(this.timeoutFooter_);if(this.$el.is(":hidden")){this.timeoutFooter_=setTimeout($.proxy(this.fitFooter,this),100);return}elWidth=this.$el.css("width");scrollWidth=elWidth>this.$tableBody.width()?getScrollBarWidth():0;this.$tableFooter.css({"margin-right":scrollWidth}).find("table").css("width",elWidth).attr("class",this.$el.attr("class"));$footerTd=this.$tableFooter.find("td");this.$body.find(">tr:first-child:not(.no-records-found) > *").each(function(i){var $this=$(this);$footerTd.eq(i).find(".fht-cell").width($this.innerWidth())})};BootstrapTable.prototype.toggleColumn=function(index,checked,needUpdate){if(index===-1){return}this.columns[index].visible=checked;this.initHeader();this.initSearch();this.initPagination();this.initBody();if(this.options.showColumns){var $items=this.$toolbar.find(".keep-open input").prop("disabled",false);if(needUpdate){$items.filter(sprintf('[value="%s"]',index)).prop("checked",checked)}if($items.filter(":checked").length<=this.options.minimumCountColumns){$items.filter(":checked").prop("disabled",true)}}};BootstrapTable.prototype.getVisibleFields=function(){var that=this,visibleFields=[];$.each(this.header.fields,function(j,field){var column=that.columns[getFieldIndex(that.columns,field)];if(!column.visible){return}visibleFields.push(field)});return visibleFields};BootstrapTable.prototype.resetView=function(params){var padding=0;if(params&¶ms.height){this.options.height=params.height}this.$selectAll.prop("checked",this.$selectItem.length>0&&this.$selectItem.length===this.$selectItem.filter(":checked").length);if(this.options.height){var toolbarHeight=this.$toolbar.outerHeight(true),paginationHeight=this.$pagination.outerHeight(true),height=this.options.height-toolbarHeight-paginationHeight;this.$tableContainer.css("height",height+"px")}if(this.options.cardView){this.$el.css("margin-top","0");this.$tableContainer.css("padding-bottom","0");this.$tableFooter.hide();return}if(this.options.showHeader&&this.options.height){this.$tableHeader.show();this.resetHeader();padding+=this.$header.outerHeight()}else{this.$tableHeader.hide();this.trigger("post-header")}if(this.options.showFooter){this.resetFooter();if(this.options.height){padding+=this.$tableFooter.outerHeight()+1}}this.getCaret();this.$tableContainer.css("padding-bottom",padding+"px");this.trigger("reset-view")};BootstrapTable.prototype.getData=function(useCurrentPage){return this.searchText||!$.isEmptyObject(this.filterColumns)||!$.isEmptyObject(this.filterColumnsPartial)?useCurrentPage?this.data.slice(this.pageFrom-1,this.pageTo):this.data:useCurrentPage?this.options.data.slice(this.pageFrom-1,this.pageTo):this.options.data};BootstrapTable.prototype.load=function(data){var fixedScroll=false;if(this.options.sidePagination==="server"){this.options.totalRows=data[this.options.totalField];fixedScroll=data.fixedScroll;data=data[this.options.dataField]}else if(!$.isArray(data)){fixedScroll=data.fixedScroll;data=data.data}this.initData(data);this.initSearch();this.initPagination();this.initBody(fixedScroll)};BootstrapTable.prototype.append=function(data){this.initData(data,"append");this.initSearch();this.initPagination();this.initSort();this.initBody(true)};BootstrapTable.prototype.prepend=function(data){this.initData(data,"prepend");this.initSearch();this.initPagination();this.initSort();this.initBody(true)};BootstrapTable.prototype.remove=function(params){var len=this.options.data.length,i,row;if(!params.hasOwnProperty("field")||!params.hasOwnProperty("values")){return}for(i=len-1;i>=0;i--){row=this.options.data[i];if(!row.hasOwnProperty(params.field)){continue}if($.inArray(row[params.field],params.values)!==-1){this.options.data.splice(i,1);if(this.options.sidePagination==="server"){this.options.totalRows-=1}}}if(len===this.options.data.length){return}this.initSearch();this.initPagination();this.initSort();this.initBody(true)};BootstrapTable.prototype.removeAll=function(){if(this.options.data.length>0){this.options.data.splice(0,this.options.data.length);this.initSearch();this.initPagination();this.initBody(true)}};BootstrapTable.prototype.getRowByUniqueId=function(id){var uniqueId=this.options.uniqueId,len=this.options.data.length,dataRow=null,i,row,rowUniqueId;for(i=len-1;i>=0;i--){row=this.options.data[i];if(row.hasOwnProperty(uniqueId)){rowUniqueId=row[uniqueId]}else if(row._data.hasOwnProperty(uniqueId)){rowUniqueId=row._data[uniqueId]}else{continue}if(typeof rowUniqueId==="string"){id=id.toString()}else if(typeof rowUniqueId==="number"){if(Number(rowUniqueId)===rowUniqueId&&rowUniqueId%1===0){id=parseInt(id)}else if(rowUniqueId===Number(rowUniqueId)&&rowUniqueId!==0){id=parseFloat(id)}}if(rowUniqueId===id){dataRow=row;break}}return dataRow};BootstrapTable.prototype.removeByUniqueId=function(id){var len=this.options.data.length,row=this.getRowByUniqueId(id);if(row){this.options.data.splice(this.options.data.indexOf(row),1)}if(len===this.options.data.length){return}this.initSearch();this.initPagination();this.initBody(true)};BootstrapTable.prototype.updateByUniqueId=function(params){var that=this;var allParams=$.isArray(params)?params:[params];$.each(allParams,function(i,params){var rowId;if(!params.hasOwnProperty("id")||!params.hasOwnProperty("row")){return}rowId=$.inArray(that.getRowByUniqueId(params.id),that.options.data);if(rowId===-1){return}$.extend(that.options.data[rowId],params.row)});this.initSearch();this.initPagination();this.initSort();this.initBody(true)};BootstrapTable.prototype.insertRow=function(params){if(!params.hasOwnProperty("index")||!params.hasOwnProperty("row")){return}this.data.splice(params.index,0,params.row);this.initSearch();this.initPagination();this.initSort();this.initBody(true)};BootstrapTable.prototype.updateRow=function(params){var that=this;var allParams=$.isArray(params)?params:[params];$.each(allParams,function(i,params){if(!params.hasOwnProperty("index")||!params.hasOwnProperty("row")){return}$.extend(that.options.data[params.index],params.row)});this.initSearch();this.initPagination();this.initSort();this.initBody(true)};BootstrapTable.prototype.initHiddenRows=function(){this.hiddenRows=[]};BootstrapTable.prototype.showRow=function(params){this.toggleRow(params,true)};BootstrapTable.prototype.hideRow=function(params){this.toggleRow(params,false)};BootstrapTable.prototype.toggleRow=function(params,visible){var row,index;if(params.hasOwnProperty("index")){row=this.getData()[params.index]}else if(params.hasOwnProperty("uniqueId")){row=this.getRowByUniqueId(params.uniqueId)}if(!row){return}index=$.inArray(row,this.hiddenRows);if(!visible&&index===-1){this.hiddenRows.push(row)}else if(visible&&index>-1){this.hiddenRows.splice(index,1)}this.initBody(true)};BootstrapTable.prototype.getHiddenRows=function(show){var that=this,data=this.getData(),rows=[];$.each(data,function(i,row){if($.inArray(row,that.hiddenRows)>-1){rows.push(row)}});this.hiddenRows=rows;return rows};BootstrapTable.prototype.mergeCells=function(options){var row=options.index,col=$.inArray(options.field,this.getVisibleFields()),rowspan=options.rowspan||1,colspan=options.colspan||1,i,j,$tr=this.$body.find(">tr"),$td;if(this.options.detailView&&!this.options.cardView){col+=1}$td=$tr.eq(row).find(">td").eq(col);if(row<0||col<0||row>=this.data.length){return}for(i=row;itd").eq(j).hide()}}$td.attr("rowspan",rowspan).attr("colspan",colspan).show()};BootstrapTable.prototype.updateCell=function(params){if(!params.hasOwnProperty("index")||!params.hasOwnProperty("field")||!params.hasOwnProperty("value")){return}this.data[params.index][params.field]=params.value;if(params.reinit===false){return}this.initSort();this.initBody(true)};BootstrapTable.prototype.getOptions=function(){return this.options};BootstrapTable.prototype.getSelections=function(){var that=this;return $.grep(this.options.data,function(row){return row[that.header.stateField]===true})};BootstrapTable.prototype.getAllSelections=function(){var that=this;return $.grep(this.options.data,function(row){return row[that.header.stateField]})};BootstrapTable.prototype.checkAll=function(){this.checkAll_(true)};BootstrapTable.prototype.uncheckAll=function(){this.checkAll_(false)};BootstrapTable.prototype.checkInvert=function(){var that=this;var rows=that.$selectItem.filter(":enabled");var checked=rows.filter(":checked");rows.each(function(){$(this).prop("checked",!$(this).prop("checked"))});that.updateRows();that.updateSelected();that.trigger("uncheck-some",checked);checked=that.getSelections();that.trigger("check-some",checked)};BootstrapTable.prototype.checkAll_=function(checked){var rows;if(!checked){rows=this.getSelections()}this.$selectAll.add(this.$selectAll_).prop("checked",checked);this.$selectItem.filter(":enabled").prop("checked",checked);this.updateRows();if(checked){rows=this.getSelections()}this.trigger(checked?"check-all":"uncheck-all",rows)};BootstrapTable.prototype.check=function(index){this.check_(true,index)};BootstrapTable.prototype.uncheck=function(index){this.check_(false,index)};BootstrapTable.prototype.check_=function(checked,index){var $el=this.$selectItem.filter(sprintf('[data-index="%s"]',index)).prop("checked",checked);this.data[index][this.header.stateField]=checked;this.updateSelected();this.trigger(checked?"check":"uncheck",this.data[index],$el)};BootstrapTable.prototype.checkBy=function(obj){this.checkBy_(true,obj)};BootstrapTable.prototype.uncheckBy=function(obj){this.checkBy_(false,obj)};BootstrapTable.prototype.checkBy_=function(checked,obj){if(!obj.hasOwnProperty("field")||!obj.hasOwnProperty("values")){return}var that=this,rows=[];$.each(this.options.data,function(index,row){if(!row.hasOwnProperty(obj.field)){return false}if($.inArray(row[obj.field],obj.values)!==-1){var $el=that.$selectItem.filter(":enabled").filter(sprintf('[data-index="%s"]',index)).prop("checked",checked);row[that.header.stateField]=checked;rows.push(row);that.trigger(checked?"check":"uncheck",row,$el)}});this.updateSelected();this.trigger(checked?"check-some":"uncheck-some",rows)};BootstrapTable.prototype.destroy=function(){this.$el.insertBefore(this.$container);$(this.options.toolbar).insertBefore(this.$el);this.$container.next().remove();this.$container.remove();this.$el.html(this.$el_.html()).css("margin-top","0").attr("class",this.$el_.attr("class")||"")};BootstrapTable.prototype.showLoading=function(){this.$tableLoading.show()};BootstrapTable.prototype.hideLoading=function(){this.$tableLoading.hide()};BootstrapTable.prototype.togglePagination=function(){this.options.pagination=!this.options.pagination;var button=this.$toolbar.find('button[name="paginationSwitch"] i');if(this.options.pagination){button.attr("class",this.options.iconsPrefix+" "+this.options.icons.paginationSwitchDown)}else{button.attr("class",this.options.iconsPrefix+" "+this.options.icons.paginationSwitchUp)}this.updatePagination()};BootstrapTable.prototype.refresh=function(params){if(params&¶ms.url){this.options.url=params.url}if(params&¶ms.pageNumber){this.options.pageNumber=params.pageNumber}if(params&¶ms.pageSize){this.options.pageSize=params.pageSize}this.initServer(params&¶ms.silent,params&¶ms.query,params&¶ms.url);this.trigger("refresh",params)};BootstrapTable.prototype.resetWidth=function(){if(this.options.showHeader&&this.options.height){this.fitHeader()}if(this.options.showFooter){this.fitFooter()}};BootstrapTable.prototype.showColumn=function(field){this.toggleColumn(getFieldIndex(this.columns,field),true,true)};BootstrapTable.prototype.hideColumn=function(field){this.toggleColumn(getFieldIndex(this.columns,field),false,true)};BootstrapTable.prototype.getHiddenColumns=function(){return $.grep(this.columns,function(column){return!column.visible})};BootstrapTable.prototype.getVisibleColumns=function(){return $.grep(this.columns,function(column){return column.visible})};BootstrapTable.prototype.toggleAllColumns=function(visible){$.each(this.columns,function(i,column){this.columns[i].visible=visible});this.initHeader();this.initSearch();this.initPagination();this.initBody();if(this.options.showColumns){var $items=this.$toolbar.find(".keep-open input").prop("disabled",false);if($items.filter(":checked").length<=this.options.minimumCountColumns){$items.filter(":checked").prop("disabled",true)}}};BootstrapTable.prototype.showAllColumns=function(){this.toggleAllColumns(true)};BootstrapTable.prototype.hideAllColumns=function(){this.toggleAllColumns(false)};BootstrapTable.prototype.filterBy=function(columns){this.filterColumns=$.isEmptyObject(columns)?{}:columns;this.options.pageNumber=1;this.initSearch();this.updatePagination()};BootstrapTable.prototype.scrollTo=function(value){if(typeof value==="string"){value=value==="bottom"?this.$tableBody[0].scrollHeight:0}if(typeof value==="number"){this.$tableBody.scrollTop(value)}if(typeof value==="undefined"){return this.$tableBody.scrollTop()}};BootstrapTable.prototype.getScrollPosition=function(){return this.scrollTo()};BootstrapTable.prototype.selectPage=function(page){if(page>0&&page<=this.options.totalPages){this.options.pageNumber=page;this.updatePagination()}};BootstrapTable.prototype.prevPage=function(){if(this.options.pageNumber>1){this.options.pageNumber--;this.updatePagination()}};BootstrapTable.prototype.nextPage=function(){if(this.options.pageNumber tr[data-index="%s"]',index));if($tr.next().is("tr.detail-view")===(expand?false:true)){$tr.find("> td > .detail-icon").click()}};BootstrapTable.prototype.expandRow=function(index){this.expandRow_(true,index)};BootstrapTable.prototype.collapseRow=function(index){this.expandRow_(false,index)};BootstrapTable.prototype.expandAllRows=function(isSubTable){if(isSubTable){var $tr=this.$body.find(sprintf('> tr[data-index="%s"]',0)),that=this,detailIcon=null,executeInterval=false,idInterval=-1;if(!$tr.next().is("tr.detail-view")){$tr.find("> td > .detail-icon").click();executeInterval=true}else if(!$tr.next().next().is("tr.detail-view")){$tr.next().find(".detail-icon").click();executeInterval=true}if(executeInterval){try{idInterval=setInterval(function(){detailIcon=that.$body.find("tr.detail-view").last().find(".detail-icon");if(detailIcon.length>0){detailIcon.click()}else{clearInterval(idInterval)}},1)}catch(ex){clearInterval(idInterval)}}}else{var trs=this.$body.children();for(var i=0;i.btn-group'); + var $btnAutoRefresh = $btnGroup.find('.auto-refresh'); + + if (!$btnAutoRefresh.length) { + $btnAutoRefresh = $([ + sprintf('' + ].join('')).appendTo($btnGroup); + + $btnAutoRefresh.on('click', $.proxy(this.toggleAutoRefresh, this)); + } + } + }; + + BootstrapTable.prototype.toggleAutoRefresh = function() { + if (this.options.autoRefresh) { + if (this.options.autoRefreshStatus) { + clearInterval(this.options.autoRefreshFunction); + this.$toolbar.find('>.btn-group').find('.auto-refresh').removeClass('enabled'); + } else { + var that = this; + this.options.autoRefreshFunction = setInterval(function () { + that.refresh({silent: that.options.autoRefreshSilent}); + }, this.options.autoRefreshInterval*1000); + this.$toolbar.find('>.btn-group').find('.auto-refresh').addClass('enabled'); + } + this.options.autoRefreshStatus = !this.options.autoRefreshStatus; + } + }; + +})(jQuery); diff --git a/public/assets/libs/bootstrap-table/dist/extensions/auto-refresh/bootstrap-table-auto-refresh.min.js b/public/assets/libs/bootstrap-table/dist/extensions/auto-refresh/bootstrap-table-auto-refresh.min.js new file mode 100644 index 0000000..bb7f595 --- /dev/null +++ b/public/assets/libs/bootstrap-table/dist/extensions/auto-refresh/bootstrap-table-auto-refresh.min.js @@ -0,0 +1,7 @@ +/* +* bootstrap-table - v1.11.1 - 2017-02-22 +* https://github.com/wenzhixin/bootstrap-table +* Copyright (c) 2017 zhixin wen +* Licensed MIT License +*/ +!function(a){"use strict";a.extend(a.fn.bootstrapTable.defaults,{autoRefresh:!1,autoRefreshInterval:60,autoRefreshSilent:!0,autoRefreshStatus:!0,autoRefreshFunction:null}),a.extend(a.fn.bootstrapTable.defaults.icons,{autoRefresh:"glyphicon-time icon-time"}),a.extend(a.fn.bootstrapTable.locales,{formatAutoRefresh:function(){return"Auto Refresh"}}),a.extend(a.fn.bootstrapTable.defaults,a.fn.bootstrapTable.locales);var b=a.fn.bootstrapTable.Constructor,c=b.prototype.init,d=b.prototype.initToolbar,e=a.fn.bootstrapTable.utils.sprintf;b.prototype.init=function(){if(c.apply(this,Array.prototype.slice.apply(arguments)),this.options.autoRefresh&&this.options.autoRefreshStatus){var a=this;this.options.autoRefreshFunction=setInterval(function(){a.refresh({silent:a.options.autoRefreshSilent})},1e3*this.options.autoRefreshInterval)}},b.prototype.initToolbar=function(){if(d.apply(this,Array.prototype.slice.apply(arguments)),this.options.autoRefresh){var b=this.$toolbar.find(">.btn-group"),c=b.find(".auto-refresh");c.length||(c=a([e('"].join("")).appendTo(b),c.on("click",a.proxy(this.toggleAutoRefresh,this)))}},b.prototype.toggleAutoRefresh=function(){if(this.options.autoRefresh){if(this.options.autoRefreshStatus)clearInterval(this.options.autoRefreshFunction),this.$toolbar.find(">.btn-group").find(".auto-refresh").removeClass("enabled");else{var a=this;this.options.autoRefreshFunction=setInterval(function(){a.refresh({silent:a.options.autoRefreshSilent})},1e3*this.options.autoRefreshInterval),this.$toolbar.find(">.btn-group").find(".auto-refresh").addClass("enabled")}this.options.autoRefreshStatus=!this.options.autoRefreshStatus}}}(jQuery); \ No newline at end of file diff --git a/public/assets/libs/bootstrap-table/dist/extensions/click-edit-row/bootstrap-table-click-edit-row.css b/public/assets/libs/bootstrap-table/dist/extensions/click-edit-row/bootstrap-table-click-edit-row.css new file mode 100644 index 0000000..85c3645 --- /dev/null +++ b/public/assets/libs/bootstrap-table/dist/extensions/click-edit-row/bootstrap-table-click-edit-row.css @@ -0,0 +1,21 @@ +#tooling{ + float: right; +} +.clear{ + display: block; + width: 13px; + height: 13px; + position: absolute; + opacity: 0.6; + z-index: 100; + top: 50%; + right: 26px; + margin-top: -10px; + cursor: pointer; +} +.clear > i{ + font-size: 1.5em; +} +.clear > i:hover{ + color: hsl(0, 0%, 75%); +} \ No newline at end of file diff --git a/public/assets/libs/bootstrap-table/dist/extensions/click-edit-row/bootstrap-table-click-edit-row.js b/public/assets/libs/bootstrap-table/dist/extensions/click-edit-row/bootstrap-table-click-edit-row.js new file mode 100644 index 0000000..3af4e5c --- /dev/null +++ b/public/assets/libs/bootstrap-table/dist/extensions/click-edit-row/bootstrap-table-click-edit-row.js @@ -0,0 +1,142 @@ +/** + * @author horken wong + * @version: v1.0.0 + * https://github.com/horkenw/bootstrap-table + * Click to edit row for bootstrap-table + */ + +(function ($) { + 'use strict'; + + $.extend($.fn.bootstrapTable.defaults, { + clickEdit: false + }); + + function setDivision(node, options){ + var $option = $('