\n\t\t*/\n\t\tfunction _rotateToOrientaion(img, orientation) {\n\t\t\tvar RADIANS = Math.PI/180;\n\t\t\tvar canvas = document.createElement('canvas');\n\t\t\tvar ctx = canvas.getContext('2d');\n\t\t\tvar width = img.width;\n\t\t\tvar height = img.height;\n\n\t\t\tif (Basic.inArray(orientation, [5,6,7,8]) > -1) {\n\t\t\t\tcanvas.width = height;\n\t\t\t\tcanvas.height = width;\n\t\t\t} else {\n\t\t\t\tcanvas.width = width;\n\t\t\t\tcanvas.height = height;\n\t\t\t}\n\n\t\t\t/**\n\t\t\t1 = The 0th row is at the visual top of the image, and the 0th column is the visual left-hand side.\n\t\t\t2 = The 0th row is at the visual top of the image, and the 0th column is the visual right-hand side.\n\t\t\t3 = The 0th row is at the visual bottom of the image, and the 0th column is the visual right-hand side.\n\t\t\t4 = The 0th row is at the visual bottom of the image, and the 0th column is the visual left-hand side.\n\t\t\t5 = The 0th row is the visual left-hand side of the image, and the 0th column is the visual top.\n\t\t\t6 = The 0th row is the visual right-hand side of the image, and the 0th column is the visual top.\n\t\t\t7 = The 0th row is the visual right-hand side of the image, and the 0th column is the visual bottom.\n\t\t\t8 = The 0th row is the visual left-hand side of the image, and the 0th column is the visual bottom.\n\t\t\t*/\n\t\t\tswitch (orientation) {\n\t\t\t\tcase 2:\n\t\t\t\t\t// horizontal flip\n\t\t\t\t\tctx.translate(width, 0);\n\t\t\t\t\tctx.scale(-1, 1);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 3:\n\t\t\t\t\t// 180 rotate left\n\t\t\t\t\tctx.translate(width, height);\n\t\t\t\t\tctx.rotate(180 * RADIANS);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 4:\n\t\t\t\t\t// vertical flip\n\t\t\t\t\tctx.translate(0, height);\n\t\t\t\t\tctx.scale(1, -1);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 5:\n\t\t\t\t\t// vertical flip + 90 rotate right\n\t\t\t\t\tctx.rotate(90 * RADIANS);\n\t\t\t\t\tctx.scale(1, -1);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 6:\n\t\t\t\t\t// 90 rotate right\n\t\t\t\t\tctx.rotate(90 * RADIANS);\n\t\t\t\t\tctx.translate(0, -height);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 7:\n\t\t\t\t\t// horizontal flip + 90 rotate right\n\t\t\t\t\tctx.rotate(90 * RADIANS);\n\t\t\t\t\tctx.translate(width, -height);\n\t\t\t\t\tctx.scale(-1, 1);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 8:\n\t\t\t\t\t// 90 rotate left\n\t\t\t\t\tctx.rotate(-90 * RADIANS);\n\t\t\t\t\tctx.translate(-width, 0);\n\t\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tctx.drawImage(img, 0, 0, width, height);\n\t\t\treturn canvas;\n\t\t}\n\n\n\t\tfunction _purge() {\n\t\t\tif (_imgInfo) {\n\t\t\t\t_imgInfo.purge();\n\t\t\t\t_imgInfo = null;\n\t\t\t}\n\n\t\t\t_binStr = _img = _canvas = _blob = null;\n\t\t\t_modified = false;\n\t\t}\n\t}\n\n\treturn (extensions.Image = HTML5Image);\n});\n\n// Included from: src/javascript/runtime/flash/Runtime.js\n\n/**\n * Runtime.js\n *\n * Copyright 2013, Moxiecode Systems AB\n * Released under GPL License.\n *\n * License: http://www.plupload.com/license\n * Contributing: http://www.plupload.com/contributing\n */\n\n/*global ActiveXObject:true */\n\n/**\nDefines constructor for Flash runtime.\n\n@class moxie/runtime/flash/Runtime\n@private\n*/\ndefine(\"moxie/runtime/flash/Runtime\", [\n\t\"moxie/core/utils/Basic\",\n\t\"moxie/core/utils/Env\",\n\t\"moxie/core/utils/Dom\",\n\t\"moxie/core/Exceptions\",\n\t\"moxie/runtime/Runtime\"\n], function(Basic, Env, Dom, x, Runtime) {\n\t\n\tvar type = 'flash', extensions = {};\n\n\t/**\n\tGet the version of the Flash Player\n\n\t@method getShimVersion\n\t@private\n\t@return {Number} Flash Player version\n\t*/\n\tfunction getShimVersion() {\n\t\tvar version;\n\n\t\ttry {\n\t\t\tversion = navigator.plugins['Shockwave Flash'];\n\t\t\tversion = version.description;\n\t\t} catch (e1) {\n\t\t\ttry {\n\t\t\t\tversion = new ActiveXObject('ShockwaveFlash.ShockwaveFlash').GetVariable('$version');\n\t\t\t} catch (e2) {\n\t\t\t\tversion = '0.0';\n\t\t\t}\n\t\t}\n\t\tversion = version.match(/\\d+/g);\n\t\treturn parseFloat(version[0] + '.' + version[1]);\n\t}\n\n\n\t/**\n\tCross-browser SWF removal\n \t- Especially needed to safely and completely remove a SWF in Internet Explorer\n\n \tOriginated from SWFObject v2.2 \n\t*/\n\tfunction removeSWF(id) {\n var obj = Dom.get(id);\n if (obj && obj.nodeName == \"OBJECT\") {\n if (Env.browser === 'IE') {\n obj.style.display = \"none\";\n (function onInit(){\n \t// http://msdn.microsoft.com/en-us/library/ie/ms534360(v=vs.85).aspx\n if (obj.readyState == 4) {\n removeObjectInIE(id);\n }\n else {\n setTimeout(onInit, 10);\n }\n })();\n }\n else {\n obj.parentNode.removeChild(obj);\n }\n }\n }\n\n\n\tfunction removeObjectInIE(id) {\n var obj = Dom.get(id);\n if (obj) {\n for (var i in obj) {\n if (typeof obj[i] == \"function\") {\n obj[i] = null;\n }\n }\n obj.parentNode.removeChild(obj);\n }\n }\n\n\t/**\n\tConstructor for the Flash Runtime\n\t*/\n\tfunction FlashRuntime(options) {\n\t\tvar I = this, initTimer;\n\n\t\toptions = Basic.extend({ swf_url: Env.swf_url }, options);\n\n\t\tRuntime.call(this, options, type, {\n\t\t\taccess_binary: function(value) {\n\t\t\t\treturn value && I.mode === 'browser';\n\t\t\t},\n\t\t\taccess_image_binary: function(value) {\n\t\t\t\treturn value && I.mode === 'browser';\n\t\t\t},\n\t\t\tdisplay_media: Runtime.capTest(defined('moxie/image/Image')),\n\t\t\tdo_cors: Runtime.capTrue,\n\t\t\tdrag_and_drop: false,\n\t\t\treport_upload_progress: function() {\n\t\t\t\treturn I.mode === 'client';\n\t\t\t},\n\t\t\tresize_image: Runtime.capTrue,\n\t\t\treturn_response_headers: false,\n\t\t\treturn_response_type: function(responseType) {\n\t\t\t\tif (responseType === 'json' && !!window.JSON) {\n\t\t\t\t\treturn true;\n\t\t\t\t} \n\t\t\t\treturn !Basic.arrayDiff(responseType, ['', 'text', 'document']) || I.mode === 'browser';\n\t\t\t},\n\t\t\treturn_status_code: function(code) {\n\t\t\t\treturn I.mode === 'browser' || !Basic.arrayDiff(code, [200, 404]);\n\t\t\t},\n\t\t\tselect_file: Runtime.capTrue,\n\t\t\tselect_multiple: Runtime.capTrue,\n\t\t\tsend_binary_string: function(value) {\n\t\t\t\treturn value && I.mode === 'browser';\n\t\t\t},\n\t\t\tsend_browser_cookies: function(value) {\n\t\t\t\treturn value && I.mode === 'browser';\n\t\t\t},\n\t\t\tsend_custom_headers: function(value) {\n\t\t\t\treturn value && I.mode === 'browser';\n\t\t\t},\n\t\t\tsend_multipart: Runtime.capTrue,\n\t\t\tslice_blob: function(value) {\n\t\t\t\treturn value && I.mode === 'browser';\n\t\t\t},\n\t\t\tstream_upload: function(value) {\n\t\t\t\treturn value && I.mode === 'browser';\n\t\t\t},\n\t\t\tsummon_file_dialog: false,\n\t\t\tupload_filesize: function(size) {\n\t\t\t\treturn Basic.parseSizeStr(size) <= 2097152 || I.mode === 'client';\n\t\t\t},\n\t\t\tuse_http_method: function(methods) {\n\t\t\t\treturn !Basic.arrayDiff(methods, ['GET', 'POST']);\n\t\t\t}\n\t\t}, { \n\t\t\t// capabilities that require specific mode\n\t\t\taccess_binary: function(value) {\n\t\t\t\treturn value ? 'browser' : 'client';\n\t\t\t},\n\t\t\taccess_image_binary: function(value) {\n\t\t\t\treturn value ? 'browser' : 'client';\n\t\t\t},\n\t\t\treport_upload_progress: function(value) {\n\t\t\t\treturn value ? 'browser' : 'client';\n\t\t\t},\n\t\t\treturn_response_type: function(responseType) {\n\t\t\t\treturn Basic.arrayDiff(responseType, ['', 'text', 'json', 'document']) ? 'browser' : ['client', 'browser'];\n\t\t\t},\n\t\t\treturn_status_code: function(code) {\n\t\t\t\treturn Basic.arrayDiff(code, [200, 404]) ? 'browser' : ['client', 'browser'];\n\t\t\t},\n\t\t\tsend_binary_string: function(value) {\n\t\t\t\treturn value ? 'browser' : 'client';\n\t\t\t},\n\t\t\tsend_browser_cookies: function(value) {\n\t\t\t\treturn value ? 'browser' : 'client';\n\t\t\t},\n\t\t\tsend_custom_headers: function(value) {\n\t\t\t\treturn value ? 'browser' : 'client';\n\t\t\t},\n\t\t\tslice_blob: function(value) {\n\t\t\t\treturn value ? 'browser' : 'client';\n\t\t\t},\n\t\t\tstream_upload: function(value) {\n\t\t\t\treturn value ? 'client' : 'browser';\n\t\t\t},\n\t\t\tupload_filesize: function(size) {\n\t\t\t\treturn Basic.parseSizeStr(size) >= 2097152 ? 'client' : 'browser';\n\t\t\t}\n\t\t}, 'client');\n\n\n\t\t// minimal requirement for Flash Player version\n\t\tif (getShimVersion() < 11.3) {\n\t\t\tif (MXI_DEBUG && Env.debug.runtime) {\n\t\t\t\tEnv.log(\"\\tFlash didn't meet minimal version requirement (11.3).\");\t\n\t\t\t}\n\n\t\t\tthis.mode = false; // with falsy mode, runtime won't operable, no matter what the mode was before\n\t\t}\n\n\n\t\tBasic.extend(this, {\n\n\t\t\tgetShim: function() {\n\t\t\t\treturn Dom.get(this.uid);\n\t\t\t},\n\n\t\t\tshimExec: function(component, action) {\n\t\t\t\tvar args = [].slice.call(arguments, 2);\n\t\t\t\treturn I.getShim().exec(this.uid, component, action, args);\n\t\t\t},\n\n\t\t\tinit: function() {\n\t\t\t\tvar html, el, container;\n\n\t\t\t\tcontainer = this.getShimContainer();\n\n\t\t\t\t// if not the minimal height, shims are not initialized in older browsers (e.g FF3.6, IE6,7,8, Safari 4.0,5.0, etc)\n\t\t\t\tBasic.extend(container.style, {\n\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\ttop: '-8px',\n\t\t\t\t\tleft: '-8px',\n\t\t\t\t\twidth: '9px',\n\t\t\t\t\theight: '9px',\n\t\t\t\t\toverflow: 'hidden'\n\t\t\t\t});\n\n\t\t\t\t// insert flash object\n\t\t\t\thtml = '';\n\n\t\t\t\tif (Env.browser === 'IE') {\n\t\t\t\t\tel = document.createElement('div');\n\t\t\t\t\tcontainer.appendChild(el);\n\t\t\t\t\tel.outerHTML = html;\n\t\t\t\t\tel = container = null; // just in case\n\t\t\t\t} else {\n\t\t\t\t\tcontainer.innerHTML = html;\n\t\t\t\t}\n\n\t\t\t\t// Init is dispatched by the shim\n\t\t\t\tinitTimer = setTimeout(function() {\n\t\t\t\t\tif (I && !I.initialized) { // runtime might be already destroyed by this moment\n\t\t\t\t\t\tI.trigger(\"Error\", new x.RuntimeError(x.RuntimeError.NOT_INIT_ERR));\n\n\t\t\t\t\t\tif (MXI_DEBUG && Env.debug.runtime) {\n\t\t\t\t\t\t\tEnv.log(\"\\tFlash failed to initialize within a specified period of time (typically 5s).\");\t\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}, 5000);\n\t\t\t},\n\n\t\t\tdestroy: (function(destroy) { // extend default destroy method\n\t\t\t\treturn function() {\n\t\t\t\t\tremoveSWF(I.uid); // SWF removal requires special care in IE\n\n\t\t\t\t\tdestroy.call(I);\n\t\t\t\t\tclearTimeout(initTimer); // initialization check might be still onwait\n\t\t\t\t\toptions = initTimer = destroy = I = null;\n\t\t\t\t};\n\t\t\t}(this.destroy))\n\n\t\t}, extensions);\n\t}\n\n\tRuntime.addConstructor(type, FlashRuntime);\n\n\treturn extensions;\n});\n\n// Included from: src/javascript/runtime/flash/file/Blob.js\n\n/**\n * Blob.js\n *\n * Copyright 2013, Moxiecode Systems AB\n * Released under GPL License.\n *\n * License: http://www.plupload.com/license\n * Contributing: http://www.plupload.com/contributing\n */\n\n/**\n@class moxie/runtime/flash/file/Blob\n@private\n*/\ndefine(\"moxie/runtime/flash/file/Blob\", [\n\t\"moxie/runtime/flash/Runtime\",\n\t\"moxie/file/Blob\"\n], function(extensions, Blob) {\n\n\tvar FlashBlob = {\n\t\tslice: function(blob, start, end, type) {\n\t\t\tvar self = this.getRuntime();\n\n\t\t\tif (start < 0) {\n\t\t\t\tstart = Math.max(blob.size + start, 0);\n\t\t\t} else if (start > 0) {\n\t\t\t\tstart = Math.min(start, blob.size);\n\t\t\t}\n\n\t\t\tif (end < 0) {\n\t\t\t\tend = Math.max(blob.size + end, 0);\n\t\t\t} else if (end > 0) {\n\t\t\t\tend = Math.min(end, blob.size);\n\t\t\t}\n\n\t\t\tblob = self.shimExec.call(this, 'Blob', 'slice', start, end, type || '');\n\n\t\t\tif (blob) {\n\t\t\t\tblob = new Blob(self.uid, blob);\n\t\t\t}\n\t\t\treturn blob;\n\t\t}\n\t};\n\n\treturn (extensions.Blob = FlashBlob);\n});\n\n// Included from: src/javascript/runtime/flash/file/FileInput.js\n\n/**\n * FileInput.js\n *\n * Copyright 2013, Moxiecode Systems AB\n * Released under GPL License.\n *\n * License: http://www.plupload.com/license\n * Contributing: http://www.plupload.com/contributing\n */\n\n/**\n@class moxie/runtime/flash/file/FileInput\n@private\n*/\ndefine(\"moxie/runtime/flash/file/FileInput\", [\n\t\"moxie/runtime/flash/Runtime\",\n\t\"moxie/file/File\",\n\t\"moxie/core/utils/Dom\",\n\t\"moxie/core/utils/Basic\"\n], function(extensions, File, Dom, Basic) {\n\n\tvar FileInput = {\n\t\tinit: function(options) {\n\t\t\tvar comp = this, I = this.getRuntime();\n\t\t\tvar browseButton = Dom.get(options.browse_button);\n\n\t\t\tif (browseButton) {\n\t\t\t\tbrowseButton.setAttribute('tabindex', -1);\n\t\t\t\tbrowseButton = null;\n\t\t\t}\n\n\t\t\tthis.bind(\"Change\", function() {\n\t\t\t\tvar files = I.shimExec.call(comp, 'FileInput', 'getFiles');\n\t\t\t\tcomp.files = [];\n\t\t\t\tBasic.each(files, function(file) {\n\t\t\t\t\tcomp.files.push(new File(I.uid, file));\n\t\t\t\t});\n\t\t\t}, 999);\n\n\t\t\tthis.getRuntime().shimExec.call(this, 'FileInput', 'init', {\n\t\t\t\taccept: options.accept,\n\t\t\t\tmultiple: options.multiple\n\t\t\t});\n\n\t\t\tthis.trigger('ready');\n\t\t}\n\t};\n\n\treturn (extensions.FileInput = FileInput);\n});\n\n// Included from: src/javascript/runtime/flash/file/FileReader.js\n\n/**\n * FileReader.js\n *\n * Copyright 2013, Moxiecode Systems AB\n * Released under GPL License.\n *\n * License: http://www.plupload.com/license\n * Contributing: http://www.plupload.com/contributing\n */\n\n/**\n@class moxie/runtime/flash/file/FileReader\n@private\n*/\ndefine(\"moxie/runtime/flash/file/FileReader\", [\n\t\"moxie/runtime/flash/Runtime\",\n\t\"moxie/core/utils/Encode\"\n], function(extensions, Encode) {\n\n\tfunction _formatData(data, op) {\n\t\tswitch (op) {\n\t\t\tcase 'readAsText':\n\t\t\t\treturn Encode.atob(data, 'utf8');\n\t\t\tcase 'readAsBinaryString':\n\t\t\t\treturn Encode.atob(data);\n\t\t\tcase 'readAsDataURL':\n\t\t\t\treturn data;\n\t\t}\n\t\treturn null;\n\t}\n\n\tvar FileReader = {\n\t\tread: function(op, blob) {\n\t\t\tvar comp = this;\n\n\t\t\tcomp.result = '';\n\n\t\t\t// special prefix for DataURL read mode\n\t\t\tif (op === 'readAsDataURL') {\n\t\t\t\tcomp.result = 'data:' + (blob.type || '') + ';base64,';\n\t\t\t}\n\n\t\t\tcomp.bind('Progress', function(e, data) {\n\t\t\t\tif (data) {\n\t\t\t\t\tcomp.result += _formatData(data, op);\n\t\t\t\t}\n\t\t\t}, 999);\n\n\t\t\treturn comp.getRuntime().shimExec.call(this, 'FileReader', 'readAsBase64', blob.uid);\n\t\t}\n\t};\n\n\treturn (extensions.FileReader = FileReader);\n});\n\n// Included from: src/javascript/runtime/flash/file/FileReaderSync.js\n\n/**\n * FileReaderSync.js\n *\n * Copyright 2013, Moxiecode Systems AB\n * Released under GPL License.\n *\n * License: http://www.plupload.com/license\n * Contributing: http://www.plupload.com/contributing\n */\n\n/**\n@class moxie/runtime/flash/file/FileReaderSync\n@private\n*/\ndefine(\"moxie/runtime/flash/file/FileReaderSync\", [\n\t\"moxie/runtime/flash/Runtime\",\n\t\"moxie/core/utils/Encode\"\n], function(extensions, Encode) {\n\t\n\tfunction _formatData(data, op) {\n\t\tswitch (op) {\n\t\t\tcase 'readAsText':\n\t\t\t\treturn Encode.atob(data, 'utf8');\n\t\t\tcase 'readAsBinaryString':\n\t\t\t\treturn Encode.atob(data);\n\t\t\tcase 'readAsDataURL':\n\t\t\t\treturn data;\n\t\t}\n\t\treturn null;\n\t}\n\n\tvar FileReaderSync = {\n\t\tread: function(op, blob) {\n\t\t\tvar result, self = this.getRuntime();\n\n\t\t\tresult = self.shimExec.call(this, 'FileReaderSync', 'readAsBase64', blob.uid);\n\t\t\tif (!result) {\n\t\t\t\treturn null; // or throw ex\n\t\t\t}\n\n\t\t\t// special prefix for DataURL read mode\n\t\t\tif (op === 'readAsDataURL') {\n\t\t\t\tresult = 'data:' + (blob.type || '') + ';base64,' + result;\n\t\t\t}\n\n\t\t\treturn _formatData(result, op, blob.type);\n\t\t}\n\t};\n\n\treturn (extensions.FileReaderSync = FileReaderSync);\n});\n\n// Included from: src/javascript/runtime/flash/runtime/Transporter.js\n\n/**\n * Transporter.js\n *\n * Copyright 2013, Moxiecode Systems AB\n * Released under GPL License.\n *\n * License: http://www.plupload.com/license\n * Contributing: http://www.plupload.com/contributing\n */\n\n/**\n@class moxie/runtime/flash/runtime/Transporter\n@private\n*/\ndefine(\"moxie/runtime/flash/runtime/Transporter\", [\n\t\"moxie/runtime/flash/Runtime\",\n\t\"moxie/file/Blob\"\n], function(extensions, Blob) {\n\n\tvar Transporter = {\n\t\tgetAsBlob: function(type) {\n\t\t\tvar self = this.getRuntime()\n\t\t\t, blob = self.shimExec.call(this, 'Transporter', 'getAsBlob', type)\n\t\t\t;\n\t\t\tif (blob) {\n\t\t\t\treturn new Blob(self.uid, blob);\n\t\t\t}\n\t\t\treturn null;\n\t\t}\n\t};\n\n\treturn (extensions.Transporter = Transporter);\n});\n\n// Included from: src/javascript/runtime/flash/xhr/XMLHttpRequest.js\n\n/**\n * XMLHttpRequest.js\n *\n * Copyright 2013, Moxiecode Systems AB\n * Released under GPL License.\n *\n * License: http://www.plupload.com/license\n * Contributing: http://www.plupload.com/contributing\n */\n\n/**\n@class moxie/runtime/flash/xhr/XMLHttpRequest\n@private\n*/\ndefine(\"moxie/runtime/flash/xhr/XMLHttpRequest\", [\n\t\"moxie/runtime/flash/Runtime\",\n\t\"moxie/core/utils/Basic\",\n\t\"moxie/file/Blob\",\n\t\"moxie/file/File\",\n\t\"moxie/file/FileReaderSync\",\n\t\"moxie/runtime/flash/file/FileReaderSync\",\n\t\"moxie/xhr/FormData\",\n\t\"moxie/runtime/Transporter\",\n\t\"moxie/runtime/flash/runtime/Transporter\"\n], function(extensions, Basic, Blob, File, FileReaderSync, FileReaderSyncFlash, FormData, Transporter, TransporterFlash) {\n\t\n\tvar XMLHttpRequest = {\n\n\t\tsend: function(meta, data) {\n\t\t\tvar target = this, self = target.getRuntime();\n\n\t\t\tfunction send() {\n\t\t\t\tmeta.transport = self.mode;\n\t\t\t\tself.shimExec.call(target, 'XMLHttpRequest', 'send', meta, data);\n\t\t\t}\n\n\n\t\t\tfunction appendBlob(name, blob) {\n\t\t\t\tself.shimExec.call(target, 'XMLHttpRequest', 'appendBlob', name, blob.uid);\n\t\t\t\tdata = null;\n\t\t\t\tsend();\n\t\t\t}\n\n\n\t\t\tfunction attachBlob(blob, cb) {\n\t\t\t\tvar tr = new Transporter();\n\n\t\t\t\ttr.bind(\"TransportingComplete\", function() {\n\t\t\t\t\tcb(this.result);\n\t\t\t\t});\n\n\t\t\t\ttr.transport(blob.getSource(), blob.type, {\n\t\t\t\t\truid: self.uid\n\t\t\t\t});\n\t\t\t}\n\n\t\t\t// copy over the headers if any\n\t\t\tif (!Basic.isEmptyObj(meta.headers)) {\n\t\t\t\tBasic.each(meta.headers, function(value, header) {\n\t\t\t\t\tself.shimExec.call(target, 'XMLHttpRequest', 'setRequestHeader', header, value.toString()); // Silverlight doesn't accept integers into the arguments of type object\n\t\t\t\t});\n\t\t\t}\n\n\t\t\t// transfer over multipart params and blob itself\n\t\t\tif (data instanceof FormData) {\n\t\t\t\tvar blobField;\n\t\t\t\tdata.each(function(value, name) {\n\t\t\t\t\tif (value instanceof Blob) {\n\t\t\t\t\t\tblobField = name;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tself.shimExec.call(target, 'XMLHttpRequest', 'append', name, value);\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\tif (!data.hasBlob()) {\n\t\t\t\t\tdata = null;\n\t\t\t\t\tsend();\n\t\t\t\t} else {\n\t\t\t\t\tvar blob = data.getBlob();\n\t\t\t\t\tif (blob.isDetached()) {\n\t\t\t\t\t\tattachBlob(blob, function(attachedBlob) {\n\t\t\t\t\t\t\tblob.destroy();\n\t\t\t\t\t\t\tappendBlob(blobField, attachedBlob);\t\t\n\t\t\t\t\t\t});\n\t\t\t\t\t} else {\n\t\t\t\t\t\tappendBlob(blobField, blob);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if (data instanceof Blob) {\n\t\t\t\tif (data.isDetached()) {\n\t\t\t\t\tattachBlob(data, function(attachedBlob) {\n\t\t\t\t\t\tdata.destroy();\n\t\t\t\t\t\tdata = attachedBlob.uid;\n\t\t\t\t\t\tsend();\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\tdata = data.uid;\n\t\t\t\t\tsend();\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tsend();\n\t\t\t}\n\t\t},\n\n\t\tgetResponse: function(responseType) {\n\t\t\tvar frs, blob, self = this.getRuntime();\n\n\t\t\tblob = self.shimExec.call(this, 'XMLHttpRequest', 'getResponseAsBlob');\n\n\t\t\tif (blob) {\n\t\t\t\tblob = new File(self.uid, blob);\n\n\t\t\t\tif ('blob' === responseType) {\n\t\t\t\t\treturn blob;\n\t\t\t\t}\n\n\t\t\t\ttry { \n\t\t\t\t\tfrs = new FileReaderSync();\n\n\t\t\t\t\tif (!!~Basic.inArray(responseType, [\"\", \"text\"])) {\n\t\t\t\t\t\treturn frs.readAsText(blob);\n\t\t\t\t\t} else if ('json' === responseType && !!window.JSON) {\n\t\t\t\t\t\treturn JSON.parse(frs.readAsText(blob));\n\t\t\t\t\t}\n\t\t\t\t} finally {\n\t\t\t\t\tblob.destroy();\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn null;\n\t\t},\n\n\t\tabort: function(upload_complete_flag) {\n\t\t\tvar self = this.getRuntime();\n\n\t\t\tself.shimExec.call(this, 'XMLHttpRequest', 'abort');\n\n\t\t\tthis.dispatchEvent('readystatechange');\n\t\t\t// this.dispatchEvent('progress');\n\t\t\tthis.dispatchEvent('abort');\n\n\t\t\t//if (!upload_complete_flag) {\n\t\t\t\t// this.dispatchEvent('uploadprogress');\n\t\t\t//}\n\t\t}\n\t};\n\n\treturn (extensions.XMLHttpRequest = XMLHttpRequest);\n});\n\n// Included from: src/javascript/runtime/flash/image/Image.js\n\n/**\n * Image.js\n *\n * Copyright 2013, Moxiecode Systems AB\n * Released under GPL License.\n *\n * License: http://www.plupload.com/license\n * Contributing: http://www.plupload.com/contributing\n */\n\n/**\n@class moxie/runtime/flash/image/Image\n@private\n*/\ndefine(\"moxie/runtime/flash/image/Image\", [\n\t\"moxie/runtime/flash/Runtime\",\n\t\"moxie/core/utils/Basic\",\n\t\"moxie/runtime/Transporter\",\n\t\"moxie/file/Blob\",\n\t\"moxie/file/FileReaderSync\"\n], function(extensions, Basic, Transporter, Blob, FileReaderSync) {\n\t\n\tvar Image = {\n\t\tloadFromBlob: function(blob) {\n\t\t\tvar comp = this, self = comp.getRuntime();\n\n\t\t\tfunction exec(srcBlob) {\n\t\t\t\tself.shimExec.call(comp, 'Image', 'loadFromBlob', srcBlob.uid);\n\t\t\t\tcomp = self = null;\n\t\t\t}\n\n\t\t\tif (blob.isDetached()) { // binary string\n\t\t\t\tvar tr = new Transporter();\n\t\t\t\ttr.bind(\"TransportingComplete\", function() {\n\t\t\t\t\texec(tr.result.getSource());\n\t\t\t\t});\n\t\t\t\ttr.transport(blob.getSource(), blob.type, { ruid: self.uid });\n\t\t\t} else {\n\t\t\t\texec(blob.getSource());\n\t\t\t}\n\t\t},\n\n\t\tloadFromImage: function(img) {\n\t\t\tvar self = this.getRuntime();\n\t\t\treturn self.shimExec.call(this, 'Image', 'loadFromImage', img.uid);\n\t\t},\n\n\t\tgetInfo: function() {\n\t\t\tvar self = this.getRuntime()\n\t\t\t, info = self.shimExec.call(this, 'Image', 'getInfo')\n\t\t\t;\n\n\t\t\tif (info.meta && info.meta.thumb && info.meta.thumb.data && !(self.meta.thumb.data instanceof Blob)) {\n\t\t\t\tinfo.meta.thumb.data = new Blob(self.uid, info.meta.thumb.data);\n\t\t\t}\n\t\t\treturn info;\n\t\t},\n\n\t\tgetAsBlob: function(type, quality) {\n\t\t\tvar self = this.getRuntime()\n\t\t\t, blob = self.shimExec.call(this, 'Image', 'getAsBlob', type, quality)\n\t\t\t;\n\t\t\tif (blob) {\n\t\t\t\treturn new Blob(self.uid, blob);\n\t\t\t}\n\t\t\treturn null;\n\t\t},\n\n\t\tgetAsDataURL: function() {\n\t\t\tvar self = this.getRuntime()\n\t\t\t, blob = self.Image.getAsBlob.apply(this, arguments)\n\t\t\t, frs\n\t\t\t;\n\t\t\tif (!blob) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\tfrs = new FileReaderSync();\n\t\t\treturn frs.readAsDataURL(blob);\n\t\t}\n\t};\n\n\treturn (extensions.Image = Image);\n});\n\n// Included from: src/javascript/runtime/silverlight/Runtime.js\n\n/**\n * RunTime.js\n *\n * Copyright 2013, Moxiecode Systems AB\n * Released under GPL License.\n *\n * License: http://www.plupload.com/license\n * Contributing: http://www.plupload.com/contributing\n */\n\n/*global ActiveXObject:true */\n\n/**\nDefines constructor for Silverlight runtime.\n\n@class moxie/runtime/silverlight/Runtime\n@private\n*/\ndefine(\"moxie/runtime/silverlight/Runtime\", [\n\t\"moxie/core/utils/Basic\",\n\t\"moxie/core/utils/Env\",\n\t\"moxie/core/utils/Dom\",\n\t\"moxie/core/Exceptions\",\n\t\"moxie/runtime/Runtime\"\n], function(Basic, Env, Dom, x, Runtime) {\n\t\n\tvar type = \"silverlight\", extensions = {};\n\n\tfunction isInstalled(version) {\n\t\tvar isVersionSupported = false, control = null, actualVer,\n\t\t\tactualVerArray, reqVerArray, requiredVersionPart, actualVersionPart, index = 0;\n\n\t\ttry {\n\t\t\ttry {\n\t\t\t\tcontrol = new ActiveXObject('AgControl.AgControl');\n\n\t\t\t\tif (control.IsVersionSupported(version)) {\n\t\t\t\t\tisVersionSupported = true;\n\t\t\t\t}\n\n\t\t\t\tcontrol = null;\n\t\t\t} catch (e) {\n\t\t\t\tvar plugin = navigator.plugins[\"Silverlight Plug-In\"];\n\n\t\t\t\tif (plugin) {\n\t\t\t\t\tactualVer = plugin.description;\n\n\t\t\t\t\tif (actualVer === \"1.0.30226.2\") {\n\t\t\t\t\t\tactualVer = \"2.0.30226.2\";\n\t\t\t\t\t}\n\n\t\t\t\t\tactualVerArray = actualVer.split(\".\");\n\n\t\t\t\t\twhile (actualVerArray.length > 3) {\n\t\t\t\t\t\tactualVerArray.pop();\n\t\t\t\t\t}\n\n\t\t\t\t\twhile ( actualVerArray.length < 4) {\n\t\t\t\t\t\tactualVerArray.push(0);\n\t\t\t\t\t}\n\n\t\t\t\t\treqVerArray = version.split(\".\");\n\n\t\t\t\t\twhile (reqVerArray.length > 4) {\n\t\t\t\t\t\treqVerArray.pop();\n\t\t\t\t\t}\n\n\t\t\t\t\tdo {\n\t\t\t\t\t\trequiredVersionPart = parseInt(reqVerArray[index], 10);\n\t\t\t\t\t\tactualVersionPart = parseInt(actualVerArray[index], 10);\n\t\t\t\t\t\tindex++;\n\t\t\t\t\t} while (index < reqVerArray.length && requiredVersionPart === actualVersionPart);\n\n\t\t\t\t\tif (requiredVersionPart <= actualVersionPart && !isNaN(requiredVersionPart)) {\n\t\t\t\t\t\tisVersionSupported = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (e2) {\n\t\t\tisVersionSupported = false;\n\t\t}\n\n\t\treturn isVersionSupported;\n\t}\n\n\t/**\n\tConstructor for the Silverlight Runtime\n\t*/\n\tfunction SilverlightRuntime(options) {\n\t\tvar I = this, initTimer;\n\n\t\toptions = Basic.extend({ xap_url: Env.xap_url }, options);\n\n\t\tRuntime.call(this, options, type, {\n\t\t\taccess_binary: Runtime.capTrue,\n\t\t\taccess_image_binary: Runtime.capTrue,\n\t\t\tdisplay_media: Runtime.capTest(defined('moxie/image/Image')),\n\t\t\tdo_cors: Runtime.capTrue,\n\t\t\tdrag_and_drop: false,\n\t\t\treport_upload_progress: Runtime.capTrue,\n\t\t\tresize_image: Runtime.capTrue,\n\t\t\treturn_response_headers: function(value) {\n\t\t\t\treturn value && I.mode === 'client';\n\t\t\t},\n\t\t\treturn_response_type: function(responseType) {\n\t\t\t\tif (responseType !== 'json') {\n\t\t\t\t\treturn true;\n\t\t\t\t} else {\n\t\t\t\t\treturn !!window.JSON;\n\t\t\t\t}\n\t\t\t},\n\t\t\treturn_status_code: function(code) {\n\t\t\t\treturn I.mode === 'client' || !Basic.arrayDiff(code, [200, 404]);\n\t\t\t},\n\t\t\tselect_file: Runtime.capTrue,\n\t\t\tselect_multiple: Runtime.capTrue,\n\t\t\tsend_binary_string: Runtime.capTrue,\n\t\t\tsend_browser_cookies: function(value) {\n\t\t\t\treturn value && I.mode === 'browser';\n\t\t\t},\n\t\t\tsend_custom_headers: function(value) {\n\t\t\t\treturn value && I.mode === 'client';\n\t\t\t},\n\t\t\tsend_multipart: Runtime.capTrue,\n\t\t\tslice_blob: Runtime.capTrue,\n\t\t\tstream_upload: true,\n\t\t\tsummon_file_dialog: false,\n\t\t\tupload_filesize: Runtime.capTrue,\n\t\t\tuse_http_method: function(methods) {\n\t\t\t\treturn I.mode === 'client' || !Basic.arrayDiff(methods, ['GET', 'POST']);\n\t\t\t}\n\t\t}, { \n\t\t\t// capabilities that require specific mode\n\t\t\treturn_response_headers: function(value) {\n\t\t\t\treturn value ? 'client' : 'browser';\n\t\t\t},\n\t\t\treturn_status_code: function(code) {\n\t\t\t\treturn Basic.arrayDiff(code, [200, 404]) ? 'client' : ['client', 'browser'];\n\t\t\t},\n\t\t\tsend_browser_cookies: function(value) {\n\t\t\t\treturn value ? 'browser' : 'client';\n\t\t\t},\n\t\t\tsend_custom_headers: function(value) {\n\t\t\t\treturn value ? 'client' : 'browser';\n\t\t\t},\n\t\t\tuse_http_method: function(methods) {\n\t\t\t\treturn Basic.arrayDiff(methods, ['GET', 'POST']) ? 'client' : ['client', 'browser'];\n\t\t\t}\n\t\t});\n\n\n\t\t// minimal requirement\n\t\tif (!isInstalled('2.0.31005.0') || Env.browser === 'Opera') {\n\t\t\tif (MXI_DEBUG && Env.debug.runtime) {\n\t\t\t\tEnv.log(\"\\tSilverlight is not installed or minimal version (2.0.31005.0) requirement not met (not likely).\");\t\n\t\t\t}\n\n\t\t\tthis.mode = false;\n\t\t}\n\n\n\t\tBasic.extend(this, {\n\t\t\tgetShim: function() {\n\t\t\t\treturn Dom.get(this.uid).content.Moxie;\n\t\t\t},\n\n\t\t\tshimExec: function(component, action) {\n\t\t\t\tvar args = [].slice.call(arguments, 2);\n\t\t\t\treturn I.getShim().exec(this.uid, component, action, args);\n\t\t\t},\n\n\t\t\tinit : function() {\n\t\t\t\tvar container;\n\n\t\t\t\tcontainer = this.getShimContainer();\n\n\t\t\t\tcontainer.innerHTML = '';\n\n\t\t\t\t// Init is dispatched by the shim\n\t\t\t\tinitTimer = setTimeout(function() {\n\t\t\t\t\tif (I && !I.initialized) { // runtime might be already destroyed by this moment\n\t\t\t\t\t\tI.trigger(\"Error\", new x.RuntimeError(x.RuntimeError.NOT_INIT_ERR));\n\n\t\t\t\t\t\tif (MXI_DEBUG && Env.debug.runtime) {\n\t\t\t\t\t\t\tEnv.log(\"\\Silverlight failed to initialize within a specified period of time (5-10s).\");\t\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}, Env.OS !== 'Windows'? 10000 : 5000); // give it more time to initialize in non Windows OS (like Mac)\n\t\t\t},\n\n\t\t\tdestroy: (function(destroy) { // extend default destroy method\n\t\t\t\treturn function() {\n\t\t\t\t\tdestroy.call(I);\n\t\t\t\t\tclearTimeout(initTimer); // initialization check might be still onwait\n\t\t\t\t\toptions = initTimer = destroy = I = null;\n\t\t\t\t};\n\t\t\t}(this.destroy))\n\n\t\t}, extensions);\n\t}\n\n\tRuntime.addConstructor(type, SilverlightRuntime); \n\n\treturn extensions;\n});\n\n// Included from: src/javascript/runtime/silverlight/file/Blob.js\n\n/**\n * Blob.js\n *\n * Copyright 2013, Moxiecode Systems AB\n * Released under GPL License.\n *\n * License: http://www.plupload.com/license\n * Contributing: http://www.plupload.com/contributing\n */\n\n/**\n@class moxie/runtime/silverlight/file/Blob\n@private\n*/\ndefine(\"moxie/runtime/silverlight/file/Blob\", [\n\t\"moxie/runtime/silverlight/Runtime\",\n\t\"moxie/core/utils/Basic\",\n\t\"moxie/runtime/flash/file/Blob\"\n], function(extensions, Basic, Blob) {\n\treturn (extensions.Blob = Basic.extend({}, Blob));\n});\n\n// Included from: src/javascript/runtime/silverlight/file/FileInput.js\n\n/**\n * FileInput.js\n *\n * Copyright 2013, Moxiecode Systems AB\n * Released under GPL License.\n *\n * License: http://www.plupload.com/license\n * Contributing: http://www.plupload.com/contributing\n */\n\n/**\n@class moxie/runtime/silverlight/file/FileInput\n@private\n*/\ndefine(\"moxie/runtime/silverlight/file/FileInput\", [\n\t\"moxie/runtime/silverlight/Runtime\",\n\t\"moxie/file/File\",\n\t\"moxie/core/utils/Dom\",\n\t\"moxie/core/utils/Basic\"\n], function(extensions, File, Dom, Basic) {\n\n\tfunction toFilters(accept) {\n\t\tvar filter = '';\n\t\tfor (var i = 0; i < accept.length; i++) {\n\t\t\tfilter += (filter !== '' ? '|' : '') + accept[i].title + \" | *.\" + accept[i].extensions.replace(/,/g, ';*.');\n\t\t}\n\t\treturn filter;\n\t}\n\n\t\n\tvar FileInput = {\n\t\tinit: function(options) {\n\t\t\tvar comp = this, I = this.getRuntime();\n\t\t\tvar browseButton = Dom.get(options.browse_button);\n\n\t\t\tif (browseButton) {\n\t\t\t\tbrowseButton.setAttribute('tabindex', -1);\n\t\t\t\tbrowseButton = null;\n\t\t\t}\n\n\t\t\tthis.bind(\"Change\", function() {\n\t\t\t\tvar files = I.shimExec.call(comp, 'FileInput', 'getFiles');\n\t\t\t\tcomp.files = [];\n\t\t\t\tBasic.each(files, function(file) {\n\t\t\t\t\tcomp.files.push(new File(I.uid, file));\n\t\t\t\t});\n\t\t\t}, 999);\n\t\t\t\n\t\t\tI.shimExec.call(this, 'FileInput', 'init', toFilters(options.accept), options.multiple);\n\t\t\tthis.trigger('ready');\n\t\t},\n\n\t\tsetOption: function(name, value) {\n\t\t\tif (name == 'accept') {\n\t\t\t\tvalue = toFilters(value);\n\t\t\t}\n\t\t\tthis.getRuntime().shimExec.call(this, 'FileInput', 'setOption', name, value);\n\t\t}\n\t};\n\n\treturn (extensions.FileInput = FileInput);\n});\n\n// Included from: src/javascript/runtime/silverlight/file/FileDrop.js\n\n/**\n * FileDrop.js\n *\n * Copyright 2013, Moxiecode Systems AB\n * Released under GPL License.\n *\n * License: http://www.plupload.com/license\n * Contributing: http://www.plupload.com/contributing\n */\n\n/**\n@class moxie/runtime/silverlight/file/FileDrop\n@private\n*/\ndefine(\"moxie/runtime/silverlight/file/FileDrop\", [\n\t\"moxie/runtime/silverlight/Runtime\",\n\t\"moxie/core/utils/Dom\", \n\t\"moxie/core/utils/Events\"\n], function(extensions, Dom, Events) {\n\n\t// not exactly useful, since works only in safari (...crickets...)\n\tvar FileDrop = {\n\t\tinit: function() {\n\t\t\tvar comp = this, self = comp.getRuntime(), dropZone;\n\n\t\t\tdropZone = self.getShimContainer();\n\n\t\t\tEvents.addEvent(dropZone, 'dragover', function(e) {\n\t\t\t\te.preventDefault();\n\t\t\t\te.stopPropagation();\n\t\t\t\te.dataTransfer.dropEffect = 'copy';\n\t\t\t}, comp.uid);\n\n\t\t\tEvents.addEvent(dropZone, 'dragenter', function(e) {\n\t\t\t\te.preventDefault();\n\t\t\t\tvar flag = Dom.get(self.uid).dragEnter(e);\n\t\t\t\t// If handled, then stop propagation of event in DOM\n\t\t\t\tif (flag) {\n\t\t\t\t\te.stopPropagation();\n\t\t\t\t}\n\t\t\t}, comp.uid);\n\n\t\t\tEvents.addEvent(dropZone, 'drop', function(e) {\n\t\t\t\te.preventDefault();\n\t\t\t\tvar flag = Dom.get(self.uid).dragDrop(e);\n\t\t\t\t// If handled, then stop propagation of event in DOM\n\t\t\t\tif (flag) {\n\t\t\t\t\te.stopPropagation();\n\t\t\t\t}\n\t\t\t}, comp.uid);\n\n\t\t\treturn self.shimExec.call(this, 'FileDrop', 'init');\n\t\t}\n\t};\n\n\treturn (extensions.FileDrop = FileDrop);\n});\n\n// Included from: src/javascript/runtime/silverlight/file/FileReader.js\n\n/**\n * FileReader.js\n *\n * Copyright 2013, Moxiecode Systems AB\n * Released under GPL License.\n *\n * License: http://www.plupload.com/license\n * Contributing: http://www.plupload.com/contributing\n */\n\n/**\n@class moxie/runtime/silverlight/file/FileReader\n@private\n*/\ndefine(\"moxie/runtime/silverlight/file/FileReader\", [\n\t\"moxie/runtime/silverlight/Runtime\",\n\t\"moxie/core/utils/Basic\",\n\t\"moxie/runtime/flash/file/FileReader\"\n], function(extensions, Basic, FileReader) {\n\treturn (extensions.FileReader = Basic.extend({}, FileReader));\n});\n\n// Included from: src/javascript/runtime/silverlight/file/FileReaderSync.js\n\n/**\n * FileReaderSync.js\n *\n * Copyright 2013, Moxiecode Systems AB\n * Released under GPL License.\n *\n * License: http://www.plupload.com/license\n * Contributing: http://www.plupload.com/contributing\n */\n\n/**\n@class moxie/runtime/silverlight/file/FileReaderSync\n@private\n*/\ndefine(\"moxie/runtime/silverlight/file/FileReaderSync\", [\n\t\"moxie/runtime/silverlight/Runtime\",\n\t\"moxie/core/utils/Basic\",\n\t\"moxie/runtime/flash/file/FileReaderSync\"\n], function(extensions, Basic, FileReaderSync) {\n\treturn (extensions.FileReaderSync = Basic.extend({}, FileReaderSync));\n});\n\n// Included from: src/javascript/runtime/silverlight/runtime/Transporter.js\n\n/**\n * Transporter.js\n *\n * Copyright 2013, Moxiecode Systems AB\n * Released under GPL License.\n *\n * License: http://www.plupload.com/license\n * Contributing: http://www.plupload.com/contributing\n */\n\n/**\n@class moxie/runtime/silverlight/runtime/Transporter\n@private\n*/\ndefine(\"moxie/runtime/silverlight/runtime/Transporter\", [\n\t\"moxie/runtime/silverlight/Runtime\",\n\t\"moxie/core/utils/Basic\",\n\t\"moxie/runtime/flash/runtime/Transporter\"\n], function(extensions, Basic, Transporter) {\n\treturn (extensions.Transporter = Basic.extend({}, Transporter));\n});\n\n// Included from: src/javascript/runtime/silverlight/xhr/XMLHttpRequest.js\n\n/**\n * XMLHttpRequest.js\n *\n * Copyright 2013, Moxiecode Systems AB\n * Released under GPL License.\n *\n * License: http://www.plupload.com/license\n * Contributing: http://www.plupload.com/contributing\n */\n\n/**\n@class moxie/runtime/silverlight/xhr/XMLHttpRequest\n@private\n*/\ndefine(\"moxie/runtime/silverlight/xhr/XMLHttpRequest\", [\n\t\"moxie/runtime/silverlight/Runtime\",\n\t\"moxie/core/utils/Basic\",\n\t\"moxie/runtime/flash/xhr/XMLHttpRequest\",\n\t\"moxie/runtime/silverlight/file/FileReaderSync\",\n\t\"moxie/runtime/silverlight/runtime/Transporter\"\n], function(extensions, Basic, XMLHttpRequest, FileReaderSyncSilverlight, TransporterSilverlight) {\n\treturn (extensions.XMLHttpRequest = Basic.extend({}, XMLHttpRequest));\n});\n\n// Included from: src/javascript/runtime/silverlight/image/Image.js\n\n/**\n * Image.js\n *\n * Copyright 2013, Moxiecode Systems AB\n * Released under GPL License.\n *\n * License: http://www.plupload.com/license\n * Contributing: http://www.plupload.com/contributing\n */\n \n/**\n@class moxie/runtime/silverlight/image/Image\n@private\n*/\ndefine(\"moxie/runtime/silverlight/image/Image\", [\n\t\"moxie/runtime/silverlight/Runtime\",\n\t\"moxie/core/utils/Basic\",\n\t\"moxie/file/Blob\",\n\t\"moxie/runtime/flash/image/Image\"\n], function(extensions, Basic, Blob, Image) {\n\treturn (extensions.Image = Basic.extend({}, Image, {\n\n\t\tgetInfo: function() {\n\t\t\tvar self = this.getRuntime()\n\t\t\t, grps = ['tiff', 'exif', 'gps', 'thumb']\n\t\t\t, info = { meta: {} }\n\t\t\t, rawInfo = self.shimExec.call(this, 'Image', 'getInfo')\n\t\t\t;\n\n\t\t\tif (rawInfo.meta) {\n\t\t\t\tBasic.each(grps, function(grp) {\n\t\t\t\t\tvar meta = rawInfo.meta[grp]\n\t\t\t\t\t, tag\n\t\t\t\t\t, i\n\t\t\t\t\t, length\n\t\t\t\t\t, value\n\t\t\t\t\t;\n\t\t\t\t\tif (meta && meta.keys) {\n\t\t\t\t\t\tinfo.meta[grp] = {};\n\t\t\t\t\t\tfor (i = 0, length = meta.keys.length; i < length; i++) {\n\t\t\t\t\t\t\ttag = meta.keys[i];\n\t\t\t\t\t\t\tvalue = meta[tag];\n\t\t\t\t\t\t\tif (value) {\n\t\t\t\t\t\t\t\t// convert numbers\n\t\t\t\t\t\t\t\tif (/^(\\d|[1-9]\\d+)$/.test(value)) { // integer (make sure doesn't start with zero)\n\t\t\t\t\t\t\t\t\tvalue = parseInt(value, 10);\n\t\t\t\t\t\t\t\t} else if (/^\\d*\\.\\d+$/.test(value)) { // double\n\t\t\t\t\t\t\t\t\tvalue = parseFloat(value);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tinfo.meta[grp][tag] = value;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\t// save thumb data as blob\n\t\t\t\tif (info.meta && info.meta.thumb && info.meta.thumb.data && !(self.meta.thumb.data instanceof Blob)) {\n\t\t\t\t\tinfo.meta.thumb.data = new Blob(self.uid, info.meta.thumb.data);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tinfo.width = parseInt(rawInfo.width, 10);\n\t\t\tinfo.height = parseInt(rawInfo.height, 10);\n\t\t\tinfo.size = parseInt(rawInfo.size, 10);\n\t\t\tinfo.type = rawInfo.type;\n\t\t\tinfo.name = rawInfo.name;\n\n\t\t\treturn info;\n\t\t},\n\n\t\tresize: function(rect, ratio, opts) {\n\t\t\tthis.getRuntime().shimExec.call(this, 'Image', 'resize', rect.x, rect.y, rect.width, rect.height, ratio, opts.preserveHeaders, opts.resample);\n\t\t}\n\t}));\n});\n\n// Included from: src/javascript/runtime/html4/Runtime.js\n\n/**\n * Runtime.js\n *\n * Copyright 2013, Moxiecode Systems AB\n * Released under GPL License.\n *\n * License: http://www.plupload.com/license\n * Contributing: http://www.plupload.com/contributing\n */\n\n/*global File:true */\n\n/**\nDefines constructor for HTML4 runtime.\n\n@class moxie/runtime/html4/Runtime\n@private\n*/\ndefine(\"moxie/runtime/html4/Runtime\", [\n\t\"moxie/core/utils/Basic\",\n\t\"moxie/core/Exceptions\",\n\t\"moxie/runtime/Runtime\",\n\t\"moxie/core/utils/Env\"\n], function(Basic, x, Runtime, Env) {\n\t\n\tvar type = 'html4', extensions = {};\n\n\tfunction Html4Runtime(options) {\n\t\tvar I = this\n\t\t, Test = Runtime.capTest\n\t\t, True = Runtime.capTrue\n\t\t;\n\n\t\tRuntime.call(this, options, type, {\n\t\t\taccess_binary: Test(window.FileReader || window.File && File.getAsDataURL),\n\t\t\taccess_image_binary: false,\n\t\t\tdisplay_media: Test(\n\t\t\t\t(Env.can('create_canvas') || Env.can('use_data_uri_over32kb')) && \n\t\t\t\tdefined('moxie/image/Image')\n\t\t\t),\n\t\t\tdo_cors: false,\n\t\t\tdrag_and_drop: false,\n\t\t\tfilter_by_extension: Test(function() { // if you know how to feature-detect this, please suggest\n\t\t\t\treturn !(\n\t\t\t\t\t(Env.browser === 'Chrome' && Env.verComp(Env.version, 28, '<')) || \n\t\t\t\t\t(Env.browser === 'IE' && Env.verComp(Env.version, 10, '<')) || \n\t\t\t\t\t(Env.browser === 'Safari' && Env.verComp(Env.version, 7, '<')) ||\n\t\t\t\t\t(Env.browser === 'Firefox' && Env.verComp(Env.version, 37, '<'))\n\t\t\t\t);\n\t\t\t}()),\n\t\t\tresize_image: function() {\n\t\t\t\treturn extensions.Image && I.can('access_binary') && Env.can('create_canvas');\n\t\t\t},\n\t\t\treport_upload_progress: false,\n\t\t\treturn_response_headers: false,\n\t\t\treturn_response_type: function(responseType) {\n\t\t\t\tif (responseType === 'json' && !!window.JSON) {\n\t\t\t\t\treturn true;\n\t\t\t\t} \n\t\t\t\treturn !!~Basic.inArray(responseType, ['text', 'document', '']);\n\t\t\t},\n\t\t\treturn_status_code: function(code) {\n\t\t\t\treturn !Basic.arrayDiff(code, [200, 404]);\n\t\t\t},\n\t\t\tselect_file: function() {\n\t\t\t\treturn Env.can('use_fileinput');\n\t\t\t},\n\t\t\tselect_multiple: false,\n\t\t\tsend_binary_string: false,\n\t\t\tsend_custom_headers: false,\n\t\t\tsend_multipart: true,\n\t\t\tslice_blob: false,\n\t\t\tstream_upload: function() {\n\t\t\t\treturn I.can('select_file');\n\t\t\t},\n\t\t\tsummon_file_dialog: function() { // yeah... some dirty sniffing here...\n\t\t\t\treturn I.can('select_file') && !(\n\t\t\t\t\t(Env.browser === 'Firefox' && Env.verComp(Env.version, 4, '<')) ||\n\t\t\t\t\t(Env.browser === 'Opera' && Env.verComp(Env.version, 12, '<')) ||\n\t\t\t\t\t(Env.browser === 'IE' && Env.verComp(Env.version, 10, '<'))\n\t\t\t\t);\n\t\t\t},\n\t\t\tupload_filesize: True,\n\t\t\tuse_http_method: function(methods) {\n\t\t\t\treturn !Basic.arrayDiff(methods, ['GET', 'POST']);\n\t\t\t}\n\t\t});\n\n\n\t\tBasic.extend(this, {\n\t\t\tinit : function() {\n\t\t\t\tthis.trigger(\"Init\");\n\t\t\t},\n\n\t\t\tdestroy: (function(destroy) { // extend default destroy method\n\t\t\t\treturn function() {\n\t\t\t\t\tdestroy.call(I);\n\t\t\t\t\tdestroy = I = null;\n\t\t\t\t};\n\t\t\t}(this.destroy))\n\t\t});\n\n\t\tBasic.extend(this.getShim(), extensions);\n\t}\n\n\tRuntime.addConstructor(type, Html4Runtime);\n\n\treturn extensions;\n});\n\n// Included from: src/javascript/runtime/html4/file/FileInput.js\n\n/**\n * FileInput.js\n *\n * Copyright 2013, Moxiecode Systems AB\n * Released under GPL License.\n *\n * License: http://www.plupload.com/license\n * Contributing: http://www.plupload.com/contributing\n */\n\n/**\n@class moxie/runtime/html4/file/FileInput\n@private\n*/\ndefine(\"moxie/runtime/html4/file/FileInput\", [\n\t\"moxie/runtime/html4/Runtime\",\n\t\"moxie/file/File\",\n\t\"moxie/core/utils/Basic\",\n\t\"moxie/core/utils/Dom\",\n\t\"moxie/core/utils/Events\",\n\t\"moxie/core/utils/Mime\",\n\t\"moxie/core/utils/Env\"\n], function(extensions, File, Basic, Dom, Events, Mime, Env) {\n\t\n\tfunction FileInput() {\n\t\tvar _uid, _mimes = [], _options, _browseBtnZIndex; // save original z-index;\n\n\t\tfunction addInput() {\n\t\t\tvar comp = this, I = comp.getRuntime(), shimContainer, browseButton, currForm, form, input, uid;\n\n\t\t\tuid = Basic.guid('uid_');\n\n\t\t\tshimContainer = I.getShimContainer(); // we get new ref every time to avoid memory leaks in IE\n\n\t\t\tif (_uid) { // move previous form out of the view\n\t\t\t\tcurrForm = Dom.get(_uid + '_form');\n\t\t\t\tif (currForm) {\n\t\t\t\t\tBasic.extend(currForm.style, { top: '100%' });\n\t\t\t\t\t// it shouldn't be possible to tab into the hidden element\n\t\t\t\t\tcurrForm.firstChild.setAttribute('tabindex', -1);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// build form in DOM, since innerHTML version not able to submit file for some reason\n\t\t\tform = document.createElement('form');\n\t\t\tform.setAttribute('id', uid + '_form');\n\t\t\tform.setAttribute('method', 'post');\n\t\t\tform.setAttribute('enctype', 'multipart/form-data');\n\t\t\tform.setAttribute('encoding', 'multipart/form-data');\n\n\t\t\tBasic.extend(form.style, {\n\t\t\t\toverflow: 'hidden',\n\t\t\t\tposition: 'absolute',\n\t\t\t\ttop: 0,\n\t\t\t\tleft: 0,\n\t\t\t\twidth: '100%',\n\t\t\t\theight: '100%'\n\t\t\t});\n\n\t\t\tinput = document.createElement('input');\n\t\t\tinput.setAttribute('id', uid);\n\t\t\tinput.setAttribute('type', 'file');\n\t\t\tinput.setAttribute('accept', _mimes.join(','));\n\n\t\t\tif (I.can('summon_file_dialog')) {\n\t\t\t\tinput.setAttribute('tabindex', -1);\n\t\t\t}\n\n\t\t\tBasic.extend(input.style, {\n\t\t\t\tfontSize: '999px',\n\t\t\t\topacity: 0\n\t\t\t});\n\n\t\t\tform.appendChild(input);\n\t\t\tshimContainer.appendChild(form);\n\n\t\t\t// prepare file input to be placed underneath the browse_button element\n\t\t\tBasic.extend(input.style, {\n\t\t\t\tposition: 'absolute',\n\t\t\t\ttop: 0,\n\t\t\t\tleft: 0,\n\t\t\t\twidth: '100%',\n\t\t\t\theight: '100%'\n\t\t\t});\n\n\t\t\tif (Env.browser === 'IE' && Env.verComp(Env.version, 10, '<')) {\n\t\t\t\tBasic.extend(input.style, {\n\t\t\t\t\tfilter : \"progid:DXImageTransform.Microsoft.Alpha(opacity=0)\"\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tinput.onchange = function() { // there should be only one handler for this\n\t\t\t\tvar file;\n\n\t\t\t\tif (!this.value) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (this.files) { // check if browser is fresh enough\n\t\t\t\t\tfile = this.files[0];\n\t\t\t\t} else {\n\t\t\t\t\tfile = {\n\t\t\t\t\t\tname: this.value\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tfile = new File(I.uid, file);\n\n\t\t\t\t// clear event handler\n\t\t\t\tthis.onchange = function() {}; \n\t\t\t\taddInput.call(comp); \n\n\t\t\t\tcomp.files = [file];\n\n\t\t\t\t// substitute all ids with file uids (consider file.uid read-only - we cannot do it the other way around)\n\t\t\t\tinput.setAttribute('id', file.uid);\n\t\t\t\tform.setAttribute('id', file.uid + '_form');\n\t\t\t\t\n\t\t\t\tcomp.trigger('change');\n\n\t\t\t\tinput = form = null;\n\t\t\t};\n\n\n\t\t\t// route click event to the input\n\t\t\tif (I.can('summon_file_dialog')) {\n\t\t\t\tbrowseButton = Dom.get(_options.browse_button);\n\t\t\t\tEvents.removeEvent(browseButton, 'click', comp.uid);\n\t\t\t\tEvents.addEvent(browseButton, 'click', function(e) {\n\t\t\t\t\tif (input && !input.disabled) { // for some reason FF (up to 8.0.1 so far) lets to click disabled input[type=file]\n\t\t\t\t\t\tinput.click();\n\t\t\t\t\t}\n\t\t\t\t\te.preventDefault();\n\t\t\t\t}, comp.uid);\n\t\t\t}\n\n\t\t\t_uid = uid;\n\n\t\t\tshimContainer = currForm = browseButton = null;\n\t\t}\n\n\t\tBasic.extend(this, {\n\t\t\tinit: function(options) {\n\t\t\t\tvar comp = this, I = comp.getRuntime(), shimContainer;\n\n\t\t\t\t// figure out accept string\n\t\t\t\t_options = options;\n\t\t\t\t_mimes = Mime.extList2mimes(options.accept, I.can('filter_by_extension'));\n\n\t\t\t\tshimContainer = I.getShimContainer();\n\n\t\t\t\t(function() {\n\t\t\t\t\tvar browseButton, zIndex, top;\n\n\t\t\t\t\tbrowseButton = Dom.get(options.browse_button);\n\t\t\t\t\t_browseBtnZIndex = Dom.getStyle(browseButton, 'z-index') || 'auto';\n\n\t\t\t\t\t// Route click event to the input[type=file] element for browsers that support such behavior\n\t\t\t\t\tif (I.can('summon_file_dialog')) {\n\t\t\t\t\t\tif (Dom.getStyle(browseButton, 'position') === 'static') {\n\t\t\t\t\t\t\tbrowseButton.style.position = 'relative';\n\t\t\t\t\t\t}\t\t\t\t\t\t\n\n\t\t\t\t\t\tcomp.bind('Refresh', function() {\n\t\t\t\t\t\t\tzIndex = parseInt(_browseBtnZIndex, 10) || 1;\n\n\t\t\t\t\t\t\tDom.get(_options.browse_button).style.zIndex = zIndex;\n\t\t\t\t\t\t\tthis.getRuntime().getShimContainer().style.zIndex = zIndex - 1;\n\t\t\t\t\t\t});\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// it shouldn't be possible to tab into the hidden element\n\t\t\t\t\t\tbrowseButton.setAttribute('tabindex', -1);\n\t\t\t\t\t}\n\n\t\t\t\t\t/* Since we have to place input[type=file] on top of the browse_button for some browsers,\n\t\t\t\t\tbrowse_button loses interactivity, so we restore it here */\n\t\t\t\t\ttop = I.can('summon_file_dialog') ? browseButton : shimContainer;\n\n\t\t\t\t\tEvents.addEvent(top, 'mouseover', function() {\n\t\t\t\t\t\tcomp.trigger('mouseenter');\n\t\t\t\t\t}, comp.uid);\n\n\t\t\t\t\tEvents.addEvent(top, 'mouseout', function() {\n\t\t\t\t\t\tcomp.trigger('mouseleave');\n\t\t\t\t\t}, comp.uid);\n\n\t\t\t\t\tEvents.addEvent(top, 'mousedown', function() {\n\t\t\t\t\t\tcomp.trigger('mousedown');\n\t\t\t\t\t}, comp.uid);\n\n\t\t\t\t\tEvents.addEvent(Dom.get(options.container), 'mouseup', function() {\n\t\t\t\t\t\tcomp.trigger('mouseup');\n\t\t\t\t\t}, comp.uid);\n\n\t\t\t\t\tbrowseButton = null;\n\t\t\t\t}());\n\n\t\t\t\taddInput.call(this);\n\n\t\t\t\tshimContainer = null;\n\n\t\t\t\t// trigger ready event asynchronously\n\t\t\t\tcomp.trigger({\n\t\t\t\t\ttype: 'ready',\n\t\t\t\t\tasync: true\n\t\t\t\t});\n\t\t\t},\n\n\t\t\tsetOption: function(name, value) {\n\t\t\t\tvar I = this.getRuntime();\n\t\t\t\tvar input;\n\n\t\t\t\tif (name == 'accept') {\n\t\t\t\t\t_mimes = value.mimes || Mime.extList2mimes(value, I.can('filter_by_extension'));\n\t\t\t\t}\n\n\t\t\t\t// update current input\n\t\t\t\tinput = Dom.get(_uid)\n\t\t\t\tif (input) {\n\t\t\t\t\tinput.setAttribute('accept', _mimes.join(','));\n\t\t\t\t}\n\t\t\t},\n\n\n\t\t\tdisable: function(state) {\n\t\t\t\tvar input;\n\n\t\t\t\tif ((input = Dom.get(_uid))) {\n\t\t\t\t\tinput.disabled = !!state;\n\t\t\t\t}\n\t\t\t},\n\n\t\t\tdestroy: function() {\n\t\t\t\tvar I = this.getRuntime()\n\t\t\t\t, shim = I.getShim()\n\t\t\t\t, shimContainer = I.getShimContainer()\n\t\t\t\t, container = _options && Dom.get(_options.container)\n\t\t\t\t, browseButton = _options && Dom.get(_options.browse_button)\n\t\t\t\t;\n\t\t\t\t\n\t\t\t\tif (container) {\n\t\t\t\t\tEvents.removeAllEvents(container, this.uid);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif (browseButton) {\n\t\t\t\t\tEvents.removeAllEvents(browseButton, this.uid);\n\t\t\t\t\tbrowseButton.style.zIndex = _browseBtnZIndex; // reset to original value\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif (shimContainer) {\n\t\t\t\t\tEvents.removeAllEvents(shimContainer, this.uid);\n\t\t\t\t\tshimContainer.innerHTML = '';\n\t\t\t\t}\n\n\t\t\t\tshim.removeInstance(this.uid);\n\n\t\t\t\t_uid = _mimes = _options = shimContainer = container = browseButton = shim = null;\n\t\t\t}\n\t\t});\n\t}\n\n\treturn (extensions.FileInput = FileInput);\n});\n\n// Included from: src/javascript/runtime/html4/file/FileReader.js\n\n/**\n * FileReader.js\n *\n * Copyright 2013, Moxiecode Systems AB\n * Released under GPL License.\n *\n * License: http://www.plupload.com/license\n * Contributing: http://www.plupload.com/contributing\n */\n\n/**\n@class moxie/runtime/html4/file/FileReader\n@private\n*/\ndefine(\"moxie/runtime/html4/file/FileReader\", [\n\t\"moxie/runtime/html4/Runtime\",\n\t\"moxie/runtime/html5/file/FileReader\"\n], function(extensions, FileReader) {\n\treturn (extensions.FileReader = FileReader);\n});\n\n// Included from: src/javascript/runtime/html4/xhr/XMLHttpRequest.js\n\n/**\n * XMLHttpRequest.js\n *\n * Copyright 2013, Moxiecode Systems AB\n * Released under GPL License.\n *\n * License: http://www.plupload.com/license\n * Contributing: http://www.plupload.com/contributing\n */\n\n/**\n@class moxie/runtime/html4/xhr/XMLHttpRequest\n@private\n*/\ndefine(\"moxie/runtime/html4/xhr/XMLHttpRequest\", [\n\t\"moxie/runtime/html4/Runtime\",\n\t\"moxie/core/utils/Basic\",\n\t\"moxie/core/utils/Dom\",\n\t\"moxie/core/utils/Url\",\n\t\"moxie/core/Exceptions\",\n\t\"moxie/core/utils/Events\",\n\t\"moxie/file/Blob\",\n\t\"moxie/xhr/FormData\"\n], function(extensions, Basic, Dom, Url, x, Events, Blob, FormData) {\n\t\n\tfunction XMLHttpRequest() {\n\t\tvar _status, _response, _iframe;\n\n\t\tfunction cleanup(cb) {\n\t\t\tvar target = this, uid, form, inputs, i, hasFile = false;\n\n\t\t\tif (!_iframe) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tuid = _iframe.id.replace(/_iframe$/, '');\n\n\t\t\tform = Dom.get(uid + '_form');\n\t\t\tif (form) {\n\t\t\t\tinputs = form.getElementsByTagName('input');\n\t\t\t\ti = inputs.length;\n\n\t\t\t\twhile (i--) {\n\t\t\t\t\tswitch (inputs[i].getAttribute('type')) {\n\t\t\t\t\t\tcase 'hidden':\n\t\t\t\t\t\t\tinputs[i].parentNode.removeChild(inputs[i]);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'file':\n\t\t\t\t\t\t\thasFile = true; // flag the case for later\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tinputs = [];\n\n\t\t\t\tif (!hasFile) { // we need to keep the form for sake of possible retries\n\t\t\t\t\tform.parentNode.removeChild(form);\n\t\t\t\t}\n\t\t\t\tform = null;\n\t\t\t}\n\n\t\t\t// without timeout, request is marked as canceled (in console)\n\t\t\tsetTimeout(function() {\n\t\t\t\tEvents.removeEvent(_iframe, 'load', target.uid);\n\t\t\t\tif (_iframe.parentNode) { // #382\n\t\t\t\t\t_iframe.parentNode.removeChild(_iframe);\n\t\t\t\t}\n\n\t\t\t\t// check if shim container has any other children, if - not, remove it as well\n\t\t\t\tvar shimContainer = target.getRuntime().getShimContainer();\n\t\t\t\tif (!shimContainer.children.length) {\n\t\t\t\t\tshimContainer.parentNode.removeChild(shimContainer);\n\t\t\t\t}\n\n\t\t\t\tshimContainer = _iframe = null;\n\t\t\t\tcb();\n\t\t\t}, 1);\n\t\t}\n\n\t\tBasic.extend(this, {\n\t\t\tsend: function(meta, data) {\n\t\t\t\tvar target = this, I = target.getRuntime(), uid, form, input, blob;\n\n\t\t\t\t_status = _response = null;\n\n\t\t\t\tfunction createIframe() {\n\t\t\t\t\tvar container = I.getShimContainer() || document.body\n\t\t\t\t\t, temp = document.createElement('div')\n\t\t\t\t\t;\n\n\t\t\t\t\t// IE 6 won't be able to set the name using setAttribute or iframe.name\n\t\t\t\t\ttemp.innerHTML = '';\n\t\t\t\t\t_iframe = temp.firstChild;\n\t\t\t\t\tcontainer.appendChild(_iframe);\n\n\t\t\t\t\t/* _iframe.onreadystatechange = function() {\n\t\t\t\t\t\tconsole.info(_iframe.readyState);\n\t\t\t\t\t};*/\n\n\t\t\t\t\tEvents.addEvent(_iframe, 'load', function() { // _iframe.onload doesn't work in IE lte 8\n\t\t\t\t\t\tvar el;\n\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tel = _iframe.contentWindow.document || _iframe.contentDocument || window.frames[_iframe.id].document;\n\n\t\t\t\t\t\t\t// try to detect some standard error pages\n\t\t\t\t\t\t\tif (/^4(0[0-9]|1[0-7]|2[2346])\\s/.test(el.title)) { // test if title starts with 4xx HTTP error\n\t\t\t\t\t\t\t\t_status = el.title.replace(/^(\\d+).*$/, '$1');\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t_status = 200;\n\t\t\t\t\t\t\t\t// get result\n\t\t\t\t\t\t\t\t_response = Basic.trim(el.body.innerHTML);\n\n\t\t\t\t\t\t\t\t// we need to fire these at least once\n\t\t\t\t\t\t\t\ttarget.trigger({\n\t\t\t\t\t\t\t\t\ttype: 'progress',\n\t\t\t\t\t\t\t\t\tloaded: _response.length,\n\t\t\t\t\t\t\t\t\ttotal: _response.length\n\t\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\t\tif (blob) { // if we were uploading a file\n\t\t\t\t\t\t\t\t\ttarget.trigger({\n\t\t\t\t\t\t\t\t\t\ttype: 'uploadprogress',\n\t\t\t\t\t\t\t\t\t\tloaded: blob.size || 1025,\n\t\t\t\t\t\t\t\t\t\ttotal: blob.size || 1025\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} catch (ex) {\n\t\t\t\t\t\t\tif (Url.hasSameOrigin(meta.url)) {\n\t\t\t\t\t\t\t\t// if response is sent with error code, iframe in IE gets redirected to res://ieframe.dll/http_x.htm\n\t\t\t\t\t\t\t\t// which obviously results to cross domain error (wtf?)\n\t\t\t\t\t\t\t\t_status = 404;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tcleanup.call(target, function() {\n\t\t\t\t\t\t\t\t\ttarget.trigger('error');\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\t\n\t\t\t\t\t\n\t\t\t\t\t\tcleanup.call(target, function() {\n\t\t\t\t\t\t\ttarget.trigger('load');\n\t\t\t\t\t\t});\n\t\t\t\t\t}, target.uid);\n\t\t\t\t} // end createIframe\n\n\t\t\t\t// prepare data to be sent and convert if required\n\t\t\t\tif (data instanceof FormData && data.hasBlob()) {\n\t\t\t\t\tblob = data.getBlob();\n\t\t\t\t\tuid = blob.uid;\n\t\t\t\t\tinput = Dom.get(uid);\n\t\t\t\t\tform = Dom.get(uid + '_form');\n\t\t\t\t\tif (!form) {\n\t\t\t\t\t\tthrow new x.DOMException(x.DOMException.NOT_FOUND_ERR);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tuid = Basic.guid('uid_');\n\n\t\t\t\t\tform = document.createElement('form');\n\t\t\t\t\tform.setAttribute('id', uid + '_form');\n\t\t\t\t\tform.setAttribute('method', meta.method);\n\t\t\t\t\tform.setAttribute('enctype', 'multipart/form-data');\n\t\t\t\t\tform.setAttribute('encoding', 'multipart/form-data');\n\n\t\t\t\t\tI.getShimContainer().appendChild(form);\n\t\t\t\t}\n\n\t\t\t\t// set upload target\n\t\t\t\tform.setAttribute('target', uid + '_iframe');\n\n\t\t\t\tif (data instanceof FormData) {\n\t\t\t\t\tdata.each(function(value, name) {\n\t\t\t\t\t\tif (value instanceof Blob) {\n\t\t\t\t\t\t\tif (input) {\n\t\t\t\t\t\t\t\tinput.setAttribute('name', name);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tvar hidden = document.createElement('input');\n\n\t\t\t\t\t\t\tBasic.extend(hidden, {\n\t\t\t\t\t\t\t\ttype : 'hidden',\n\t\t\t\t\t\t\t\tname : name,\n\t\t\t\t\t\t\t\tvalue : value\n\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\t// make sure that input[type=\"file\"], if it's there, comes last\n\t\t\t\t\t\t\tif (input) {\n\t\t\t\t\t\t\t\tform.insertBefore(hidden, input);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tform.appendChild(hidden);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\t// set destination url\n\t\t\t\tform.setAttribute(\"action\", meta.url);\n\n\t\t\t\tcreateIframe();\n\t\t\t\tform.submit();\n\t\t\t\ttarget.trigger('loadstart');\n\t\t\t},\n\n\t\t\tgetStatus: function() {\n\t\t\t\treturn _status;\n\t\t\t},\n\n\t\t\tgetResponse: function(responseType) {\n\t\t\t\tif ('json' === responseType) {\n\t\t\t\t\t// strip off ..
tags that might be enclosing the response\n\t\t\t\t\tif (Basic.typeOf(_response) === 'string' && !!window.JSON) {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\treturn JSON.parse(_response.replace(/^\\s*]*>/, '').replace(/<\\/pre>\\s*$/, ''));\n\t\t\t\t\t\t} catch (ex) {\n\t\t\t\t\t\t\treturn null;\n\t\t\t\t\t\t}\n\t\t\t\t\t} \n\t\t\t\t} else if ('document' === responseType) {\n\n\t\t\t\t}\n\t\t\t\treturn _response;\n\t\t\t},\n\n\t\t\tabort: function() {\n\t\t\t\tvar target = this;\n\n\t\t\t\tif (_iframe && _iframe.contentWindow) {\n\t\t\t\t\tif (_iframe.contentWindow.stop) { // FireFox/Safari/Chrome\n\t\t\t\t\t\t_iframe.contentWindow.stop();\n\t\t\t\t\t} else if (_iframe.contentWindow.document.execCommand) { // IE\n\t\t\t\t\t\t_iframe.contentWindow.document.execCommand('Stop');\n\t\t\t\t\t} else {\n\t\t\t\t\t\t_iframe.src = \"about:blank\";\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tcleanup.call(this, function() {\n\t\t\t\t\t// target.dispatchEvent('readystatechange');\n\t\t\t\t\ttarget.dispatchEvent('abort');\n\t\t\t\t});\n\t\t\t},\n\n\t\t\tdestroy: function() {\n\t\t\t\tthis.getRuntime().getShim().removeInstance(this.uid);\n\t\t\t}\n\t\t});\n\t}\n\n\treturn (extensions.XMLHttpRequest = XMLHttpRequest);\n});\n\n// Included from: src/javascript/runtime/html4/image/Image.js\n\n/**\n * Image.js\n *\n * Copyright 2013, Moxiecode Systems AB\n * Released under GPL License.\n *\n * License: http://www.plupload.com/license\n * Contributing: http://www.plupload.com/contributing\n */\n\n/**\n@class moxie/runtime/html4/image/Image\n@private\n*/\ndefine(\"moxie/runtime/html4/image/Image\", [\n\t\"moxie/runtime/html4/Runtime\",\n\t\"moxie/runtime/html5/image/Image\"\n], function(extensions, Image) {\n\treturn (extensions.Image = Image);\n});\n\nexpose([\"moxie/core/utils/Basic\",\"moxie/core/utils/Encode\",\"moxie/core/utils/Env\",\"moxie/core/Exceptions\",\"moxie/core/utils/Dom\",\"moxie/core/EventTarget\",\"moxie/runtime/Runtime\",\"moxie/runtime/RuntimeClient\",\"moxie/file/Blob\",\"moxie/core/I18n\",\"moxie/core/utils/Mime\",\"moxie/file/FileInput\",\"moxie/file/File\",\"moxie/file/FileDrop\",\"moxie/file/FileReader\",\"moxie/core/utils/Url\",\"moxie/runtime/RuntimeTarget\",\"moxie/xhr/FormData\",\"moxie/xhr/XMLHttpRequest\",\"moxie/image/Image\",\"moxie/core/utils/Events\",\"moxie/runtime/html5/image/ResizerCanvas\"]);\n})(this);\n}));", "/**\n * mOxie - multi-runtime File API & XMLHttpRequest L2 Polyfill\n * v1.5.7\n *\n * Copyright 2013, Moxiecode Systems AB\n * Released under GPL License.\n *\n * License: http://www.plupload.com/license\n * Contributing: http://www.plupload.com/contributing\n *\n * Date: 2017-11-03\n */\n!function(e,t){var i=function(){var e={};return t.apply(e,arguments),e.moxie};\"function\"==typeof define&&define.amd?define(\"moxie\",[],i):\"object\"==typeof module&&module.exports?module.exports=i():e.moxie=i()}(this||window,function(){!function(e,t){\"use strict\";function i(e,t){for(var i,n=[],r=0;r0&&c(n,function(n,u){var c=-1!==h(e(n),[\"array\",\"object\"]);return n===r||t&&o[u]===r?!0:(c&&i&&(n=a(n)),e(o[u])===e(n)&&c?s(t,i,[o[u],n]):o[u]=n,void 0)})}),o}function u(e,t){function i(){this.constructor=e}for(var n in t)({}).hasOwnProperty.call(t,n)&&(e[n]=t[n]);return i.prototype=t.prototype,e.prototype=new i,e.parent=t.prototype,e}function c(e,t){var i,n,r,o;if(e){try{i=e.length}catch(a){i=o}if(i===o||\"number\"!=typeof i){for(n in e)if(e.hasOwnProperty(n)&&t(e[n],n)===!1)return}else for(r=0;i>r;r++)if(t(e[r],r)===!1)return}}function l(t){var i;if(!t||\"object\"!==e(t))return!0;for(i in t)return!1;return!0}function d(t,i){function n(r){\"function\"===e(t[r])&&t[r](function(e){++ri;i++)if(t[i]===e)return i}return-1}function f(t,i){var n=[];\"array\"!==e(t)&&(t=[t]),\"array\"!==e(i)&&(i=[i]);for(var r in t)-1===h(t[r],i)&&n.push(t[r]);return n.length?n:!1}function p(e,t){var i=[];return c(e,function(e){-1!==h(e,t)&&i.push(e)}),i.length?i:null}function g(e){var t,i=[];for(t=0;ti;i++)n+=Math.floor(65535*Math.random()).toString(32);return(t||\"o_\")+n+(e++).toString(32)}}();return{guid:E,typeOf:e,extend:t,extendIf:i,extendImmutable:n,extendImmutableIf:r,clone:o,inherit:u,each:c,isEmptyObj:l,inSeries:d,inParallel:m,inArray:h,arrayDiff:f,arrayIntersect:p,toArray:g,trim:x,sprintf:w,parseSizeStr:v,delay:y}}),n(\"moxie/core/utils/Encode\",[],function(){var e=function(e){return unescape(encodeURIComponent(e))},t=function(e){return decodeURIComponent(escape(e))},i=function(e,i){if(\"function\"==typeof window.atob)return i?t(window.atob(e)):window.atob(e);var n,r,o,a,s,u,c,l,d=\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\",m=0,h=0,f=\"\",p=[];if(!e)return e;e+=\"\";do a=d.indexOf(e.charAt(m++)),s=d.indexOf(e.charAt(m++)),u=d.indexOf(e.charAt(m++)),c=d.indexOf(e.charAt(m++)),l=a<<18|s<<12|u<<6|c,n=255&l>>16,r=255&l>>8,o=255&l,p[h++]=64==u?String.fromCharCode(n):64==c?String.fromCharCode(n,r):String.fromCharCode(n,r,o);while(m>18,s=63&l>>12,u=63&l>>6,c=63&l,p[h++]=d.charAt(a)+d.charAt(s)+d.charAt(u)+d.charAt(c);while(mn;n++)if(e[n]!=t[n]){if(e[n]=u(e[n]),t[n]=u(t[n]),e[n]t[n]){o=1;break}}if(!i)return o;switch(i){case\">\":case\"gt\":return o>0;case\">=\":case\"ge\":return o>=0;case\"<=\":case\"le\":return 0>=o;case\"==\":case\"=\":case\"eq\":return 0===o;case\"<>\":case\"!=\":case\"ne\":return 0!==o;case\"\":case\"<\":case\"lt\":return 0>o;default:return null}}var n=function(e){var t=\"\",i=\"?\",n=\"function\",r=\"undefined\",o=\"object\",a=\"name\",s=\"version\",u={has:function(e,t){return-1!==t.toLowerCase().indexOf(e.toLowerCase())},lowerize:function(e){return e.toLowerCase()}},c={rgx:function(){for(var t,i,a,s,u,c,l,d=0,m=arguments;d0?2==u.length?t[u[0]]=typeof u[1]==n?u[1].call(this,l):u[1]:3==u.length?t[u[0]]=typeof u[1]!==n||u[1].exec&&u[1].test?l?l.replace(u[1],u[2]):e:l?u[1].call(this,l,u[2]):e:4==u.length&&(t[u[0]]=l?u[3].call(this,l.replace(u[1],u[2])):e):t[u]=l?l:e;break}if(c)break}return t},str:function(t,n){for(var r in n)if(typeof n[r]===o&&n[r].length>0){for(var a=0;a=\")),i.use_blob_uri},use_data_uri:function(){var e=new Image;return e.onload=function(){i.use_data_uri=1===e.width&&1===e.height},setTimeout(function(){e.src=\"data:image/gif;base64,R0lGODlhAQABAIAAAP8AAAAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==\"},1),!1}(),use_data_uri_over32kb:function(){return i.use_data_uri&&(\"IE\"!==a.browser||a.version>=9)},use_data_uri_of:function(e){return i.use_data_uri&&33e3>e||i.use_data_uri_over32kb()},use_fileinput:function(){if(navigator.userAgent.match(/(Android (1.0|1.1|1.5|1.6|2.0|2.1))|(Windows Phone (OS 7|8.0))|(XBLWP)|(ZuneWP)|(w(eb)?OSBrowser)|(webOS)|(Kindle\\/(1.0|2.0|2.5|3.0))/))return!1;var e=document.createElement(\"input\");return e.setAttribute(\"type\",\"file\"),i.use_fileinput=!e.disabled},use_webgl:function(){var e,n=document.createElement(\"canvas\"),r=null;try{r=n.getContext(\"webgl\")||n.getContext(\"experimental-webgl\")}catch(o){}return r||(r=null),e=!!r,i.use_webgl=e,n=t,e}};return function(t){var n=[].slice.call(arguments);return n.shift(),\"function\"===e.typeOf(i[t])?i[t].apply(this,n):!!i[t]}}(),o=(new n).getResult(),a={can:r,uaParser:n,browser:o.browser.name,version:o.browser.version,os:o.os.name,osVersion:o.os.version,verComp:i,swf_url:\"../flash/Moxie.swf\",xap_url:\"../silverlight/Moxie.xap\",global_event_dispatcher:\"moxie.core.EventTarget.instance.dispatchEvent\"};return a.OS=a.os,a}),n(\"moxie/core/Exceptions\",[\"moxie/core/utils/Basic\"],function(e){function t(e,t){var i;for(i in e)if(e[i]===t)return i;return null}return{RuntimeError:function(){function i(e,i){this.code=e,this.name=t(n,e),this.message=this.name+(i||\": RuntimeError \"+this.code)}var n={NOT_INIT_ERR:1,EXCEPTION_ERR:3,NOT_SUPPORTED_ERR:9,JS_ERR:4};return e.extend(i,n),i.prototype=Error.prototype,i}(),OperationNotAllowedException:function(){function t(e){this.code=e,this.name=\"OperationNotAllowedException\"}return e.extend(t,{NOT_ALLOWED_ERR:1}),t.prototype=Error.prototype,t}(),ImageError:function(){function i(e){this.code=e,this.name=t(n,e),this.message=this.name+\": ImageError \"+this.code}var n={WRONG_FORMAT:1,MAX_RESOLUTION_ERR:2,INVALID_META_ERR:3};return e.extend(i,n),i.prototype=Error.prototype,i}(),FileException:function(){function i(e){this.code=e,this.name=t(n,e),this.message=this.name+\": FileException \"+this.code}var n={NOT_FOUND_ERR:1,SECURITY_ERR:2,ABORT_ERR:3,NOT_READABLE_ERR:4,ENCODING_ERR:5,NO_MODIFICATION_ALLOWED_ERR:6,INVALID_STATE_ERR:7,SYNTAX_ERR:8};return e.extend(i,n),i.prototype=Error.prototype,i}(),DOMException:function(){function i(e){this.code=e,this.name=t(n,e),this.message=this.name+\": DOMException \"+this.code}var n={INDEX_SIZE_ERR:1,DOMSTRING_SIZE_ERR:2,HIERARCHY_REQUEST_ERR:3,WRONG_DOCUMENT_ERR:4,INVALID_CHARACTER_ERR:5,NO_DATA_ALLOWED_ERR:6,NO_MODIFICATION_ALLOWED_ERR:7,NOT_FOUND_ERR:8,NOT_SUPPORTED_ERR:9,INUSE_ATTRIBUTE_ERR:10,INVALID_STATE_ERR:11,SYNTAX_ERR:12,INVALID_MODIFICATION_ERR:13,NAMESPACE_ERR:14,INVALID_ACCESS_ERR:15,VALIDATION_ERR:16,TYPE_MISMATCH_ERR:17,SECURITY_ERR:18,NETWORK_ERR:19,ABORT_ERR:20,URL_MISMATCH_ERR:21,QUOTA_EXCEEDED_ERR:22,TIMEOUT_ERR:23,INVALID_NODE_TYPE_ERR:24,DATA_CLONE_ERR:25};return e.extend(i,n),i.prototype=Error.prototype,i}(),EventException:function(){function t(e){this.code=e,this.name=\"EventException\"}return e.extend(t,{UNSPECIFIED_EVENT_TYPE_ERR:0}),t.prototype=Error.prototype,t}()}}),n(\"moxie/core/utils/Dom\",[\"moxie/core/utils/Env\"],function(e){var t=function(e){return\"string\"!=typeof e?e:document.getElementById(e)},i=function(e,t){if(!e.className)return!1;var i=new RegExp(\"(^|\\\\s+)\"+t+\"(\\\\s+|$)\");return i.test(e.className)},n=function(e,t){i(e,t)||(e.className=e.className?e.className.replace(/\\s+$/,\"\")+\" \"+t:t)},r=function(e,t){if(e.className){var i=new RegExp(\"(^|\\\\s+)\"+t+\"(\\\\s+|$)\");e.className=e.className.replace(i,function(e,t,i){return\" \"===t&&\" \"===i?\" \":\"\"})}},o=function(e,t){return e.currentStyle?e.currentStyle[t]:window.getComputedStyle?window.getComputedStyle(e,null)[t]:void 0},a=function(t,i){function n(e){var t,i,n=0,r=0;return e&&(i=e.getBoundingClientRect(),t=\"CSS1Compat\"===c.compatMode?c.documentElement:c.body,n=i.left+t.scrollLeft,r=i.top+t.scrollTop),{x:n,y:r}}var r,o,a,s=0,u=0,c=document;if(t=t,i=i||c.body,t&&t.getBoundingClientRect&&\"IE\"===e.browser&&(!c.documentMode||c.documentMode<8))return o=n(t),a=n(i),{x:o.x-a.x,y:o.y-a.y};for(r=t;r&&r!=i&&r.nodeType;)s+=r.offsetLeft||0,u+=r.offsetTop||0,r=r.offsetParent;for(r=t.parentNode;r&&r!=i&&r.nodeType;)s-=r.scrollLeft||0,u-=r.scrollTop||0,r=r.parentNode;return{x:s,y:u}},s=function(e){return{w:e.offsetWidth||e.clientWidth,h:e.offsetHeight||e.clientHeight}};return{get:t,hasClass:i,addClass:n,removeClass:r,getStyle:o,getPos:a,getSize:s}}),n(\"moxie/core/EventTarget\",[\"moxie/core/utils/Env\",\"moxie/core/Exceptions\",\"moxie/core/utils/Basic\"],function(e,t,i){function n(){this.uid=i.guid()}var r={};return i.extend(n.prototype,{init:function(){this.uid||(this.uid=i.guid(\"uid_\"))},addEventListener:function(e,t,n,o){var a,s=this;return this.hasOwnProperty(\"uid\")||(this.uid=i.guid(\"uid_\")),e=i.trim(e),/\\s/.test(e)?(i.each(e.split(/\\s+/),function(e){s.addEventListener(e,t,n,o)}),void 0):(e=e.toLowerCase(),n=parseInt(n,10)||0,a=r[this.uid]&&r[this.uid][e]||[],a.push({fn:t,priority:n,scope:o||this}),r[this.uid]||(r[this.uid]={}),r[this.uid][e]=a,void 0)},hasEventListener:function(e){var t;return e?(e=e.toLowerCase(),t=r[this.uid]&&r[this.uid][e]):t=r[this.uid],t?t:!1},removeEventListener:function(e,t){var n,o,a=this;if(e=e.toLowerCase(),/\\s/.test(e))return i.each(e.split(/\\s+/),function(e){a.removeEventListener(e,t)}),void 0;if(n=r[this.uid]&&r[this.uid][e]){if(t){for(o=n.length-1;o>=0;o--)if(n[o].fn===t){n.splice(o,1);break}}else n=[];n.length||(delete r[this.uid][e],i.isEmptyObj(r[this.uid])&&delete r[this.uid])}},removeAllEventListeners:function(){r[this.uid]&&delete r[this.uid]},dispatchEvent:function(e){var n,o,a,s,u,c={},l=!0;if(\"string\"!==i.typeOf(e)){if(s=e,\"string\"!==i.typeOf(s.type))throw new t.EventException(t.EventException.UNSPECIFIED_EVENT_TYPE_ERR);e=s.type,s.total!==u&&s.loaded!==u&&(c.total=s.total,c.loaded=s.loaded),c.async=s.async||!1}if(-1!==e.indexOf(\"::\")?function(t){n=t[0],e=t[1]}(e.split(\"::\")):n=this.uid,e=e.toLowerCase(),o=r[n]&&r[n][e]){o.sort(function(e,t){return t.priority-e.priority}),a=[].slice.call(arguments),a.shift(),c.type=e,a.unshift(c);var d=[];i.each(o,function(e){a[0].target=e.scope,c.async?d.push(function(t){setTimeout(function(){t(e.fn.apply(e.scope,a)===!1)},1)}):d.push(function(t){t(e.fn.apply(e.scope,a)===!1)})}),d.length&&i.inSeries(d,function(e){l=!e})}return l},bindOnce:function(e,t,i,n){var r=this;r.bind.call(this,e,function o(){return r.unbind(e,o),t.apply(this,arguments)},i,n)},bind:function(){this.addEventListener.apply(this,arguments)},unbind:function(){this.removeEventListener.apply(this,arguments)},unbindAll:function(){this.removeAllEventListeners.apply(this,arguments)},trigger:function(){return this.dispatchEvent.apply(this,arguments)},handleEventProps:function(e){var t=this;this.bind(e.join(\" \"),function(e){var t=\"on\"+e.type.toLowerCase();\"function\"===i.typeOf(this[t])&&this[t].apply(this,arguments)}),i.each(e,function(e){e=\"on\"+e.toLowerCase(e),\"undefined\"===i.typeOf(t[e])&&(t[e]=null)})}}),n.instance=new n,n}),n(\"moxie/runtime/Runtime\",[\"moxie/core/utils/Env\",\"moxie/core/utils/Basic\",\"moxie/core/utils/Dom\",\"moxie/core/EventTarget\"],function(e,t,i,n){function r(e,n,o,s,u){var c,l=this,d=t.guid(n+\"_\"),m=u||\"browser\";e=e||{},a[d]=this,o=t.extend({access_binary:!1,access_image_binary:!1,display_media:!1,do_cors:!1,drag_and_drop:!1,filter_by_extension:!0,resize_image:!1,report_upload_progress:!1,return_response_headers:!1,return_response_type:!1,return_status_code:!0,send_custom_headers:!1,select_file:!1,select_folder:!1,select_multiple:!0,send_binary_string:!1,send_browser_cookies:!0,send_multipart:!0,slice_blob:!1,stream_upload:!1,summon_file_dialog:!1,upload_filesize:!0,use_http_method:!0},o),e.preferred_caps&&(m=r.getMode(s,e.preferred_caps,m)),c=function(){var e={};return{exec:function(t,i,n,r){return c[i]&&(e[t]||(e[t]={context:this,instance:new c[i]}),e[t].instance[n])?e[t].instance[n].apply(this,r):void 0},removeInstance:function(t){delete e[t]},removeAllInstances:function(){var i=this;t.each(e,function(e,n){\"function\"===t.typeOf(e.instance.destroy)&&e.instance.destroy.call(e.context),i.removeInstance(n)})}}}(),t.extend(this,{initialized:!1,uid:d,type:n,mode:r.getMode(s,e.required_caps,m),shimid:d+\"_container\",clients:0,options:e,can:function(e,i){var n=arguments[2]||o;if(\"string\"===t.typeOf(e)&&\"undefined\"===t.typeOf(i)&&(e=r.parseCaps(e)),\"object\"===t.typeOf(e)){for(var a in e)if(!this.can(a,e[a],n))return!1;return!0}return\"function\"===t.typeOf(n[e])?n[e].call(this,i):i===n[e]},getShimContainer:function(){var e,n=i.get(this.shimid);return n||(e=i.get(this.options.container)||document.body,n=document.createElement(\"div\"),n.id=this.shimid,n.className=\"moxie-shim moxie-shim-\"+this.type,t.extend(n.style,{position:\"absolute\",top:\"0px\",left:\"0px\",width:\"1px\",height:\"1px\",overflow:\"hidden\"}),e.appendChild(n),e=null),n},getShim:function(){return c},shimExec:function(e,t){var i=[].slice.call(arguments,2);return l.getShim().exec.call(this,this.uid,e,t,i)},exec:function(e,t){var i=[].slice.call(arguments,2);return l[e]&&l[e][t]?l[e][t].apply(this,i):l.shimExec.apply(this,arguments)},destroy:function(){if(l){var e=i.get(this.shimid);e&&e.parentNode.removeChild(e),c&&c.removeAllInstances(),this.unbindAll(),delete a[this.uid],this.uid=null,d=l=c=e=null}}}),this.mode&&e.required_caps&&!this.can(e.required_caps)&&(this.mode=!1)}var o={},a={};return r.order=\"html5,flash,silverlight,html4\",r.getRuntime=function(e){return a[e]?a[e]:!1},r.addConstructor=function(e,t){t.prototype=n.instance,o[e]=t},r.getConstructor=function(e){return o[e]||null},r.getInfo=function(e){var t=r.getRuntime(e);return t?{uid:t.uid,type:t.type,mode:t.mode,can:function(){return t.can.apply(t,arguments)}}:null},r.parseCaps=function(e){var i={};return\"string\"!==t.typeOf(e)?e||{}:(t.each(e.split(\",\"),function(e){i[e]=!0}),i)},r.can=function(e,t){var i,n,o=r.getConstructor(e);return o?(i=new o({required_caps:t}),n=i.mode,i.destroy(),!!n):!1},r.thatCan=function(e,t){var i=(t||r.order).split(/\\s*,\\s*/);for(var n in i)if(r.can(i[n],e))return i[n];return null},r.getMode=function(e,i,n){var r=null;if(\"undefined\"===t.typeOf(n)&&(n=\"browser\"),i&&!t.isEmptyObj(e)){if(t.each(i,function(i,n){if(e.hasOwnProperty(n)){var o=e[n](i);if(\"string\"==typeof o&&(o=[o]),r){if(!(r=t.arrayIntersect(r,o)))return r=!1}else r=o}}),r)return-1!==t.inArray(n,r)?n:r[0];if(r===!1)return!1}return n},r.getGlobalEventTarget=function(){if(/^moxie\\./.test(e.global_event_dispatcher)&&!e.can(\"access_global_ns\")){var i=t.guid(\"moxie_event_target_\");window[i]=function(e,t){n.instance.dispatchEvent(e,t)},e.global_event_dispatcher=i}return e.global_event_dispatcher},r.capTrue=function(){return!0},r.capFalse=function(){return!1},r.capTest=function(e){return function(){return!!e}},r}),n(\"moxie/runtime/RuntimeClient\",[\"moxie/core/utils/Env\",\"moxie/core/Exceptions\",\"moxie/core/utils/Basic\",\"moxie/runtime/Runtime\"],function(e,t,i,n){return function(){var e;i.extend(this,{connectRuntime:function(r){function o(i){var a,u;return i.length?(a=i.shift().toLowerCase(),(u=n.getConstructor(a))?(e=new u(r),e.bind(\"Init\",function(){e.initialized=!0,setTimeout(function(){e.clients++,s.ruid=e.uid,s.trigger(\"RuntimeInit\",e)},1)}),e.bind(\"Error\",function(){e.destroy(),o(i)}),e.bind(\"Exception\",function(e,i){var n=i.name+\"(#\"+i.code+\")\"+(i.message?\", from: \"+i.message:\"\");s.trigger(\"RuntimeError\",new t.RuntimeError(t.RuntimeError.EXCEPTION_ERR,n))}),e.mode?(e.init(),void 0):(e.trigger(\"Error\"),void 0)):(o(i),void 0)):(s.trigger(\"RuntimeError\",new t.RuntimeError(t.RuntimeError.NOT_INIT_ERR)),e=null,void 0)}var a,s=this;if(\"string\"===i.typeOf(r)?a=r:\"string\"===i.typeOf(r.ruid)&&(a=r.ruid),a){if(e=n.getRuntime(a))return s.ruid=a,e.clients++,e;throw new t.RuntimeError(t.RuntimeError.NOT_INIT_ERR)}o((r.runtime_order||n.order).split(/\\s*,\\s*/))},disconnectRuntime:function(){e&&--e.clients<=0&&e.destroy(),e=null},getRuntime:function(){return e&&e.uid?e:e=null},exec:function(){return e?e.exec.apply(this,arguments):null},can:function(t){return e?e.can(t):!1}})}}),n(\"moxie/file/Blob\",[\"moxie/core/utils/Basic\",\"moxie/core/utils/Encode\",\"moxie/runtime/RuntimeClient\"],function(e,t,i){function n(o,a){function s(t,i,o){var a,s=r[this.uid];return\"string\"===e.typeOf(s)&&s.length?(a=new n(null,{type:o,size:i-t}),a.detach(s.substr(t,a.size)),a):null}i.call(this),o&&this.connectRuntime(o),a?\"string\"===e.typeOf(a)&&(a={data:a}):a={},e.extend(this,{uid:a.uid||e.guid(\"uid_\"),ruid:o,size:a.size||0,type:a.type||\"\",slice:function(e,t,i){return this.isDetached()?s.apply(this,arguments):this.getRuntime().exec.call(this,\"Blob\",\"slice\",this.getSource(),e,t,i)},getSource:function(){return r[this.uid]?r[this.uid]:null},detach:function(e){if(this.ruid&&(this.getRuntime().exec.call(this,\"Blob\",\"destroy\"),this.disconnectRuntime(),this.ruid=null),e=e||\"\",\"data:\"==e.substr(0,5)){var i=e.indexOf(\";base64,\");this.type=e.substring(5,i),e=t.atob(e.substring(i+8))}this.size=e.length,r[this.uid]=e},isDetached:function(){return!this.ruid&&\"string\"===e.typeOf(r[this.uid])},destroy:function(){this.detach(),delete r[this.uid]}}),a.data?this.detach(a.data):r[this.uid]=a}var r={};return n}),n(\"moxie/core/I18n\",[\"moxie/core/utils/Basic\"],function(e){var t={};return{addI18n:function(i){return e.extend(t,i)},translate:function(e){return t[e]||e},_:function(e){return this.translate(e)},sprintf:function(t){var i=[].slice.call(arguments,1);return t.replace(/%[a-z]/g,function(){var t=i.shift();return\"undefined\"!==e.typeOf(t)?t:\"\"})}}}),n(\"moxie/core/utils/Mime\",[\"moxie/core/utils/Basic\",\"moxie/core/I18n\"],function(e,t){var i=\"application/msword,doc dot,application/pdf,pdf,application/pgp-signature,pgp,application/postscript,ps ai eps,application/rtf,rtf,application/vnd.ms-excel,xls xlb xlt xla,application/vnd.ms-powerpoint,ppt pps pot ppa,application/zip,zip,application/x-shockwave-flash,swf swfl,application/vnd.openxmlformats-officedocument.wordprocessingml.document,docx,application/vnd.openxmlformats-officedocument.wordprocessingml.template,dotx,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,xlsx,application/vnd.openxmlformats-officedocument.presentationml.presentation,pptx,application/vnd.openxmlformats-officedocument.presentationml.template,potx,application/vnd.openxmlformats-officedocument.presentationml.slideshow,ppsx,application/x-javascript,js,application/json,json,audio/mpeg,mp3 mpga mpega mp2,audio/x-wav,wav,audio/x-m4a,m4a,audio/ogg,oga ogg,audio/aiff,aiff aif,audio/flac,flac,audio/aac,aac,audio/ac3,ac3,audio/x-ms-wma,wma,image/bmp,bmp,image/gif,gif,image/jpeg,jpg jpeg jpe,image/photoshop,psd,image/png,png,image/svg+xml,svg svgz,image/tiff,tiff tif,text/plain,asc txt text diff log,text/html,htm html xhtml,text/css,css,text/csv,csv,text/rtf,rtf,video/mpeg,mpeg mpg mpe m2v,video/quicktime,qt mov,video/mp4,mp4,video/x-m4v,m4v,video/x-flv,flv,video/x-ms-wmv,wmv,video/avi,avi,video/webm,webm,video/3gpp,3gpp 3gp,video/3gpp2,3g2,video/vnd.rn-realvideo,rv,video/ogg,ogv,video/x-matroska,mkv,application/vnd.oasis.opendocument.formula-template,otf,application/octet-stream,exe\",n={},r={},o=function(e){var t,i,o,a=e.split(/,/);for(t=0;ta;a++)o+=String.fromCharCode(r[a]);return o}}t.call(this),e.extend(this,{uid:e.guid(\"uid_\"),readAsBinaryString:function(e){return n.call(this,\"readAsBinaryString\",e)},readAsDataURL:function(e){return n.call(this,\"readAsDataURL\",e)},readAsText:function(e){return n.call(this,\"readAsText\",e)}})}}),n(\"moxie/xhr/FormData\",[\"moxie/core/Exceptions\",\"moxie/core/utils/Basic\",\"moxie/file/Blob\"],function(e,t,i){function n(){var e,n=[];t.extend(this,{append:function(r,o){var a=this,s=t.typeOf(o);o instanceof i?e={name:r,value:o}:\"array\"===s?(r+=\"[]\",t.each(o,function(e){a.append(r,e)})):\"object\"===s?t.each(o,function(e,t){a.append(r+\"[\"+t+\"]\",e)}):\"null\"===s||\"undefined\"===s||\"number\"===s&&isNaN(o)?a.append(r,\"false\"):n.push({name:r,value:o.toString()})},hasBlob:function(){return!!this.getBlob()},getBlob:function(){return e&&e.value||null},getBlobName:function(){return e&&e.name||null},each:function(i){t.each(n,function(e){i(e.value,e.name)}),e&&i(e.value,e.name)},destroy:function(){e=null,n=[]}})}return n}),n(\"moxie/xhr/XMLHttpRequest\",[\"moxie/core/utils/Basic\",\"moxie/core/Exceptions\",\"moxie/core/EventTarget\",\"moxie/core/utils/Encode\",\"moxie/core/utils/Url\",\"moxie/runtime/Runtime\",\"moxie/runtime/RuntimeTarget\",\"moxie/file/Blob\",\"moxie/file/FileReaderSync\",\"moxie/xhr/FormData\",\"moxie/core/utils/Env\",\"moxie/core/utils/Mime\"],function(e,t,i,n,r,o,a,s,u,c,l,d){function m(){this.uid=e.guid(\"uid_\")}function h(){function i(e,t){return I.hasOwnProperty(e)?1===arguments.length?l.can(\"define_property\")?I[e]:A[e]:(l.can(\"define_property\")?I[e]=t:A[e]=t,void 0):void 0}function u(t){function n(){_&&(_.destroy(),_=null),s.dispatchEvent(\"loadend\"),s=null}function r(r){_.bind(\"LoadStart\",function(e){i(\"readyState\",h.LOADING),s.dispatchEvent(\"readystatechange\"),s.dispatchEvent(e),L&&s.upload.dispatchEvent(e)}),_.bind(\"Progress\",function(e){i(\"readyState\")!==h.LOADING&&(i(\"readyState\",h.LOADING),s.dispatchEvent(\"readystatechange\")),s.dispatchEvent(e)}),_.bind(\"UploadProgress\",function(e){L&&s.upload.dispatchEvent({type:\"progress\",lengthComputable:!1,total:e.total,loaded:e.loaded})}),_.bind(\"Load\",function(t){i(\"readyState\",h.DONE),i(\"status\",Number(r.exec.call(_,\"XMLHttpRequest\",\"getStatus\")||0)),i(\"statusText\",f[i(\"status\")]||\"\"),i(\"response\",r.exec.call(_,\"XMLHttpRequest\",\"getResponse\",i(\"responseType\"))),~e.inArray(i(\"responseType\"),[\"text\",\"\"])?i(\"responseText\",i(\"response\")):\"document\"===i(\"responseType\")&&i(\"responseXML\",i(\"response\")),U=r.exec.call(_,\"XMLHttpRequest\",\"getAllResponseHeaders\"),s.dispatchEvent(\"readystatechange\"),i(\"status\")>0?(L&&s.upload.dispatchEvent(t),s.dispatchEvent(t)):(F=!0,s.dispatchEvent(\"error\")),n()}),_.bind(\"Abort\",function(e){s.dispatchEvent(e),n()}),_.bind(\"Error\",function(e){F=!0,i(\"readyState\",h.DONE),s.dispatchEvent(\"readystatechange\"),M=!0,s.dispatchEvent(e),n()}),r.exec.call(_,\"XMLHttpRequest\",\"send\",{url:x,method:v,async:T,user:w,password:y,headers:S,mimeType:D,encoding:O,responseType:s.responseType,withCredentials:s.withCredentials,options:k},t)}var s=this;E=(new Date).getTime(),_=new a,\"string\"==typeof k.required_caps&&(k.required_caps=o.parseCaps(k.required_caps)),k.required_caps=e.extend({},k.required_caps,{return_response_type:s.responseType}),t instanceof c&&(k.required_caps.send_multipart=!0),e.isEmptyObj(S)||(k.required_caps.send_custom_headers=!0),B||(k.required_caps.do_cors=!0),k.ruid?r(_.connectRuntime(k)):(_.bind(\"RuntimeInit\",function(e,t){r(t)}),_.bind(\"RuntimeError\",function(e,t){s.dispatchEvent(\"RuntimeError\",t)}),_.connectRuntime(k))}function g(){i(\"responseText\",\"\"),i(\"responseXML\",null),i(\"response\",null),i(\"status\",0),i(\"statusText\",\"\"),E=b=null}var x,v,w,y,E,b,_,R,A=this,I={timeout:0,readyState:h.UNSENT,withCredentials:!1,status:0,statusText:\"\",responseType:\"\",responseXML:null,responseText:null,response:null},T=!0,S={},O=null,D=null,N=!1,C=!1,L=!1,M=!1,F=!1,B=!1,P=null,H=null,k={},U=\"\";e.extend(this,I,{uid:e.guid(\"uid_\"),upload:new m,open:function(o,a,s,u,c){var l;if(!o||!a)throw new t.DOMException(t.DOMException.SYNTAX_ERR);if(/[\\u0100-\\uffff]/.test(o)||n.utf8_encode(o)!==o)throw new t.DOMException(t.DOMException.SYNTAX_ERR);if(~e.inArray(o.toUpperCase(),[\"CONNECT\",\"DELETE\",\"GET\",\"HEAD\",\"OPTIONS\",\"POST\",\"PUT\",\"TRACE\",\"TRACK\"])&&(v=o.toUpperCase()),~e.inArray(v,[\"CONNECT\",\"TRACE\",\"TRACK\"]))throw new t.DOMException(t.DOMException.SECURITY_ERR);if(a=n.utf8_encode(a),l=r.parseUrl(a),B=r.hasSameOrigin(l),x=r.resolveUrl(a),(u||c)&&!B)throw new t.DOMException(t.DOMException.INVALID_ACCESS_ERR);if(w=u||l.user,y=c||l.pass,T=s||!0,T===!1&&(i(\"timeout\")||i(\"withCredentials\")||\"\"!==i(\"responseType\")))throw new t.DOMException(t.DOMException.INVALID_ACCESS_ERR);N=!T,C=!1,S={},g.call(this),i(\"readyState\",h.OPENED),this.dispatchEvent(\"readystatechange\")},setRequestHeader:function(r,o){var a=[\"accept-charset\",\"accept-encoding\",\"access-control-request-headers\",\"access-control-request-method\",\"connection\",\"content-length\",\"cookie\",\"cookie2\",\"content-transfer-encoding\",\"date\",\"expect\",\"host\",\"keep-alive\",\"origin\",\"referer\",\"te\",\"trailer\",\"transfer-encoding\",\"upgrade\",\"user-agent\",\"via\"];if(i(\"readyState\")!==h.OPENED||C)throw new t.DOMException(t.DOMException.INVALID_STATE_ERR);if(/[\\u0100-\\uffff]/.test(r)||n.utf8_encode(r)!==r)throw new t.DOMException(t.DOMException.SYNTAX_ERR);return r=e.trim(r).toLowerCase(),~e.inArray(r,a)||/^(proxy\\-|sec\\-)/.test(r)?!1:(S[r]?S[r]+=\", \"+o:S[r]=o,!0)},hasRequestHeader:function(e){return e&&S[e.toLowerCase()]||!1},getAllResponseHeaders:function(){return U||\"\"},getResponseHeader:function(t){return t=t.toLowerCase(),F||~e.inArray(t,[\"set-cookie\",\"set-cookie2\"])?null:U&&\"\"!==U&&(R||(R={},e.each(U.split(/\\r\\n/),function(t){var i=t.split(/:\\s+/);2===i.length&&(i[0]=e.trim(i[0]),R[i[0].toLowerCase()]={header:i[0],value:e.trim(i[1])})})),R.hasOwnProperty(t))?R[t].header+\": \"+R[t].value:null},overrideMimeType:function(n){var r,o;if(~e.inArray(i(\"readyState\"),[h.LOADING,h.DONE]))throw new t.DOMException(t.DOMException.INVALID_STATE_ERR);if(n=e.trim(n.toLowerCase()),/;/.test(n)&&(r=n.match(/^([^;]+)(?:;\\scharset\\=)?(.*)$/))&&(n=r[1],r[2]&&(o=r[2])),!d.mimes[n])throw new t.DOMException(t.DOMException.SYNTAX_ERR);P=n,H=o},send:function(i,r){if(k=\"string\"===e.typeOf(r)?{ruid:r}:r?r:{},this.readyState!==h.OPENED||C)throw new t.DOMException(t.DOMException.INVALID_STATE_ERR);if(i instanceof s)k.ruid=i.ruid,D=i.type||\"application/octet-stream\";else if(i instanceof c){if(i.hasBlob()){var o=i.getBlob();k.ruid=o.ruid,D=o.type||\"application/octet-stream\"}}else\"string\"==typeof i&&(O=\"UTF-8\",D=\"text/plain;charset=UTF-8\",i=n.utf8_encode(i));this.withCredentials||(this.withCredentials=k.required_caps&&k.required_caps.send_browser_cookies&&!B),L=!N&&this.upload.hasEventListener(),F=!1,M=!i,N||(C=!0),u.call(this,i)},abort:function(){if(F=!0,N=!1,~e.inArray(i(\"readyState\"),[h.UNSENT,h.OPENED,h.DONE]))i(\"readyState\",h.UNSENT);else{if(i(\"readyState\",h.DONE),C=!1,!_)throw new t.DOMException(t.DOMException.INVALID_STATE_ERR);_.getRuntime().exec.call(_,\"XMLHttpRequest\",\"abort\",M),M=!0}},destroy:function(){_&&(\"function\"===e.typeOf(_.destroy)&&_.destroy(),_=null),this.unbindAll(),this.upload&&(this.upload.unbindAll(),this.upload=null)}}),this.handleEventProps(p.concat([\"readystatechange\"])),this.upload.handleEventProps(p)}var f={100:\"Continue\",101:\"Switching Protocols\",102:\"Processing\",200:\"OK\",201:\"Created\",202:\"Accepted\",203:\"Non-Authoritative Information\",204:\"No Content\",205:\"Reset Content\",206:\"Partial Content\",207:\"Multi-Status\",226:\"IM Used\",300:\"Multiple Choices\",301:\"Moved Permanently\",302:\"Found\",303:\"See Other\",304:\"Not Modified\",305:\"Use Proxy\",306:\"Reserved\",307:\"Temporary Redirect\",400:\"Bad Request\",401:\"Unauthorized\",402:\"Payment Required\",403:\"Forbidden\",404:\"Not Found\",405:\"Method Not Allowed\",406:\"Not Acceptable\",407:\"Proxy Authentication Required\",408:\"Request Timeout\",409:\"Conflict\",410:\"Gone\",411:\"Length Required\",412:\"Precondition Failed\",413:\"Request Entity Too Large\",414:\"Request-URI Too Long\",415:\"Unsupported Media Type\",416:\"Requested Range Not Satisfiable\",417:\"Expectation Failed\",422:\"Unprocessable Entity\",423:\"Locked\",424:\"Failed Dependency\",426:\"Upgrade Required\",500:\"Internal Server Error\",501:\"Not Implemented\",502:\"Bad Gateway\",503:\"Service Unavailable\",504:\"Gateway Timeout\",505:\"HTTP Version Not Supported\",506:\"Variant Also Negotiates\",507:\"Insufficient Storage\",510:\"Not Extended\"};m.prototype=i.instance;var p=[\"loadstart\",\"progress\",\"abort\",\"error\",\"load\",\"timeout\",\"loadend\"];return h.UNSENT=0,h.OPENED=1,h.HEADERS_RECEIVED=2,h.LOADING=3,h.DONE=4,h.prototype=i.instance,h}),n(\"moxie/runtime/Transporter\",[\"moxie/core/utils/Basic\",\"moxie/core/utils/Encode\",\"moxie/runtime/RuntimeClient\",\"moxie/core/EventTarget\"],function(e,t,i,n){function r(){function n(){l=d=0,c=this.result=null}function o(t,i){var n=this;u=i,n.bind(\"TransportingProgress\",function(t){d=t.loaded,l>d&&-1===e.inArray(n.state,[r.IDLE,r.DONE])&&a.call(n)},999),n.bind(\"TransportingComplete\",function(){d=l,n.state=r.DONE,c=null,n.result=u.exec.call(n,\"Transporter\",\"getAsBlob\",t||\"\")},999),n.state=r.BUSY,n.trigger(\"TransportingStarted\"),a.call(n)}function a(){var e,i=this,n=l-d;m>n&&(m=n),e=t.btoa(c.substr(d,m)),u.exec.call(i,\"Transporter\",\"receive\",e,l)}var s,u,c,l,d,m;i.call(this),e.extend(this,{uid:e.guid(\"uid_\"),state:r.IDLE,result:null,transport:function(t,i,r){var a=this;if(r=e.extend({chunk_size:204798},r),(s=r.chunk_size%3)&&(r.chunk_size+=3-s),m=r.chunk_size,n.call(this),c=t,l=t.length,\"string\"===e.typeOf(r)||r.ruid)o.call(a,i,this.connectRuntime(r));else{var u=function(e,t){a.unbind(\"RuntimeInit\",u),o.call(a,i,t)};this.bind(\"RuntimeInit\",u),this.connectRuntime(r)}},abort:function(){var e=this;e.state=r.IDLE,u&&(u.exec.call(e,\"Transporter\",\"clear\"),e.trigger(\"TransportingAborted\")),n.call(e)},destroy:function(){this.unbindAll(),u=null,this.disconnectRuntime(),n.call(this)}})}return r.IDLE=0,r.BUSY=1,r.DONE=2,r.prototype=n.instance,r}),n(\"moxie/image/Image\",[\"moxie/core/utils/Basic\",\"moxie/core/utils/Dom\",\"moxie/core/Exceptions\",\"moxie/file/FileReaderSync\",\"moxie/xhr/XMLHttpRequest\",\"moxie/runtime/Runtime\",\"moxie/runtime/RuntimeClient\",\"moxie/runtime/Transporter\",\"moxie/core/utils/Env\",\"moxie/core/EventTarget\",\"moxie/file/Blob\",\"moxie/file/File\",\"moxie/core/utils/Encode\"],function(e,t,i,n,r,o,a,s,u,c,l,d,m){function h(){function n(e){try{return e||(e=this.exec(\"Image\",\"getInfo\")),this.size=e.size,this.width=e.width,this.height=e.height,this.type=e.type,this.meta=e.meta,\"\"===this.name&&(this.name=e.name),!0}catch(t){return this.trigger(\"error\",t.code),!1}}function c(t){var n=e.typeOf(t);try{if(t instanceof h){if(!t.size)throw new i.DOMException(i.DOMException.INVALID_STATE_ERR);p.apply(this,arguments)}else if(t instanceof l){if(!~e.inArray(t.type,[\"image/jpeg\",\"image/png\"]))throw new i.ImageError(i.ImageError.WRONG_FORMAT);g.apply(this,arguments)}else if(-1!==e.inArray(n,[\"blob\",\"file\"]))c.call(this,new d(null,t),arguments[1]);else if(\"string\"===n)\"data:\"===t.substr(0,5)?c.call(this,new l(null,{data:t}),arguments[1]):x.apply(this,arguments);else{if(\"node\"!==n||\"img\"!==t.nodeName.toLowerCase())throw new i.DOMException(i.DOMException.TYPE_MISMATCH_ERR);c.call(this,t.src,arguments[1])}}catch(r){this.trigger(\"error\",r.code)}}function p(t,i){var n=this.connectRuntime(t.ruid);this.ruid=n.uid,n.exec.call(this,\"Image\",\"loadFromImage\",t,\"undefined\"===e.typeOf(i)?!0:i)}function g(t,i){function n(e){r.ruid=e.uid,e.exec.call(r,\"Image\",\"loadFromBlob\",t)}var r=this;r.name=t.name||\"\",t.isDetached()?(this.bind(\"RuntimeInit\",function(e,t){n(t)}),i&&\"string\"==typeof i.required_caps&&(i.required_caps=o.parseCaps(i.required_caps)),this.connectRuntime(e.extend({required_caps:{access_image_binary:!0,resize_image:!0}},i))):n(this.connectRuntime(t.ruid))}function x(e,t){var i,n=this;i=new r,i.open(\"get\",e),i.responseType=\"blob\",i.onprogress=function(e){n.trigger(e)},i.onload=function(){g.call(n,i.response,!0)},i.onerror=function(e){n.trigger(e)},i.onloadend=function(){i.destroy()},i.bind(\"RuntimeError\",function(e,t){n.trigger(\"RuntimeError\",t)}),i.send(null,t)}a.call(this),e.extend(this,{uid:e.guid(\"uid_\"),ruid:null,name:\"\",size:0,width:0,height:0,type:\"\",meta:{},clone:function(){this.load.apply(this,arguments)},load:function(){c.apply(this,arguments)},resize:function(t){var n,r,o=this,a={x:0,y:0,width:o.width,height:o.height},s=e.extendIf({width:o.width,height:o.height,type:o.type||\"image/jpeg\",quality:90,crop:!1,fit:!0,preserveHeaders:!0,resample:\"default\",multipass:!0},t);try{if(!o.size)throw new i.DOMException(i.DOMException.INVALID_STATE_ERR);if(o.width>h.MAX_RESIZE_WIDTH||o.height>h.MAX_RESIZE_HEIGHT)throw new i.ImageError(i.ImageError.MAX_RESOLUTION_ERR);if(n=o.meta&&o.meta.tiff&&o.meta.tiff.Orientation||1,-1!==e.inArray(n,[5,6,7,8])){var u=s.width;s.width=s.height,s.height=u}if(s.crop){switch(r=Math.max(s.width/o.width,s.height/o.height),t.fit?(a.width=Math.min(Math.ceil(s.width/r),o.width),a.height=Math.min(Math.ceil(s.height/r),o.height),r=s.width/a.width):(a.width=Math.min(s.width,o.width),a.height=Math.min(s.height,o.height),r=1),\"boolean\"==typeof s.crop&&(s.crop=\"cc\"),s.crop.toLowerCase().replace(/_/,\"-\")){case\"rb\":case\"right-bottom\":a.x=o.width-a.width,a.y=o.height-a.height;break;case\"cb\":case\"center-bottom\":a.x=Math.floor((o.width-a.width)/2),a.y=o.height-a.height;break;case\"lb\":case\"left-bottom\":a.x=0,a.y=o.height-a.height;break;case\"lt\":case\"left-top\":a.x=0,a.y=0;break;case\"ct\":case\"center-top\":a.x=Math.floor((o.width-a.width)/2),a.y=0;break;case\"rt\":case\"right-top\":a.x=o.width-a.width,a.y=0;break;case\"rc\":case\"right-center\":case\"right-middle\":a.x=o.width-a.width,a.y=Math.floor((o.height-a.height)/2);break;case\"lc\":case\"left-center\":case\"left-middle\":a.x=0,a.y=Math.floor((o.height-a.height)/2);break;case\"cc\":case\"center-center\":case\"center-middle\":default:a.x=Math.floor((o.width-a.width)/2),a.y=Math.floor((o.height-a.height)/2)}a.x=Math.max(a.x,0),a.y=Math.max(a.y,0)}else r=Math.min(s.width/o.width,s.height/o.height),r>1&&!s.fit&&(r=1);this.exec(\"Image\",\"resize\",a,r,s)}catch(c){o.trigger(\"error\",c.code)}},downsize:function(t){var i,n={width:this.width,height:this.height,type:this.type||\"image/jpeg\",quality:90,crop:!1,fit:!1,preserveHeaders:!0,resample:\"default\"};i=\"object\"==typeof t?e.extend(n,t):e.extend(n,{width:arguments[0],height:arguments[1],crop:arguments[2],preserveHeaders:arguments[3]}),this.resize(i)},crop:function(e,t,i){this.downsize(e,t,!0,i)},getAsCanvas:function(){if(!u.can(\"create_canvas\"))throw new i.RuntimeError(i.RuntimeError.NOT_SUPPORTED_ERR);return this.exec(\"Image\",\"getAsCanvas\")},getAsBlob:function(e,t){if(!this.size)throw new i.DOMException(i.DOMException.INVALID_STATE_ERR);return this.exec(\"Image\",\"getAsBlob\",e||\"image/jpeg\",t||90)},getAsDataURL:function(e,t){if(!this.size)throw new i.DOMException(i.DOMException.INVALID_STATE_ERR);return this.exec(\"Image\",\"getAsDataURL\",e||\"image/jpeg\",t||90)},getAsBinaryString:function(e,t){var i=this.getAsDataURL(e,t);return m.atob(i.substring(i.indexOf(\"base64,\")+7))},embed:function(n,r){function o(t,r){var o=this;if(u.can(\"create_canvas\")){var l=o.getAsCanvas();if(l)return n.appendChild(l),l=null,o.destroy(),c.trigger(\"embedded\"),void 0}var d=o.getAsDataURL(t,r);if(!d)throw new i.ImageError(i.ImageError.WRONG_FORMAT);if(u.can(\"use_data_uri_of\",d.length))n.innerHTML='',o.destroy(),c.trigger(\"embedded\");else{var h=new s;h.bind(\"TransportingComplete\",function(){a=c.connectRuntime(this.result.ruid),c.bind(\"Embedded\",function(){e.extend(a.getShimContainer().style,{top:\"0px\",left:\"0px\",width:o.width+\"px\",height:o.height+\"px\"}),a=null},999),a.exec.call(c,\"ImageView\",\"display\",this.result.uid,width,height),o.destroy()}),h.transport(m.atob(d.substring(d.indexOf(\"base64,\")+7)),t,{required_caps:{display_media:!0},runtime_order:\"flash,silverlight\",container:n})}}var a,c=this,l=e.extend({width:this.width,height:this.height,type:this.type||\"image/jpeg\",quality:90,fit:!0,resample:\"nearest\"},r);try{if(!(n=t.get(n)))throw new i.DOMException(i.DOMException.INVALID_NODE_TYPE_ERR);if(!this.size)throw new i.DOMException(i.DOMException.INVALID_STATE_ERR);this.width>h.MAX_RESIZE_WIDTH||this.height>h.MAX_RESIZE_HEIGHT;var d=new h;return d.bind(\"Resize\",function(){o.call(this,l.type,l.quality)}),d.bind(\"Load\",function(){this.downsize(l)}),this.meta.thumb&&this.meta.thumb.width>=l.width&&this.meta.thumb.height>=l.height?d.load(this.meta.thumb.data):d.clone(this,!1),d}catch(f){this.trigger(\"error\",f.code)}},destroy:function(){this.ruid&&(this.getRuntime().exec.call(this,\"Image\",\"destroy\"),this.disconnectRuntime()),this.meta&&this.meta.thumb&&this.meta.thumb.data.destroy(),this.unbindAll()}}),this.handleEventProps(f),this.bind(\"Load Resize\",function(){return n.call(this)},999)}var f=[\"progress\",\"load\",\"error\",\"resize\",\"embedded\"];return h.MAX_RESIZE_WIDTH=8192,h.MAX_RESIZE_HEIGHT=8192,h.prototype=c.instance,h}),n(\"moxie/runtime/html5/Runtime\",[\"moxie/core/utils/Basic\",\"moxie/core/Exceptions\",\"moxie/runtime/Runtime\",\"moxie/core/utils/Env\"],function(e,t,i,n){function o(t){var o=this,u=i.capTest,c=i.capTrue,l=e.extend({access_binary:u(window.FileReader||window.File&&window.File.getAsDataURL),access_image_binary:function(){return o.can(\"access_binary\")&&!!s.Image},display_media:u((n.can(\"create_canvas\")||n.can(\"use_data_uri_over32kb\"))&&r(\"moxie/image/Image\")),do_cors:u(window.XMLHttpRequest&&\"withCredentials\"in new XMLHttpRequest),drag_and_drop:u(function(){var e=document.createElement(\"div\");return(\"draggable\"in e||\"ondragstart\"in e&&\"ondrop\"in e)&&(\"IE\"!==n.browser||n.verComp(n.version,9,\">\"))}()),filter_by_extension:u(function(){return!(\"Chrome\"===n.browser&&n.verComp(n.version,28,\"<\")||\"IE\"===n.browser&&n.verComp(n.version,10,\"<\")||\"Safari\"===n.browser&&n.verComp(n.version,7,\"<\")||\"Firefox\"===n.browser&&n.verComp(n.version,37,\"<\"))}()),return_response_headers:c,return_response_type:function(e){return\"json\"===e&&window.JSON?!0:n.can(\"return_response_type\",e)},return_status_code:c,report_upload_progress:u(window.XMLHttpRequest&&(new XMLHttpRequest).upload),resize_image:function(){return o.can(\"access_binary\")&&n.can(\"create_canvas\")},select_file:function(){return n.can(\"use_fileinput\")&&window.File},select_folder:function(){return o.can(\"select_file\")&&(\"Chrome\"===n.browser&&n.verComp(n.version,21,\">=\")||\"Firefox\"===n.browser&&n.verComp(n.version,42,\">=\"))},select_multiple:function(){return!(!o.can(\"select_file\")||\"Safari\"===n.browser&&\"Windows\"===n.os||\"iOS\"===n.os&&n.verComp(n.osVersion,\"7.0.0\",\">\")&&n.verComp(n.osVersion,\"8.0.0\",\"<\"))},send_binary_string:u(window.XMLHttpRequest&&((new XMLHttpRequest).sendAsBinary||window.Uint8Array&&window.ArrayBuffer)),send_custom_headers:u(window.XMLHttpRequest),send_multipart:function(){return!!(window.XMLHttpRequest&&(new XMLHttpRequest).upload&&window.FormData)||o.can(\"send_binary_string\")},slice_blob:u(window.File&&(File.prototype.mozSlice||File.prototype.webkitSlice||File.prototype.slice)),stream_upload:function(){return o.can(\"slice_blob\")&&o.can(\"send_multipart\")},summon_file_dialog:function(){return o.can(\"select_file\")&&!(\"Firefox\"===n.browser&&n.verComp(n.version,4,\"<\")||\"Opera\"===n.browser&&n.verComp(n.version,12,\"<\")||\"IE\"===n.browser&&n.verComp(n.version,10,\"<\"))},upload_filesize:c,use_http_method:c},arguments[2]);i.call(this,t,arguments[1]||a,l),e.extend(this,{init:function(){this.trigger(\"Init\")},destroy:function(e){return function(){e.call(o),e=o=null}}(this.destroy)}),e.extend(this.getShim(),s)}var a=\"html5\",s={};return i.addConstructor(a,o),s}),n(\"moxie/runtime/html5/file/Blob\",[\"moxie/runtime/html5/Runtime\",\"moxie/file/Blob\"],function(e,t){function i(){function e(e,t,i){var n;if(!window.File.prototype.slice)return(n=window.File.prototype.webkitSlice||window.File.prototype.mozSlice)?n.call(e,t,i):null;try{return e.slice(),e.slice(t,i)}catch(r){return e.slice(t,i-t)}}this.slice=function(){return new t(this.getRuntime().uid,e.apply(this,arguments))},this.destroy=function(){this.getRuntime().getShim().removeInstance(this.uid)}}return e.Blob=i}),n(\"moxie/core/utils/Events\",[\"moxie/core/utils/Basic\"],function(e){function t(){this.returnValue=!1}function i(){this.cancelBubble=!0}var n={},r=\"moxie_\"+e.guid(),o=function(o,a,s,u){var c,l;a=a.toLowerCase(),o.addEventListener?(c=s,o.addEventListener(a,c,!1)):o.attachEvent&&(c=function(){var e=window.event;e.target||(e.target=e.srcElement),e.preventDefault=t,e.stopPropagation=i,s(e)},o.attachEvent(\"on\"+a,c)),o[r]||(o[r]=e.guid()),n.hasOwnProperty(o[r])||(n[o[r]]={}),l=n[o[r]],l.hasOwnProperty(a)||(l[a]=[]),l[a].push({func:c,orig:s,key:u})},a=function(t,i,o){var a,s;if(i=i.toLowerCase(),t[r]&&n[t[r]]&&n[t[r]][i]){a=n[t[r]][i];for(var u=a.length-1;u>=0&&(a[u].orig!==o&&a[u].key!==o||(t.removeEventListener?t.removeEventListener(i,a[u].func,!1):t.detachEvent&&t.detachEvent(\"on\"+i,a[u].func),a[u].orig=null,a[u].func=null,a.splice(u,1),o===s));u--);if(a.length||delete n[t[r]][i],e.isEmptyObj(n[t[r]])){delete n[t[r]];try{delete t[r]}catch(c){t[r]=s}}}},s=function(t,i){t&&t[r]&&e.each(n[t[r]],function(e,n){a(t,n,i)})};return{addEvent:o,removeEvent:a,removeAllEvents:s}}),n(\"moxie/runtime/html5/file/FileInput\",[\"moxie/runtime/html5/Runtime\",\"moxie/file/File\",\"moxie/core/utils/Basic\",\"moxie/core/utils/Dom\",\"moxie/core/utils/Events\",\"moxie/core/utils/Mime\",\"moxie/core/utils/Env\"],function(e,t,i,n,r,o,a){function s(){var e,s;i.extend(this,{init:function(u){var c,l,d,m,h,f,p=this,g=p.getRuntime();e=u,d=o.extList2mimes(e.accept,g.can(\"filter_by_extension\")),l=g.getShimContainer(),l.innerHTML='\",c=n.get(g.uid),i.extend(c.style,{position:\"absolute\",top:0,left:0,width:\"100%\",height:\"100%\"}),m=n.get(e.browse_button),s=n.getStyle(m,\"z-index\")||\"auto\",g.can(\"summon_file_dialog\")&&(\"static\"===n.getStyle(m,\"position\")&&(m.style.position=\"relative\"),r.addEvent(m,\"click\",function(e){var t=n.get(g.uid);t&&!t.disabled&&t.click(),e.preventDefault()},p.uid),p.bind(\"Refresh\",function(){h=parseInt(s,10)||1,n.get(e.browse_button).style.zIndex=h,this.getRuntime().getShimContainer().style.zIndex=h-1})),f=g.can(\"summon_file_dialog\")?m:l,r.addEvent(f,\"mouseover\",function(){p.trigger(\"mouseenter\")},p.uid),r.addEvent(f,\"mouseout\",function(){p.trigger(\"mouseleave\")},p.uid),r.addEvent(f,\"mousedown\",function(){p.trigger(\"mousedown\")},p.uid),r.addEvent(n.get(e.container),\"mouseup\",function(){p.trigger(\"mouseup\")},p.uid),(g.can(\"summon_file_dialog\")?c:m).setAttribute(\"tabindex\",-1),c.onchange=function x(){if(p.files=[],i.each(this.files,function(i){var n=\"\";return e.directory&&\".\"==i.name?!0:(i.webkitRelativePath&&(n=\"/\"+i.webkitRelativePath.replace(/^\\//,\"\")),i=new t(g.uid,i),i.relativePath=n,p.files.push(i),void 0)}),\"IE\"!==a.browser&&\"IEMobile\"!==a.browser)this.value=\"\";else{var n=this.cloneNode(!0);this.parentNode.replaceChild(n,this),n.onchange=x}p.files.length&&p.trigger(\"change\")},p.trigger({type:\"ready\",async:!0}),l=null},setOption:function(e,t){var i=this.getRuntime(),r=n.get(i.uid);switch(e){case\"accept\":if(t){var a=t.mimes||o.extList2mimes(t,i.can(\"filter_by_extension\"));r.setAttribute(\"accept\",a.join(\",\"))}else r.removeAttribute(\"accept\");break;case\"directory\":t&&i.can(\"select_folder\")?(r.setAttribute(\"directory\",\"\"),r.setAttribute(\"webkitdirectory\",\"\")):(r.removeAttribute(\"directory\"),r.removeAttribute(\"webkitdirectory\"));break;case\"multiple\":t&&i.can(\"select_multiple\")?r.setAttribute(\"multiple\",\"\"):r.removeAttribute(\"multiple\")}},disable:function(e){var t,i=this.getRuntime();(t=n.get(i.uid))&&(t.disabled=!!e)},destroy:function(){var t=this.getRuntime(),i=t.getShim(),o=t.getShimContainer(),a=e&&n.get(e.container),u=e&&n.get(e.browse_button);a&&r.removeAllEvents(a,this.uid),u&&(r.removeAllEvents(u,this.uid),u.style.zIndex=s),o&&(r.removeAllEvents(o,this.uid),o.innerHTML=\"\"),i.removeInstance(this.uid),e=o=a=u=i=null}})}return e.FileInput=s}),n(\"moxie/runtime/html5/file/FileDrop\",[\"moxie/runtime/html5/Runtime\",\"moxie/file/File\",\"moxie/core/utils/Basic\",\"moxie/core/utils/Dom\",\"moxie/core/utils/Events\",\"moxie/core/utils/Mime\"],function(e,t,i,n,r,o){function a(){function e(e){if(!e.dataTransfer||!e.dataTransfer.types)return!1;var t=i.toArray(e.dataTransfer.types||[]);return-1!==i.inArray(\"Files\",t)||-1!==i.inArray(\"public.file-url\",t)||-1!==i.inArray(\"application/x-moz-file\",t)}function a(e,i){if(u(e)){var n=new t(f,e);n.relativePath=i||\"\",p.push(n)}}function s(e){for(var t=[],n=0;n=\")&&u.verComp(u.version,7,\"<\"),f=\"Android Browser\"===u.browser,p=!1;if(h=i.url.replace(/^.+?\\/([\\w\\-\\.]+)$/,\"$1\").toLowerCase(),m=c(),m.open(i.method,i.url,i.async,i.user,i.password),r instanceof o)r.isDetached()&&(p=!0),r=r.getSource();else if(r instanceof a){if(r.hasBlob())if(r.getBlob().isDetached())r=d.call(s,r),p=!0;else if((l||f)&&\"blob\"===t.typeOf(r.getBlob().getSource())&&window.FileReader)return e.call(s,i,r),void 0;if(r instanceof a){var g=new window.FormData;r.each(function(e,t){e instanceof o?g.append(t,e.getSource()):g.append(t,e)}),r=g}}m.upload?(i.withCredentials&&(m.withCredentials=!0),m.addEventListener(\"load\",function(e){s.trigger(e)}),m.addEventListener(\"error\",function(e){s.trigger(e)}),m.addEventListener(\"progress\",function(e){s.trigger(e)}),m.upload.addEventListener(\"progress\",function(e){s.trigger({type:\"UploadProgress\",loaded:e.loaded,total:e.total})})):m.onreadystatechange=function(){switch(m.readyState){case 1:break;case 2:break;case 3:var e,t;try{n.hasSameOrigin(i.url)&&(e=m.getResponseHeader(\"Content-Length\")||0),m.responseText&&(t=m.responseText.length)}catch(r){e=t=0}s.trigger({type:\"progress\",lengthComputable:!!e,total:parseInt(e,10),loaded:t});break;case 4:m.onreadystatechange=function(){};try{if(m.status>=200&&m.status<400){s.trigger(\"load\");break}}catch(r){}s.trigger(\"error\")}},t.isEmptyObj(i.headers)||t.each(i.headers,function(e,t){m.setRequestHeader(t,e)}),\"\"!==i.responseType&&\"responseType\"in m&&(m.responseType=\"json\"!==i.responseType||u.can(\"return_response_type\",\"json\")?i.responseType:\"text\"),p?m.sendAsBinary?m.sendAsBinary(r):function(){for(var e=new Uint8Array(r.length),t=0;t0&&o.set(new Uint8Array(t.slice(0,e)),0),o.set(new Uint8Array(r),e),o.set(new Uint8Array(t.slice(e+n)),e+r.byteLength),this.clear(),t=o.buffer,i=new DataView(t);break}default:return t}},length:function(){return t?t.byteLength:0},clear:function(){i=t=null}})}function n(t){function i(e,i,n){n=3===arguments.length?n:t.length-i-1,t=t.substr(0,i)+e+t.substr(n+i)}e.extend(this,{readByteAt:function(e){return t.charCodeAt(e)},writeByteAt:function(e,t){i(String.fromCharCode(t),e,1)},SEGMENT:function(e,n,r){switch(arguments.length){case 1:return t.substr(e);case 2:return t.substr(e,n);case 3:i(null!==r?r:\"\",e,n);break;default:return t}},length:function(){return t?t.length:0},clear:function(){t=null}})}return e.extend(t.prototype,{littleEndian:!1,read:function(e,t){var i,n,r;if(e+t>this.length())throw new Error(\"You are trying to read outside the source boundaries.\");for(n=this.littleEndian?0:-8*(t-1),r=0,i=0;t>r;r++)i|=this.readByteAt(e+r)<this.length())throw new Error(\"You are trying to write outside the source boundaries.\");for(n=this.littleEndian?0:-8*(i-1),r=0;i>r;r++)this.writeByteAt(e+r,255&t>>Math.abs(n+8*r))},BYTE:function(e){return this.read(e,1)},SHORT:function(e){return this.read(e,2)},LONG:function(e){return this.read(e,4)},SLONG:function(e){var t=this.read(e,4);return t>2147483647?t-4294967296:t},CHAR:function(e){return String.fromCharCode(this.read(e,1))},STRING:function(e,t){return this.asArray(\"CHAR\",e,t).join(\"\")},asArray:function(e,t,i){for(var n=[],r=0;i>r;r++)n[r]=this[e](t+r);return n}}),t}),n(\"moxie/runtime/html5/image/JPEGHeaders\",[\"moxie/runtime/html5/utils/BinaryReader\",\"moxie/core/Exceptions\"],function(e,t){return function i(n){var r,o,a,s=[],u=0;if(r=new e(n),65496!==r.SHORT(0))throw r.clear(),new t.ImageError(t.ImageError.WRONG_FORMAT);for(o=2;o<=r.length();)if(a=r.SHORT(o),a>=65488&&65495>=a)o+=2;else{if(65498===a||65497===a)break;u=r.SHORT(o+2)+2,a>=65505&&65519>=a&&s.push({hex:a,name:\"APP\"+(15&a),start:o,length:u,segment:r.SEGMENT(o,u)}),o+=u}return r.clear(),{headers:s,restore:function(t){var i,n,r;for(r=new e(t),o=65504==r.SHORT(2)?4+r.SHORT(4):2,n=0,i=s.length;i>n;n++)r.SEGMENT(o,0,s[n].segment),o+=s[n].length;return t=r.SEGMENT(),r.clear(),t},strip:function(t){var n,r,o,a;for(o=new i(t),r=o.headers,o.purge(),n=new e(t),a=r.length;a--;)n.SEGMENT(r[a].start,r[a].length,\"\");return t=n.SEGMENT(),n.clear(),t},get:function(e){for(var t=[],i=0,n=s.length;n>i;i++)s[i].name===e.toUpperCase()&&t.push(s[i].segment);return t},set:function(e,t){var i,n,r,o=[];for(\"string\"==typeof t?o.push(t):o=t,i=n=0,r=s.length;r>i&&(s[i].name===e.toUpperCase()&&(s[i].segment=o[n],s[i].length=o[n].length,n++),!(n>=o.length));i++);},purge:function(){this.headers=s=[]}}}}),n(\"moxie/runtime/html5/image/ExifParser\",[\"moxie/core/utils/Basic\",\"moxie/runtime/html5/utils/BinaryReader\",\"moxie/core/Exceptions\"],function(e,i,n){function r(o){function a(i,r){var o,a,s,u,c,m,h,f,p=this,g=[],x={},v={1:\"BYTE\",7:\"UNDEFINED\",2:\"ASCII\",3:\"SHORT\",4:\"LONG\",5:\"RATIONAL\",9:\"SLONG\",10:\"SRATIONAL\"},w={BYTE:1,UNDEFINED:1,ASCII:1,SHORT:2,LONG:4,RATIONAL:8,SLONG:4,SRATIONAL:8};for(o=p.SHORT(i),a=0;o>a;a++)if(g=[],h=i+2+12*a,s=r[p.SHORT(h)],s!==t){if(u=v[p.SHORT(h+=2)],c=p.LONG(h+=2),m=w[u],!m)throw new n.ImageError(n.ImageError.INVALID_META_ERR);if(h+=4,m*c>4&&(h=p.LONG(h)+d.tiffHeader),h+m*c>=this.length())throw new n.ImageError(n.ImageError.INVALID_META_ERR);\"ASCII\"!==u?(g=p.asArray(u,h,c),f=1==c?g[0]:g,x[s]=l.hasOwnProperty(s)&&\"object\"!=typeof f?l[s][f]:f):x[s]=e.trim(p.STRING(h,c).replace(/\\0$/,\"\"))}return x}function s(e,t,i){var n,r,o,a=0;if(\"string\"==typeof t){var s=c[e.toLowerCase()];for(var u in s)if(s[u]===t){t=u;break}}n=d[e.toLowerCase()+\"IFD\"],r=this.SHORT(n);for(var l=0;r>l;l++)if(o=n+12*l+2,this.SHORT(o)==t){a=o+8;break}if(!a)return!1;try{this.write(a,i,4)}catch(m){return!1}return!0}var u,c,l,d,m,h;if(i.call(this,o),c={tiff:{274:\"Orientation\",270:\"ImageDescription\",271:\"Make\",272:\"Model\",305:\"Software\",34665:\"ExifIFDPointer\",34853:\"GPSInfoIFDPointer\"},exif:{36864:\"ExifVersion\",40961:\"ColorSpace\",40962:\"PixelXDimension\",40963:\"PixelYDimension\",36867:\"DateTimeOriginal\",33434:\"ExposureTime\",33437:\"FNumber\",34855:\"ISOSpeedRatings\",37377:\"ShutterSpeedValue\",37378:\"ApertureValue\",37383:\"MeteringMode\",37384:\"LightSource\",37385:\"Flash\",37386:\"FocalLength\",41986:\"ExposureMode\",41987:\"WhiteBalance\",41990:\"SceneCaptureType\",41988:\"DigitalZoomRatio\",41992:\"Contrast\",41993:\"Saturation\",41994:\"Sharpness\"},gps:{0:\"GPSVersionID\",1:\"GPSLatitudeRef\",2:\"GPSLatitude\",3:\"GPSLongitudeRef\",4:\"GPSLongitude\"},thumb:{513:\"JPEGInterchangeFormat\",514:\"JPEGInterchangeFormatLength\"}},l={ColorSpace:{1:\"sRGB\",0:\"Uncalibrated\"},MeteringMode:{0:\"Unknown\",1:\"Average\",2:\"CenterWeightedAverage\",3:\"Spot\",4:\"MultiSpot\",5:\"Pattern\",6:\"Partial\",255:\"Other\"},LightSource:{1:\"Daylight\",2:\"Fliorescent\",3:\"Tungsten\",4:\"Flash\",9:\"Fine weather\",10:\"Cloudy weather\",11:\"Shade\",12:\"Daylight fluorescent (D 5700 - 7100K)\",13:\"Day white fluorescent (N 4600 -5400K)\",14:\"Cool white fluorescent (W 3900 - 4500K)\",15:\"White fluorescent (WW 3200 - 3700K)\",17:\"Standard light A\",18:\"Standard light B\",19:\"Standard light C\",20:\"D55\",21:\"D65\",22:\"D75\",23:\"D50\",24:\"ISO studio tungsten\",255:\"Other\"},Flash:{0:\"Flash did not fire\",1:\"Flash fired\",5:\"Strobe return light not detected\",7:\"Strobe return light detected\",9:\"Flash fired, compulsory flash mode\",13:\"Flash fired, compulsory flash mode, return light not detected\",15:\"Flash fired, compulsory flash mode, return light detected\",16:\"Flash did not fire, compulsory flash mode\",24:\"Flash did not fire, auto mode\",25:\"Flash fired, auto mode\",29:\"Flash fired, auto mode, return light not detected\",31:\"Flash fired, auto mode, return light detected\",32:\"No flash function\",65:\"Flash fired, red-eye reduction mode\",69:\"Flash fired, red-eye reduction mode, return light not detected\",71:\"Flash fired, red-eye reduction mode, return light detected\",73:\"Flash fired, compulsory flash mode, red-eye reduction mode\",77:\"Flash fired, compulsory flash mode, red-eye reduction mode, return light not detected\",79:\"Flash fired, compulsory flash mode, red-eye reduction mode, return light detected\",89:\"Flash fired, auto mode, red-eye reduction mode\",93:\"Flash fired, auto mode, return light not detected, red-eye reduction mode\",95:\"Flash fired, auto mode, return light detected, red-eye reduction mode\"},ExposureMode:{0:\"Auto exposure\",1:\"Manual exposure\",2:\"Auto bracket\"},WhiteBalance:{0:\"Auto white balance\",1:\"Manual white balance\"},SceneCaptureType:{0:\"Standard\",1:\"Landscape\",2:\"Portrait\",3:\"Night scene\"},Contrast:{0:\"Normal\",1:\"Soft\",2:\"Hard\"},Saturation:{0:\"Normal\",1:\"Low saturation\",2:\"High saturation\"},Sharpness:{0:\"Normal\",1:\"Soft\",2:\"Hard\"},GPSLatitudeRef:{N:\"North latitude\",S:\"South latitude\"},GPSLongitudeRef:{E:\"East longitude\",W:\"West longitude\"}},d={tiffHeader:10},m=d.tiffHeader,u={clear:this.clear},e.extend(this,{read:function(){try{return r.prototype.read.apply(this,arguments)}catch(e){throw new n.ImageError(n.ImageError.INVALID_META_ERR)}},write:function(){try{return r.prototype.write.apply(this,arguments)}catch(e){throw new n.ImageError(n.ImageError.INVALID_META_ERR)}},UNDEFINED:function(){return this.BYTE.apply(this,arguments)},RATIONAL:function(e){return this.LONG(e)/this.LONG(e+4)},SRATIONAL:function(e){return this.SLONG(e)/this.SLONG(e+4)},ASCII:function(e){return this.CHAR(e)},TIFF:function(){return h||null},EXIF:function(){var t=null;if(d.exifIFD){try{t=a.call(this,d.exifIFD,c.exif)}catch(i){return null}if(t.ExifVersion&&\"array\"===e.typeOf(t.ExifVersion)){for(var n=0,r=\"\";n=65472&&65475>=t)return n+=5,{height:e.SHORT(n),width:e.SHORT(n+=2)};i=e.SHORT(n+=2),n+=i-2}return null}function s(){var e,t,i=d.thumb();return i&&(e=new n(i),t=a(e),e.clear(),t)?(t.data=i,t):null}function u(){d&&l&&c&&(d.clear(),l.purge(),c.clear(),m=l=d=c=null)}var c,l,d,m;if(c=new n(o),65496!==c.SHORT(0))throw new t.ImageError(t.ImageError.WRONG_FORMAT);l=new i(o);try{d=new r(l.get(\"app1\")[0])}catch(h){}m=a.call(this),e.extend(this,{type:\"image/jpeg\",size:c.length(),width:m&&m.width||0,height:m&&m.height||0,setExif:function(t,i){return d?(\"object\"===e.typeOf(t)?e.each(t,function(e,t){d.setExif(t,e)}):d.setExif(t,i),l.set(\"app1\",d.SEGMENT()),void 0):!1},writeHeaders:function(){return arguments.length?l.restore(arguments[0]):l.restore(o)},stripHeaders:function(e){return l.strip(e)},purge:function(){u.call(this)}}),d&&(this.meta={tiff:d.TIFF(),exif:d.EXIF(),gps:d.GPS(),thumb:s()})}return o}),n(\"moxie/runtime/html5/image/PNG\",[\"moxie/core/Exceptions\",\"moxie/core/utils/Basic\",\"moxie/runtime/html5/utils/BinaryReader\"],function(e,t,i){function n(n){function r(){var e,t;return e=a.call(this,8),\"IHDR\"==e.type?(t=e.start,{width:s.LONG(t),height:s.LONG(t+=4)}):null}function o(){s&&(s.clear(),n=l=u=c=s=null)}function a(e){var t,i,n,r;return t=s.LONG(e),i=s.STRING(e+=4,4),n=e+=4,r=s.LONG(e+t),{length:t,type:i,start:n,CRC:r}}var s,u,c,l;s=new i(n),function(){var t=0,i=0,n=[35152,20039,3338,6666];for(i=0;ii.height?\"width\":\"height\",a=Math.round(i[o]*n),s=!1;\"nearest\"!==r&&(.5>n||n>2)&&(n=.5>n?.5:2,s=!0);var u=t(i,n);return s?e(u,a/u[o],r):u}function t(e,t){var i=e.width,n=e.height,r=Math.round(i*t),o=Math.round(n*t),a=document.createElement(\"canvas\");return a.width=r,a.height=o,a.getContext(\"2d\").drawImage(e,0,0,i,n,0,0,r,o),e=null,a}return{scale:e}}),n(\"moxie/runtime/html5/image/Image\",[\"moxie/runtime/html5/Runtime\",\"moxie/core/utils/Basic\",\"moxie/core/Exceptions\",\"moxie/core/utils/Encode\",\"moxie/file/Blob\",\"moxie/file/File\",\"moxie/runtime/html5/image/ImageInfo\",\"moxie/runtime/html5/image/ResizerCanvas\",\"moxie/core/utils/Mime\",\"moxie/core/utils/Env\"],function(e,t,i,n,r,o,a,s,u){function c(){function e(){if(!v&&!g)throw new i.ImageError(i.DOMException.INVALID_STATE_ERR);return v||g}function c(){var t=e();return\"canvas\"==t.nodeName.toLowerCase()?t:(v=document.createElement(\"canvas\"),v.width=t.width,v.height=t.height,v.getContext(\"2d\").drawImage(t,0,0),v)}function l(e){return n.atob(e.substring(e.indexOf(\"base64,\")+7))}function d(e,t){return\"data:\"+(t||\"\")+\";base64,\"+n.btoa(e)}function m(e){var t=this;g=new Image,g.onerror=function(){p.call(this),t.trigger(\"error\",i.ImageError.WRONG_FORMAT)},g.onload=function(){t.trigger(\"load\")},g.src=\"data:\"==e.substr(0,5)?e:d(e,y.type)}function h(e,t){var n,r=this;return window.FileReader?(n=new FileReader,n.onload=function(){t.call(r,this.result)},n.onerror=function(){r.trigger(\"error\",i.ImageError.WRONG_FORMAT)},n.readAsDataURL(e),void 0):t.call(this,e.getAsDataURL())}function f(e,i){var n=Math.PI/180,r=document.createElement(\"canvas\"),o=r.getContext(\"2d\"),a=e.width,s=e.height;switch(t.inArray(i,[5,6,7,8])>-1?(r.width=s,r.height=a):(r.width=a,r.height=s),i){case 2:o.translate(a,0),o.scale(-1,1);break;case 3:o.translate(a,s),o.rotate(180*n);break;case 4:o.translate(0,s),o.scale(1,-1);break;case 5:o.rotate(90*n),o.scale(1,-1);break;case 6:o.rotate(90*n),o.translate(0,-s);break;case 7:o.rotate(90*n),o.translate(a,-s),o.scale(-1,1);break;case 8:o.rotate(-90*n),o.translate(-a,0)}return o.drawImage(e,0,0,a,s),r}function p(){x&&(x.purge(),x=null),w=g=v=y=null,b=!1}var g,x,v,w,y,E=this,b=!1,_=!0;t.extend(this,{loadFromBlob:function(e){var t=this.getRuntime(),n=arguments.length>1?arguments[1]:!0;if(!t.can(\"access_binary\"))throw new i.RuntimeError(i.RuntimeError.NOT_SUPPORTED_ERR);return y=e,e.isDetached()?(w=e.getSource(),m.call(this,w),void 0):(h.call(this,e.getSource(),function(e){n&&(w=l(e)),m.call(this,e)}),void 0)},loadFromImage:function(e,t){this.meta=e.meta,y=new o(null,{name:e.name,size:e.size,type:e.type}),m.call(this,t?w=e.getAsBinaryString():e.getAsDataURL())},getInfo:function(){var t,i=this.getRuntime();return!x&&w&&i.can(\"access_image_binary\")&&(x=new a(w)),t={width:e().width||0,height:e().height||0,type:y.type||u.getFileMime(y.name),size:w&&w.length||y.size||0,name:y.name||\"\",meta:null},_&&(t.meta=x&&x.meta||this.meta||{},!t.meta||!t.meta.thumb||t.meta.thumb.data instanceof r||(t.meta.thumb.data=new r(null,{type:\"image/jpeg\",data:t.meta.thumb.data}))),t},resize:function(t,i,n){var r=document.createElement(\"canvas\");if(r.width=t.width,r.height=t.height,r.getContext(\"2d\").drawImage(e(),t.x,t.y,t.width,t.height,0,0,r.width,r.height),v=s.scale(r,i),_=n.preserveHeaders,!_){var o=this.meta&&this.meta.tiff&&this.meta.tiff.Orientation||1;v=f(v,o)}this.width=v.width,this.height=v.height,b=!0,this.trigger(\"Resize\")},getAsCanvas:function(){return v||(v=c()),v.id=this.uid+\"_canvas\",v},getAsBlob:function(e,t){return e!==this.type?(b=!0,new o(null,{name:y.name||\"\",type:e,data:E.getAsDataURL(e,t)})):new o(null,{name:y.name||\"\",type:e,data:E.getAsBinaryString(e,t)})},getAsDataURL:function(e){var t=arguments[1]||90;if(!b)return g.src;if(c(),\"image/jpeg\"!==e)return v.toDataURL(\"image/png\");try{return v.toDataURL(\"image/jpeg\",t/100)}catch(i){return v.toDataURL(\"image/jpeg\")}},getAsBinaryString:function(e,t){if(!b)return w||(w=l(E.getAsDataURL(e,t))),w;if(\"image/jpeg\"!==e)w=l(E.getAsDataURL(e,t));else{var i;t||(t=90),c();try{i=v.toDataURL(\"image/jpeg\",t/100)}catch(n){i=v.toDataURL(\"image/jpeg\")}w=l(i),x&&(w=x.stripHeaders(w),_&&(x.meta&&x.meta.exif&&x.setExif({PixelXDimension:this.width,PixelYDimension:this.height}),w=x.writeHeaders(w)),x.purge(),x=null)}return b=!1,w},destroy:function(){E=null,p.call(this),this.getRuntime().getShim().removeInstance(this.uid)}})}return e.Image=c}),n(\"moxie/runtime/flash/Runtime\",[\"moxie/core/utils/Basic\",\"moxie/core/utils/Env\",\"moxie/core/utils/Dom\",\"moxie/core/Exceptions\",\"moxie/runtime/Runtime\"],function(e,t,i,n,o){function a(){var e;try{e=navigator.plugins[\"Shockwave Flash\"],e=e.description}catch(t){try{e=new ActiveXObject(\"ShockwaveFlash.ShockwaveFlash\").GetVariable(\"$version\")}catch(i){e=\"0.0\"}}return e=e.match(/\\d+/g),parseFloat(e[0]+\".\"+e[1])}function s(e){var n=i.get(e);n&&\"OBJECT\"==n.nodeName&&(\"IE\"===t.browser?(n.style.display=\"none\",function r(){4==n.readyState?u(e):setTimeout(r,10)}()):n.parentNode.removeChild(n))}function u(e){var t=i.get(e);if(t){for(var n in t)\"function\"==typeof t[n]&&(t[n]=null);t.parentNode.removeChild(t)}}function c(u){var c,m=this;u=e.extend({swf_url:t.swf_url},u),o.call(this,u,l,{access_binary:function(e){return e&&\"browser\"===m.mode},access_image_binary:function(e){return e&&\"browser\"===m.mode},display_media:o.capTest(r(\"moxie/image/Image\")),do_cors:o.capTrue,drag_and_drop:!1,report_upload_progress:function(){return\"client\"===m.mode},resize_image:o.capTrue,return_response_headers:!1,return_response_type:function(t){return\"json\"===t&&window.JSON?!0:!e.arrayDiff(t,[\"\",\"text\",\"document\"])||\"browser\"===m.mode},return_status_code:function(t){return\"browser\"===m.mode||!e.arrayDiff(t,[200,404])},select_file:o.capTrue,select_multiple:o.capTrue,send_binary_string:function(e){return e&&\"browser\"===m.mode},send_browser_cookies:function(e){return e&&\"browser\"===m.mode},send_custom_headers:function(e){return e&&\"browser\"===m.mode},send_multipart:o.capTrue,slice_blob:function(e){return e&&\"browser\"===m.mode},stream_upload:function(e){return e&&\"browser\"===m.mode},summon_file_dialog:!1,upload_filesize:function(t){return e.parseSizeStr(t)<=2097152||\"client\"===m.mode},use_http_method:function(t){return!e.arrayDiff(t,[\"GET\",\"POST\"])}},{access_binary:function(e){return e?\"browser\":\"client\"},access_image_binary:function(e){return e?\"browser\":\"client\"},report_upload_progress:function(e){return e?\"browser\":\"client\"},return_response_type:function(t){return e.arrayDiff(t,[\"\",\"text\",\"json\",\"document\"])?\"browser\":[\"client\",\"browser\"]},return_status_code:function(t){return e.arrayDiff(t,[200,404])?\"browser\":[\"client\",\"browser\"]},send_binary_string:function(e){return e?\"browser\":\"client\"},send_browser_cookies:function(e){return e?\"browser\":\"client\"},send_custom_headers:function(e){return e?\"browser\":\"client\"},slice_blob:function(e){return e?\"browser\":\"client\"},stream_upload:function(e){return e?\"client\":\"browser\"},upload_filesize:function(t){return e.parseSizeStr(t)>=2097152?\"client\":\"browser\"}},\"client\"),a()<11.3&&(this.mode=!1),e.extend(this,{getShim:function(){return i.get(this.uid)},shimExec:function(e,t){var i=[].slice.call(arguments,2);return m.getShim().exec(this.uid,e,t,i)},init:function(){var i,r,a;a=this.getShimContainer(),e.extend(a.style,{position:\"absolute\",top:\"-8px\",left:\"-8px\",width:\"9px\",height:\"9px\",overflow:\"hidden\"}),i='\",\"IE\"===t.browser?(r=document.createElement(\"div\"),a.appendChild(r),r.outerHTML=i,r=a=null):a.innerHTML=i,c=setTimeout(function(){m&&!m.initialized&&m.trigger(\"Error\",new n.RuntimeError(n.RuntimeError.NOT_INIT_ERR))},5e3)},destroy:function(e){return function(){s(m.uid),e.call(m),clearTimeout(c),u=c=e=m=null}}(this.destroy)},d)}var l=\"flash\",d={};return o.addConstructor(l,c),d}),n(\"moxie/runtime/flash/file/Blob\",[\"moxie/runtime/flash/Runtime\",\"moxie/file/Blob\"],function(e,t){var i={slice:function(e,i,n,r){var o=this.getRuntime();return 0>i?i=Math.max(e.size+i,0):i>0&&(i=Math.min(i,e.size)),0>n?n=Math.max(e.size+n,0):n>0&&(n=Math.min(n,e.size)),e=o.shimExec.call(this,\"Blob\",\"slice\",i,n,r||\"\"),e&&(e=new t(o.uid,e)),e}};return e.Blob=i}),n(\"moxie/runtime/flash/file/FileInput\",[\"moxie/runtime/flash/Runtime\",\"moxie/file/File\",\"moxie/core/utils/Dom\",\"moxie/core/utils/Basic\"],function(e,t,i,n){var r={init:function(e){var r=this,o=this.getRuntime(),a=i.get(e.browse_button);a&&(a.setAttribute(\"tabindex\",-1),a=null),this.bind(\"Change\",function(){var e=o.shimExec.call(r,\"FileInput\",\"getFiles\");r.files=[],n.each(e,function(e){r.files.push(new t(o.uid,e))})},999),this.getRuntime().shimExec.call(this,\"FileInput\",\"init\",{accept:e.accept,multiple:e.multiple}),this.trigger(\"ready\")}};return e.FileInput=r}),n(\"moxie/runtime/flash/file/FileReader\",[\"moxie/runtime/flash/Runtime\",\"moxie/core/utils/Encode\"],function(e,t){function i(e,i){switch(i){case\"readAsText\":return t.atob(e,\"utf8\");case\"readAsBinaryString\":return t.atob(e);case\"readAsDataURL\":return e}return null}var n={read:function(e,t){var n=this;return n.result=\"\",\"readAsDataURL\"===e&&(n.result=\"data:\"+(t.type||\"\")+\";base64,\"),n.bind(\"Progress\",function(t,r){r&&(n.result+=i(r,e))},999),n.getRuntime().shimExec.call(this,\"FileReader\",\"readAsBase64\",t.uid)}};return e.FileReader=n}),n(\"moxie/runtime/flash/file/FileReaderSync\",[\"moxie/runtime/flash/Runtime\",\"moxie/core/utils/Encode\"],function(e,t){function i(e,i){switch(i){case\"readAsText\":return t.atob(e,\"utf8\");case\"readAsBinaryString\":return t.atob(e);case\"readAsDataURL\":return e}return null}var n={read:function(e,t){var n,r=this.getRuntime();return(n=r.shimExec.call(this,\"FileReaderSync\",\"readAsBase64\",t.uid))?(\"readAsDataURL\"===e&&(n=\"data:\"+(t.type||\"\")+\";base64,\"+n),i(n,e,t.type)):null}};return e.FileReaderSync=n}),n(\"moxie/runtime/flash/runtime/Transporter\",[\"moxie/runtime/flash/Runtime\",\"moxie/file/Blob\"],function(e,t){var i={getAsBlob:function(e){var i=this.getRuntime(),n=i.shimExec.call(this,\"Transporter\",\"getAsBlob\",e);return n?new t(i.uid,n):null}};return e.Transporter=i}),n(\"moxie/runtime/flash/xhr/XMLHttpRequest\",[\"moxie/runtime/flash/Runtime\",\"moxie/core/utils/Basic\",\"moxie/file/Blob\",\"moxie/file/File\",\"moxie/file/FileReaderSync\",\"moxie/runtime/flash/file/FileReaderSync\",\"moxie/xhr/FormData\",\"moxie/runtime/Transporter\",\"moxie/runtime/flash/runtime/Transporter\"],function(e,t,i,n,r,o,a,s){var u={send:function(e,n){function r(){e.transport=l.mode,l.shimExec.call(c,\"XMLHttpRequest\",\"send\",e,n)}function o(e,t){l.shimExec.call(c,\"XMLHttpRequest\",\"appendBlob\",e,t.uid),n=null,r()}function u(e,t){var i=new s;i.bind(\"TransportingComplete\",function(){t(this.result)}),i.transport(e.getSource(),e.type,{ruid:l.uid})}var c=this,l=c.getRuntime();if(t.isEmptyObj(e.headers)||t.each(e.headers,function(e,t){l.shimExec.call(c,\"XMLHttpRequest\",\"setRequestHeader\",t,e.toString())}),n instanceof a){var d;if(n.each(function(e,t){e instanceof i?d=t:l.shimExec.call(c,\"XMLHttpRequest\",\"append\",t,e)}),n.hasBlob()){var m=n.getBlob();m.isDetached()?u(m,function(e){m.destroy(),o(d,e)}):o(d,m)}else n=null,r()}else n instanceof i?n.isDetached()?u(n,function(e){n.destroy(),n=e.uid,r()}):(n=n.uid,r()):r()},getResponse:function(e){var i,o,a=this.getRuntime();if(o=a.shimExec.call(this,\"XMLHttpRequest\",\"getResponseAsBlob\")){if(o=new n(a.uid,o),\"blob\"===e)return o;try{if(i=new r,~t.inArray(e,[\"\",\"text\"]))return i.readAsText(o);if(\"json\"===e&&window.JSON)return JSON.parse(i.readAsText(o))}finally{o.destroy()}}return null},abort:function(){var e=this.getRuntime();e.shimExec.call(this,\"XMLHttpRequest\",\"abort\"),this.dispatchEvent(\"readystatechange\"),this.dispatchEvent(\"abort\")}};return e.XMLHttpRequest=u}),n(\"moxie/runtime/flash/image/Image\",[\"moxie/runtime/flash/Runtime\",\"moxie/core/utils/Basic\",\"moxie/runtime/Transporter\",\"moxie/file/Blob\",\"moxie/file/FileReaderSync\"],function(e,t,i,n,r){var o={loadFromBlob:function(e){function t(e){r.shimExec.call(n,\"Image\",\"loadFromBlob\",e.uid),n=r=null}var n=this,r=n.getRuntime();if(e.isDetached()){var o=new i;o.bind(\"TransportingComplete\",function(){t(o.result.getSource())}),o.transport(e.getSource(),e.type,{ruid:r.uid})}else t(e.getSource())},loadFromImage:function(e){var t=this.getRuntime();return t.shimExec.call(this,\"Image\",\"loadFromImage\",e.uid)},getInfo:function(){var e=this.getRuntime(),t=e.shimExec.call(this,\"Image\",\"getInfo\");return t.meta&&t.meta.thumb&&t.meta.thumb.data&&!(e.meta.thumb.data instanceof n)&&(t.meta.thumb.data=new n(e.uid,t.meta.thumb.data)),t},getAsBlob:function(e,t){var i=this.getRuntime(),r=i.shimExec.call(this,\"Image\",\"getAsBlob\",e,t);return r?new n(i.uid,r):null},getAsDataURL:function(){var e,t=this.getRuntime(),i=t.Image.getAsBlob.apply(this,arguments);return i?(e=new r,e.readAsDataURL(i)):null}};return e.Image=o}),n(\"moxie/runtime/silverlight/Runtime\",[\"moxie/core/utils/Basic\",\"moxie/core/utils/Env\",\"moxie/core/utils/Dom\",\"moxie/core/Exceptions\",\"moxie/runtime/Runtime\"],function(e,t,i,n,o){function a(e){var t,i,n,r,o,a=!1,s=null,u=0;try{try{s=new ActiveXObject(\"AgControl.AgControl\"),s.IsVersionSupported(e)&&(a=!0),s=null}catch(c){var l=navigator.plugins[\"Silverlight Plug-In\"];if(l){for(t=l.description,\"1.0.30226.2\"===t&&(t=\"2.0.30226.2\"),i=t.split(\".\");i.length>3;)i.pop();for(;i.length<4;)i.push(0);for(n=e.split(\".\");n.length>4;)n.pop();do r=parseInt(n[u],10),o=parseInt(i[u],10),u++;while(u=r&&!isNaN(r)&&(a=!0)}}}catch(d){a=!1}return a}function s(s){var l,d=this;s=e.extend({xap_url:t.xap_url},s),o.call(this,s,u,{access_binary:o.capTrue,access_image_binary:o.capTrue,display_media:o.capTest(r(\"moxie/image/Image\")),do_cors:o.capTrue,drag_and_drop:!1,report_upload_progress:o.capTrue,resize_image:o.capTrue,return_response_headers:function(e){return e&&\"client\"===d.mode},return_response_type:function(e){return\"json\"!==e?!0:!!window.JSON},return_status_code:function(t){return\"client\"===d.mode||!e.arrayDiff(t,[200,404])},select_file:o.capTrue,select_multiple:o.capTrue,send_binary_string:o.capTrue,send_browser_cookies:function(e){return e&&\"browser\"===d.mode},send_custom_headers:function(e){return e&&\"client\"===d.mode},send_multipart:o.capTrue,slice_blob:o.capTrue,stream_upload:!0,summon_file_dialog:!1,upload_filesize:o.capTrue,use_http_method:function(t){return\"client\"===d.mode||!e.arrayDiff(t,[\"GET\",\"POST\"])}},{return_response_headers:function(e){return e?\"client\":\"browser\"},return_status_code:function(t){return e.arrayDiff(t,[200,404])?\"client\":[\"client\",\"browser\"]},send_browser_cookies:function(e){return e?\"browser\":\"client\"},send_custom_headers:function(e){return e?\"client\":\"browser\"},use_http_method:function(t){return e.arrayDiff(t,[\"GET\",\"POST\"])?\"client\":[\"client\",\"browser\"]}}),a(\"2.0.31005.0\")&&\"Opera\"!==t.browser||(this.mode=!1),e.extend(this,{getShim:function(){return i.get(this.uid).content.Moxie},shimExec:function(e,t){var i=[].slice.call(arguments,2);return d.getShim().exec(this.uid,e,t,i)},init:function(){var e;e=this.getShimContainer(),e.innerHTML='\",l=setTimeout(function(){d&&!d.initialized&&d.trigger(\"Error\",new n.RuntimeError(n.RuntimeError.NOT_INIT_ERR))},\"Windows\"!==t.OS?1e4:5e3)},destroy:function(e){return function(){e.call(d),clearTimeout(l),s=l=e=d=null}}(this.destroy)},c)}var u=\"silverlight\",c={};return o.addConstructor(u,s),c}),n(\"moxie/runtime/silverlight/file/Blob\",[\"moxie/runtime/silverlight/Runtime\",\"moxie/core/utils/Basic\",\"moxie/runtime/flash/file/Blob\"],function(e,t,i){return e.Blob=t.extend({},i)}),n(\"moxie/runtime/silverlight/file/FileInput\",[\"moxie/runtime/silverlight/Runtime\",\"moxie/file/File\",\"moxie/core/utils/Dom\",\"moxie/core/utils/Basic\"],function(e,t,i,n){function r(e){for(var t=\"\",i=0;ii;i++)t=s.keys[i],a=s[t],a&&(/^(\\d|[1-9]\\d+)$/.test(a)?a=parseInt(a,10):/^\\d*\\.\\d+$/.test(a)&&(a=parseFloat(a)),r.meta[e][t]=a)}),r.meta&&r.meta.thumb&&r.meta.thumb.data&&!(e.meta.thumb.data instanceof i)&&(r.meta.thumb.data=new i(e.uid,r.meta.thumb.data))),r.width=parseInt(o.width,10),r.height=parseInt(o.height,10),r.size=parseInt(o.size,10),r.type=o.type,r.name=o.name,r},resize:function(e,t,i){this.getRuntime().shimExec.call(this,\"Image\",\"resize\",e.x,e.y,e.width,e.height,t,i.preserveHeaders,i.resample)}})}),n(\"moxie/runtime/html4/Runtime\",[\"moxie/core/utils/Basic\",\"moxie/core/Exceptions\",\"moxie/runtime/Runtime\",\"moxie/core/utils/Env\"],function(e,t,i,n){function o(t){var o=this,u=i.capTest,c=i.capTrue;i.call(this,t,a,{access_binary:u(window.FileReader||window.File&&File.getAsDataURL),access_image_binary:!1,display_media:u((n.can(\"create_canvas\")||n.can(\"use_data_uri_over32kb\"))&&r(\"moxie/image/Image\")),do_cors:!1,drag_and_drop:!1,filter_by_extension:u(function(){return!(\"Chrome\"===n.browser&&n.verComp(n.version,28,\"<\")||\"IE\"===n.browser&&n.verComp(n.version,10,\"<\")||\"Safari\"===n.browser&&n.verComp(n.version,7,\"<\")||\"Firefox\"===n.browser&&n.verComp(n.version,37,\"<\"))}()),resize_image:function(){return s.Image&&o.can(\"access_binary\")&&n.can(\"create_canvas\")},report_upload_progress:!1,return_response_headers:!1,return_response_type:function(t){return\"json\"===t&&window.JSON?!0:!!~e.inArray(t,[\"text\",\"document\",\"\"])},return_status_code:function(t){return!e.arrayDiff(t,[200,404])},select_file:function(){return n.can(\"use_fileinput\")},select_multiple:!1,send_binary_string:!1,send_custom_headers:!1,send_multipart:!0,slice_blob:!1,stream_upload:function(){return o.can(\"select_file\")},summon_file_dialog:function(){return o.can(\"select_file\")&&!(\"Firefox\"===n.browser&&n.verComp(n.version,4,\"<\")||\"Opera\"===n.browser&&n.verComp(n.version,12,\"<\")||\"IE\"===n.browser&&n.verComp(n.version,10,\"<\"))},upload_filesize:c,use_http_method:function(t){return!e.arrayDiff(t,[\"GET\",\"POST\"])}}),e.extend(this,{init:function(){this.trigger(\"Init\")},destroy:function(e){return function(){e.call(o),e=o=null}}(this.destroy)}),e.extend(this.getShim(),s)}var a=\"html4\",s={};return i.addConstructor(a,o),s}),n(\"moxie/runtime/html4/file/FileInput\",[\"moxie/runtime/html4/Runtime\",\"moxie/file/File\",\"moxie/core/utils/Basic\",\"moxie/core/utils/Dom\",\"moxie/core/utils/Events\",\"moxie/core/utils/Mime\",\"moxie/core/utils/Env\"],function(e,t,i,n,r,o,a){function s(){function e(){var o,c,d,m,h,f,p=this,g=p.getRuntime();f=i.guid(\"uid_\"),o=g.getShimContainer(),s&&(d=n.get(s+\"_form\"),d&&(i.extend(d.style,{top:\"100%\"}),d.firstChild.setAttribute(\"tabindex\",-1))),m=document.createElement(\"form\"),m.setAttribute(\"id\",f+\"_form\"),m.setAttribute(\"method\",\"post\"),m.setAttribute(\"enctype\",\"multipart/form-data\"),m.setAttribute(\"encoding\",\"multipart/form-data\"),i.extend(m.style,{overflow:\"hidden\",position:\"absolute\",top:0,left:0,width:\"100%\",height:\"100%\"}),h=document.createElement(\"input\"),h.setAttribute(\"id\",f),h.setAttribute(\"type\",\"file\"),h.setAttribute(\"accept\",l.join(\",\")),g.can(\"summon_file_dialog\")&&h.setAttribute(\"tabindex\",-1),i.extend(h.style,{fontSize:\"999px\",opacity:0}),m.appendChild(h),o.appendChild(m),i.extend(h.style,{position:\"absolute\",top:0,left:0,width:\"100%\",height:\"100%\"}),\"IE\"===a.browser&&a.verComp(a.version,10,\"<\")&&i.extend(h.style,{filter:\"progid:DXImageTransform.Microsoft.Alpha(opacity=0)\"}),h.onchange=function(){var i;this.value&&(i=this.files?this.files[0]:{name:this.value},i=new t(g.uid,i),this.onchange=function(){},e.call(p),p.files=[i],h.setAttribute(\"id\",i.uid),m.setAttribute(\"id\",i.uid+\"_form\"),p.trigger(\"change\"),h=m=null)},g.can(\"summon_file_dialog\")&&(c=n.get(u.browse_button),r.removeEvent(c,\"click\",p.uid),r.addEvent(c,\"click\",function(e){h&&!h.disabled&&h.click(),e.preventDefault()},p.uid)),s=f,o=d=c=null}var s,u,c,l=[];i.extend(this,{init:function(t){var i,a=this,s=a.getRuntime();u=t,l=o.extList2mimes(t.accept,s.can(\"filter_by_extension\")),i=s.getShimContainer(),function(){var e,o,l;e=n.get(t.browse_button),c=n.getStyle(e,\"z-index\")||\"auto\",s.can(\"summon_file_dialog\")?(\"static\"===n.getStyle(e,\"position\")&&(e.style.position=\"relative\"),a.bind(\"Refresh\",function(){o=parseInt(c,10)||1,n.get(u.browse_button).style.zIndex=o,this.getRuntime().getShimContainer().style.zIndex=o-1})):e.setAttribute(\"tabindex\",-1),l=s.can(\"summon_file_dialog\")?e:i,r.addEvent(l,\"mouseover\",function(){a.trigger(\"mouseenter\")},a.uid),r.addEvent(l,\"mouseout\",function(){a.trigger(\"mouseleave\")},a.uid),r.addEvent(l,\"mousedown\",function(){a.trigger(\"mousedown\")},a.uid),r.addEvent(n.get(t.container),\"mouseup\",function(){a.trigger(\"mouseup\")},a.uid),e=null}(),e.call(this),i=null,a.trigger({type:\"ready\",async:!0})},setOption:function(e,t){var i,r=this.getRuntime();\"accept\"==e&&(l=t.mimes||o.extList2mimes(t,r.can(\"filter_by_extension\"))),i=n.get(s),i&&i.setAttribute(\"accept\",l.join(\",\"))},disable:function(e){var t;(t=n.get(s))&&(t.disabled=!!e)},destroy:function(){var e=this.getRuntime(),t=e.getShim(),i=e.getShimContainer(),o=u&&n.get(u.container),a=u&&n.get(u.browse_button);o&&r.removeAllEvents(o,this.uid),a&&(r.removeAllEvents(a,this.uid),a.style.zIndex=c),i&&(r.removeAllEvents(i,this.uid),i.innerHTML=\"\"),t.removeInstance(this.uid),s=l=u=i=o=a=t=null}})}return e.FileInput=s}),n(\"moxie/runtime/html4/file/FileReader\",[\"moxie/runtime/html4/Runtime\",\"moxie/runtime/html5/file/FileReader\"],function(e,t){return e.FileReader=t}),n(\"moxie/runtime/html4/xhr/XMLHttpRequest\",[\"moxie/runtime/html4/Runtime\",\"moxie/core/utils/Basic\",\"moxie/core/utils/Dom\",\"moxie/core/utils/Url\",\"moxie/core/Exceptions\",\"moxie/core/utils/Events\",\"moxie/file/Blob\",\"moxie/xhr/FormData\"],function(e,t,i,n,r,o,a,s){function u(){function e(e){var t,n,r,a,s=this,u=!1;if(l){if(t=l.id.replace(/_iframe$/,\"\"),n=i.get(t+\"_form\")){for(r=n.getElementsByTagName(\"input\"),a=r.length;a--;)switch(r[a].getAttribute(\"type\")){case\"hidden\":r[a].parentNode.removeChild(r[a]);break;case\"file\":u=!0}r=[],u||n.parentNode.removeChild(n),n=null}setTimeout(function(){o.removeEvent(l,\"load\",s.uid),l.parentNode&&l.parentNode.removeChild(l);var t=s.getRuntime().getShimContainer();t.children.length||t.parentNode.removeChild(t),t=l=null,e()},1)}}var u,c,l;t.extend(this,{send:function(d,m){function h(){var i=w.getShimContainer()||document.body,r=document.createElement(\"div\");r.innerHTML='',l=r.firstChild,i.appendChild(l),o.addEvent(l,\"load\",function(){var i;try{i=l.contentWindow.document||l.contentDocument||window.frames[l.id].document,/^4(0[0-9]|1[0-7]|2[2346])\\s/.test(i.title)?u=i.title.replace(/^(\\d+).*$/,\"$1\"):(u=200,c=t.trim(i.body.innerHTML),v.trigger({type:\"progress\",loaded:c.length,total:c.length}),x&&v.trigger({type:\"uploadprogress\",loaded:x.size||1025,total:x.size||1025}))}catch(r){if(!n.hasSameOrigin(d.url))return e.call(v,function(){v.trigger(\"error\")}),void 0;u=404}e.call(v,function(){v.trigger(\"load\")})},v.uid)}var f,p,g,x,v=this,w=v.getRuntime();if(u=c=null,m instanceof s&&m.hasBlob()){if(x=m.getBlob(),f=x.uid,g=i.get(f),p=i.get(f+\"_form\"),!p)throw new r.DOMException(r.DOMException.NOT_FOUND_ERR)}else f=t.guid(\"uid_\"),p=document.createElement(\"form\"),p.setAttribute(\"id\",f+\"_form\"),p.setAttribute(\"method\",d.method),p.setAttribute(\"enctype\",\"multipart/form-data\"),p.setAttribute(\"encoding\",\"multipart/form-data\"),w.getShimContainer().appendChild(p);p.setAttribute(\"target\",f+\"_iframe\"),m instanceof s&&m.each(function(e,i){if(e instanceof a)g&&g.setAttribute(\"name\",i);else{var n=document.createElement(\"input\");t.extend(n,{type:\"hidden\",name:i,value:e}),g?p.insertBefore(n,g):p.appendChild(n)}}),p.setAttribute(\"action\",d.url),h(),p.submit(),v.trigger(\"loadstart\")},getStatus:function(){return u},getResponse:function(e){if(\"json\"===e&&\"string\"===t.typeOf(c)&&window.JSON)try{return JSON.parse(c.replace(/^\\s*]*>/,\"\").replace(/<\\/pre>\\s*$/,\"\"))}catch(i){return null}return c},abort:function(){var t=this;l&&l.contentWindow&&(l.contentWindow.stop?l.contentWindow.stop():l.contentWindow.document.execCommand?l.contentWindow.document.execCommand(\"Stop\"):l.src=\"about:blank\"),e.call(this,function(){t.dispatchEvent(\"abort\")})},destroy:function(){this.getRuntime().getShim().removeInstance(this.uid)}})}return e.XMLHttpRequest=u}),n(\"moxie/runtime/html4/image/Image\",[\"moxie/runtime/html4/Runtime\",\"moxie/runtime/html5/image/Image\"],function(e,t){return e.Image=t}),a([\"moxie/core/utils/Basic\",\"moxie/core/utils/Encode\",\"moxie/core/utils/Env\",\"moxie/core/Exceptions\",\"moxie/core/utils/Dom\",\"moxie/core/EventTarget\",\"moxie/runtime/Runtime\",\"moxie/runtime/RuntimeClient\",\"moxie/file/Blob\",\"moxie/core/I18n\",\"moxie/core/utils/Mime\",\"moxie/file/FileInput\",\"moxie/file/File\",\"moxie/file/FileDrop\",\"moxie/file/FileReader\",\"moxie/core/utils/Url\",\"moxie/runtime/RuntimeTarget\",\"moxie/xhr/FormData\",\"moxie/xhr/XMLHttpRequest\",\"moxie/image/Image\",\"moxie/core/utils/Events\",\"moxie/runtime/html5/image/ResizerCanvas\"])}(this)});\n/**\n * Plupload - multi-runtime File Uploader\n * v2.3.9\n *\n * Copyright 2013, Moxiecode Systems AB\n * Released under GPL License.\n *\n * License: http://www.plupload.com/license\n * Contributing: http://www.plupload.com/contributing\n *\n * Date: 2021-11-15\n */\n!function(e,t){var i=function(){var e={};return t.apply(e,arguments),e.plupload};\"function\"==typeof define&&define.amd?define(\"plupload\",[\"./moxie\"],i):\"object\"==typeof module&&module.exports?module.exports=i(require(\"./moxie\")):e.plupload=i(e.moxie)}(this||window,function(e){!function(e,t,i){function n(e){function t(e,t,i){var r={chunks:\"slice_blob\",jpgresize:\"send_binary_string\",pngresize:\"send_binary_string\",progress:\"report_upload_progress\",multi_selection:\"select_multiple\",dragdrop:\"drag_and_drop\",drop_element:\"drag_and_drop\",headers:\"send_custom_headers\",urlstream_upload:\"send_binary_string\",canSendBinary:\"send_binary\",triggerDialog:\"summon_file_dialog\"};r[e]?n[r[e]]=t:i||(n[e]=t)}var i=e.required_features,n={};return\"string\"==typeof i?l.each(i.split(/\\s*,\\s*/),function(e){t(e,!0)}):\"object\"==typeof i?l.each(i,function(e,i){t(i,e)}):i===!0&&(e.chunk_size&&e.chunk_size>0&&(n.slice_blob=!0),l.isEmptyObj(e.resize)&&e.multipart!==!1||(n.send_binary_string=!0),e.http_method&&(n.use_http_method=e.http_method),l.each(e,function(e,i){t(i,!!e,!0)})),n}var r=window.setTimeout,s={},a=t.core.utils,o=t.runtime.Runtime,l={VERSION:\"2.3.6\",STOPPED:1,STARTED:2,QUEUED:1,UPLOADING:2,FAILED:4,DONE:5,GENERIC_ERROR:-100,HTTP_ERROR:-200,IO_ERROR:-300,SECURITY_ERROR:-400,INIT_ERROR:-500,FILE_SIZE_ERROR:-600,FILE_EXTENSION_ERROR:-601,FILE_DUPLICATE_ERROR:-602,IMAGE_FORMAT_ERROR:-700,MEMORY_ERROR:-701,IMAGE_DIMENSIONS_ERROR:-702,moxie:t,mimeTypes:a.Mime.mimes,ua:a.Env,typeOf:a.Basic.typeOf,extend:a.Basic.extend,guid:a.Basic.guid,getAll:function(e){var t,i=[];\"array\"!==l.typeOf(e)&&(e=[e]);for(var n=e.length;n--;)t=l.get(e[n]),t&&i.push(t);return i.length?i:null},get:a.Dom.get,each:a.Basic.each,getPos:a.Dom.getPos,getSize:a.Dom.getSize,xmlEncode:function(e){var t={\"<\":\"lt\",\">\":\"gt\",\"&\":\"amp\",'\"':\"quot\",\"'\":\"#39\"},i=/[<>&\\\"\\']/g;return e?(\"\"+e).replace(i,function(e){return t[e]?\"&\"+t[e]+\";\":e}):e},toArray:a.Basic.toArray,inArray:a.Basic.inArray,inSeries:a.Basic.inSeries,addI18n:t.core.I18n.addI18n,translate:t.core.I18n.translate,sprintf:a.Basic.sprintf,isEmptyObj:a.Basic.isEmptyObj,hasClass:a.Dom.hasClass,addClass:a.Dom.addClass,removeClass:a.Dom.removeClass,getStyle:a.Dom.getStyle,addEvent:a.Events.addEvent,removeEvent:a.Events.removeEvent,removeAllEvents:a.Events.removeAllEvents,cleanName:function(e){var t,i;for(i=[/[\\300-\\306]/g,\"A\",/[\\340-\\346]/g,\"a\",/\\307/g,\"C\",/\\347/g,\"c\",/[\\310-\\313]/g,\"E\",/[\\350-\\353]/g,\"e\",/[\\314-\\317]/g,\"I\",/[\\354-\\357]/g,\"i\",/\\321/g,\"N\",/\\361/g,\"n\",/[\\322-\\330]/g,\"O\",/[\\362-\\370]/g,\"o\",/[\\331-\\334]/g,\"U\",/[\\371-\\374]/g,\"u\"],t=0;t0?\"&\":\"?\")+i),e},formatSize:function(e){function t(e,t){return Math.round(e*Math.pow(10,t))/Math.pow(10,t)}if(e===i||/\\D/.test(e))return l.translate(\"N/A\");var n=Math.pow(1024,4);return e>n?t(e/n,1)+\" \"+l.translate(\"tb\"):e>(n/=1024)?t(e/n,1)+\" \"+l.translate(\"gb\"):e>(n/=1024)?t(e/n,1)+\" \"+l.translate(\"mb\"):e>1024?Math.round(e/1024)+\" \"+l.translate(\"kb\"):e+\" \"+l.translate(\"b\")},parseSize:a.Basic.parseSizeStr,predictRuntime:function(e,t){var i,n;return i=new l.Uploader(e),n=o.thatCan(i.getOption().required_features,t||e.runtimes),i.destroy(),n},addFileFilter:function(e,t){s[e]=t}};l.addFileFilter(\"mime_types\",function(e,t,i){e.length&&!e.regexp.test(t.name)?(this.trigger(\"Error\",{code:l.FILE_EXTENSION_ERROR,message:l.translate(\"File extension error.\"),file:t}),i(!1)):i(!0)}),l.addFileFilter(\"max_file_size\",function(e,t,i){var n;e=l.parseSize(e),t.size!==n&&e&&t.size>e?(this.trigger(\"Error\",{code:l.FILE_SIZE_ERROR,message:l.translate(\"File size error.\"),file:t}),i(!1)):i(!0)}),l.addFileFilter(\"prevent_duplicates\",function(e,t,i){if(e)for(var n=this.files.length;n--;)if(t.name===this.files[n].name&&t.size===this.files[n].size)return this.trigger(\"Error\",{code:l.FILE_DUPLICATE_ERROR,message:l.translate(\"Duplicate file error.\"),file:t}),i(!1),void 0;i(!0)}),l.addFileFilter(\"prevent_empty\",function(e,t,n){e&&!t.size&&t.size!==i?(this.trigger(\"Error\",{code:l.FILE_SIZE_ERROR,message:l.translate(\"File size error.\"),file:t}),n(!1)):n(!0)}),l.Uploader=function(e){function a(){var e,t,i=0;if(this.state==l.STARTED){for(t=0;t0?Math.ceil(100*(e.loaded/e.size)):100,d()}function d(){var e,t,n,r=0;for(I.reset(),e=0;eS)&&(r+=n),I.loaded+=n):I.size=i,t.status==l.DONE?I.uploaded++:t.status==l.FAILED?I.failed++:I.queued++;I.size===i?I.percent=D.length>0?Math.ceil(100*(I.uploaded/D.length)):0:(I.bytesPerSec=Math.ceil(r/((+new Date-S||1)/1e3)),I.percent=I.size>0?Math.ceil(100*(I.loaded/I.size)):0)}function c(){var e=F[0]||P[0];return e?e.getRuntime().uid:!1}function f(){this.bind(\"FilesAdded FilesRemoved\",function(e){e.trigger(\"QueueChanged\"),e.refresh()}),this.bind(\"CancelUpload\",b),this.bind(\"BeforeUpload\",m),this.bind(\"UploadFile\",_),this.bind(\"UploadProgress\",E),this.bind(\"StateChanged\",v),this.bind(\"QueueChanged\",d),this.bind(\"Error\",R),this.bind(\"FileUploaded\",y),this.bind(\"Destroy\",z)}function p(e,i){var n=this,r=0,s=[],a={runtime_order:e.runtimes,required_caps:e.required_features,preferred_caps:x,swf_url:e.flash_swf_url,xap_url:e.silverlight_xap_url};l.each(e.runtimes.split(/\\s*,\\s*/),function(t){e[t]&&(a[t]=e[t])}),e.browse_button&&l.each(e.browse_button,function(i){s.push(function(s){var u=new t.file.FileInput(l.extend({},a,{accept:e.filters.mime_types,name:e.file_data_name,multiple:e.multi_selection,container:e.container,browse_button:i}));u.onready=function(){var e=o.getInfo(this.ruid);l.extend(n.features,{chunks:e.can(\"slice_blob\"),multipart:e.can(\"send_multipart\"),multi_selection:e.can(\"select_multiple\")}),r++,F.push(this),s()},u.onchange=function(){n.addFile(this.files)},u.bind(\"mouseenter mouseleave mousedown mouseup\",function(t){U||(e.browse_button_hover&&(\"mouseenter\"===t.type?l.addClass(i,e.browse_button_hover):\"mouseleave\"===t.type&&l.removeClass(i,e.browse_button_hover)),e.browse_button_active&&(\"mousedown\"===t.type?l.addClass(i,e.browse_button_active):\"mouseup\"===t.type&&l.removeClass(i,e.browse_button_active)))}),u.bind(\"mousedown\",function(){n.trigger(\"Browse\")}),u.bind(\"error runtimeerror\",function(){u=null,s()}),u.init()})}),e.drop_element&&l.each(e.drop_element,function(e){s.push(function(i){var s=new t.file.FileDrop(l.extend({},a,{drop_zone:e}));s.onready=function(){var e=o.getInfo(this.ruid);l.extend(n.features,{chunks:e.can(\"slice_blob\"),multipart:e.can(\"send_multipart\"),dragdrop:e.can(\"drag_and_drop\")}),r++,P.push(this),i()},s.ondrop=function(){n.addFile(this.files)},s.bind(\"error runtimeerror\",function(){s=null,i()}),s.init()})}),l.inSeries(s,function(){\"function\"==typeof i&&i(r)})}function g(e,n,r,s){var a=new t.image.Image;try{a.onload=function(){n.width>this.width&&n.height>this.height&&n.quality===i&&n.preserve_headers&&!n.crop?(this.destroy(),s(e)):a.downsize(n.width,n.height,n.crop,n.preserve_headers)},a.onresize=function(){var t=this.getAsBlob(e.type,n.quality);this.destroy(),s(t)},a.bind(\"error runtimeerror\",function(){this.destroy(),s(e)}),a.load(e,r)}catch(o){s(e)}}function h(e,i,r){function s(e,i,n){var r=O[e];switch(e){case\"max_file_size\":\"max_file_size\"===e&&(O.max_file_size=O.filters.max_file_size=i);break;case\"chunk_size\":(i=l.parseSize(i))&&(O[e]=i,O.send_file_name=!0);break;case\"multipart\":O[e]=i,i||(O.send_file_name=!0);break;case\"http_method\":O[e]=\"PUT\"===i.toUpperCase()?\"PUT\":\"POST\";break;case\"unique_names\":O[e]=i,i&&(O.send_file_name=!0);break;case\"filters\":\"array\"===l.typeOf(i)&&(i={mime_types:i}),n?l.extend(O.filters,i):O.filters=i,i.mime_types&&(\"string\"===l.typeOf(i.mime_types)&&(i.mime_types=t.core.utils.Mime.mimes2extList(i.mime_types)),i.mime_types.regexp=function(e){var t=[];return l.each(e,function(e){l.each(e.extensions.split(/,/),function(e){/^\\s*\\*\\s*$/.test(e)?t.push(\"\\\\.*\"):t.push(\"\\\\.\"+e.replace(new RegExp(\"[\"+\"/^$.*+?|()[]{}\\\\\".replace(/./g,\"\\\\$&\")+\"]\",\"g\"),\"\\\\$&\"))})}),new RegExp(\"(\"+t.join(\"|\")+\")$\",\"i\")}(i.mime_types),O.filters.mime_types=i.mime_types);break;case\"resize\":O.resize=i?l.extend({preserve_headers:!0,crop:!1},i):!1;break;case\"prevent_duplicates\":O.prevent_duplicates=O.filters.prevent_duplicates=!!i;break;case\"container\":case\"browse_button\":case\"drop_element\":i=\"container\"===e?l.get(i):l.getAll(i);case\"runtimes\":case\"multi_selection\":case\"flash_swf_url\":case\"silverlight_xap_url\":O[e]=i,n||(u=!0);break;default:O[e]=i}n||a.trigger(\"OptionChanged\",e,i,r)}var a=this,u=!1;\"object\"==typeof e?l.each(e,function(e,t){s(t,e,r)}):s(e,i,r),r?(O.required_features=n(l.extend({},O)),x=n(l.extend({},O,{required_features:!0}))):u&&(a.trigger(\"Destroy\"),p.call(a,O,function(e){e?(a.runtime=o.getInfo(c()).type,a.trigger(\"Init\",{runtime:a.runtime}),a.trigger(\"PostInit\")):a.trigger(\"Error\",{code:l.INIT_ERROR,message:l.translate(\"Init error.\")})}))}function m(e,t){if(e.settings.unique_names){var i=t.name.match(/\\.([^.]+)$/),n=\"part\";i&&(n=i[1]),t.target_name=t.id+\".\"+n}}function _(e,i){function n(){c-->0?r(s,1e3):(i.loaded=p,e.trigger(\"Error\",{code:l.HTTP_ERROR,message:l.translate(\"HTTP Error.\"),file:i,response:T.responseText,status:T.status,responseHeaders:T.getAllResponseHeaders()}))}function s(){var t,n,r={};i.status===l.UPLOADING&&e.state!==l.STOPPED&&(e.settings.send_file_name&&(r.name=i.target_name||i.name),d&&f.chunks&&o.size>d?(n=Math.min(d,o.size-p),t=o.slice(p,p+n)):(n=o.size,t=o),d&&f.chunks&&(e.settings.send_chunk_number?(r.chunk=Math.ceil(p/d),r.chunks=Math.ceil(o.size/d)):(r.offset=p,r.total=o.size)),e.trigger(\"BeforeChunkUpload\",i,r,t,p)&&a(r,t,n))}function a(a,d,g){var m;T=new t.xhr.XMLHttpRequest,T.upload&&(T.upload.onprogress=function(t){i.loaded=Math.min(i.size,p+t.loaded),e.trigger(\"UploadProgress\",i)}),T.onload=function(){return T.status<200||T.status>=400?(n(),void 0):(c=e.settings.max_retries,g=o.size?(i.size!=i.origSize&&(o.destroy(),o=null),e.trigger(\"UploadProgress\",i),i.status=l.DONE,i.completeTimestamp=+new Date,e.trigger(\"FileUploaded\",i,{response:T.responseText,status:T.status,responseHeaders:T.getAllResponseHeaders()})):r(s,1),void 0)},T.onerror=function(){n()},T.onloadend=function(){this.destroy()},e.settings.multipart&&f.multipart?(T.open(e.settings.http_method,u,!0),l.each(e.settings.headers,function(e,t){T.setRequestHeader(t,e)}),m=new t.xhr.FormData,l.each(l.extend(a,e.settings.multipart_params),function(e,t){m.append(t,e)}),m.append(e.settings.file_data_name,d),T.send(m,h)):(u=l.buildUrl(e.settings.url,l.extend(a,e.settings.multipart_params)),T.open(e.settings.http_method,u,!0),l.each(e.settings.headers,function(e,t){T.setRequestHeader(t,e)}),T.hasRequestHeader(\"Content-Type\")||T.setRequestHeader(\"Content-Type\",\"application/octet-stream\"),T.send(d,h))}var o,u=e.settings.url,d=e.settings.chunk_size,c=e.settings.max_retries,f=e.features,p=0,h={runtime_order:e.settings.runtimes,required_caps:e.settings.required_features,preferred_caps:x,swf_url:e.settings.flash_swf_url,xap_url:e.settings.silverlight_xap_url};i.loaded&&(p=i.loaded=d?d*Math.floor(i.loaded/d):0),o=i.getSource(),l.isEmptyObj(e.settings.resize)||-1===l.inArray(o.type,[\"image/jpeg\",\"image/png\"])?s():g(o,e.settings.resize,h,function(e){o=e,i.size=e.size,s()})}function E(e,t){u(t)}function v(e){if(e.state==l.STARTED)S=+new Date;else if(e.state==l.STOPPED)for(var t=e.files.length-1;t>=0;t--)e.files[t].status==l.UPLOADING&&(e.files[t].status=l.QUEUED,d())}function b(){T&&T.abort()}function y(e){d(),r(function(){a.call(e)},1)}function R(e,t){t.code===l.INIT_ERROR?e.destroy():t.code===l.HTTP_ERROR&&(t.file.status=l.FAILED,t.file.completeTimestamp=+new Date,u(t.file),e.state==l.STARTED&&(e.trigger(\"CancelUpload\"),r(function(){a.call(e)},1)))}function z(e){e.stop(),l.each(D,function(e){e.destroy()}),D=[],F.length&&(l.each(F,function(e){e.destroy()}),F=[]),P.length&&(l.each(P,function(e){e.destroy()}),P=[]),x={},U=!1,S=T=null,I.reset()}var O,S,I,T,w=l.guid(),D=[],x={},F=[],P=[],U=!1;O={chunk_size:0,file_data_name:\"file\",filters:{mime_types:[],max_file_size:0,prevent_duplicates:!1,prevent_empty:!0},flash_swf_url:\"js/Moxie.swf\",http_method:\"POST\",max_retries:0,multipart:!0,multi_selection:!0,resize:!1,runtimes:o.order,send_file_name:!0,send_chunk_number:!0,silverlight_xap_url:\"js/Moxie.xap\"},h.call(this,e,null,!0),I=new l.QueueProgress,l.extend(this,{id:w,uid:w,state:l.STOPPED,features:{},runtime:null,files:D,settings:O,total:I,init:function(){var e,t,i=this;return e=i.getOption(\"preinit\"),\"function\"==typeof e?e(i):l.each(e,function(e,t){i.bind(t,e)}),f.call(i),l.each([\"container\",\"browse_button\",\"drop_element\"],function(e){return null===i.getOption(e)?(t={code:l.INIT_ERROR,message:l.sprintf(l.translate(\"%s specified, but cannot be found.\"),e)},!1):void 0}),t?i.trigger(\"Error\",t):O.browse_button||O.drop_element?(p.call(i,O,function(e){var t=i.getOption(\"init\");\"function\"==typeof t?t(i):l.each(t,function(e,t){i.bind(t,e)}),e?(i.runtime=o.getInfo(c()).type,i.trigger(\"Init\",{runtime:i.runtime}),i.trigger(\"PostInit\")):i.trigger(\"Error\",{code:l.INIT_ERROR,message:l.translate(\"Init error.\")})}),void 0):i.trigger(\"Error\",{code:l.INIT_ERROR,message:l.translate(\"You must specify either browse_button or drop_element.\")})},setOption:function(e,t){h.call(this,e,t,!this.runtime)},getOption:function(e){return e?O[e]:O},refresh:function(){F.length&&l.each(F,function(e){e.trigger(\"Refresh\")}),this.trigger(\"Refresh\")},start:function(){this.state!=l.STARTED&&(this.state=l.STARTED,this.trigger(\"StateChanged\"),a.call(this))},stop:function(){this.state!=l.STOPPED&&(this.state=l.STOPPED,this.trigger(\"StateChanged\"),this.trigger(\"CancelUpload\"))},disableBrowse:function(){U=arguments[0]!==i?arguments[0]:!0,F.length&&l.each(F,function(e){e.disable(U)}),this.trigger(\"DisableBrowse\",U)},getFile:function(e){var t;for(t=D.length-1;t>=0;t--)if(D[t].id===e)return D[t]},addFile:function(e,i){function n(e,t){var i=[];l.each(u.settings.filters,function(t,n){s[n]&&i.push(function(i){s[n].call(u,t,e,function(e){i(!e)})})}),l.inSeries(i,t)}function a(e){var s=l.typeOf(e);if(e instanceof t.file.File){if(!e.ruid&&!e.isDetached()){if(!o)return!1;e.ruid=o,e.connectRuntime(o)}a(new l.File(e))}else e instanceof t.file.Blob?(a(e.getSource()),e.destroy()):e instanceof l.File?(i&&(e.name=i),d.push(function(t){n(e,function(i){i||(D.push(e),f.push(e),u.trigger(\"FileFiltered\",e)),r(t,1)})})):-1!==l.inArray(s,[\"file\",\"blob\"])?a(new t.file.File(null,e)):\"node\"===s&&\"filelist\"===l.typeOf(e.files)?l.each(e.files,a):\"array\"===s&&(i=null,l.each(e,a))}var o,u=this,d=[],f=[];o=c(),a(e),d.length&&l.inSeries(d,function(){f.length&&u.trigger(\"FilesAdded\",f)})},removeFile:function(e){for(var t=\"string\"==typeof e?e:e.id,i=D.length-1;i>=0;i--)if(D[i].id===t)return this.splice(i,1)[0]},splice:function(e,t){var n=D.splice(e===i?0:e,t===i?D.length:t),r=!1;return this.state==l.STARTED&&(l.each(n,function(e){return e.status===l.UPLOADING?(r=!0,!1):void 0}),r&&this.stop()),this.trigger(\"FilesRemoved\",n),l.each(n,function(e){e.destroy()}),r&&this.start(),n},dispatchEvent:function(e){var t,i;if(e=e.toLowerCase(),t=this.hasEventListener(e)){t.sort(function(e,t){return t.priority-e.priority}),i=[].slice.call(arguments),i.shift(),i.unshift(this);for(var n=0;n {\n const metaTag = document.querySelector(\"meta[name=csp-nonce]\");\n return nonce = metaTag && metaTag.content;\n};\n\nconst cspNonce = () => nonce || loadCSPNonce();\n\nconst m = Element.prototype.matches || Element.prototype.matchesSelector || Element.prototype.mozMatchesSelector || Element.prototype.msMatchesSelector || Element.prototype.oMatchesSelector || Element.prototype.webkitMatchesSelector;\n\nconst matches = function(element, selector) {\n if (selector.exclude) {\n return m.call(element, selector.selector) && !m.call(element, selector.exclude);\n } else {\n return m.call(element, selector);\n }\n};\n\nconst EXPANDO = \"_ujsData\";\n\nconst getData = (element, key) => element[EXPANDO] ? element[EXPANDO][key] : undefined;\n\nconst setData = function(element, key, value) {\n if (!element[EXPANDO]) {\n element[EXPANDO] = {};\n }\n return element[EXPANDO][key] = value;\n};\n\nconst $ = selector => Array.prototype.slice.call(document.querySelectorAll(selector));\n\nconst isContentEditable = function(element) {\n var isEditable = false;\n do {\n if (element.isContentEditable) {\n isEditable = true;\n break;\n }\n element = element.parentElement;\n } while (element);\n return isEditable;\n};\n\nconst csrfToken = () => {\n const meta = document.querySelector(\"meta[name=csrf-token]\");\n return meta && meta.content;\n};\n\nconst csrfParam = () => {\n const meta = document.querySelector(\"meta[name=csrf-param]\");\n return meta && meta.content;\n};\n\nconst CSRFProtection = xhr => {\n const token = csrfToken();\n if (token) {\n return xhr.setRequestHeader(\"X-CSRF-Token\", token);\n }\n};\n\nconst refreshCSRFTokens = () => {\n const token = csrfToken();\n const param = csrfParam();\n if (token && param) {\n return $('form input[name=\"' + param + '\"]').forEach((input => input.value = token));\n }\n};\n\nconst AcceptHeaders = {\n \"*\": \"*/*\",\n text: \"text/plain\",\n html: \"text/html\",\n xml: \"application/xml, text/xml\",\n json: \"application/json, text/javascript\",\n script: \"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript\"\n};\n\nconst ajax = options => {\n options = prepareOptions(options);\n var xhr = createXHR(options, (function() {\n const response = processResponse(xhr.response != null ? xhr.response : xhr.responseText, xhr.getResponseHeader(\"Content-Type\"));\n if (Math.floor(xhr.status / 100) === 2) {\n if (typeof options.success === \"function\") {\n options.success(response, xhr.statusText, xhr);\n }\n } else {\n if (typeof options.error === \"function\") {\n options.error(response, xhr.statusText, xhr);\n }\n }\n return typeof options.complete === \"function\" ? options.complete(xhr, xhr.statusText) : undefined;\n }));\n if (options.beforeSend && !options.beforeSend(xhr, options)) {\n return false;\n }\n if (xhr.readyState === XMLHttpRequest.OPENED) {\n return xhr.send(options.data);\n }\n};\n\nvar prepareOptions = function(options) {\n options.url = options.url || location.href;\n options.type = options.type.toUpperCase();\n if (options.type === \"GET\" && options.data) {\n if (options.url.indexOf(\"?\") < 0) {\n options.url += \"?\" + options.data;\n } else {\n options.url += \"&\" + options.data;\n }\n }\n if (!(options.dataType in AcceptHeaders)) {\n options.dataType = \"*\";\n }\n options.accept = AcceptHeaders[options.dataType];\n if (options.dataType !== \"*\") {\n options.accept += \", */*; q=0.01\";\n }\n return options;\n};\n\nvar createXHR = function(options, done) {\n const xhr = new XMLHttpRequest;\n xhr.open(options.type, options.url, true);\n xhr.setRequestHeader(\"Accept\", options.accept);\n if (typeof options.data === \"string\") {\n xhr.setRequestHeader(\"Content-Type\", \"application/x-www-form-urlencoded; charset=UTF-8\");\n }\n if (!options.crossDomain) {\n xhr.setRequestHeader(\"X-Requested-With\", \"XMLHttpRequest\");\n CSRFProtection(xhr);\n }\n xhr.withCredentials = !!options.withCredentials;\n xhr.onreadystatechange = function() {\n if (xhr.readyState === XMLHttpRequest.DONE) {\n return done(xhr);\n }\n };\n return xhr;\n};\n\nvar processResponse = function(response, type) {\n if (typeof response === \"string\" && typeof type === \"string\") {\n if (type.match(/\\bjson\\b/)) {\n try {\n response = JSON.parse(response);\n } catch (error) {}\n } else if (type.match(/\\b(?:java|ecma)script\\b/)) {\n const script = document.createElement(\"script\");\n script.setAttribute(\"nonce\", cspNonce());\n script.text = response;\n document.head.appendChild(script).parentNode.removeChild(script);\n } else if (type.match(/\\b(xml|html|svg)\\b/)) {\n const parser = new DOMParser;\n type = type.replace(/;.+/, \"\");\n try {\n response = parser.parseFromString(response, type);\n } catch (error1) {}\n }\n }\n return response;\n};\n\nconst href = element => element.href;\n\nconst isCrossDomain = function(url) {\n const originAnchor = document.createElement(\"a\");\n originAnchor.href = location.href;\n const urlAnchor = document.createElement(\"a\");\n try {\n urlAnchor.href = url;\n return !((!urlAnchor.protocol || urlAnchor.protocol === \":\") && !urlAnchor.host || originAnchor.protocol + \"//\" + originAnchor.host === urlAnchor.protocol + \"//\" + urlAnchor.host);\n } catch (e) {\n return true;\n }\n};\n\nlet preventDefault;\n\nlet {CustomEvent: CustomEvent} = window;\n\nif (typeof CustomEvent !== \"function\") {\n CustomEvent = function(event, params) {\n const evt = document.createEvent(\"CustomEvent\");\n evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);\n return evt;\n };\n CustomEvent.prototype = window.Event.prototype;\n ({preventDefault: preventDefault} = CustomEvent.prototype);\n CustomEvent.prototype.preventDefault = function() {\n const result = preventDefault.call(this);\n if (this.cancelable && !this.defaultPrevented) {\n Object.defineProperty(this, \"defaultPrevented\", {\n get() {\n return true;\n }\n });\n }\n return result;\n };\n}\n\nconst fire = (obj, name, data) => {\n const event = new CustomEvent(name, {\n bubbles: true,\n cancelable: true,\n detail: data\n });\n obj.dispatchEvent(event);\n return !event.defaultPrevented;\n};\n\nconst stopEverything = e => {\n fire(e.target, \"ujs:everythingStopped\");\n e.preventDefault();\n e.stopPropagation();\n e.stopImmediatePropagation();\n};\n\nconst delegate = (element, selector, eventType, handler) => element.addEventListener(eventType, (function(e) {\n let {target: target} = e;\n while (!!(target instanceof Element) && !matches(target, selector)) {\n target = target.parentNode;\n }\n if (target instanceof Element && handler.call(target, e) === false) {\n e.preventDefault();\n e.stopPropagation();\n }\n}));\n\nconst toArray = e => Array.prototype.slice.call(e);\n\nconst serializeElement = (element, additionalParam) => {\n let inputs = [ element ];\n if (matches(element, \"form\")) {\n inputs = toArray(element.elements);\n }\n const params = [];\n inputs.forEach((function(input) {\n if (!input.name || input.disabled) {\n return;\n }\n if (matches(input, \"fieldset[disabled] *\")) {\n return;\n }\n if (matches(input, \"select\")) {\n toArray(input.options).forEach((function(option) {\n if (option.selected) {\n params.push({\n name: input.name,\n value: option.value\n });\n }\n }));\n } else if (input.checked || [ \"radio\", \"checkbox\", \"submit\" ].indexOf(input.type) === -1) {\n params.push({\n name: input.name,\n value: input.value\n });\n }\n }));\n if (additionalParam) {\n params.push(additionalParam);\n }\n return params.map((function(param) {\n if (param.name) {\n return `${encodeURIComponent(param.name)}=${encodeURIComponent(param.value)}`;\n } else {\n return param;\n }\n })).join(\"&\");\n};\n\nconst formElements = (form, selector) => {\n if (matches(form, \"form\")) {\n return toArray(form.elements).filter((el => matches(el, selector)));\n } else {\n return toArray(form.querySelectorAll(selector));\n }\n};\n\nconst handleConfirmWithRails = rails => function(e) {\n if (!allowAction(this, rails)) {\n stopEverything(e);\n }\n};\n\nconst confirm = (message, element) => window.confirm(message);\n\nvar allowAction = function(element, rails) {\n let callback;\n const message = element.getAttribute(\"data-confirm\");\n if (!message) {\n return true;\n }\n let answer = false;\n if (fire(element, \"confirm\")) {\n try {\n answer = rails.confirm(message, element);\n } catch (error) {}\n callback = fire(element, \"confirm:complete\", [ answer ]);\n }\n return answer && callback;\n};\n\nconst handleDisabledElement = function(e) {\n const element = this;\n if (element.disabled) {\n stopEverything(e);\n }\n};\n\nconst enableElement = e => {\n let element;\n if (e instanceof Event) {\n if (isXhrRedirect(e)) {\n return;\n }\n element = e.target;\n } else {\n element = e;\n }\n if (isContentEditable(element)) {\n return;\n }\n if (matches(element, linkDisableSelector)) {\n return enableLinkElement(element);\n } else if (matches(element, buttonDisableSelector) || matches(element, formEnableSelector)) {\n return enableFormElement(element);\n } else if (matches(element, formSubmitSelector)) {\n return enableFormElements(element);\n }\n};\n\nconst disableElement = e => {\n const element = e instanceof Event ? e.target : e;\n if (isContentEditable(element)) {\n return;\n }\n if (matches(element, linkDisableSelector)) {\n return disableLinkElement(element);\n } else if (matches(element, buttonDisableSelector) || matches(element, formDisableSelector)) {\n return disableFormElement(element);\n } else if (matches(element, formSubmitSelector)) {\n return disableFormElements(element);\n }\n};\n\nvar disableLinkElement = function(element) {\n if (getData(element, \"ujs:disabled\")) {\n return;\n }\n const replacement = element.getAttribute(\"data-disable-with\");\n if (replacement != null) {\n setData(element, \"ujs:enable-with\", element.innerHTML);\n element.innerHTML = replacement;\n }\n element.addEventListener(\"click\", stopEverything);\n return setData(element, \"ujs:disabled\", true);\n};\n\nvar enableLinkElement = function(element) {\n const originalText = getData(element, \"ujs:enable-with\");\n if (originalText != null) {\n element.innerHTML = originalText;\n setData(element, \"ujs:enable-with\", null);\n }\n element.removeEventListener(\"click\", stopEverything);\n return setData(element, \"ujs:disabled\", null);\n};\n\nvar disableFormElements = form => formElements(form, formDisableSelector).forEach(disableFormElement);\n\nvar disableFormElement = function(element) {\n if (getData(element, \"ujs:disabled\")) {\n return;\n }\n const replacement = element.getAttribute(\"data-disable-with\");\n if (replacement != null) {\n if (matches(element, \"button\")) {\n setData(element, \"ujs:enable-with\", element.innerHTML);\n element.innerHTML = replacement;\n } else {\n setData(element, \"ujs:enable-with\", element.value);\n element.value = replacement;\n }\n }\n element.disabled = true;\n return setData(element, \"ujs:disabled\", true);\n};\n\nvar enableFormElements = form => formElements(form, formEnableSelector).forEach((element => enableFormElement(element)));\n\nvar enableFormElement = function(element) {\n const originalText = getData(element, \"ujs:enable-with\");\n if (originalText != null) {\n if (matches(element, \"button\")) {\n element.innerHTML = originalText;\n } else {\n element.value = originalText;\n }\n setData(element, \"ujs:enable-with\", null);\n }\n element.disabled = false;\n return setData(element, \"ujs:disabled\", null);\n};\n\nvar isXhrRedirect = function(event) {\n const xhr = event.detail ? event.detail[0] : undefined;\n return xhr && xhr.getResponseHeader(\"X-Xhr-Redirect\");\n};\n\nconst handleMethodWithRails = rails => function(e) {\n const link = this;\n const method = link.getAttribute(\"data-method\");\n if (!method) {\n return;\n }\n if (isContentEditable(this)) {\n return;\n }\n const href = rails.href(link);\n const csrfToken$1 = csrfToken();\n const csrfParam$1 = csrfParam();\n const form = document.createElement(\"form\");\n let formContent = ``;\n if (csrfParam$1 && csrfToken$1 && !isCrossDomain(href)) {\n formContent += ``;\n }\n formContent += '';\n form.method = \"post\";\n form.action = href;\n form.target = link.target;\n form.innerHTML = formContent;\n form.style.display = \"none\";\n document.body.appendChild(form);\n form.querySelector('[type=\"submit\"]').click();\n stopEverything(e);\n};\n\nconst isRemote = function(element) {\n const value = element.getAttribute(\"data-remote\");\n return value != null && value !== \"false\";\n};\n\nconst handleRemoteWithRails = rails => function(e) {\n let data, method, url;\n const element = this;\n if (!isRemote(element)) {\n return true;\n }\n if (!fire(element, \"ajax:before\")) {\n fire(element, \"ajax:stopped\");\n return false;\n }\n if (isContentEditable(element)) {\n fire(element, \"ajax:stopped\");\n return false;\n }\n const withCredentials = element.getAttribute(\"data-with-credentials\");\n const dataType = element.getAttribute(\"data-type\") || \"script\";\n if (matches(element, formSubmitSelector)) {\n const button = getData(element, \"ujs:submit-button\");\n method = getData(element, \"ujs:submit-button-formmethod\") || element.getAttribute(\"method\") || \"get\";\n url = getData(element, \"ujs:submit-button-formaction\") || element.getAttribute(\"action\") || location.href;\n if (method.toUpperCase() === \"GET\") {\n url = url.replace(/\\?.*$/, \"\");\n }\n if (element.enctype === \"multipart/form-data\") {\n data = new FormData(element);\n if (button != null) {\n data.append(button.name, button.value);\n }\n } else {\n data = serializeElement(element, button);\n }\n setData(element, \"ujs:submit-button\", null);\n setData(element, \"ujs:submit-button-formmethod\", null);\n setData(element, \"ujs:submit-button-formaction\", null);\n } else if (matches(element, buttonClickSelector) || matches(element, inputChangeSelector)) {\n method = element.getAttribute(\"data-method\");\n url = element.getAttribute(\"data-url\");\n data = serializeElement(element, element.getAttribute(\"data-params\"));\n } else {\n method = element.getAttribute(\"data-method\");\n url = rails.href(element);\n data = element.getAttribute(\"data-params\");\n }\n ajax({\n type: method || \"GET\",\n url: url,\n data: data,\n dataType: dataType,\n beforeSend(xhr, options) {\n if (fire(element, \"ajax:beforeSend\", [ xhr, options ])) {\n return fire(element, \"ajax:send\", [ xhr ]);\n } else {\n fire(element, \"ajax:stopped\");\n return false;\n }\n },\n success(...args) {\n return fire(element, \"ajax:success\", args);\n },\n error(...args) {\n return fire(element, \"ajax:error\", args);\n },\n complete(...args) {\n return fire(element, \"ajax:complete\", args);\n },\n crossDomain: isCrossDomain(url),\n withCredentials: withCredentials != null && withCredentials !== \"false\"\n });\n stopEverything(e);\n};\n\nconst formSubmitButtonClick = function(e) {\n const button = this;\n const {form: form} = button;\n if (!form) {\n return;\n }\n if (button.name) {\n setData(form, \"ujs:submit-button\", {\n name: button.name,\n value: button.value\n });\n }\n setData(form, \"ujs:formnovalidate-button\", button.formNoValidate);\n setData(form, \"ujs:submit-button-formaction\", button.getAttribute(\"formaction\"));\n return setData(form, \"ujs:submit-button-formmethod\", button.getAttribute(\"formmethod\"));\n};\n\nconst preventInsignificantClick = function(e) {\n const link = this;\n const method = (link.getAttribute(\"data-method\") || \"GET\").toUpperCase();\n const data = link.getAttribute(\"data-params\");\n const metaClick = e.metaKey || e.ctrlKey;\n const insignificantMetaClick = metaClick && method === \"GET\" && !data;\n const nonPrimaryMouseClick = e.button != null && e.button !== 0;\n if (nonPrimaryMouseClick || insignificantMetaClick) {\n e.stopImmediatePropagation();\n }\n};\n\nconst Rails = {\n $: $,\n ajax: ajax,\n buttonClickSelector: buttonClickSelector,\n buttonDisableSelector: buttonDisableSelector,\n confirm: confirm,\n cspNonce: cspNonce,\n csrfToken: csrfToken,\n csrfParam: csrfParam,\n CSRFProtection: CSRFProtection,\n delegate: delegate,\n disableElement: disableElement,\n enableElement: enableElement,\n fileInputSelector: fileInputSelector,\n fire: fire,\n formElements: formElements,\n formEnableSelector: formEnableSelector,\n formDisableSelector: formDisableSelector,\n formInputClickSelector: formInputClickSelector,\n formSubmitButtonClick: formSubmitButtonClick,\n formSubmitSelector: formSubmitSelector,\n getData: getData,\n handleDisabledElement: handleDisabledElement,\n href: href,\n inputChangeSelector: inputChangeSelector,\n isCrossDomain: isCrossDomain,\n linkClickSelector: linkClickSelector,\n linkDisableSelector: linkDisableSelector,\n loadCSPNonce: loadCSPNonce,\n matches: matches,\n preventInsignificantClick: preventInsignificantClick,\n refreshCSRFTokens: refreshCSRFTokens,\n serializeElement: serializeElement,\n setData: setData,\n stopEverything: stopEverything\n};\n\nconst handleConfirm = handleConfirmWithRails(Rails);\n\nRails.handleConfirm = handleConfirm;\n\nconst handleMethod = handleMethodWithRails(Rails);\n\nRails.handleMethod = handleMethod;\n\nconst handleRemote = handleRemoteWithRails(Rails);\n\nRails.handleRemote = handleRemote;\n\nconst start = function() {\n if (window._rails_loaded) {\n throw new Error(\"rails-ujs has already been loaded!\");\n }\n window.addEventListener(\"pageshow\", (function() {\n $(formEnableSelector).forEach((function(el) {\n if (getData(el, \"ujs:disabled\")) {\n enableElement(el);\n }\n }));\n $(linkDisableSelector).forEach((function(el) {\n if (getData(el, \"ujs:disabled\")) {\n enableElement(el);\n }\n }));\n }));\n delegate(document, linkDisableSelector, \"ajax:complete\", enableElement);\n delegate(document, linkDisableSelector, \"ajax:stopped\", enableElement);\n delegate(document, buttonDisableSelector, \"ajax:complete\", enableElement);\n delegate(document, buttonDisableSelector, \"ajax:stopped\", enableElement);\n delegate(document, linkClickSelector, \"click\", preventInsignificantClick);\n delegate(document, linkClickSelector, \"click\", handleDisabledElement);\n delegate(document, linkClickSelector, \"click\", handleConfirm);\n delegate(document, linkClickSelector, \"click\", disableElement);\n delegate(document, linkClickSelector, \"click\", handleRemote);\n delegate(document, linkClickSelector, \"click\", handleMethod);\n delegate(document, buttonClickSelector, \"click\", preventInsignificantClick);\n delegate(document, buttonClickSelector, \"click\", handleDisabledElement);\n delegate(document, buttonClickSelector, \"click\", handleConfirm);\n delegate(document, buttonClickSelector, \"click\", disableElement);\n delegate(document, buttonClickSelector, \"click\", handleRemote);\n delegate(document, inputChangeSelector, \"change\", handleDisabledElement);\n delegate(document, inputChangeSelector, \"change\", handleConfirm);\n delegate(document, inputChangeSelector, \"change\", handleRemote);\n delegate(document, formSubmitSelector, \"submit\", handleDisabledElement);\n delegate(document, formSubmitSelector, \"submit\", handleConfirm);\n delegate(document, formSubmitSelector, \"submit\", handleRemote);\n delegate(document, formSubmitSelector, \"submit\", (e => setTimeout((() => disableElement(e)), 13)));\n delegate(document, formSubmitSelector, \"ajax:send\", disableElement);\n delegate(document, formSubmitSelector, \"ajax:complete\", enableElement);\n delegate(document, formInputClickSelector, \"click\", preventInsignificantClick);\n delegate(document, formInputClickSelector, \"click\", handleDisabledElement);\n delegate(document, formInputClickSelector, \"click\", handleConfirm);\n delegate(document, formInputClickSelector, \"click\", formSubmitButtonClick);\n document.addEventListener(\"DOMContentLoaded\", refreshCSRFTokens);\n document.addEventListener(\"DOMContentLoaded\", loadCSPNonce);\n return window._rails_loaded = true;\n};\n\nRails.start = start;\n\nif (typeof jQuery !== \"undefined\" && jQuery && jQuery.ajax) {\n if (jQuery.rails) {\n throw new Error(\"If you load both jquery_ujs and rails-ujs, use rails-ujs only.\");\n }\n jQuery.rails = Rails;\n jQuery.ajaxPrefilter((function(options, originalOptions, xhr) {\n if (!options.crossDomain) {\n return CSRFProtection(xhr);\n }\n }));\n}\n\nexport { Rails as default };\n", "/**\n * --------------------------------------------------------------------------\n * Bootstrap (v4.3.1): tab.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport $ from 'jquery'\nimport Util from './util'\n\n/**\n * ------------------------------------------------------------------------\n * Constants\n * ------------------------------------------------------------------------\n */\n\nconst NAME = 'tab'\nconst VERSION = '4.3.1'\nconst DATA_KEY = 'bs.tab'\nconst EVENT_KEY = `.${DATA_KEY}`\nconst DATA_API_KEY = '.data-api'\nconst JQUERY_NO_CONFLICT = $.fn[NAME]\n\nconst Event = {\n HIDE : `hide${EVENT_KEY}`,\n HIDDEN : `hidden${EVENT_KEY}`,\n SHOW : `show${EVENT_KEY}`,\n SHOWN : `shown${EVENT_KEY}`,\n CLICK_DATA_API : `click${EVENT_KEY}${DATA_API_KEY}`\n}\n\nconst ClassName = {\n DROPDOWN_MENU : 'dropdown-menu',\n ACTIVE : 'active',\n DISABLED : 'disabled',\n FADE : 'fade',\n SHOW : 'show'\n}\n\nconst Selector = {\n DROPDOWN : '.dropdown',\n NAV_LIST_GROUP : '.nav, .list-group',\n ACTIVE : '.active',\n ACTIVE_UL : '> li > .active',\n DATA_TOGGLE : '[data-toggle=\"tab\"], [data-toggle=\"pill\"], [data-toggle=\"list\"]',\n DROPDOWN_TOGGLE : '.dropdown-toggle',\n DROPDOWN_ACTIVE_CHILD : '> .dropdown-menu .active'\n}\n\n/**\n * ------------------------------------------------------------------------\n * Class Definition\n * ------------------------------------------------------------------------\n */\n\nclass Tab {\n constructor(element) {\n this._element = element\n }\n\n // Getters\n\n static get VERSION() {\n return VERSION\n }\n\n // Public\n\n show() {\n if (this._element.parentNode &&\n this._element.parentNode.nodeType === Node.ELEMENT_NODE &&\n $(this._element).hasClass(ClassName.ACTIVE) ||\n $(this._element).hasClass(ClassName.DISABLED)) {\n return\n }\n\n let target\n let previous\n const listElement = $(this._element).closest(Selector.NAV_LIST_GROUP)[0]\n const selector = Util.getSelectorFromElement(this._element)\n\n if (listElement) {\n const itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? Selector.ACTIVE_UL : Selector.ACTIVE\n previous = $.makeArray($(listElement).find(itemSelector))\n previous = previous[previous.length - 1]\n }\n\n const hideEvent = $.Event(Event.HIDE, {\n relatedTarget: this._element\n })\n\n const showEvent = $.Event(Event.SHOW, {\n relatedTarget: previous\n })\n\n if (previous) {\n $(previous).trigger(hideEvent)\n }\n\n $(this._element).trigger(showEvent)\n\n if (showEvent.isDefaultPrevented() ||\n hideEvent.isDefaultPrevented()) {\n return\n }\n\n if (selector) {\n target = document.querySelector(selector)\n }\n\n this._activate(\n this._element,\n listElement\n )\n\n const complete = () => {\n const hiddenEvent = $.Event(Event.HIDDEN, {\n relatedTarget: this._element\n })\n\n const shownEvent = $.Event(Event.SHOWN, {\n relatedTarget: previous\n })\n\n $(previous).trigger(hiddenEvent)\n $(this._element).trigger(shownEvent)\n }\n\n if (target) {\n this._activate(target, target.parentNode, complete)\n } else {\n complete()\n }\n }\n\n dispose() {\n $.removeData(this._element, DATA_KEY)\n this._element = null\n }\n\n // Private\n\n _activate(element, container, callback) {\n const activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL')\n ? $(container).find(Selector.ACTIVE_UL)\n : $(container).children(Selector.ACTIVE)\n\n const active = activeElements[0]\n const isTransitioning = callback && (active && $(active).hasClass(ClassName.FADE))\n const complete = () => this._transitionComplete(\n element,\n active,\n callback\n )\n\n if (active && isTransitioning) {\n const transitionDuration = Util.getTransitionDurationFromElement(active)\n\n $(active)\n .removeClass(ClassName.SHOW)\n .one(Util.TRANSITION_END, complete)\n .emulateTransitionEnd(transitionDuration)\n } else {\n complete()\n }\n }\n\n _transitionComplete(element, active, callback) {\n if (active) {\n $(active).removeClass(ClassName.ACTIVE)\n\n const dropdownChild = $(active.parentNode).find(\n Selector.DROPDOWN_ACTIVE_CHILD\n )[0]\n\n if (dropdownChild) {\n $(dropdownChild).removeClass(ClassName.ACTIVE)\n }\n\n if (active.getAttribute('role') === 'tab') {\n active.setAttribute('aria-selected', false)\n }\n }\n\n $(element).addClass(ClassName.ACTIVE)\n if (element.getAttribute('role') === 'tab') {\n element.setAttribute('aria-selected', true)\n }\n\n Util.reflow(element)\n\n if (element.classList.contains(ClassName.FADE)) {\n element.classList.add(ClassName.SHOW)\n }\n\n if (element.parentNode && $(element.parentNode).hasClass(ClassName.DROPDOWN_MENU)) {\n const dropdownElement = $(element).closest(Selector.DROPDOWN)[0]\n\n if (dropdownElement) {\n const dropdownToggleList = [].slice.call(dropdownElement.querySelectorAll(Selector.DROPDOWN_TOGGLE))\n\n $(dropdownToggleList).addClass(ClassName.ACTIVE)\n }\n\n element.setAttribute('aria-expanded', true)\n }\n\n if (callback) {\n callback()\n }\n }\n\n // Static\n\n static _jQueryInterface(config) {\n return this.each(function () {\n const $this = $(this)\n let data = $this.data(DATA_KEY)\n\n if (!data) {\n data = new Tab(this)\n $this.data(DATA_KEY, data)\n }\n\n if (typeof config === 'string') {\n if (typeof data[config] === 'undefined') {\n throw new TypeError(`No method named \"${config}\"`)\n }\n data[config]()\n }\n })\n }\n}\n\n/**\n * ------------------------------------------------------------------------\n * Data Api implementation\n * ------------------------------------------------------------------------\n */\n\n$(document)\n .on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {\n event.preventDefault()\n Tab._jQueryInterface.call($(this), 'show')\n })\n\n/**\n * ------------------------------------------------------------------------\n * jQuery\n * ------------------------------------------------------------------------\n */\n\n$.fn[NAME] = Tab._jQueryInterface\n$.fn[NAME].Constructor = Tab\n$.fn[NAME].noConflict = () => {\n $.fn[NAME] = JQUERY_NO_CONFLICT\n return Tab._jQueryInterface\n}\n\nexport default Tab\n", "/**\n * --------------------------------------------------------------------------\n * Bootstrap (v4.3.1): util.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport $ from 'jquery'\n\n/**\n * ------------------------------------------------------------------------\n * Private TransitionEnd Helpers\n * ------------------------------------------------------------------------\n */\n\nconst TRANSITION_END = 'transitionend'\nconst MAX_UID = 1000000\nconst MILLISECONDS_MULTIPLIER = 1000\n\n// Shoutout AngusCroll (https://goo.gl/pxwQGp)\nfunction toType(obj) {\n return {}.toString.call(obj).match(/\\s([a-z]+)/i)[1].toLowerCase()\n}\n\nfunction getSpecialTransitionEndEvent() {\n return {\n bindType: TRANSITION_END,\n delegateType: TRANSITION_END,\n handle(event) {\n if ($(event.target).is(this)) {\n return event.handleObj.handler.apply(this, arguments) // eslint-disable-line prefer-rest-params\n }\n return undefined // eslint-disable-line no-undefined\n }\n }\n}\n\nfunction transitionEndEmulator(duration) {\n let called = false\n\n $(this).one(Util.TRANSITION_END, () => {\n called = true\n })\n\n setTimeout(() => {\n if (!called) {\n Util.triggerTransitionEnd(this)\n }\n }, duration)\n\n return this\n}\n\nfunction setTransitionEndSupport() {\n $.fn.emulateTransitionEnd = transitionEndEmulator\n $.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent()\n}\n\n/**\n * --------------------------------------------------------------------------\n * Public Util Api\n * --------------------------------------------------------------------------\n */\n\nconst Util = {\n\n TRANSITION_END: 'bsTransitionEnd',\n\n getUID(prefix) {\n do {\n // eslint-disable-next-line no-bitwise\n prefix += ~~(Math.random() * MAX_UID) // \"~~\" acts like a faster Math.floor() here\n } while (document.getElementById(prefix))\n return prefix\n },\n\n getSelectorFromElement(element) {\n let selector = element.getAttribute('data-target')\n\n if (!selector || selector === '#') {\n const hrefAttr = element.getAttribute('href')\n selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : ''\n }\n\n try {\n return document.querySelector(selector) ? selector : null\n } catch (err) {\n return null\n }\n },\n\n getTransitionDurationFromElement(element) {\n if (!element) {\n return 0\n }\n\n // Get transition-duration of the element\n let transitionDuration = $(element).css('transition-duration')\n let transitionDelay = $(element).css('transition-delay')\n\n const floatTransitionDuration = parseFloat(transitionDuration)\n const floatTransitionDelay = parseFloat(transitionDelay)\n\n // Return 0 if element or transition duration is not found\n if (!floatTransitionDuration && !floatTransitionDelay) {\n return 0\n }\n\n // If multiple durations are defined, take the first\n transitionDuration = transitionDuration.split(',')[0]\n transitionDelay = transitionDelay.split(',')[0]\n\n return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER\n },\n\n reflow(element) {\n return element.offsetHeight\n },\n\n triggerTransitionEnd(element) {\n $(element).trigger(TRANSITION_END)\n },\n\n // TODO: Remove in v5\n supportsTransitionEnd() {\n return Boolean(TRANSITION_END)\n },\n\n isElement(obj) {\n return (obj[0] || obj).nodeType\n },\n\n typeCheckConfig(componentName, config, configTypes) {\n for (const property in configTypes) {\n if (Object.prototype.hasOwnProperty.call(configTypes, property)) {\n const expectedTypes = configTypes[property]\n const value = config[property]\n const valueType = value && Util.isElement(value)\n ? 'element' : toType(value)\n\n if (!new RegExp(expectedTypes).test(valueType)) {\n throw new Error(\n `${componentName.toUpperCase()}: ` +\n `Option \"${property}\" provided type \"${valueType}\" ` +\n `but expected type \"${expectedTypes}\".`)\n }\n }\n }\n },\n\n findShadowRoot(element) {\n if (!document.documentElement.attachShadow) {\n return null\n }\n\n // Can find the shadow root otherwise it'll return the document\n if (typeof element.getRootNode === 'function') {\n const root = element.getRootNode()\n return root instanceof ShadowRoot ? root : null\n }\n\n if (element instanceof ShadowRoot) {\n return element\n }\n\n // when we don't find a shadow root\n if (!element.parentNode) {\n return null\n }\n\n return Util.findShadowRoot(element.parentNode)\n }\n}\n\nsetTransitionEndSupport()\n\nexport default Util\n", "/**\n * --------------------------------------------------------------------------\n * Bootstrap (v4.3.1): collapse.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport $ from 'jquery'\nimport Util from './util'\n\n/**\n * ------------------------------------------------------------------------\n * Constants\n * ------------------------------------------------------------------------\n */\n\nconst NAME = 'collapse'\nconst VERSION = '4.3.1'\nconst DATA_KEY = 'bs.collapse'\nconst EVENT_KEY = `.${DATA_KEY}`\nconst DATA_API_KEY = '.data-api'\nconst JQUERY_NO_CONFLICT = $.fn[NAME]\n\nconst Default = {\n toggle : true,\n parent : ''\n}\n\nconst DefaultType = {\n toggle : 'boolean',\n parent : '(string|element)'\n}\n\nconst Event = {\n SHOW : `show${EVENT_KEY}`,\n SHOWN : `shown${EVENT_KEY}`,\n HIDE : `hide${EVENT_KEY}`,\n HIDDEN : `hidden${EVENT_KEY}`,\n CLICK_DATA_API : `click${EVENT_KEY}${DATA_API_KEY}`\n}\n\nconst ClassName = {\n SHOW : 'show',\n COLLAPSE : 'collapse',\n COLLAPSING : 'collapsing',\n COLLAPSED : 'collapsed'\n}\n\nconst Dimension = {\n WIDTH : 'width',\n HEIGHT : 'height'\n}\n\nconst Selector = {\n ACTIVES : '.show, .collapsing',\n DATA_TOGGLE : '[data-toggle=\"collapse\"]'\n}\n\n/**\n * ------------------------------------------------------------------------\n * Class Definition\n * ------------------------------------------------------------------------\n */\n\nclass Collapse {\n constructor(element, config) {\n this._isTransitioning = false\n this._element = element\n this._config = this._getConfig(config)\n this._triggerArray = [].slice.call(document.querySelectorAll(\n `[data-toggle=\"collapse\"][href=\"#${element.id}\"],` +\n `[data-toggle=\"collapse\"][data-target=\"#${element.id}\"]`\n ))\n\n const toggleList = [].slice.call(document.querySelectorAll(Selector.DATA_TOGGLE))\n for (let i = 0, len = toggleList.length; i < len; i++) {\n const elem = toggleList[i]\n const selector = Util.getSelectorFromElement(elem)\n const filterElement = [].slice.call(document.querySelectorAll(selector))\n .filter((foundElem) => foundElem === element)\n\n if (selector !== null && filterElement.length > 0) {\n this._selector = selector\n this._triggerArray.push(elem)\n }\n }\n\n this._parent = this._config.parent ? this._getParent() : null\n\n if (!this._config.parent) {\n this._addAriaAndCollapsedClass(this._element, this._triggerArray)\n }\n\n if (this._config.toggle) {\n this.toggle()\n }\n }\n\n // Getters\n\n static get VERSION() {\n return VERSION\n }\n\n static get Default() {\n return Default\n }\n\n // Public\n\n toggle() {\n if ($(this._element).hasClass(ClassName.SHOW)) {\n this.hide()\n } else {\n this.show()\n }\n }\n\n show() {\n if (this._isTransitioning ||\n $(this._element).hasClass(ClassName.SHOW)) {\n return\n }\n\n let actives\n let activesData\n\n if (this._parent) {\n actives = [].slice.call(this._parent.querySelectorAll(Selector.ACTIVES))\n .filter((elem) => {\n if (typeof this._config.parent === 'string') {\n return elem.getAttribute('data-parent') === this._config.parent\n }\n\n return elem.classList.contains(ClassName.COLLAPSE)\n })\n\n if (actives.length === 0) {\n actives = null\n }\n }\n\n if (actives) {\n activesData = $(actives).not(this._selector).data(DATA_KEY)\n if (activesData && activesData._isTransitioning) {\n return\n }\n }\n\n const startEvent = $.Event(Event.SHOW)\n $(this._element).trigger(startEvent)\n if (startEvent.isDefaultPrevented()) {\n return\n }\n\n if (actives) {\n Collapse._jQueryInterface.call($(actives).not(this._selector), 'hide')\n if (!activesData) {\n $(actives).data(DATA_KEY, null)\n }\n }\n\n const dimension = this._getDimension()\n\n $(this._element)\n .removeClass(ClassName.COLLAPSE)\n .addClass(ClassName.COLLAPSING)\n\n this._element.style[dimension] = 0\n\n if (this._triggerArray.length) {\n $(this._triggerArray)\n .removeClass(ClassName.COLLAPSED)\n .attr('aria-expanded', true)\n }\n\n this.setTransitioning(true)\n\n const complete = () => {\n $(this._element)\n .removeClass(ClassName.COLLAPSING)\n .addClass(ClassName.COLLAPSE)\n .addClass(ClassName.SHOW)\n\n this._element.style[dimension] = ''\n\n this.setTransitioning(false)\n\n $(this._element).trigger(Event.SHOWN)\n }\n\n const capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1)\n const scrollSize = `scroll${capitalizedDimension}`\n const transitionDuration = Util.getTransitionDurationFromElement(this._element)\n\n $(this._element)\n .one(Util.TRANSITION_END, complete)\n .emulateTransitionEnd(transitionDuration)\n\n this._element.style[dimension] = `${this._element[scrollSize]}px`\n }\n\n hide() {\n if (this._isTransitioning ||\n !$(this._element).hasClass(ClassName.SHOW)) {\n return\n }\n\n const startEvent = $.Event(Event.HIDE)\n $(this._element).trigger(startEvent)\n if (startEvent.isDefaultPrevented()) {\n return\n }\n\n const dimension = this._getDimension()\n\n this._element.style[dimension] = `${this._element.getBoundingClientRect()[dimension]}px`\n\n Util.reflow(this._element)\n\n $(this._element)\n .addClass(ClassName.COLLAPSING)\n .removeClass(ClassName.COLLAPSE)\n .removeClass(ClassName.SHOW)\n\n const triggerArrayLength = this._triggerArray.length\n if (triggerArrayLength > 0) {\n for (let i = 0; i < triggerArrayLength; i++) {\n const trigger = this._triggerArray[i]\n const selector = Util.getSelectorFromElement(trigger)\n\n if (selector !== null) {\n const $elem = $([].slice.call(document.querySelectorAll(selector)))\n if (!$elem.hasClass(ClassName.SHOW)) {\n $(trigger).addClass(ClassName.COLLAPSED)\n .attr('aria-expanded', false)\n }\n }\n }\n }\n\n this.setTransitioning(true)\n\n const complete = () => {\n this.setTransitioning(false)\n $(this._element)\n .removeClass(ClassName.COLLAPSING)\n .addClass(ClassName.COLLAPSE)\n .trigger(Event.HIDDEN)\n }\n\n this._element.style[dimension] = ''\n const transitionDuration = Util.getTransitionDurationFromElement(this._element)\n\n $(this._element)\n .one(Util.TRANSITION_END, complete)\n .emulateTransitionEnd(transitionDuration)\n }\n\n setTransitioning(isTransitioning) {\n this._isTransitioning = isTransitioning\n }\n\n dispose() {\n $.removeData(this._element, DATA_KEY)\n\n this._config = null\n this._parent = null\n this._element = null\n this._triggerArray = null\n this._isTransitioning = null\n }\n\n // Private\n\n _getConfig(config) {\n config = {\n ...Default,\n ...config\n }\n config.toggle = Boolean(config.toggle) // Coerce string values\n Util.typeCheckConfig(NAME, config, DefaultType)\n return config\n }\n\n _getDimension() {\n const hasWidth = $(this._element).hasClass(Dimension.WIDTH)\n return hasWidth ? Dimension.WIDTH : Dimension.HEIGHT\n }\n\n _getParent() {\n let parent\n\n if (Util.isElement(this._config.parent)) {\n parent = this._config.parent\n\n // It's a jQuery object\n if (typeof this._config.parent.jquery !== 'undefined') {\n parent = this._config.parent[0]\n }\n } else {\n parent = document.querySelector(this._config.parent)\n }\n\n const selector =\n `[data-toggle=\"collapse\"][data-parent=\"${this._config.parent}\"]`\n\n const children = [].slice.call(parent.querySelectorAll(selector))\n $(children).each((i, element) => {\n this._addAriaAndCollapsedClass(\n Collapse._getTargetFromElement(element),\n [element]\n )\n })\n\n return parent\n }\n\n _addAriaAndCollapsedClass(element, triggerArray) {\n const isOpen = $(element).hasClass(ClassName.SHOW)\n\n if (triggerArray.length) {\n $(triggerArray)\n .toggleClass(ClassName.COLLAPSED, !isOpen)\n .attr('aria-expanded', isOpen)\n }\n }\n\n // Static\n\n static _getTargetFromElement(element) {\n const selector = Util.getSelectorFromElement(element)\n return selector ? document.querySelector(selector) : null\n }\n\n static _jQueryInterface(config) {\n return this.each(function () {\n const $this = $(this)\n let data = $this.data(DATA_KEY)\n const _config = {\n ...Default,\n ...$this.data(),\n ...typeof config === 'object' && config ? config : {}\n }\n\n if (!data && _config.toggle && /show|hide/.test(config)) {\n _config.toggle = false\n }\n\n if (!data) {\n data = new Collapse(this, _config)\n $this.data(DATA_KEY, data)\n }\n\n if (typeof config === 'string') {\n if (typeof data[config] === 'undefined') {\n throw new TypeError(`No method named \"${config}\"`)\n }\n data[config]()\n }\n })\n }\n}\n\n/**\n * ------------------------------------------------------------------------\n * Data Api implementation\n * ------------------------------------------------------------------------\n */\n\n$(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {\n // preventDefault only for elements (which change the URL) not inside the collapsible element\n if (event.currentTarget.tagName === 'A') {\n event.preventDefault()\n }\n\n const $trigger = $(this)\n const selector = Util.getSelectorFromElement(this)\n const selectors = [].slice.call(document.querySelectorAll(selector))\n\n $(selectors).each(function () {\n const $target = $(this)\n const data = $target.data(DATA_KEY)\n const config = data ? 'toggle' : $trigger.data()\n Collapse._jQueryInterface.call($target, config)\n })\n})\n\n/**\n * ------------------------------------------------------------------------\n * jQuery\n * ------------------------------------------------------------------------\n */\n\n$.fn[NAME] = Collapse._jQueryInterface\n$.fn[NAME].Constructor = Collapse\n$.fn[NAME].noConflict = () => {\n $.fn[NAME] = JQUERY_NO_CONFLICT\n return Collapse._jQueryInterface\n}\n\nexport default Collapse\n", "(function(){function diff_match_patch(){this.Diff_Timeout=1;this.Diff_EditCost=4;this.Match_Threshold=0.5;this.Match_Distance=1E3;this.Patch_DeleteThreshold=0.5;this.Patch_Margin=4;this.Match_MaxBits=32}\ndiff_match_patch.prototype.diff_main=function(a,b,c,d){\"undefined\"==typeof d&&(d=0>=this.Diff_Timeout?Number.MAX_VALUE:(new Date).getTime()+1E3*this.Diff_Timeout);if(null==a||null==b)throw Error(\"Null input. (diff_main)\");if(a==b)return a?[[0,a]]:[];\"undefined\"==typeof c&&(c=!0);var e=c,f=this.diff_commonPrefix(a,b);c=a.substring(0,f);a=a.substring(f);b=b.substring(f);var f=this.diff_commonSuffix(a,b),g=a.substring(a.length-f);a=a.substring(0,a.length-f);b=b.substring(0,b.length-f);a=this.diff_compute_(a,\nb,e,d);c&&a.unshift([0,c]);g&&a.push([0,g]);this.diff_cleanupMerge(a);return a};\ndiff_match_patch.prototype.diff_compute_=function(a,b,c,d){if(!a)return[[1,b]];if(!b)return[[-1,a]];var e=a.length>b.length?a:b,f=a.length>b.length?b:a,g=e.indexOf(f);return-1!=g?(c=[[1,e.substring(0,g)],[0,f],[1,e.substring(g+f.length)]],a.length>b.length&&(c[0][0]=c[2][0]=-1),c):1==f.length?[[-1,a],[1,b]]:(e=this.diff_halfMatch_(a,b))?(f=e[0],a=e[1],g=e[2],b=e[3],e=e[4],f=this.diff_main(f,g,c,d),c=this.diff_main(a,b,c,d),f.concat([[0,e]],c)):c&&100c);v++){for(var n=-v+r;n<=v-t;n+=2){var l=g+n,m;m=n==-v||n!=v&&j[l-1]d)t+=2;else if(s>e)r+=2;else if(q&&(l=g+k-n,0<=l&&l=\nu)return this.diff_bisectSplit_(a,b,m,s,c)}}for(n=-v+p;n<=v-w;n+=2){l=g+n;u=n==-v||n!=v&&i[l-1]d)w+=2;else if(m>e)p+=2;else if(!q&&(l=g+k-n,0<=l&&(l=u)))return this.diff_bisectSplit_(a,b,m,s,c)}}return[[-1,a],[1,b]]};\ndiff_match_patch.prototype.diff_bisectSplit_=function(a,b,c,d,e){var f=a.substring(0,c),g=b.substring(0,d);a=a.substring(c);b=b.substring(d);f=this.diff_main(f,g,!1,e);e=this.diff_main(a,b,!1,e);return f.concat(e)};\ndiff_match_patch.prototype.diff_linesToChars_=function(a,b){function c(a){for(var b=\"\",c=0,f=-1,g=d.length;fd?a=a.substring(c-d):c=a.length?[h,j,n,l,g]:null}if(0>=this.Diff_Timeout)return null;\nvar d=a.length>b.length?a:b,e=a.length>b.length?b:a;if(4>d.length||2*e.lengthd[4].length?g:d:d:g;var j;a.length>b.length?(g=h[0],d=h[1],e=h[2],j=h[3]):(e=h[0],j=h[1],g=h[2],d=h[3]);h=h[4];return[g,d,e,j,h]};\ndiff_match_patch.prototype.diff_cleanupSemantic=function(a){for(var b=!1,c=[],d=0,e=null,f=0,g=0,h=0,j=0,i=0;f=e){if(d>=b.length/2||d>=c.length/2)a.splice(f,0,[0,c.substring(0,d)]),a[f-1][1]=b.substring(0,b.length-d),a[f+1][1]=c.substring(d),f++}else if(e>=b.length/2||e>=c.length/2)a.splice(f,0,[0,b.substring(0,e)]),a[f-1][0]=1,a[f-1][1]=c.substring(0,c.length-e),a[f+1][0]=-1,a[f+1][1]=b.substring(e),f++;f++}f++}};\ndiff_match_patch.prototype.diff_cleanupSemanticLossless=function(a){function b(a,b){if(!a||!b)return 6;var c=a.charAt(a.length-1),d=b.charAt(0),e=c.match(diff_match_patch.nonAlphaNumericRegex_),f=d.match(diff_match_patch.nonAlphaNumericRegex_),g=e&&c.match(diff_match_patch.whitespaceRegex_),h=f&&d.match(diff_match_patch.whitespaceRegex_),c=g&&c.match(diff_match_patch.linebreakRegex_),d=h&&d.match(diff_match_patch.linebreakRegex_),i=c&&a.match(diff_match_patch.blanklineEndRegex_),j=d&&b.match(diff_match_patch.blanklineStartRegex_);\nreturn i||j?5:c||d?4:e&&!g&&h?3:g||h?2:e||f?1:0}for(var c=1;c=i&&(i=k,g=d,h=e,j=f)}a[c-1][1]!=g&&(g?a[c-1][1]=g:(a.splice(c-1,1),c--),a[c][1]=\nh,j?a[c+1][1]=j:(a.splice(c+1,1),c--))}c++}};diff_match_patch.nonAlphaNumericRegex_=/[^a-zA-Z0-9]/;diff_match_patch.whitespaceRegex_=/\\s/;diff_match_patch.linebreakRegex_=/[\\r\\n]/;diff_match_patch.blanklineEndRegex_=/\\n\\r?\\n$/;diff_match_patch.blanklineStartRegex_=/^\\r?\\n\\r?\\n/;\ndiff_match_patch.prototype.diff_cleanupEfficiency=function(a){for(var b=!1,c=[],d=0,e=null,f=0,g=!1,h=!1,j=!1,i=!1;fb)break;e=c;f=d}return a.length!=g&&-1===a[g][0]?f:f+(b-e)};\ndiff_match_patch.prototype.diff_prettyHtml=function(a){for(var b=[],c=/&/g,d=//g,f=/\\n/g,g=0;g\");switch(h){case 1:b[g]=''+j+\"\";break;case -1:b[g]=''+j+\"\";break;case 0:b[g]=\"\"+j+\"\"}}return b.join(\"\")};\ndiff_match_patch.prototype.diff_text1=function(a){for(var b=[],c=0;ci)throw Error(\"Invalid number in diff_fromDelta: \"+h);h=a.substring(e,e+=i);\"=\"==f[g].charAt(0)?c[d++]=[0,h]:c[d++]=[-1,h];break;default:if(f[g])throw Error(\"Invalid diff operation in diff_fromDelta: \"+\nf[g]);}}if(e!=a.length)throw Error(\"Delta length (\"+e+\") does not equal source text length (\"+a.length+\").\");return c};diff_match_patch.prototype.match_main=function(a,b,c){if(null==a||null==b||null==c)throw Error(\"Null input. (match_main)\");c=Math.max(0,Math.min(c,a.length));return a==b?0:a.length?a.substring(c,c+b.length)==b?c:this.match_bitap_(a,b,c):-1};\ndiff_match_patch.prototype.match_bitap_=function(a,b,c){function d(a,d){var e=a/b.length,g=Math.abs(c-d);return!f.Match_Distance?g?1:e:e+g/f.Match_Distance}if(b.length>this.Match_MaxBits)throw Error(\"Pattern too long for this browser.\");var e=this.match_alphabet_(b),f=this,g=this.Match_Threshold,h=a.indexOf(b,c);-1!=h&&(g=Math.min(d(0,h),g),h=a.lastIndexOf(b,c+b.length),-1!=h&&(g=Math.min(d(0,h),g)));for(var j=1<=i;p--){var w=e[a.charAt(p-1)];k[p]=0===t?(k[p+1]<<1|1)&w:(k[p+1]<<1|1)&w|((r[p+1]|r[p])<<1|1)|r[p+1];if(k[p]&j&&(w=d(t,p-1),w<=g))if(g=w,h=p-1,h>c)i=Math.max(1,2*c-h);else break}if(d(t+1,c)>g)break;r=k}return h};\ndiff_match_patch.prototype.match_alphabet_=function(a){for(var b={},c=0;c=2*this.Patch_Margin&&\ne&&(this.patch_addContext_(a,h),c.push(a),a=new diff_match_patch.patch_obj,e=0,h=d,f=g)}1!==i&&(f+=k.length);-1!==i&&(g+=k.length)}e&&(this.patch_addContext_(a,h),c.push(a));return c};diff_match_patch.prototype.patch_deepCopy=function(a){for(var b=[],c=0;cthis.Match_MaxBits){if(j=this.match_main(b,h.substring(0,this.Match_MaxBits),g),-1!=j&&(i=this.match_main(b,h.substring(h.length-this.Match_MaxBits),g+h.length-this.Match_MaxBits),-1==i||j>=i))j=-1}else j=this.match_main(b,h,g);\nif(-1==j)e[f]=!1,d-=a[f].length2-a[f].length1;else if(e[f]=!0,d=j-g,g=-1==i?b.substring(j,j+h.length):b.substring(j,i+this.Match_MaxBits),h==g)b=b.substring(0,j)+this.diff_text2(a[f].diffs)+b.substring(j+h.length);else if(g=this.diff_main(h,g,!1),h.length>this.Match_MaxBits&&this.diff_levenshtein(g)/h.length>this.Patch_DeleteThreshold)e[f]=!1;else{this.diff_cleanupSemanticLossless(g);for(var h=0,k,i=0;ie[0][1].length){var f=b-e[0][1].length;e[0][1]=c.substring(e[0][1].length)+e[0][1];d.start1-=f;d.start2-=f;d.length1+=f;d.length2+=f}d=a[a.length-1];e=d.diffs;0==e.length||0!=e[e.length-1][0]?(e.push([0,\nc]),d.length1+=b,d.length2+=b):b>e[e.length-1][1].length&&(f=b-e[e.length-1][1].length,e[e.length-1][1]+=c.substring(0,f),d.length1+=f,d.length2+=f);return c};\ndiff_match_patch.prototype.patch_splitMax=function(a){for(var b=this.Match_MaxBits,c=0;c2*b?(h.length1+=i.length,e+=i.length,j=!1,h.diffs.push([g,i]),d.diffs.shift()):(i=i.substring(0,b-h.length1-this.Patch_Margin),h.length1+=i.length,e+=i.length,0===g?(h.length2+=i.length,f+=i.length):j=!1,h.diffs.push([g,i]),i==d.diffs[0][1]?d.diffs.shift():d.diffs[0][1]=d.diffs[0][1].substring(i.length))}g=this.diff_text2(h.diffs);g=g.substring(g.length-this.Patch_Margin);i=this.diff_text1(d.diffs).substring(0,this.Patch_Margin);\"\"!==i&&\n(h.length1+=i.length,h.length2+=i.length,0!==h.diffs.length&&0===h.diffs[h.diffs.length-1][0]?h.diffs[h.diffs.length-1][1]+=i:h.diffs.push([0,i]));j||a.splice(++c,0,h)}}};diff_match_patch.prototype.patch_toText=function(a){for(var b=[],c=0;c-1;z--){var e=h[z],a=(e.tagName||\"\").toUpperCase();[\"STYLE\",\"LINK\"].indexOf(a)>-1&&(v=e)}return K.head.insertBefore(l,v),c}}function v(){return++Cc}function z(c){for(var l=[],h=(c||[]).length>>>0;h--;)l[h]=c[h];return l}function e(c){return c.classList?z(c.classList):(c.getAttribute(\"class\")||\"\").split(\" \").filter(function(c){return c})}function a(c,h){var v=h.split(\"-\"),z=v[0],e=v.slice(1).join(\"-\");return z!==c||\"\"===e||l(e)?null:e}function m(c){return(\"\"+c).replace(/&/g,\"&\").replace(/\"/g,\""\").replace(/'/g,\"'\").replace(//g,\">\")}function t(c){return Object.keys(c||{}).reduce(function(l,h){return l+(h+'=\"')+m(c[h])+'\" '},\"\").trim()}function s(c){return Object.keys(c||{}).reduce(function(l,h){return l+(h+\": \")+c[h]+\";\"},\"\")}function r(c){return c.size!==Vc.size||c.x!==Vc.x||c.y!==Vc.y||c.rotate!==Vc.rotate||c.flipX||c.flipY}function f(c){var l=c.transform,h=c.containerWidth,v=c.iconWidth;return{outer:{transform:\"translate(\"+h/2+\" 256)\"},inner:{transform:\"translate(\"+32*l.x+\", \"+32*l.y+\") \"+\" \"+(\"scale(\"+l.size/16*(l.flipX?-1:1)+\", \"+l.size/16*(l.flipY?-1:1)+\") \")+\" \"+(\"rotate(\"+l.rotate+\" 0 0)\")},path:{transform:\"translate(\"+v/2*-1+\" -256)\"}}}function M(c){var l=c.transform,h=c.width,v=void 0===h?$:h,z=c.height,e=void 0===z?$:z,a=c.startCentered,m=void 0!==a&&a,t=\"\";return t+=m&&Z?\"translate(\"+(l.x/oc-v/2)+\"em, \"+(l.y/oc-e/2)+\"em) \":m?\"translate(calc(-50% + \"+l.x/oc+\"em), calc(-50% + \"+l.y/oc+\"em)) \":\"translate(\"+l.x/oc+\"em, \"+l.y/oc+\"em) \",t+=\"scale(\"+l.size/oc*(l.flipX?-1:1)+\", \"+l.size/oc*(l.flipY?-1:1)+\") \",t+=\"rotate(\"+l.rotate+\"deg) \"}function i(c){var l,h=c.icons,z=h.main,e=h.mask,a=c.prefix,m=c.iconName,t=c.transform,s=c.symbol,r=c.title,f=c.extra,M=e.found?e:z,i=M.width,n=M.height,H=\"fa-w-\"+Math.ceil(i/n*16),o=[Hc.replacementClass,m?Hc.familyPrefix+\"-\"+m:\"\",H].concat(f.classes).join(\" \"),V={children:[],attributes:fc({},f.attributes,(l={},rc(l,cc,\"\"),rc(l,\"data-prefix\",a),rc(l,\"data-icon\",m),rc(l,\"class\",o),rc(l,\"role\",\"img\"),rc(l,\"xmlns\",\"http://www.w3.org/2000/svg\"),rc(l,\"viewBox\",\"0 0 \"+i+\" \"+n),l))};r&&V.children.push({tag:\"title\",attributes:{id:V.attributes[\"aria-labelledby\"]||\"title-\"+v()},children:[r]});var C=fc({},V,{prefix:a,iconName:m,main:z,mask:e,transform:t,symbol:s,styles:f.styles}),L=e.found&&z.found?uc(C):dc(C),u=L.children,d=L.attributes;return C.children=u,C.attributes=d,s?gc(C):pc(C)}function n(c){var l,h=c.content,v=c.width,z=c.height,e=c.transform,a=c.title,m=c.extra,t=fc({},m.attributes,a?{title:a}:{},(l={},rc(l,cc,\"\"),rc(l,\"class\",m.classes.join(\" \")),l)),f=fc({},m.styles);r(e)&&(f.transform=M({transform:e,startCentered:!0,width:v,height:z}),f[\"-webkit-transform\"]=f.transform);var i=s(f);i.length>0&&(t.style=i);var n=[];return n.push({tag:\"span\",attributes:t,children:[h]}),a&&n.push({tag:\"span\",attributes:{class:\"sr-only\"},children:[a]}),n}function H(c,l){return Nc[c][l]}function o(c,l){return qc[c][l]}function V(c){return Tc[c]||{prefix:null,iconName:null}}function C(c){return c.reduce(function(c,l){var h=a(Hc.familyPrefix,l);if(Fc[l])c.prefix=l;else if(h){var v=\"fa\"===c.prefix?V(h):{};c.iconName=v.iconName||h,c.prefix=v.prefix||c.prefix}else l!==Hc.replacementClass&&0!==l.indexOf(\"fa-w-\")&&c.rest.push(l);return c},Wc())}function L(c,l,h){if(c&&c[l]&&c[l][h])return{prefix:l,iconName:h,icon:c[l][h]}}function u(c){var l=c.tag,h=c.attributes,v=void 0===h?{}:h,z=c.children,e=void 0===z?[]:z;return\"string\"==typeof c?m(c):\"<\"+l+\" \"+t(v)+\">\"+e.map(u).join(\"\")+\"\"+l+\">\"}function d(c){var l=c.getAttribute?c.getAttribute(\"class\"):null;return!!l&&(!!~l.toString().indexOf(Hc.replacementClass)||~l.toString().indexOf(\"fa-layers-text\"))}function p(){return!0===Hc.autoReplaceSvg?Ic.replace:Ic[Hc.autoReplaceSvg]||Ic.replace}function g(c,l){var h=\"function\"==typeof l?l:Pc;0===c.length?h():(U.requestAnimationFrame||function(c){return c()})(function(){var l=p(),v=kc.begin(\"mutate\");c.map(l),v(),h()})}function b(c){Rc=!0,c(),Rc=!1}function w(c){if(G){var l=c.treeCallback,h=c.nodeCallback,v=c.pseudoElementsCallback,a=new G(function(c){Rc||z(c).forEach(function(c){if(\"childList\"===c.type&&c.addedNodes.length>0&&!d(c.addedNodes[0])&&(Hc.searchPseudoElements&&v(c.target),l(c.target)),\"attributes\"===c.type&&\"class\"===c.attributeName&&c.target.parentNode&&Hc.searchPseudoElements&&v(c.target.parentNode),\"attributes\"===c.type&&d(c.target)&&~ac.indexOf(c.attributeName))if(\"class\"===c.attributeName){var z=C(e(c.target)),a=z.prefix,m=z.iconName;a&&c.target.setAttribute(\"data-prefix\",a),m&&c.target.setAttribute(\"data-icon\",m)}else h(c.target)})});K.getElementsByTagName&&a.observe(K.getElementsByTagName(\"body\")[0],{childList:!0,attributes:!0,characterData:!0,subtree:!0})}}function y(c){for(var l=\"\",h=0;h1&&void 0!==arguments[1]?arguments[1]:null,h=K.documentElement.classList,v=function(c){return h.add(hc+\"-\"+c)},e=function(c){return h.remove(hc+\"-\"+c)},a=Object.keys(ll),m=[\".\"+hl+\":not([\"+cc+\"])\"].concat(a.map(function(c){return\".\"+c+\":not([\"+cc+\"])\"})).join(\", \");if(0!==m.length){var t=z(c.querySelectorAll(m));if(t.length>0){v(\"pending\"),e(\"complete\");var s=kc.begin(\"onTree\"),r=t.reduce(function(c,l){try{var h=O(l);h&&c.push(h)}catch(c){vc||c instanceof _&&console.error(c)}return c},[]);s(),g(r,function(){v(\"active\"),v(\"complete\"),e(\"pending\"),\"function\"==typeof l&&l()})}}}function q(c){var l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,h=O(c);h&&g([h],l)}function T(c){return{found:!0,width:c[0],height:c[1],icon:{tag:\"path\",attributes:{fill:\"currentColor\",d:c.slice(4)[0]}}}}function j(){Hc.autoAddCss&&(sl||h(tl()),sl=!0)}function F(c,l){return Object.defineProperty(c,\"abstract\",{get:l}),Object.defineProperty(c,\"html\",{get:function(){return c.abstract.map(function(c){return u(c)})}}),Object.defineProperty(c,\"node\",{get:function(){if(K.createElement){var l=K.createElement(\"div\");return l.innerHTML=c.html,l.children}}}),c}function W(c){var l=c.prefix,h=void 0===l?\"fa\":l,v=c.iconName;if(v)return L(rl.definitions,h,v)||L(wc.styles,h,v)}var P=function(){},I={},R={},B=null,X={mark:P,measure:P};try{\"undefined\"!=typeof window&&(I=window),\"undefined\"!=typeof document&&(R=document),\"undefined\"!=typeof MutationObserver&&(B=MutationObserver),\"undefined\"!=typeof performance&&(X=performance)}catch(c){}var Y=(I.navigator||{}).userAgent,D=void 0===Y?\"\":Y,U=I,K=R,G=B,J=X,Q=!!U.document,Z=~D.indexOf(\"MSIE\")||~D.indexOf(\"Trident/\"),$=16,cc=\"data-fa-processed\",lc=\"data-fa-pseudo-element\",hc=\"fontawesome-i2svg\",vc=function(){try{return!0}catch(c){return!1}}(),zc=[1,2,3,4,5,6,7,8,9,10],ec=zc.concat([11,12,13,14,15,16,17,18,19,20]),ac=[\"class\",\"data-prefix\",\"data-icon\",\"data-fa-transform\",\"data-fa-mask\"],mc=[\"xs\",\"sm\",\"lg\",\"fw\",\"ul\",\"li\",\"border\",\"pull-left\",\"pull-right\",\"spin\",\"pulse\",\"rotate-90\",\"rotate-180\",\"rotate-270\",\"flip-horizontal\",\"flip-vertical\",\"stack\",\"stack-1x\",\"stack-2x\",\"inverse\",\"layers\",\"layers-text\",\"layers-counter\"].concat(zc.map(function(c){return c+\"x\"})).concat(ec.map(function(c){return\"w-\"+c})),tc=function(c,l){if(!(c instanceof l))throw new TypeError(\"Cannot call a class as a function\")},sc=function(){function c(c,l){for(var h=0;h=0||Object.prototype.hasOwnProperty.call(c,v)&&(h[v]=c[v]);return h},ic=function(c){if(Array.isArray(c)){for(var l=0,h=Array(c.length);l0&&(h.style=e),r(z)){var a=f({transform:z,containerWidth:v.width,iconWidth:v.width});l.push({tag:\"g\",attributes:fc({},a.outer),children:[{tag:\"g\",attributes:fc({},a.inner),children:[{tag:v.icon.tag,children:v.icon.children,attributes:fc({},v.icon.attributes,a.path)}]}]})}else l.push(v.icon);return{children:l,attributes:h}},pc=function(c){var l=c.children,h=c.main,v=c.mask,z=c.attributes,e=c.styles,a=c.transform;if(r(a)&&h.found&&!v.found){var m={x:h.width/h.height/2,y:.5};z.style=s(fc({},e,{\"transform-origin\":m.x+a.x/16+\"em \"+(m.y+a.y/16)+\"em\"}))}return[{tag:\"svg\",attributes:z,children:l}]},gc=function(c){var l=c.prefix,h=c.iconName,v=c.children,z=c.attributes,e=c.symbol,a=!0===e?l+\"-\"+Hc.familyPrefix+\"-\"+h:e;return[{tag:\"svg\",attributes:{style:\"display: none;\"},children:[{tag:\"symbol\",attributes:fc({},z,{id:a}),children:v}]}]},bc=U||{};bc.___FONT_AWESOME___||(bc.___FONT_AWESOME___={}),bc.___FONT_AWESOME___.styles||(bc.___FONT_AWESOME___.styles={}),bc.___FONT_AWESOME___.hooks||(bc.___FONT_AWESOME___.hooks={}),bc.___FONT_AWESOME___.shims||(bc.___FONT_AWESOME___.shims=[]);var wc=bc.___FONT_AWESOME___,yc=function(){},Sc=Hc.measurePerformance&&J&&J.mark&&J.measure?J:{mark:yc,measure:yc},_c=function(c){Sc.mark('FA \"5.0.1\" '+c+\" ends\"),Sc.measure('FA \"5.0.1\" '+c,'FA \"5.0.1\" '+c+\" begins\",'FA \"5.0.1\" '+c+\" ends\")},kc={begin:function(c){return Sc.mark('FA \"5.0.1\" '+c+\" begins\"),function(){return _c(c)}},end:_c},Ac=function(c,l){return function(h,v,z,e){return c.call(l,h,v,z,e)}},xc=function(c,l,h,v){var z,e,a,m=Object.keys(c),t=m.length,s=void 0!==v?Ac(l,v):l;for(void 0===h?(z=1,a=c[m[0]]):(z=0,a=h);z0&&(c[v]=z.join(\":\").trim()),c},{})),h},Xc=function(c){var l=c.getAttribute(\"data-prefix\"),h=c.getAttribute(\"data-icon\"),v=void 0!==c.innerText?c.innerText.trim():\"\",z=C(e(c));return l&&h&&(z.prefix=l,z.iconName=h),z.prefix&&v.length>1?z.iconName=o(z.prefix,c.innerText):z.prefix&&1===v.length&&(z.iconName=H(z.prefix,y(c.innerText))),z},Yc=function(c){var l={size:16,x:0,y:0,flipX:!1,flipY:!1,rotate:0};return c?c.toLowerCase().split(\" \").reduce(function(c,l){var h=l.toLowerCase().split(\"-\"),v=h[0],z=h.slice(1).join(\"-\");if(v&&\"h\"===z)return c.flipX=!0,c;if(v&&\"v\"===z)return c.flipY=!0,c;if(z=parseFloat(z),isNaN(z))return c;switch(v){case\"grow\":c.size=c.size+z;break;case\"shrink\":c.size=c.size-z;break;case\"left\":c.x=c.x-z;break;case\"right\":c.x=c.x+z;break;case\"up\":c.y=c.y-z;break;case\"down\":c.y=c.y+z;break;case\"rotate\":c.rotate=c.rotate+z}return c},l):l},Dc=function(c){return Yc(c.getAttribute(\"data-fa-transform\"))},Uc=function(c){var l=c.getAttribute(\"data-fa-symbol\");return null!==l&&(\"\"===l||l)},Kc=function(c){var l=z(c.attributes).reduce(function(c,l){return\"class\"!==c.name&&\"style\"!==c.name&&(c[l.name]=l.value),c},{}),h=c.getAttribute(\"title\");return Hc.autoA11y&&(h?l[\"aria-labelledby\"]=Hc.replacementClass+\"-title-\"+v():l[\"aria-hidden\"]=\"true\"),l},Gc=function(c){var l=c.getAttribute(\"data-fa-mask\");return l?C(l.split(\" \").map(function(c){return c.trim()})):Wc()};_.prototype=Object.create(Error.prototype),_.prototype.constructor=_;var Jc={fill:\"currentColor\"},Qc={attributeType:\"XML\",repeatCount:\"indefinite\",dur:\"2s\"},Zc={tag:\"path\",attributes:fc({},Jc,{d:\"M156.5,447.7l-12.6,29.5c-18.7-9.5-35.9-21.2-51.5-34.9l22.7-22.7C127.6,430.5,141.5,440,156.5,447.7z M40.6,272H8.5 c1.4,21.2,5.4,41.7,11.7,61.1L50,321.2C45.1,305.5,41.8,289,40.6,272z M40.6,240c1.4-18.8,5.2-37,11.1-54.1l-29.5-12.6 C14.7,194.3,10,216.7,8.5,240H40.6z M64.3,156.5c7.8-14.9,17.2-28.8,28.1-41.5L69.7,92.3c-13.7,15.6-25.5,32.8-34.9,51.5 L64.3,156.5z M397,419.6c-13.9,12-29.4,22.3-46.1,30.4l11.9,29.8c20.7-9.9,39.8-22.6,56.9-37.6L397,419.6z M115,92.4 c13.9-12,29.4-22.3,46.1-30.4l-11.9-29.8c-20.7,9.9-39.8,22.6-56.8,37.6L115,92.4z M447.7,355.5c-7.8,14.9-17.2,28.8-28.1,41.5 l22.7,22.7c13.7-15.6,25.5-32.9,34.9-51.5L447.7,355.5z M471.4,272c-1.4,18.8-5.2,37-11.1,54.1l29.5,12.6 c7.5-21.1,12.2-43.5,13.6-66.8H471.4z M321.2,462c-15.7,5-32.2,8.2-49.2,9.4v32.1c21.2-1.4,41.7-5.4,61.1-11.7L321.2,462z M240,471.4c-18.8-1.4-37-5.2-54.1-11.1l-12.6,29.5c21.1,7.5,43.5,12.2,66.8,13.6V471.4z M462,190.8c5,15.7,8.2,32.2,9.4,49.2h32.1 c-1.4-21.2-5.4-41.7-11.7-61.1L462,190.8z M92.4,397c-12-13.9-22.3-29.4-30.4-46.1l-29.8,11.9c9.9,20.7,22.6,39.8,37.6,56.9 L92.4,397z M272,40.6c18.8,1.4,36.9,5.2,54.1,11.1l12.6-29.5C317.7,14.7,295.3,10,272,8.5V40.6z M190.8,50 c15.7-5,32.2-8.2,49.2-9.4V8.5c-21.2,1.4-41.7,5.4-61.1,11.7L190.8,50z M442.3,92.3L419.6,115c12,13.9,22.3,29.4,30.5,46.1 l29.8-11.9C470,128.5,457.3,109.4,442.3,92.3z M397,92.4l22.7-22.7c-15.6-13.7-32.8-25.5-51.5-34.9l-12.6,29.5 C370.4,72.1,384.4,81.5,397,92.4z\"})},$c=fc({},Qc,{attributeName:\"opacity\"}),cl={tag:\"g\",children:[Zc,{tag:\"circle\",attributes:fc({},Jc,{cx:\"256\",cy:\"364\",r:\"28\"}),children:[{tag:\"animate\",attributes:fc({},Qc,{attributeName:\"r\",values:\"28;14;28;28;14;28;\"})},{tag:\"animate\",attributes:fc({},$c,{values:\"1;0;1;1;0;1;\"})}]},{tag:\"path\",attributes:fc({},Jc,{opacity:\"1\",d:\"M263.7,312h-16c-6.6,0-12-5.4-12-12c0-71,77.4-63.9,77.4-107.8c0-20-17.8-40.2-57.4-40.2c-29.1,0-44.3,9.6-59.2,28.7 c-3.9,5-11.1,6-16.2,2.4l-13.1-9.2c-5.6-3.9-6.9-11.8-2.6-17.2c21.2-27.2,46.4-44.7,91.2-44.7c52.3,0,97.4,29.8,97.4,80.2 c0,67.6-77.4,63.5-77.4,107.8C275.7,306.6,270.3,312,263.7,312z\"}),children:[{tag:\"animate\",attributes:fc({},$c,{values:\"1;0;0;0;0;1;\"})}]},{tag:\"path\",attributes:fc({},Jc,{opacity:\"0\",d:\"M232.5,134.5l7,168c0.3,6.4,5.6,11.5,12,11.5h9c6.4,0,11.7-5.1,12-11.5l7-168c0.3-6.8-5.2-12.5-12-12.5h-23 C237.7,122,232.2,127.7,232.5,134.5z\"}),children:[{tag:\"animate\",attributes:fc({},$c,{values:\"0;0;1;1;0;0;\"})}]}]},ll=wc.styles,hl=\"fa-layers-text\",vl=/Font Awesome 5 (Solid|Regular|Light|Brands)/,zl={Solid:\"fas\",Regular:\"far\",Light:\"fal\",Brands:\"fab\"},el=[],al=(K.documentElement.doScroll?/^loaded|^c/:/^loaded|^i|^c/).test(K.readyState);al||K.addEventListener(\"DOMContentLoaded\",function c(){K.removeEventListener(\"DOMContentLoaded\",c),al=1,el.map(function(c){return c()})});var ml=function(c){K&&(al?setTimeout(c,0):el.push(c))},tl=function(){var c=\"svg-inline--fa\",l=Hc.familyPrefix,h=Hc.replacementClass,v=\"svg:not(:root).svg-inline--fa{overflow:visible}.svg-inline--fa{display:inline-block;font-size:inherit;height:1em;overflow:visible;vertical-align:-.125em}.svg-inline--fa.fa-lg{vertical-align:-.225em}.svg-inline--fa.fa-w-1{width:.0625em}.svg-inline--fa.fa-w-2{width:.125em}.svg-inline--fa.fa-w-3{width:.1875em}.svg-inline--fa.fa-w-4{width:.25em}.svg-inline--fa.fa-w-5{width:.3125em}.svg-inline--fa.fa-w-6{width:.375em}.svg-inline--fa.fa-w-7{width:.4375em}.svg-inline--fa.fa-w-8{width:.5em}.svg-inline--fa.fa-w-9{width:.5625em}.svg-inline--fa.fa-w-10{width:.625em}.svg-inline--fa.fa-w-11{width:.6875em}.svg-inline--fa.fa-w-12{width:.75em}.svg-inline--fa.fa-w-13{width:.8125em}.svg-inline--fa.fa-w-14{width:.875em}.svg-inline--fa.fa-w-15{width:.9375em}.svg-inline--fa.fa-w-16{width:1em}.svg-inline--fa.fa-w-17{width:1.0625em}.svg-inline--fa.fa-w-18{width:1.125em}.svg-inline--fa.fa-w-19{width:1.1875em}.svg-inline--fa.fa-w-20{width:1.25em}.svg-inline--fa.fa-pull-left{margin-right:.3em;width:auto}.svg-inline--fa.fa-pull-right{margin-left:.3em;width:auto}.svg-inline--fa.fa-border{height:1.5em}.svg-inline--fa.fa-li{width:2em}.svg-inline--fa.fa-fw{width:1.25em}.fa-layers svg.svg-inline--fa{bottom:0;left:0;margin:auto;position:absolute;right:0;top:0}.fa-layers{display:inline-block;height:1em;position:relative;text-align:center;vertical-align:-12.5%;width:1em}.fa-layers svg.svg-inline--fa{-webkit-transform-origin:center center;transform-origin:center center}.fa-layers-counter,.fa-layers-text{display:inline-block;position:absolute;text-align:center}.fa-layers-text{left:50%;top:50%;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%);-webkit-transform-origin:center center;transform-origin:center center}.fa-layers-counter{background-color:#ff253a;border-radius:1em;color:#fff;height:1.5em;line-height:1;max-width:5em;min-width:1.5em;overflow:hidden;padding:.25em;right:0;text-overflow:ellipsis;top:0;-webkit-transform:scale(.25);transform:scale(.25);-webkit-transform-origin:top right;transform-origin:top right}.fa-layers-bottom-right{bottom:0;right:0;top:auto;-webkit-transform:scale(.25);transform:scale(.25);-webkit-transform-origin:bottom right;transform-origin:bottom right}.fa-layers-bottom-left{bottom:0;left:0;right:auto;top:auto;-webkit-transform:scale(.25);transform:scale(.25);-webkit-transform-origin:bottom left;transform-origin:bottom left}.fa-layers-top-right{right:0;top:0;-webkit-transform:scale(.25);transform:scale(.25);-webkit-transform-origin:top right;transform-origin:top right}.fa-layers-top-left{left:0;right:auto;top:0;-webkit-transform:scale(.25);transform:scale(.25);-webkit-transform-origin:top left;transform-origin:top left}.fa-lg{font-size:1.33333em;line-height:.75em;vertical-align:-.0667em}.fa-xs{font-size:.75em}.fa-sm{font-size:.875em}.fa-1x{font-size:1em}.fa-2x{font-size:2em}.fa-3x{font-size:3em}.fa-4x{font-size:4em}.fa-5x{font-size:5em}.fa-6x{font-size:6em}.fa-7x{font-size:7em}.fa-8x{font-size:8em}.fa-9x{font-size:9em}.fa-10x{font-size:10em}.fa-fw{text-align:center;width:1.25em}.fa-ul{list-style-type:none;margin-left:2.5em;padding-left:0}.fa-ul>li{position:relative}.fa-li{left:-2em;position:absolute;text-align:center;width:2em;line-height:inherit}.fa-border{border:solid .08em #eee;border-radius:.1em;padding:.2em .25em .15em}.fa-pull-left{float:left}.fa-pull-right{float:right}.fa.fa-pull-left,.fab.fa-pull-left,.fal.fa-pull-left,.far.fa-pull-left,.fas.fa-pull-left{margin-right:.3em}.fa.fa-pull-right,.fab.fa-pull-right,.fal.fa-pull-right,.far.fa-pull-right,.fas.fa-pull-right{margin-left:.3em}.fa-spin{-webkit-animation:fa-spin 2s infinite linear;animation:fa-spin 2s infinite linear}.fa-pulse{-webkit-animation:fa-spin 1s infinite steps(8);animation:fa-spin 1s infinite steps(8)}@-webkit-keyframes fa-spin{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes fa-spin{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}.fa-rotate-90{-webkit-transform:rotate(90deg);transform:rotate(90deg)}.fa-rotate-180{-webkit-transform:rotate(180deg);transform:rotate(180deg)}.fa-rotate-270{-webkit-transform:rotate(270deg);transform:rotate(270deg)}.fa-flip-horizontal{-webkit-transform:scale(-1,1);transform:scale(-1,1)}.fa-flip-vertical{-webkit-transform:scale(1,-1);transform:scale(1,-1)}.fa-flip-horizontal.fa-flip-vertical{-webkit-transform:scale(-1,-1);transform:scale(-1,-1)}:root .fa-flip-horizontal,:root .fa-flip-vertical,:root .fa-rotate-180,:root .fa-rotate-270,:root .fa-rotate-90{-webkit-filter:none;filter:none}.fa-stack{display:inline-block;height:2em;position:relative;width:2em}.fa-stack-1x,.fa-stack-2x{bottom:0;left:0;margin:auto;position:absolute;right:0;top:0}.svg-inline--fa.fa-stack-1x{height:1em;width:1em}.svg-inline--fa.fa-stack-2x{height:2em;width:2em}.fa-inverse{color:#fff}.sr-only{border:0;clip:rect(0,0,0,0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.sr-only-focusable:active,.sr-only-focusable:focus{clip:auto;height:auto;margin:0;overflow:visible;position:static;width:auto}\";if(\"fa\"!==l||h!==c){var z=new RegExp(\"\\\\.fa\\\\-\",\"g\"),e=new RegExp(\"\\\\.\"+c,\"g\");v=v.replace(z,\".\"+l+\"-\").replace(e,\".\"+h)}return v},sl=!1,rl=new(function(){function c(){tc(this,c),this.definitions={}}return sc(c,[{key:\"add\",value:function(){for(var c=this,l=arguments.length,h=Array(l),v=0;v0&&void 0!==arguments[0]?arguments[0]:{};j();var l=c.node,h=void 0===l?K:l,v=c.callback,z=void 0===v?function(){}:v;Hc.searchPseudoElements&&E(h),N(h,z)},css:tl,insertCss:function(){h(tl())}},library:rl,parse:{transform:function(c){return Yc(c)}},findIconDefinition:W,icon:function(c){return function(l){var h=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},v=(l||{}).icon?l:W(l||{}),z=h.mask;return z&&(z=(z||{}).icon?z:W(z||{})),c(v,fc({},h,{mask:z}))}}(function(c){var l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},h=l.transform,z=void 0===h?Vc:h,e=l.symbol,a=void 0!==e&&e,m=l.mask,t=void 0===m?null:m,s=l.title,r=void 0===s?null:s,f=l.classes,M=void 0===f?[]:f,n=l.attributes,H=void 0===n?{}:n,o=l.styles,V=void 0===o?{}:o;if(c){var C=c.prefix,L=c.iconName,u=c.icon;return F(fc({type:\"icon\"},c),function(){return j(),Hc.autoA11y&&(r?H[\"aria-labelledby\"]=Hc.replacementClass+\"-title-\"+v():H[\"aria-hidden\"]=\"true\"),i({icons:{main:T(u),mask:t?T(t.icon):{found:!1,width:null,height:null,icon:{}}},prefix:C,iconName:L,transform:fc({},Vc,z),symbol:a,title:r,extra:{attributes:H,styles:V,classes:M}})})}}),text:function(c){var l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},h=l.transform,v=void 0===h?Vc:h,z=l.title,e=void 0===z?null:z,a=l.classes,m=void 0===a?[]:a,t=l.attributes,s=void 0===t?{}:t,r=l.styles,f=void 0===r?{}:r;return F({type:\"text\",content:c},function(){return j(),n({content:c,transform:fc({},Vc,v),title:e,extra:{attributes:s,styles:f,classes:[Hc.familyPrefix+\"-layers-text\"].concat(ic(m))}})})},layer:function(c){return F({type:\"layer\"},function(){j();var l=[];return c(function(c){l=Array.isArray(c)?c.map(function(c){l=l.concat(c.abstract)}):l.concat(c.abstract)}),[{tag:\"span\",attributes:{class:Hc.familyPrefix+\"-layers\"},children:l}]})}};Object.defineProperty(fl,\"config\",{get:function(){Hc.autoReplaceSvg,Hc.observeMutations,Hc.showMissingIcons;return Mc(Hc,[\"autoReplaceSvg\",\"observeMutations\",\"showMissingIcons\"])},set:function(l){c(l)}}),function(c){try{c()}catch(c){}}(function(){var c=function(){Hc.autoReplaceSvg&&fl.dom.i2svg({node:K})};Q&&(U.FontAwesome||(U.FontAwesome=fl),ml(function(){Object.keys(wc.styles).length>0&&c(),Hc.observeMutations&&\"function\"==typeof MutationObserver&&w({treeCallback:N,nodeCallback:q,pseudoElementsCallback:E})})),wc.hooks=fc({},wc.hooks,{addPack:function(l,h){wc.styles[l]=fc({},wc.styles[l]||{},h),jc(),c()},addShims:function(l){var h;(h=wc.shims).push.apply(h,ic(l)),jc(),c()}})})}();", "(() => {\n if (!window.CMS) window.CMS = {};\n const CMS = window.CMS;\n\n // TODO(glebm): Use the battle-tested universal onPageLoad code and enable Turbolinks+async in the demo app.\n // See: https://gist.github.com/glebm/2496daf445877055447a6fac46509d9a\n const isTurbolinks = \"Turbolinks\" in window && window.Turbolinks.supported;\n if (isTurbolinks) {\n document.addEventListener(\"turbolinks:load\", () => {\n window.CMS.init();\n });\n document.addEventListener(\"turbolinks:before-cache\", () => {\n window.CMS.dispose();\n });\n } else {\n document.addEventListener(\"DOMContentLoaded\", () => {\n window.CMS.init();\n });\n }\n\n CMS.init = () => {\n CMS.current_path = window.location.pathname;\n CMS.slugify();\n CMS.codemirror.init();\n CMS.wysiwyg.init();\n CMS.sortableList.init();\n CMS.timepicker.init();\n CMS.pageFragments();\n CMS.categories();\n CMS.files.init();\n CMS.fileLinks();\n CMS.fileUpload.init();\n CMS.diff();\n };\n\n CMS.dispose = () => {\n CMS.codemirror.dispose();\n CMS.wysiwyg.dispose();\n CMS.files.dispose();\n CMS.fileUpload.dispose();\n CMS.sortableList.dispose();\n CMS.timepicker.dispose();\n };\n\n CMS.getLocale = () =>\n document.querySelector('meta[name=\"cms-locale\"]').content;\n})();\n", "(() => {\n window.CMS.categories = (root = document) => {\n const widget = root.querySelector('.categories-widget');\n if (widget === null) return;\n const readSection = widget.querySelector('.read');\n const editSection = widget.querySelector('.editable');\n widget.querySelector('.read button.toggle-cat-edit').addEventListener('click', () => {\n readSection.style.display = 'none';\n editSection.style.display = 'block';\n });\n widget.querySelector('.editable button.toggle-cat-edit').addEventListener('click', () => {\n editSection.style.display = 'none';\n readSection.style.display = 'block';\n });\n };\n})();\n\n", "import jQuery from \"jquery\";\nimport CodeMirror from \"codemirror\";\nimport \"codemirror/mode/markdown/markdown\";\nimport \"codemirror/mode/htmlmixed/htmlmixed\";\n\n(() => {\n const codeMirrorInstances = [];\n window.CMS.codemirror = {\n init(root = document) {\n for (const textarea of root.querySelectorAll(\n \"textarea[data-cms-cm-mode]\"\n )) {\n const codemirror = CodeMirror.fromTextArea(textarea, {\n mode: textarea.dataset.cmsCmMode,\n tabSize: 2,\n lineWrapping: true,\n autoCloseTags: true,\n lineNumbers: true,\n viewportMargin: Infinity,\n });\n codeMirrorInstances.push(codemirror);\n }\n\n const tabsRoot =\n root.id === \"form-fragments\"\n ? root\n : root.querySelector(\"#form-fragments\");\n jQuery(tabsRoot)\n .find('a[data-toggle=\"tab\"]')\n .on(\"shown.bs.tab\", () => {\n for (const codemirror of codeMirrorInstances) {\n codemirror.refresh();\n }\n });\n },\n dispose() {\n for (const codemirror of codeMirrorInstances) {\n codemirror.toTextArea();\n }\n codeMirrorInstances.length = 0;\n },\n };\n})();\n", "import jQuery from \"jquery\";\n\n(() => {\n window.CMS.diff = () => {\n jQuery(\".revision\").prettyTextDiff({\n cleanup: true,\n originalContainer: \".original\",\n changedContainer: \".current\",\n diffContainer: \".diff .content\",\n });\n };\n})();\n", "import jQuery from \"jquery\";\nimport Popover from \"bootstrap/js/src/popover\";\n\n(() => {\n const isFirefox = /\\bFirefox\\//.test(navigator.userAgent);\n\n class FileLink {\n constructor(link) {\n this.link = link;\n this.isImage = !!link.dataset.cmsFileThumbUrl;\n\n link.addEventListener(\"dragstart\", (evt) => {\n evt.dataTransfer.setData(\n \"text/plain\",\n this.link.dataset.cmsFileLinkTag\n );\n });\n\n if (this.isImage) {\n new Popover(link, {\n container: link.parentElement,\n trigger: \"hover\",\n placement: \"top\",\n content: this.buildFileThumbnail(),\n html: true,\n });\n\n link.addEventListener(\"dragstart\", (evt) => {\n evt.dataTransfer.setDragImage(this.buildFileThumbnail(), 4, 2);\n this.getPopover().hide();\n });\n\n this.workAroundFirefoxPopoverGlitch();\n }\n }\n\n buildFileThumbnail() {\n const img = new Image();\n img.src = this.link.dataset.cmsFileThumbUrl;\n return img;\n }\n\n // To work around a Firefox bug causing the popover to re-appear after the drop:\n // https://github.com/comfy/comfortable-mexican-sofa/pull/799#issuecomment-369124161\n //\n // Possibly related to:\n // https://bugzilla.mozilla.org/show_bug.cgi?id=505521\n workAroundFirefoxPopoverGlitch() {\n if (!isFirefox) return;\n this.link.addEventListener(\"dragstart\", () => {\n this.getPopover().disable();\n });\n this.link.addEventListener(\"dragend\", () => {\n setTimeout(() => {\n const popover = this.getPopover();\n popover.enable();\n popover.hide();\n }, 300);\n });\n }\n\n // We can't keep a reference to the Popover object, because Bootstrap re-creates it internally.\n getPopover() {\n return jQuery(this.link).data(Popover.DATA_KEY);\n }\n }\n\n window.CMS.fileLinks = (root = document) => {\n for (const link of root.querySelectorAll(\"[data-cms-file-link-tag]\")) {\n new FileLink(link);\n }\n };\n})();\n", "/**\n * --------------------------------------------------------------------------\n * Bootstrap (v4.3.1): popover.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport $ from 'jquery'\nimport Tooltip from './tooltip'\n\n/**\n * ------------------------------------------------------------------------\n * Constants\n * ------------------------------------------------------------------------\n */\n\nconst NAME = 'popover'\nconst VERSION = '4.3.1'\nconst DATA_KEY = 'bs.popover'\nconst EVENT_KEY = `.${DATA_KEY}`\nconst JQUERY_NO_CONFLICT = $.fn[NAME]\nconst CLASS_PREFIX = 'bs-popover'\nconst BSCLS_PREFIX_REGEX = new RegExp(`(^|\\\\s)${CLASS_PREFIX}\\\\S+`, 'g')\n\nconst Default = {\n ...Tooltip.Default,\n placement : 'right',\n trigger : 'click',\n content : '',\n template : ''\n}\n\nconst DefaultType = {\n ...Tooltip.DefaultType,\n content : '(string|element|function)'\n}\n\nconst ClassName = {\n FADE : 'fade',\n SHOW : 'show'\n}\n\nconst Selector = {\n TITLE : '.popover-header',\n CONTENT : '.popover-body'\n}\n\nconst Event = {\n HIDE : `hide${EVENT_KEY}`,\n HIDDEN : `hidden${EVENT_KEY}`,\n SHOW : `show${EVENT_KEY}`,\n SHOWN : `shown${EVENT_KEY}`,\n INSERTED : `inserted${EVENT_KEY}`,\n CLICK : `click${EVENT_KEY}`,\n FOCUSIN : `focusin${EVENT_KEY}`,\n FOCUSOUT : `focusout${EVENT_KEY}`,\n MOUSEENTER : `mouseenter${EVENT_KEY}`,\n MOUSELEAVE : `mouseleave${EVENT_KEY}`\n}\n\n/**\n * ------------------------------------------------------------------------\n * Class Definition\n * ------------------------------------------------------------------------\n */\n\nclass Popover extends Tooltip {\n // Getters\n\n static get VERSION() {\n return VERSION\n }\n\n static get Default() {\n return Default\n }\n\n static get NAME() {\n return NAME\n }\n\n static get DATA_KEY() {\n return DATA_KEY\n }\n\n static get Event() {\n return Event\n }\n\n static get EVENT_KEY() {\n return EVENT_KEY\n }\n\n static get DefaultType() {\n return DefaultType\n }\n\n // Overrides\n\n isWithContent() {\n return this.getTitle() || this._getContent()\n }\n\n addAttachmentClass(attachment) {\n $(this.getTipElement()).addClass(`${CLASS_PREFIX}-${attachment}`)\n }\n\n getTipElement() {\n this.tip = this.tip || $(this.config.template)[0]\n return this.tip\n }\n\n setContent() {\n const $tip = $(this.getTipElement())\n\n // We use append for html objects to maintain js events\n this.setElementContent($tip.find(Selector.TITLE), this.getTitle())\n let content = this._getContent()\n if (typeof content === 'function') {\n content = content.call(this.element)\n }\n this.setElementContent($tip.find(Selector.CONTENT), content)\n\n $tip.removeClass(`${ClassName.FADE} ${ClassName.SHOW}`)\n }\n\n // Private\n\n _getContent() {\n return this.element.getAttribute('data-content') ||\n this.config.content\n }\n\n _cleanTipClass() {\n const $tip = $(this.getTipElement())\n const tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX)\n if (tabClass !== null && tabClass.length > 0) {\n $tip.removeClass(tabClass.join(''))\n }\n }\n\n // Static\n\n static _jQueryInterface(config) {\n return this.each(function () {\n let data = $(this).data(DATA_KEY)\n const _config = typeof config === 'object' ? config : null\n\n if (!data && /dispose|hide/.test(config)) {\n return\n }\n\n if (!data) {\n data = new Popover(this, _config)\n $(this).data(DATA_KEY, data)\n }\n\n if (typeof config === 'string') {\n if (typeof data[config] === 'undefined') {\n throw new TypeError(`No method named \"${config}\"`)\n }\n data[config]()\n }\n })\n }\n}\n\n/**\n * ------------------------------------------------------------------------\n * jQuery\n * ------------------------------------------------------------------------\n */\n\n$.fn[NAME] = Popover._jQueryInterface\n$.fn[NAME].Constructor = Popover\n$.fn[NAME].noConflict = () => {\n $.fn[NAME] = JQUERY_NO_CONFLICT\n return Popover._jQueryInterface\n}\n\nexport default Popover\n", "/**\n * --------------------------------------------------------------------------\n * Bootstrap (v4.3.1): tools/sanitizer.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nconst uriAttrs = [\n 'background',\n 'cite',\n 'href',\n 'itemtype',\n 'longdesc',\n 'poster',\n 'src',\n 'xlink:href'\n]\n\nconst ARIA_ATTRIBUTE_PATTERN = /^aria-[\\w-]*$/i\n\nexport const DefaultWhitelist = {\n // Global attributes allowed on any supplied element below.\n '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],\n a: ['target', 'href', 'title', 'rel'],\n area: [],\n b: [],\n br: [],\n col: [],\n code: [],\n div: [],\n em: [],\n hr: [],\n h1: [],\n h2: [],\n h3: [],\n h4: [],\n h5: [],\n h6: [],\n i: [],\n img: ['src', 'alt', 'title', 'width', 'height'],\n li: [],\n ol: [],\n p: [],\n pre: [],\n s: [],\n small: [],\n span: [],\n sub: [],\n sup: [],\n strong: [],\n u: [],\n ul: []\n}\n\n/**\n * A pattern that recognizes a commonly useful subset of URLs that are safe.\n *\n * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts\n */\nconst SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi\n\n/**\n * A pattern that matches safe data URLs. Only matches image, video and audio types.\n *\n * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts\n */\nconst DATA_URL_PATTERN = /^data:(?:image\\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\\/(?:mpeg|mp4|ogg|webm)|audio\\/(?:mp3|oga|ogg|opus));base64,[a-z0-9+/]+=*$/i\n\nfunction allowedAttribute(attr, allowedAttributeList) {\n const attrName = attr.nodeName.toLowerCase()\n\n if (allowedAttributeList.indexOf(attrName) !== -1) {\n if (uriAttrs.indexOf(attrName) !== -1) {\n return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN))\n }\n\n return true\n }\n\n const regExp = allowedAttributeList.filter((attrRegex) => attrRegex instanceof RegExp)\n\n // Check if a regular expression validates the attribute.\n for (let i = 0, l = regExp.length; i < l; i++) {\n if (attrName.match(regExp[i])) {\n return true\n }\n }\n\n return false\n}\n\nexport function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) {\n if (unsafeHtml.length === 0) {\n return unsafeHtml\n }\n\n if (sanitizeFn && typeof sanitizeFn === 'function') {\n return sanitizeFn(unsafeHtml)\n }\n\n const domParser = new window.DOMParser()\n const createdDocument = domParser.parseFromString(unsafeHtml, 'text/html')\n const whitelistKeys = Object.keys(whiteList)\n const elements = [].slice.call(createdDocument.body.querySelectorAll('*'))\n\n for (let i = 0, len = elements.length; i < len; i++) {\n const el = elements[i]\n const elName = el.nodeName.toLowerCase()\n\n if (whitelistKeys.indexOf(el.nodeName.toLowerCase()) === -1) {\n el.parentNode.removeChild(el)\n\n continue\n }\n\n const attributeList = [].slice.call(el.attributes)\n const whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || [])\n\n attributeList.forEach((attr) => {\n if (!allowedAttribute(attr, whitelistedAttributes)) {\n el.removeAttribute(attr.nodeName)\n }\n })\n }\n\n return createdDocument.body.innerHTML\n}\n", "/**\n * --------------------------------------------------------------------------\n * Bootstrap (v4.3.1): tooltip.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport {\n DefaultWhitelist,\n sanitizeHtml\n} from './tools/sanitizer'\nimport $ from 'jquery'\nimport Popper from 'popper.js'\nimport Util from './util'\n\n/**\n * ------------------------------------------------------------------------\n * Constants\n * ------------------------------------------------------------------------\n */\n\nconst NAME = 'tooltip'\nconst VERSION = '4.3.1'\nconst DATA_KEY = 'bs.tooltip'\nconst EVENT_KEY = `.${DATA_KEY}`\nconst JQUERY_NO_CONFLICT = $.fn[NAME]\nconst CLASS_PREFIX = 'bs-tooltip'\nconst BSCLS_PREFIX_REGEX = new RegExp(`(^|\\\\s)${CLASS_PREFIX}\\\\S+`, 'g')\nconst DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn']\n\nconst DefaultType = {\n animation : 'boolean',\n template : 'string',\n title : '(string|element|function)',\n trigger : 'string',\n delay : '(number|object)',\n html : 'boolean',\n selector : '(string|boolean)',\n placement : '(string|function)',\n offset : '(number|string|function)',\n container : '(string|element|boolean)',\n fallbackPlacement : '(string|array)',\n boundary : '(string|element)',\n sanitize : 'boolean',\n sanitizeFn : '(null|function)',\n whiteList : 'object'\n}\n\nconst AttachmentMap = {\n AUTO : 'auto',\n TOP : 'top',\n RIGHT : 'right',\n BOTTOM : 'bottom',\n LEFT : 'left'\n}\n\nconst Default = {\n animation : true,\n template : '',\n trigger : 'hover focus',\n title : '',\n delay : 0,\n html : false,\n selector : false,\n placement : 'top',\n offset : 0,\n container : false,\n fallbackPlacement : 'flip',\n boundary : 'scrollParent',\n sanitize : true,\n sanitizeFn : null,\n whiteList : DefaultWhitelist\n}\n\nconst HoverState = {\n SHOW : 'show',\n OUT : 'out'\n}\n\nconst Event = {\n HIDE : `hide${EVENT_KEY}`,\n HIDDEN : `hidden${EVENT_KEY}`,\n SHOW : `show${EVENT_KEY}`,\n SHOWN : `shown${EVENT_KEY}`,\n INSERTED : `inserted${EVENT_KEY}`,\n CLICK : `click${EVENT_KEY}`,\n FOCUSIN : `focusin${EVENT_KEY}`,\n FOCUSOUT : `focusout${EVENT_KEY}`,\n MOUSEENTER : `mouseenter${EVENT_KEY}`,\n MOUSELEAVE : `mouseleave${EVENT_KEY}`\n}\n\nconst ClassName = {\n FADE : 'fade',\n SHOW : 'show'\n}\n\nconst Selector = {\n TOOLTIP : '.tooltip',\n TOOLTIP_INNER : '.tooltip-inner',\n ARROW : '.arrow'\n}\n\nconst Trigger = {\n HOVER : 'hover',\n FOCUS : 'focus',\n CLICK : 'click',\n MANUAL : 'manual'\n}\n\n\n/**\n * ------------------------------------------------------------------------\n * Class Definition\n * ------------------------------------------------------------------------\n */\n\nclass Tooltip {\n constructor(element, config) {\n /**\n * Check for Popper dependency\n * Popper - https://popper.js.org\n */\n if (typeof Popper === 'undefined') {\n throw new TypeError('Bootstrap\\'s tooltips require Popper.js (https://popper.js.org/)')\n }\n\n // private\n this._isEnabled = true\n this._timeout = 0\n this._hoverState = ''\n this._activeTrigger = {}\n this._popper = null\n\n // Protected\n this.element = element\n this.config = this._getConfig(config)\n this.tip = null\n\n this._setListeners()\n }\n\n // Getters\n\n static get VERSION() {\n return VERSION\n }\n\n static get Default() {\n return Default\n }\n\n static get NAME() {\n return NAME\n }\n\n static get DATA_KEY() {\n return DATA_KEY\n }\n\n static get Event() {\n return Event\n }\n\n static get EVENT_KEY() {\n return EVENT_KEY\n }\n\n static get DefaultType() {\n return DefaultType\n }\n\n // Public\n\n enable() {\n this._isEnabled = true\n }\n\n disable() {\n this._isEnabled = false\n }\n\n toggleEnabled() {\n this._isEnabled = !this._isEnabled\n }\n\n toggle(event) {\n if (!this._isEnabled) {\n return\n }\n\n if (event) {\n const dataKey = this.constructor.DATA_KEY\n let context = $(event.currentTarget).data(dataKey)\n\n if (!context) {\n context = new this.constructor(\n event.currentTarget,\n this._getDelegateConfig()\n )\n $(event.currentTarget).data(dataKey, context)\n }\n\n context._activeTrigger.click = !context._activeTrigger.click\n\n if (context._isWithActiveTrigger()) {\n context._enter(null, context)\n } else {\n context._leave(null, context)\n }\n } else {\n if ($(this.getTipElement()).hasClass(ClassName.SHOW)) {\n this._leave(null, this)\n return\n }\n\n this._enter(null, this)\n }\n }\n\n dispose() {\n clearTimeout(this._timeout)\n\n $.removeData(this.element, this.constructor.DATA_KEY)\n\n $(this.element).off(this.constructor.EVENT_KEY)\n $(this.element).closest('.modal').off('hide.bs.modal')\n\n if (this.tip) {\n $(this.tip).remove()\n }\n\n this._isEnabled = null\n this._timeout = null\n this._hoverState = null\n this._activeTrigger = null\n if (this._popper !== null) {\n this._popper.destroy()\n }\n\n this._popper = null\n this.element = null\n this.config = null\n this.tip = null\n }\n\n show() {\n if ($(this.element).css('display') === 'none') {\n throw new Error('Please use show on visible elements')\n }\n\n const showEvent = $.Event(this.constructor.Event.SHOW)\n if (this.isWithContent() && this._isEnabled) {\n $(this.element).trigger(showEvent)\n\n const shadowRoot = Util.findShadowRoot(this.element)\n const isInTheDom = $.contains(\n shadowRoot !== null ? shadowRoot : this.element.ownerDocument.documentElement,\n this.element\n )\n\n if (showEvent.isDefaultPrevented() || !isInTheDom) {\n return\n }\n\n const tip = this.getTipElement()\n const tipId = Util.getUID(this.constructor.NAME)\n\n tip.setAttribute('id', tipId)\n this.element.setAttribute('aria-describedby', tipId)\n\n this.setContent()\n\n if (this.config.animation) {\n $(tip).addClass(ClassName.FADE)\n }\n\n const placement = typeof this.config.placement === 'function'\n ? this.config.placement.call(this, tip, this.element)\n : this.config.placement\n\n const attachment = this._getAttachment(placement)\n this.addAttachmentClass(attachment)\n\n const container = this._getContainer()\n $(tip).data(this.constructor.DATA_KEY, this)\n\n if (!$.contains(this.element.ownerDocument.documentElement, this.tip)) {\n $(tip).appendTo(container)\n }\n\n $(this.element).trigger(this.constructor.Event.INSERTED)\n\n this._popper = new Popper(this.element, tip, {\n placement: attachment,\n modifiers: {\n offset: this._getOffset(),\n flip: {\n behavior: this.config.fallbackPlacement\n },\n arrow: {\n element: Selector.ARROW\n },\n preventOverflow: {\n boundariesElement: this.config.boundary\n }\n },\n onCreate: (data) => {\n if (data.originalPlacement !== data.placement) {\n this._handlePopperPlacementChange(data)\n }\n },\n onUpdate: (data) => this._handlePopperPlacementChange(data)\n })\n\n $(tip).addClass(ClassName.SHOW)\n\n // If this is a touch-enabled device we add extra\n // empty mouseover listeners to the body's immediate children;\n // only needed because of broken event delegation on iOS\n // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html\n if ('ontouchstart' in document.documentElement) {\n $(document.body).children().on('mouseover', null, $.noop)\n }\n\n const complete = () => {\n if (this.config.animation) {\n this._fixTransition()\n }\n const prevHoverState = this._hoverState\n this._hoverState = null\n\n $(this.element).trigger(this.constructor.Event.SHOWN)\n\n if (prevHoverState === HoverState.OUT) {\n this._leave(null, this)\n }\n }\n\n if ($(this.tip).hasClass(ClassName.FADE)) {\n const transitionDuration = Util.getTransitionDurationFromElement(this.tip)\n\n $(this.tip)\n .one(Util.TRANSITION_END, complete)\n .emulateTransitionEnd(transitionDuration)\n } else {\n complete()\n }\n }\n }\n\n hide(callback) {\n const tip = this.getTipElement()\n const hideEvent = $.Event(this.constructor.Event.HIDE)\n const complete = () => {\n if (this._hoverState !== HoverState.SHOW && tip.parentNode) {\n tip.parentNode.removeChild(tip)\n }\n\n this._cleanTipClass()\n this.element.removeAttribute('aria-describedby')\n $(this.element).trigger(this.constructor.Event.HIDDEN)\n if (this._popper !== null) {\n this._popper.destroy()\n }\n\n if (callback) {\n callback()\n }\n }\n\n $(this.element).trigger(hideEvent)\n\n if (hideEvent.isDefaultPrevented()) {\n return\n }\n\n $(tip).removeClass(ClassName.SHOW)\n\n // If this is a touch-enabled device we remove the extra\n // empty mouseover listeners we added for iOS support\n if ('ontouchstart' in document.documentElement) {\n $(document.body).children().off('mouseover', null, $.noop)\n }\n\n this._activeTrigger[Trigger.CLICK] = false\n this._activeTrigger[Trigger.FOCUS] = false\n this._activeTrigger[Trigger.HOVER] = false\n\n if ($(this.tip).hasClass(ClassName.FADE)) {\n const transitionDuration = Util.getTransitionDurationFromElement(tip)\n\n $(tip)\n .one(Util.TRANSITION_END, complete)\n .emulateTransitionEnd(transitionDuration)\n } else {\n complete()\n }\n\n this._hoverState = ''\n }\n\n update() {\n if (this._popper !== null) {\n this._popper.scheduleUpdate()\n }\n }\n\n // Protected\n\n isWithContent() {\n return Boolean(this.getTitle())\n }\n\n addAttachmentClass(attachment) {\n $(this.getTipElement()).addClass(`${CLASS_PREFIX}-${attachment}`)\n }\n\n getTipElement() {\n this.tip = this.tip || $(this.config.template)[0]\n return this.tip\n }\n\n setContent() {\n const tip = this.getTipElement()\n this.setElementContent($(tip.querySelectorAll(Selector.TOOLTIP_INNER)), this.getTitle())\n $(tip).removeClass(`${ClassName.FADE} ${ClassName.SHOW}`)\n }\n\n setElementContent($element, content) {\n if (typeof content === 'object' && (content.nodeType || content.jquery)) {\n // Content is a DOM node or a jQuery\n if (this.config.html) {\n if (!$(content).parent().is($element)) {\n $element.empty().append(content)\n }\n } else {\n $element.text($(content).text())\n }\n\n return\n }\n\n if (this.config.html) {\n if (this.config.sanitize) {\n content = sanitizeHtml(content, this.config.whiteList, this.config.sanitizeFn)\n }\n\n $element.html(content)\n } else {\n $element.text(content)\n }\n }\n\n getTitle() {\n let title = this.element.getAttribute('data-original-title')\n\n if (!title) {\n title = typeof this.config.title === 'function'\n ? this.config.title.call(this.element)\n : this.config.title\n }\n\n return title\n }\n\n // Private\n\n _getOffset() {\n const offset = {}\n\n if (typeof this.config.offset === 'function') {\n offset.fn = (data) => {\n data.offsets = {\n ...data.offsets,\n ...this.config.offset(data.offsets, this.element) || {}\n }\n\n return data\n }\n } else {\n offset.offset = this.config.offset\n }\n\n return offset\n }\n\n _getContainer() {\n if (this.config.container === false) {\n return document.body\n }\n\n if (Util.isElement(this.config.container)) {\n return $(this.config.container)\n }\n\n return $(document).find(this.config.container)\n }\n\n _getAttachment(placement) {\n return AttachmentMap[placement.toUpperCase()]\n }\n\n _setListeners() {\n const triggers = this.config.trigger.split(' ')\n\n triggers.forEach((trigger) => {\n if (trigger === 'click') {\n $(this.element).on(\n this.constructor.Event.CLICK,\n this.config.selector,\n (event) => this.toggle(event)\n )\n } else if (trigger !== Trigger.MANUAL) {\n const eventIn = trigger === Trigger.HOVER\n ? this.constructor.Event.MOUSEENTER\n : this.constructor.Event.FOCUSIN\n const eventOut = trigger === Trigger.HOVER\n ? this.constructor.Event.MOUSELEAVE\n : this.constructor.Event.FOCUSOUT\n\n $(this.element)\n .on(\n eventIn,\n this.config.selector,\n (event) => this._enter(event)\n )\n .on(\n eventOut,\n this.config.selector,\n (event) => this._leave(event)\n )\n }\n })\n\n $(this.element).closest('.modal').on(\n 'hide.bs.modal',\n () => {\n if (this.element) {\n this.hide()\n }\n }\n )\n\n if (this.config.selector) {\n this.config = {\n ...this.config,\n trigger: 'manual',\n selector: ''\n }\n } else {\n this._fixTitle()\n }\n }\n\n _fixTitle() {\n const titleType = typeof this.element.getAttribute('data-original-title')\n\n if (this.element.getAttribute('title') || titleType !== 'string') {\n this.element.setAttribute(\n 'data-original-title',\n this.element.getAttribute('title') || ''\n )\n\n this.element.setAttribute('title', '')\n }\n }\n\n _enter(event, context) {\n const dataKey = this.constructor.DATA_KEY\n context = context || $(event.currentTarget).data(dataKey)\n\n if (!context) {\n context = new this.constructor(\n event.currentTarget,\n this._getDelegateConfig()\n )\n $(event.currentTarget).data(dataKey, context)\n }\n\n if (event) {\n context._activeTrigger[\n event.type === 'focusin' ? Trigger.FOCUS : Trigger.HOVER\n ] = true\n }\n\n if ($(context.getTipElement()).hasClass(ClassName.SHOW) || context._hoverState === HoverState.SHOW) {\n context._hoverState = HoverState.SHOW\n return\n }\n\n clearTimeout(context._timeout)\n\n context._hoverState = HoverState.SHOW\n\n if (!context.config.delay || !context.config.delay.show) {\n context.show()\n return\n }\n\n context._timeout = setTimeout(() => {\n if (context._hoverState === HoverState.SHOW) {\n context.show()\n }\n }, context.config.delay.show)\n }\n\n _leave(event, context) {\n const dataKey = this.constructor.DATA_KEY\n context = context || $(event.currentTarget).data(dataKey)\n\n if (!context) {\n context = new this.constructor(\n event.currentTarget,\n this._getDelegateConfig()\n )\n $(event.currentTarget).data(dataKey, context)\n }\n\n if (event) {\n context._activeTrigger[\n event.type === 'focusout' ? Trigger.FOCUS : Trigger.HOVER\n ] = false\n }\n\n if (context._isWithActiveTrigger()) {\n return\n }\n\n clearTimeout(context._timeout)\n\n context._hoverState = HoverState.OUT\n\n if (!context.config.delay || !context.config.delay.hide) {\n context.hide()\n return\n }\n\n context._timeout = setTimeout(() => {\n if (context._hoverState === HoverState.OUT) {\n context.hide()\n }\n }, context.config.delay.hide)\n }\n\n _isWithActiveTrigger() {\n for (const trigger in this._activeTrigger) {\n if (this._activeTrigger[trigger]) {\n return true\n }\n }\n\n return false\n }\n\n _getConfig(config) {\n const dataAttributes = $(this.element).data()\n\n Object.keys(dataAttributes)\n .forEach((dataAttr) => {\n if (DISALLOWED_ATTRIBUTES.indexOf(dataAttr) !== -1) {\n delete dataAttributes[dataAttr]\n }\n })\n\n config = {\n ...this.constructor.Default,\n ...dataAttributes,\n ...typeof config === 'object' && config ? config : {}\n }\n\n if (typeof config.delay === 'number') {\n config.delay = {\n show: config.delay,\n hide: config.delay\n }\n }\n\n if (typeof config.title === 'number') {\n config.title = config.title.toString()\n }\n\n if (typeof config.content === 'number') {\n config.content = config.content.toString()\n }\n\n Util.typeCheckConfig(\n NAME,\n config,\n this.constructor.DefaultType\n )\n\n if (config.sanitize) {\n config.template = sanitizeHtml(config.template, config.whiteList, config.sanitizeFn)\n }\n\n return config\n }\n\n _getDelegateConfig() {\n const config = {}\n\n if (this.config) {\n for (const key in this.config) {\n if (this.constructor.Default[key] !== this.config[key]) {\n config[key] = this.config[key]\n }\n }\n }\n\n return config\n }\n\n _cleanTipClass() {\n const $tip = $(this.getTipElement())\n const tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX)\n if (tabClass !== null && tabClass.length) {\n $tip.removeClass(tabClass.join(''))\n }\n }\n\n _handlePopperPlacementChange(popperData) {\n const popperInstance = popperData.instance\n this.tip = popperInstance.popper\n this._cleanTipClass()\n this.addAttachmentClass(this._getAttachment(popperData.placement))\n }\n\n _fixTransition() {\n const tip = this.getTipElement()\n const initConfigAnimation = this.config.animation\n\n if (tip.getAttribute('x-placement') !== null) {\n return\n }\n\n $(tip).removeClass(ClassName.FADE)\n this.config.animation = false\n this.hide()\n this.show()\n this.config.animation = initConfigAnimation\n }\n\n // Static\n\n static _jQueryInterface(config) {\n return this.each(function () {\n let data = $(this).data(DATA_KEY)\n const _config = typeof config === 'object' && config\n\n if (!data && /dispose|hide/.test(config)) {\n return\n }\n\n if (!data) {\n data = new Tooltip(this, _config)\n $(this).data(DATA_KEY, data)\n }\n\n if (typeof config === 'string') {\n if (typeof data[config] === 'undefined') {\n throw new TypeError(`No method named \"${config}\"`)\n }\n data[config]()\n }\n })\n }\n}\n\n/**\n * ------------------------------------------------------------------------\n * jQuery\n * ------------------------------------------------------------------------\n */\n\n$.fn[NAME] = Tooltip._jQueryInterface\n$.fn[NAME].Constructor = Tooltip\n$.fn[NAME].noConflict = () => {\n $.fn[NAME] = JQUERY_NO_CONFLICT\n return Tooltip._jQueryInterface\n}\n\nexport default Tooltip\n", "export default typeof window !== 'undefined' && typeof document !== 'undefined' && typeof navigator !== 'undefined';\n", "import isBrowser from './isBrowser';\n\nconst timeoutDuration = (function(){\n const longerTimeoutBrowsers = ['Edge', 'Trident', 'Firefox'];\n for (let i = 0; i < longerTimeoutBrowsers.length; i += 1) {\n if (isBrowser && navigator.userAgent.indexOf(longerTimeoutBrowsers[i]) >= 0) {\n return 1;\n }\n }\n return 0;\n}());\n\nexport function microtaskDebounce(fn) {\n let called = false\n return () => {\n if (called) {\n return\n }\n called = true\n window.Promise.resolve().then(() => {\n called = false\n fn()\n })\n }\n}\n\nexport function taskDebounce(fn) {\n let scheduled = false;\n return () => {\n if (!scheduled) {\n scheduled = true;\n setTimeout(() => {\n scheduled = false;\n fn();\n }, timeoutDuration);\n }\n };\n}\n\nconst supportsMicroTasks = isBrowser && window.Promise\n\n\n/**\n* Create a debounced version of a method, that's asynchronously deferred\n* but called in the minimum time possible.\n*\n* @method\n* @memberof Popper.Utils\n* @argument {Function} fn\n* @returns {Function}\n*/\nexport default (supportsMicroTasks\n ? microtaskDebounce\n : taskDebounce);\n", "/**\n * Check if the given variable is a function\n * @method\n * @memberof Popper.Utils\n * @argument {Any} functionToCheck - variable to check\n * @returns {Boolean} answer to: is a function?\n */\nexport default function isFunction(functionToCheck) {\n const getType = {};\n return (\n functionToCheck &&\n getType.toString.call(functionToCheck) === '[object Function]'\n );\n}\n", "/**\n * Get CSS computed property of the given element\n * @method\n * @memberof Popper.Utils\n * @argument {Eement} element\n * @argument {String} property\n */\nexport default function getStyleComputedProperty(element, property) {\n if (element.nodeType !== 1) {\n return [];\n }\n // NOTE: 1 DOM access here\n const window = element.ownerDocument.defaultView;\n const css = window.getComputedStyle(element, null);\n return property ? css[property] : css;\n}\n", "/**\n * Returns the parentNode or the host of the element\n * @method\n * @memberof Popper.Utils\n * @argument {Element} element\n * @returns {Element} parent\n */\nexport default function getParentNode(element) {\n if (element.nodeName === 'HTML') {\n return element;\n }\n return element.parentNode || element.host;\n}\n", "import getStyleComputedProperty from './getStyleComputedProperty';\nimport getParentNode from './getParentNode';\n\n/**\n * Returns the scrolling parent of the given element\n * @method\n * @memberof Popper.Utils\n * @argument {Element} element\n * @returns {Element} scroll parent\n */\nexport default function getScrollParent(element) {\n // Return body, `getScroll` will take care to get the correct `scrollTop` from it\n if (!element) {\n return document.body\n }\n\n switch (element.nodeName) {\n case 'HTML':\n case 'BODY':\n return element.ownerDocument.body\n case '#document':\n return element.body\n }\n\n // Firefox want us to check `-x` and `-y` variations as well\n const { overflow, overflowX, overflowY } = getStyleComputedProperty(element);\n if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) {\n return element;\n }\n\n return getScrollParent(getParentNode(element));\n}\n", "/**\n * Returns the reference node of the reference object, or the reference object itself.\n * @method\n * @memberof Popper.Utils\n * @param {Element|Object} reference - the reference element (the popper will be relative to this)\n * @returns {Element} parent\n */\nexport default function getReferenceNode(reference) {\n return reference && reference.referenceNode ? reference.referenceNode : reference;\n}\n", "import isBrowser from './isBrowser';\n\nconst isIE11 = isBrowser && !!(window.MSInputMethodContext && document.documentMode);\nconst isIE10 = isBrowser && /MSIE 10/.test(navigator.userAgent);\n\n/**\n * Determines if the browser is Internet Explorer\n * @method\n * @memberof Popper.Utils\n * @param {Number} version to check\n * @returns {Boolean} isIE\n */\nexport default function isIE(version) {\n if (version === 11) {\n return isIE11;\n }\n if (version === 10) {\n return isIE10;\n }\n return isIE11 || isIE10;\n}\n", "import getStyleComputedProperty from './getStyleComputedProperty';\nimport isIE from './isIE';\n/**\n * Returns the offset parent of the given element\n * @method\n * @memberof Popper.Utils\n * @argument {Element} element\n * @returns {Element} offset parent\n */\nexport default function getOffsetParent(element) {\n if (!element) {\n return document.documentElement;\n }\n\n const noOffsetParent = isIE(10) ? document.body : null;\n\n // NOTE: 1 DOM access here\n let offsetParent = element.offsetParent || null;\n // Skip hidden elements which don't have an offsetParent\n while (offsetParent === noOffsetParent && element.nextElementSibling) {\n offsetParent = (element = element.nextElementSibling).offsetParent;\n }\n\n const nodeName = offsetParent && offsetParent.nodeName;\n\n if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') {\n return element ? element.ownerDocument.documentElement : document.documentElement;\n }\n\n // .offsetParent will return the closest TH, TD or TABLE in case\n // no offsetParent is present, I hate this job...\n if (\n ['TH', 'TD', 'TABLE'].indexOf(offsetParent.nodeName) !== -1 &&\n getStyleComputedProperty(offsetParent, 'position') === 'static'\n ) {\n return getOffsetParent(offsetParent);\n }\n\n return offsetParent;\n}\n", "import getOffsetParent from './getOffsetParent';\n\nexport default function isOffsetContainer(element) {\n const { nodeName } = element;\n if (nodeName === 'BODY') {\n return false;\n }\n return (\n nodeName === 'HTML' || getOffsetParent(element.firstElementChild) === element\n );\n}\n", "/**\n * Finds the root node (document, shadowDOM root) of the given element\n * @method\n * @memberof Popper.Utils\n * @argument {Element} node\n * @returns {Element} root node\n */\nexport default function getRoot(node) {\n if (node.parentNode !== null) {\n return getRoot(node.parentNode);\n }\n\n return node;\n}\n", "import isOffsetContainer from './isOffsetContainer';\nimport getRoot from './getRoot';\nimport getOffsetParent from './getOffsetParent';\n\n/**\n * Finds the offset parent common to the two provided nodes\n * @method\n * @memberof Popper.Utils\n * @argument {Element} element1\n * @argument {Element} element2\n * @returns {Element} common offset parent\n */\nexport default function findCommonOffsetParent(element1, element2) {\n // This check is needed to avoid errors in case one of the elements isn't defined for any reason\n if (!element1 || !element1.nodeType || !element2 || !element2.nodeType) {\n return document.documentElement;\n }\n\n // Here we make sure to give as \"start\" the element that comes first in the DOM\n const order =\n element1.compareDocumentPosition(element2) &\n Node.DOCUMENT_POSITION_FOLLOWING;\n const start = order ? element1 : element2;\n const end = order ? element2 : element1;\n\n // Get common ancestor container\n const range = document.createRange();\n range.setStart(start, 0);\n range.setEnd(end, 0);\n const { commonAncestorContainer } = range;\n\n // Both nodes are inside #document\n if (\n (element1 !== commonAncestorContainer &&\n element2 !== commonAncestorContainer) ||\n start.contains(end)\n ) {\n if (isOffsetContainer(commonAncestorContainer)) {\n return commonAncestorContainer;\n }\n\n return getOffsetParent(commonAncestorContainer);\n }\n\n // one of the nodes is inside shadowDOM, find which one\n const element1root = getRoot(element1);\n if (element1root.host) {\n return findCommonOffsetParent(element1root.host, element2);\n } else {\n return findCommonOffsetParent(element1, getRoot(element2).host);\n }\n}\n", "/**\n * Gets the scroll value of the given element in the given side (top and left)\n * @method\n * @memberof Popper.Utils\n * @argument {Element} element\n * @argument {String} side `top` or `left`\n * @returns {number} amount of scrolled pixels\n */\nexport default function getScroll(element, side = 'top') {\n const upperSide = side === 'top' ? 'scrollTop' : 'scrollLeft';\n const nodeName = element.nodeName;\n\n if (nodeName === 'BODY' || nodeName === 'HTML') {\n const html = element.ownerDocument.documentElement;\n const scrollingElement = element.ownerDocument.scrollingElement || html;\n return scrollingElement[upperSide];\n }\n\n return element[upperSide];\n}\n", "import getScroll from './getScroll';\n\n/*\n * Sum or subtract the element scroll values (left and top) from a given rect object\n * @method\n * @memberof Popper.Utils\n * @param {Object} rect - Rect object you want to change\n * @param {HTMLElement} element - The element from the function reads the scroll values\n * @param {Boolean} subtract - set to true if you want to subtract the scroll values\n * @return {Object} rect - The modifier rect object\n */\nexport default function includeScroll(rect, element, subtract = false) {\n const scrollTop = getScroll(element, 'top');\n const scrollLeft = getScroll(element, 'left');\n const modifier = subtract ? -1 : 1;\n rect.top += scrollTop * modifier;\n rect.bottom += scrollTop * modifier;\n rect.left += scrollLeft * modifier;\n rect.right += scrollLeft * modifier;\n return rect;\n}\n", "/*\n * Helper to detect borders of a given element\n * @method\n * @memberof Popper.Utils\n * @param {CSSStyleDeclaration} styles\n * Result of `getStyleComputedProperty` on the given element\n * @param {String} axis - `x` or `y`\n * @return {number} borders - The borders size of the given axis\n */\n\nexport default function getBordersSize(styles, axis) {\n const sideA = axis === 'x' ? 'Left' : 'Top';\n const sideB = sideA === 'Left' ? 'Right' : 'Bottom';\n\n return (\n parseFloat(styles[`border${sideA}Width`]) +\n parseFloat(styles[`border${sideB}Width`])\n );\n}\n", "import isIE from './isIE';\n\nfunction getSize(axis, body, html, computedStyle) {\n return Math.max(\n body[`offset${axis}`],\n body[`scroll${axis}`],\n html[`client${axis}`],\n html[`offset${axis}`],\n html[`scroll${axis}`],\n isIE(10)\n ? (parseInt(html[`offset${axis}`]) + \n parseInt(computedStyle[`margin${axis === 'Height' ? 'Top' : 'Left'}`]) + \n parseInt(computedStyle[`margin${axis === 'Height' ? 'Bottom' : 'Right'}`]))\n : 0 \n );\n}\n\nexport default function getWindowSizes(document) {\n const body = document.body;\n const html = document.documentElement;\n const computedStyle = isIE(10) && getComputedStyle(html);\n\n return {\n height: getSize('Height', body, html, computedStyle),\n width: getSize('Width', body, html, computedStyle),\n };\n}\n", "/**\n * Given element offsets, generate an output similar to getBoundingClientRect\n * @method\n * @memberof Popper.Utils\n * @argument {Object} offsets\n * @returns {Object} ClientRect like output\n */\nexport default function getClientRect(offsets) {\n return {\n ...offsets,\n right: offsets.left + offsets.width,\n bottom: offsets.top + offsets.height,\n };\n}\n", "import getStyleComputedProperty from './getStyleComputedProperty';\nimport getBordersSize from './getBordersSize';\nimport getWindowSizes from './getWindowSizes';\nimport getScroll from './getScroll';\nimport getClientRect from './getClientRect';\nimport isIE from './isIE';\n\n/**\n * Get bounding client rect of given element\n * @method\n * @memberof Popper.Utils\n * @param {HTMLElement} element\n * @return {Object} client rect\n */\nexport default function getBoundingClientRect(element) {\n let rect = {};\n\n // IE10 10 FIX: Please, don't ask, the element isn't\n // considered in DOM in some circumstances...\n // This isn't reproducible in IE10 compatibility mode of IE11\n try {\n if (isIE(10)) {\n rect = element.getBoundingClientRect();\n const scrollTop = getScroll(element, 'top');\n const scrollLeft = getScroll(element, 'left');\n rect.top += scrollTop;\n rect.left += scrollLeft;\n rect.bottom += scrollTop;\n rect.right += scrollLeft;\n }\n else {\n rect = element.getBoundingClientRect();\n }\n }\n catch(e){}\n\n const result = {\n left: rect.left,\n top: rect.top,\n width: rect.right - rect.left,\n height: rect.bottom - rect.top,\n };\n\n // subtract scrollbar size from sizes\n const sizes = element.nodeName === 'HTML' ? getWindowSizes(element.ownerDocument) : {};\n const width =\n sizes.width || element.clientWidth || result.width;\n const height =\n sizes.height || element.clientHeight || result.height;\n\n let horizScrollbar = element.offsetWidth - width;\n let vertScrollbar = element.offsetHeight - height;\n\n // if an hypothetical scrollbar is detected, we must be sure it's not a `border`\n // we make this check conditional for performance reasons\n if (horizScrollbar || vertScrollbar) {\n const styles = getStyleComputedProperty(element);\n horizScrollbar -= getBordersSize(styles, 'x');\n vertScrollbar -= getBordersSize(styles, 'y');\n\n result.width -= horizScrollbar;\n result.height -= vertScrollbar;\n }\n\n return getClientRect(result);\n}\n", "import getStyleComputedProperty from './getStyleComputedProperty';\nimport includeScroll from './includeScroll';\nimport getScrollParent from './getScrollParent';\nimport getBoundingClientRect from './getBoundingClientRect';\nimport runIsIE from './isIE';\nimport getClientRect from './getClientRect';\n\nexport default function getOffsetRectRelativeToArbitraryNode(children, parent, fixedPosition = false) {\n const isIE10 = runIsIE(10);\n const isHTML = parent.nodeName === 'HTML';\n const childrenRect = getBoundingClientRect(children);\n const parentRect = getBoundingClientRect(parent);\n const scrollParent = getScrollParent(children);\n\n const styles = getStyleComputedProperty(parent);\n const borderTopWidth = parseFloat(styles.borderTopWidth);\n const borderLeftWidth = parseFloat(styles.borderLeftWidth);\n\n // In cases where the parent is fixed, we must ignore negative scroll in offset calc\n if(fixedPosition && isHTML) {\n parentRect.top = Math.max(parentRect.top, 0);\n parentRect.left = Math.max(parentRect.left, 0);\n }\n let offsets = getClientRect({\n top: childrenRect.top - parentRect.top - borderTopWidth,\n left: childrenRect.left - parentRect.left - borderLeftWidth,\n width: childrenRect.width,\n height: childrenRect.height,\n });\n offsets.marginTop = 0;\n offsets.marginLeft = 0;\n\n // Subtract margins of documentElement in case it's being used as parent\n // we do this only on HTML because it's the only element that behaves\n // differently when margins are applied to it. The margins are included in\n // the box of the documentElement, in the other cases not.\n if (!isIE10 && isHTML) {\n const marginTop = parseFloat(styles.marginTop);\n const marginLeft = parseFloat(styles.marginLeft);\n\n offsets.top -= borderTopWidth - marginTop;\n offsets.bottom -= borderTopWidth - marginTop;\n offsets.left -= borderLeftWidth - marginLeft;\n offsets.right -= borderLeftWidth - marginLeft;\n\n // Attach marginTop and marginLeft because in some circumstances we may need them\n offsets.marginTop = marginTop;\n offsets.marginLeft = marginLeft;\n }\n\n if (\n isIE10 && !fixedPosition\n ? parent.contains(scrollParent)\n : parent === scrollParent && scrollParent.nodeName !== 'BODY'\n ) {\n offsets = includeScroll(offsets, parent);\n }\n\n return offsets;\n}\n", "import getOffsetRectRelativeToArbitraryNode from './getOffsetRectRelativeToArbitraryNode';\nimport getScroll from './getScroll';\nimport getClientRect from './getClientRect';\n\nexport default function getViewportOffsetRectRelativeToArtbitraryNode(element, excludeScroll = false) {\n const html = element.ownerDocument.documentElement;\n const relativeOffset = getOffsetRectRelativeToArbitraryNode(element, html);\n const width = Math.max(html.clientWidth, window.innerWidth || 0);\n const height = Math.max(html.clientHeight, window.innerHeight || 0);\n\n const scrollTop = !excludeScroll ? getScroll(html) : 0;\n const scrollLeft = !excludeScroll ? getScroll(html, 'left') : 0;\n\n const offset = {\n top: scrollTop - relativeOffset.top + relativeOffset.marginTop,\n left: scrollLeft - relativeOffset.left + relativeOffset.marginLeft,\n width,\n height,\n };\n\n return getClientRect(offset);\n}\n", "import getStyleComputedProperty from './getStyleComputedProperty';\nimport getParentNode from './getParentNode';\n\n/**\n * Check if the given element is fixed or is inside a fixed parent\n * @method\n * @memberof Popper.Utils\n * @argument {Element} element\n * @argument {Element} customContainer\n * @returns {Boolean} answer to \"isFixed?\"\n */\nexport default function isFixed(element) {\n const nodeName = element.nodeName;\n if (nodeName === 'BODY' || nodeName === 'HTML') {\n return false;\n }\n if (getStyleComputedProperty(element, 'position') === 'fixed') {\n return true;\n }\n const parentNode = getParentNode(element);\n if (!parentNode) {\n return false;\n }\n return isFixed(parentNode);\n}\n", "import getStyleComputedProperty from './getStyleComputedProperty';\nimport isIE from './isIE';\n/**\n * Finds the first parent of an element that has a transformed property defined\n * @method\n * @memberof Popper.Utils\n * @argument {Element} element\n * @returns {Element} first transformed parent or documentElement\n */\n\nexport default function getFixedPositionOffsetParent(element) {\n // This check is needed to avoid errors in case one of the elements isn't defined for any reason\n if (!element || !element.parentElement || isIE()) {\n return document.documentElement;\n }\n let el = element.parentElement;\n while (el && getStyleComputedProperty(el, 'transform') === 'none') {\n el = el.parentElement;\n }\n return el || document.documentElement;\n\n}\n", "import getScrollParent from './getScrollParent';\nimport getParentNode from './getParentNode';\nimport getReferenceNode from './getReferenceNode';\nimport findCommonOffsetParent from './findCommonOffsetParent';\nimport getOffsetRectRelativeToArbitraryNode from './getOffsetRectRelativeToArbitraryNode';\nimport getViewportOffsetRectRelativeToArtbitraryNode from './getViewportOffsetRectRelativeToArtbitraryNode';\nimport getWindowSizes from './getWindowSizes';\nimport isFixed from './isFixed';\nimport getFixedPositionOffsetParent from './getFixedPositionOffsetParent';\n\n/**\n * Computed the boundaries limits and return them\n * @method\n * @memberof Popper.Utils\n * @param {HTMLElement} popper\n * @param {HTMLElement} reference\n * @param {number} padding\n * @param {HTMLElement} boundariesElement - Element used to define the boundaries\n * @param {Boolean} fixedPosition - Is in fixed position mode\n * @returns {Object} Coordinates of the boundaries\n */\nexport default function getBoundaries(\n popper,\n reference,\n padding,\n boundariesElement,\n fixedPosition = false\n) {\n // NOTE: 1 DOM access here\n\n let boundaries = { top: 0, left: 0 };\n const offsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));\n\n // Handle viewport case\n if (boundariesElement === 'viewport' ) {\n boundaries = getViewportOffsetRectRelativeToArtbitraryNode(offsetParent, fixedPosition);\n }\n\n else {\n // Handle other cases based on DOM element used as boundaries\n let boundariesNode;\n if (boundariesElement === 'scrollParent') {\n boundariesNode = getScrollParent(getParentNode(reference));\n if (boundariesNode.nodeName === 'BODY') {\n boundariesNode = popper.ownerDocument.documentElement;\n }\n } else if (boundariesElement === 'window') {\n boundariesNode = popper.ownerDocument.documentElement;\n } else {\n boundariesNode = boundariesElement;\n }\n\n const offsets = getOffsetRectRelativeToArbitraryNode(\n boundariesNode,\n offsetParent,\n fixedPosition\n );\n\n // In case of HTML, we need a different computation\n if (boundariesNode.nodeName === 'HTML' && !isFixed(offsetParent)) {\n const { height, width } = getWindowSizes(popper.ownerDocument);\n boundaries.top += offsets.top - offsets.marginTop;\n boundaries.bottom = height + offsets.top;\n boundaries.left += offsets.left - offsets.marginLeft;\n boundaries.right = width + offsets.left;\n } else {\n // for all the other DOM elements, this one is good\n boundaries = offsets;\n }\n }\n\n // Add paddings\n padding = padding || 0;\n const isPaddingNumber = typeof padding === 'number';\n boundaries.left += isPaddingNumber ? padding : padding.left || 0; \n boundaries.top += isPaddingNumber ? padding : padding.top || 0; \n boundaries.right -= isPaddingNumber ? padding : padding.right || 0; \n boundaries.bottom -= isPaddingNumber ? padding : padding.bottom || 0; \n\n return boundaries;\n}\n", "import getBoundaries from '../utils/getBoundaries';\n\nfunction getArea({ width, height }) {\n return width * height;\n}\n\n/**\n * Utility used to transform the `auto` placement to the placement with more\n * available space.\n * @method\n * @memberof Popper.Utils\n * @argument {Object} data - The data object generated by update method\n * @argument {Object} options - Modifiers configuration and options\n * @returns {Object} The data object, properly modified\n */\nexport default function computeAutoPlacement(\n placement,\n refRect,\n popper,\n reference,\n boundariesElement,\n padding = 0\n) {\n if (placement.indexOf('auto') === -1) {\n return placement;\n }\n\n const boundaries = getBoundaries(\n popper,\n reference,\n padding,\n boundariesElement\n );\n\n const rects = {\n top: {\n width: boundaries.width,\n height: refRect.top - boundaries.top,\n },\n right: {\n width: boundaries.right - refRect.right,\n height: boundaries.height,\n },\n bottom: {\n width: boundaries.width,\n height: boundaries.bottom - refRect.bottom,\n },\n left: {\n width: refRect.left - boundaries.left,\n height: boundaries.height,\n },\n };\n\n const sortedAreas = Object.keys(rects)\n .map(key => ({\n key,\n ...rects[key],\n area: getArea(rects[key]),\n }))\n .sort((a, b) => b.area - a.area);\n\n const filteredAreas = sortedAreas.filter(\n ({ width, height }) =>\n width >= popper.clientWidth && height >= popper.clientHeight\n );\n\n const computedPlacement = filteredAreas.length > 0\n ? filteredAreas[0].key\n : sortedAreas[0].key;\n\n const variation = placement.split('-')[1];\n\n return computedPlacement + (variation ? `-${variation}` : '');\n}\n", "import findCommonOffsetParent from './findCommonOffsetParent';\nimport getOffsetRectRelativeToArbitraryNode from './getOffsetRectRelativeToArbitraryNode';\nimport getFixedPositionOffsetParent from './getFixedPositionOffsetParent';\nimport getReferenceNode from './getReferenceNode';\n\n/**\n * Get offsets to the reference element\n * @method\n * @memberof Popper.Utils\n * @param {Object} state\n * @param {Element} popper - the popper element\n * @param {Element} reference - the reference element (the popper will be relative to this)\n * @param {Element} fixedPosition - is in fixed position mode\n * @returns {Object} An object containing the offsets which will be applied to the popper\n */\nexport default function getReferenceOffsets(state, popper, reference, fixedPosition = null) {\n const commonOffsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));\n return getOffsetRectRelativeToArbitraryNode(reference, commonOffsetParent, fixedPosition);\n}\n", "/**\n * Get the outer sizes of the given element (offset size + margins)\n * @method\n * @memberof Popper.Utils\n * @argument {Element} element\n * @returns {Object} object containing width and height properties\n */\nexport default function getOuterSizes(element) {\n const window = element.ownerDocument.defaultView;\n const styles = window.getComputedStyle(element);\n const x = parseFloat(styles.marginTop || 0) + parseFloat(styles.marginBottom || 0);\n const y = parseFloat(styles.marginLeft || 0) + parseFloat(styles.marginRight || 0);\n const result = {\n width: element.offsetWidth + y,\n height: element.offsetHeight + x,\n };\n return result;\n}\n", "/**\n * Get the opposite placement of the given one\n * @method\n * @memberof Popper.Utils\n * @argument {String} placement\n * @returns {String} flipped placement\n */\nexport default function getOppositePlacement(placement) {\n const hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };\n return placement.replace(/left|right|bottom|top/g, matched => hash[matched]);\n}\n", "import getOuterSizes from './getOuterSizes';\nimport getOppositePlacement from './getOppositePlacement';\n\n/**\n * Get offsets to the popper\n * @method\n * @memberof Popper.Utils\n * @param {Object} position - CSS position the Popper will get applied\n * @param {HTMLElement} popper - the popper element\n * @param {Object} referenceOffsets - the reference offsets (the popper will be relative to this)\n * @param {String} placement - one of the valid placement options\n * @returns {Object} popperOffsets - An object containing the offsets which will be applied to the popper\n */\nexport default function getPopperOffsets(popper, referenceOffsets, placement) {\n placement = placement.split('-')[0];\n\n // Get popper node sizes\n const popperRect = getOuterSizes(popper);\n\n // Add position, width and height to our offsets object\n const popperOffsets = {\n width: popperRect.width,\n height: popperRect.height,\n };\n\n // depending by the popper placement we have to compute its offsets slightly differently\n const isHoriz = ['right', 'left'].indexOf(placement) !== -1;\n const mainSide = isHoriz ? 'top' : 'left';\n const secondarySide = isHoriz ? 'left' : 'top';\n const measurement = isHoriz ? 'height' : 'width';\n const secondaryMeasurement = !isHoriz ? 'height' : 'width';\n\n popperOffsets[mainSide] =\n referenceOffsets[mainSide] +\n referenceOffsets[measurement] / 2 -\n popperRect[measurement] / 2;\n if (placement === secondarySide) {\n popperOffsets[secondarySide] =\n referenceOffsets[secondarySide] - popperRect[secondaryMeasurement];\n } else {\n popperOffsets[secondarySide] =\n referenceOffsets[getOppositePlacement(secondarySide)];\n }\n\n return popperOffsets;\n}\n", "/**\n * Mimics the `find` method of Array\n * @method\n * @memberof Popper.Utils\n * @argument {Array} arr\n * @argument prop\n * @argument value\n * @returns index or -1\n */\nexport default function find(arr, check) {\n // use native find if supported\n if (Array.prototype.find) {\n return arr.find(check);\n }\n\n // use `filter` to obtain the same behavior of `find`\n return arr.filter(check)[0];\n}\n", "import find from './find';\n\n/**\n * Return the index of the matching object\n * @method\n * @memberof Popper.Utils\n * @argument {Array} arr\n * @argument prop\n * @argument value\n * @returns index or -1\n */\nexport default function findIndex(arr, prop, value) {\n // use native findIndex if supported\n if (Array.prototype.findIndex) {\n return arr.findIndex(cur => cur[prop] === value);\n }\n\n // use `find` + `indexOf` if `findIndex` isn't supported\n const match = find(arr, obj => obj[prop] === value);\n return arr.indexOf(match);\n}\n", "import isFunction from './isFunction';\nimport findIndex from './findIndex';\nimport getClientRect from '../utils/getClientRect';\n\n/**\n * Loop trough the list of modifiers and run them in order,\n * each of them will then edit the data object.\n * @method\n * @memberof Popper.Utils\n * @param {dataObject} data\n * @param {Array} modifiers\n * @param {String} ends - Optional modifier name used as stopper\n * @returns {dataObject}\n */\nexport default function runModifiers(modifiers, data, ends) {\n const modifiersToRun = ends === undefined\n ? modifiers\n : modifiers.slice(0, findIndex(modifiers, 'name', ends));\n\n modifiersToRun.forEach(modifier => {\n if (modifier['function']) { // eslint-disable-line dot-notation\n console.warn('`modifier.function` is deprecated, use `modifier.fn`!');\n }\n const fn = modifier['function'] || modifier.fn; // eslint-disable-line dot-notation\n if (modifier.enabled && isFunction(fn)) {\n // Add properties to offsets to make them a complete clientRect object\n // we do this before each modifier to make sure the previous one doesn't\n // mess with these values\n data.offsets.popper = getClientRect(data.offsets.popper);\n data.offsets.reference = getClientRect(data.offsets.reference);\n\n data = fn(data, modifier);\n }\n });\n\n return data;\n}\n", "import computeAutoPlacement from '../utils/computeAutoPlacement';\nimport getReferenceOffsets from '../utils/getReferenceOffsets';\nimport getPopperOffsets from '../utils/getPopperOffsets';\nimport runModifiers from '../utils/runModifiers';\n\n/**\n * Updates the position of the popper, computing the new offsets and applying\n * the new style.
\n * Prefer `scheduleUpdate` over `update` because of performance reasons.\n * @method\n * @memberof Popper\n */\nexport default function update() {\n // if popper is destroyed, don't perform any further update\n if (this.state.isDestroyed) {\n return;\n }\n\n let data = {\n instance: this,\n styles: {},\n arrowStyles: {},\n attributes: {},\n flipped: false,\n offsets: {},\n };\n\n // compute reference element offsets\n data.offsets.reference = getReferenceOffsets(\n this.state,\n this.popper,\n this.reference,\n this.options.positionFixed\n );\n\n // compute auto placement, store placement inside the data object,\n // modifiers will be able to edit `placement` if needed\n // and refer to originalPlacement to know the original value\n data.placement = computeAutoPlacement(\n this.options.placement,\n data.offsets.reference,\n this.popper,\n this.reference,\n this.options.modifiers.flip.boundariesElement,\n this.options.modifiers.flip.padding\n );\n\n // store the computed placement inside `originalPlacement`\n data.originalPlacement = data.placement;\n\n data.positionFixed = this.options.positionFixed;\n\n // compute the popper offsets\n data.offsets.popper = getPopperOffsets(\n this.popper,\n data.offsets.reference,\n data.placement\n );\n\n data.offsets.popper.position = this.options.positionFixed\n ? 'fixed'\n : 'absolute';\n\n // run the modifiers\n data = runModifiers(this.modifiers, data);\n\n // the first `update` will call `onCreate` callback\n // the other ones will call `onUpdate` callback\n if (!this.state.isCreated) {\n this.state.isCreated = true;\n this.options.onCreate(data);\n } else {\n this.options.onUpdate(data);\n }\n}\n", "/**\n * Helper used to know if the given modifier is enabled.\n * @method\n * @memberof Popper.Utils\n * @returns {Boolean}\n */\nexport default function isModifierEnabled(modifiers, modifierName) {\n return modifiers.some(\n ({ name, enabled }) => enabled && name === modifierName\n );\n}\n", "/**\n * Get the prefixed supported property name\n * @method\n * @memberof Popper.Utils\n * @argument {String} property (camelCase)\n * @returns {String} prefixed property (camelCase or PascalCase, depending on the vendor prefix)\n */\nexport default function getSupportedPropertyName(property) {\n const prefixes = [false, 'ms', 'Webkit', 'Moz', 'O'];\n const upperProp = property.charAt(0).toUpperCase() + property.slice(1);\n\n for (let i = 0; i < prefixes.length; i++) {\n const prefix = prefixes[i];\n const toCheck = prefix ? `${prefix}${upperProp}` : property;\n if (typeof document.body.style[toCheck] !== 'undefined') {\n return toCheck;\n }\n }\n return null;\n}\n", "import isModifierEnabled from '../utils/isModifierEnabled';\nimport getSupportedPropertyName from '../utils/getSupportedPropertyName';\n\n/**\n * Destroys the popper.\n * @method\n * @memberof Popper\n */\nexport default function destroy() {\n this.state.isDestroyed = true;\n\n // touch DOM only if `applyStyle` modifier is enabled\n if (isModifierEnabled(this.modifiers, 'applyStyle')) {\n this.popper.removeAttribute('x-placement');\n this.popper.style.position = '';\n this.popper.style.top = '';\n this.popper.style.left = '';\n this.popper.style.right = '';\n this.popper.style.bottom = '';\n this.popper.style.willChange = '';\n this.popper.style[getSupportedPropertyName('transform')] = '';\n }\n\n this.disableEventListeners();\n\n // remove the popper if user explicitly asked for the deletion on destroy\n // do not use `remove` because IE11 doesn't support it\n if (this.options.removeOnDestroy) {\n this.popper.parentNode.removeChild(this.popper);\n }\n return this;\n}\n", "/**\n * Get the window associated with the element\n * @argument {Element} element\n * @returns {Window}\n */\nexport default function getWindow(element) {\n const ownerDocument = element.ownerDocument;\n return ownerDocument ? ownerDocument.defaultView : window;\n}\n", "import getScrollParent from './getScrollParent';\nimport getWindow from './getWindow';\n\nfunction attachToScrollParents(scrollParent, event, callback, scrollParents) {\n const isBody = scrollParent.nodeName === 'BODY';\n const target = isBody ? scrollParent.ownerDocument.defaultView : scrollParent;\n target.addEventListener(event, callback, { passive: true });\n\n if (!isBody) {\n attachToScrollParents(\n getScrollParent(target.parentNode),\n event,\n callback,\n scrollParents\n );\n }\n scrollParents.push(target);\n}\n\n/**\n * Setup needed event listeners used to update the popper position\n * @method\n * @memberof Popper.Utils\n * @private\n */\nexport default function setupEventListeners(\n reference,\n options,\n state,\n updateBound\n) {\n // Resize event listener on window\n state.updateBound = updateBound;\n getWindow(reference).addEventListener('resize', state.updateBound, { passive: true });\n\n // Scroll event listener on scroll parents\n const scrollElement = getScrollParent(reference);\n attachToScrollParents(\n scrollElement,\n 'scroll',\n state.updateBound,\n state.scrollParents\n );\n state.scrollElement = scrollElement;\n state.eventsEnabled = true;\n\n return state;\n}\n", "import setupEventListeners from '../utils/setupEventListeners';\n\n/**\n * It will add resize/scroll events and start recalculating\n * position of the popper element when they are triggered.\n * @method\n * @memberof Popper\n */\nexport default function enableEventListeners() {\n if (!this.state.eventsEnabled) {\n this.state = setupEventListeners(\n this.reference,\n this.options,\n this.state,\n this.scheduleUpdate\n );\n }\n}\n", "import getWindow from './getWindow';\n\n/**\n * Remove event listeners used to update the popper position\n * @method\n * @memberof Popper.Utils\n * @private\n */\nexport default function removeEventListeners(reference, state) {\n // Remove resize event listener on window\n getWindow(reference).removeEventListener('resize', state.updateBound);\n\n // Remove scroll event listener on scroll parents\n state.scrollParents.forEach(target => {\n target.removeEventListener('scroll', state.updateBound);\n });\n\n // Reset state\n state.updateBound = null;\n state.scrollParents = [];\n state.scrollElement = null;\n state.eventsEnabled = false;\n return state;\n}\n", "import removeEventListeners from '../utils/removeEventListeners';\n\n/**\n * It will remove resize/scroll events and won't recalculate popper position\n * when they are triggered. It also won't trigger `onUpdate` callback anymore,\n * unless you call `update` method manually.\n * @method\n * @memberof Popper\n */\nexport default function disableEventListeners() {\n if (this.state.eventsEnabled) {\n cancelAnimationFrame(this.scheduleUpdate);\n this.state = removeEventListeners(this.reference, this.state);\n }\n}\n", "/**\n * Tells if a given input is a number\n * @method\n * @memberof Popper.Utils\n * @param {*} input to check\n * @return {Boolean}\n */\nexport default function isNumeric(n) {\n return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);\n}\n", "import isNumeric from './isNumeric';\n\n/**\n * Set the style to the given popper\n * @method\n * @memberof Popper.Utils\n * @argument {Element} element - Element to apply the style to\n * @argument {Object} styles\n * Object with a list of properties and values which will be applied to the element\n */\nexport default function setStyles(element, styles) {\n Object.keys(styles).forEach(prop => {\n let unit = '';\n // add unit if the value is numeric and is one of the following\n if (\n ['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !==\n -1 &&\n isNumeric(styles[prop])\n ) {\n unit = 'px';\n }\n element.style[prop] = styles[prop] + unit;\n });\n}\n", "/**\n * Set the attributes to the given popper\n * @method\n * @memberof Popper.Utils\n * @argument {Element} element - Element to apply the attributes to\n * @argument {Object} styles\n * Object with a list of properties and values which will be applied to the element\n */\nexport default function setAttributes(element, attributes) {\n Object.keys(attributes).forEach(function(prop) {\n const value = attributes[prop];\n if (value !== false) {\n element.setAttribute(prop, attributes[prop]);\n } else {\n element.removeAttribute(prop);\n }\n });\n}\n", "import setStyles from '../utils/setStyles';\nimport setAttributes from '../utils/setAttributes';\nimport getReferenceOffsets from '../utils/getReferenceOffsets';\nimport computeAutoPlacement from '../utils/computeAutoPlacement';\n\n/**\n * @function\n * @memberof Modifiers\n * @argument {Object} data - The data object generated by `update` method\n * @argument {Object} data.styles - List of style properties - values to apply to popper element\n * @argument {Object} data.attributes - List of attribute properties - values to apply to popper element\n * @argument {Object} options - Modifiers configuration and options\n * @returns {Object} The same data object\n */\nexport default function applyStyle(data) {\n // any property present in `data.styles` will be applied to the popper,\n // in this way we can make the 3rd party modifiers add custom styles to it\n // Be aware, modifiers could override the properties defined in the previous\n // lines of this modifier!\n setStyles(data.instance.popper, data.styles);\n\n // any property present in `data.attributes` will be applied to the popper,\n // they will be set as HTML attributes of the element\n setAttributes(data.instance.popper, data.attributes);\n\n // if arrowElement is defined and arrowStyles has some properties\n if (data.arrowElement && Object.keys(data.arrowStyles).length) {\n setStyles(data.arrowElement, data.arrowStyles);\n }\n\n return data;\n}\n\n/**\n * Set the x-placement attribute before everything else because it could be used\n * to add margins to the popper margins needs to be calculated to get the\n * correct popper offsets.\n * @method\n * @memberof Popper.modifiers\n * @param {HTMLElement} reference - The reference element used to position the popper\n * @param {HTMLElement} popper - The HTML element used as popper\n * @param {Object} options - Popper.js options\n */\nexport function applyStyleOnLoad(\n reference,\n popper,\n options,\n modifierOptions,\n state\n) {\n // compute reference element offsets\n const referenceOffsets = getReferenceOffsets(state, popper, reference, options.positionFixed);\n\n // compute auto placement, store placement inside the data object,\n // modifiers will be able to edit `placement` if needed\n // and refer to originalPlacement to know the original value\n const placement = computeAutoPlacement(\n options.placement,\n referenceOffsets,\n popper,\n reference,\n options.modifiers.flip.boundariesElement,\n options.modifiers.flip.padding\n );\n\n popper.setAttribute('x-placement', placement);\n\n // Apply `position` to popper before anything else because\n // without the position applied we can't guarantee correct computations\n setStyles(popper, { position: options.positionFixed ? 'fixed' : 'absolute' });\n\n return options;\n}\n", "/**\n * @function\n * @memberof Popper.Utils\n * @argument {Object} data - The data object generated by `update` method\n * @argument {Boolean} shouldRound - If the offsets should be rounded at all\n * @returns {Object} The popper's position offsets rounded\n *\n * The tale of pixel-perfect positioning. It's still not 100% perfect, but as\n * good as it can be within reason.\n * Discussion here: https://github.com/FezVrasta/popper.js/pull/715\n *\n * Low DPI screens cause a popper to be blurry if not using full pixels (Safari\n * as well on High DPI screens).\n *\n * Firefox prefers no rounding for positioning and does not have blurriness on\n * high DPI screens.\n *\n * Only horizontal placement and left/right values need to be considered.\n */\nexport default function getRoundedOffsets(data, shouldRound) {\n const { popper, reference } = data.offsets;\n const { round, floor } = Math;\n const noRound = v => v;\n \n const referenceWidth = round(reference.width);\n const popperWidth = round(popper.width);\n \n const isVertical = ['left', 'right'].indexOf(data.placement) !== -1;\n const isVariation = data.placement.indexOf('-') !== -1;\n const sameWidthParity = referenceWidth % 2 === popperWidth % 2;\n const bothOddWidth = referenceWidth % 2 === 1 && popperWidth % 2 === 1;\n\n const horizontalToInteger = !shouldRound\n ? noRound\n : isVertical || isVariation || sameWidthParity\n ? round\n : floor;\n const verticalToInteger = !shouldRound ? noRound : round;\n\n return {\n left: horizontalToInteger(\n bothOddWidth && !isVariation && shouldRound\n ? popper.left - 1\n : popper.left\n ),\n top: verticalToInteger(popper.top),\n bottom: verticalToInteger(popper.bottom),\n right: horizontalToInteger(popper.right),\n };\n}\n", "import getSupportedPropertyName from '../utils/getSupportedPropertyName';\nimport find from '../utils/find';\nimport getOffsetParent from '../utils/getOffsetParent';\nimport getBoundingClientRect from '../utils/getBoundingClientRect';\nimport getRoundedOffsets from '../utils/getRoundedOffsets';\nimport isBrowser from '../utils/isBrowser';\n\nconst isFirefox = isBrowser && /Firefox/i.test(navigator.userAgent);\n\n/**\n * @function\n * @memberof Modifiers\n * @argument {Object} data - The data object generated by `update` method\n * @argument {Object} options - Modifiers configuration and options\n * @returns {Object} The data object, properly modified\n */\nexport default function computeStyle(data, options) {\n const { x, y } = options;\n const { popper } = data.offsets;\n\n // Remove this legacy support in Popper.js v2\n const legacyGpuAccelerationOption = find(\n data.instance.modifiers,\n modifier => modifier.name === 'applyStyle'\n ).gpuAcceleration;\n if (legacyGpuAccelerationOption !== undefined) {\n console.warn(\n 'WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!'\n );\n }\n const gpuAcceleration =\n legacyGpuAccelerationOption !== undefined\n ? legacyGpuAccelerationOption\n : options.gpuAcceleration;\n\n const offsetParent = getOffsetParent(data.instance.popper);\n const offsetParentRect = getBoundingClientRect(offsetParent);\n\n // Styles\n const styles = {\n position: popper.position,\n };\n\n const offsets = getRoundedOffsets(\n data,\n window.devicePixelRatio < 2 || !isFirefox\n );\n\n const sideA = x === 'bottom' ? 'top' : 'bottom';\n const sideB = y === 'right' ? 'left' : 'right';\n\n // if gpuAcceleration is set to `true` and transform is supported,\n // we use `translate3d` to apply the position to the popper we\n // automatically use the supported prefixed version if needed\n const prefixedProperty = getSupportedPropertyName('transform');\n\n // now, let's make a step back and look at this code closely (wtf?)\n // If the content of the popper grows once it's been positioned, it\n // may happen that the popper gets misplaced because of the new content\n // overflowing its reference element\n // To avoid this problem, we provide two options (x and y), which allow\n // the consumer to define the offset origin.\n // If we position a popper on top of a reference element, we can set\n // `x` to `top` to make the popper grow towards its top instead of\n // its bottom.\n let left, top;\n if (sideA === 'bottom') {\n // when offsetParent is the positioning is relative to the bottom of the screen (excluding the scrollbar)\n // and not the bottom of the html element\n if (offsetParent.nodeName === 'HTML') {\n top = -offsetParent.clientHeight + offsets.bottom;\n } else {\n top = -offsetParentRect.height + offsets.bottom;\n }\n } else {\n top = offsets.top;\n }\n if (sideB === 'right') {\n if (offsetParent.nodeName === 'HTML') {\n left = -offsetParent.clientWidth + offsets.right;\n } else {\n left = -offsetParentRect.width + offsets.right;\n }\n } else {\n left = offsets.left;\n }\n if (gpuAcceleration && prefixedProperty) {\n styles[prefixedProperty] = `translate3d(${left}px, ${top}px, 0)`;\n styles[sideA] = 0;\n styles[sideB] = 0;\n styles.willChange = 'transform';\n } else {\n // othwerise, we use the standard `top`, `left`, `bottom` and `right` properties\n const invertTop = sideA === 'bottom' ? -1 : 1;\n const invertLeft = sideB === 'right' ? -1 : 1;\n styles[sideA] = top * invertTop;\n styles[sideB] = left * invertLeft;\n styles.willChange = `${sideA}, ${sideB}`;\n }\n\n // Attributes\n const attributes = {\n 'x-placement': data.placement,\n };\n\n // Update `data` attributes, styles and arrowStyles\n data.attributes = { ...attributes, ...data.attributes };\n data.styles = { ...styles, ...data.styles };\n data.arrowStyles = { ...data.offsets.arrow, ...data.arrowStyles };\n\n return data;\n}\n", "import find from './find';\n\n/**\n * Helper used to know if the given modifier depends from another one.
\n * It checks if the needed modifier is listed and enabled.\n * @method\n * @memberof Popper.Utils\n * @param {Array} modifiers - list of modifiers\n * @param {String} requestingName - name of requesting modifier\n * @param {String} requestedName - name of requested modifier\n * @returns {Boolean}\n */\nexport default function isModifierRequired(\n modifiers,\n requestingName,\n requestedName\n) {\n const requesting = find(modifiers, ({ name }) => name === requestingName);\n\n const isRequired =\n !!requesting &&\n modifiers.some(modifier => {\n return (\n modifier.name === requestedName &&\n modifier.enabled &&\n modifier.order < requesting.order\n );\n });\n\n if (!isRequired) {\n const requesting = `\\`${requestingName}\\``;\n const requested = `\\`${requestedName}\\``;\n console.warn(\n `${requested} modifier is required by ${requesting} modifier in order to work, be sure to include it before ${requesting}!`\n );\n }\n return isRequired;\n}\n", "import getClientRect from '../utils/getClientRect';\nimport getOuterSizes from '../utils/getOuterSizes';\nimport isModifierRequired from '../utils/isModifierRequired';\nimport getStyleComputedProperty from '../utils/getStyleComputedProperty';\n\n/**\n * @function\n * @memberof Modifiers\n * @argument {Object} data - The data object generated by update method\n * @argument {Object} options - Modifiers configuration and options\n * @returns {Object} The data object, properly modified\n */\nexport default function arrow(data, options) {\n // arrow depends on keepTogether in order to work\n if (!isModifierRequired(data.instance.modifiers, 'arrow', 'keepTogether')) {\n return data;\n }\n\n let arrowElement = options.element;\n\n // if arrowElement is a string, suppose it's a CSS selector\n if (typeof arrowElement === 'string') {\n arrowElement = data.instance.popper.querySelector(arrowElement);\n\n // if arrowElement is not found, don't run the modifier\n if (!arrowElement) {\n return data;\n }\n } else {\n // if the arrowElement isn't a query selector we must check that the\n // provided DOM node is child of its popper node\n if (!data.instance.popper.contains(arrowElement)) {\n console.warn(\n 'WARNING: `arrow.element` must be child of its popper element!'\n );\n return data;\n }\n }\n\n const placement = data.placement.split('-')[0];\n const { popper, reference } = data.offsets;\n const isVertical = ['left', 'right'].indexOf(placement) !== -1;\n\n const len = isVertical ? 'height' : 'width';\n const sideCapitalized = isVertical ? 'Top' : 'Left';\n const side = sideCapitalized.toLowerCase();\n const altSide = isVertical ? 'left' : 'top';\n const opSide = isVertical ? 'bottom' : 'right';\n const arrowElementSize = getOuterSizes(arrowElement)[len];\n\n //\n // extends keepTogether behavior making sure the popper and its\n // reference have enough pixels in conjunction\n //\n\n // top/left side\n if (reference[opSide] - arrowElementSize < popper[side]) {\n data.offsets.popper[side] -=\n popper[side] - (reference[opSide] - arrowElementSize);\n }\n // bottom/right side\n if (reference[side] + arrowElementSize > popper[opSide]) {\n data.offsets.popper[side] +=\n reference[side] + arrowElementSize - popper[opSide];\n }\n data.offsets.popper = getClientRect(data.offsets.popper);\n\n // compute center of the popper\n const center = reference[side] + reference[len] / 2 - arrowElementSize / 2;\n\n // Compute the sideValue using the updated popper offsets\n // take popper margin in account because we don't have this info available\n const css = getStyleComputedProperty(data.instance.popper);\n const popperMarginSide = parseFloat(css[`margin${sideCapitalized}`]);\n const popperBorderSide = parseFloat(css[`border${sideCapitalized}Width`]);\n let sideValue =\n center - data.offsets.popper[side] - popperMarginSide - popperBorderSide;\n\n // prevent arrowElement from being placed not contiguously to its popper\n sideValue = Math.max(Math.min(popper[len] - arrowElementSize, sideValue), 0);\n\n data.arrowElement = arrowElement;\n data.offsets.arrow = {\n [side]: Math.round(sideValue),\n [altSide]: '', // make sure to unset any eventual altSide value from the DOM node\n };\n\n return data;\n}\n", "/**\n * Get the opposite placement variation of the given one\n * @method\n * @memberof Popper.Utils\n * @argument {String} placement variation\n * @returns {String} flipped placement variation\n */\nexport default function getOppositeVariation(variation) {\n if (variation === 'end') {\n return 'start';\n } else if (variation === 'start') {\n return 'end';\n }\n return variation;\n}\n", "/**\n * List of accepted placements to use as values of the `placement` option.
\n * Valid placements are:\n * - `auto`\n * - `top`\n * - `right`\n * - `bottom`\n * - `left`\n *\n * Each placement can have a variation from this list:\n * - `-start`\n * - `-end`\n *\n * Variations are interpreted easily if you think of them as the left to right\n * written languages. Horizontally (`top` and `bottom`), `start` is left and `end`\n * is right.
\n * Vertically (`left` and `right`), `start` is top and `end` is bottom.\n *\n * Some valid examples are:\n * - `top-end` (on top of reference, right aligned)\n * - `right-start` (on right of reference, top aligned)\n * - `bottom` (on bottom, centered)\n * - `auto-end` (on the side with more space available, alignment depends by placement)\n *\n * @static\n * @type {Array}\n * @enum {String}\n * @readonly\n * @method placements\n * @memberof Popper\n */\nexport default [\n 'auto-start',\n 'auto',\n 'auto-end',\n 'top-start',\n 'top',\n 'top-end',\n 'right-start',\n 'right',\n 'right-end',\n 'bottom-end',\n 'bottom',\n 'bottom-start',\n 'left-end',\n 'left',\n 'left-start',\n];\n", "import placements from '../methods/placements';\n\n// Get rid of `auto` `auto-start` and `auto-end`\nconst validPlacements = placements.slice(3);\n\n/**\n * Given an initial placement, returns all the subsequent placements\n * clockwise (or counter-clockwise).\n *\n * @method\n * @memberof Popper.Utils\n * @argument {String} placement - A valid placement (it accepts variations)\n * @argument {Boolean} counter - Set to true to walk the placements counterclockwise\n * @returns {Array} placements including their variations\n */\nexport default function clockwise(placement, counter = false) {\n const index = validPlacements.indexOf(placement);\n const arr = validPlacements\n .slice(index + 1)\n .concat(validPlacements.slice(0, index));\n return counter ? arr.reverse() : arr;\n}\n", "import getOppositePlacement from '../utils/getOppositePlacement';\nimport getOppositeVariation from '../utils/getOppositeVariation';\nimport getPopperOffsets from '../utils/getPopperOffsets';\nimport runModifiers from '../utils/runModifiers';\nimport getBoundaries from '../utils/getBoundaries';\nimport isModifierEnabled from '../utils/isModifierEnabled';\nimport clockwise from '../utils/clockwise';\n\nconst BEHAVIORS = {\n FLIP: 'flip',\n CLOCKWISE: 'clockwise',\n COUNTERCLOCKWISE: 'counterclockwise',\n};\n\n/**\n * @function\n * @memberof Modifiers\n * @argument {Object} data - The data object generated by update method\n * @argument {Object} options - Modifiers configuration and options\n * @returns {Object} The data object, properly modified\n */\nexport default function flip(data, options) {\n // if `inner` modifier is enabled, we can't use the `flip` modifier\n if (isModifierEnabled(data.instance.modifiers, 'inner')) {\n return data;\n }\n\n if (data.flipped && data.placement === data.originalPlacement) {\n // seems like flip is trying to loop, probably there's not enough space on any of the flippable sides\n return data;\n }\n\n const boundaries = getBoundaries(\n data.instance.popper,\n data.instance.reference,\n options.padding,\n options.boundariesElement,\n data.positionFixed\n );\n\n let placement = data.placement.split('-')[0];\n let placementOpposite = getOppositePlacement(placement);\n let variation = data.placement.split('-')[1] || '';\n\n let flipOrder = [];\n\n switch (options.behavior) {\n case BEHAVIORS.FLIP:\n flipOrder = [placement, placementOpposite];\n break;\n case BEHAVIORS.CLOCKWISE:\n flipOrder = clockwise(placement);\n break;\n case BEHAVIORS.COUNTERCLOCKWISE:\n flipOrder = clockwise(placement, true);\n break;\n default:\n flipOrder = options.behavior;\n }\n\n flipOrder.forEach((step, index) => {\n if (placement !== step || flipOrder.length === index + 1) {\n return data;\n }\n\n placement = data.placement.split('-')[0];\n placementOpposite = getOppositePlacement(placement);\n\n const popperOffsets = data.offsets.popper;\n const refOffsets = data.offsets.reference;\n\n // using floor because the reference offsets may contain decimals we are not going to consider here\n const floor = Math.floor;\n const overlapsRef =\n (placement === 'left' &&\n floor(popperOffsets.right) > floor(refOffsets.left)) ||\n (placement === 'right' &&\n floor(popperOffsets.left) < floor(refOffsets.right)) ||\n (placement === 'top' &&\n floor(popperOffsets.bottom) > floor(refOffsets.top)) ||\n (placement === 'bottom' &&\n floor(popperOffsets.top) < floor(refOffsets.bottom));\n\n const overflowsLeft = floor(popperOffsets.left) < floor(boundaries.left);\n const overflowsRight = floor(popperOffsets.right) > floor(boundaries.right);\n const overflowsTop = floor(popperOffsets.top) < floor(boundaries.top);\n const overflowsBottom =\n floor(popperOffsets.bottom) > floor(boundaries.bottom);\n\n const overflowsBoundaries =\n (placement === 'left' && overflowsLeft) ||\n (placement === 'right' && overflowsRight) ||\n (placement === 'top' && overflowsTop) ||\n (placement === 'bottom' && overflowsBottom);\n\n // flip the variation if required\n const isVertical = ['top', 'bottom'].indexOf(placement) !== -1;\n\n // flips variation if reference element overflows boundaries\n const flippedVariationByRef =\n !!options.flipVariations &&\n ((isVertical && variation === 'start' && overflowsLeft) ||\n (isVertical && variation === 'end' && overflowsRight) ||\n (!isVertical && variation === 'start' && overflowsTop) ||\n (!isVertical && variation === 'end' && overflowsBottom));\n\n // flips variation if popper content overflows boundaries\n const flippedVariationByContent =\n !!options.flipVariationsByContent &&\n ((isVertical && variation === 'start' && overflowsRight) ||\n (isVertical && variation === 'end' && overflowsLeft) ||\n (!isVertical && variation === 'start' && overflowsBottom) ||\n (!isVertical && variation === 'end' && overflowsTop));\n\n const flippedVariation = flippedVariationByRef || flippedVariationByContent;\n\n if (overlapsRef || overflowsBoundaries || flippedVariation) {\n // this boolean to detect any flip loop\n data.flipped = true;\n\n if (overlapsRef || overflowsBoundaries) {\n placement = flipOrder[index + 1];\n }\n\n if (flippedVariation) {\n variation = getOppositeVariation(variation);\n }\n\n data.placement = placement + (variation ? '-' + variation : '');\n\n // this object contains `position`, we want to preserve it along with\n // any additional property we may add in the future\n data.offsets.popper = {\n ...data.offsets.popper,\n ...getPopperOffsets(\n data.instance.popper,\n data.offsets.reference,\n data.placement\n ),\n };\n\n data = runModifiers(data.instance.modifiers, data, 'flip');\n }\n });\n return data;\n}\n", "/**\n * @function\n * @memberof Modifiers\n * @argument {Object} data - The data object generated by update method\n * @argument {Object} options - Modifiers configuration and options\n * @returns {Object} The data object, properly modified\n */\nexport default function keepTogether(data) {\n const { popper, reference } = data.offsets;\n const placement = data.placement.split('-')[0];\n const floor = Math.floor;\n const isVertical = ['top', 'bottom'].indexOf(placement) !== -1;\n const side = isVertical ? 'right' : 'bottom';\n const opSide = isVertical ? 'left' : 'top';\n const measurement = isVertical ? 'width' : 'height';\n\n if (popper[side] < floor(reference[opSide])) {\n data.offsets.popper[opSide] =\n floor(reference[opSide]) - popper[measurement];\n }\n if (popper[opSide] > floor(reference[side])) {\n data.offsets.popper[opSide] = floor(reference[side]);\n }\n\n return data;\n}\n", "import isNumeric from '../utils/isNumeric';\nimport getClientRect from '../utils/getClientRect';\nimport find from '../utils/find';\n\n/**\n * Converts a string containing value + unit into a px value number\n * @function\n * @memberof {modifiers~offset}\n * @private\n * @argument {String} str - Value + unit string\n * @argument {String} measurement - `height` or `width`\n * @argument {Object} popperOffsets\n * @argument {Object} referenceOffsets\n * @returns {Number|String}\n * Value in pixels, or original string if no values were extracted\n */\nexport function toValue(str, measurement, popperOffsets, referenceOffsets) {\n // separate value from unit\n const split = str.match(/((?:\\-|\\+)?\\d*\\.?\\d*)(.*)/);\n const value = +split[1];\n const unit = split[2];\n\n // If it's not a number it's an operator, I guess\n if (!value) {\n return str;\n }\n\n if (unit.indexOf('%') === 0) {\n let element;\n switch (unit) {\n case '%p':\n element = popperOffsets;\n break;\n case '%':\n case '%r':\n default:\n element = referenceOffsets;\n }\n\n const rect = getClientRect(element);\n return rect[measurement] / 100 * value;\n } else if (unit === 'vh' || unit === 'vw') {\n // if is a vh or vw, we calculate the size based on the viewport\n let size;\n if (unit === 'vh') {\n size = Math.max(\n document.documentElement.clientHeight,\n window.innerHeight || 0\n );\n } else {\n size = Math.max(\n document.documentElement.clientWidth,\n window.innerWidth || 0\n );\n }\n return size / 100 * value;\n } else {\n // if is an explicit pixel unit, we get rid of the unit and keep the value\n // if is an implicit unit, it's px, and we return just the value\n return value;\n }\n}\n\n/**\n * Parse an `offset` string to extrapolate `x` and `y` numeric offsets.\n * @function\n * @memberof {modifiers~offset}\n * @private\n * @argument {String} offset\n * @argument {Object} popperOffsets\n * @argument {Object} referenceOffsets\n * @argument {String} basePlacement\n * @returns {Array} a two cells array with x and y offsets in numbers\n */\nexport function parseOffset(\n offset,\n popperOffsets,\n referenceOffsets,\n basePlacement\n) {\n const offsets = [0, 0];\n\n // Use height if placement is left or right and index is 0 otherwise use width\n // in this way the first offset will use an axis and the second one\n // will use the other one\n const useHeight = ['right', 'left'].indexOf(basePlacement) !== -1;\n\n // Split the offset string to obtain a list of values and operands\n // The regex addresses values with the plus or minus sign in front (+10, -20, etc)\n const fragments = offset.split(/(\\+|\\-)/).map(frag => frag.trim());\n\n // Detect if the offset string contains a pair of values or a single one\n // they could be separated by comma or space\n const divider = fragments.indexOf(\n find(fragments, frag => frag.search(/,|\\s/) !== -1)\n );\n\n if (fragments[divider] && fragments[divider].indexOf(',') === -1) {\n console.warn(\n 'Offsets separated by white space(s) are deprecated, use a comma (,) instead.'\n );\n }\n\n // If divider is found, we divide the list of values and operands to divide\n // them by ofset X and Y.\n const splitRegex = /\\s*,\\s*|\\s+/;\n let ops = divider !== -1\n ? [\n fragments\n .slice(0, divider)\n .concat([fragments[divider].split(splitRegex)[0]]),\n [fragments[divider].split(splitRegex)[1]].concat(\n fragments.slice(divider + 1)\n ),\n ]\n : [fragments];\n\n // Convert the values with units to absolute pixels to allow our computations\n ops = ops.map((op, index) => {\n // Most of the units rely on the orientation of the popper\n const measurement = (index === 1 ? !useHeight : useHeight)\n ? 'height'\n : 'width';\n let mergeWithPrevious = false;\n return (\n op\n // This aggregates any `+` or `-` sign that aren't considered operators\n // e.g.: 10 + +5 => [10, +, +5]\n .reduce((a, b) => {\n if (a[a.length - 1] === '' && ['+', '-'].indexOf(b) !== -1) {\n a[a.length - 1] = b;\n mergeWithPrevious = true;\n return a;\n } else if (mergeWithPrevious) {\n a[a.length - 1] += b;\n mergeWithPrevious = false;\n return a;\n } else {\n return a.concat(b);\n }\n }, [])\n // Here we convert the string values into number values (in px)\n .map(str => toValue(str, measurement, popperOffsets, referenceOffsets))\n );\n });\n\n // Loop trough the offsets arrays and execute the operations\n ops.forEach((op, index) => {\n op.forEach((frag, index2) => {\n if (isNumeric(frag)) {\n offsets[index] += frag * (op[index2 - 1] === '-' ? -1 : 1);\n }\n });\n });\n return offsets;\n}\n\n/**\n * @function\n * @memberof Modifiers\n * @argument {Object} data - The data object generated by update method\n * @argument {Object} options - Modifiers configuration and options\n * @argument {Number|String} options.offset=0\n * The offset value as described in the modifier description\n * @returns {Object} The data object, properly modified\n */\nexport default function offset(data, { offset }) {\n const { placement, offsets: { popper, reference } } = data;\n const basePlacement = placement.split('-')[0];\n\n let offsets;\n if (isNumeric(+offset)) {\n offsets = [+offset, 0];\n } else {\n offsets = parseOffset(offset, popper, reference, basePlacement);\n }\n\n if (basePlacement === 'left') {\n popper.top += offsets[0];\n popper.left -= offsets[1];\n } else if (basePlacement === 'right') {\n popper.top += offsets[0];\n popper.left += offsets[1];\n } else if (basePlacement === 'top') {\n popper.left += offsets[0];\n popper.top -= offsets[1];\n } else if (basePlacement === 'bottom') {\n popper.left += offsets[0];\n popper.top += offsets[1];\n }\n\n data.popper = popper;\n return data;\n}\n", "import getOffsetParent from '../utils/getOffsetParent';\nimport getBoundaries from '../utils/getBoundaries';\nimport getSupportedPropertyName from '../utils/getSupportedPropertyName';\n\n/**\n * @function\n * @memberof Modifiers\n * @argument {Object} data - The data object generated by `update` method\n * @argument {Object} options - Modifiers configuration and options\n * @returns {Object} The data object, properly modified\n */\nexport default function preventOverflow(data, options) {\n let boundariesElement =\n options.boundariesElement || getOffsetParent(data.instance.popper);\n\n // If offsetParent is the reference element, we really want to\n // go one step up and use the next offsetParent as reference to\n // avoid to make this modifier completely useless and look like broken\n if (data.instance.reference === boundariesElement) {\n boundariesElement = getOffsetParent(boundariesElement);\n }\n\n // NOTE: DOM access here\n // resets the popper's position so that the document size can be calculated excluding\n // the size of the popper element itself\n const transformProp = getSupportedPropertyName('transform');\n const popperStyles = data.instance.popper.style; // assignment to help minification\n const { top, left, [transformProp]: transform } = popperStyles;\n popperStyles.top = '';\n popperStyles.left = '';\n popperStyles[transformProp] = '';\n\n const boundaries = getBoundaries(\n data.instance.popper,\n data.instance.reference,\n options.padding,\n boundariesElement,\n data.positionFixed\n );\n\n // NOTE: DOM access here\n // restores the original style properties after the offsets have been computed\n popperStyles.top = top;\n popperStyles.left = left;\n popperStyles[transformProp] = transform;\n\n options.boundaries = boundaries;\n\n const order = options.priority;\n let popper = data.offsets.popper;\n\n const check = {\n primary(placement) {\n let value = popper[placement];\n if (\n popper[placement] < boundaries[placement] &&\n !options.escapeWithReference\n ) {\n value = Math.max(popper[placement], boundaries[placement]);\n }\n return { [placement]: value };\n },\n secondary(placement) {\n const mainSide = placement === 'right' ? 'left' : 'top';\n let value = popper[mainSide];\n if (\n popper[placement] > boundaries[placement] &&\n !options.escapeWithReference\n ) {\n value = Math.min(\n popper[mainSide],\n boundaries[placement] -\n (placement === 'right' ? popper.width : popper.height)\n );\n }\n return { [mainSide]: value };\n },\n };\n\n order.forEach(placement => {\n const side =\n ['left', 'top'].indexOf(placement) !== -1 ? 'primary' : 'secondary';\n popper = { ...popper, ...check[side](placement) };\n });\n\n data.offsets.popper = popper;\n\n return data;\n}\n", "/**\n * @function\n * @memberof Modifiers\n * @argument {Object} data - The data object generated by `update` method\n * @argument {Object} options - Modifiers configuration and options\n * @returns {Object} The data object, properly modified\n */\nexport default function shift(data) {\n const placement = data.placement;\n const basePlacement = placement.split('-')[0];\n const shiftvariation = placement.split('-')[1];\n\n // if shift shiftvariation is specified, run the modifier\n if (shiftvariation) {\n const { reference, popper } = data.offsets;\n const isVertical = ['bottom', 'top'].indexOf(basePlacement) !== -1;\n const side = isVertical ? 'left' : 'top';\n const measurement = isVertical ? 'width' : 'height';\n\n const shiftOffsets = {\n start: { [side]: reference[side] },\n end: {\n [side]: reference[side] + reference[measurement] - popper[measurement],\n },\n };\n\n data.offsets.popper = { ...popper, ...shiftOffsets[shiftvariation] };\n }\n\n return data;\n}\n", "import isModifierRequired from '../utils/isModifierRequired';\nimport find from '../utils/find';\n\n/**\n * @function\n * @memberof Modifiers\n * @argument {Object} data - The data object generated by update method\n * @argument {Object} options - Modifiers configuration and options\n * @returns {Object} The data object, properly modified\n */\nexport default function hide(data) {\n if (!isModifierRequired(data.instance.modifiers, 'hide', 'preventOverflow')) {\n return data;\n }\n\n const refRect = data.offsets.reference;\n const bound = find(\n data.instance.modifiers,\n modifier => modifier.name === 'preventOverflow'\n ).boundaries;\n\n if (\n refRect.bottom < bound.top ||\n refRect.left > bound.right ||\n refRect.top > bound.bottom ||\n refRect.right < bound.left\n ) {\n // Avoid unnecessary DOM access if visibility hasn't changed\n if (data.hide === true) {\n return data;\n }\n\n data.hide = true;\n data.attributes['x-out-of-boundaries'] = '';\n } else {\n // Avoid unnecessary DOM access if visibility hasn't changed\n if (data.hide === false) {\n return data;\n }\n\n data.hide = false;\n data.attributes['x-out-of-boundaries'] = false;\n }\n\n return data;\n}\n", "import getClientRect from '../utils/getClientRect';\nimport getOppositePlacement from '../utils/getOppositePlacement';\n\n/**\n * @function\n * @memberof Modifiers\n * @argument {Object} data - The data object generated by `update` method\n * @argument {Object} options - Modifiers configuration and options\n * @returns {Object} The data object, properly modified\n */\nexport default function inner(data) {\n const placement = data.placement;\n const basePlacement = placement.split('-')[0];\n const { popper, reference } = data.offsets;\n const isHoriz = ['left', 'right'].indexOf(basePlacement) !== -1;\n\n const subtractLength = ['top', 'left'].indexOf(basePlacement) === -1;\n\n popper[isHoriz ? 'left' : 'top'] =\n reference[basePlacement] -\n (subtractLength ? popper[isHoriz ? 'width' : 'height'] : 0);\n\n data.placement = getOppositePlacement(placement);\n data.offsets.popper = getClientRect(popper);\n\n return data;\n}\n", "import applyStyle, { applyStyleOnLoad } from './applyStyle';\nimport computeStyle from './computeStyle';\nimport arrow from './arrow';\nimport flip from './flip';\nimport keepTogether from './keepTogether';\nimport offset from './offset';\nimport preventOverflow from './preventOverflow';\nimport shift from './shift';\nimport hide from './hide';\nimport inner from './inner';\n\n/**\n * Modifier function, each modifier can have a function of this type assigned\n * to its `fn` property.
\n * These functions will be called on each update, this means that you must\n * make sure they are performant enough to avoid performance bottlenecks.\n *\n * @function ModifierFn\n * @argument {dataObject} data - The data object generated by `update` method\n * @argument {Object} options - Modifiers configuration and options\n * @returns {dataObject} The data object, properly modified\n */\n\n/**\n * Modifiers are plugins used to alter the behavior of your poppers.
\n * Popper.js uses a set of 9 modifiers to provide all the basic functionalities\n * needed by the library.\n *\n * Usually you don't want to override the `order`, `fn` and `onLoad` props.\n * All the other properties are configurations that could be tweaked.\n * @namespace modifiers\n */\nexport default {\n /**\n * Modifier used to shift the popper on the start or end of its reference\n * element.
\n * It will read the variation of the `placement` property.
\n * It can be one either `-end` or `-start`.\n * @memberof modifiers\n * @inner\n */\n shift: {\n /** @prop {number} order=100 - Index used to define the order of execution */\n order: 100,\n /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */\n enabled: true,\n /** @prop {ModifierFn} */\n fn: shift,\n },\n\n /**\n * The `offset` modifier can shift your popper on both its axis.\n *\n * It accepts the following units:\n * - `px` or unit-less, interpreted as pixels\n * - `%` or `%r`, percentage relative to the length of the reference element\n * - `%p`, percentage relative to the length of the popper element\n * - `vw`, CSS viewport width unit\n * - `vh`, CSS viewport height unit\n *\n * For length is intended the main axis relative to the placement of the popper.
\n * This means that if the placement is `top` or `bottom`, the length will be the\n * `width`. In case of `left` or `right`, it will be the `height`.\n *\n * You can provide a single value (as `Number` or `String`), or a pair of values\n * as `String` divided by a comma or one (or more) white spaces.
\n * The latter is a deprecated method because it leads to confusion and will be\n * removed in v2.
\n * Additionally, it accepts additions and subtractions between different units.\n * Note that multiplications and divisions aren't supported.\n *\n * Valid examples are:\n * ```\n * 10\n * '10%'\n * '10, 10'\n * '10%, 10'\n * '10 + 10%'\n * '10 - 5vh + 3%'\n * '-10px + 5vh, 5px - 6%'\n * ```\n * > **NB**: If you desire to apply offsets to your poppers in a way that may make them overlap\n * > with their reference element, unfortunately, you will have to disable the `flip` modifier.\n * > You can read more on this at this [issue](https://github.com/FezVrasta/popper.js/issues/373).\n *\n * @memberof modifiers\n * @inner\n */\n offset: {\n /** @prop {number} order=200 - Index used to define the order of execution */\n order: 200,\n /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */\n enabled: true,\n /** @prop {ModifierFn} */\n fn: offset,\n /** @prop {Number|String} offset=0\n * The offset value as described in the modifier description\n */\n offset: 0,\n },\n\n /**\n * Modifier used to prevent the popper from being positioned outside the boundary.\n *\n * A scenario exists where the reference itself is not within the boundaries.
\n * We can say it has \"escaped the boundaries\" — or just \"escaped\".
\n * In this case we need to decide whether the popper should either:\n *\n * - detach from the reference and remain \"trapped\" in the boundaries, or\n * - if it should ignore the boundary and \"escape with its reference\"\n *\n * When `escapeWithReference` is set to`true` and reference is completely\n * outside its boundaries, the popper will overflow (or completely leave)\n * the boundaries in order to remain attached to the edge of the reference.\n *\n * @memberof modifiers\n * @inner\n */\n preventOverflow: {\n /** @prop {number} order=300 - Index used to define the order of execution */\n order: 300,\n /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */\n enabled: true,\n /** @prop {ModifierFn} */\n fn: preventOverflow,\n /**\n * @prop {Array} [priority=['left','right','top','bottom']]\n * Popper will try to prevent overflow following these priorities by default,\n * then, it could overflow on the left and on top of the `boundariesElement`\n */\n priority: ['left', 'right', 'top', 'bottom'],\n /**\n * @prop {number} padding=5\n * Amount of pixel used to define a minimum distance between the boundaries\n * and the popper. This makes sure the popper always has a little padding\n * between the edges of its container\n */\n padding: 5,\n /**\n * @prop {String|HTMLElement} boundariesElement='scrollParent'\n * Boundaries used by the modifier. Can be `scrollParent`, `window`,\n * `viewport` or any DOM element.\n */\n boundariesElement: 'scrollParent',\n },\n\n /**\n * Modifier used to make sure the reference and its popper stay near each other\n * without leaving any gap between the two. Especially useful when the arrow is\n * enabled and you want to ensure that it points to its reference element.\n * It cares only about the first axis. You can still have poppers with margin\n * between the popper and its reference element.\n * @memberof modifiers\n * @inner\n */\n keepTogether: {\n /** @prop {number} order=400 - Index used to define the order of execution */\n order: 400,\n /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */\n enabled: true,\n /** @prop {ModifierFn} */\n fn: keepTogether,\n },\n\n /**\n * This modifier is used to move the `arrowElement` of the popper to make\n * sure it is positioned between the reference element and its popper element.\n * It will read the outer size of the `arrowElement` node to detect how many\n * pixels of conjunction are needed.\n *\n * It has no effect if no `arrowElement` is provided.\n * @memberof modifiers\n * @inner\n */\n arrow: {\n /** @prop {number} order=500 - Index used to define the order of execution */\n order: 500,\n /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */\n enabled: true,\n /** @prop {ModifierFn} */\n fn: arrow,\n /** @prop {String|HTMLElement} element='[x-arrow]' - Selector or node used as arrow */\n element: '[x-arrow]',\n },\n\n /**\n * Modifier used to flip the popper's placement when it starts to overlap its\n * reference element.\n *\n * Requires the `preventOverflow` modifier before it in order to work.\n *\n * **NOTE:** this modifier will interrupt the current update cycle and will\n * restart it if it detects the need to flip the placement.\n * @memberof modifiers\n * @inner\n */\n flip: {\n /** @prop {number} order=600 - Index used to define the order of execution */\n order: 600,\n /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */\n enabled: true,\n /** @prop {ModifierFn} */\n fn: flip,\n /**\n * @prop {String|Array} behavior='flip'\n * The behavior used to change the popper's placement. It can be one of\n * `flip`, `clockwise`, `counterclockwise` or an array with a list of valid\n * placements (with optional variations)\n */\n behavior: 'flip',\n /**\n * @prop {number} padding=5\n * The popper will flip if it hits the edges of the `boundariesElement`\n */\n padding: 5,\n /**\n * @prop {String|HTMLElement} boundariesElement='viewport'\n * The element which will define the boundaries of the popper position.\n * The popper will never be placed outside of the defined boundaries\n * (except if `keepTogether` is enabled)\n */\n boundariesElement: 'viewport',\n /**\n * @prop {Boolean} flipVariations=false\n * The popper will switch placement variation between `-start` and `-end` when\n * the reference element overlaps its boundaries.\n *\n * The original placement should have a set variation.\n */\n flipVariations: false,\n /**\n * @prop {Boolean} flipVariationsByContent=false\n * The popper will switch placement variation between `-start` and `-end` when\n * the popper element overlaps its reference boundaries.\n *\n * The original placement should have a set variation.\n */\n flipVariationsByContent: false,\n },\n\n /**\n * Modifier used to make the popper flow toward the inner of the reference element.\n * By default, when this modifier is disabled, the popper will be placed outside\n * the reference element.\n * @memberof modifiers\n * @inner\n */\n inner: {\n /** @prop {number} order=700 - Index used to define the order of execution */\n order: 700,\n /** @prop {Boolean} enabled=false - Whether the modifier is enabled or not */\n enabled: false,\n /** @prop {ModifierFn} */\n fn: inner,\n },\n\n /**\n * Modifier used to hide the popper when its reference element is outside of the\n * popper boundaries. It will set a `x-out-of-boundaries` attribute which can\n * be used to hide with a CSS selector the popper when its reference is\n * out of boundaries.\n *\n * Requires the `preventOverflow` modifier before it in order to work.\n * @memberof modifiers\n * @inner\n */\n hide: {\n /** @prop {number} order=800 - Index used to define the order of execution */\n order: 800,\n /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */\n enabled: true,\n /** @prop {ModifierFn} */\n fn: hide,\n },\n\n /**\n * Computes the style that will be applied to the popper element to gets\n * properly positioned.\n *\n * Note that this modifier will not touch the DOM, it just prepares the styles\n * so that `applyStyle` modifier can apply it. This separation is useful\n * in case you need to replace `applyStyle` with a custom implementation.\n *\n * This modifier has `850` as `order` value to maintain backward compatibility\n * with previous versions of Popper.js. Expect the modifiers ordering method\n * to change in future major versions of the library.\n *\n * @memberof modifiers\n * @inner\n */\n computeStyle: {\n /** @prop {number} order=850 - Index used to define the order of execution */\n order: 850,\n /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */\n enabled: true,\n /** @prop {ModifierFn} */\n fn: computeStyle,\n /**\n * @prop {Boolean} gpuAcceleration=true\n * If true, it uses the CSS 3D transformation to position the popper.\n * Otherwise, it will use the `top` and `left` properties\n */\n gpuAcceleration: true,\n /**\n * @prop {string} [x='bottom']\n * Where to anchor the X axis (`bottom` or `top`). AKA X offset origin.\n * Change this if your popper should grow in a direction different from `bottom`\n */\n x: 'bottom',\n /**\n * @prop {string} [x='left']\n * Where to anchor the Y axis (`left` or `right`). AKA Y offset origin.\n * Change this if your popper should grow in a direction different from `right`\n */\n y: 'right',\n },\n\n /**\n * Applies the computed styles to the popper element.\n *\n * All the DOM manipulations are limited to this modifier. This is useful in case\n * you want to integrate Popper.js inside a framework or view library and you\n * want to delegate all the DOM manipulations to it.\n *\n * Note that if you disable this modifier, you must make sure the popper element\n * has its position set to `absolute` before Popper.js can do its work!\n *\n * Just disable this modifier and define your own to achieve the desired effect.\n *\n * @memberof modifiers\n * @inner\n */\n applyStyle: {\n /** @prop {number} order=900 - Index used to define the order of execution */\n order: 900,\n /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */\n enabled: true,\n /** @prop {ModifierFn} */\n fn: applyStyle,\n /** @prop {Function} */\n onLoad: applyStyleOnLoad,\n /**\n * @deprecated since version 1.10.0, the property moved to `computeStyle` modifier\n * @prop {Boolean} gpuAcceleration=true\n * If true, it uses the CSS 3D transformation to position the popper.\n * Otherwise, it will use the `top` and `left` properties\n */\n gpuAcceleration: undefined,\n },\n};\n\n/**\n * The `dataObject` is an object containing all the information used by Popper.js.\n * This object is passed to modifiers and to the `onCreate` and `onUpdate` callbacks.\n * @name dataObject\n * @property {Object} data.instance The Popper.js instance\n * @property {String} data.placement Placement applied to popper\n * @property {String} data.originalPlacement Placement originally defined on init\n * @property {Boolean} data.flipped True if popper has been flipped by flip modifier\n * @property {Boolean} data.hide True if the reference element is out of boundaries, useful to know when to hide the popper\n * @property {HTMLElement} data.arrowElement Node used as arrow by arrow modifier\n * @property {Object} data.styles Any CSS property defined here will be applied to the popper. It expects the JavaScript nomenclature (eg. `marginBottom`)\n * @property {Object} data.arrowStyles Any CSS property defined here will be applied to the popper arrow. It expects the JavaScript nomenclature (eg. `marginBottom`)\n * @property {Object} data.boundaries Offsets of the popper boundaries\n * @property {Object} data.offsets The measurements of popper, reference and arrow elements\n * @property {Object} data.offsets.popper `top`, `left`, `width`, `height` values\n * @property {Object} data.offsets.reference `top`, `left`, `width`, `height` values\n * @property {Object} data.offsets.arrow] `top` and `left` offsets, only one of them will be different from 0\n */\n", "import modifiers from '../modifiers/index';\n\n/**\n * Default options provided to Popper.js constructor.
\n * These can be overridden using the `options` argument of Popper.js.
\n * To override an option, simply pass an object with the same\n * structure of the `options` object, as the 3rd argument. For example:\n * ```\n * new Popper(ref, pop, {\n * modifiers: {\n * preventOverflow: { enabled: false }\n * }\n * })\n * ```\n * @type {Object}\n * @static\n * @memberof Popper\n */\nexport default {\n /**\n * Popper's placement.\n * @prop {Popper.placements} placement='bottom'\n */\n placement: 'bottom',\n\n /**\n * Set this to true if you want popper to position it self in 'fixed' mode\n * @prop {Boolean} positionFixed=false\n */\n positionFixed: false,\n\n /**\n * Whether events (resize, scroll) are initially enabled.\n * @prop {Boolean} eventsEnabled=true\n */\n eventsEnabled: true,\n\n /**\n * Set to true if you want to automatically remove the popper when\n * you call the `destroy` method.\n * @prop {Boolean} removeOnDestroy=false\n */\n removeOnDestroy: false,\n\n /**\n * Callback called when the popper is created.
\n * By default, it is set to no-op.
\n * Access Popper.js instance with `data.instance`.\n * @prop {onCreate}\n */\n onCreate: () => {},\n\n /**\n * Callback called when the popper is updated. This callback is not called\n * on the initialization/creation of the popper, but only on subsequent\n * updates.
\n * By default, it is set to no-op.
\n * Access Popper.js instance with `data.instance`.\n * @prop {onUpdate}\n */\n onUpdate: () => {},\n\n /**\n * List of modifiers used to modify the offsets before they are applied to the popper.\n * They provide most of the functionalities of Popper.js.\n * @prop {modifiers}\n */\n modifiers,\n};\n\n/**\n * @callback onCreate\n * @param {dataObject} data\n */\n\n/**\n * @callback onUpdate\n * @param {dataObject} data\n */\n", "// Utils\nimport debounce from './utils/debounce';\nimport isFunction from './utils/isFunction';\n\n// Methods\nimport update from './methods/update';\nimport destroy from './methods/destroy';\nimport enableEventListeners from './methods/enableEventListeners';\nimport disableEventListeners from './methods/disableEventListeners';\nimport Defaults from './methods/defaults';\nimport placements from './methods/placements';\n\nexport default class Popper {\n /**\n * Creates a new Popper.js instance.\n * @class Popper\n * @param {Element|referenceObject} reference - The reference element used to position the popper\n * @param {Element} popper - The HTML / XML element used as the popper\n * @param {Object} options - Your custom options to override the ones defined in [Defaults](#defaults)\n * @return {Object} instance - The generated Popper.js instance\n */\n constructor(reference, popper, options = {}) {\n // make update() debounced, so that it only runs at most once-per-tick\n this.update = debounce(this.update.bind(this));\n\n // with {} we create a new object with the options inside it\n this.options = { ...Popper.Defaults, ...options };\n\n // init state\n this.state = {\n isDestroyed: false,\n isCreated: false,\n scrollParents: [],\n };\n\n // get reference and popper elements (allow jQuery wrappers)\n this.reference = reference && reference.jquery ? reference[0] : reference;\n this.popper = popper && popper.jquery ? popper[0] : popper;\n\n // Deep merge modifiers options\n this.options.modifiers = {};\n Object.keys({\n ...Popper.Defaults.modifiers,\n ...options.modifiers,\n }).forEach(name => {\n this.options.modifiers[name] = {\n // If it's a built-in modifier, use it as base\n ...(Popper.Defaults.modifiers[name] || {}),\n // If there are custom options, override and merge with default ones\n ...(options.modifiers ? options.modifiers[name] : {}),\n };\n });\n\n // Refactoring modifiers' list (Object => Array)\n this.modifiers = Object.keys(this.options.modifiers)\n .map(name => ({\n name,\n ...this.options.modifiers[name],\n }))\n // sort the modifiers by order\n .sort((a, b) => a.order - b.order);\n\n // modifiers have the ability to execute arbitrary code when Popper.js get inited\n // such code is executed in the same order of its modifier\n // they could add new properties to their options configuration\n // BE AWARE: don't add options to `options.modifiers.name` but to `modifierOptions`!\n this.modifiers.forEach(modifierOptions => {\n if (modifierOptions.enabled && isFunction(modifierOptions.onLoad)) {\n modifierOptions.onLoad(\n this.reference,\n this.popper,\n this.options,\n modifierOptions,\n this.state\n );\n }\n });\n\n // fire the first update to position the popper in the right place\n this.update();\n\n const eventsEnabled = this.options.eventsEnabled;\n if (eventsEnabled) {\n // setup event listeners, they will take care of update the position in specific situations\n this.enableEventListeners();\n }\n\n this.state.eventsEnabled = eventsEnabled;\n }\n\n // We can't use class properties because they don't get listed in the\n // class prototype and break stuff like Sinon stubs\n update() {\n return update.call(this);\n }\n destroy() {\n return destroy.call(this);\n }\n enableEventListeners() {\n return enableEventListeners.call(this);\n }\n disableEventListeners() {\n return disableEventListeners.call(this);\n }\n\n /**\n * Schedules an update. It will run on the next UI update available.\n * @method scheduleUpdate\n * @memberof Popper\n */\n scheduleUpdate = () => requestAnimationFrame(this.update);\n\n /**\n * Collection of utilities useful when writing custom modifiers.\n * Starting from version 1.7, this method is available only if you\n * include `popper-utils.js` before `popper.js`.\n *\n * **DEPRECATION**: This way to access PopperUtils is deprecated\n * and will be removed in v2! Use the PopperUtils module directly instead.\n * Due to the high instability of the methods contained in Utils, we can't\n * guarantee them to follow semver. Use them at your own risk!\n * @static\n * @private\n * @type {Object}\n * @deprecated since version 1.8\n * @member Utils\n * @memberof Popper\n */\n static Utils = (typeof window !== 'undefined' ? window : global).PopperUtils;\n\n static placements = placements;\n\n static Defaults = Defaults;\n}\n\n/**\n * The `referenceObject` is an object that provides an interface compatible with Popper.js\n * and lets you use it as replacement of a real DOM node.
\n * You can use this method to position a popper relatively to a set of coordinates\n * in case you don't have a DOM node to use as reference.\n *\n * ```\n * new Popper(referenceObject, popperNode);\n * ```\n *\n * NB: This feature isn't supported in Internet Explorer 10.\n * @name referenceObject\n * @property {Function} data.getBoundingClientRect\n * A function that returns a set of coordinates compatible with the native `getBoundingClientRect` method.\n * @property {number} data.clientWidth\n * An ES6 getter that will return the width of the virtual reference element.\n * @property {number} data.clientHeight\n * An ES6 getter that will return the height of the virtual reference element.\n */\n", "import plupload from \"plupload\";\n\n(() => {\n const DROP_TARGET_ACTIVE_CLASS = \"cms-uploader-drag-drop-target-active\";\n\n class FileUpload {\n constructor(container, settings) {\n if (!container.id) container.id = plupload.guid();\n settings = Object.assign(\n FileUpload.defaultUploaderSettings(container.id),\n settings\n );\n this.ui = {\n container,\n list: container.querySelector(\".cms-uploader-filelist\"),\n dropElement: container.querySelector(`#${settings.drop_element}`),\n };\n this.cleanupFns = [];\n this.uploader = new plupload.Uploader(settings);\n this.uploader.bind(\"PostInit\", () => this.onUploaderPostInit());\n this.uploader.bind(\"Error\", (_uploader, error) =>\n this.onUploaderError(error)\n );\n this.uploader.bind(\"FilesAdded\", (_uploader, files) =>\n this.onUploaderFilesAdded(files)\n );\n this.uploader.bind(\"UploadProgress\", (_uploader, file) =>\n this.onUploaderUploadProgress(file)\n );\n this.uploader.bind(\"FileUploaded\", (_uploader, file, info) =>\n this.onUploaderFileUploaded(file, info)\n );\n this.uploader.bind(\"FilesRemoved\", (_uploader, files) =>\n this.onUploaderFilesRemoved(files)\n );\n this.uploader.init();\n if (settings.setup) {\n settings.setup(this.uploader);\n }\n }\n\n destroy() {\n this.uploader.destroy();\n for (const cleanupFn of this.cleanupFns) {\n cleanupFn();\n }\n }\n\n addCleanup(cleanupFn) {\n this.cleanupFns.push(cleanupFn);\n }\n\n onUploaderPostInit() {\n // Show drag and drop info and attach events only if drag and drop is enabled and supported.\n if (\n !this.uploader.settings.dragdrop ||\n !this.uploader.features.dragdrop\n ) {\n this.ui.container.querySelector(\n \".cms-uploader-drag-drop-info\"\n ).style.display = \"none\";\n return;\n }\n // When dragging over the document add a class to the drop target that puts it on top of every element and remove\n // that class when dropping or leaving the drop target. Otherwise the dragleave event would fire whenever we drag\n // over a child element inside the drop target such as text nodes.\n const onDragEnter = (e) => {\n // Only react to drag'n'drops that contain a file. See:\n // https://developer.mozilla.org/en-US/docs/Web/API/DataTransfer/types\n if (e.dataTransfer.types.includes(\"Files\")) {\n this.ui.dropElement.classList.add(DROP_TARGET_ACTIVE_CLASS);\n }\n };\n document.addEventListener(\"dragenter\", onDragEnter);\n this.addCleanup(() => {\n document.removeEventListener(\"dragenter\", onDragEnter);\n });\n for (const eventName of [\"drop\", \"dragleave\"]) {\n this.ui.dropElement.addEventListener(eventName, () => {\n this.ui.dropElement.classList.remove(DROP_TARGET_ACTIVE_CLASS);\n });\n }\n }\n\n onUploaderError(error) {\n if (error.code === plupload.INIT_ERROR) {\n window.alert(\"Error: Initialisation error. Reload to try again.\");\n return;\n }\n const file = error.file;\n if (!file) return;\n // Get error message from the server response. Not all runtimes support this.\n let message = error.response;\n // If no error message is in the server response get standard plupload error messages.\n // This will have descriptive error message for something like file size or file format errors but for\n // server errors it will only display a general error message.\n if (!message) {\n message = error.message;\n if (error.details) message += ` (${error.details})`;\n }\n file.status = plupload.FAILED;\n file.error_message = message;\n this.updateFileStatus(file);\n }\n\n onUploaderFilesAdded(files) {\n for (const file of files) {\n this.addFile(file);\n }\n // Auto start upload when files are added.\n this.uploader.start();\n }\n\n onUploaderUploadProgress(file) {\n this.updateFileStatus(file);\n }\n\n onUploaderFileUploaded(file, info) {\n // Replace the dummy file entry in the file list with the the entry from the server response.\n const template = document.createElement(\"template\");\n template.innerHTML = info.response;\n const newListItem = template.content.firstElementChild;\n this.ui.list.replaceChild(newListItem, this.fileListItem(file));\n window.CMS.fileLinks(newListItem);\n }\n\n onUploaderFilesRemoved(files) {\n for (const file of files) {\n this.removeFile(file);\n }\n }\n\n addFile(file) {\n this.ui.list.insertAdjacentHTML(\n \"afterbegin\",\n FileUpload.buildListItemHTML(file)\n );\n this.fileListItem(file)\n .querySelector(\".cms-uploader-file-delete\")\n .addEventListener(\"click\", (evt) => {\n evt.preventDefault();\n this.uploader.removeFile(file);\n });\n this.updateFileStatus(file);\n }\n\n removeFile(file) {\n this.fileListItem(file).remove();\n }\n\n updateFileStatus(file) {\n const progressBar =\n this.fileListItem(file).querySelector(\".progress-bar\");\n switch (file.status) {\n case plupload.UPLOADING:\n progressBar.style.width = `${file.percent}%`;\n break;\n case plupload.FAILED:\n progressBar.style.width = \"100%\";\n progressBar.classList.add(\"progress-bar-danger\");\n progressBar.querySelector(\"span\").innerHTML = file.error_message;\n break;\n }\n }\n\n fileListItem({ id }) {\n return this.ui.container.querySelector(`#${id}`);\n }\n\n static buildListItemHTML({ id, name }) {\n return `\n \n \n `;\n }\n\n static defaultUploaderSettings(id) {\n return {\n runtimes: \"html5,browserplus,silverlight,flash,gears\",\n dragdrop: true,\n drop_element: `${id}-drag-drop-target`,\n browse_button: `${id}-browse`,\n container: id,\n file_data_name: \"file[file]\",\n };\n }\n }\n\n const uploaders = [];\n window.CMS.fileUpload = {\n init(root = document) {\n const el = root.querySelector(\"#cms-uploader\");\n if (el === null) return;\n uploaders.push(\n new FileUpload(el, {\n url: el.dataset.cmsUploaderUrl,\n multipart_params: {\n [el.dataset.cmsUploaderTokenName]: el.dataset.cmsUploaderTokenValue,\n [el.dataset.cmsUploaderSessionName]:\n el.dataset.cmsUploaderSessionValue,\n },\n })\n );\n },\n dispose() {\n for (const uploader of uploader) {\n uploader.dispose();\n }\n uploaders.length = 0;\n },\n };\n})();\n", "import Modal from \"bootstrap/js/src/popover\";\n\n// Site files modal.\n(() => {\n let modal = null;\n\n const initModalContent = (modalContent) => {\n window.CMS.fileUpload.init(modalContent);\n window.CMS.fileLinks(modalContent);\n modalContent.addEventListener(\"dragstart\", (evt) => {\n if (\n evt.target.nodeType === Node.ELEMENT_NODE &&\n evt.target.matches(\".cms-uploader-filelist .item-title a\") &&\n modal != null\n ) {\n modal.hide();\n }\n });\n };\n\n window.CMS.files = {\n init() {\n const modalToggle = document.querySelector(\".cms-files-open-modal\");\n const modalContainer = document.querySelector(\".cms-files-modal\");\n if (modalToggle === null || modalContainer === null) return;\n const modalContent = modalContainer.querySelector(\".modal-content\");\n modalToggle.addEventListener(\"click\", (evt) => {\n evt.preventDefault();\n fetch(modalContainer.dataset.url, { credentials: \"same-origin\" })\n .then((resp) => resp.text())\n .then((html) => {\n modalContent.innerHTML = `${html}
`;\n initModalContent(modalContent);\n });\n modal = modal || new Modal(modalContainer);\n modal.show();\n });\n },\n dispose() {\n if (modal !== null) {\n modal.hide();\n modal.dispose();\n modal = null;\n }\n },\n };\n})();\n", "window.CMS.pageFragments = () => {\n const toggle = document.querySelector('select#fragments-toggle');\n if (toggle === null) return;\n const url = new URL(toggle.dataset.url, document.location.href);\n toggle.addEventListener('change', () => {\n url.searchParams.set('layout_id', toggle.value);\n fetch(url, {credentials: 'same-origin'}).then((resp) => resp.text()).then((html) => {\n const container = document.querySelector('#form-fragments-container');\n container.innerHTML = html;\n // TODO: Only dispose of the widgets that were within the fragment.\n CMS.wysiwyg.dispose();\n CMS.timepicker.dispose();\n CMS.codemirror.dispose();\n\n CMS.fileLinks(container);\n // TODO: Container should also be passed here once the TODO above is addressed.\n CMS.wysiwyg.init();\n CMS.timepicker.init();\n CMS.codemirror.init();\n });\n });\n};\n", "/**!\n * Sortable 1.15.6\n * @author\tRubaXa \n * @author\towenm \n * @license MIT\n */\nfunction ownKeys(object, enumerableOnly) {\n var keys = Object.keys(object);\n if (Object.getOwnPropertySymbols) {\n var symbols = Object.getOwnPropertySymbols(object);\n if (enumerableOnly) {\n symbols = symbols.filter(function (sym) {\n return Object.getOwnPropertyDescriptor(object, sym).enumerable;\n });\n }\n keys.push.apply(keys, symbols);\n }\n return keys;\n}\nfunction _objectSpread2(target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i] != null ? arguments[i] : {};\n if (i % 2) {\n ownKeys(Object(source), true).forEach(function (key) {\n _defineProperty(target, key, source[key]);\n });\n } else if (Object.getOwnPropertyDescriptors) {\n Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));\n } else {\n ownKeys(Object(source)).forEach(function (key) {\n Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));\n });\n }\n }\n return target;\n}\nfunction _typeof(obj) {\n \"@babel/helpers - typeof\";\n\n if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") {\n _typeof = function (obj) {\n return typeof obj;\n };\n } else {\n _typeof = function (obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n };\n }\n return _typeof(obj);\n}\nfunction _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n return obj;\n}\nfunction _extends() {\n _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n return target;\n };\n return _extends.apply(this, arguments);\n}\nfunction _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n return target;\n}\nfunction _objectWithoutProperties(source, excluded) {\n if (source == null) return {};\n var target = _objectWithoutPropertiesLoose(source, excluded);\n var key, i;\n if (Object.getOwnPropertySymbols) {\n var sourceSymbolKeys = Object.getOwnPropertySymbols(source);\n for (i = 0; i < sourceSymbolKeys.length; i++) {\n key = sourceSymbolKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;\n target[key] = source[key];\n }\n }\n return target;\n}\nfunction _toConsumableArray(arr) {\n return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();\n}\nfunction _arrayWithoutHoles(arr) {\n if (Array.isArray(arr)) return _arrayLikeToArray(arr);\n}\nfunction _iterableToArray(iter) {\n if (typeof Symbol !== \"undefined\" && iter[Symbol.iterator] != null || iter[\"@@iterator\"] != null) return Array.from(iter);\n}\nfunction _unsupportedIterableToArray(o, minLen) {\n if (!o) return;\n if (typeof o === \"string\") return _arrayLikeToArray(o, minLen);\n var n = Object.prototype.toString.call(o).slice(8, -1);\n if (n === \"Object\" && o.constructor) n = o.constructor.name;\n if (n === \"Map\" || n === \"Set\") return Array.from(o);\n if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);\n}\nfunction _arrayLikeToArray(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];\n return arr2;\n}\nfunction _nonIterableSpread() {\n throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\n\nvar version = \"1.15.6\";\n\nfunction userAgent(pattern) {\n if (typeof window !== 'undefined' && window.navigator) {\n return !! /*@__PURE__*/navigator.userAgent.match(pattern);\n }\n}\nvar IE11OrLess = userAgent(/(?:Trident.*rv[ :]?11\\.|msie|iemobile|Windows Phone)/i);\nvar Edge = userAgent(/Edge/i);\nvar FireFox = userAgent(/firefox/i);\nvar Safari = userAgent(/safari/i) && !userAgent(/chrome/i) && !userAgent(/android/i);\nvar IOS = userAgent(/iP(ad|od|hone)/i);\nvar ChromeForAndroid = userAgent(/chrome/i) && userAgent(/android/i);\n\nvar captureMode = {\n capture: false,\n passive: false\n};\nfunction on(el, event, fn) {\n el.addEventListener(event, fn, !IE11OrLess && captureMode);\n}\nfunction off(el, event, fn) {\n el.removeEventListener(event, fn, !IE11OrLess && captureMode);\n}\nfunction matches( /**HTMLElement*/el, /**String*/selector) {\n if (!selector) return;\n selector[0] === '>' && (selector = selector.substring(1));\n if (el) {\n try {\n if (el.matches) {\n return el.matches(selector);\n } else if (el.msMatchesSelector) {\n return el.msMatchesSelector(selector);\n } else if (el.webkitMatchesSelector) {\n return el.webkitMatchesSelector(selector);\n }\n } catch (_) {\n return false;\n }\n }\n return false;\n}\nfunction getParentOrHost(el) {\n return el.host && el !== document && el.host.nodeType ? el.host : el.parentNode;\n}\nfunction closest( /**HTMLElement*/el, /**String*/selector, /**HTMLElement*/ctx, includeCTX) {\n if (el) {\n ctx = ctx || document;\n do {\n if (selector != null && (selector[0] === '>' ? el.parentNode === ctx && matches(el, selector) : matches(el, selector)) || includeCTX && el === ctx) {\n return el;\n }\n if (el === ctx) break;\n /* jshint boss:true */\n } while (el = getParentOrHost(el));\n }\n return null;\n}\nvar R_SPACE = /\\s+/g;\nfunction toggleClass(el, name, state) {\n if (el && name) {\n if (el.classList) {\n el.classList[state ? 'add' : 'remove'](name);\n } else {\n var className = (' ' + el.className + ' ').replace(R_SPACE, ' ').replace(' ' + name + ' ', ' ');\n el.className = (className + (state ? ' ' + name : '')).replace(R_SPACE, ' ');\n }\n }\n}\nfunction css(el, prop, val) {\n var style = el && el.style;\n if (style) {\n if (val === void 0) {\n if (document.defaultView && document.defaultView.getComputedStyle) {\n val = document.defaultView.getComputedStyle(el, '');\n } else if (el.currentStyle) {\n val = el.currentStyle;\n }\n return prop === void 0 ? val : val[prop];\n } else {\n if (!(prop in style) && prop.indexOf('webkit') === -1) {\n prop = '-webkit-' + prop;\n }\n style[prop] = val + (typeof val === 'string' ? '' : 'px');\n }\n }\n}\nfunction matrix(el, selfOnly) {\n var appliedTransforms = '';\n if (typeof el === 'string') {\n appliedTransforms = el;\n } else {\n do {\n var transform = css(el, 'transform');\n if (transform && transform !== 'none') {\n appliedTransforms = transform + ' ' + appliedTransforms;\n }\n /* jshint boss:true */\n } while (!selfOnly && (el = el.parentNode));\n }\n var matrixFn = window.DOMMatrix || window.WebKitCSSMatrix || window.CSSMatrix || window.MSCSSMatrix;\n /*jshint -W056 */\n return matrixFn && new matrixFn(appliedTransforms);\n}\nfunction find(ctx, tagName, iterator) {\n if (ctx) {\n var list = ctx.getElementsByTagName(tagName),\n i = 0,\n n = list.length;\n if (iterator) {\n for (; i < n; i++) {\n iterator(list[i], i);\n }\n }\n return list;\n }\n return [];\n}\nfunction getWindowScrollingElement() {\n var scrollingElement = document.scrollingElement;\n if (scrollingElement) {\n return scrollingElement;\n } else {\n return document.documentElement;\n }\n}\n\n/**\r\n * Returns the \"bounding client rect\" of given element\r\n * @param {HTMLElement} el The element whose boundingClientRect is wanted\r\n * @param {[Boolean]} relativeToContainingBlock Whether the rect should be relative to the containing block of (including) the container\r\n * @param {[Boolean]} relativeToNonStaticParent Whether the rect should be relative to the relative parent of (including) the contaienr\r\n * @param {[Boolean]} undoScale Whether the container's scale() should be undone\r\n * @param {[HTMLElement]} container The parent the element will be placed in\r\n * @return {Object} The boundingClientRect of el, with specified adjustments\r\n */\nfunction getRect(el, relativeToContainingBlock, relativeToNonStaticParent, undoScale, container) {\n if (!el.getBoundingClientRect && el !== window) return;\n var elRect, top, left, bottom, right, height, width;\n if (el !== window && el.parentNode && el !== getWindowScrollingElement()) {\n elRect = el.getBoundingClientRect();\n top = elRect.top;\n left = elRect.left;\n bottom = elRect.bottom;\n right = elRect.right;\n height = elRect.height;\n width = elRect.width;\n } else {\n top = 0;\n left = 0;\n bottom = window.innerHeight;\n right = window.innerWidth;\n height = window.innerHeight;\n width = window.innerWidth;\n }\n if ((relativeToContainingBlock || relativeToNonStaticParent) && el !== window) {\n // Adjust for translate()\n container = container || el.parentNode;\n\n // solves #1123 (see: https://stackoverflow.com/a/37953806/6088312)\n // Not needed on <= IE11\n if (!IE11OrLess) {\n do {\n if (container && container.getBoundingClientRect && (css(container, 'transform') !== 'none' || relativeToNonStaticParent && css(container, 'position') !== 'static')) {\n var containerRect = container.getBoundingClientRect();\n\n // Set relative to edges of padding box of container\n top -= containerRect.top + parseInt(css(container, 'border-top-width'));\n left -= containerRect.left + parseInt(css(container, 'border-left-width'));\n bottom = top + elRect.height;\n right = left + elRect.width;\n break;\n }\n /* jshint boss:true */\n } while (container = container.parentNode);\n }\n }\n if (undoScale && el !== window) {\n // Adjust for scale()\n var elMatrix = matrix(container || el),\n scaleX = elMatrix && elMatrix.a,\n scaleY = elMatrix && elMatrix.d;\n if (elMatrix) {\n top /= scaleY;\n left /= scaleX;\n width /= scaleX;\n height /= scaleY;\n bottom = top + height;\n right = left + width;\n }\n }\n return {\n top: top,\n left: left,\n bottom: bottom,\n right: right,\n width: width,\n height: height\n };\n}\n\n/**\r\n * Checks if a side of an element is scrolled past a side of its parents\r\n * @param {HTMLElement} el The element who's side being scrolled out of view is in question\r\n * @param {String} elSide Side of the element in question ('top', 'left', 'right', 'bottom')\r\n * @param {String} parentSide Side of the parent in question ('top', 'left', 'right', 'bottom')\r\n * @return {HTMLElement} The parent scroll element that the el's side is scrolled past, or null if there is no such element\r\n */\nfunction isScrolledPast(el, elSide, parentSide) {\n var parent = getParentAutoScrollElement(el, true),\n elSideVal = getRect(el)[elSide];\n\n /* jshint boss:true */\n while (parent) {\n var parentSideVal = getRect(parent)[parentSide],\n visible = void 0;\n if (parentSide === 'top' || parentSide === 'left') {\n visible = elSideVal >= parentSideVal;\n } else {\n visible = elSideVal <= parentSideVal;\n }\n if (!visible) return parent;\n if (parent === getWindowScrollingElement()) break;\n parent = getParentAutoScrollElement(parent, false);\n }\n return false;\n}\n\n/**\r\n * Gets nth child of el, ignoring hidden children, sortable's elements (does not ignore clone if it's visible)\r\n * and non-draggable elements\r\n * @param {HTMLElement} el The parent element\r\n * @param {Number} childNum The index of the child\r\n * @param {Object} options Parent Sortable's options\r\n * @return {HTMLElement} The child at index childNum, or null if not found\r\n */\nfunction getChild(el, childNum, options, includeDragEl) {\n var currentChild = 0,\n i = 0,\n children = el.children;\n while (i < children.length) {\n if (children[i].style.display !== 'none' && children[i] !== Sortable.ghost && (includeDragEl || children[i] !== Sortable.dragged) && closest(children[i], options.draggable, el, false)) {\n if (currentChild === childNum) {\n return children[i];\n }\n currentChild++;\n }\n i++;\n }\n return null;\n}\n\n/**\r\n * Gets the last child in the el, ignoring ghostEl or invisible elements (clones)\r\n * @param {HTMLElement} el Parent element\r\n * @param {selector} selector Any other elements that should be ignored\r\n * @return {HTMLElement} The last child, ignoring ghostEl\r\n */\nfunction lastChild(el, selector) {\n var last = el.lastElementChild;\n while (last && (last === Sortable.ghost || css(last, 'display') === 'none' || selector && !matches(last, selector))) {\n last = last.previousElementSibling;\n }\n return last || null;\n}\n\n/**\r\n * Returns the index of an element within its parent for a selected set of\r\n * elements\r\n * @param {HTMLElement} el\r\n * @param {selector} selector\r\n * @return {number}\r\n */\nfunction index(el, selector) {\n var index = 0;\n if (!el || !el.parentNode) {\n return -1;\n }\n\n /* jshint boss:true */\n while (el = el.previousElementSibling) {\n if (el.nodeName.toUpperCase() !== 'TEMPLATE' && el !== Sortable.clone && (!selector || matches(el, selector))) {\n index++;\n }\n }\n return index;\n}\n\n/**\r\n * Returns the scroll offset of the given element, added with all the scroll offsets of parent elements.\r\n * The value is returned in real pixels.\r\n * @param {HTMLElement} el\r\n * @return {Array} Offsets in the format of [left, top]\r\n */\nfunction getRelativeScrollOffset(el) {\n var offsetLeft = 0,\n offsetTop = 0,\n winScroller = getWindowScrollingElement();\n if (el) {\n do {\n var elMatrix = matrix(el),\n scaleX = elMatrix.a,\n scaleY = elMatrix.d;\n offsetLeft += el.scrollLeft * scaleX;\n offsetTop += el.scrollTop * scaleY;\n } while (el !== winScroller && (el = el.parentNode));\n }\n return [offsetLeft, offsetTop];\n}\n\n/**\r\n * Returns the index of the object within the given array\r\n * @param {Array} arr Array that may or may not hold the object\r\n * @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\r\n * @return {Number} The index of the object in the array, or -1\r\n */\nfunction indexOfObject(arr, obj) {\n for (var i in arr) {\n if (!arr.hasOwnProperty(i)) continue;\n for (var key in obj) {\n if (obj.hasOwnProperty(key) && obj[key] === arr[i][key]) return Number(i);\n }\n }\n return -1;\n}\nfunction getParentAutoScrollElement(el, includeSelf) {\n // skip to window\n if (!el || !el.getBoundingClientRect) return getWindowScrollingElement();\n var elem = el;\n var gotSelf = false;\n do {\n // we don't need to get elem css if it isn't even overflowing in the first place (performance)\n if (elem.clientWidth < elem.scrollWidth || elem.clientHeight < elem.scrollHeight) {\n var elemCSS = css(elem);\n if (elem.clientWidth < elem.scrollWidth && (elemCSS.overflowX == 'auto' || elemCSS.overflowX == 'scroll') || elem.clientHeight < elem.scrollHeight && (elemCSS.overflowY == 'auto' || elemCSS.overflowY == 'scroll')) {\n if (!elem.getBoundingClientRect || elem === document.body) return getWindowScrollingElement();\n if (gotSelf || includeSelf) return elem;\n gotSelf = true;\n }\n }\n /* jshint boss:true */\n } while (elem = elem.parentNode);\n return getWindowScrollingElement();\n}\nfunction extend(dst, src) {\n if (dst && src) {\n for (var key in src) {\n if (src.hasOwnProperty(key)) {\n dst[key] = src[key];\n }\n }\n }\n return dst;\n}\nfunction isRectEqual(rect1, rect2) {\n 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);\n}\nvar _throttleTimeout;\nfunction throttle(callback, ms) {\n return function () {\n if (!_throttleTimeout) {\n var args = arguments,\n _this = this;\n if (args.length === 1) {\n callback.call(_this, args[0]);\n } else {\n callback.apply(_this, args);\n }\n _throttleTimeout = setTimeout(function () {\n _throttleTimeout = void 0;\n }, ms);\n }\n };\n}\nfunction cancelThrottle() {\n clearTimeout(_throttleTimeout);\n _throttleTimeout = void 0;\n}\nfunction scrollBy(el, x, y) {\n el.scrollLeft += x;\n el.scrollTop += y;\n}\nfunction clone(el) {\n var Polymer = window.Polymer;\n var $ = window.jQuery || window.Zepto;\n if (Polymer && Polymer.dom) {\n return Polymer.dom(el).cloneNode(true);\n } else if ($) {\n return $(el).clone(true)[0];\n } else {\n return el.cloneNode(true);\n }\n}\nfunction setRect(el, rect) {\n css(el, 'position', 'absolute');\n css(el, 'top', rect.top);\n css(el, 'left', rect.left);\n css(el, 'width', rect.width);\n css(el, 'height', rect.height);\n}\nfunction unsetRect(el) {\n css(el, 'position', '');\n css(el, 'top', '');\n css(el, 'left', '');\n css(el, 'width', '');\n css(el, 'height', '');\n}\nfunction getChildContainingRectFromElement(container, options, ghostEl) {\n var rect = {};\n Array.from(container.children).forEach(function (child) {\n var _rect$left, _rect$top, _rect$right, _rect$bottom;\n if (!closest(child, options.draggable, container, false) || child.animated || child === ghostEl) return;\n var childRect = getRect(child);\n rect.left = Math.min((_rect$left = rect.left) !== null && _rect$left !== void 0 ? _rect$left : Infinity, childRect.left);\n rect.top = Math.min((_rect$top = rect.top) !== null && _rect$top !== void 0 ? _rect$top : Infinity, childRect.top);\n rect.right = Math.max((_rect$right = rect.right) !== null && _rect$right !== void 0 ? _rect$right : -Infinity, childRect.right);\n rect.bottom = Math.max((_rect$bottom = rect.bottom) !== null && _rect$bottom !== void 0 ? _rect$bottom : -Infinity, childRect.bottom);\n });\n rect.width = rect.right - rect.left;\n rect.height = rect.bottom - rect.top;\n rect.x = rect.left;\n rect.y = rect.top;\n return rect;\n}\nvar expando = 'Sortable' + new Date().getTime();\n\nfunction AnimationStateManager() {\n var animationStates = [],\n animationCallbackId;\n return {\n captureAnimationState: function captureAnimationState() {\n animationStates = [];\n if (!this.options.animation) return;\n var children = [].slice.call(this.el.children);\n children.forEach(function (child) {\n if (css(child, 'display') === 'none' || child === Sortable.ghost) return;\n animationStates.push({\n target: child,\n rect: getRect(child)\n });\n var fromRect = _objectSpread2({}, animationStates[animationStates.length - 1].rect);\n\n // If animating: compensate for current animation\n if (child.thisAnimationDuration) {\n var childMatrix = matrix(child, true);\n if (childMatrix) {\n fromRect.top -= childMatrix.f;\n fromRect.left -= childMatrix.e;\n }\n }\n child.fromRect = fromRect;\n });\n },\n addAnimationState: function addAnimationState(state) {\n animationStates.push(state);\n },\n removeAnimationState: function removeAnimationState(target) {\n animationStates.splice(indexOfObject(animationStates, {\n target: target\n }), 1);\n },\n animateAll: function animateAll(callback) {\n var _this = this;\n if (!this.options.animation) {\n clearTimeout(animationCallbackId);\n if (typeof callback === 'function') callback();\n return;\n }\n var animating = false,\n animationTime = 0;\n animationStates.forEach(function (state) {\n var time = 0,\n target = state.target,\n fromRect = target.fromRect,\n toRect = getRect(target),\n prevFromRect = target.prevFromRect,\n prevToRect = target.prevToRect,\n animatingRect = state.rect,\n targetMatrix = matrix(target, true);\n if (targetMatrix) {\n // Compensate for current animation\n toRect.top -= targetMatrix.f;\n toRect.left -= targetMatrix.e;\n }\n target.toRect = toRect;\n if (target.thisAnimationDuration) {\n // Could also check if animatingRect is between fromRect and toRect\n if (isRectEqual(prevFromRect, toRect) && !isRectEqual(fromRect, toRect) &&\n // Make sure animatingRect is on line between toRect & fromRect\n (animatingRect.top - toRect.top) / (animatingRect.left - toRect.left) === (fromRect.top - toRect.top) / (fromRect.left - toRect.left)) {\n // If returning to same place as started from animation and on same axis\n time = calculateRealTime(animatingRect, prevFromRect, prevToRect, _this.options);\n }\n }\n\n // if fromRect != toRect: animate\n if (!isRectEqual(toRect, fromRect)) {\n target.prevFromRect = fromRect;\n target.prevToRect = toRect;\n if (!time) {\n time = _this.options.animation;\n }\n _this.animate(target, animatingRect, toRect, time);\n }\n if (time) {\n animating = true;\n animationTime = Math.max(animationTime, time);\n clearTimeout(target.animationResetTimer);\n target.animationResetTimer = setTimeout(function () {\n target.animationTime = 0;\n target.prevFromRect = null;\n target.fromRect = null;\n target.prevToRect = null;\n target.thisAnimationDuration = null;\n }, time);\n target.thisAnimationDuration = time;\n }\n });\n clearTimeout(animationCallbackId);\n if (!animating) {\n if (typeof callback === 'function') callback();\n } else {\n animationCallbackId = setTimeout(function () {\n if (typeof callback === 'function') callback();\n }, animationTime);\n }\n animationStates = [];\n },\n animate: function animate(target, currentRect, toRect, duration) {\n if (duration) {\n css(target, 'transition', '');\n css(target, 'transform', '');\n var elMatrix = matrix(this.el),\n scaleX = elMatrix && elMatrix.a,\n scaleY = elMatrix && elMatrix.d,\n translateX = (currentRect.left - toRect.left) / (scaleX || 1),\n translateY = (currentRect.top - toRect.top) / (scaleY || 1);\n target.animatingX = !!translateX;\n target.animatingY = !!translateY;\n css(target, 'transform', 'translate3d(' + translateX + 'px,' + translateY + 'px,0)');\n this.forRepaintDummy = repaint(target); // repaint\n\n css(target, 'transition', 'transform ' + duration + 'ms' + (this.options.easing ? ' ' + this.options.easing : ''));\n css(target, 'transform', 'translate3d(0,0,0)');\n typeof target.animated === 'number' && clearTimeout(target.animated);\n target.animated = setTimeout(function () {\n css(target, 'transition', '');\n css(target, 'transform', '');\n target.animated = false;\n target.animatingX = false;\n target.animatingY = false;\n }, duration);\n }\n }\n };\n}\nfunction repaint(target) {\n return target.offsetWidth;\n}\nfunction calculateRealTime(animatingRect, fromRect, toRect, options) {\n 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;\n}\n\nvar plugins = [];\nvar defaults = {\n initializeByDefault: true\n};\nvar PluginManager = {\n mount: function mount(plugin) {\n // Set default static properties\n for (var option in defaults) {\n if (defaults.hasOwnProperty(option) && !(option in plugin)) {\n plugin[option] = defaults[option];\n }\n }\n plugins.forEach(function (p) {\n if (p.pluginName === plugin.pluginName) {\n throw \"Sortable: Cannot mount plugin \".concat(plugin.pluginName, \" more than once\");\n }\n });\n plugins.push(plugin);\n },\n pluginEvent: function pluginEvent(eventName, sortable, evt) {\n var _this = this;\n this.eventCanceled = false;\n evt.cancel = function () {\n _this.eventCanceled = true;\n };\n var eventNameGlobal = eventName + 'Global';\n plugins.forEach(function (plugin) {\n if (!sortable[plugin.pluginName]) return;\n // Fire global events if it exists in this sortable\n if (sortable[plugin.pluginName][eventNameGlobal]) {\n sortable[plugin.pluginName][eventNameGlobal](_objectSpread2({\n sortable: sortable\n }, evt));\n }\n\n // Only fire plugin event if plugin is enabled in this sortable,\n // and plugin has event defined\n if (sortable.options[plugin.pluginName] && sortable[plugin.pluginName][eventName]) {\n sortable[plugin.pluginName][eventName](_objectSpread2({\n sortable: sortable\n }, evt));\n }\n });\n },\n initializePlugins: function initializePlugins(sortable, el, defaults, options) {\n plugins.forEach(function (plugin) {\n var pluginName = plugin.pluginName;\n if (!sortable.options[pluginName] && !plugin.initializeByDefault) return;\n var initialized = new plugin(sortable, el, sortable.options);\n initialized.sortable = sortable;\n initialized.options = sortable.options;\n sortable[pluginName] = initialized;\n\n // Add default options from plugin\n _extends(defaults, initialized.defaults);\n });\n for (var option in sortable.options) {\n if (!sortable.options.hasOwnProperty(option)) continue;\n var modified = this.modifyOption(sortable, option, sortable.options[option]);\n if (typeof modified !== 'undefined') {\n sortable.options[option] = modified;\n }\n }\n },\n getEventProperties: function getEventProperties(name, sortable) {\n var eventProperties = {};\n plugins.forEach(function (plugin) {\n if (typeof plugin.eventProperties !== 'function') return;\n _extends(eventProperties, plugin.eventProperties.call(sortable[plugin.pluginName], name));\n });\n return eventProperties;\n },\n modifyOption: function modifyOption(sortable, name, value) {\n var modifiedValue;\n plugins.forEach(function (plugin) {\n // Plugin must exist on the Sortable\n if (!sortable[plugin.pluginName]) return;\n\n // If static option listener exists for this option, call in the context of the Sortable's instance of this plugin\n if (plugin.optionListeners && typeof plugin.optionListeners[name] === 'function') {\n modifiedValue = plugin.optionListeners[name].call(sortable[plugin.pluginName], value);\n }\n });\n return modifiedValue;\n }\n};\n\nfunction dispatchEvent(_ref) {\n var sortable = _ref.sortable,\n rootEl = _ref.rootEl,\n name = _ref.name,\n targetEl = _ref.targetEl,\n cloneEl = _ref.cloneEl,\n toEl = _ref.toEl,\n fromEl = _ref.fromEl,\n oldIndex = _ref.oldIndex,\n newIndex = _ref.newIndex,\n oldDraggableIndex = _ref.oldDraggableIndex,\n newDraggableIndex = _ref.newDraggableIndex,\n originalEvent = _ref.originalEvent,\n putSortable = _ref.putSortable,\n extraEventProperties = _ref.extraEventProperties;\n sortable = sortable || rootEl && rootEl[expando];\n if (!sortable) return;\n var evt,\n options = sortable.options,\n onName = 'on' + name.charAt(0).toUpperCase() + name.substr(1);\n // Support for new CustomEvent feature\n if (window.CustomEvent && !IE11OrLess && !Edge) {\n evt = new CustomEvent(name, {\n bubbles: true,\n cancelable: true\n });\n } else {\n evt = document.createEvent('Event');\n evt.initEvent(name, true, true);\n }\n evt.to = toEl || rootEl;\n evt.from = fromEl || rootEl;\n evt.item = targetEl || rootEl;\n evt.clone = cloneEl;\n evt.oldIndex = oldIndex;\n evt.newIndex = newIndex;\n evt.oldDraggableIndex = oldDraggableIndex;\n evt.newDraggableIndex = newDraggableIndex;\n evt.originalEvent = originalEvent;\n evt.pullMode = putSortable ? putSortable.lastPutMode : undefined;\n var allEventProperties = _objectSpread2(_objectSpread2({}, extraEventProperties), PluginManager.getEventProperties(name, sortable));\n for (var option in allEventProperties) {\n evt[option] = allEventProperties[option];\n }\n if (rootEl) {\n rootEl.dispatchEvent(evt);\n }\n if (options[onName]) {\n options[onName].call(sortable, evt);\n }\n}\n\nvar _excluded = [\"evt\"];\nvar pluginEvent = function pluginEvent(eventName, sortable) {\n var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},\n originalEvent = _ref.evt,\n data = _objectWithoutProperties(_ref, _excluded);\n PluginManager.pluginEvent.bind(Sortable)(eventName, sortable, _objectSpread2({\n dragEl: dragEl,\n parentEl: parentEl,\n ghostEl: ghostEl,\n rootEl: rootEl,\n nextEl: nextEl,\n lastDownEl: lastDownEl,\n cloneEl: cloneEl,\n cloneHidden: cloneHidden,\n dragStarted: moved,\n putSortable: putSortable,\n activeSortable: Sortable.active,\n originalEvent: originalEvent,\n oldIndex: oldIndex,\n oldDraggableIndex: oldDraggableIndex,\n newIndex: newIndex,\n newDraggableIndex: newDraggableIndex,\n hideGhostForTarget: _hideGhostForTarget,\n unhideGhostForTarget: _unhideGhostForTarget,\n cloneNowHidden: function cloneNowHidden() {\n cloneHidden = true;\n },\n cloneNowShown: function cloneNowShown() {\n cloneHidden = false;\n },\n dispatchSortableEvent: function dispatchSortableEvent(name) {\n _dispatchEvent({\n sortable: sortable,\n name: name,\n originalEvent: originalEvent\n });\n }\n }, data));\n};\nfunction _dispatchEvent(info) {\n dispatchEvent(_objectSpread2({\n putSortable: putSortable,\n cloneEl: cloneEl,\n targetEl: dragEl,\n rootEl: rootEl,\n oldIndex: oldIndex,\n oldDraggableIndex: oldDraggableIndex,\n newIndex: newIndex,\n newDraggableIndex: newDraggableIndex\n }, info));\n}\nvar dragEl,\n parentEl,\n ghostEl,\n rootEl,\n nextEl,\n lastDownEl,\n cloneEl,\n cloneHidden,\n oldIndex,\n newIndex,\n oldDraggableIndex,\n newDraggableIndex,\n activeGroup,\n putSortable,\n awaitingDragStarted = false,\n ignoreNextClick = false,\n sortables = [],\n tapEvt,\n touchEvt,\n lastDx,\n lastDy,\n tapDistanceLeft,\n tapDistanceTop,\n moved,\n lastTarget,\n lastDirection,\n pastFirstInvertThresh = false,\n isCircumstantialInvert = false,\n targetMoveDistance,\n // For positioning ghost absolutely\n ghostRelativeParent,\n ghostRelativeParentInitialScroll = [],\n // (left, top)\n\n _silent = false,\n savedInputChecked = [];\n\n/** @const */\nvar documentExists = typeof document !== 'undefined',\n PositionGhostAbsolutely = IOS,\n CSSFloatProperty = Edge || IE11OrLess ? 'cssFloat' : 'float',\n // This will not pass for IE9, because IE9 DnD only works on anchors\n supportDraggable = documentExists && !ChromeForAndroid && !IOS && 'draggable' in document.createElement('div'),\n supportCssPointerEvents = function () {\n if (!documentExists) return;\n // false when <= IE11\n if (IE11OrLess) {\n return false;\n }\n var el = document.createElement('x');\n el.style.cssText = 'pointer-events:auto';\n return el.style.pointerEvents === 'auto';\n }(),\n _detectDirection = function _detectDirection(el, options) {\n var elCSS = css(el),\n elWidth = parseInt(elCSS.width) - parseInt(elCSS.paddingLeft) - parseInt(elCSS.paddingRight) - parseInt(elCSS.borderLeftWidth) - parseInt(elCSS.borderRightWidth),\n child1 = getChild(el, 0, options),\n child2 = getChild(el, 1, options),\n firstChildCSS = child1 && css(child1),\n secondChildCSS = child2 && css(child2),\n firstChildWidth = firstChildCSS && parseInt(firstChildCSS.marginLeft) + parseInt(firstChildCSS.marginRight) + getRect(child1).width,\n secondChildWidth = secondChildCSS && parseInt(secondChildCSS.marginLeft) + parseInt(secondChildCSS.marginRight) + getRect(child2).width;\n if (elCSS.display === 'flex') {\n return elCSS.flexDirection === 'column' || elCSS.flexDirection === 'column-reverse' ? 'vertical' : 'horizontal';\n }\n if (elCSS.display === 'grid') {\n return elCSS.gridTemplateColumns.split(' ').length <= 1 ? 'vertical' : 'horizontal';\n }\n if (child1 && firstChildCSS[\"float\"] && firstChildCSS[\"float\"] !== 'none') {\n var touchingSideChild2 = firstChildCSS[\"float\"] === 'left' ? 'left' : 'right';\n return child2 && (secondChildCSS.clear === 'both' || secondChildCSS.clear === touchingSideChild2) ? 'vertical' : 'horizontal';\n }\n 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';\n },\n _dragElInRowColumn = function _dragElInRowColumn(dragRect, targetRect, vertical) {\n var dragElS1Opp = vertical ? dragRect.left : dragRect.top,\n dragElS2Opp = vertical ? dragRect.right : dragRect.bottom,\n dragElOppLength = vertical ? dragRect.width : dragRect.height,\n targetS1Opp = vertical ? targetRect.left : targetRect.top,\n targetS2Opp = vertical ? targetRect.right : targetRect.bottom,\n targetOppLength = vertical ? targetRect.width : targetRect.height;\n return dragElS1Opp === targetS1Opp || dragElS2Opp === targetS2Opp || dragElS1Opp + dragElOppLength / 2 === targetS1Opp + targetOppLength / 2;\n },\n /**\r\n * Detects first nearest empty sortable to X and Y position using emptyInsertThreshold.\r\n * @param {Number} x X position\r\n * @param {Number} y Y position\r\n * @return {HTMLElement} Element of the first found nearest Sortable\r\n */\n _detectNearestEmptySortable = function _detectNearestEmptySortable(x, y) {\n var ret;\n sortables.some(function (sortable) {\n var threshold = sortable[expando].options.emptyInsertThreshold;\n if (!threshold || lastChild(sortable)) return;\n var rect = getRect(sortable),\n insideHorizontally = x >= rect.left - threshold && x <= rect.right + threshold,\n insideVertically = y >= rect.top - threshold && y <= rect.bottom + threshold;\n if (insideHorizontally && insideVertically) {\n return ret = sortable;\n }\n });\n return ret;\n },\n _prepareGroup = function _prepareGroup(options) {\n function toFn(value, pull) {\n return function (to, from, dragEl, evt) {\n var sameGroup = to.options.group.name && from.options.group.name && to.options.group.name === from.options.group.name;\n if (value == null && (pull || sameGroup)) {\n // Default pull value\n // Default pull and put value if same group\n return true;\n } else if (value == null || value === false) {\n return false;\n } else if (pull && value === 'clone') {\n return value;\n } else if (typeof value === 'function') {\n return toFn(value(to, from, dragEl, evt), pull)(to, from, dragEl, evt);\n } else {\n var otherGroup = (pull ? to : from).options.group.name;\n return value === true || typeof value === 'string' && value === otherGroup || value.join && value.indexOf(otherGroup) > -1;\n }\n };\n }\n var group = {};\n var originalGroup = options.group;\n if (!originalGroup || _typeof(originalGroup) != 'object') {\n originalGroup = {\n name: originalGroup\n };\n }\n group.name = originalGroup.name;\n group.checkPull = toFn(originalGroup.pull, true);\n group.checkPut = toFn(originalGroup.put);\n group.revertClone = originalGroup.revertClone;\n options.group = group;\n },\n _hideGhostForTarget = function _hideGhostForTarget() {\n if (!supportCssPointerEvents && ghostEl) {\n css(ghostEl, 'display', 'none');\n }\n },\n _unhideGhostForTarget = function _unhideGhostForTarget() {\n if (!supportCssPointerEvents && ghostEl) {\n css(ghostEl, 'display', '');\n }\n };\n\n// #1184 fix - Prevent click event on fallback if dragged but item not changed position\nif (documentExists && !ChromeForAndroid) {\n document.addEventListener('click', function (evt) {\n if (ignoreNextClick) {\n evt.preventDefault();\n evt.stopPropagation && evt.stopPropagation();\n evt.stopImmediatePropagation && evt.stopImmediatePropagation();\n ignoreNextClick = false;\n return false;\n }\n }, true);\n}\nvar nearestEmptyInsertDetectEvent = function nearestEmptyInsertDetectEvent(evt) {\n if (dragEl) {\n evt = evt.touches ? evt.touches[0] : evt;\n var nearest = _detectNearestEmptySortable(evt.clientX, evt.clientY);\n if (nearest) {\n // Create imitation event\n var event = {};\n for (var i in evt) {\n if (evt.hasOwnProperty(i)) {\n event[i] = evt[i];\n }\n }\n event.target = event.rootEl = nearest;\n event.preventDefault = void 0;\n event.stopPropagation = void 0;\n nearest[expando]._onDragOver(event);\n }\n }\n};\nvar _checkOutsideTargetEl = function _checkOutsideTargetEl(evt) {\n if (dragEl) {\n dragEl.parentNode[expando]._isOutsideThisEl(evt.target);\n }\n};\n\n/**\r\n * @class Sortable\r\n * @param {HTMLElement} el\r\n * @param {Object} [options]\r\n */\nfunction Sortable(el, options) {\n if (!(el && el.nodeType && el.nodeType === 1)) {\n throw \"Sortable: `el` must be an HTMLElement, not \".concat({}.toString.call(el));\n }\n this.el = el; // root element\n this.options = options = _extends({}, options);\n\n // Export instance\n el[expando] = this;\n var defaults = {\n group: null,\n sort: true,\n disabled: false,\n store: null,\n handle: null,\n draggable: /^[uo]l$/i.test(el.nodeName) ? '>li' : '>*',\n swapThreshold: 1,\n // percentage; 0 <= x <= 1\n invertSwap: false,\n // invert always\n invertedSwapThreshold: null,\n // will be set to same as swapThreshold if default\n removeCloneOnHide: true,\n direction: function direction() {\n return _detectDirection(el, this.options);\n },\n ghostClass: 'sortable-ghost',\n chosenClass: 'sortable-chosen',\n dragClass: 'sortable-drag',\n ignore: 'a, img',\n filter: null,\n preventOnFilter: true,\n animation: 0,\n easing: null,\n setData: function setData(dataTransfer, dragEl) {\n dataTransfer.setData('Text', dragEl.textContent);\n },\n dropBubble: false,\n dragoverBubble: false,\n dataIdAttr: 'data-id',\n delay: 0,\n delayOnTouchOnly: false,\n touchStartThreshold: (Number.parseInt ? Number : window).parseInt(window.devicePixelRatio, 10) || 1,\n forceFallback: false,\n fallbackClass: 'sortable-fallback',\n fallbackOnBody: false,\n fallbackTolerance: 0,\n fallbackOffset: {\n x: 0,\n y: 0\n },\n // Disabled on Safari: #1571; Enabled on Safari IOS: #2244\n supportPointer: Sortable.supportPointer !== false && 'PointerEvent' in window && (!Safari || IOS),\n emptyInsertThreshold: 5\n };\n PluginManager.initializePlugins(this, el, defaults);\n\n // Set default options\n for (var name in defaults) {\n !(name in options) && (options[name] = defaults[name]);\n }\n _prepareGroup(options);\n\n // Bind all private methods\n for (var fn in this) {\n if (fn.charAt(0) === '_' && typeof this[fn] === 'function') {\n this[fn] = this[fn].bind(this);\n }\n }\n\n // Setup drag mode\n this.nativeDraggable = options.forceFallback ? false : supportDraggable;\n if (this.nativeDraggable) {\n // Touch start threshold cannot be greater than the native dragstart threshold\n this.options.touchStartThreshold = 1;\n }\n\n // Bind events\n if (options.supportPointer) {\n on(el, 'pointerdown', this._onTapStart);\n } else {\n on(el, 'mousedown', this._onTapStart);\n on(el, 'touchstart', this._onTapStart);\n }\n if (this.nativeDraggable) {\n on(el, 'dragover', this);\n on(el, 'dragenter', this);\n }\n sortables.push(this.el);\n\n // Restore sorting\n options.store && options.store.get && this.sort(options.store.get(this) || []);\n\n // Add animation state manager\n _extends(this, AnimationStateManager());\n}\nSortable.prototype = /** @lends Sortable.prototype */{\n constructor: Sortable,\n _isOutsideThisEl: function _isOutsideThisEl(target) {\n if (!this.el.contains(target) && target !== this.el) {\n lastTarget = null;\n }\n },\n _getDirection: function _getDirection(evt, target) {\n return typeof this.options.direction === 'function' ? this.options.direction.call(this, evt, target, dragEl) : this.options.direction;\n },\n _onTapStart: function _onTapStart( /** Event|TouchEvent */evt) {\n if (!evt.cancelable) return;\n var _this = this,\n el = this.el,\n options = this.options,\n preventOnFilter = options.preventOnFilter,\n type = evt.type,\n touch = evt.touches && evt.touches[0] || evt.pointerType && evt.pointerType === 'touch' && evt,\n target = (touch || evt).target,\n originalTarget = evt.target.shadowRoot && (evt.path && evt.path[0] || evt.composedPath && evt.composedPath()[0]) || target,\n filter = options.filter;\n _saveInputCheckedState(el);\n\n // Don't trigger start event when an element is been dragged, otherwise the evt.oldindex always wrong when set option.group.\n if (dragEl) {\n return;\n }\n if (/mousedown|pointerdown/.test(type) && evt.button !== 0 || options.disabled) {\n return; // only left button and enabled\n }\n\n // cancel dnd if original target is content editable\n if (originalTarget.isContentEditable) {\n return;\n }\n\n // Safari ignores further event handling after mousedown\n if (!this.nativeDraggable && Safari && target && target.tagName.toUpperCase() === 'SELECT') {\n return;\n }\n target = closest(target, options.draggable, el, false);\n if (target && target.animated) {\n return;\n }\n if (lastDownEl === target) {\n // Ignoring duplicate `down`\n return;\n }\n\n // Get the index of the dragged element within its parent\n oldIndex = index(target);\n oldDraggableIndex = index(target, options.draggable);\n\n // Check filter\n if (typeof filter === 'function') {\n if (filter.call(this, evt, target, this)) {\n _dispatchEvent({\n sortable: _this,\n rootEl: originalTarget,\n name: 'filter',\n targetEl: target,\n toEl: el,\n fromEl: el\n });\n pluginEvent('filter', _this, {\n evt: evt\n });\n preventOnFilter && evt.preventDefault();\n return; // cancel dnd\n }\n } else if (filter) {\n filter = filter.split(',').some(function (criteria) {\n criteria = closest(originalTarget, criteria.trim(), el, false);\n if (criteria) {\n _dispatchEvent({\n sortable: _this,\n rootEl: criteria,\n name: 'filter',\n targetEl: target,\n fromEl: el,\n toEl: el\n });\n pluginEvent('filter', _this, {\n evt: evt\n });\n return true;\n }\n });\n if (filter) {\n preventOnFilter && evt.preventDefault();\n return; // cancel dnd\n }\n }\n if (options.handle && !closest(originalTarget, options.handle, el, false)) {\n return;\n }\n\n // Prepare `dragstart`\n this._prepareDragStart(evt, touch, target);\n },\n _prepareDragStart: function _prepareDragStart( /** Event */evt, /** Touch */touch, /** HTMLElement */target) {\n var _this = this,\n el = _this.el,\n options = _this.options,\n ownerDocument = el.ownerDocument,\n dragStartFn;\n if (target && !dragEl && target.parentNode === el) {\n var dragRect = getRect(target);\n rootEl = el;\n dragEl = target;\n parentEl = dragEl.parentNode;\n nextEl = dragEl.nextSibling;\n lastDownEl = target;\n activeGroup = options.group;\n Sortable.dragged = dragEl;\n tapEvt = {\n target: dragEl,\n clientX: (touch || evt).clientX,\n clientY: (touch || evt).clientY\n };\n tapDistanceLeft = tapEvt.clientX - dragRect.left;\n tapDistanceTop = tapEvt.clientY - dragRect.top;\n this._lastX = (touch || evt).clientX;\n this._lastY = (touch || evt).clientY;\n dragEl.style['will-change'] = 'all';\n dragStartFn = function dragStartFn() {\n pluginEvent('delayEnded', _this, {\n evt: evt\n });\n if (Sortable.eventCanceled) {\n _this._onDrop();\n return;\n }\n // Delayed drag has been triggered\n // we can re-enable the events: touchmove/mousemove\n _this._disableDelayedDragEvents();\n if (!FireFox && _this.nativeDraggable) {\n dragEl.draggable = true;\n }\n\n // Bind the events: dragstart/dragend\n _this._triggerDragStart(evt, touch);\n\n // Drag start event\n _dispatchEvent({\n sortable: _this,\n name: 'choose',\n originalEvent: evt\n });\n\n // Chosen item\n toggleClass(dragEl, options.chosenClass, true);\n };\n\n // Disable \"draggable\"\n options.ignore.split(',').forEach(function (criteria) {\n find(dragEl, criteria.trim(), _disableDraggable);\n });\n on(ownerDocument, 'dragover', nearestEmptyInsertDetectEvent);\n on(ownerDocument, 'mousemove', nearestEmptyInsertDetectEvent);\n on(ownerDocument, 'touchmove', nearestEmptyInsertDetectEvent);\n if (options.supportPointer) {\n on(ownerDocument, 'pointerup', _this._onDrop);\n // Native D&D triggers pointercancel\n !this.nativeDraggable && on(ownerDocument, 'pointercancel', _this._onDrop);\n } else {\n on(ownerDocument, 'mouseup', _this._onDrop);\n on(ownerDocument, 'touchend', _this._onDrop);\n on(ownerDocument, 'touchcancel', _this._onDrop);\n }\n\n // Make dragEl draggable (must be before delay for FireFox)\n if (FireFox && this.nativeDraggable) {\n this.options.touchStartThreshold = 4;\n dragEl.draggable = true;\n }\n pluginEvent('delayStart', this, {\n evt: evt\n });\n\n // Delay is impossible for native DnD in Edge or IE\n if (options.delay && (!options.delayOnTouchOnly || touch) && (!this.nativeDraggable || !(Edge || IE11OrLess))) {\n if (Sortable.eventCanceled) {\n this._onDrop();\n return;\n }\n // If the user moves the pointer or let go the click or touch\n // before the delay has been reached:\n // disable the delayed drag\n if (options.supportPointer) {\n on(ownerDocument, 'pointerup', _this._disableDelayedDrag);\n on(ownerDocument, 'pointercancel', _this._disableDelayedDrag);\n } else {\n on(ownerDocument, 'mouseup', _this._disableDelayedDrag);\n on(ownerDocument, 'touchend', _this._disableDelayedDrag);\n on(ownerDocument, 'touchcancel', _this._disableDelayedDrag);\n }\n on(ownerDocument, 'mousemove', _this._delayedDragTouchMoveHandler);\n on(ownerDocument, 'touchmove', _this._delayedDragTouchMoveHandler);\n options.supportPointer && on(ownerDocument, 'pointermove', _this._delayedDragTouchMoveHandler);\n _this._dragStartTimer = setTimeout(dragStartFn, options.delay);\n } else {\n dragStartFn();\n }\n }\n },\n _delayedDragTouchMoveHandler: function _delayedDragTouchMoveHandler( /** TouchEvent|PointerEvent **/e) {\n var touch = e.touches ? e.touches[0] : e;\n 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))) {\n this._disableDelayedDrag();\n }\n },\n _disableDelayedDrag: function _disableDelayedDrag() {\n dragEl && _disableDraggable(dragEl);\n clearTimeout(this._dragStartTimer);\n this._disableDelayedDragEvents();\n },\n _disableDelayedDragEvents: function _disableDelayedDragEvents() {\n var ownerDocument = this.el.ownerDocument;\n off(ownerDocument, 'mouseup', this._disableDelayedDrag);\n off(ownerDocument, 'touchend', this._disableDelayedDrag);\n off(ownerDocument, 'touchcancel', this._disableDelayedDrag);\n off(ownerDocument, 'pointerup', this._disableDelayedDrag);\n off(ownerDocument, 'pointercancel', this._disableDelayedDrag);\n off(ownerDocument, 'mousemove', this._delayedDragTouchMoveHandler);\n off(ownerDocument, 'touchmove', this._delayedDragTouchMoveHandler);\n off(ownerDocument, 'pointermove', this._delayedDragTouchMoveHandler);\n },\n _triggerDragStart: function _triggerDragStart( /** Event */evt, /** Touch */touch) {\n touch = touch || evt.pointerType == 'touch' && evt;\n if (!this.nativeDraggable || touch) {\n if (this.options.supportPointer) {\n on(document, 'pointermove', this._onTouchMove);\n } else if (touch) {\n on(document, 'touchmove', this._onTouchMove);\n } else {\n on(document, 'mousemove', this._onTouchMove);\n }\n } else {\n on(dragEl, 'dragend', this);\n on(rootEl, 'dragstart', this._onDragStart);\n }\n try {\n if (document.selection) {\n _nextTick(function () {\n document.selection.empty();\n });\n } else {\n window.getSelection().removeAllRanges();\n }\n } catch (err) {}\n },\n _dragStarted: function _dragStarted(fallback, evt) {\n awaitingDragStarted = false;\n if (rootEl && dragEl) {\n pluginEvent('dragStarted', this, {\n evt: evt\n });\n if (this.nativeDraggable) {\n on(document, 'dragover', _checkOutsideTargetEl);\n }\n var options = this.options;\n\n // Apply effect\n !fallback && toggleClass(dragEl, options.dragClass, false);\n toggleClass(dragEl, options.ghostClass, true);\n Sortable.active = this;\n fallback && this._appendGhost();\n\n // Drag start event\n _dispatchEvent({\n sortable: this,\n name: 'start',\n originalEvent: evt\n });\n } else {\n this._nulling();\n }\n },\n _emulateDragOver: function _emulateDragOver() {\n if (touchEvt) {\n this._lastX = touchEvt.clientX;\n this._lastY = touchEvt.clientY;\n _hideGhostForTarget();\n var target = document.elementFromPoint(touchEvt.clientX, touchEvt.clientY);\n var parent = target;\n while (target && target.shadowRoot) {\n target = target.shadowRoot.elementFromPoint(touchEvt.clientX, touchEvt.clientY);\n if (target === parent) break;\n parent = target;\n }\n dragEl.parentNode[expando]._isOutsideThisEl(target);\n if (parent) {\n do {\n if (parent[expando]) {\n var inserted = void 0;\n inserted = parent[expando]._onDragOver({\n clientX: touchEvt.clientX,\n clientY: touchEvt.clientY,\n target: target,\n rootEl: parent\n });\n if (inserted && !this.options.dragoverBubble) {\n break;\n }\n }\n target = parent; // store last element\n }\n /* jshint boss:true */ while (parent = getParentOrHost(parent));\n }\n _unhideGhostForTarget();\n }\n },\n _onTouchMove: function _onTouchMove( /**TouchEvent*/evt) {\n if (tapEvt) {\n var options = this.options,\n fallbackTolerance = options.fallbackTolerance,\n fallbackOffset = options.fallbackOffset,\n touch = evt.touches ? evt.touches[0] : evt,\n ghostMatrix = ghostEl && matrix(ghostEl, true),\n scaleX = ghostEl && ghostMatrix && ghostMatrix.a,\n scaleY = ghostEl && ghostMatrix && ghostMatrix.d,\n relativeScrollOffset = PositionGhostAbsolutely && ghostRelativeParent && getRelativeScrollOffset(ghostRelativeParent),\n dx = (touch.clientX - tapEvt.clientX + fallbackOffset.x) / (scaleX || 1) + (relativeScrollOffset ? relativeScrollOffset[0] - ghostRelativeParentInitialScroll[0] : 0) / (scaleX || 1),\n dy = (touch.clientY - tapEvt.clientY + fallbackOffset.y) / (scaleY || 1) + (relativeScrollOffset ? relativeScrollOffset[1] - ghostRelativeParentInitialScroll[1] : 0) / (scaleY || 1);\n\n // only set the status to dragging, when we are actually dragging\n if (!Sortable.active && !awaitingDragStarted) {\n if (fallbackTolerance && Math.max(Math.abs(touch.clientX - this._lastX), Math.abs(touch.clientY - this._lastY)) < fallbackTolerance) {\n return;\n }\n this._onDragStart(evt, true);\n }\n if (ghostEl) {\n if (ghostMatrix) {\n ghostMatrix.e += dx - (lastDx || 0);\n ghostMatrix.f += dy - (lastDy || 0);\n } else {\n ghostMatrix = {\n a: 1,\n b: 0,\n c: 0,\n d: 1,\n e: dx,\n f: dy\n };\n }\n var cssMatrix = \"matrix(\".concat(ghostMatrix.a, \",\").concat(ghostMatrix.b, \",\").concat(ghostMatrix.c, \",\").concat(ghostMatrix.d, \",\").concat(ghostMatrix.e, \",\").concat(ghostMatrix.f, \")\");\n css(ghostEl, 'webkitTransform', cssMatrix);\n css(ghostEl, 'mozTransform', cssMatrix);\n css(ghostEl, 'msTransform', cssMatrix);\n css(ghostEl, 'transform', cssMatrix);\n lastDx = dx;\n lastDy = dy;\n touchEvt = touch;\n }\n evt.cancelable && evt.preventDefault();\n }\n },\n _appendGhost: function _appendGhost() {\n // Bug if using scale(): https://stackoverflow.com/questions/2637058\n // Not being adjusted for\n if (!ghostEl) {\n var container = this.options.fallbackOnBody ? document.body : rootEl,\n rect = getRect(dragEl, true, PositionGhostAbsolutely, true, container),\n options = this.options;\n\n // Position absolutely\n if (PositionGhostAbsolutely) {\n // Get relatively positioned parent\n ghostRelativeParent = container;\n while (css(ghostRelativeParent, 'position') === 'static' && css(ghostRelativeParent, 'transform') === 'none' && ghostRelativeParent !== document) {\n ghostRelativeParent = ghostRelativeParent.parentNode;\n }\n if (ghostRelativeParent !== document.body && ghostRelativeParent !== document.documentElement) {\n if (ghostRelativeParent === document) ghostRelativeParent = getWindowScrollingElement();\n rect.top += ghostRelativeParent.scrollTop;\n rect.left += ghostRelativeParent.scrollLeft;\n } else {\n ghostRelativeParent = getWindowScrollingElement();\n }\n ghostRelativeParentInitialScroll = getRelativeScrollOffset(ghostRelativeParent);\n }\n ghostEl = dragEl.cloneNode(true);\n toggleClass(ghostEl, options.ghostClass, false);\n toggleClass(ghostEl, options.fallbackClass, true);\n toggleClass(ghostEl, options.dragClass, true);\n css(ghostEl, 'transition', '');\n css(ghostEl, 'transform', '');\n css(ghostEl, 'box-sizing', 'border-box');\n css(ghostEl, 'margin', 0);\n css(ghostEl, 'top', rect.top);\n css(ghostEl, 'left', rect.left);\n css(ghostEl, 'width', rect.width);\n css(ghostEl, 'height', rect.height);\n css(ghostEl, 'opacity', '0.8');\n css(ghostEl, 'position', PositionGhostAbsolutely ? 'absolute' : 'fixed');\n css(ghostEl, 'zIndex', '100000');\n css(ghostEl, 'pointerEvents', 'none');\n Sortable.ghost = ghostEl;\n container.appendChild(ghostEl);\n\n // Set transform-origin\n css(ghostEl, 'transform-origin', tapDistanceLeft / parseInt(ghostEl.style.width) * 100 + '% ' + tapDistanceTop / parseInt(ghostEl.style.height) * 100 + '%');\n }\n },\n _onDragStart: function _onDragStart( /**Event*/evt, /**boolean*/fallback) {\n var _this = this;\n var dataTransfer = evt.dataTransfer;\n var options = _this.options;\n pluginEvent('dragStart', this, {\n evt: evt\n });\n if (Sortable.eventCanceled) {\n this._onDrop();\n return;\n }\n pluginEvent('setupClone', this);\n if (!Sortable.eventCanceled) {\n cloneEl = clone(dragEl);\n cloneEl.removeAttribute(\"id\");\n cloneEl.draggable = false;\n cloneEl.style['will-change'] = '';\n this._hideClone();\n toggleClass(cloneEl, this.options.chosenClass, false);\n Sortable.clone = cloneEl;\n }\n\n // #1143: IFrame support workaround\n _this.cloneId = _nextTick(function () {\n pluginEvent('clone', _this);\n if (Sortable.eventCanceled) return;\n if (!_this.options.removeCloneOnHide) {\n rootEl.insertBefore(cloneEl, dragEl);\n }\n _this._hideClone();\n _dispatchEvent({\n sortable: _this,\n name: 'clone'\n });\n });\n !fallback && toggleClass(dragEl, options.dragClass, true);\n\n // Set proper drop events\n if (fallback) {\n ignoreNextClick = true;\n _this._loopId = setInterval(_this._emulateDragOver, 50);\n } else {\n // Undo what was set in _prepareDragStart before drag started\n off(document, 'mouseup', _this._onDrop);\n off(document, 'touchend', _this._onDrop);\n off(document, 'touchcancel', _this._onDrop);\n if (dataTransfer) {\n dataTransfer.effectAllowed = 'move';\n options.setData && options.setData.call(_this, dataTransfer, dragEl);\n }\n on(document, 'drop', _this);\n\n // #1276 fix:\n css(dragEl, 'transform', 'translateZ(0)');\n }\n awaitingDragStarted = true;\n _this._dragStartId = _nextTick(_this._dragStarted.bind(_this, fallback, evt));\n on(document, 'selectstart', _this);\n moved = true;\n window.getSelection().removeAllRanges();\n if (Safari) {\n css(document.body, 'user-select', 'none');\n }\n },\n // Returns true - if no further action is needed (either inserted or another condition)\n _onDragOver: function _onDragOver( /**Event*/evt) {\n var el = this.el,\n target = evt.target,\n dragRect,\n targetRect,\n revert,\n options = this.options,\n group = options.group,\n activeSortable = Sortable.active,\n isOwner = activeGroup === group,\n canSort = options.sort,\n fromSortable = putSortable || activeSortable,\n vertical,\n _this = this,\n completedFired = false;\n if (_silent) return;\n function dragOverEvent(name, extra) {\n pluginEvent(name, _this, _objectSpread2({\n evt: evt,\n isOwner: isOwner,\n axis: vertical ? 'vertical' : 'horizontal',\n revert: revert,\n dragRect: dragRect,\n targetRect: targetRect,\n canSort: canSort,\n fromSortable: fromSortable,\n target: target,\n completed: completed,\n onMove: function onMove(target, after) {\n return _onMove(rootEl, el, dragEl, dragRect, target, getRect(target), evt, after);\n },\n changed: changed\n }, extra));\n }\n\n // Capture animation state\n function capture() {\n dragOverEvent('dragOverAnimationCapture');\n _this.captureAnimationState();\n if (_this !== fromSortable) {\n fromSortable.captureAnimationState();\n }\n }\n\n // Return invocation when dragEl is inserted (or completed)\n function completed(insertion) {\n dragOverEvent('dragOverCompleted', {\n insertion: insertion\n });\n if (insertion) {\n // Clones must be hidden before folding animation to capture dragRectAbsolute properly\n if (isOwner) {\n activeSortable._hideClone();\n } else {\n activeSortable._showClone(_this);\n }\n if (_this !== fromSortable) {\n // Set ghost class to new sortable's ghost class\n toggleClass(dragEl, putSortable ? putSortable.options.ghostClass : activeSortable.options.ghostClass, false);\n toggleClass(dragEl, options.ghostClass, true);\n }\n if (putSortable !== _this && _this !== Sortable.active) {\n putSortable = _this;\n } else if (_this === Sortable.active && putSortable) {\n putSortable = null;\n }\n\n // Animation\n if (fromSortable === _this) {\n _this._ignoreWhileAnimating = target;\n }\n _this.animateAll(function () {\n dragOverEvent('dragOverAnimationComplete');\n _this._ignoreWhileAnimating = null;\n });\n if (_this !== fromSortable) {\n fromSortable.animateAll();\n fromSortable._ignoreWhileAnimating = null;\n }\n }\n\n // Null lastTarget if it is not inside a previously swapped element\n if (target === dragEl && !dragEl.animated || target === el && !target.animated) {\n lastTarget = null;\n }\n\n // no bubbling and not fallback\n if (!options.dragoverBubble && !evt.rootEl && target !== document) {\n dragEl.parentNode[expando]._isOutsideThisEl(evt.target);\n\n // Do not detect for empty insert if already inserted\n !insertion && nearestEmptyInsertDetectEvent(evt);\n }\n !options.dragoverBubble && evt.stopPropagation && evt.stopPropagation();\n return completedFired = true;\n }\n\n // Call when dragEl has been inserted\n function changed() {\n newIndex = index(dragEl);\n newDraggableIndex = index(dragEl, options.draggable);\n _dispatchEvent({\n sortable: _this,\n name: 'change',\n toEl: el,\n newIndex: newIndex,\n newDraggableIndex: newDraggableIndex,\n originalEvent: evt\n });\n }\n if (evt.preventDefault !== void 0) {\n evt.cancelable && evt.preventDefault();\n }\n target = closest(target, options.draggable, el, true);\n dragOverEvent('dragOver');\n if (Sortable.eventCanceled) return completedFired;\n if (dragEl.contains(evt.target) || target.animated && target.animatingX && target.animatingY || _this._ignoreWhileAnimating === target) {\n return completed(false);\n }\n ignoreNextClick = false;\n if (activeSortable && !options.disabled && (isOwner ? canSort || (revert = parentEl !== rootEl) // Reverting item into the original list\n : putSortable === this || (this.lastPutMode = activeGroup.checkPull(this, activeSortable, dragEl, evt)) && group.checkPut(this, activeSortable, dragEl, evt))) {\n vertical = this._getDirection(evt, target) === 'vertical';\n dragRect = getRect(dragEl);\n dragOverEvent('dragOverValid');\n if (Sortable.eventCanceled) return completedFired;\n if (revert) {\n parentEl = rootEl; // actualization\n capture();\n this._hideClone();\n dragOverEvent('revert');\n if (!Sortable.eventCanceled) {\n if (nextEl) {\n rootEl.insertBefore(dragEl, nextEl);\n } else {\n rootEl.appendChild(dragEl);\n }\n }\n return completed(true);\n }\n var elLastChild = lastChild(el, options.draggable);\n if (!elLastChild || _ghostIsLast(evt, vertical, this) && !elLastChild.animated) {\n // Insert to end of list\n\n // If already at end of list: Do not insert\n if (elLastChild === dragEl) {\n return completed(false);\n }\n\n // if there is a last element, it is the target\n if (elLastChild && el === evt.target) {\n target = elLastChild;\n }\n if (target) {\n targetRect = getRect(target);\n }\n if (_onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, !!target) !== false) {\n capture();\n if (elLastChild && elLastChild.nextSibling) {\n // the last draggable element is not the last node\n el.insertBefore(dragEl, elLastChild.nextSibling);\n } else {\n el.appendChild(dragEl);\n }\n parentEl = el; // actualization\n\n changed();\n return completed(true);\n }\n } else if (elLastChild && _ghostIsFirst(evt, vertical, this)) {\n // Insert to start of list\n var firstChild = getChild(el, 0, options, true);\n if (firstChild === dragEl) {\n return completed(false);\n }\n target = firstChild;\n targetRect = getRect(target);\n if (_onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, false) !== false) {\n capture();\n el.insertBefore(dragEl, firstChild);\n parentEl = el; // actualization\n\n changed();\n return completed(true);\n }\n } else if (target.parentNode === el) {\n targetRect = getRect(target);\n var direction = 0,\n targetBeforeFirstSwap,\n differentLevel = dragEl.parentNode !== el,\n differentRowCol = !_dragElInRowColumn(dragEl.animated && dragEl.toRect || dragRect, target.animated && target.toRect || targetRect, vertical),\n side1 = vertical ? 'top' : 'left',\n scrolledPastTop = isScrolledPast(target, 'top', 'top') || isScrolledPast(dragEl, 'top', 'top'),\n scrollBefore = scrolledPastTop ? scrolledPastTop.scrollTop : void 0;\n if (lastTarget !== target) {\n targetBeforeFirstSwap = targetRect[side1];\n pastFirstInvertThresh = false;\n isCircumstantialInvert = !differentRowCol && options.invertSwap || differentLevel;\n }\n direction = _getSwapDirection(evt, target, targetRect, vertical, differentRowCol ? 1 : options.swapThreshold, options.invertedSwapThreshold == null ? options.swapThreshold : options.invertedSwapThreshold, isCircumstantialInvert, lastTarget === target);\n var sibling;\n if (direction !== 0) {\n // Check if target is beside dragEl in respective direction (ignoring hidden elements)\n var dragIndex = index(dragEl);\n do {\n dragIndex -= direction;\n sibling = parentEl.children[dragIndex];\n } while (sibling && (css(sibling, 'display') === 'none' || sibling === ghostEl));\n }\n // If dragEl is already beside target: Do not insert\n if (direction === 0 || sibling === target) {\n return completed(false);\n }\n lastTarget = target;\n lastDirection = direction;\n var nextSibling = target.nextElementSibling,\n after = false;\n after = direction === 1;\n var moveVector = _onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, after);\n if (moveVector !== false) {\n if (moveVector === 1 || moveVector === -1) {\n after = moveVector === 1;\n }\n _silent = true;\n setTimeout(_unsilent, 30);\n capture();\n if (after && !nextSibling) {\n el.appendChild(dragEl);\n } else {\n target.parentNode.insertBefore(dragEl, after ? nextSibling : target);\n }\n\n // Undo chrome's scroll adjustment (has no effect on other browsers)\n if (scrolledPastTop) {\n scrollBy(scrolledPastTop, 0, scrollBefore - scrolledPastTop.scrollTop);\n }\n parentEl = dragEl.parentNode; // actualization\n\n // must be done before animation\n if (targetBeforeFirstSwap !== undefined && !isCircumstantialInvert) {\n targetMoveDistance = Math.abs(targetBeforeFirstSwap - getRect(target)[side1]);\n }\n changed();\n return completed(true);\n }\n }\n if (el.contains(dragEl)) {\n return completed(false);\n }\n }\n return false;\n },\n _ignoreWhileAnimating: null,\n _offMoveEvents: function _offMoveEvents() {\n off(document, 'mousemove', this._onTouchMove);\n off(document, 'touchmove', this._onTouchMove);\n off(document, 'pointermove', this._onTouchMove);\n off(document, 'dragover', nearestEmptyInsertDetectEvent);\n off(document, 'mousemove', nearestEmptyInsertDetectEvent);\n off(document, 'touchmove', nearestEmptyInsertDetectEvent);\n },\n _offUpEvents: function _offUpEvents() {\n var ownerDocument = this.el.ownerDocument;\n off(ownerDocument, 'mouseup', this._onDrop);\n off(ownerDocument, 'touchend', this._onDrop);\n off(ownerDocument, 'pointerup', this._onDrop);\n off(ownerDocument, 'pointercancel', this._onDrop);\n off(ownerDocument, 'touchcancel', this._onDrop);\n off(document, 'selectstart', this);\n },\n _onDrop: function _onDrop( /**Event*/evt) {\n var el = this.el,\n options = this.options;\n\n // Get the index of the dragged element within its parent\n newIndex = index(dragEl);\n newDraggableIndex = index(dragEl, options.draggable);\n pluginEvent('drop', this, {\n evt: evt\n });\n parentEl = dragEl && dragEl.parentNode;\n\n // Get again after plugin event\n newIndex = index(dragEl);\n newDraggableIndex = index(dragEl, options.draggable);\n if (Sortable.eventCanceled) {\n this._nulling();\n return;\n }\n awaitingDragStarted = false;\n isCircumstantialInvert = false;\n pastFirstInvertThresh = false;\n clearInterval(this._loopId);\n clearTimeout(this._dragStartTimer);\n _cancelNextTick(this.cloneId);\n _cancelNextTick(this._dragStartId);\n\n // Unbind events\n if (this.nativeDraggable) {\n off(document, 'drop', this);\n off(el, 'dragstart', this._onDragStart);\n }\n this._offMoveEvents();\n this._offUpEvents();\n if (Safari) {\n css(document.body, 'user-select', '');\n }\n css(dragEl, 'transform', '');\n if (evt) {\n if (moved) {\n evt.cancelable && evt.preventDefault();\n !options.dropBubble && evt.stopPropagation();\n }\n ghostEl && ghostEl.parentNode && ghostEl.parentNode.removeChild(ghostEl);\n if (rootEl === parentEl || putSortable && putSortable.lastPutMode !== 'clone') {\n // Remove clone(s)\n cloneEl && cloneEl.parentNode && cloneEl.parentNode.removeChild(cloneEl);\n }\n if (dragEl) {\n if (this.nativeDraggable) {\n off(dragEl, 'dragend', this);\n }\n _disableDraggable(dragEl);\n dragEl.style['will-change'] = '';\n\n // Remove classes\n // ghostClass is added in dragStarted\n if (moved && !awaitingDragStarted) {\n toggleClass(dragEl, putSortable ? putSortable.options.ghostClass : this.options.ghostClass, false);\n }\n toggleClass(dragEl, this.options.chosenClass, false);\n\n // Drag stop event\n _dispatchEvent({\n sortable: this,\n name: 'unchoose',\n toEl: parentEl,\n newIndex: null,\n newDraggableIndex: null,\n originalEvent: evt\n });\n if (rootEl !== parentEl) {\n if (newIndex >= 0) {\n // Add event\n _dispatchEvent({\n rootEl: parentEl,\n name: 'add',\n toEl: parentEl,\n fromEl: rootEl,\n originalEvent: evt\n });\n\n // Remove event\n _dispatchEvent({\n sortable: this,\n name: 'remove',\n toEl: parentEl,\n originalEvent: evt\n });\n\n // drag from one list and drop into another\n _dispatchEvent({\n rootEl: parentEl,\n name: 'sort',\n toEl: parentEl,\n fromEl: rootEl,\n originalEvent: evt\n });\n _dispatchEvent({\n sortable: this,\n name: 'sort',\n toEl: parentEl,\n originalEvent: evt\n });\n }\n putSortable && putSortable.save();\n } else {\n if (newIndex !== oldIndex) {\n if (newIndex >= 0) {\n // drag & drop within the same list\n _dispatchEvent({\n sortable: this,\n name: 'update',\n toEl: parentEl,\n originalEvent: evt\n });\n _dispatchEvent({\n sortable: this,\n name: 'sort',\n toEl: parentEl,\n originalEvent: evt\n });\n }\n }\n }\n if (Sortable.active) {\n /* jshint eqnull:true */\n if (newIndex == null || newIndex === -1) {\n newIndex = oldIndex;\n newDraggableIndex = oldDraggableIndex;\n }\n _dispatchEvent({\n sortable: this,\n name: 'end',\n toEl: parentEl,\n originalEvent: evt\n });\n\n // Save sorting\n this.save();\n }\n }\n }\n this._nulling();\n },\n _nulling: function _nulling() {\n pluginEvent('nulling', this);\n 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;\n savedInputChecked.forEach(function (el) {\n el.checked = true;\n });\n savedInputChecked.length = lastDx = lastDy = 0;\n },\n handleEvent: function handleEvent( /**Event*/evt) {\n switch (evt.type) {\n case 'drop':\n case 'dragend':\n this._onDrop(evt);\n break;\n case 'dragenter':\n case 'dragover':\n if (dragEl) {\n this._onDragOver(evt);\n _globalDragOver(evt);\n }\n break;\n case 'selectstart':\n evt.preventDefault();\n break;\n }\n },\n /**\r\n * Serializes the item into an array of string.\r\n * @returns {String[]}\r\n */\n toArray: function toArray() {\n var order = [],\n el,\n children = this.el.children,\n i = 0,\n n = children.length,\n options = this.options;\n for (; i < n; i++) {\n el = children[i];\n if (closest(el, options.draggable, this.el, false)) {\n order.push(el.getAttribute(options.dataIdAttr) || _generateId(el));\n }\n }\n return order;\n },\n /**\r\n * Sorts the elements according to the array.\r\n * @param {String[]} order order of the items\r\n */\n sort: function sort(order, useAnimation) {\n var items = {},\n rootEl = this.el;\n this.toArray().forEach(function (id, i) {\n var el = rootEl.children[i];\n if (closest(el, this.options.draggable, rootEl, false)) {\n items[id] = el;\n }\n }, this);\n useAnimation && this.captureAnimationState();\n order.forEach(function (id) {\n if (items[id]) {\n rootEl.removeChild(items[id]);\n rootEl.appendChild(items[id]);\n }\n });\n useAnimation && this.animateAll();\n },\n /**\r\n * Save the current sorting\r\n */\n save: function save() {\n var store = this.options.store;\n store && store.set && store.set(this);\n },\n /**\r\n * 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.\r\n * @param {HTMLElement} el\r\n * @param {String} [selector] default: `options.draggable`\r\n * @returns {HTMLElement|null}\r\n */\n closest: function closest$1(el, selector) {\n return closest(el, selector || this.options.draggable, this.el, false);\n },\n /**\r\n * Set/get option\r\n * @param {string} name\r\n * @param {*} [value]\r\n * @returns {*}\r\n */\n option: function option(name, value) {\n var options = this.options;\n if (value === void 0) {\n return options[name];\n } else {\n var modifiedValue = PluginManager.modifyOption(this, name, value);\n if (typeof modifiedValue !== 'undefined') {\n options[name] = modifiedValue;\n } else {\n options[name] = value;\n }\n if (name === 'group') {\n _prepareGroup(options);\n }\n }\n },\n /**\r\n * Destroy\r\n */\n destroy: function destroy() {\n pluginEvent('destroy', this);\n var el = this.el;\n el[expando] = null;\n off(el, 'mousedown', this._onTapStart);\n off(el, 'touchstart', this._onTapStart);\n off(el, 'pointerdown', this._onTapStart);\n if (this.nativeDraggable) {\n off(el, 'dragover', this);\n off(el, 'dragenter', this);\n }\n // Remove draggable attributes\n Array.prototype.forEach.call(el.querySelectorAll('[draggable]'), function (el) {\n el.removeAttribute('draggable');\n });\n this._onDrop();\n this._disableDelayedDragEvents();\n sortables.splice(sortables.indexOf(this.el), 1);\n this.el = el = null;\n },\n _hideClone: function _hideClone() {\n if (!cloneHidden) {\n pluginEvent('hideClone', this);\n if (Sortable.eventCanceled) return;\n css(cloneEl, 'display', 'none');\n if (this.options.removeCloneOnHide && cloneEl.parentNode) {\n cloneEl.parentNode.removeChild(cloneEl);\n }\n cloneHidden = true;\n }\n },\n _showClone: function _showClone(putSortable) {\n if (putSortable.lastPutMode !== 'clone') {\n this._hideClone();\n return;\n }\n if (cloneHidden) {\n pluginEvent('showClone', this);\n if (Sortable.eventCanceled) return;\n\n // show clone at dragEl or original position\n if (dragEl.parentNode == rootEl && !this.options.group.revertClone) {\n rootEl.insertBefore(cloneEl, dragEl);\n } else if (nextEl) {\n rootEl.insertBefore(cloneEl, nextEl);\n } else {\n rootEl.appendChild(cloneEl);\n }\n if (this.options.group.revertClone) {\n this.animate(dragEl, cloneEl);\n }\n css(cloneEl, 'display', '');\n cloneHidden = false;\n }\n }\n};\nfunction _globalDragOver( /**Event*/evt) {\n if (evt.dataTransfer) {\n evt.dataTransfer.dropEffect = 'move';\n }\n evt.cancelable && evt.preventDefault();\n}\nfunction _onMove(fromEl, toEl, dragEl, dragRect, targetEl, targetRect, originalEvent, willInsertAfter) {\n var evt,\n sortable = fromEl[expando],\n onMoveFn = sortable.options.onMove,\n retVal;\n // Support for new CustomEvent feature\n if (window.CustomEvent && !IE11OrLess && !Edge) {\n evt = new CustomEvent('move', {\n bubbles: true,\n cancelable: true\n });\n } else {\n evt = document.createEvent('Event');\n evt.initEvent('move', true, true);\n }\n evt.to = toEl;\n evt.from = fromEl;\n evt.dragged = dragEl;\n evt.draggedRect = dragRect;\n evt.related = targetEl || toEl;\n evt.relatedRect = targetRect || getRect(toEl);\n evt.willInsertAfter = willInsertAfter;\n evt.originalEvent = originalEvent;\n fromEl.dispatchEvent(evt);\n if (onMoveFn) {\n retVal = onMoveFn.call(sortable, evt, originalEvent);\n }\n return retVal;\n}\nfunction _disableDraggable(el) {\n el.draggable = false;\n}\nfunction _unsilent() {\n _silent = false;\n}\nfunction _ghostIsFirst(evt, vertical, sortable) {\n var firstElRect = getRect(getChild(sortable.el, 0, sortable.options, true));\n var childContainingRect = getChildContainingRectFromElement(sortable.el, sortable.options, ghostEl);\n var spacer = 10;\n return vertical ? evt.clientX < childContainingRect.left - spacer || evt.clientY < firstElRect.top && evt.clientX < firstElRect.right : evt.clientY < childContainingRect.top - spacer || evt.clientY < firstElRect.bottom && evt.clientX < firstElRect.left;\n}\nfunction _ghostIsLast(evt, vertical, sortable) {\n var lastElRect = getRect(lastChild(sortable.el, sortable.options.draggable));\n var childContainingRect = getChildContainingRectFromElement(sortable.el, sortable.options, ghostEl);\n var spacer = 10;\n return vertical ? evt.clientX > childContainingRect.right + spacer || evt.clientY > lastElRect.bottom && evt.clientX > lastElRect.left : evt.clientY > childContainingRect.bottom + spacer || evt.clientX > lastElRect.right && evt.clientY > lastElRect.top;\n}\nfunction _getSwapDirection(evt, target, targetRect, vertical, swapThreshold, invertedSwapThreshold, invertSwap, isLastTarget) {\n var mouseOnAxis = vertical ? evt.clientY : evt.clientX,\n targetLength = vertical ? targetRect.height : targetRect.width,\n targetS1 = vertical ? targetRect.top : targetRect.left,\n targetS2 = vertical ? targetRect.bottom : targetRect.right,\n invert = false;\n if (!invertSwap) {\n // Never invert or create dragEl shadow when target movemenet causes mouse to move past the end of regular swapThreshold\n if (isLastTarget && targetMoveDistance < targetLength * swapThreshold) {\n // multiplied only by swapThreshold because mouse will already be inside target by (1 - threshold) * targetLength / 2\n // check if past first invert threshold on side opposite of lastDirection\n if (!pastFirstInvertThresh && (lastDirection === 1 ? mouseOnAxis > targetS1 + targetLength * invertedSwapThreshold / 2 : mouseOnAxis < targetS2 - targetLength * invertedSwapThreshold / 2)) {\n // past first invert threshold, do not restrict inverted threshold to dragEl shadow\n pastFirstInvertThresh = true;\n }\n if (!pastFirstInvertThresh) {\n // dragEl shadow (target move distance shadow)\n if (lastDirection === 1 ? mouseOnAxis < targetS1 + targetMoveDistance // over dragEl shadow\n : mouseOnAxis > targetS2 - targetMoveDistance) {\n return -lastDirection;\n }\n } else {\n invert = true;\n }\n } else {\n // Regular\n if (mouseOnAxis > targetS1 + targetLength * (1 - swapThreshold) / 2 && mouseOnAxis < targetS2 - targetLength * (1 - swapThreshold) / 2) {\n return _getInsertDirection(target);\n }\n }\n }\n invert = invert || invertSwap;\n if (invert) {\n // Invert of regular\n if (mouseOnAxis < targetS1 + targetLength * invertedSwapThreshold / 2 || mouseOnAxis > targetS2 - targetLength * invertedSwapThreshold / 2) {\n return mouseOnAxis > targetS1 + targetLength / 2 ? 1 : -1;\n }\n }\n return 0;\n}\n\n/**\r\n * Gets the direction dragEl must be swapped relative to target in order to make it\r\n * seem that dragEl has been \"inserted\" into that element's position\r\n * @param {HTMLElement} target The target whose position dragEl is being inserted at\r\n * @return {Number} Direction dragEl must be swapped\r\n */\nfunction _getInsertDirection(target) {\n if (index(dragEl) < index(target)) {\n return 1;\n } else {\n return -1;\n }\n}\n\n/**\r\n * Generate id\r\n * @param {HTMLElement} el\r\n * @returns {String}\r\n * @private\r\n */\nfunction _generateId(el) {\n var str = el.tagName + el.className + el.src + el.href + el.textContent,\n i = str.length,\n sum = 0;\n while (i--) {\n sum += str.charCodeAt(i);\n }\n return sum.toString(36);\n}\nfunction _saveInputCheckedState(root) {\n savedInputChecked.length = 0;\n var inputs = root.getElementsByTagName('input');\n var idx = inputs.length;\n while (idx--) {\n var el = inputs[idx];\n el.checked && savedInputChecked.push(el);\n }\n}\nfunction _nextTick(fn) {\n return setTimeout(fn, 0);\n}\nfunction _cancelNextTick(id) {\n return clearTimeout(id);\n}\n\n// Fixed #973:\nif (documentExists) {\n on(document, 'touchmove', function (evt) {\n if ((Sortable.active || awaitingDragStarted) && evt.cancelable) {\n evt.preventDefault();\n }\n });\n}\n\n// Export utils\nSortable.utils = {\n on: on,\n off: off,\n css: css,\n find: find,\n is: function is(el, selector) {\n return !!closest(el, selector, el, false);\n },\n extend: extend,\n throttle: throttle,\n closest: closest,\n toggleClass: toggleClass,\n clone: clone,\n index: index,\n nextTick: _nextTick,\n cancelNextTick: _cancelNextTick,\n detectDirection: _detectDirection,\n getChild: getChild,\n expando: expando\n};\n\n/**\r\n * Get the Sortable instance of an element\r\n * @param {HTMLElement} element The element\r\n * @return {Sortable|undefined} The instance of Sortable\r\n */\nSortable.get = function (element) {\n return element[expando];\n};\n\n/**\r\n * Mount a plugin to Sortable\r\n * @param {...SortablePlugin|SortablePlugin[]} plugins Plugins being mounted\r\n */\nSortable.mount = function () {\n for (var _len = arguments.length, plugins = new Array(_len), _key = 0; _key < _len; _key++) {\n plugins[_key] = arguments[_key];\n }\n if (plugins[0].constructor === Array) plugins = plugins[0];\n plugins.forEach(function (plugin) {\n if (!plugin.prototype || !plugin.prototype.constructor) {\n throw \"Sortable: Mounted plugin must be a constructor function, not \".concat({}.toString.call(plugin));\n }\n if (plugin.utils) Sortable.utils = _objectSpread2(_objectSpread2({}, Sortable.utils), plugin.utils);\n PluginManager.mount(plugin);\n });\n};\n\n/**\r\n * Create sortable instance\r\n * @param {HTMLElement} el\r\n * @param {Object} [options]\r\n */\nSortable.create = function (el, options) {\n return new Sortable(el, options);\n};\n\n// Export\nSortable.version = version;\n\nvar autoScrolls = [],\n scrollEl,\n scrollRootEl,\n scrolling = false,\n lastAutoScrollX,\n lastAutoScrollY,\n touchEvt$1,\n pointerElemChangedInterval;\nfunction AutoScrollPlugin() {\n function AutoScroll() {\n this.defaults = {\n scroll: true,\n forceAutoScrollFallback: false,\n scrollSensitivity: 30,\n scrollSpeed: 10,\n bubbleScroll: true\n };\n\n // Bind all private methods\n for (var fn in this) {\n if (fn.charAt(0) === '_' && typeof this[fn] === 'function') {\n this[fn] = this[fn].bind(this);\n }\n }\n }\n AutoScroll.prototype = {\n dragStarted: function dragStarted(_ref) {\n var originalEvent = _ref.originalEvent;\n if (this.sortable.nativeDraggable) {\n on(document, 'dragover', this._handleAutoScroll);\n } else {\n if (this.options.supportPointer) {\n on(document, 'pointermove', this._handleFallbackAutoScroll);\n } else if (originalEvent.touches) {\n on(document, 'touchmove', this._handleFallbackAutoScroll);\n } else {\n on(document, 'mousemove', this._handleFallbackAutoScroll);\n }\n }\n },\n dragOverCompleted: function dragOverCompleted(_ref2) {\n var originalEvent = _ref2.originalEvent;\n // For when bubbling is canceled and using fallback (fallback 'touchmove' always reached)\n if (!this.options.dragOverBubble && !originalEvent.rootEl) {\n this._handleAutoScroll(originalEvent);\n }\n },\n drop: function drop() {\n if (this.sortable.nativeDraggable) {\n off(document, 'dragover', this._handleAutoScroll);\n } else {\n off(document, 'pointermove', this._handleFallbackAutoScroll);\n off(document, 'touchmove', this._handleFallbackAutoScroll);\n off(document, 'mousemove', this._handleFallbackAutoScroll);\n }\n clearPointerElemChangedInterval();\n clearAutoScrolls();\n cancelThrottle();\n },\n nulling: function nulling() {\n touchEvt$1 = scrollRootEl = scrollEl = scrolling = pointerElemChangedInterval = lastAutoScrollX = lastAutoScrollY = null;\n autoScrolls.length = 0;\n },\n _handleFallbackAutoScroll: function _handleFallbackAutoScroll(evt) {\n this._handleAutoScroll(evt, true);\n },\n _handleAutoScroll: function _handleAutoScroll(evt, fallback) {\n var _this = this;\n var x = (evt.touches ? evt.touches[0] : evt).clientX,\n y = (evt.touches ? evt.touches[0] : evt).clientY,\n elem = document.elementFromPoint(x, y);\n touchEvt$1 = evt;\n\n // IE does not seem to have native autoscroll,\n // Edge's autoscroll seems too conditional,\n // MACOS Safari does not have autoscroll,\n // Firefox and Chrome are good\n if (fallback || this.options.forceAutoScrollFallback || Edge || IE11OrLess || Safari) {\n autoScroll(evt, this.options, elem, fallback);\n\n // Listener for pointer element change\n var ogElemScroller = getParentAutoScrollElement(elem, true);\n if (scrolling && (!pointerElemChangedInterval || x !== lastAutoScrollX || y !== lastAutoScrollY)) {\n pointerElemChangedInterval && clearPointerElemChangedInterval();\n // Detect for pointer elem change, emulating native DnD behaviour\n pointerElemChangedInterval = setInterval(function () {\n var newElem = getParentAutoScrollElement(document.elementFromPoint(x, y), true);\n if (newElem !== ogElemScroller) {\n ogElemScroller = newElem;\n clearAutoScrolls();\n }\n autoScroll(evt, _this.options, newElem, fallback);\n }, 10);\n lastAutoScrollX = x;\n lastAutoScrollY = y;\n }\n } else {\n // if DnD is enabled (and browser has good autoscrolling), first autoscroll will already scroll, so get parent autoscroll of first autoscroll\n if (!this.options.bubbleScroll || getParentAutoScrollElement(elem, true) === getWindowScrollingElement()) {\n clearAutoScrolls();\n return;\n }\n autoScroll(evt, this.options, getParentAutoScrollElement(elem, false), false);\n }\n }\n };\n return _extends(AutoScroll, {\n pluginName: 'scroll',\n initializeByDefault: true\n });\n}\nfunction clearAutoScrolls() {\n autoScrolls.forEach(function (autoScroll) {\n clearInterval(autoScroll.pid);\n });\n autoScrolls = [];\n}\nfunction clearPointerElemChangedInterval() {\n clearInterval(pointerElemChangedInterval);\n}\nvar autoScroll = throttle(function (evt, options, rootEl, isFallback) {\n // Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=505521\n if (!options.scroll) return;\n var x = (evt.touches ? evt.touches[0] : evt).clientX,\n y = (evt.touches ? evt.touches[0] : evt).clientY,\n sens = options.scrollSensitivity,\n speed = options.scrollSpeed,\n winScroller = getWindowScrollingElement();\n var scrollThisInstance = false,\n scrollCustomFn;\n\n // New scroll root, set scrollEl\n if (scrollRootEl !== rootEl) {\n scrollRootEl = rootEl;\n clearAutoScrolls();\n scrollEl = options.scroll;\n scrollCustomFn = options.scrollFn;\n if (scrollEl === true) {\n scrollEl = getParentAutoScrollElement(rootEl, true);\n }\n }\n var layersOut = 0;\n var currentParent = scrollEl;\n do {\n var el = currentParent,\n rect = getRect(el),\n top = rect.top,\n bottom = rect.bottom,\n left = rect.left,\n right = rect.right,\n width = rect.width,\n height = rect.height,\n canScrollX = void 0,\n canScrollY = void 0,\n scrollWidth = el.scrollWidth,\n scrollHeight = el.scrollHeight,\n elCSS = css(el),\n scrollPosX = el.scrollLeft,\n scrollPosY = el.scrollTop;\n if (el === winScroller) {\n canScrollX = width < scrollWidth && (elCSS.overflowX === 'auto' || elCSS.overflowX === 'scroll' || elCSS.overflowX === 'visible');\n canScrollY = height < scrollHeight && (elCSS.overflowY === 'auto' || elCSS.overflowY === 'scroll' || elCSS.overflowY === 'visible');\n } else {\n canScrollX = width < scrollWidth && (elCSS.overflowX === 'auto' || elCSS.overflowX === 'scroll');\n canScrollY = height < scrollHeight && (elCSS.overflowY === 'auto' || elCSS.overflowY === 'scroll');\n }\n var vx = canScrollX && (Math.abs(right - x) <= sens && scrollPosX + width < scrollWidth) - (Math.abs(left - x) <= sens && !!scrollPosX);\n var vy = canScrollY && (Math.abs(bottom - y) <= sens && scrollPosY + height < scrollHeight) - (Math.abs(top - y) <= sens && !!scrollPosY);\n if (!autoScrolls[layersOut]) {\n for (var i = 0; i <= layersOut; i++) {\n if (!autoScrolls[i]) {\n autoScrolls[i] = {};\n }\n }\n }\n if (autoScrolls[layersOut].vx != vx || autoScrolls[layersOut].vy != vy || autoScrolls[layersOut].el !== el) {\n autoScrolls[layersOut].el = el;\n autoScrolls[layersOut].vx = vx;\n autoScrolls[layersOut].vy = vy;\n clearInterval(autoScrolls[layersOut].pid);\n if (vx != 0 || vy != 0) {\n scrollThisInstance = true;\n /* jshint loopfunc:true */\n autoScrolls[layersOut].pid = setInterval(function () {\n // emulate drag over during autoscroll (fallback), emulating native DnD behaviour\n if (isFallback && this.layer === 0) {\n Sortable.active._onTouchMove(touchEvt$1); // To move ghost if it is positioned absolutely\n }\n var scrollOffsetY = autoScrolls[this.layer].vy ? autoScrolls[this.layer].vy * speed : 0;\n var scrollOffsetX = autoScrolls[this.layer].vx ? autoScrolls[this.layer].vx * speed : 0;\n if (typeof scrollCustomFn === 'function') {\n if (scrollCustomFn.call(Sortable.dragged.parentNode[expando], scrollOffsetX, scrollOffsetY, evt, touchEvt$1, autoScrolls[this.layer].el) !== 'continue') {\n return;\n }\n }\n scrollBy(autoScrolls[this.layer].el, scrollOffsetX, scrollOffsetY);\n }.bind({\n layer: layersOut\n }), 24);\n }\n }\n layersOut++;\n } while (options.bubbleScroll && currentParent !== winScroller && (currentParent = getParentAutoScrollElement(currentParent, false)));\n scrolling = scrollThisInstance; // in case another function catches scrolling as false in between when it is not\n}, 30);\n\nvar drop = function drop(_ref) {\n var originalEvent = _ref.originalEvent,\n putSortable = _ref.putSortable,\n dragEl = _ref.dragEl,\n activeSortable = _ref.activeSortable,\n dispatchSortableEvent = _ref.dispatchSortableEvent,\n hideGhostForTarget = _ref.hideGhostForTarget,\n unhideGhostForTarget = _ref.unhideGhostForTarget;\n if (!originalEvent) return;\n var toSortable = putSortable || activeSortable;\n hideGhostForTarget();\n var touch = originalEvent.changedTouches && originalEvent.changedTouches.length ? originalEvent.changedTouches[0] : originalEvent;\n var target = document.elementFromPoint(touch.clientX, touch.clientY);\n unhideGhostForTarget();\n if (toSortable && !toSortable.el.contains(target)) {\n dispatchSortableEvent('spill');\n this.onSpill({\n dragEl: dragEl,\n putSortable: putSortable\n });\n }\n};\nfunction Revert() {}\nRevert.prototype = {\n startIndex: null,\n dragStart: function dragStart(_ref2) {\n var oldDraggableIndex = _ref2.oldDraggableIndex;\n this.startIndex = oldDraggableIndex;\n },\n onSpill: function onSpill(_ref3) {\n var dragEl = _ref3.dragEl,\n putSortable = _ref3.putSortable;\n this.sortable.captureAnimationState();\n if (putSortable) {\n putSortable.captureAnimationState();\n }\n var nextSibling = getChild(this.sortable.el, this.startIndex, this.options);\n if (nextSibling) {\n this.sortable.el.insertBefore(dragEl, nextSibling);\n } else {\n this.sortable.el.appendChild(dragEl);\n }\n this.sortable.animateAll();\n if (putSortable) {\n putSortable.animateAll();\n }\n },\n drop: drop\n};\n_extends(Revert, {\n pluginName: 'revertOnSpill'\n});\nfunction Remove() {}\nRemove.prototype = {\n onSpill: function onSpill(_ref4) {\n var dragEl = _ref4.dragEl,\n putSortable = _ref4.putSortable;\n var parentSortable = putSortable || this.sortable;\n parentSortable.captureAnimationState();\n dragEl.parentNode && dragEl.parentNode.removeChild(dragEl);\n parentSortable.animateAll();\n },\n drop: drop\n};\n_extends(Remove, {\n pluginName: 'removeOnSpill'\n});\n\nvar lastSwapEl;\nfunction SwapPlugin() {\n function Swap() {\n this.defaults = {\n swapClass: 'sortable-swap-highlight'\n };\n }\n Swap.prototype = {\n dragStart: function dragStart(_ref) {\n var dragEl = _ref.dragEl;\n lastSwapEl = dragEl;\n },\n dragOverValid: function dragOverValid(_ref2) {\n var completed = _ref2.completed,\n target = _ref2.target,\n onMove = _ref2.onMove,\n activeSortable = _ref2.activeSortable,\n changed = _ref2.changed,\n cancel = _ref2.cancel;\n if (!activeSortable.options.swap) return;\n var el = this.sortable.el,\n options = this.options;\n if (target && target !== el) {\n var prevSwapEl = lastSwapEl;\n if (onMove(target) !== false) {\n toggleClass(target, options.swapClass, true);\n lastSwapEl = target;\n } else {\n lastSwapEl = null;\n }\n if (prevSwapEl && prevSwapEl !== lastSwapEl) {\n toggleClass(prevSwapEl, options.swapClass, false);\n }\n }\n changed();\n completed(true);\n cancel();\n },\n drop: function drop(_ref3) {\n var activeSortable = _ref3.activeSortable,\n putSortable = _ref3.putSortable,\n dragEl = _ref3.dragEl;\n var toSortable = putSortable || this.sortable;\n var options = this.options;\n lastSwapEl && toggleClass(lastSwapEl, options.swapClass, false);\n if (lastSwapEl && (options.swap || putSortable && putSortable.options.swap)) {\n if (dragEl !== lastSwapEl) {\n toSortable.captureAnimationState();\n if (toSortable !== activeSortable) activeSortable.captureAnimationState();\n swapNodes(dragEl, lastSwapEl);\n toSortable.animateAll();\n if (toSortable !== activeSortable) activeSortable.animateAll();\n }\n }\n },\n nulling: function nulling() {\n lastSwapEl = null;\n }\n };\n return _extends(Swap, {\n pluginName: 'swap',\n eventProperties: function eventProperties() {\n return {\n swapItem: lastSwapEl\n };\n }\n });\n}\nfunction swapNodes(n1, n2) {\n var p1 = n1.parentNode,\n p2 = n2.parentNode,\n i1,\n i2;\n if (!p1 || !p2 || p1.isEqualNode(n2) || p2.isEqualNode(n1)) return;\n i1 = index(n1);\n i2 = index(n2);\n if (p1.isEqualNode(p2) && i1 < i2) {\n i2++;\n }\n p1.insertBefore(n2, p1.children[i1]);\n p2.insertBefore(n1, p2.children[i2]);\n}\n\nvar multiDragElements = [],\n multiDragClones = [],\n lastMultiDragSelect,\n // for selection with modifier key down (SHIFT)\n multiDragSortable,\n initialFolding = false,\n // Initial multi-drag fold when drag started\n folding = false,\n // Folding any other time\n dragStarted = false,\n dragEl$1,\n clonesFromRect,\n clonesHidden;\nfunction MultiDragPlugin() {\n function MultiDrag(sortable) {\n // Bind all private methods\n for (var fn in this) {\n if (fn.charAt(0) === '_' && typeof this[fn] === 'function') {\n this[fn] = this[fn].bind(this);\n }\n }\n if (!sortable.options.avoidImplicitDeselect) {\n if (sortable.options.supportPointer) {\n on(document, 'pointerup', this._deselectMultiDrag);\n } else {\n on(document, 'mouseup', this._deselectMultiDrag);\n on(document, 'touchend', this._deselectMultiDrag);\n }\n }\n on(document, 'keydown', this._checkKeyDown);\n on(document, 'keyup', this._checkKeyUp);\n this.defaults = {\n selectedClass: 'sortable-selected',\n multiDragKey: null,\n avoidImplicitDeselect: false,\n setData: function setData(dataTransfer, dragEl) {\n var data = '';\n if (multiDragElements.length && multiDragSortable === sortable) {\n multiDragElements.forEach(function (multiDragElement, i) {\n data += (!i ? '' : ', ') + multiDragElement.textContent;\n });\n } else {\n data = dragEl.textContent;\n }\n dataTransfer.setData('Text', data);\n }\n };\n }\n MultiDrag.prototype = {\n multiDragKeyDown: false,\n isMultiDrag: false,\n delayStartGlobal: function delayStartGlobal(_ref) {\n var dragged = _ref.dragEl;\n dragEl$1 = dragged;\n },\n delayEnded: function delayEnded() {\n this.isMultiDrag = ~multiDragElements.indexOf(dragEl$1);\n },\n setupClone: function setupClone(_ref2) {\n var sortable = _ref2.sortable,\n cancel = _ref2.cancel;\n if (!this.isMultiDrag) return;\n for (var i = 0; i < multiDragElements.length; i++) {\n multiDragClones.push(clone(multiDragElements[i]));\n multiDragClones[i].sortableIndex = multiDragElements[i].sortableIndex;\n multiDragClones[i].draggable = false;\n multiDragClones[i].style['will-change'] = '';\n toggleClass(multiDragClones[i], this.options.selectedClass, false);\n multiDragElements[i] === dragEl$1 && toggleClass(multiDragClones[i], this.options.chosenClass, false);\n }\n sortable._hideClone();\n cancel();\n },\n clone: function clone(_ref3) {\n var sortable = _ref3.sortable,\n rootEl = _ref3.rootEl,\n dispatchSortableEvent = _ref3.dispatchSortableEvent,\n cancel = _ref3.cancel;\n if (!this.isMultiDrag) return;\n if (!this.options.removeCloneOnHide) {\n if (multiDragElements.length && multiDragSortable === sortable) {\n insertMultiDragClones(true, rootEl);\n dispatchSortableEvent('clone');\n cancel();\n }\n }\n },\n showClone: function showClone(_ref4) {\n var cloneNowShown = _ref4.cloneNowShown,\n rootEl = _ref4.rootEl,\n cancel = _ref4.cancel;\n if (!this.isMultiDrag) return;\n insertMultiDragClones(false, rootEl);\n multiDragClones.forEach(function (clone) {\n css(clone, 'display', '');\n });\n cloneNowShown();\n clonesHidden = false;\n cancel();\n },\n hideClone: function hideClone(_ref5) {\n var _this = this;\n var sortable = _ref5.sortable,\n cloneNowHidden = _ref5.cloneNowHidden,\n cancel = _ref5.cancel;\n if (!this.isMultiDrag) return;\n multiDragClones.forEach(function (clone) {\n css(clone, 'display', 'none');\n if (_this.options.removeCloneOnHide && clone.parentNode) {\n clone.parentNode.removeChild(clone);\n }\n });\n cloneNowHidden();\n clonesHidden = true;\n cancel();\n },\n dragStartGlobal: function dragStartGlobal(_ref6) {\n var sortable = _ref6.sortable;\n if (!this.isMultiDrag && multiDragSortable) {\n multiDragSortable.multiDrag._deselectMultiDrag();\n }\n multiDragElements.forEach(function (multiDragElement) {\n multiDragElement.sortableIndex = index(multiDragElement);\n });\n\n // Sort multi-drag elements\n multiDragElements = multiDragElements.sort(function (a, b) {\n return a.sortableIndex - b.sortableIndex;\n });\n dragStarted = true;\n },\n dragStarted: function dragStarted(_ref7) {\n var _this2 = this;\n var sortable = _ref7.sortable;\n if (!this.isMultiDrag) return;\n if (this.options.sort) {\n // Capture rects,\n // hide multi drag elements (by positioning them absolute),\n // set multi drag elements rects to dragRect,\n // show multi drag elements,\n // animate to rects,\n // unset rects & remove from DOM\n\n sortable.captureAnimationState();\n if (this.options.animation) {\n multiDragElements.forEach(function (multiDragElement) {\n if (multiDragElement === dragEl$1) return;\n css(multiDragElement, 'position', 'absolute');\n });\n var dragRect = getRect(dragEl$1, false, true, true);\n multiDragElements.forEach(function (multiDragElement) {\n if (multiDragElement === dragEl$1) return;\n setRect(multiDragElement, dragRect);\n });\n folding = true;\n initialFolding = true;\n }\n }\n sortable.animateAll(function () {\n folding = false;\n initialFolding = false;\n if (_this2.options.animation) {\n multiDragElements.forEach(function (multiDragElement) {\n unsetRect(multiDragElement);\n });\n }\n\n // Remove all auxiliary multidrag items from el, if sorting enabled\n if (_this2.options.sort) {\n removeMultiDragElements();\n }\n });\n },\n dragOver: function dragOver(_ref8) {\n var target = _ref8.target,\n completed = _ref8.completed,\n cancel = _ref8.cancel;\n if (folding && ~multiDragElements.indexOf(target)) {\n completed(false);\n cancel();\n }\n },\n revert: function revert(_ref9) {\n var fromSortable = _ref9.fromSortable,\n rootEl = _ref9.rootEl,\n sortable = _ref9.sortable,\n dragRect = _ref9.dragRect;\n if (multiDragElements.length > 1) {\n // Setup unfold animation\n multiDragElements.forEach(function (multiDragElement) {\n sortable.addAnimationState({\n target: multiDragElement,\n rect: folding ? getRect(multiDragElement) : dragRect\n });\n unsetRect(multiDragElement);\n multiDragElement.fromRect = dragRect;\n fromSortable.removeAnimationState(multiDragElement);\n });\n folding = false;\n insertMultiDragElements(!this.options.removeCloneOnHide, rootEl);\n }\n },\n dragOverCompleted: function dragOverCompleted(_ref10) {\n var sortable = _ref10.sortable,\n isOwner = _ref10.isOwner,\n insertion = _ref10.insertion,\n activeSortable = _ref10.activeSortable,\n parentEl = _ref10.parentEl,\n putSortable = _ref10.putSortable;\n var options = this.options;\n if (insertion) {\n // Clones must be hidden before folding animation to capture dragRectAbsolute properly\n if (isOwner) {\n activeSortable._hideClone();\n }\n initialFolding = false;\n // If leaving sort:false root, or already folding - Fold to new location\n if (options.animation && multiDragElements.length > 1 && (folding || !isOwner && !activeSortable.options.sort && !putSortable)) {\n // Fold: Set all multi drag elements's rects to dragEl's rect when multi-drag elements are invisible\n var dragRectAbsolute = getRect(dragEl$1, false, true, true);\n multiDragElements.forEach(function (multiDragElement) {\n if (multiDragElement === dragEl$1) return;\n setRect(multiDragElement, dragRectAbsolute);\n\n // Move element(s) to end of parentEl so that it does not interfere with multi-drag clones insertion if they are inserted\n // while folding, and so that we can capture them again because old sortable will no longer be fromSortable\n parentEl.appendChild(multiDragElement);\n });\n folding = true;\n }\n\n // Clones must be shown (and check to remove multi drags) after folding when interfering multiDragElements are moved out\n if (!isOwner) {\n // Only remove if not folding (folding will remove them anyways)\n if (!folding) {\n removeMultiDragElements();\n }\n if (multiDragElements.length > 1) {\n var clonesHiddenBefore = clonesHidden;\n activeSortable._showClone(sortable);\n\n // Unfold animation for clones if showing from hidden\n if (activeSortable.options.animation && !clonesHidden && clonesHiddenBefore) {\n multiDragClones.forEach(function (clone) {\n activeSortable.addAnimationState({\n target: clone,\n rect: clonesFromRect\n });\n clone.fromRect = clonesFromRect;\n clone.thisAnimationDuration = null;\n });\n }\n } else {\n activeSortable._showClone(sortable);\n }\n }\n }\n },\n dragOverAnimationCapture: function dragOverAnimationCapture(_ref11) {\n var dragRect = _ref11.dragRect,\n isOwner = _ref11.isOwner,\n activeSortable = _ref11.activeSortable;\n multiDragElements.forEach(function (multiDragElement) {\n multiDragElement.thisAnimationDuration = null;\n });\n if (activeSortable.options.animation && !isOwner && activeSortable.multiDrag.isMultiDrag) {\n clonesFromRect = _extends({}, dragRect);\n var dragMatrix = matrix(dragEl$1, true);\n clonesFromRect.top -= dragMatrix.f;\n clonesFromRect.left -= dragMatrix.e;\n }\n },\n dragOverAnimationComplete: function dragOverAnimationComplete() {\n if (folding) {\n folding = false;\n removeMultiDragElements();\n }\n },\n drop: function drop(_ref12) {\n var evt = _ref12.originalEvent,\n rootEl = _ref12.rootEl,\n parentEl = _ref12.parentEl,\n sortable = _ref12.sortable,\n dispatchSortableEvent = _ref12.dispatchSortableEvent,\n oldIndex = _ref12.oldIndex,\n putSortable = _ref12.putSortable;\n var toSortable = putSortable || this.sortable;\n if (!evt) return;\n var options = this.options,\n children = parentEl.children;\n\n // Multi-drag selection\n if (!dragStarted) {\n if (options.multiDragKey && !this.multiDragKeyDown) {\n this._deselectMultiDrag();\n }\n toggleClass(dragEl$1, options.selectedClass, !~multiDragElements.indexOf(dragEl$1));\n if (!~multiDragElements.indexOf(dragEl$1)) {\n multiDragElements.push(dragEl$1);\n dispatchEvent({\n sortable: sortable,\n rootEl: rootEl,\n name: 'select',\n targetEl: dragEl$1,\n originalEvent: evt\n });\n\n // Modifier activated, select from last to dragEl\n if (evt.shiftKey && lastMultiDragSelect && sortable.el.contains(lastMultiDragSelect)) {\n var lastIndex = index(lastMultiDragSelect),\n currentIndex = index(dragEl$1);\n if (~lastIndex && ~currentIndex && lastIndex !== currentIndex) {\n (function () {\n // Must include lastMultiDragSelect (select it), in case modified selection from no selection\n // (but previous selection existed)\n var n, i;\n if (currentIndex > lastIndex) {\n i = lastIndex;\n n = currentIndex;\n } else {\n i = currentIndex;\n n = lastIndex + 1;\n }\n var filter = options.filter;\n for (; i < n; i++) {\n if (~multiDragElements.indexOf(children[i])) continue;\n // Check if element is draggable\n if (!closest(children[i], options.draggable, parentEl, false)) continue;\n // Check if element is filtered\n var filtered = filter && (typeof filter === 'function' ? filter.call(sortable, evt, children[i], sortable) : filter.split(',').some(function (criteria) {\n return closest(children[i], criteria.trim(), parentEl, false);\n }));\n if (filtered) continue;\n toggleClass(children[i], options.selectedClass, true);\n multiDragElements.push(children[i]);\n dispatchEvent({\n sortable: sortable,\n rootEl: rootEl,\n name: 'select',\n targetEl: children[i],\n originalEvent: evt\n });\n }\n })();\n }\n } else {\n lastMultiDragSelect = dragEl$1;\n }\n multiDragSortable = toSortable;\n } else {\n multiDragElements.splice(multiDragElements.indexOf(dragEl$1), 1);\n lastMultiDragSelect = null;\n dispatchEvent({\n sortable: sortable,\n rootEl: rootEl,\n name: 'deselect',\n targetEl: dragEl$1,\n originalEvent: evt\n });\n }\n }\n\n // Multi-drag drop\n if (dragStarted && this.isMultiDrag) {\n folding = false;\n // Do not \"unfold\" after around dragEl if reverted\n if ((parentEl[expando].options.sort || parentEl !== rootEl) && multiDragElements.length > 1) {\n var dragRect = getRect(dragEl$1),\n multiDragIndex = index(dragEl$1, ':not(.' + this.options.selectedClass + ')');\n if (!initialFolding && options.animation) dragEl$1.thisAnimationDuration = null;\n toSortable.captureAnimationState();\n if (!initialFolding) {\n if (options.animation) {\n dragEl$1.fromRect = dragRect;\n multiDragElements.forEach(function (multiDragElement) {\n multiDragElement.thisAnimationDuration = null;\n if (multiDragElement !== dragEl$1) {\n var rect = folding ? getRect(multiDragElement) : dragRect;\n multiDragElement.fromRect = rect;\n\n // Prepare unfold animation\n toSortable.addAnimationState({\n target: multiDragElement,\n rect: rect\n });\n }\n });\n }\n\n // Multi drag elements are not necessarily removed from the DOM on drop, so to reinsert\n // properly they must all be removed\n removeMultiDragElements();\n multiDragElements.forEach(function (multiDragElement) {\n if (children[multiDragIndex]) {\n parentEl.insertBefore(multiDragElement, children[multiDragIndex]);\n } else {\n parentEl.appendChild(multiDragElement);\n }\n multiDragIndex++;\n });\n\n // If initial folding is done, the elements may have changed position because they are now\n // unfolding around dragEl, even though dragEl may not have his index changed, so update event\n // must be fired here as Sortable will not.\n if (oldIndex === index(dragEl$1)) {\n var update = false;\n multiDragElements.forEach(function (multiDragElement) {\n if (multiDragElement.sortableIndex !== index(multiDragElement)) {\n update = true;\n return;\n }\n });\n if (update) {\n dispatchSortableEvent('update');\n dispatchSortableEvent('sort');\n }\n }\n }\n\n // Must be done after capturing individual rects (scroll bar)\n multiDragElements.forEach(function (multiDragElement) {\n unsetRect(multiDragElement);\n });\n toSortable.animateAll();\n }\n multiDragSortable = toSortable;\n }\n\n // Remove clones if necessary\n if (rootEl === parentEl || putSortable && putSortable.lastPutMode !== 'clone') {\n multiDragClones.forEach(function (clone) {\n clone.parentNode && clone.parentNode.removeChild(clone);\n });\n }\n },\n nullingGlobal: function nullingGlobal() {\n this.isMultiDrag = dragStarted = false;\n multiDragClones.length = 0;\n },\n destroyGlobal: function destroyGlobal() {\n this._deselectMultiDrag();\n off(document, 'pointerup', this._deselectMultiDrag);\n off(document, 'mouseup', this._deselectMultiDrag);\n off(document, 'touchend', this._deselectMultiDrag);\n off(document, 'keydown', this._checkKeyDown);\n off(document, 'keyup', this._checkKeyUp);\n },\n _deselectMultiDrag: function _deselectMultiDrag(evt) {\n if (typeof dragStarted !== \"undefined\" && dragStarted) return;\n\n // Only deselect if selection is in this sortable\n if (multiDragSortable !== this.sortable) return;\n\n // Only deselect if target is not item in this sortable\n if (evt && closest(evt.target, this.options.draggable, this.sortable.el, false)) return;\n\n // Only deselect if left click\n if (evt && evt.button !== 0) return;\n while (multiDragElements.length) {\n var el = multiDragElements[0];\n toggleClass(el, this.options.selectedClass, false);\n multiDragElements.shift();\n dispatchEvent({\n sortable: this.sortable,\n rootEl: this.sortable.el,\n name: 'deselect',\n targetEl: el,\n originalEvent: evt\n });\n }\n },\n _checkKeyDown: function _checkKeyDown(evt) {\n if (evt.key === this.options.multiDragKey) {\n this.multiDragKeyDown = true;\n }\n },\n _checkKeyUp: function _checkKeyUp(evt) {\n if (evt.key === this.options.multiDragKey) {\n this.multiDragKeyDown = false;\n }\n }\n };\n return _extends(MultiDrag, {\n // Static methods & properties\n pluginName: 'multiDrag',\n utils: {\n /**\r\n * Selects the provided multi-drag item\r\n * @param {HTMLElement} el The element to be selected\r\n */\n select: function select(el) {\n var sortable = el.parentNode[expando];\n if (!sortable || !sortable.options.multiDrag || ~multiDragElements.indexOf(el)) return;\n if (multiDragSortable && multiDragSortable !== sortable) {\n multiDragSortable.multiDrag._deselectMultiDrag();\n multiDragSortable = sortable;\n }\n toggleClass(el, sortable.options.selectedClass, true);\n multiDragElements.push(el);\n },\n /**\r\n * Deselects the provided multi-drag item\r\n * @param {HTMLElement} el The element to be deselected\r\n */\n deselect: function deselect(el) {\n var sortable = el.parentNode[expando],\n index = multiDragElements.indexOf(el);\n if (!sortable || !sortable.options.multiDrag || !~index) return;\n toggleClass(el, sortable.options.selectedClass, false);\n multiDragElements.splice(index, 1);\n }\n },\n eventProperties: function eventProperties() {\n var _this3 = this;\n var oldIndicies = [],\n newIndicies = [];\n multiDragElements.forEach(function (multiDragElement) {\n oldIndicies.push({\n multiDragElement: multiDragElement,\n index: multiDragElement.sortableIndex\n });\n\n // multiDragElements will already be sorted if folding\n var newIndex;\n if (folding && multiDragElement !== dragEl$1) {\n newIndex = -1;\n } else if (folding) {\n newIndex = index(multiDragElement, ':not(.' + _this3.options.selectedClass + ')');\n } else {\n newIndex = index(multiDragElement);\n }\n newIndicies.push({\n multiDragElement: multiDragElement,\n index: newIndex\n });\n });\n return {\n items: _toConsumableArray(multiDragElements),\n clones: [].concat(multiDragClones),\n oldIndicies: oldIndicies,\n newIndicies: newIndicies\n };\n },\n optionListeners: {\n multiDragKey: function multiDragKey(key) {\n key = key.toLowerCase();\n if (key === 'ctrl') {\n key = 'Control';\n } else if (key.length > 1) {\n key = key.charAt(0).toUpperCase() + key.substr(1);\n }\n return key;\n }\n }\n });\n}\nfunction insertMultiDragElements(clonesInserted, rootEl) {\n multiDragElements.forEach(function (multiDragElement, i) {\n var target = rootEl.children[multiDragElement.sortableIndex + (clonesInserted ? Number(i) : 0)];\n if (target) {\n rootEl.insertBefore(multiDragElement, target);\n } else {\n rootEl.appendChild(multiDragElement);\n }\n });\n}\n\n/**\r\n * Insert multi-drag clones\r\n * @param {[Boolean]} elementsInserted Whether the multi-drag elements are inserted\r\n * @param {HTMLElement} rootEl\r\n */\nfunction insertMultiDragClones(elementsInserted, rootEl) {\n multiDragClones.forEach(function (clone, i) {\n var target = rootEl.children[clone.sortableIndex + (elementsInserted ? Number(i) : 0)];\n if (target) {\n rootEl.insertBefore(clone, target);\n } else {\n rootEl.appendChild(clone);\n }\n });\n}\nfunction removeMultiDragElements() {\n multiDragElements.forEach(function (multiDragElement) {\n if (multiDragElement === dragEl$1) return;\n multiDragElement.parentNode && multiDragElement.parentNode.removeChild(multiDragElement);\n });\n}\n\nSortable.mount(new AutoScrollPlugin());\nSortable.mount(Remove, Revert);\n\nexport default Sortable;\nexport { MultiDragPlugin as MultiDrag, Sortable, SwapPlugin as Swap };\n", "import Sortable from \"sortablejs\";\n\n(() => {\n const Rails = window.Rails;\n const DATA_ID_ATTRIBUTE = \"data-id\";\n\n const sortableStore = {\n get(sortable) {\n return Array.from(sortable.el.children, (el) =>\n el.getAttribute(DATA_ID_ATTRIBUTE)\n );\n },\n set(sortable) {\n fetch(`${CMS.current_path}/reorder`, {\n body: JSON.stringify({ order: sortable.toArray() }),\n headers: {\n \"Content-Type\": \"application/json\",\n \"X-CSRF-Token\": Rails.csrfToken(),\n },\n credentials: \"same-origin\",\n method: \"PUT\",\n });\n },\n };\n\n const sortableInstances = [];\n window.CMS.sortableList = {\n init(root = document) {\n for (const sortableRoot of root.querySelectorAll(\".sortable\")) {\n sortableInstances.push(\n Sortable.create(sortableRoot, {\n handle: \".dragger\",\n draggable: \"li\",\n dataIdAttr: DATA_ID_ATTRIBUTE,\n store: sortableStore,\n onStart: (evt) => evt.from.classList.add(\"sortable-active\"),\n onEnd: (evt) => evt.from.classList.remove(\"sortable-active\"),\n })\n );\n }\n },\n dispose() {\n for (const sortable of sortableInstances) {\n sortable.destroy();\n }\n sortableInstances.length = 0;\n },\n };\n})();\n", "(() => {\n const SLUGIFY_REPLACEMENTS = [\n [/[\u00E0\u00E1\u00E2\u00E3]/g, 'a'],\n [/\u00E4/g, 'ae'],\n [/[\u00E8\u00E9\u00EB\u00EA]/g, 'e'],\n [/[\u00EC\u00ED\u00EF\u00EE]/g, 'i'],\n [/[\u00F2\u00F3\u00F4\u00F5]/g, 'o'],\n [/\u00F6/g, 'oe'],\n [/[\u00F9\u00FA\u00FB]/g, 'u'],\n [/\u00FC/g, 'ue'],\n [/\u00F1/g, 'n'],\n [/\u00E7/g, 'c'],\n [/\u00DF/g, 'ss'],\n [/[\u00B7\\/,:;_ ]/g, '-']\n ];\n\n const slugifyValue = (value) => {\n let slug = value.trim().toLowerCase();\n for (const [from, to] of SLUGIFY_REPLACEMENTS) {\n slug = slug.replace(from, to);\n }\n // Remove any other URL incompatible characters and replace multiple dashes with just a single one.\n return slug.replace(/[^a-z0-9-]/g, '').replace(/-+/g, '-');\n };\n\n window.CMS.slugify = () => {\n const input = document.querySelector('input[data-slugify=true]');\n const slugInput = document.querySelector('input[data-slug]');\n if (input === null || slugInput === null) return;\n input.addEventListener('input', () => {\n slugInput.value = slugifyValue(input.value);\n });\n };\n})();\n", "export var HOOKS = [\n \"onChange\",\n \"onClose\",\n \"onDayCreate\",\n \"onDestroy\",\n \"onKeyDown\",\n \"onMonthChange\",\n \"onOpen\",\n \"onParseConfig\",\n \"onReady\",\n \"onValueUpdate\",\n \"onYearChange\",\n \"onPreCalendarPosition\",\n];\nexport var defaults = {\n _disable: [],\n allowInput: false,\n allowInvalidPreload: false,\n altFormat: \"F j, Y\",\n altInput: false,\n altInputClass: \"form-control input\",\n animate: typeof window === \"object\" &&\n window.navigator.userAgent.indexOf(\"MSIE\") === -1,\n ariaDateFormat: \"F j, Y\",\n autoFillDefaultTime: true,\n clickOpens: true,\n closeOnSelect: true,\n conjunction: \", \",\n dateFormat: \"Y-m-d\",\n defaultHour: 12,\n defaultMinute: 0,\n defaultSeconds: 0,\n disable: [],\n disableMobile: false,\n enableSeconds: false,\n enableTime: false,\n errorHandler: function (err) {\n return typeof console !== \"undefined\" && console.warn(err);\n },\n getWeek: function (givenDate) {\n var date = new Date(givenDate.getTime());\n date.setHours(0, 0, 0, 0);\n date.setDate(date.getDate() + 3 - ((date.getDay() + 6) % 7));\n var week1 = new Date(date.getFullYear(), 0, 4);\n return (1 +\n Math.round(((date.getTime() - week1.getTime()) / 86400000 -\n 3 +\n ((week1.getDay() + 6) % 7)) /\n 7));\n },\n hourIncrement: 1,\n ignoredFocusElements: [],\n inline: false,\n locale: \"default\",\n minuteIncrement: 5,\n mode: \"single\",\n monthSelectorType: \"dropdown\",\n nextArrow: \"\",\n noCalendar: false,\n now: new Date(),\n onChange: [],\n onClose: [],\n onDayCreate: [],\n onDestroy: [],\n onKeyDown: [],\n onMonthChange: [],\n onOpen: [],\n onParseConfig: [],\n onReady: [],\n onValueUpdate: [],\n onYearChange: [],\n onPreCalendarPosition: [],\n plugins: [],\n position: \"auto\",\n positionElement: undefined,\n prevArrow: \"\",\n shorthandCurrentMonth: false,\n showMonths: 1,\n static: false,\n time_24hr: false,\n weekNumbers: false,\n wrap: false,\n};\n", "export var english = {\n weekdays: {\n shorthand: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"],\n longhand: [\n \"Sunday\",\n \"Monday\",\n \"Tuesday\",\n \"Wednesday\",\n \"Thursday\",\n \"Friday\",\n \"Saturday\",\n ],\n },\n months: {\n shorthand: [\n \"Jan\",\n \"Feb\",\n \"Mar\",\n \"Apr\",\n \"May\",\n \"Jun\",\n \"Jul\",\n \"Aug\",\n \"Sep\",\n \"Oct\",\n \"Nov\",\n \"Dec\",\n ],\n longhand: [\n \"January\",\n \"February\",\n \"March\",\n \"April\",\n \"May\",\n \"June\",\n \"July\",\n \"August\",\n \"September\",\n \"October\",\n \"November\",\n \"December\",\n ],\n },\n daysInMonth: [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31],\n firstDayOfWeek: 0,\n ordinal: function (nth) {\n var s = nth % 100;\n if (s > 3 && s < 21)\n return \"th\";\n switch (s % 10) {\n case 1:\n return \"st\";\n case 2:\n return \"nd\";\n case 3:\n return \"rd\";\n default:\n return \"th\";\n }\n },\n rangeSeparator: \" to \",\n weekAbbreviation: \"Wk\",\n scrollTitle: \"Scroll to increment\",\n toggleTitle: \"Click to toggle\",\n amPM: [\"AM\", \"PM\"],\n yearAriaLabel: \"Year\",\n monthAriaLabel: \"Month\",\n hourAriaLabel: \"Hour\",\n minuteAriaLabel: \"Minute\",\n time_24hr: false,\n};\nexport default english;\n", "export var pad = function (number, length) {\n if (length === void 0) { length = 2; }\n return (\"000\" + number).slice(length * -1);\n};\nexport var int = function (bool) { return (bool === true ? 1 : 0); };\nexport function debounce(fn, wait) {\n var t;\n return function () {\n var _this = this;\n var args = arguments;\n clearTimeout(t);\n t = setTimeout(function () { return fn.apply(_this, args); }, wait);\n };\n}\nexport var arrayify = function (obj) {\n return obj instanceof Array ? obj : [obj];\n};\n", "export function toggleClass(elem, className, bool) {\n if (bool === true)\n return elem.classList.add(className);\n elem.classList.remove(className);\n}\nexport function createElement(tag, className, content) {\n var e = window.document.createElement(tag);\n className = className || \"\";\n content = content || \"\";\n e.className = className;\n if (content !== undefined)\n e.textContent = content;\n return e;\n}\nexport function clearNode(node) {\n while (node.firstChild)\n node.removeChild(node.firstChild);\n}\nexport function findParent(node, condition) {\n if (condition(node))\n return node;\n else if (node.parentNode)\n return findParent(node.parentNode, condition);\n return undefined;\n}\nexport function createNumberInput(inputClassName, opts) {\n var wrapper = createElement(\"div\", \"numInputWrapper\"), numInput = createElement(\"input\", \"numInput \" + inputClassName), arrowUp = createElement(\"span\", \"arrowUp\"), arrowDown = createElement(\"span\", \"arrowDown\");\n if (navigator.userAgent.indexOf(\"MSIE 9.0\") === -1) {\n numInput.type = \"number\";\n }\n else {\n numInput.type = \"text\";\n numInput.pattern = \"\\\\d*\";\n }\n if (opts !== undefined)\n for (var key in opts)\n numInput.setAttribute(key, opts[key]);\n wrapper.appendChild(numInput);\n wrapper.appendChild(arrowUp);\n wrapper.appendChild(arrowDown);\n return wrapper;\n}\nexport function getEventTarget(event) {\n try {\n if (typeof event.composedPath === \"function\") {\n var path = event.composedPath();\n return path[0];\n }\n return event.target;\n }\n catch (error) {\n return event.target;\n }\n}\n", "import { int, pad } from \"../utils\";\nvar doNothing = function () { return undefined; };\nexport var monthToStr = function (monthNumber, shorthand, locale) { return locale.months[shorthand ? \"shorthand\" : \"longhand\"][monthNumber]; };\nexport var revFormat = {\n D: doNothing,\n F: function (dateObj, monthName, locale) {\n dateObj.setMonth(locale.months.longhand.indexOf(monthName));\n },\n G: function (dateObj, hour) {\n dateObj.setHours((dateObj.getHours() >= 12 ? 12 : 0) + parseFloat(hour));\n },\n H: function (dateObj, hour) {\n dateObj.setHours(parseFloat(hour));\n },\n J: function (dateObj, day) {\n dateObj.setDate(parseFloat(day));\n },\n K: function (dateObj, amPM, locale) {\n dateObj.setHours((dateObj.getHours() % 12) +\n 12 * int(new RegExp(locale.amPM[1], \"i\").test(amPM)));\n },\n M: function (dateObj, shortMonth, locale) {\n dateObj.setMonth(locale.months.shorthand.indexOf(shortMonth));\n },\n S: function (dateObj, seconds) {\n dateObj.setSeconds(parseFloat(seconds));\n },\n U: function (_, unixSeconds) { return new Date(parseFloat(unixSeconds) * 1000); },\n W: function (dateObj, weekNum, locale) {\n var weekNumber = parseInt(weekNum);\n var date = new Date(dateObj.getFullYear(), 0, 2 + (weekNumber - 1) * 7, 0, 0, 0, 0);\n date.setDate(date.getDate() - date.getDay() + locale.firstDayOfWeek);\n return date;\n },\n Y: function (dateObj, year) {\n dateObj.setFullYear(parseFloat(year));\n },\n Z: function (_, ISODate) { return new Date(ISODate); },\n d: function (dateObj, day) {\n dateObj.setDate(parseFloat(day));\n },\n h: function (dateObj, hour) {\n dateObj.setHours((dateObj.getHours() >= 12 ? 12 : 0) + parseFloat(hour));\n },\n i: function (dateObj, minutes) {\n dateObj.setMinutes(parseFloat(minutes));\n },\n j: function (dateObj, day) {\n dateObj.setDate(parseFloat(day));\n },\n l: doNothing,\n m: function (dateObj, month) {\n dateObj.setMonth(parseFloat(month) - 1);\n },\n n: function (dateObj, month) {\n dateObj.setMonth(parseFloat(month) - 1);\n },\n s: function (dateObj, seconds) {\n dateObj.setSeconds(parseFloat(seconds));\n },\n u: function (_, unixMillSeconds) {\n return new Date(parseFloat(unixMillSeconds));\n },\n w: doNothing,\n y: function (dateObj, year) {\n dateObj.setFullYear(2000 + parseFloat(year));\n },\n};\nexport var tokenRegex = {\n D: \"\",\n F: \"\",\n G: \"(\\\\d\\\\d|\\\\d)\",\n H: \"(\\\\d\\\\d|\\\\d)\",\n J: \"(\\\\d\\\\d|\\\\d)\\\\w+\",\n K: \"\",\n M: \"\",\n S: \"(\\\\d\\\\d|\\\\d)\",\n U: \"(.+)\",\n W: \"(\\\\d\\\\d|\\\\d)\",\n Y: \"(\\\\d{4})\",\n Z: \"(.+)\",\n d: \"(\\\\d\\\\d|\\\\d)\",\n h: \"(\\\\d\\\\d|\\\\d)\",\n i: \"(\\\\d\\\\d|\\\\d)\",\n j: \"(\\\\d\\\\d|\\\\d)\",\n l: \"\",\n m: \"(\\\\d\\\\d|\\\\d)\",\n n: \"(\\\\d\\\\d|\\\\d)\",\n s: \"(\\\\d\\\\d|\\\\d)\",\n u: \"(.+)\",\n w: \"(\\\\d\\\\d|\\\\d)\",\n y: \"(\\\\d{2})\",\n};\nexport var formats = {\n Z: function (date) { return date.toISOString(); },\n D: function (date, locale, options) {\n return locale.weekdays.shorthand[formats.w(date, locale, options)];\n },\n F: function (date, locale, options) {\n return monthToStr(formats.n(date, locale, options) - 1, false, locale);\n },\n G: function (date, locale, options) {\n return pad(formats.h(date, locale, options));\n },\n H: function (date) { return pad(date.getHours()); },\n J: function (date, locale) {\n return locale.ordinal !== undefined\n ? date.getDate() + locale.ordinal(date.getDate())\n : date.getDate();\n },\n K: function (date, locale) { return locale.amPM[int(date.getHours() > 11)]; },\n M: function (date, locale) {\n return monthToStr(date.getMonth(), true, locale);\n },\n S: function (date) { return pad(date.getSeconds()); },\n U: function (date) { return date.getTime() / 1000; },\n W: function (date, _, options) {\n return options.getWeek(date);\n },\n Y: function (date) { return pad(date.getFullYear(), 4); },\n d: function (date) { return pad(date.getDate()); },\n h: function (date) { return (date.getHours() % 12 ? date.getHours() % 12 : 12); },\n i: function (date) { return pad(date.getMinutes()); },\n j: function (date) { return date.getDate(); },\n l: function (date, locale) {\n return locale.weekdays.longhand[date.getDay()];\n },\n m: function (date) { return pad(date.getMonth() + 1); },\n n: function (date) { return date.getMonth() + 1; },\n s: function (date) { return date.getSeconds(); },\n u: function (date) { return date.getTime(); },\n w: function (date) { return date.getDay(); },\n y: function (date) { return String(date.getFullYear()).substring(2); },\n};\n", "import { tokenRegex, revFormat, formats, } from \"./formatting\";\nimport { defaults } from \"../types/options\";\nimport { english } from \"../l10n/default\";\nexport var createDateFormatter = function (_a) {\n var _b = _a.config, config = _b === void 0 ? defaults : _b, _c = _a.l10n, l10n = _c === void 0 ? english : _c, _d = _a.isMobile, isMobile = _d === void 0 ? false : _d;\n return function (dateObj, frmt, overrideLocale) {\n var locale = overrideLocale || l10n;\n if (config.formatDate !== undefined && !isMobile) {\n return config.formatDate(dateObj, frmt, locale);\n }\n return frmt\n .split(\"\")\n .map(function (c, i, arr) {\n return formats[c] && arr[i - 1] !== \"\\\\\"\n ? formats[c](dateObj, locale, config)\n : c !== \"\\\\\"\n ? c\n : \"\";\n })\n .join(\"\");\n };\n};\nexport var createDateParser = function (_a) {\n var _b = _a.config, config = _b === void 0 ? defaults : _b, _c = _a.l10n, l10n = _c === void 0 ? english : _c;\n return function (date, givenFormat, timeless, customLocale) {\n if (date !== 0 && !date)\n return undefined;\n var locale = customLocale || l10n;\n var parsedDate;\n var dateOrig = date;\n if (date instanceof Date)\n parsedDate = new Date(date.getTime());\n else if (typeof date !== \"string\" &&\n date.toFixed !== undefined)\n parsedDate = new Date(date);\n else if (typeof date === \"string\") {\n var format = givenFormat || (config || defaults).dateFormat;\n var datestr = String(date).trim();\n if (datestr === \"today\") {\n parsedDate = new Date();\n timeless = true;\n }\n else if (config && config.parseDate) {\n parsedDate = config.parseDate(date, format);\n }\n else if (/Z$/.test(datestr) ||\n /GMT$/.test(datestr)) {\n parsedDate = new Date(date);\n }\n else {\n var matched = void 0, ops = [];\n for (var i = 0, matchIndex = 0, regexStr = \"\"; i < format.length; i++) {\n var token = format[i];\n var isBackSlash = token === \"\\\\\";\n var escaped = format[i - 1] === \"\\\\\" || isBackSlash;\n if (tokenRegex[token] && !escaped) {\n regexStr += tokenRegex[token];\n var match = new RegExp(regexStr).exec(date);\n if (match && (matched = true)) {\n ops[token !== \"Y\" ? \"push\" : \"unshift\"]({\n fn: revFormat[token],\n val: match[++matchIndex],\n });\n }\n }\n else if (!isBackSlash)\n regexStr += \".\";\n }\n parsedDate =\n !config || !config.noCalendar\n ? new Date(new Date().getFullYear(), 0, 1, 0, 0, 0, 0)\n : new Date(new Date().setHours(0, 0, 0, 0));\n ops.forEach(function (_a) {\n var fn = _a.fn, val = _a.val;\n return (parsedDate = fn(parsedDate, val, locale) || parsedDate);\n });\n parsedDate = matched ? parsedDate : undefined;\n }\n }\n if (!(parsedDate instanceof Date && !isNaN(parsedDate.getTime()))) {\n config.errorHandler(new Error(\"Invalid date provided: \" + dateOrig));\n return undefined;\n }\n if (timeless === true)\n parsedDate.setHours(0, 0, 0, 0);\n return parsedDate;\n };\n};\nexport function compareDates(date1, date2, timeless) {\n if (timeless === void 0) { timeless = true; }\n if (timeless !== false) {\n return (new Date(date1.getTime()).setHours(0, 0, 0, 0) -\n new Date(date2.getTime()).setHours(0, 0, 0, 0));\n }\n return date1.getTime() - date2.getTime();\n}\nexport function compareTimes(date1, date2) {\n return (3600 * (date1.getHours() - date2.getHours()) +\n 60 * (date1.getMinutes() - date2.getMinutes()) +\n date1.getSeconds() -\n date2.getSeconds());\n}\nexport var isBetween = function (ts, ts1, ts2) {\n return ts > Math.min(ts1, ts2) && ts < Math.max(ts1, ts2);\n};\nexport var calculateSecondsSinceMidnight = function (hours, minutes, seconds) {\n return hours * 3600 + minutes * 60 + seconds;\n};\nexport var parseSeconds = function (secondsSinceMidnight) {\n var hours = Math.floor(secondsSinceMidnight / 3600), minutes = (secondsSinceMidnight - hours * 3600) / 60;\n return [hours, minutes, secondsSinceMidnight - hours * 3600 - minutes * 60];\n};\nexport var duration = {\n DAY: 86400000,\n};\nexport function getDefaultHours(config) {\n var hours = config.defaultHour;\n var minutes = config.defaultMinute;\n var seconds = config.defaultSeconds;\n if (config.minDate !== undefined) {\n var minHour = config.minDate.getHours();\n var minMinutes = config.minDate.getMinutes();\n var minSeconds = config.minDate.getSeconds();\n if (hours < minHour) {\n hours = minHour;\n }\n if (hours === minHour && minutes < minMinutes) {\n minutes = minMinutes;\n }\n if (hours === minHour && minutes === minMinutes && seconds < minSeconds)\n seconds = config.minDate.getSeconds();\n }\n if (config.maxDate !== undefined) {\n var maxHr = config.maxDate.getHours();\n var maxMinutes = config.maxDate.getMinutes();\n hours = Math.min(hours, maxHr);\n if (hours === maxHr)\n minutes = Math.min(maxMinutes, minutes);\n if (hours === maxHr && minutes === maxMinutes)\n seconds = config.maxDate.getSeconds();\n }\n return { hours: hours, minutes: minutes, seconds: seconds };\n}\n", "\"use strict\";\nif (typeof Object.assign !== \"function\") {\n Object.assign = function (target) {\n var args = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n args[_i - 1] = arguments[_i];\n }\n if (!target) {\n throw TypeError(\"Cannot convert undefined or null to object\");\n }\n var _loop_1 = function (source) {\n if (source) {\n Object.keys(source).forEach(function (key) { return (target[key] = source[key]); });\n }\n };\n for (var _a = 0, args_1 = args; _a < args_1.length; _a++) {\n var source = args_1[_a];\n _loop_1(source);\n }\n return target;\n };\n}\n", "var __assign = (this && this.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\nvar __spreadArrays = (this && this.__spreadArrays) || function () {\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\n r[k] = a[j];\n return r;\n};\nimport { defaults as defaultOptions, HOOKS, } from \"./types/options\";\nimport English from \"./l10n/default\";\nimport { arrayify, debounce, int, pad } from \"./utils\";\nimport { clearNode, createElement, createNumberInput, findParent, toggleClass, getEventTarget, } from \"./utils/dom\";\nimport { compareDates, createDateParser, createDateFormatter, duration, isBetween, getDefaultHours, calculateSecondsSinceMidnight, parseSeconds, } from \"./utils/dates\";\nimport { tokenRegex, monthToStr } from \"./utils/formatting\";\nimport \"./utils/polyfills\";\nvar DEBOUNCED_CHANGE_MS = 300;\nfunction FlatpickrInstance(element, instanceConfig) {\n var self = {\n config: __assign(__assign({}, defaultOptions), flatpickr.defaultConfig),\n l10n: English,\n };\n self.parseDate = createDateParser({ config: self.config, l10n: self.l10n });\n self._handlers = [];\n self.pluginElements = [];\n self.loadedPlugins = [];\n self._bind = bind;\n self._setHoursFromDate = setHoursFromDate;\n self._positionCalendar = positionCalendar;\n self.changeMonth = changeMonth;\n self.changeYear = changeYear;\n self.clear = clear;\n self.close = close;\n self.onMouseOver = onMouseOver;\n self._createElement = createElement;\n self.createDay = createDay;\n self.destroy = destroy;\n self.isEnabled = isEnabled;\n self.jumpToDate = jumpToDate;\n self.updateValue = updateValue;\n self.open = open;\n self.redraw = redraw;\n self.set = set;\n self.setDate = setDate;\n self.toggle = toggle;\n function setupHelperFunctions() {\n self.utils = {\n getDaysInMonth: function (month, yr) {\n if (month === void 0) { month = self.currentMonth; }\n if (yr === void 0) { yr = self.currentYear; }\n if (month === 1 && ((yr % 4 === 0 && yr % 100 !== 0) || yr % 400 === 0))\n return 29;\n return self.l10n.daysInMonth[month];\n },\n };\n }\n function init() {\n self.element = self.input = element;\n self.isOpen = false;\n parseConfig();\n setupLocale();\n setupInputs();\n setupDates();\n setupHelperFunctions();\n if (!self.isMobile)\n build();\n bindEvents();\n if (self.selectedDates.length || self.config.noCalendar) {\n if (self.config.enableTime) {\n setHoursFromDate(self.config.noCalendar ? self.latestSelectedDateObj : undefined);\n }\n updateValue(false);\n }\n setCalendarWidth();\n var isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);\n if (!self.isMobile && isSafari) {\n positionCalendar();\n }\n triggerEvent(\"onReady\");\n }\n function getClosestActiveElement() {\n var _a;\n return (((_a = self.calendarContainer) === null || _a === void 0 ? void 0 : _a.getRootNode())\n .activeElement || document.activeElement);\n }\n function bindToInstance(fn) {\n return fn.bind(self);\n }\n function setCalendarWidth() {\n var config = self.config;\n if (config.weekNumbers === false && config.showMonths === 1) {\n return;\n }\n else if (config.noCalendar !== true) {\n window.requestAnimationFrame(function () {\n if (self.calendarContainer !== undefined) {\n self.calendarContainer.style.visibility = \"hidden\";\n self.calendarContainer.style.display = \"block\";\n }\n if (self.daysContainer !== undefined) {\n var daysWidth = (self.days.offsetWidth + 1) * config.showMonths;\n self.daysContainer.style.width = daysWidth + \"px\";\n self.calendarContainer.style.width =\n daysWidth +\n (self.weekWrapper !== undefined\n ? self.weekWrapper.offsetWidth\n : 0) +\n \"px\";\n self.calendarContainer.style.removeProperty(\"visibility\");\n self.calendarContainer.style.removeProperty(\"display\");\n }\n });\n }\n }\n function updateTime(e) {\n if (self.selectedDates.length === 0) {\n var defaultDate = self.config.minDate === undefined ||\n compareDates(new Date(), self.config.minDate) >= 0\n ? new Date()\n : new Date(self.config.minDate.getTime());\n var defaults = getDefaultHours(self.config);\n defaultDate.setHours(defaults.hours, defaults.minutes, defaults.seconds, defaultDate.getMilliseconds());\n self.selectedDates = [defaultDate];\n self.latestSelectedDateObj = defaultDate;\n }\n if (e !== undefined && e.type !== \"blur\") {\n timeWrapper(e);\n }\n var prevValue = self._input.value;\n setHoursFromInputs();\n updateValue();\n if (self._input.value !== prevValue) {\n self._debouncedChange();\n }\n }\n function ampm2military(hour, amPM) {\n return (hour % 12) + 12 * int(amPM === self.l10n.amPM[1]);\n }\n function military2ampm(hour) {\n switch (hour % 24) {\n case 0:\n case 12:\n return 12;\n default:\n return hour % 12;\n }\n }\n function setHoursFromInputs() {\n if (self.hourElement === undefined || self.minuteElement === undefined)\n return;\n var hours = (parseInt(self.hourElement.value.slice(-2), 10) || 0) % 24, minutes = (parseInt(self.minuteElement.value, 10) || 0) % 60, seconds = self.secondElement !== undefined\n ? (parseInt(self.secondElement.value, 10) || 0) % 60\n : 0;\n if (self.amPM !== undefined) {\n hours = ampm2military(hours, self.amPM.textContent);\n }\n var limitMinHours = self.config.minTime !== undefined ||\n (self.config.minDate &&\n self.minDateHasTime &&\n self.latestSelectedDateObj &&\n compareDates(self.latestSelectedDateObj, self.config.minDate, true) ===\n 0);\n var limitMaxHours = self.config.maxTime !== undefined ||\n (self.config.maxDate &&\n self.maxDateHasTime &&\n self.latestSelectedDateObj &&\n compareDates(self.latestSelectedDateObj, self.config.maxDate, true) ===\n 0);\n if (self.config.maxTime !== undefined &&\n self.config.minTime !== undefined &&\n self.config.minTime > self.config.maxTime) {\n var minBound = calculateSecondsSinceMidnight(self.config.minTime.getHours(), self.config.minTime.getMinutes(), self.config.minTime.getSeconds());\n var maxBound = calculateSecondsSinceMidnight(self.config.maxTime.getHours(), self.config.maxTime.getMinutes(), self.config.maxTime.getSeconds());\n var currentTime = calculateSecondsSinceMidnight(hours, minutes, seconds);\n if (currentTime > maxBound && currentTime < minBound) {\n var result = parseSeconds(minBound);\n hours = result[0];\n minutes = result[1];\n seconds = result[2];\n }\n }\n else {\n if (limitMaxHours) {\n var maxTime = self.config.maxTime !== undefined\n ? self.config.maxTime\n : self.config.maxDate;\n hours = Math.min(hours, maxTime.getHours());\n if (hours === maxTime.getHours())\n minutes = Math.min(minutes, maxTime.getMinutes());\n if (minutes === maxTime.getMinutes())\n seconds = Math.min(seconds, maxTime.getSeconds());\n }\n if (limitMinHours) {\n var minTime = self.config.minTime !== undefined\n ? self.config.minTime\n : self.config.minDate;\n hours = Math.max(hours, minTime.getHours());\n if (hours === minTime.getHours() && minutes < minTime.getMinutes())\n minutes = minTime.getMinutes();\n if (minutes === minTime.getMinutes())\n seconds = Math.max(seconds, minTime.getSeconds());\n }\n }\n setHours(hours, minutes, seconds);\n }\n function setHoursFromDate(dateObj) {\n var date = dateObj || self.latestSelectedDateObj;\n if (date && date instanceof Date) {\n setHours(date.getHours(), date.getMinutes(), date.getSeconds());\n }\n }\n function setHours(hours, minutes, seconds) {\n if (self.latestSelectedDateObj !== undefined) {\n self.latestSelectedDateObj.setHours(hours % 24, minutes, seconds || 0, 0);\n }\n if (!self.hourElement || !self.minuteElement || self.isMobile)\n return;\n self.hourElement.value = pad(!self.config.time_24hr\n ? ((12 + hours) % 12) + 12 * int(hours % 12 === 0)\n : hours);\n self.minuteElement.value = pad(minutes);\n if (self.amPM !== undefined)\n self.amPM.textContent = self.l10n.amPM[int(hours >= 12)];\n if (self.secondElement !== undefined)\n self.secondElement.value = pad(seconds);\n }\n function onYearInput(event) {\n var eventTarget = getEventTarget(event);\n var year = parseInt(eventTarget.value) + (event.delta || 0);\n if (year / 1000 > 1 ||\n (event.key === \"Enter\" && !/[^\\d]/.test(year.toString()))) {\n changeYear(year);\n }\n }\n function bind(element, event, handler, options) {\n if (event instanceof Array)\n return event.forEach(function (ev) { return bind(element, ev, handler, options); });\n if (element instanceof Array)\n return element.forEach(function (el) { return bind(el, event, handler, options); });\n element.addEventListener(event, handler, options);\n self._handlers.push({\n remove: function () { return element.removeEventListener(event, handler, options); },\n });\n }\n function triggerChange() {\n triggerEvent(\"onChange\");\n }\n function bindEvents() {\n if (self.config.wrap) {\n [\"open\", \"close\", \"toggle\", \"clear\"].forEach(function (evt) {\n Array.prototype.forEach.call(self.element.querySelectorAll(\"[data-\" + evt + \"]\"), function (el) {\n return bind(el, \"click\", self[evt]);\n });\n });\n }\n if (self.isMobile) {\n setupMobile();\n return;\n }\n var debouncedResize = debounce(onResize, 50);\n self._debouncedChange = debounce(triggerChange, DEBOUNCED_CHANGE_MS);\n if (self.daysContainer && !/iPhone|iPad|iPod/i.test(navigator.userAgent))\n bind(self.daysContainer, \"mouseover\", function (e) {\n if (self.config.mode === \"range\")\n onMouseOver(getEventTarget(e));\n });\n bind(self._input, \"keydown\", onKeyDown);\n if (self.calendarContainer !== undefined) {\n bind(self.calendarContainer, \"keydown\", onKeyDown);\n }\n if (!self.config.inline && !self.config.static)\n bind(window, \"resize\", debouncedResize);\n if (window.ontouchstart !== undefined)\n bind(window.document, \"touchstart\", documentClick);\n else\n bind(window.document, \"mousedown\", documentClick);\n bind(window.document, \"focus\", documentClick, { capture: true });\n if (self.config.clickOpens === true) {\n bind(self._input, \"focus\", self.open);\n bind(self._input, \"click\", self.open);\n }\n if (self.daysContainer !== undefined) {\n bind(self.monthNav, \"click\", onMonthNavClick);\n bind(self.monthNav, [\"keyup\", \"increment\"], onYearInput);\n bind(self.daysContainer, \"click\", selectDate);\n }\n if (self.timeContainer !== undefined &&\n self.minuteElement !== undefined &&\n self.hourElement !== undefined) {\n var selText = function (e) {\n return getEventTarget(e).select();\n };\n bind(self.timeContainer, [\"increment\"], updateTime);\n bind(self.timeContainer, \"blur\", updateTime, { capture: true });\n bind(self.timeContainer, \"click\", timeIncrement);\n bind([self.hourElement, self.minuteElement], [\"focus\", \"click\"], selText);\n if (self.secondElement !== undefined)\n bind(self.secondElement, \"focus\", function () { return self.secondElement && self.secondElement.select(); });\n if (self.amPM !== undefined) {\n bind(self.amPM, \"click\", function (e) {\n updateTime(e);\n });\n }\n }\n if (self.config.allowInput) {\n bind(self._input, \"blur\", onBlur);\n }\n }\n function jumpToDate(jumpDate, triggerChange) {\n var jumpTo = jumpDate !== undefined\n ? self.parseDate(jumpDate)\n : self.latestSelectedDateObj ||\n (self.config.minDate && self.config.minDate > self.now\n ? self.config.minDate\n : self.config.maxDate && self.config.maxDate < self.now\n ? self.config.maxDate\n : self.now);\n var oldYear = self.currentYear;\n var oldMonth = self.currentMonth;\n try {\n if (jumpTo !== undefined) {\n self.currentYear = jumpTo.getFullYear();\n self.currentMonth = jumpTo.getMonth();\n }\n }\n catch (e) {\n e.message = \"Invalid date supplied: \" + jumpTo;\n self.config.errorHandler(e);\n }\n if (triggerChange && self.currentYear !== oldYear) {\n triggerEvent(\"onYearChange\");\n buildMonthSwitch();\n }\n if (triggerChange &&\n (self.currentYear !== oldYear || self.currentMonth !== oldMonth)) {\n triggerEvent(\"onMonthChange\");\n }\n self.redraw();\n }\n function timeIncrement(e) {\n var eventTarget = getEventTarget(e);\n if (~eventTarget.className.indexOf(\"arrow\"))\n incrementNumInput(e, eventTarget.classList.contains(\"arrowUp\") ? 1 : -1);\n }\n function incrementNumInput(e, delta, inputElem) {\n var target = e && getEventTarget(e);\n var input = inputElem ||\n (target && target.parentNode && target.parentNode.firstChild);\n var event = createEvent(\"increment\");\n event.delta = delta;\n input && input.dispatchEvent(event);\n }\n function build() {\n var fragment = window.document.createDocumentFragment();\n self.calendarContainer = createElement(\"div\", \"flatpickr-calendar\");\n self.calendarContainer.tabIndex = -1;\n if (!self.config.noCalendar) {\n fragment.appendChild(buildMonthNav());\n self.innerContainer = createElement(\"div\", \"flatpickr-innerContainer\");\n if (self.config.weekNumbers) {\n var _a = buildWeeks(), weekWrapper = _a.weekWrapper, weekNumbers = _a.weekNumbers;\n self.innerContainer.appendChild(weekWrapper);\n self.weekNumbers = weekNumbers;\n self.weekWrapper = weekWrapper;\n }\n self.rContainer = createElement(\"div\", \"flatpickr-rContainer\");\n self.rContainer.appendChild(buildWeekdays());\n if (!self.daysContainer) {\n self.daysContainer = createElement(\"div\", \"flatpickr-days\");\n self.daysContainer.tabIndex = -1;\n }\n buildDays();\n self.rContainer.appendChild(self.daysContainer);\n self.innerContainer.appendChild(self.rContainer);\n fragment.appendChild(self.innerContainer);\n }\n if (self.config.enableTime) {\n fragment.appendChild(buildTime());\n }\n toggleClass(self.calendarContainer, \"rangeMode\", self.config.mode === \"range\");\n toggleClass(self.calendarContainer, \"animate\", self.config.animate === true);\n toggleClass(self.calendarContainer, \"multiMonth\", self.config.showMonths > 1);\n self.calendarContainer.appendChild(fragment);\n var customAppend = self.config.appendTo !== undefined &&\n self.config.appendTo.nodeType !== undefined;\n if (self.config.inline || self.config.static) {\n self.calendarContainer.classList.add(self.config.inline ? \"inline\" : \"static\");\n if (self.config.inline) {\n if (!customAppend && self.element.parentNode)\n self.element.parentNode.insertBefore(self.calendarContainer, self._input.nextSibling);\n else if (self.config.appendTo !== undefined)\n self.config.appendTo.appendChild(self.calendarContainer);\n }\n if (self.config.static) {\n var wrapper = createElement(\"div\", \"flatpickr-wrapper\");\n if (self.element.parentNode)\n self.element.parentNode.insertBefore(wrapper, self.element);\n wrapper.appendChild(self.element);\n if (self.altInput)\n wrapper.appendChild(self.altInput);\n wrapper.appendChild(self.calendarContainer);\n }\n }\n if (!self.config.static && !self.config.inline)\n (self.config.appendTo !== undefined\n ? self.config.appendTo\n : window.document.body).appendChild(self.calendarContainer);\n }\n function createDay(className, date, _dayNumber, i) {\n var dateIsEnabled = isEnabled(date, true), dayElement = createElement(\"span\", className, date.getDate().toString());\n dayElement.dateObj = date;\n dayElement.$i = i;\n dayElement.setAttribute(\"aria-label\", self.formatDate(date, self.config.ariaDateFormat));\n if (className.indexOf(\"hidden\") === -1 &&\n compareDates(date, self.now) === 0) {\n self.todayDateElem = dayElement;\n dayElement.classList.add(\"today\");\n dayElement.setAttribute(\"aria-current\", \"date\");\n }\n if (dateIsEnabled) {\n dayElement.tabIndex = -1;\n if (isDateSelected(date)) {\n dayElement.classList.add(\"selected\");\n self.selectedDateElem = dayElement;\n if (self.config.mode === \"range\") {\n toggleClass(dayElement, \"startRange\", self.selectedDates[0] &&\n compareDates(date, self.selectedDates[0], true) === 0);\n toggleClass(dayElement, \"endRange\", self.selectedDates[1] &&\n compareDates(date, self.selectedDates[1], true) === 0);\n if (className === \"nextMonthDay\")\n dayElement.classList.add(\"inRange\");\n }\n }\n }\n else {\n dayElement.classList.add(\"flatpickr-disabled\");\n }\n if (self.config.mode === \"range\") {\n if (isDateInRange(date) && !isDateSelected(date))\n dayElement.classList.add(\"inRange\");\n }\n if (self.weekNumbers &&\n self.config.showMonths === 1 &&\n className !== \"prevMonthDay\" &&\n i % 7 === 6) {\n self.weekNumbers.insertAdjacentHTML(\"beforeend\", \"\" + self.config.getWeek(date) + \"\");\n }\n triggerEvent(\"onDayCreate\", dayElement);\n return dayElement;\n }\n function focusOnDayElem(targetNode) {\n targetNode.focus();\n if (self.config.mode === \"range\")\n onMouseOver(targetNode);\n }\n function getFirstAvailableDay(delta) {\n var startMonth = delta > 0 ? 0 : self.config.showMonths - 1;\n var endMonth = delta > 0 ? self.config.showMonths : -1;\n for (var m = startMonth; m != endMonth; m += delta) {\n var month = self.daysContainer.children[m];\n var startIndex = delta > 0 ? 0 : month.children.length - 1;\n var endIndex = delta > 0 ? month.children.length : -1;\n for (var i = startIndex; i != endIndex; i += delta) {\n var c = month.children[i];\n if (c.className.indexOf(\"hidden\") === -1 && isEnabled(c.dateObj))\n return c;\n }\n }\n return undefined;\n }\n function getNextAvailableDay(current, delta) {\n var givenMonth = current.className.indexOf(\"Month\") === -1\n ? current.dateObj.getMonth()\n : self.currentMonth;\n var endMonth = delta > 0 ? self.config.showMonths : -1;\n var loopDelta = delta > 0 ? 1 : -1;\n for (var m = givenMonth - self.currentMonth; m != endMonth; m += loopDelta) {\n var month = self.daysContainer.children[m];\n var startIndex = givenMonth - self.currentMonth === m\n ? current.$i + delta\n : delta < 0\n ? month.children.length - 1\n : 0;\n var numMonthDays = month.children.length;\n for (var i = startIndex; i >= 0 && i < numMonthDays && i != (delta > 0 ? numMonthDays : -1); i += loopDelta) {\n var c = month.children[i];\n if (c.className.indexOf(\"hidden\") === -1 &&\n isEnabled(c.dateObj) &&\n Math.abs(current.$i - i) >= Math.abs(delta))\n return focusOnDayElem(c);\n }\n }\n self.changeMonth(loopDelta);\n focusOnDay(getFirstAvailableDay(loopDelta), 0);\n return undefined;\n }\n function focusOnDay(current, offset) {\n var activeElement = getClosestActiveElement();\n var dayFocused = isInView(activeElement || document.body);\n var startElem = current !== undefined\n ? current\n : dayFocused\n ? activeElement\n : self.selectedDateElem !== undefined && isInView(self.selectedDateElem)\n ? self.selectedDateElem\n : self.todayDateElem !== undefined && isInView(self.todayDateElem)\n ? self.todayDateElem\n : getFirstAvailableDay(offset > 0 ? 1 : -1);\n if (startElem === undefined) {\n self._input.focus();\n }\n else if (!dayFocused) {\n focusOnDayElem(startElem);\n }\n else {\n getNextAvailableDay(startElem, offset);\n }\n }\n function buildMonthDays(year, month) {\n var firstOfMonth = (new Date(year, month, 1).getDay() - self.l10n.firstDayOfWeek + 7) % 7;\n var prevMonthDays = self.utils.getDaysInMonth((month - 1 + 12) % 12, year);\n var daysInMonth = self.utils.getDaysInMonth(month, year), days = window.document.createDocumentFragment(), isMultiMonth = self.config.showMonths > 1, prevMonthDayClass = isMultiMonth ? \"prevMonthDay hidden\" : \"prevMonthDay\", nextMonthDayClass = isMultiMonth ? \"nextMonthDay hidden\" : \"nextMonthDay\";\n var dayNumber = prevMonthDays + 1 - firstOfMonth, dayIndex = 0;\n for (; dayNumber <= prevMonthDays; dayNumber++, dayIndex++) {\n days.appendChild(createDay(\"flatpickr-day \" + prevMonthDayClass, new Date(year, month - 1, dayNumber), dayNumber, dayIndex));\n }\n for (dayNumber = 1; dayNumber <= daysInMonth; dayNumber++, dayIndex++) {\n days.appendChild(createDay(\"flatpickr-day\", new Date(year, month, dayNumber), dayNumber, dayIndex));\n }\n for (var dayNum = daysInMonth + 1; dayNum <= 42 - firstOfMonth &&\n (self.config.showMonths === 1 || dayIndex % 7 !== 0); dayNum++, dayIndex++) {\n days.appendChild(createDay(\"flatpickr-day \" + nextMonthDayClass, new Date(year, month + 1, dayNum % daysInMonth), dayNum, dayIndex));\n }\n var dayContainer = createElement(\"div\", \"dayContainer\");\n dayContainer.appendChild(days);\n return dayContainer;\n }\n function buildDays() {\n if (self.daysContainer === undefined) {\n return;\n }\n clearNode(self.daysContainer);\n if (self.weekNumbers)\n clearNode(self.weekNumbers);\n var frag = document.createDocumentFragment();\n for (var i = 0; i < self.config.showMonths; i++) {\n var d = new Date(self.currentYear, self.currentMonth, 1);\n d.setMonth(self.currentMonth + i);\n frag.appendChild(buildMonthDays(d.getFullYear(), d.getMonth()));\n }\n self.daysContainer.appendChild(frag);\n self.days = self.daysContainer.firstChild;\n if (self.config.mode === \"range\" && self.selectedDates.length === 1) {\n onMouseOver();\n }\n }\n function buildMonthSwitch() {\n if (self.config.showMonths > 1 ||\n self.config.monthSelectorType !== \"dropdown\")\n return;\n var shouldBuildMonth = function (month) {\n if (self.config.minDate !== undefined &&\n self.currentYear === self.config.minDate.getFullYear() &&\n month < self.config.minDate.getMonth()) {\n return false;\n }\n return !(self.config.maxDate !== undefined &&\n self.currentYear === self.config.maxDate.getFullYear() &&\n month > self.config.maxDate.getMonth());\n };\n self.monthsDropdownContainer.tabIndex = -1;\n self.monthsDropdownContainer.innerHTML = \"\";\n for (var i = 0; i < 12; i++) {\n if (!shouldBuildMonth(i))\n continue;\n var month = createElement(\"option\", \"flatpickr-monthDropdown-month\");\n month.value = new Date(self.currentYear, i).getMonth().toString();\n month.textContent = monthToStr(i, self.config.shorthandCurrentMonth, self.l10n);\n month.tabIndex = -1;\n if (self.currentMonth === i) {\n month.selected = true;\n }\n self.monthsDropdownContainer.appendChild(month);\n }\n }\n function buildMonth() {\n var container = createElement(\"div\", \"flatpickr-month\");\n var monthNavFragment = window.document.createDocumentFragment();\n var monthElement;\n if (self.config.showMonths > 1 ||\n self.config.monthSelectorType === \"static\") {\n monthElement = createElement(\"span\", \"cur-month\");\n }\n else {\n self.monthsDropdownContainer = createElement(\"select\", \"flatpickr-monthDropdown-months\");\n self.monthsDropdownContainer.setAttribute(\"aria-label\", self.l10n.monthAriaLabel);\n bind(self.monthsDropdownContainer, \"change\", function (e) {\n var target = getEventTarget(e);\n var selectedMonth = parseInt(target.value, 10);\n self.changeMonth(selectedMonth - self.currentMonth);\n triggerEvent(\"onMonthChange\");\n });\n buildMonthSwitch();\n monthElement = self.monthsDropdownContainer;\n }\n var yearInput = createNumberInput(\"cur-year\", { tabindex: \"-1\" });\n var yearElement = yearInput.getElementsByTagName(\"input\")[0];\n yearElement.setAttribute(\"aria-label\", self.l10n.yearAriaLabel);\n if (self.config.minDate) {\n yearElement.setAttribute(\"min\", self.config.minDate.getFullYear().toString());\n }\n if (self.config.maxDate) {\n yearElement.setAttribute(\"max\", self.config.maxDate.getFullYear().toString());\n yearElement.disabled =\n !!self.config.minDate &&\n self.config.minDate.getFullYear() === self.config.maxDate.getFullYear();\n }\n var currentMonth = createElement(\"div\", \"flatpickr-current-month\");\n currentMonth.appendChild(monthElement);\n currentMonth.appendChild(yearInput);\n monthNavFragment.appendChild(currentMonth);\n container.appendChild(monthNavFragment);\n return {\n container: container,\n yearElement: yearElement,\n monthElement: monthElement,\n };\n }\n function buildMonths() {\n clearNode(self.monthNav);\n self.monthNav.appendChild(self.prevMonthNav);\n if (self.config.showMonths) {\n self.yearElements = [];\n self.monthElements = [];\n }\n for (var m = self.config.showMonths; m--;) {\n var month = buildMonth();\n self.yearElements.push(month.yearElement);\n self.monthElements.push(month.monthElement);\n self.monthNav.appendChild(month.container);\n }\n self.monthNav.appendChild(self.nextMonthNav);\n }\n function buildMonthNav() {\n self.monthNav = createElement(\"div\", \"flatpickr-months\");\n self.yearElements = [];\n self.monthElements = [];\n self.prevMonthNav = createElement(\"span\", \"flatpickr-prev-month\");\n self.prevMonthNav.innerHTML = self.config.prevArrow;\n self.nextMonthNav = createElement(\"span\", \"flatpickr-next-month\");\n self.nextMonthNav.innerHTML = self.config.nextArrow;\n buildMonths();\n Object.defineProperty(self, \"_hidePrevMonthArrow\", {\n get: function () { return self.__hidePrevMonthArrow; },\n set: function (bool) {\n if (self.__hidePrevMonthArrow !== bool) {\n toggleClass(self.prevMonthNav, \"flatpickr-disabled\", bool);\n self.__hidePrevMonthArrow = bool;\n }\n },\n });\n Object.defineProperty(self, \"_hideNextMonthArrow\", {\n get: function () { return self.__hideNextMonthArrow; },\n set: function (bool) {\n if (self.__hideNextMonthArrow !== bool) {\n toggleClass(self.nextMonthNav, \"flatpickr-disabled\", bool);\n self.__hideNextMonthArrow = bool;\n }\n },\n });\n self.currentYearElement = self.yearElements[0];\n updateNavigationCurrentMonth();\n return self.monthNav;\n }\n function buildTime() {\n self.calendarContainer.classList.add(\"hasTime\");\n if (self.config.noCalendar)\n self.calendarContainer.classList.add(\"noCalendar\");\n var defaults = getDefaultHours(self.config);\n self.timeContainer = createElement(\"div\", \"flatpickr-time\");\n self.timeContainer.tabIndex = -1;\n var separator = createElement(\"span\", \"flatpickr-time-separator\", \":\");\n var hourInput = createNumberInput(\"flatpickr-hour\", {\n \"aria-label\": self.l10n.hourAriaLabel,\n });\n self.hourElement = hourInput.getElementsByTagName(\"input\")[0];\n var minuteInput = createNumberInput(\"flatpickr-minute\", {\n \"aria-label\": self.l10n.minuteAriaLabel,\n });\n self.minuteElement = minuteInput.getElementsByTagName(\"input\")[0];\n self.hourElement.tabIndex = self.minuteElement.tabIndex = -1;\n self.hourElement.value = pad(self.latestSelectedDateObj\n ? self.latestSelectedDateObj.getHours()\n : self.config.time_24hr\n ? defaults.hours\n : military2ampm(defaults.hours));\n self.minuteElement.value = pad(self.latestSelectedDateObj\n ? self.latestSelectedDateObj.getMinutes()\n : defaults.minutes);\n self.hourElement.setAttribute(\"step\", self.config.hourIncrement.toString());\n self.minuteElement.setAttribute(\"step\", self.config.minuteIncrement.toString());\n self.hourElement.setAttribute(\"min\", self.config.time_24hr ? \"0\" : \"1\");\n self.hourElement.setAttribute(\"max\", self.config.time_24hr ? \"23\" : \"12\");\n self.hourElement.setAttribute(\"maxlength\", \"2\");\n self.minuteElement.setAttribute(\"min\", \"0\");\n self.minuteElement.setAttribute(\"max\", \"59\");\n self.minuteElement.setAttribute(\"maxlength\", \"2\");\n self.timeContainer.appendChild(hourInput);\n self.timeContainer.appendChild(separator);\n self.timeContainer.appendChild(minuteInput);\n if (self.config.time_24hr)\n self.timeContainer.classList.add(\"time24hr\");\n if (self.config.enableSeconds) {\n self.timeContainer.classList.add(\"hasSeconds\");\n var secondInput = createNumberInput(\"flatpickr-second\");\n self.secondElement = secondInput.getElementsByTagName(\"input\")[0];\n self.secondElement.value = pad(self.latestSelectedDateObj\n ? self.latestSelectedDateObj.getSeconds()\n : defaults.seconds);\n self.secondElement.setAttribute(\"step\", self.minuteElement.getAttribute(\"step\"));\n self.secondElement.setAttribute(\"min\", \"0\");\n self.secondElement.setAttribute(\"max\", \"59\");\n self.secondElement.setAttribute(\"maxlength\", \"2\");\n self.timeContainer.appendChild(createElement(\"span\", \"flatpickr-time-separator\", \":\"));\n self.timeContainer.appendChild(secondInput);\n }\n if (!self.config.time_24hr) {\n self.amPM = createElement(\"span\", \"flatpickr-am-pm\", self.l10n.amPM[int((self.latestSelectedDateObj\n ? self.hourElement.value\n : self.config.defaultHour) > 11)]);\n self.amPM.title = self.l10n.toggleTitle;\n self.amPM.tabIndex = -1;\n self.timeContainer.appendChild(self.amPM);\n }\n return self.timeContainer;\n }\n function buildWeekdays() {\n if (!self.weekdayContainer)\n self.weekdayContainer = createElement(\"div\", \"flatpickr-weekdays\");\n else\n clearNode(self.weekdayContainer);\n for (var i = self.config.showMonths; i--;) {\n var container = createElement(\"div\", \"flatpickr-weekdaycontainer\");\n self.weekdayContainer.appendChild(container);\n }\n updateWeekdays();\n return self.weekdayContainer;\n }\n function updateWeekdays() {\n if (!self.weekdayContainer) {\n return;\n }\n var firstDayOfWeek = self.l10n.firstDayOfWeek;\n var weekdays = __spreadArrays(self.l10n.weekdays.shorthand);\n if (firstDayOfWeek > 0 && firstDayOfWeek < weekdays.length) {\n weekdays = __spreadArrays(weekdays.splice(firstDayOfWeek, weekdays.length), weekdays.splice(0, firstDayOfWeek));\n }\n for (var i = self.config.showMonths; i--;) {\n self.weekdayContainer.children[i].innerHTML = \"\\n \\n \" + weekdays.join(\"\") + \"\\n \\n \";\n }\n }\n function buildWeeks() {\n self.calendarContainer.classList.add(\"hasWeeks\");\n var weekWrapper = createElement(\"div\", \"flatpickr-weekwrapper\");\n weekWrapper.appendChild(createElement(\"span\", \"flatpickr-weekday\", self.l10n.weekAbbreviation));\n var weekNumbers = createElement(\"div\", \"flatpickr-weeks\");\n weekWrapper.appendChild(weekNumbers);\n return {\n weekWrapper: weekWrapper,\n weekNumbers: weekNumbers,\n };\n }\n function changeMonth(value, isOffset) {\n if (isOffset === void 0) { isOffset = true; }\n var delta = isOffset ? value : value - self.currentMonth;\n if ((delta < 0 && self._hidePrevMonthArrow === true) ||\n (delta > 0 && self._hideNextMonthArrow === true))\n return;\n self.currentMonth += delta;\n if (self.currentMonth < 0 || self.currentMonth > 11) {\n self.currentYear += self.currentMonth > 11 ? 1 : -1;\n self.currentMonth = (self.currentMonth + 12) % 12;\n triggerEvent(\"onYearChange\");\n buildMonthSwitch();\n }\n buildDays();\n triggerEvent(\"onMonthChange\");\n updateNavigationCurrentMonth();\n }\n function clear(triggerChangeEvent, toInitial) {\n if (triggerChangeEvent === void 0) { triggerChangeEvent = true; }\n if (toInitial === void 0) { toInitial = true; }\n self.input.value = \"\";\n if (self.altInput !== undefined)\n self.altInput.value = \"\";\n if (self.mobileInput !== undefined)\n self.mobileInput.value = \"\";\n self.selectedDates = [];\n self.latestSelectedDateObj = undefined;\n if (toInitial === true) {\n self.currentYear = self._initialDate.getFullYear();\n self.currentMonth = self._initialDate.getMonth();\n }\n if (self.config.enableTime === true) {\n var _a = getDefaultHours(self.config), hours = _a.hours, minutes = _a.minutes, seconds = _a.seconds;\n setHours(hours, minutes, seconds);\n }\n self.redraw();\n if (triggerChangeEvent)\n triggerEvent(\"onChange\");\n }\n function close() {\n self.isOpen = false;\n if (!self.isMobile) {\n if (self.calendarContainer !== undefined) {\n self.calendarContainer.classList.remove(\"open\");\n }\n if (self._input !== undefined) {\n self._input.classList.remove(\"active\");\n }\n }\n triggerEvent(\"onClose\");\n }\n function destroy() {\n if (self.config !== undefined)\n triggerEvent(\"onDestroy\");\n for (var i = self._handlers.length; i--;) {\n self._handlers[i].remove();\n }\n self._handlers = [];\n if (self.mobileInput) {\n if (self.mobileInput.parentNode)\n self.mobileInput.parentNode.removeChild(self.mobileInput);\n self.mobileInput = undefined;\n }\n else if (self.calendarContainer && self.calendarContainer.parentNode) {\n if (self.config.static && self.calendarContainer.parentNode) {\n var wrapper = self.calendarContainer.parentNode;\n wrapper.lastChild && wrapper.removeChild(wrapper.lastChild);\n if (wrapper.parentNode) {\n while (wrapper.firstChild)\n wrapper.parentNode.insertBefore(wrapper.firstChild, wrapper);\n wrapper.parentNode.removeChild(wrapper);\n }\n }\n else\n self.calendarContainer.parentNode.removeChild(self.calendarContainer);\n }\n if (self.altInput) {\n self.input.type = \"text\";\n if (self.altInput.parentNode)\n self.altInput.parentNode.removeChild(self.altInput);\n delete self.altInput;\n }\n if (self.input) {\n self.input.type = self.input._type;\n self.input.classList.remove(\"flatpickr-input\");\n self.input.removeAttribute(\"readonly\");\n }\n [\n \"_showTimeInput\",\n \"latestSelectedDateObj\",\n \"_hideNextMonthArrow\",\n \"_hidePrevMonthArrow\",\n \"__hideNextMonthArrow\",\n \"__hidePrevMonthArrow\",\n \"isMobile\",\n \"isOpen\",\n \"selectedDateElem\",\n \"minDateHasTime\",\n \"maxDateHasTime\",\n \"days\",\n \"daysContainer\",\n \"_input\",\n \"_positionElement\",\n \"innerContainer\",\n \"rContainer\",\n \"monthNav\",\n \"todayDateElem\",\n \"calendarContainer\",\n \"weekdayContainer\",\n \"prevMonthNav\",\n \"nextMonthNav\",\n \"monthsDropdownContainer\",\n \"currentMonthElement\",\n \"currentYearElement\",\n \"navigationCurrentMonth\",\n \"selectedDateElem\",\n \"config\",\n ].forEach(function (k) {\n try {\n delete self[k];\n }\n catch (_) { }\n });\n }\n function isCalendarElem(elem) {\n return self.calendarContainer.contains(elem);\n }\n function documentClick(e) {\n if (self.isOpen && !self.config.inline) {\n var eventTarget_1 = getEventTarget(e);\n var isCalendarElement = isCalendarElem(eventTarget_1);\n var isInput = eventTarget_1 === self.input ||\n eventTarget_1 === self.altInput ||\n self.element.contains(eventTarget_1) ||\n (e.path &&\n e.path.indexOf &&\n (~e.path.indexOf(self.input) ||\n ~e.path.indexOf(self.altInput)));\n var lostFocus = !isInput &&\n !isCalendarElement &&\n !isCalendarElem(e.relatedTarget);\n var isIgnored = !self.config.ignoredFocusElements.some(function (elem) {\n return elem.contains(eventTarget_1);\n });\n if (lostFocus && isIgnored) {\n if (self.config.allowInput) {\n self.setDate(self._input.value, false, self.config.altInput\n ? self.config.altFormat\n : self.config.dateFormat);\n }\n if (self.timeContainer !== undefined &&\n self.minuteElement !== undefined &&\n self.hourElement !== undefined &&\n self.input.value !== \"\" &&\n self.input.value !== undefined) {\n updateTime();\n }\n self.close();\n if (self.config &&\n self.config.mode === \"range\" &&\n self.selectedDates.length === 1)\n self.clear(false);\n }\n }\n }\n function changeYear(newYear) {\n if (!newYear ||\n (self.config.minDate && newYear < self.config.minDate.getFullYear()) ||\n (self.config.maxDate && newYear > self.config.maxDate.getFullYear()))\n return;\n var newYearNum = newYear, isNewYear = self.currentYear !== newYearNum;\n self.currentYear = newYearNum || self.currentYear;\n if (self.config.maxDate &&\n self.currentYear === self.config.maxDate.getFullYear()) {\n self.currentMonth = Math.min(self.config.maxDate.getMonth(), self.currentMonth);\n }\n else if (self.config.minDate &&\n self.currentYear === self.config.minDate.getFullYear()) {\n self.currentMonth = Math.max(self.config.minDate.getMonth(), self.currentMonth);\n }\n if (isNewYear) {\n self.redraw();\n triggerEvent(\"onYearChange\");\n buildMonthSwitch();\n }\n }\n function isEnabled(date, timeless) {\n var _a;\n if (timeless === void 0) { timeless = true; }\n var dateToCheck = self.parseDate(date, undefined, timeless);\n if ((self.config.minDate &&\n dateToCheck &&\n compareDates(dateToCheck, self.config.minDate, timeless !== undefined ? timeless : !self.minDateHasTime) < 0) ||\n (self.config.maxDate &&\n dateToCheck &&\n compareDates(dateToCheck, self.config.maxDate, timeless !== undefined ? timeless : !self.maxDateHasTime) > 0))\n return false;\n if (!self.config.enable && self.config.disable.length === 0)\n return true;\n if (dateToCheck === undefined)\n return false;\n var bool = !!self.config.enable, array = (_a = self.config.enable) !== null && _a !== void 0 ? _a : self.config.disable;\n for (var i = 0, d = void 0; i < array.length; i++) {\n d = array[i];\n if (typeof d === \"function\" &&\n d(dateToCheck))\n return bool;\n else if (d instanceof Date &&\n dateToCheck !== undefined &&\n d.getTime() === dateToCheck.getTime())\n return bool;\n else if (typeof d === \"string\") {\n var parsed = self.parseDate(d, undefined, true);\n return parsed && parsed.getTime() === dateToCheck.getTime()\n ? bool\n : !bool;\n }\n else if (typeof d === \"object\" &&\n dateToCheck !== undefined &&\n d.from &&\n d.to &&\n dateToCheck.getTime() >= d.from.getTime() &&\n dateToCheck.getTime() <= d.to.getTime())\n return bool;\n }\n return !bool;\n }\n function isInView(elem) {\n if (self.daysContainer !== undefined)\n return (elem.className.indexOf(\"hidden\") === -1 &&\n elem.className.indexOf(\"flatpickr-disabled\") === -1 &&\n self.daysContainer.contains(elem));\n return false;\n }\n function onBlur(e) {\n var isInput = e.target === self._input;\n var valueChanged = self._input.value.trimEnd() !== getDateStr();\n if (isInput &&\n valueChanged &&\n !(e.relatedTarget && isCalendarElem(e.relatedTarget))) {\n self.setDate(self._input.value, true, e.target === self.altInput\n ? self.config.altFormat\n : self.config.dateFormat);\n }\n }\n function onKeyDown(e) {\n var eventTarget = getEventTarget(e);\n var isInput = self.config.wrap\n ? element.contains(eventTarget)\n : eventTarget === self._input;\n var allowInput = self.config.allowInput;\n var allowKeydown = self.isOpen && (!allowInput || !isInput);\n var allowInlineKeydown = self.config.inline && isInput && !allowInput;\n if (e.keyCode === 13 && isInput) {\n if (allowInput) {\n self.setDate(self._input.value, true, eventTarget === self.altInput\n ? self.config.altFormat\n : self.config.dateFormat);\n self.close();\n return eventTarget.blur();\n }\n else {\n self.open();\n }\n }\n else if (isCalendarElem(eventTarget) ||\n allowKeydown ||\n allowInlineKeydown) {\n var isTimeObj = !!self.timeContainer &&\n self.timeContainer.contains(eventTarget);\n switch (e.keyCode) {\n case 13:\n if (isTimeObj) {\n e.preventDefault();\n updateTime();\n focusAndClose();\n }\n else\n selectDate(e);\n break;\n case 27:\n e.preventDefault();\n focusAndClose();\n break;\n case 8:\n case 46:\n if (isInput && !self.config.allowInput) {\n e.preventDefault();\n self.clear();\n }\n break;\n case 37:\n case 39:\n if (!isTimeObj && !isInput) {\n e.preventDefault();\n var activeElement = getClosestActiveElement();\n if (self.daysContainer !== undefined &&\n (allowInput === false ||\n (activeElement && isInView(activeElement)))) {\n var delta_1 = e.keyCode === 39 ? 1 : -1;\n if (!e.ctrlKey)\n focusOnDay(undefined, delta_1);\n else {\n e.stopPropagation();\n changeMonth(delta_1);\n focusOnDay(getFirstAvailableDay(1), 0);\n }\n }\n }\n else if (self.hourElement)\n self.hourElement.focus();\n break;\n case 38:\n case 40:\n e.preventDefault();\n var delta = e.keyCode === 40 ? 1 : -1;\n if ((self.daysContainer &&\n eventTarget.$i !== undefined) ||\n eventTarget === self.input ||\n eventTarget === self.altInput) {\n if (e.ctrlKey) {\n e.stopPropagation();\n changeYear(self.currentYear - delta);\n focusOnDay(getFirstAvailableDay(1), 0);\n }\n else if (!isTimeObj)\n focusOnDay(undefined, delta * 7);\n }\n else if (eventTarget === self.currentYearElement) {\n changeYear(self.currentYear - delta);\n }\n else if (self.config.enableTime) {\n if (!isTimeObj && self.hourElement)\n self.hourElement.focus();\n updateTime(e);\n self._debouncedChange();\n }\n break;\n case 9:\n if (isTimeObj) {\n var elems = [\n self.hourElement,\n self.minuteElement,\n self.secondElement,\n self.amPM,\n ]\n .concat(self.pluginElements)\n .filter(function (x) { return x; });\n var i = elems.indexOf(eventTarget);\n if (i !== -1) {\n var target = elems[i + (e.shiftKey ? -1 : 1)];\n e.preventDefault();\n (target || self._input).focus();\n }\n }\n else if (!self.config.noCalendar &&\n self.daysContainer &&\n self.daysContainer.contains(eventTarget) &&\n e.shiftKey) {\n e.preventDefault();\n self._input.focus();\n }\n break;\n default:\n break;\n }\n }\n if (self.amPM !== undefined && eventTarget === self.amPM) {\n switch (e.key) {\n case self.l10n.amPM[0].charAt(0):\n case self.l10n.amPM[0].charAt(0).toLowerCase():\n self.amPM.textContent = self.l10n.amPM[0];\n setHoursFromInputs();\n updateValue();\n break;\n case self.l10n.amPM[1].charAt(0):\n case self.l10n.amPM[1].charAt(0).toLowerCase():\n self.amPM.textContent = self.l10n.amPM[1];\n setHoursFromInputs();\n updateValue();\n break;\n }\n }\n if (isInput || isCalendarElem(eventTarget)) {\n triggerEvent(\"onKeyDown\", e);\n }\n }\n function onMouseOver(elem, cellClass) {\n if (cellClass === void 0) { cellClass = \"flatpickr-day\"; }\n if (self.selectedDates.length !== 1 ||\n (elem &&\n (!elem.classList.contains(cellClass) ||\n elem.classList.contains(\"flatpickr-disabled\"))))\n return;\n var hoverDate = elem\n ? elem.dateObj.getTime()\n : self.days.firstElementChild.dateObj.getTime(), initialDate = self.parseDate(self.selectedDates[0], undefined, true).getTime(), rangeStartDate = Math.min(hoverDate, self.selectedDates[0].getTime()), rangeEndDate = Math.max(hoverDate, self.selectedDates[0].getTime());\n var containsDisabled = false;\n var minRange = 0, maxRange = 0;\n for (var t = rangeStartDate; t < rangeEndDate; t += duration.DAY) {\n if (!isEnabled(new Date(t), true)) {\n containsDisabled =\n containsDisabled || (t > rangeStartDate && t < rangeEndDate);\n if (t < initialDate && (!minRange || t > minRange))\n minRange = t;\n else if (t > initialDate && (!maxRange || t < maxRange))\n maxRange = t;\n }\n }\n var hoverableCells = Array.from(self.rContainer.querySelectorAll(\"*:nth-child(-n+\" + self.config.showMonths + \") > .\" + cellClass));\n hoverableCells.forEach(function (dayElem) {\n var date = dayElem.dateObj;\n var timestamp = date.getTime();\n var outOfRange = (minRange > 0 && timestamp < minRange) ||\n (maxRange > 0 && timestamp > maxRange);\n if (outOfRange) {\n dayElem.classList.add(\"notAllowed\");\n [\"inRange\", \"startRange\", \"endRange\"].forEach(function (c) {\n dayElem.classList.remove(c);\n });\n return;\n }\n else if (containsDisabled && !outOfRange)\n return;\n [\"startRange\", \"inRange\", \"endRange\", \"notAllowed\"].forEach(function (c) {\n dayElem.classList.remove(c);\n });\n if (elem !== undefined) {\n elem.classList.add(hoverDate <= self.selectedDates[0].getTime()\n ? \"startRange\"\n : \"endRange\");\n if (initialDate < hoverDate && timestamp === initialDate)\n dayElem.classList.add(\"startRange\");\n else if (initialDate > hoverDate && timestamp === initialDate)\n dayElem.classList.add(\"endRange\");\n if (timestamp >= minRange &&\n (maxRange === 0 || timestamp <= maxRange) &&\n isBetween(timestamp, initialDate, hoverDate))\n dayElem.classList.add(\"inRange\");\n }\n });\n }\n function onResize() {\n if (self.isOpen && !self.config.static && !self.config.inline)\n positionCalendar();\n }\n function open(e, positionElement) {\n if (positionElement === void 0) { positionElement = self._positionElement; }\n if (self.isMobile === true) {\n if (e) {\n e.preventDefault();\n var eventTarget = getEventTarget(e);\n if (eventTarget) {\n eventTarget.blur();\n }\n }\n if (self.mobileInput !== undefined) {\n self.mobileInput.focus();\n self.mobileInput.click();\n }\n triggerEvent(\"onOpen\");\n return;\n }\n else if (self._input.disabled || self.config.inline) {\n return;\n }\n var wasOpen = self.isOpen;\n self.isOpen = true;\n if (!wasOpen) {\n self.calendarContainer.classList.add(\"open\");\n self._input.classList.add(\"active\");\n triggerEvent(\"onOpen\");\n positionCalendar(positionElement);\n }\n if (self.config.enableTime === true && self.config.noCalendar === true) {\n if (self.config.allowInput === false &&\n (e === undefined ||\n !self.timeContainer.contains(e.relatedTarget))) {\n setTimeout(function () { return self.hourElement.select(); }, 50);\n }\n }\n }\n function minMaxDateSetter(type) {\n return function (date) {\n var dateObj = (self.config[\"_\" + type + \"Date\"] = self.parseDate(date, self.config.dateFormat));\n var inverseDateObj = self.config[\"_\" + (type === \"min\" ? \"max\" : \"min\") + \"Date\"];\n if (dateObj !== undefined) {\n self[type === \"min\" ? \"minDateHasTime\" : \"maxDateHasTime\"] =\n dateObj.getHours() > 0 ||\n dateObj.getMinutes() > 0 ||\n dateObj.getSeconds() > 0;\n }\n if (self.selectedDates) {\n self.selectedDates = self.selectedDates.filter(function (d) { return isEnabled(d); });\n if (!self.selectedDates.length && type === \"min\")\n setHoursFromDate(dateObj);\n updateValue();\n }\n if (self.daysContainer) {\n redraw();\n if (dateObj !== undefined)\n self.currentYearElement[type] = dateObj.getFullYear().toString();\n else\n self.currentYearElement.removeAttribute(type);\n self.currentYearElement.disabled =\n !!inverseDateObj &&\n dateObj !== undefined &&\n inverseDateObj.getFullYear() === dateObj.getFullYear();\n }\n };\n }\n function parseConfig() {\n var boolOpts = [\n \"wrap\",\n \"weekNumbers\",\n \"allowInput\",\n \"allowInvalidPreload\",\n \"clickOpens\",\n \"time_24hr\",\n \"enableTime\",\n \"noCalendar\",\n \"altInput\",\n \"shorthandCurrentMonth\",\n \"inline\",\n \"static\",\n \"enableSeconds\",\n \"disableMobile\",\n ];\n var userConfig = __assign(__assign({}, JSON.parse(JSON.stringify(element.dataset || {}))), instanceConfig);\n var formats = {};\n self.config.parseDate = userConfig.parseDate;\n self.config.formatDate = userConfig.formatDate;\n Object.defineProperty(self.config, \"enable\", {\n get: function () { return self.config._enable; },\n set: function (dates) {\n self.config._enable = parseDateRules(dates);\n },\n });\n Object.defineProperty(self.config, \"disable\", {\n get: function () { return self.config._disable; },\n set: function (dates) {\n self.config._disable = parseDateRules(dates);\n },\n });\n var timeMode = userConfig.mode === \"time\";\n if (!userConfig.dateFormat && (userConfig.enableTime || timeMode)) {\n var defaultDateFormat = flatpickr.defaultConfig.dateFormat || defaultOptions.dateFormat;\n formats.dateFormat =\n userConfig.noCalendar || timeMode\n ? \"H:i\" + (userConfig.enableSeconds ? \":S\" : \"\")\n : defaultDateFormat + \" H:i\" + (userConfig.enableSeconds ? \":S\" : \"\");\n }\n if (userConfig.altInput &&\n (userConfig.enableTime || timeMode) &&\n !userConfig.altFormat) {\n var defaultAltFormat = flatpickr.defaultConfig.altFormat || defaultOptions.altFormat;\n formats.altFormat =\n userConfig.noCalendar || timeMode\n ? \"h:i\" + (userConfig.enableSeconds ? \":S K\" : \" K\")\n : defaultAltFormat + (\" h:i\" + (userConfig.enableSeconds ? \":S\" : \"\") + \" K\");\n }\n Object.defineProperty(self.config, \"minDate\", {\n get: function () { return self.config._minDate; },\n set: minMaxDateSetter(\"min\"),\n });\n Object.defineProperty(self.config, \"maxDate\", {\n get: function () { return self.config._maxDate; },\n set: minMaxDateSetter(\"max\"),\n });\n var minMaxTimeSetter = function (type) { return function (val) {\n self.config[type === \"min\" ? \"_minTime\" : \"_maxTime\"] = self.parseDate(val, \"H:i:S\");\n }; };\n Object.defineProperty(self.config, \"minTime\", {\n get: function () { return self.config._minTime; },\n set: minMaxTimeSetter(\"min\"),\n });\n Object.defineProperty(self.config, \"maxTime\", {\n get: function () { return self.config._maxTime; },\n set: minMaxTimeSetter(\"max\"),\n });\n if (userConfig.mode === \"time\") {\n self.config.noCalendar = true;\n self.config.enableTime = true;\n }\n Object.assign(self.config, formats, userConfig);\n for (var i = 0; i < boolOpts.length; i++)\n self.config[boolOpts[i]] =\n self.config[boolOpts[i]] === true ||\n self.config[boolOpts[i]] === \"true\";\n HOOKS.filter(function (hook) { return self.config[hook] !== undefined; }).forEach(function (hook) {\n self.config[hook] = arrayify(self.config[hook] || []).map(bindToInstance);\n });\n self.isMobile =\n !self.config.disableMobile &&\n !self.config.inline &&\n self.config.mode === \"single\" &&\n !self.config.disable.length &&\n !self.config.enable &&\n !self.config.weekNumbers &&\n /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);\n for (var i = 0; i < self.config.plugins.length; i++) {\n var pluginConf = self.config.plugins[i](self) || {};\n for (var key in pluginConf) {\n if (HOOKS.indexOf(key) > -1) {\n self.config[key] = arrayify(pluginConf[key])\n .map(bindToInstance)\n .concat(self.config[key]);\n }\n else if (typeof userConfig[key] === \"undefined\")\n self.config[key] = pluginConf[key];\n }\n }\n if (!userConfig.altInputClass) {\n self.config.altInputClass =\n getInputElem().className + \" \" + self.config.altInputClass;\n }\n triggerEvent(\"onParseConfig\");\n }\n function getInputElem() {\n return self.config.wrap\n ? element.querySelector(\"[data-input]\")\n : element;\n }\n function setupLocale() {\n if (typeof self.config.locale !== \"object\" &&\n typeof flatpickr.l10ns[self.config.locale] === \"undefined\")\n self.config.errorHandler(new Error(\"flatpickr: invalid locale \" + self.config.locale));\n self.l10n = __assign(__assign({}, flatpickr.l10ns.default), (typeof self.config.locale === \"object\"\n ? self.config.locale\n : self.config.locale !== \"default\"\n ? flatpickr.l10ns[self.config.locale]\n : undefined));\n tokenRegex.D = \"(\" + self.l10n.weekdays.shorthand.join(\"|\") + \")\";\n tokenRegex.l = \"(\" + self.l10n.weekdays.longhand.join(\"|\") + \")\";\n tokenRegex.M = \"(\" + self.l10n.months.shorthand.join(\"|\") + \")\";\n tokenRegex.F = \"(\" + self.l10n.months.longhand.join(\"|\") + \")\";\n tokenRegex.K = \"(\" + self.l10n.amPM[0] + \"|\" + self.l10n.amPM[1] + \"|\" + self.l10n.amPM[0].toLowerCase() + \"|\" + self.l10n.amPM[1].toLowerCase() + \")\";\n var userConfig = __assign(__assign({}, instanceConfig), JSON.parse(JSON.stringify(element.dataset || {})));\n if (userConfig.time_24hr === undefined &&\n flatpickr.defaultConfig.time_24hr === undefined) {\n self.config.time_24hr = self.l10n.time_24hr;\n }\n self.formatDate = createDateFormatter(self);\n self.parseDate = createDateParser({ config: self.config, l10n: self.l10n });\n }\n function positionCalendar(customPositionElement) {\n if (typeof self.config.position === \"function\") {\n return void self.config.position(self, customPositionElement);\n }\n if (self.calendarContainer === undefined)\n return;\n triggerEvent(\"onPreCalendarPosition\");\n var positionElement = customPositionElement || self._positionElement;\n var calendarHeight = Array.prototype.reduce.call(self.calendarContainer.children, (function (acc, child) { return acc + child.offsetHeight; }), 0), calendarWidth = self.calendarContainer.offsetWidth, configPos = self.config.position.split(\" \"), configPosVertical = configPos[0], configPosHorizontal = configPos.length > 1 ? configPos[1] : null, inputBounds = positionElement.getBoundingClientRect(), distanceFromBottom = window.innerHeight - inputBounds.bottom, showOnTop = configPosVertical === \"above\" ||\n (configPosVertical !== \"below\" &&\n distanceFromBottom < calendarHeight &&\n inputBounds.top > calendarHeight);\n var top = window.pageYOffset +\n inputBounds.top +\n (!showOnTop ? positionElement.offsetHeight + 2 : -calendarHeight - 2);\n toggleClass(self.calendarContainer, \"arrowTop\", !showOnTop);\n toggleClass(self.calendarContainer, \"arrowBottom\", showOnTop);\n if (self.config.inline)\n return;\n var left = window.pageXOffset + inputBounds.left;\n var isCenter = false;\n var isRight = false;\n if (configPosHorizontal === \"center\") {\n left -= (calendarWidth - inputBounds.width) / 2;\n isCenter = true;\n }\n else if (configPosHorizontal === \"right\") {\n left -= calendarWidth - inputBounds.width;\n isRight = true;\n }\n toggleClass(self.calendarContainer, \"arrowLeft\", !isCenter && !isRight);\n toggleClass(self.calendarContainer, \"arrowCenter\", isCenter);\n toggleClass(self.calendarContainer, \"arrowRight\", isRight);\n var right = window.document.body.offsetWidth -\n (window.pageXOffset + inputBounds.right);\n var rightMost = left + calendarWidth > window.document.body.offsetWidth;\n var centerMost = right + calendarWidth > window.document.body.offsetWidth;\n toggleClass(self.calendarContainer, \"rightMost\", rightMost);\n if (self.config.static)\n return;\n self.calendarContainer.style.top = top + \"px\";\n if (!rightMost) {\n self.calendarContainer.style.left = left + \"px\";\n self.calendarContainer.style.right = \"auto\";\n }\n else if (!centerMost) {\n self.calendarContainer.style.left = \"auto\";\n self.calendarContainer.style.right = right + \"px\";\n }\n else {\n var doc = getDocumentStyleSheet();\n if (doc === undefined)\n return;\n var bodyWidth = window.document.body.offsetWidth;\n var centerLeft = Math.max(0, bodyWidth / 2 - calendarWidth / 2);\n var centerBefore = \".flatpickr-calendar.centerMost:before\";\n var centerAfter = \".flatpickr-calendar.centerMost:after\";\n var centerIndex = doc.cssRules.length;\n var centerStyle = \"{left:\" + inputBounds.left + \"px;right:auto;}\";\n toggleClass(self.calendarContainer, \"rightMost\", false);\n toggleClass(self.calendarContainer, \"centerMost\", true);\n doc.insertRule(centerBefore + \",\" + centerAfter + centerStyle, centerIndex);\n self.calendarContainer.style.left = centerLeft + \"px\";\n self.calendarContainer.style.right = \"auto\";\n }\n }\n function getDocumentStyleSheet() {\n var editableSheet = null;\n for (var i = 0; i < document.styleSheets.length; i++) {\n var sheet = document.styleSheets[i];\n if (!sheet.cssRules)\n continue;\n try {\n sheet.cssRules;\n }\n catch (err) {\n continue;\n }\n editableSheet = sheet;\n break;\n }\n return editableSheet != null ? editableSheet : createStyleSheet();\n }\n function createStyleSheet() {\n var style = document.createElement(\"style\");\n document.head.appendChild(style);\n return style.sheet;\n }\n function redraw() {\n if (self.config.noCalendar || self.isMobile)\n return;\n buildMonthSwitch();\n updateNavigationCurrentMonth();\n buildDays();\n }\n function focusAndClose() {\n self._input.focus();\n if (window.navigator.userAgent.indexOf(\"MSIE\") !== -1 ||\n navigator.msMaxTouchPoints !== undefined) {\n setTimeout(self.close, 0);\n }\n else {\n self.close();\n }\n }\n function selectDate(e) {\n e.preventDefault();\n e.stopPropagation();\n var isSelectable = function (day) {\n return day.classList &&\n day.classList.contains(\"flatpickr-day\") &&\n !day.classList.contains(\"flatpickr-disabled\") &&\n !day.classList.contains(\"notAllowed\");\n };\n var t = findParent(getEventTarget(e), isSelectable);\n if (t === undefined)\n return;\n var target = t;\n var selectedDate = (self.latestSelectedDateObj = new Date(target.dateObj.getTime()));\n var shouldChangeMonth = (selectedDate.getMonth() < self.currentMonth ||\n selectedDate.getMonth() >\n self.currentMonth + self.config.showMonths - 1) &&\n self.config.mode !== \"range\";\n self.selectedDateElem = target;\n if (self.config.mode === \"single\")\n self.selectedDates = [selectedDate];\n else if (self.config.mode === \"multiple\") {\n var selectedIndex = isDateSelected(selectedDate);\n if (selectedIndex)\n self.selectedDates.splice(parseInt(selectedIndex), 1);\n else\n self.selectedDates.push(selectedDate);\n }\n else if (self.config.mode === \"range\") {\n if (self.selectedDates.length === 2) {\n self.clear(false, false);\n }\n self.latestSelectedDateObj = selectedDate;\n self.selectedDates.push(selectedDate);\n if (compareDates(selectedDate, self.selectedDates[0], true) !== 0)\n self.selectedDates.sort(function (a, b) { return a.getTime() - b.getTime(); });\n }\n setHoursFromInputs();\n if (shouldChangeMonth) {\n var isNewYear = self.currentYear !== selectedDate.getFullYear();\n self.currentYear = selectedDate.getFullYear();\n self.currentMonth = selectedDate.getMonth();\n if (isNewYear) {\n triggerEvent(\"onYearChange\");\n buildMonthSwitch();\n }\n triggerEvent(\"onMonthChange\");\n }\n updateNavigationCurrentMonth();\n buildDays();\n updateValue();\n if (!shouldChangeMonth &&\n self.config.mode !== \"range\" &&\n self.config.showMonths === 1)\n focusOnDayElem(target);\n else if (self.selectedDateElem !== undefined &&\n self.hourElement === undefined) {\n self.selectedDateElem && self.selectedDateElem.focus();\n }\n if (self.hourElement !== undefined)\n self.hourElement !== undefined && self.hourElement.focus();\n if (self.config.closeOnSelect) {\n var single = self.config.mode === \"single\" && !self.config.enableTime;\n var range = self.config.mode === \"range\" &&\n self.selectedDates.length === 2 &&\n !self.config.enableTime;\n if (single || range) {\n focusAndClose();\n }\n }\n triggerChange();\n }\n var CALLBACKS = {\n locale: [setupLocale, updateWeekdays],\n showMonths: [buildMonths, setCalendarWidth, buildWeekdays],\n minDate: [jumpToDate],\n maxDate: [jumpToDate],\n positionElement: [updatePositionElement],\n clickOpens: [\n function () {\n if (self.config.clickOpens === true) {\n bind(self._input, \"focus\", self.open);\n bind(self._input, \"click\", self.open);\n }\n else {\n self._input.removeEventListener(\"focus\", self.open);\n self._input.removeEventListener(\"click\", self.open);\n }\n },\n ],\n };\n function set(option, value) {\n if (option !== null && typeof option === \"object\") {\n Object.assign(self.config, option);\n for (var key in option) {\n if (CALLBACKS[key] !== undefined)\n CALLBACKS[key].forEach(function (x) { return x(); });\n }\n }\n else {\n self.config[option] = value;\n if (CALLBACKS[option] !== undefined)\n CALLBACKS[option].forEach(function (x) { return x(); });\n else if (HOOKS.indexOf(option) > -1)\n self.config[option] = arrayify(value);\n }\n self.redraw();\n updateValue(true);\n }\n function setSelectedDate(inputDate, format) {\n var dates = [];\n if (inputDate instanceof Array)\n dates = inputDate.map(function (d) { return self.parseDate(d, format); });\n else if (inputDate instanceof Date || typeof inputDate === \"number\")\n dates = [self.parseDate(inputDate, format)];\n else if (typeof inputDate === \"string\") {\n switch (self.config.mode) {\n case \"single\":\n case \"time\":\n dates = [self.parseDate(inputDate, format)];\n break;\n case \"multiple\":\n dates = inputDate\n .split(self.config.conjunction)\n .map(function (date) { return self.parseDate(date, format); });\n break;\n case \"range\":\n dates = inputDate\n .split(self.l10n.rangeSeparator)\n .map(function (date) { return self.parseDate(date, format); });\n break;\n default:\n break;\n }\n }\n else\n self.config.errorHandler(new Error(\"Invalid date supplied: \" + JSON.stringify(inputDate)));\n self.selectedDates = (self.config.allowInvalidPreload\n ? dates\n : dates.filter(function (d) { return d instanceof Date && isEnabled(d, false); }));\n if (self.config.mode === \"range\")\n self.selectedDates.sort(function (a, b) { return a.getTime() - b.getTime(); });\n }\n function setDate(date, triggerChange, format) {\n if (triggerChange === void 0) { triggerChange = false; }\n if (format === void 0) { format = self.config.dateFormat; }\n if ((date !== 0 && !date) || (date instanceof Array && date.length === 0))\n return self.clear(triggerChange);\n setSelectedDate(date, format);\n self.latestSelectedDateObj =\n self.selectedDates[self.selectedDates.length - 1];\n self.redraw();\n jumpToDate(undefined, triggerChange);\n setHoursFromDate();\n if (self.selectedDates.length === 0) {\n self.clear(false);\n }\n updateValue(triggerChange);\n if (triggerChange)\n triggerEvent(\"onChange\");\n }\n function parseDateRules(arr) {\n return arr\n .slice()\n .map(function (rule) {\n if (typeof rule === \"string\" ||\n typeof rule === \"number\" ||\n rule instanceof Date) {\n return self.parseDate(rule, undefined, true);\n }\n else if (rule &&\n typeof rule === \"object\" &&\n rule.from &&\n rule.to)\n return {\n from: self.parseDate(rule.from, undefined),\n to: self.parseDate(rule.to, undefined),\n };\n return rule;\n })\n .filter(function (x) { return x; });\n }\n function setupDates() {\n self.selectedDates = [];\n self.now = self.parseDate(self.config.now) || new Date();\n var preloadedDate = self.config.defaultDate ||\n ((self.input.nodeName === \"INPUT\" ||\n self.input.nodeName === \"TEXTAREA\") &&\n self.input.placeholder &&\n self.input.value === self.input.placeholder\n ? null\n : self.input.value);\n if (preloadedDate)\n setSelectedDate(preloadedDate, self.config.dateFormat);\n self._initialDate =\n self.selectedDates.length > 0\n ? self.selectedDates[0]\n : self.config.minDate &&\n self.config.minDate.getTime() > self.now.getTime()\n ? self.config.minDate\n : self.config.maxDate &&\n self.config.maxDate.getTime() < self.now.getTime()\n ? self.config.maxDate\n : self.now;\n self.currentYear = self._initialDate.getFullYear();\n self.currentMonth = self._initialDate.getMonth();\n if (self.selectedDates.length > 0)\n self.latestSelectedDateObj = self.selectedDates[0];\n if (self.config.minTime !== undefined)\n self.config.minTime = self.parseDate(self.config.minTime, \"H:i\");\n if (self.config.maxTime !== undefined)\n self.config.maxTime = self.parseDate(self.config.maxTime, \"H:i\");\n self.minDateHasTime =\n !!self.config.minDate &&\n (self.config.minDate.getHours() > 0 ||\n self.config.minDate.getMinutes() > 0 ||\n self.config.minDate.getSeconds() > 0);\n self.maxDateHasTime =\n !!self.config.maxDate &&\n (self.config.maxDate.getHours() > 0 ||\n self.config.maxDate.getMinutes() > 0 ||\n self.config.maxDate.getSeconds() > 0);\n }\n function setupInputs() {\n self.input = getInputElem();\n if (!self.input) {\n self.config.errorHandler(new Error(\"Invalid input element specified\"));\n return;\n }\n self.input._type = self.input.type;\n self.input.type = \"text\";\n self.input.classList.add(\"flatpickr-input\");\n self._input = self.input;\n if (self.config.altInput) {\n self.altInput = createElement(self.input.nodeName, self.config.altInputClass);\n self._input = self.altInput;\n self.altInput.placeholder = self.input.placeholder;\n self.altInput.disabled = self.input.disabled;\n self.altInput.required = self.input.required;\n self.altInput.tabIndex = self.input.tabIndex;\n self.altInput.type = \"text\";\n self.input.setAttribute(\"type\", \"hidden\");\n if (!self.config.static && self.input.parentNode)\n self.input.parentNode.insertBefore(self.altInput, self.input.nextSibling);\n }\n if (!self.config.allowInput)\n self._input.setAttribute(\"readonly\", \"readonly\");\n updatePositionElement();\n }\n function updatePositionElement() {\n self._positionElement = self.config.positionElement || self._input;\n }\n function setupMobile() {\n var inputType = self.config.enableTime\n ? self.config.noCalendar\n ? \"time\"\n : \"datetime-local\"\n : \"date\";\n self.mobileInput = createElement(\"input\", self.input.className + \" flatpickr-mobile\");\n self.mobileInput.tabIndex = 1;\n self.mobileInput.type = inputType;\n self.mobileInput.disabled = self.input.disabled;\n self.mobileInput.required = self.input.required;\n self.mobileInput.placeholder = self.input.placeholder;\n self.mobileFormatStr =\n inputType === \"datetime-local\"\n ? \"Y-m-d\\\\TH:i:S\"\n : inputType === \"date\"\n ? \"Y-m-d\"\n : \"H:i:S\";\n if (self.selectedDates.length > 0) {\n self.mobileInput.defaultValue = self.mobileInput.value = self.formatDate(self.selectedDates[0], self.mobileFormatStr);\n }\n if (self.config.minDate)\n self.mobileInput.min = self.formatDate(self.config.minDate, \"Y-m-d\");\n if (self.config.maxDate)\n self.mobileInput.max = self.formatDate(self.config.maxDate, \"Y-m-d\");\n if (self.input.getAttribute(\"step\"))\n self.mobileInput.step = String(self.input.getAttribute(\"step\"));\n self.input.type = \"hidden\";\n if (self.altInput !== undefined)\n self.altInput.type = \"hidden\";\n try {\n if (self.input.parentNode)\n self.input.parentNode.insertBefore(self.mobileInput, self.input.nextSibling);\n }\n catch (_a) { }\n bind(self.mobileInput, \"change\", function (e) {\n self.setDate(getEventTarget(e).value, false, self.mobileFormatStr);\n triggerEvent(\"onChange\");\n triggerEvent(\"onClose\");\n });\n }\n function toggle(e) {\n if (self.isOpen === true)\n return self.close();\n self.open(e);\n }\n function triggerEvent(event, data) {\n if (self.config === undefined)\n return;\n var hooks = self.config[event];\n if (hooks !== undefined && hooks.length > 0) {\n for (var i = 0; hooks[i] && i < hooks.length; i++)\n hooks[i](self.selectedDates, self.input.value, self, data);\n }\n if (event === \"onChange\") {\n self.input.dispatchEvent(createEvent(\"change\"));\n self.input.dispatchEvent(createEvent(\"input\"));\n }\n }\n function createEvent(name) {\n var e = document.createEvent(\"Event\");\n e.initEvent(name, true, true);\n return e;\n }\n function isDateSelected(date) {\n for (var i = 0; i < self.selectedDates.length; i++) {\n var selectedDate = self.selectedDates[i];\n if (selectedDate instanceof Date &&\n compareDates(selectedDate, date) === 0)\n return \"\" + i;\n }\n return false;\n }\n function isDateInRange(date) {\n if (self.config.mode !== \"range\" || self.selectedDates.length < 2)\n return false;\n return (compareDates(date, self.selectedDates[0]) >= 0 &&\n compareDates(date, self.selectedDates[1]) <= 0);\n }\n function updateNavigationCurrentMonth() {\n if (self.config.noCalendar || self.isMobile || !self.monthNav)\n return;\n self.yearElements.forEach(function (yearElement, i) {\n var d = new Date(self.currentYear, self.currentMonth, 1);\n d.setMonth(self.currentMonth + i);\n if (self.config.showMonths > 1 ||\n self.config.monthSelectorType === \"static\") {\n self.monthElements[i].textContent =\n monthToStr(d.getMonth(), self.config.shorthandCurrentMonth, self.l10n) + \" \";\n }\n else {\n self.monthsDropdownContainer.value = d.getMonth().toString();\n }\n yearElement.value = d.getFullYear().toString();\n });\n self._hidePrevMonthArrow =\n self.config.minDate !== undefined &&\n (self.currentYear === self.config.minDate.getFullYear()\n ? self.currentMonth <= self.config.minDate.getMonth()\n : self.currentYear < self.config.minDate.getFullYear());\n self._hideNextMonthArrow =\n self.config.maxDate !== undefined &&\n (self.currentYear === self.config.maxDate.getFullYear()\n ? self.currentMonth + 1 > self.config.maxDate.getMonth()\n : self.currentYear > self.config.maxDate.getFullYear());\n }\n function getDateStr(specificFormat) {\n var format = specificFormat ||\n (self.config.altInput ? self.config.altFormat : self.config.dateFormat);\n return self.selectedDates\n .map(function (dObj) { return self.formatDate(dObj, format); })\n .filter(function (d, i, arr) {\n return self.config.mode !== \"range\" ||\n self.config.enableTime ||\n arr.indexOf(d) === i;\n })\n .join(self.config.mode !== \"range\"\n ? self.config.conjunction\n : self.l10n.rangeSeparator);\n }\n function updateValue(triggerChange) {\n if (triggerChange === void 0) { triggerChange = true; }\n if (self.mobileInput !== undefined && self.mobileFormatStr) {\n self.mobileInput.value =\n self.latestSelectedDateObj !== undefined\n ? self.formatDate(self.latestSelectedDateObj, self.mobileFormatStr)\n : \"\";\n }\n self.input.value = getDateStr(self.config.dateFormat);\n if (self.altInput !== undefined) {\n self.altInput.value = getDateStr(self.config.altFormat);\n }\n if (triggerChange !== false)\n triggerEvent(\"onValueUpdate\");\n }\n function onMonthNavClick(e) {\n var eventTarget = getEventTarget(e);\n var isPrevMonth = self.prevMonthNav.contains(eventTarget);\n var isNextMonth = self.nextMonthNav.contains(eventTarget);\n if (isPrevMonth || isNextMonth) {\n changeMonth(isPrevMonth ? -1 : 1);\n }\n else if (self.yearElements.indexOf(eventTarget) >= 0) {\n eventTarget.select();\n }\n else if (eventTarget.classList.contains(\"arrowUp\")) {\n self.changeYear(self.currentYear + 1);\n }\n else if (eventTarget.classList.contains(\"arrowDown\")) {\n self.changeYear(self.currentYear - 1);\n }\n }\n function timeWrapper(e) {\n e.preventDefault();\n var isKeyDown = e.type === \"keydown\", eventTarget = getEventTarget(e), input = eventTarget;\n if (self.amPM !== undefined && eventTarget === self.amPM) {\n self.amPM.textContent =\n self.l10n.amPM[int(self.amPM.textContent === self.l10n.amPM[0])];\n }\n var min = parseFloat(input.getAttribute(\"min\")), max = parseFloat(input.getAttribute(\"max\")), step = parseFloat(input.getAttribute(\"step\")), curValue = parseInt(input.value, 10), delta = e.delta ||\n (isKeyDown ? (e.which === 38 ? 1 : -1) : 0);\n var newValue = curValue + step * delta;\n if (typeof input.value !== \"undefined\" && input.value.length === 2) {\n var isHourElem = input === self.hourElement, isMinuteElem = input === self.minuteElement;\n if (newValue < min) {\n newValue =\n max +\n newValue +\n int(!isHourElem) +\n (int(isHourElem) && int(!self.amPM));\n if (isMinuteElem)\n incrementNumInput(undefined, -1, self.hourElement);\n }\n else if (newValue > max) {\n newValue =\n input === self.hourElement ? newValue - max - int(!self.amPM) : min;\n if (isMinuteElem)\n incrementNumInput(undefined, 1, self.hourElement);\n }\n if (self.amPM &&\n isHourElem &&\n (step === 1\n ? newValue + curValue === 23\n : Math.abs(newValue - curValue) > step)) {\n self.amPM.textContent =\n self.l10n.amPM[int(self.amPM.textContent === self.l10n.amPM[0])];\n }\n input.value = pad(newValue);\n }\n }\n init();\n return self;\n}\nfunction _flatpickr(nodeList, config) {\n var nodes = Array.prototype.slice\n .call(nodeList)\n .filter(function (x) { return x instanceof HTMLElement; });\n var instances = [];\n for (var i = 0; i < nodes.length; i++) {\n var node = nodes[i];\n try {\n if (node.getAttribute(\"data-fp-omit\") !== null)\n continue;\n if (node._flatpickr !== undefined) {\n node._flatpickr.destroy();\n node._flatpickr = undefined;\n }\n node._flatpickr = FlatpickrInstance(node, config || {});\n instances.push(node._flatpickr);\n }\n catch (e) {\n console.error(e);\n }\n }\n return instances.length === 1 ? instances[0] : instances;\n}\nif (typeof HTMLElement !== \"undefined\" &&\n typeof HTMLCollection !== \"undefined\" &&\n typeof NodeList !== \"undefined\") {\n HTMLCollection.prototype.flatpickr = NodeList.prototype.flatpickr = function (config) {\n return _flatpickr(this, config);\n };\n HTMLElement.prototype.flatpickr = function (config) {\n return _flatpickr([this], config);\n };\n}\nvar flatpickr = function (selector, config) {\n if (typeof selector === \"string\") {\n return _flatpickr(window.document.querySelectorAll(selector), config);\n }\n else if (selector instanceof Node) {\n return _flatpickr([selector], config);\n }\n else {\n return _flatpickr(selector, config);\n }\n};\nflatpickr.defaultConfig = {};\nflatpickr.l10ns = {\n en: __assign({}, English),\n default: __assign({}, English),\n};\nflatpickr.localize = function (l10n) {\n flatpickr.l10ns.default = __assign(__assign({}, flatpickr.l10ns.default), l10n);\n};\nflatpickr.setDefaults = function (config) {\n flatpickr.defaultConfig = __assign(__assign({}, flatpickr.defaultConfig), config);\n};\nflatpickr.parseDate = createDateParser({});\nflatpickr.formatDate = createDateFormatter({});\nflatpickr.compareDates = compareDates;\nif (typeof jQuery !== \"undefined\" && typeof jQuery.fn !== \"undefined\") {\n jQuery.fn.flatpickr = function (config) {\n return _flatpickr(this, config);\n };\n}\nDate.prototype.fp_incr = function (days) {\n return new Date(this.getFullYear(), this.getMonth(), this.getDate() + (typeof days === \"string\" ? parseInt(days, 10) : days));\n};\nif (typeof window !== \"undefined\") {\n window.flatpickr = flatpickr;\n}\nexport default flatpickr;\n", "import flatpickr from \"flatpickr\";\n\n(() => {\n const flatpickrInstances = [];\n window.CMS.timepicker = {\n init(root = document) {\n const datetimes = root.querySelectorAll(\n \"input[type=text][data-cms-datetime]\"\n );\n const dates = root.querySelectorAll(\"input[type=text][data-cms-date]\");\n if (datetimes.length === 0 && dates.length === 0) return;\n const locale = CMS.getLocale();\n for (const datetime of datetimes) {\n flatpickrInstances.push(\n flatpickr(datetime, {\n format: \"yyyy-mm-dd hh:ii\",\n enableTime: true,\n locale: locale,\n })\n );\n }\n for (const date of dates) {\n flatpickrInstances.push(\n flatpickr(date, {\n format: \"yyyy-mm-dd\",\n locale: locale,\n })\n );\n }\n },\n dispose() {\n for (const flatpickrInstance of flatpickrInstances) {\n flatpickrInstance.destroy();\n }\n flatpickrInstances.length = 0;\n },\n };\n})();\n", "import jQuery from \"jquery\";\nimport Rails from \"@rails/ujs\";\n\nimport \"../../vendor/redactor\";\nimport \"../../vendor/redactor/filemanager\";\nimport \"../../vendor/redactor/imagemanager\";\nimport \"../../vendor/redactor/definedlinks\";\nimport \"../../vendor/redactor/table\";\nimport \"../../vendor/redactor/video\";\n\n(() => {\n const buildRedactorOptions = () => {\n const fileUploadPath = document.querySelector(\n 'meta[name=\"cms-file-upload-path\"]'\n ).content;\n const pagesPath = document.querySelector(\n 'meta[name=\"cms-pages-path\"]'\n ).content;\n const csrfParam = Rails.csrfParam();\n const csrfToken = Rails.csrfToken();\n\n const imageUpload = new URL(fileUploadPath, document.location.href);\n imageUpload.searchParams.set(\"source\", \"redactor\");\n imageUpload.searchParams.set(\"type\", \"image\");\n imageUpload.searchParams.set(csrfParam, csrfToken);\n\n const imageManagerJson = new URL(fileUploadPath, document.location.href);\n imageManagerJson.searchParams.set(\"source\", \"redactor\");\n imageManagerJson.searchParams.set(\"type\", \"image\");\n\n const fileUpload = new URL(fileUploadPath, document.location.href);\n fileUpload.searchParams.set(\"source\", \"redactor\");\n fileUpload.searchParams.set(\"type\", \"file\");\n fileUpload.searchParams.set(csrfParam, csrfToken);\n\n const fileManagerJson = new URL(fileUploadPath, document.location.href);\n fileManagerJson.searchParams.set(\"source\", \"redactor\");\n fileManagerJson.searchParams.set(\"type\", \"file\");\n\n const definedLinks = new URL(pagesPath, document.location.href);\n definedLinks.searchParams.set(\"source\", \"redactor\");\n\n return {\n minHeight: 160,\n autoresize: true,\n buttonSource: true,\n formatting: [\"p\", \"h1\", \"h2\", \"h3\", \"h4\", \"h5\", \"h6\"],\n plugins: [\n \"imagemanager\",\n \"filemanager\",\n \"table\",\n \"video\",\n \"definedlinks\",\n ],\n lang: CMS.getLocale(),\n convertDivs: false,\n imageUpload,\n imageManagerJson,\n fileUpload,\n fileManagerJson,\n definedLinks,\n // allow unsafe tags and the like (prevent redactor stripping divs and other elements)\n cleanOnEnter: false,\n replaceTags: false,\n removeComments: false,\n removeNewLines: false,\n deniedTags: [],\n replaceDivs: false,\n };\n };\n\n const redactorInstances = [];\n window.CMS.wysiwyg = {\n init(root = document) {\n const textareas = root.querySelectorAll(\n \"textarea.rich-text-editor, textarea[data-cms-rich-text]\"\n );\n if (textareas.length === 0) return;\n const redactorOptions = buildRedactorOptions();\n for (const textarea of textareas) {\n redactorInstances.push(new jQuery.Redactor(textarea, redactorOptions));\n }\n },\n dispose() {\n for (const redactor of redactorInstances) {\n redactor.core.destroy();\n }\n redactorInstances.length = 0;\n },\n };\n})();\n", "/*\n\tRedactor 10.2.5\n\tUpdated: October 1, 2015\n\n\thttp://imperavi.com/redactor/\n\n\tCopyright (c) 2009-2015, Imperavi LLC.\n\tLicense: http://imperavi.com/redactor/license/\n\n\tUsage: $('#content').redactor();\n\n\tNOTE: This is the most recent editor we have licence for. There are inline\n\tfixes and tweaks annotated with \"COMFY FIX\"\n*/\n\nimport jQuery from \"jquery\";\n\n(function ($) {\n \"use strict\";\n\n if (!Function.prototype.bind) {\n Function.prototype.bind = function (scope) {\n var fn = this;\n return function () {\n return fn.apply(scope);\n };\n };\n }\n\n var uuid = 0;\n\n // Plugin\n $.fn.redactor = function (options) {\n var val = [];\n var args = Array.prototype.slice.call(arguments, 1);\n\n if (typeof options === \"string\") {\n this.each(function () {\n var instance = $.data(this, \"redactor\");\n var func;\n\n if (options.search(/\\./) != \"-1\") {\n func = options.split(\".\");\n if (typeof instance[func[0]] != \"undefined\") {\n func = instance[func[0]][func[1]];\n }\n } else {\n func = instance[options];\n }\n\n if (typeof instance !== \"undefined\" && $.isFunction(func)) {\n var methodVal = func.apply(instance, args);\n if (methodVal !== undefined && methodVal !== instance) {\n val.push(methodVal);\n }\n } else {\n $.error('No such method \"' + options + '\" for Redactor');\n }\n });\n } else {\n this.each(function () {\n $.data(this, \"redactor\", {});\n $.data(this, \"redactor\", Redactor(this, options));\n });\n }\n\n if (val.length === 0) return this;\n else if (val.length === 1) return val[0];\n else return val;\n };\n\n // Initialization\n function Redactor(el, options) {\n return new Redactor.prototype.init(el, options);\n }\n\n // Functionality\n $.Redactor = Redactor;\n $.Redactor.VERSION = \"10.2.5\";\n $.Redactor.modules = [\n \"alignment\",\n \"autosave\",\n \"block\",\n \"buffer\",\n \"build\",\n \"button\",\n \"caret\",\n \"clean\",\n \"code\",\n \"core\",\n \"dropdown\",\n \"file\",\n \"focus\",\n \"image\",\n \"indent\",\n \"inline\",\n \"insert\",\n \"keydown\",\n \"keyup\",\n \"lang\",\n \"line\",\n \"link\",\n \"linkify\",\n \"list\",\n \"modal\",\n \"observe\",\n \"paragraphize\",\n \"paste\",\n \"placeholder\",\n \"progress\",\n \"selection\",\n \"shortcuts\",\n \"tabifier\",\n \"tidy\",\n \"toolbar\",\n \"upload\",\n \"utils\",\n ];\n\n $.Redactor.opts = {\n // settings\n lang: \"en\",\n direction: \"ltr\", // ltr or rtl\n\n plugins: false, // array\n\n focus: false,\n focusEnd: false,\n\n placeholder: false,\n\n visual: true,\n tabindex: false,\n\n minHeight: false,\n maxHeight: false,\n\n linebreaks: false,\n replaceDivs: true,\n paragraphize: true,\n cleanStyleOnEnter: false,\n enterKey: true,\n\n cleanOnPaste: true,\n cleanSpaces: true,\n pastePlainText: false,\n\n autosave: false, // false or url\n autosaveName: false,\n autosaveInterval: 60, // seconds\n autosaveOnChange: false,\n autosaveFields: false,\n\n linkTooltip: true,\n linkProtocol: \"http\",\n linkNofollow: false,\n linkSize: 50,\n\n imageEditable: true,\n imageLink: true,\n imagePosition: true,\n imageFloatMargin: \"10px\",\n imageResizable: true,\n\n imageUpload: null,\n imageUploadParam: \"file\",\n\n uploadImageField: false,\n\n dragImageUpload: true,\n\n fileUpload: null,\n fileUploadParam: \"file\",\n\n dragFileUpload: true,\n\n s3: false,\n\n convertLinks: true,\n convertUrlLinks: true,\n convertImageLinks: true,\n convertVideoLinks: true,\n\n preSpaces: 4, // or false\n tabAsSpaces: false, // true or number of spaces\n tabKey: true,\n\n scrollTarget: false,\n\n toolbar: true,\n toolbarFixed: true,\n toolbarFixedTarget: document,\n toolbarFixedTopOffset: 0, // pixels\n toolbarExternal: false, // ID selector\n toolbarOverflow: false,\n\n source: true,\n buttons: [\n \"html\",\n \"formatting\",\n \"bold\",\n \"italic\",\n \"deleted\",\n \"unorderedlist\",\n \"orderedlist\",\n \"outdent\",\n \"indent\",\n \"image\",\n \"file\",\n \"link\",\n \"alignment\",\n \"horizontalrule\",\n ], // + 'underline'\n\n buttonsHide: [],\n buttonsHideOnMobile: [],\n\n formatting: [\"p\", \"blockquote\", \"pre\", \"h1\", \"h2\", \"h3\", \"h4\", \"h5\", \"h6\"],\n formattingAdd: false,\n\n tabifier: true,\n\n deniedTags: [\"script\", \"style\"],\n allowedTags: false, // or array\n\n paragraphizeBlocks: [\n \"table\",\n \"div\",\n \"pre\",\n \"form\",\n \"ul\",\n \"ol\",\n \"h1\",\n \"h2\",\n \"h3\",\n \"h4\",\n \"h5\",\n \"h6\",\n \"dl\",\n \"blockquote\",\n \"figcaption\",\n \"address\",\n \"section\",\n \"header\",\n \"footer\",\n \"aside\",\n \"article\",\n \"object\",\n \"style\",\n \"script\",\n \"iframe\",\n \"select\",\n \"input\",\n \"textarea\",\n \"button\",\n \"option\",\n \"map\",\n \"area\",\n \"math\",\n \"hr\",\n \"fieldset\",\n \"legend\",\n \"hgroup\",\n \"nav\",\n \"figure\",\n \"details\",\n \"menu\",\n \"summary\",\n \"p\",\n ],\n\n removeComments: false,\n replaceTags: [\n [\"strike\", \"del\"],\n [\"b\", \"strong\"],\n ],\n replaceStyles: [\n [\"font-weight:\\\\s?bold\", \"strong\"],\n [\"font-style:\\\\s?italic\", \"em\"],\n [\"text-decoration:\\\\s?underline\", \"u\"],\n [\"text-decoration:\\\\s?line-through\", \"del\"],\n ],\n removeDataAttr: false,\n\n removeAttr: false, // or multi array\n allowedAttr: false, // or multi array\n\n removeWithoutAttr: [\"span\"], // or false\n removeEmpty: [\"p\"], // or false;\n\n activeButtons: [\n \"deleted\",\n \"italic\",\n \"bold\",\n \"underline\",\n \"unorderedlist\",\n \"orderedlist\",\n \"alignleft\",\n \"aligncenter\",\n \"alignright\",\n \"justify\",\n ],\n activeButtonsStates: {\n b: \"bold\",\n strong: \"bold\",\n i: \"italic\",\n em: \"italic\",\n del: \"deleted\",\n strike: \"deleted\",\n ul: \"unorderedlist\",\n ol: \"orderedlist\",\n u: \"underline\",\n },\n\n shortcuts: {\n \"ctrl+shift+m, meta+shift+m\": { func: \"inline.removeFormat\" },\n \"ctrl+b, meta+b\": { func: \"inline.format\", params: [\"bold\"] },\n \"ctrl+i, meta+i\": { func: \"inline.format\", params: [\"italic\"] },\n \"ctrl+h, meta+h\": { func: \"inline.format\", params: [\"superscript\"] },\n \"ctrl+l, meta+l\": { func: \"inline.format\", params: [\"subscript\"] },\n \"ctrl+k, meta+k\": { func: \"link.show\" },\n \"ctrl+shift+7\": { func: \"list.toggle\", params: [\"orderedlist\"] },\n \"ctrl+shift+8\": { func: \"list.toggle\", params: [\"unorderedlist\"] },\n },\n shortcutsAdd: false,\n\n // private\n buffer: [],\n rebuffer: [],\n emptyHtml: \"
\",\n invisibleSpace: \"\",\n imageTypes: [\"image/png\", \"image/jpeg\", \"image/gif\"],\n indentValue: 20,\n verifiedTags: [\n \"a\",\n \"img\",\n \"b\",\n \"strong\",\n \"sub\",\n \"sup\",\n \"i\",\n \"em\",\n \"u\",\n \"small\",\n \"strike\",\n \"del\",\n \"cite\",\n \"ul\",\n \"ol\",\n \"li\",\n ], // and for span tag special rule\n inlineTags: [\n \"strong\",\n \"b\",\n \"u\",\n \"em\",\n \"i\",\n \"code\",\n \"del\",\n \"ins\",\n \"samp\",\n \"kbd\",\n \"sup\",\n \"sub\",\n \"mark\",\n \"var\",\n \"cite\",\n \"small\",\n ],\n alignmentTags: [\n \"P\",\n \"H1\",\n \"H2\",\n \"H3\",\n \"H4\",\n \"H5\",\n \"H6\",\n \"DL\",\n \"DT\",\n \"DD\",\n \"DIV\",\n \"TD\",\n \"BLOCKQUOTE\",\n \"OUTPUT\",\n \"FIGCAPTION\",\n \"ADDRESS\",\n \"SECTION\",\n \"HEADER\",\n \"FOOTER\",\n \"ASIDE\",\n \"ARTICLE\",\n ],\n blockLevelElements: [\"PRE\", \"UL\", \"OL\", \"LI\"],\n highContrast: false,\n observe: {\n dropdowns: [],\n },\n\n // lang\n langs: {\n en: {\n html: \"HTML\",\n video: \"Insert Video\",\n image: \"Insert Image\",\n table: \"Table\",\n link: \"Link\",\n link_insert: \"Insert link\",\n link_edit: \"Edit link\",\n unlink: \"Unlink\",\n formatting: \"Formatting\",\n paragraph: \"Normal text\",\n quote: \"Quote\",\n code: \"Code\",\n header1: \"Header 1\",\n header2: \"Header 2\",\n header3: \"Header 3\",\n header4: \"Header 4\",\n header5: \"Header 5\",\n bold: \"Bold\",\n italic: \"Italic\",\n fontcolor: \"Font Color\",\n backcolor: \"Back Color\",\n unorderedlist: \"Unordered List\",\n orderedlist: \"Ordered List\",\n outdent: \"Outdent\",\n indent: \"Indent\",\n cancel: \"Cancel\",\n insert: \"Insert\",\n save: \"Save\",\n _delete: \"Delete\",\n insert_table: \"Insert Table\",\n insert_row_above: \"Add Row Above\",\n insert_row_below: \"Add Row Below\",\n insert_column_left: \"Add Column Left\",\n insert_column_right: \"Add Column Right\",\n delete_column: \"Delete Column\",\n delete_row: \"Delete Row\",\n delete_table: \"Delete Table\",\n rows: \"Rows\",\n columns: \"Columns\",\n add_head: \"Add Head\",\n delete_head: \"Delete Head\",\n title: \"Title\",\n image_position: \"Position\",\n none: \"None\",\n left: \"Left\",\n right: \"Right\",\n center: \"Center\",\n image_web_link: \"Image Web Link\",\n text: \"Text\",\n mailto: \"Email\",\n web: \"URL\",\n video_html_code: \"Video Embed Code or Youtube/Vimeo Link\",\n file: \"Insert File\",\n upload: \"Upload\",\n download: \"Download\",\n choose: \"Choose\",\n or_choose: \"Or choose\",\n drop_file_here: \"Drop file here\",\n align_left: \"Align text to the left\",\n align_center: \"Center text\",\n align_right: \"Align text to the right\",\n align_justify: \"Justify text\",\n horizontalrule: \"Insert Horizontal Rule\",\n deleted: \"Deleted\",\n anchor: \"Anchor\",\n link_new_tab: \"Open link in new tab\",\n underline: \"Underline\",\n alignment: \"Alignment\",\n filename: \"Name (optional)\",\n edit: \"Edit\",\n upload_label: \"Drop file here or \",\n },\n },\n\n linkify: {\n regexps: {\n youtube:\n /https?:\\/\\/(?:[0-9A-Z-]+\\.)?(?:youtu\\.be\\/|youtube\\.com\\S*[^\\w\\-\\s])([\\w\\-]{11})(?=[^\\w\\-]|$)(?![?=&+%\\w.\\-]*(?:['\"][^<>]*>|<\\/a>))[?=&+%\\w.-]*/gi,\n vimeo: /https?:\\/\\/(www\\.)?vimeo.com\\/(\\d+)($|\\/)/,\n image: /((https?|www)[^\\s]+\\.)(jpe?g|png|gif)(\\?[^\\s-]+)?/gi,\n url: /(https?:\\/\\/(?:www\\.|(?!www))[^\\s\\.]+\\.[^\\s]{2,}|www\\.[^\\s]+\\.[^\\s]{2,})/gi,\n },\n },\n\n codemirror: false,\n };\n\n // Functionality\n Redactor.fn = $.Redactor.prototype = {\n keyCode: {\n BACKSPACE: 8,\n DELETE: 46,\n UP: 38,\n DOWN: 40,\n ENTER: 13,\n SPACE: 32,\n ESC: 27,\n TAB: 9,\n CTRL: 17,\n META: 91,\n SHIFT: 16,\n ALT: 18,\n RIGHT: 39,\n LEFT: 37,\n LEFT_WIN: 91,\n },\n\n // Initialization\n init: function (el, options) {\n this.$element = $(el);\n this.uuid = uuid++;\n\n // if paste event detected = true\n this.rtePaste = false;\n this.$pasteBox = false;\n\n this.loadOptions(options);\n this.loadModules();\n\n // formatting storage\n this.formatting = {};\n\n // block level tags\n $.merge(this.opts.blockLevelElements, this.opts.alignmentTags);\n this.reIsBlock = new RegExp(\n \"^(\" + this.opts.blockLevelElements.join(\"|\") + \")$\",\n \"i\"\n );\n\n // setup allowed and denied tags\n this.tidy.setupAllowed();\n\n // setup denied tags\n if (this.opts.deniedTags !== false) {\n var tags = [\"html\", \"head\", \"link\", \"body\", \"meta\", \"applet\"];\n for (var i = 0; i < tags.length; i++) {\n this.opts.deniedTags.push(tags[i]);\n }\n }\n\n // load lang\n this.lang.load();\n\n // extend shortcuts\n $.extend(this.opts.shortcuts, this.opts.shortcutsAdd);\n\n // start callback\n this.core.setCallback(\"start\");\n\n // build\n this.start = true;\n this.build.run();\n },\n\n loadOptions: function (options) {\n this.opts = $.extend(\n {},\n $.extend(true, {}, $.Redactor.opts),\n this.$element.data(),\n options\n );\n },\n getModuleMethods: function (object) {\n return Object.getOwnPropertyNames(object).filter(function (property) {\n return typeof object[property] == \"function\";\n });\n },\n loadModules: function () {\n var len = $.Redactor.modules.length;\n for (var i = 0; i < len; i++) {\n this.bindModuleMethods($.Redactor.modules[i]);\n }\n },\n bindModuleMethods: function (module) {\n if (typeof this[module] == \"undefined\") return;\n\n // init module\n this[module] = this[module]();\n\n var methods = this.getModuleMethods(this[module]);\n var len = methods.length;\n\n // bind methods\n for (var z = 0; z < len; z++) {\n this[module][methods[z]] = this[module][methods[z]].bind(this);\n }\n },\n alignment: function () {\n return {\n left: function () {\n this.alignment.set(\"\");\n },\n right: function () {\n this.alignment.set(\"right\");\n },\n center: function () {\n this.alignment.set(\"center\");\n },\n justify: function () {\n this.alignment.set(\"justify\");\n },\n set: function (type) {\n // focus\n if (!this.utils.browser(\"msie\") && !this.opts.linebreaks) {\n this.$editor.focus();\n }\n\n // get blocks\n this.alignment.blocks = this.selection.getBlocks();\n this.alignment.type = type;\n\n this.buffer.set();\n this.selection.save();\n\n // set alignment\n if (this.alignment.isLinebreaksOrNoBlocks()) {\n this.alignment.setText();\n } else {\n this.alignment.setBlocks();\n }\n\n // sync\n this.selection.restore();\n this.code.sync();\n },\n setText: function () {\n var wrapper = this.selection.wrap(\"div\");\n $(wrapper)\n .attr(\"data-tagblock\", \"redactor\")\n .css(\"text-align\", this.alignment.type);\n },\n setBlocks: function () {\n $.each(\n this.alignment.blocks,\n $.proxy(function (i, el) {\n var $el = this.utils.getAlignmentElement(el);\n if (!$el) return;\n\n if (this.alignment.isNeedReplaceElement($el)) {\n this.alignment.replaceElement($el);\n } else {\n this.alignment.alignElement($el);\n }\n }, this)\n );\n },\n isLinebreaksOrNoBlocks: function () {\n return this.opts.linebreaks && this.alignment.blocks[0] === false;\n },\n isNeedReplaceElement: function ($el) {\n return (\n this.alignment.type === \"\" &&\n typeof $el.data(\"tagblock\") !== \"undefined\"\n );\n },\n replaceElement: function ($el) {\n $el.replaceWith($el.html());\n },\n alignElement: function ($el) {\n $el.css(\"text-align\", this.alignment.type);\n this.utils.removeEmptyAttr($el, \"style\");\n },\n };\n },\n autosave: function () {\n return {\n html: false,\n enable: function () {\n if (!this.opts.autosave) return;\n\n this.autosave.name = this.opts.autosaveName\n ? this.opts.autosaveName\n : this.$textarea.attr(\"name\");\n\n if (this.opts.autosaveOnChange) return;\n this.autosaveInterval = setInterval(\n this.autosave.load,\n this.opts.autosaveInterval * 1000\n );\n },\n onChange: function () {\n if (!this.opts.autosaveOnChange) return;\n this.autosave.load();\n },\n load: function () {\n if (!this.opts.autosave) return;\n\n this.autosave.source = this.code.get();\n\n if (this.autosave.html === this.autosave.source) return;\n\n // data\n var data = {};\n data[\"name\"] = this.autosave.name;\n data[this.autosave.name] = this.autosave.source;\n data = this.autosave.getHiddenFields(data);\n\n // ajax\n var jsxhr = $.ajax({\n url: this.opts.autosave,\n type: \"post\",\n data: data,\n });\n\n jsxhr.done(this.autosave.success);\n },\n getHiddenFields: function (data) {\n if (\n this.opts.autosaveFields === false ||\n typeof this.opts.autosaveFields !== \"object\"\n ) {\n return data;\n }\n\n $.each(\n this.opts.autosaveFields,\n $.proxy(function (k, v) {\n if (v !== null && v.toString().indexOf(\"#\") === 0) v = $(v).val();\n data[k] = v;\n }, this)\n );\n\n return data;\n },\n success: function (data) {\n var json;\n try {\n json = $.parseJSON(data);\n } catch (e) {\n //data has already been parsed\n json = data;\n }\n\n var callbackName =\n typeof json.error == \"undefined\" ? \"autosave\" : \"autosaveError\";\n\n this.core.setCallback(callbackName, this.autosave.name, json);\n this.autosave.html = this.autosave.source;\n },\n disable: function () {\n clearInterval(this.autosaveInterval);\n },\n };\n },\n block: function () {\n return {\n formatting: function (name) {\n this.block.clearStyle = false;\n var type, value;\n\n if (typeof this.formatting[name].data != \"undefined\") type = \"data\";\n else if (typeof this.formatting[name].attr != \"undefined\")\n type = \"attr\";\n else if (typeof this.formatting[name][\"class\"] != \"undefined\")\n type = \"class\";\n\n if (typeof this.formatting[name].clear != \"undefined\") {\n this.block.clearStyle = true;\n }\n\n if (type) value = this.formatting[name][type];\n\n this.block.format(this.formatting[name].tag, type, value);\n },\n format: function (tag, type, value) {\n if (tag == \"quote\") tag = \"blockquote\";\n\n var formatTags = [\n \"p\",\n \"pre\",\n \"blockquote\",\n \"h1\",\n \"h2\",\n \"h3\",\n \"h4\",\n \"h5\",\n \"h6\",\n ];\n if ($.inArray(tag, formatTags) == -1) return;\n\n this.block.isRemoveInline =\n tag == \"pre\" || tag.search(/h[1-6]/i) != -1;\n\n // focus\n if (!this.utils.browser(\"msie\")) this.$editor.focus();\n\n var html = $.trim(this.$editor.html());\n this.block.isEmpty = this.utils.isEmpty(html);\n\n // FF focus\n if (this.utils.browser(\"mozilla\") && !this.focus.isFocused()) {\n if (this.block.isEmpty) {\n var $first;\n if (!this.opts.linebreaks) {\n $first = this.$editor.children().first();\n this.caret.setEnd($first);\n }\n }\n }\n\n this.block.blocks = this.selection.getBlocks();\n\n this.block.blocksSize = this.block.blocks.length;\n this.block.type = type;\n this.block.value = value;\n\n this.buffer.set();\n this.selection.save();\n\n this.block.set(tag);\n\n this.selection.restore();\n this.code.sync();\n this.observe.load();\n },\n set: function (tag) {\n this.selection.get();\n this.block.containerTag = this.range.commonAncestorContainer.tagName;\n\n if (this.range.collapsed) {\n this.block.setCollapsed(tag);\n } else {\n this.block.setMultiple(tag);\n }\n },\n setCollapsed: function (tag) {\n if (this.opts.linebreaks && this.block.isEmpty && tag != \"p\") {\n var node = document.createElement(tag);\n this.$editor.html(node);\n this.caret.setEnd(node);\n\n return;\n }\n\n var block = this.block.blocks[0];\n if (block === false) return;\n\n if (block.tagName == \"LI\") {\n if (tag != \"blockquote\") return;\n\n this.block.formatListToBlockquote();\n return;\n }\n\n var isContainerTable =\n this.block.containerTag == \"TD\" || this.block.containerTag == \"TH\";\n if (isContainerTable && !this.opts.linebreaks) {\n document.execCommand(\"formatblock\", false, \"<\" + tag + \">\");\n\n block = this.selection.getBlock();\n this.block.toggle($(block));\n } else if (block.tagName.toLowerCase() != tag) {\n if (this.opts.linebreaks && tag == \"p\") {\n $(block).append(\"
\");\n this.utils.replaceWithContents(block);\n } else {\n var $formatted = this.utils.replaceToTag(block, tag);\n\n this.block.toggle($formatted);\n\n if (tag != \"p\" && tag != \"blockquote\")\n $formatted.find(\"img\").remove();\n if (this.block.isRemoveInline)\n this.utils.removeInlineTags($formatted);\n if (tag == \"p\" || this.block.headTag)\n $formatted.find(\"p\").contents().unwrap();\n\n this.block.formatTableWrapping($formatted);\n }\n } else if (\n tag == \"blockquote\" &&\n block.tagName.toLowerCase() == tag\n ) {\n // blockquote off\n if (this.opts.linebreaks) {\n $(block).append(\"
\");\n this.utils.replaceWithContents(block);\n } else {\n var $el = this.utils.replaceToTag(block, \"p\");\n this.block.toggle($el);\n }\n } else if (block.tagName.toLowerCase() == tag) {\n this.block.toggle($(block));\n }\n\n if (\n typeof this.block.type == \"undefined\" &&\n typeof this.block.value == \"undefined\"\n ) {\n $(block).removeAttr(\"class\").removeAttr(\"style\");\n }\n },\n setMultiple: function (tag) {\n var block = this.block.blocks[0];\n\n var isContainerTable =\n this.block.containerTag == \"TD\" || this.block.containerTag == \"TH\";\n\n if (block !== false && this.block.blocksSize === 1) {\n if (block.tagName.toLowerCase() == tag && tag == \"blockquote\") {\n // blockquote off\n if (this.opts.linebreaks) {\n $(block).append(\"
\");\n this.utils.replaceWithContents(block);\n } else {\n var $el = this.utils.replaceToTag(block, \"p\");\n this.block.toggle($el);\n }\n } else if (block.tagName == \"LI\") {\n if (tag != \"blockquote\") return;\n\n this.block.formatListToBlockquote();\n } else if (this.block.containerTag == \"BLOCKQUOTE\") {\n this.block.formatBlockquote(tag);\n } else if (\n this.opts.linebreaks &&\n (isContainerTable || this.range.commonAncestorContainer != block)\n ) {\n this.block.formatWrap(tag);\n } else {\n if (this.opts.linebreaks && tag == \"p\") {\n $(block).prepend(\"
\").append(\"
\");\n this.utils.replaceWithContents(block);\n } else if (block.tagName === \"TD\") {\n this.block.formatWrap(tag);\n } else {\n var $formatted = this.utils.replaceToTag(block, tag);\n\n this.block.toggle($formatted);\n\n if (this.block.isRemoveInline)\n this.utils.removeInlineTags($formatted);\n if (tag == \"p\" || this.block.headTag)\n $formatted.find(\"p\").contents().unwrap();\n }\n }\n } else {\n if (this.opts.linebreaks || tag != \"p\") {\n if (tag == \"blockquote\") {\n var count = 0;\n for (var i = 0; i < this.block.blocksSize; i++) {\n if (this.block.blocks[i].tagName == \"BLOCKQUOTE\") count++;\n }\n\n // only blockquote selected\n if (count == this.block.blocksSize) {\n $.each(\n this.block.blocks,\n $.proxy(function (i, s) {\n var $formatted = false;\n if (this.opts.linebreaks) {\n $(s).prepend(\"
\").append(\"
\");\n $formatted = this.utils.replaceWithContents(s);\n } else {\n $formatted = this.utils.replaceToTag(s, \"p\");\n }\n\n if (\n $formatted &&\n typeof this.block.type == \"undefined\" &&\n typeof this.block.value == \"undefined\"\n ) {\n $formatted.removeAttr(\"class\").removeAttr(\"style\");\n }\n }, this)\n );\n\n return;\n }\n }\n\n this.block.formatWrap(tag);\n } else {\n var classSize = 0;\n var toggleType = false;\n if (this.block.type == \"class\") {\n toggleType = \"toggle\";\n classSize = $(this.block.blocks).filter(\n \".\" + this.block.value\n ).length;\n\n if (this.block.blocksSize == classSize) toggleType = \"toggle\";\n else if (this.block.blocksSize > classSize) toggleType = \"set\";\n else if (classSize === 0) toggleType = \"set\";\n }\n\n var exceptTags = [\"ul\", \"ol\", \"li\", \"td\", \"th\", \"dl\", \"dt\", \"dd\"];\n $.each(\n this.block.blocks,\n $.proxy(function (i, s) {\n if ($.inArray(s.tagName.toLowerCase(), exceptTags) != -1)\n return;\n\n var $formatted = this.utils.replaceToTag(s, tag);\n\n if (toggleType) {\n if (toggleType == \"toggle\") this.block.toggle($formatted);\n else if (toggleType == \"remove\")\n this.block.remove($formatted);\n else if (toggleType == \"set\")\n this.block.setForce($formatted);\n } else this.block.toggle($formatted);\n\n if (tag != \"p\" && tag != \"blockquote\")\n $formatted.find(\"img\").remove();\n if (this.block.isRemoveInline)\n this.utils.removeInlineTags($formatted);\n if (tag == \"p\" || this.block.headTag)\n $formatted.find(\"p\").contents().unwrap();\n\n if (\n typeof this.block.type == \"undefined\" &&\n typeof this.block.value == \"undefined\"\n ) {\n $formatted.removeAttr(\"class\").removeAttr(\"style\");\n }\n }, this)\n );\n }\n }\n },\n setForce: function ($el) {\n // remove style and class if the specified setting\n if (this.block.clearStyle) {\n $el.removeAttr(\"class\").removeAttr(\"style\");\n }\n\n if (this.block.type == \"class\") {\n $el.addClass(this.block.value);\n return;\n } else if (this.block.type == \"attr\" || this.block.type == \"data\") {\n $el.attr(this.block.value.name, this.block.value.value);\n return;\n }\n },\n toggle: function ($el) {\n // remove style and class if the specified setting\n if (this.block.clearStyle) {\n $el.removeAttr(\"class\").removeAttr(\"style\");\n }\n\n if (this.block.type == \"class\") {\n $el.toggleClass(this.block.value);\n return;\n } else if (this.block.type == \"attr\" || this.block.type == \"data\") {\n if ($el.attr(this.block.value.name) == this.block.value.value) {\n $el.removeAttr(this.block.value.name);\n } else {\n $el.attr(this.block.value.name, this.block.value.value);\n }\n\n return;\n } else {\n $el.removeAttr(\"style class\");\n return;\n }\n },\n remove: function ($el) {\n $el.removeClass(this.block.value);\n },\n formatListToBlockquote: function () {\n var block = $(this.block.blocks[0]).closest(\n \"ul, ol\",\n this.$editor[0]\n );\n\n $(block).find(\"ul, ol\").contents().unwrap();\n $(block).find(\"li\").append($(\"
\")).contents().unwrap();\n\n var $el = this.utils.replaceToTag(block, \"blockquote\");\n this.block.toggle($el);\n },\n formatBlockquote: function (tag) {\n document.execCommand(\"outdent\");\n document.execCommand(\"formatblock\", false, tag);\n\n this.clean.clearUnverified();\n this.$editor.find(\"p:empty\").remove();\n\n var formatted = this.selection.getBlock();\n\n if (tag != \"p\") {\n $(formatted).find(\"img\").remove();\n }\n\n if (!this.opts.linebreaks) {\n this.block.toggle($(formatted));\n }\n\n this.$editor\n .find(\"ul, ol, tr, blockquote, p\")\n .each($.proxy(this.utils.removeEmpty, this));\n\n if (this.opts.linebreaks && tag == \"p\") {\n this.utils.replaceWithContents(formatted);\n }\n },\n formatWrap: function (tag) {\n if (\n this.block.containerTag == \"UL\" ||\n this.block.containerTag == \"OL\"\n ) {\n if (tag == \"blockquote\") {\n this.block.formatListToBlockquote();\n } else {\n return;\n }\n }\n\n var formatted = this.selection.wrap(tag);\n if (formatted === false) return;\n\n var $formatted = $(formatted);\n\n this.block.formatTableWrapping($formatted);\n\n var $elements = $formatted.find(\n this.opts.blockLevelElements.join(\",\") +\n \", td, table, thead, tbody, tfoot, th, tr\"\n );\n\n $elements.contents().unwrap();\n\n if (tag != \"p\" && tag != \"blockquote\")\n $formatted.find(\"img\").remove();\n\n $.each(this.block.blocks, $.proxy(this.utils.removeEmpty, this));\n\n $formatted.append(this.selection.getMarker(2));\n\n if (!this.opts.linebreaks) {\n this.block.toggle($formatted);\n }\n\n this.$editor\n .find(\"ul, ol, tr, blockquote, p\")\n .each($.proxy(this.utils.removeEmpty, this));\n $formatted.find(\"blockquote:empty\").remove();\n\n if (this.block.isRemoveInline) {\n this.utils.removeInlineTags($formatted);\n }\n\n if (this.opts.linebreaks && tag == \"p\") {\n this.utils.replaceWithContents($formatted);\n }\n\n if (this.opts.linebreaks) {\n var $next = $formatted.next().next();\n if ($next.size() != 0 && $next[0].tagName === \"BR\") {\n $next.remove();\n }\n }\n },\n formatTableWrapping: function ($formatted) {\n if ($formatted.closest(\"table\", this.$editor[0]).length === 0) return;\n\n if ($formatted.closest(\"tr\", this.$editor[0]).length === 0)\n $formatted.wrap(\"\");\n if (\n $formatted.closest(\"td\", this.$editor[0]).length === 0 &&\n $formatted.closest(\"th\").length === 0\n ) {\n $formatted.wrap(\"\");\n }\n },\n removeData: function (name, value) {\n var blocks = this.selection.getBlocks();\n $(blocks).removeAttr(\"data-\" + name);\n\n this.code.sync();\n },\n setData: function (name, value) {\n var blocks = this.selection.getBlocks();\n $(blocks).attr(\"data-\" + name, value);\n\n this.code.sync();\n },\n toggleData: function (name, value) {\n var blocks = this.selection.getBlocks();\n $.each(blocks, function () {\n if ($(this).attr(\"data-\" + name)) {\n $(this).removeAttr(\"data-\" + name);\n } else {\n $(this).attr(\"data-\" + name, value);\n }\n });\n },\n removeAttr: function (attr, value) {\n var blocks = this.selection.getBlocks();\n $(blocks).removeAttr(attr);\n\n this.code.sync();\n },\n setAttr: function (attr, value) {\n var blocks = this.selection.getBlocks();\n $(blocks).attr(attr, value);\n\n this.code.sync();\n },\n toggleAttr: function (attr, value) {\n var blocks = this.selection.getBlocks();\n $.each(blocks, function () {\n if ($(this).attr(name)) {\n $(this).removeAttr(name);\n } else {\n $(this).attr(name, value);\n }\n });\n },\n removeClass: function (className) {\n var blocks = this.selection.getBlocks();\n $(blocks).removeClass(className);\n\n this.utils.removeEmptyAttr(blocks, \"class\");\n\n this.code.sync();\n },\n setClass: function (className) {\n var blocks = this.selection.getBlocks();\n $(blocks).addClass(className);\n\n this.code.sync();\n },\n toggleClass: function (className) {\n var blocks = this.selection.getBlocks();\n $(blocks).toggleClass(className);\n\n this.code.sync();\n },\n };\n },\n buffer: function () {\n return {\n set: function (type) {\n if (typeof type == \"undefined\" || type == \"undo\") {\n this.buffer.setUndo();\n } else {\n this.buffer.setRedo();\n }\n },\n setUndo: function () {\n this.selection.save();\n this.opts.buffer.push(this.$editor.html());\n this.selection.restore();\n },\n setRedo: function () {\n this.selection.save();\n this.opts.rebuffer.push(this.$editor.html());\n this.selection.restore();\n },\n getUndo: function () {\n this.$editor.html(this.opts.buffer.pop());\n },\n getRedo: function () {\n this.$editor.html(this.opts.rebuffer.pop());\n },\n add: function () {\n this.opts.buffer.push(this.$editor.html());\n },\n undo: function () {\n if (this.opts.buffer.length === 0) return;\n\n this.buffer.set(\"redo\");\n this.buffer.getUndo();\n\n this.selection.restore();\n\n setTimeout($.proxy(this.observe.load, this), 50);\n },\n redo: function () {\n if (this.opts.rebuffer.length === 0) return;\n\n this.buffer.set(\"undo\");\n this.buffer.getRedo();\n\n this.selection.restore();\n\n setTimeout($.proxy(this.observe.load, this), 50);\n },\n };\n },\n build: function () {\n return {\n focused: false,\n blured: true,\n run: function () {\n this.build.createContainerBox();\n this.build.loadContent();\n this.build.loadEditor();\n this.build.enableEditor();\n this.build.setCodeAndCall();\n },\n isTextarea: function () {\n return this.$element[0].tagName === \"TEXTAREA\";\n },\n createContainerBox: function () {\n this.$box = $('');\n },\n createTextarea: function () {\n this.$textarea = $(\"\").attr(\n \"name\",\n this.build.getTextareaName()\n );\n },\n getTextareaName: function () {\n return typeof name == \"undefined\"\n ? \"content-\" + this.uuid\n : this.$element.attr(\"id\");\n },\n loadContent: function () {\n var func = this.build.isTextarea() ? \"val\" : \"html\";\n this.content = $.trim(this.$element[func]());\n },\n enableEditor: function () {\n this.$editor.attr({\n contenteditable: true,\n dir: this.opts.direction,\n });\n },\n loadEditor: function () {\n var func = this.build.isTextarea() ? \"fromTextarea\" : \"fromElement\";\n this.build[func]();\n },\n fromTextarea: function () {\n this.$editor = $(\"\");\n this.$textarea = this.$element;\n this.$box\n .insertAfter(this.$element)\n .append(this.$editor)\n .append(this.$element);\n this.$editor.addClass(\"redactor-editor\");\n\n this.$element.hide();\n },\n fromElement: function () {\n this.$editor = this.$element;\n this.build.createTextarea();\n this.$box\n .insertAfter(this.$editor)\n .append(this.$editor)\n .append(this.$textarea);\n this.$editor.addClass(\"redactor-editor\");\n\n this.$textarea.hide();\n },\n setCodeAndCall: function () {\n // set code\n this.code.set(this.content);\n\n this.build.setOptions();\n this.build.callEditor();\n\n // code mode\n if (this.opts.visual) return;\n setTimeout($.proxy(this.code.showCode, this), 200);\n },\n callEditor: function () {\n this.build.disableMozillaEditing();\n this.build.disableIeLinks();\n this.build.setEvents();\n this.build.setHelpers();\n\n // load toolbar\n if (this.opts.toolbar) {\n this.opts.toolbar = this.toolbar.init();\n this.toolbar.build();\n }\n\n // modal templates init\n this.modal.loadTemplates();\n\n // plugins\n this.build.plugins();\n\n // observers\n setTimeout($.proxy(this.observe.load, this), 4);\n\n // init callback\n this.core.setCallback(\"init\");\n },\n setOptions: function () {\n // textarea direction\n $(this.$textarea).attr(\"dir\", this.opts.direction);\n\n if (this.opts.linebreaks)\n this.$editor.addClass(\"redactor-linebreaks\");\n\n if (this.opts.tabindex)\n this.$editor.attr(\"tabindex\", this.opts.tabindex);\n\n if (this.opts.minHeight)\n this.$editor.css(\"minHeight\", this.opts.minHeight);\n if (this.opts.maxHeight)\n this.$editor.css(\"maxHeight\", this.opts.maxHeight);\n },\n setEventDropUpload: function (e) {\n e.preventDefault();\n\n if (!this.opts.dragImageUpload && !this.opts.dragFileUpload) return;\n if (this.opts.imageUpload === null && this.opts.fileUpload === null)\n return;\n\n var files = e.dataTransfer.files;\n this.upload.directUpload(files[0], e);\n },\n setEventDrop: function (e) {\n // COMFY FIX\n // Adding ability to drag-n-drop file links\n var text = e.dataTransfer.getData(\"text/plain\");\n if (text) this.insert.html(text, false);\n // END COMFY FIX\n\n this.code.sync();\n setTimeout(this.clean.clearUnverified, 1);\n this.core.setCallback(\"drop\", e);\n },\n setEvents: function () {\n // drop\n this.$editor.on(\"dragover.redactor dragenter.redactor\", function (e) {\n e.preventDefault();\n e.stopPropagation();\n });\n\n this.$editor.on(\n \"drop.redactor\",\n $.proxy(function (e) {\n e = e.originalEvent || e;\n\n if (window.FormData === undefined || !e.dataTransfer) return true;\n\n if (e.dataTransfer.files.length === 0) {\n return this.build.setEventDrop(e);\n } else {\n this.build.setEventDropUpload(e);\n }\n\n setTimeout(this.clean.clearUnverified, 1);\n this.core.setCallback(\"drop\", e);\n }, this)\n );\n\n // click\n this.$editor.on(\n \"click.redactor\",\n $.proxy(function (e) {\n var event = this.core.getEvent();\n var type = event == \"click\" || event == \"arrow\" ? false : \"click\";\n\n this.core.addEvent(type);\n this.utils.disableSelectAll();\n this.core.setCallback(\"click\", e);\n }, this)\n );\n\n // paste\n this.$editor.on(\"paste.redactor\", $.proxy(this.paste.init, this));\n\n // cut\n this.$editor.on(\"cut.redactor\", $.proxy(this.code.sync, this));\n\n // keydown\n this.$editor.on(\"keydown.redactor\", $.proxy(this.keydown.init, this));\n\n // keyup\n this.$editor.on(\"keyup.redactor\", $.proxy(this.keyup.init, this));\n\n // textarea keydown\n if ($.isFunction(this.opts.codeKeydownCallback)) {\n this.$textarea.on(\n \"keydown.redactor-textarea\",\n $.proxy(this.opts.codeKeydownCallback, this)\n );\n }\n\n // textarea keyup\n if ($.isFunction(this.opts.codeKeyupCallback)) {\n this.$textarea.on(\n \"keyup.redactor-textarea\",\n $.proxy(this.opts.codeKeyupCallback, this)\n );\n }\n\n // focus\n this.$editor.on(\n \"focus.redactor\",\n $.proxy(function (e) {\n if ($.isFunction(this.opts.focusCallback)) {\n this.core.setCallback(\"focus\", e);\n }\n\n this.build.focused = true;\n this.build.blured = false;\n\n if (this.selection.getCurrent() === false) {\n this.selection.get();\n this.range.setStart(this.$editor[0], 0);\n this.range.setEnd(this.$editor[0], 0);\n this.selection.addRange();\n }\n }, this)\n );\n\n // blur\n $(document).on(\n \"mousedown.redactor-blur.\" + this.uuid,\n $.proxy(function (e) {\n if (this.start) return;\n if (this.rtePaste) return;\n\n if (\n $(e.target).closest(\n \".redactor-editor, .redactor-toolbar, .redactor-dropdown\"\n ).length !== 0\n ) {\n return;\n }\n\n this.utils.disableSelectAll();\n if (!this.build.blured && $.isFunction(this.opts.blurCallback)) {\n this.core.setCallback(\"blur\", e);\n }\n\n this.build.focused = false;\n this.build.blured = true;\n }, this)\n );\n },\n setHelpers: function () {\n // linkify\n if (this.linkify.isEnabled()) {\n this.linkify.format();\n }\n\n // placeholder\n this.placeholder.enable();\n\n // focus\n if (this.opts.focus) setTimeout(this.focus.setStart, 100);\n if (this.opts.focusEnd) setTimeout(this.focus.setEnd, 100);\n },\n plugins: function () {\n if (!this.opts.plugins) return;\n\n $.each(\n this.opts.plugins,\n $.proxy(function (i, s) {\n var func =\n typeof RedactorPlugins !== \"undefined\" &&\n typeof RedactorPlugins[s] !== \"undefined\"\n ? RedactorPlugins\n : Redactor.fn;\n\n if (!$.isFunction(func[s])) {\n return;\n }\n\n this[s] = func[s]();\n\n // get methods\n var methods = this.getModuleMethods(this[s]);\n var len = methods.length;\n\n // bind methods\n for (var z = 0; z < len; z++) {\n this[s][methods[z]] = this[s][methods[z]].bind(this);\n }\n\n if ($.isFunction(this[s].init)) {\n this[s].init();\n }\n }, this)\n );\n },\n disableMozillaEditing: function () {\n if (!this.utils.browser(\"mozilla\")) return;\n\n // FF fix\n try {\n document.execCommand(\"enableObjectResizing\", false, false);\n document.execCommand(\"enableInlineTableEditing\", false, false);\n } catch (e) {}\n },\n disableIeLinks: function () {\n if (!this.utils.browser(\"msie\")) return;\n\n // IE prevent converting links\n document.execCommand(\"AutoUrlDetect\", false, false);\n },\n };\n },\n button: function () {\n return {\n build: function (btnName, btnObject) {\n var $button = $(\n ''\n ).attr({\n role: \"button\",\n \"aria-label\": btnObject.title,\n tabindex: \"-1\",\n });\n\n // click\n if (btnObject.func || btnObject.command || btnObject.dropdown) {\n this.button.setEvent($button, btnName, btnObject);\n }\n\n // dropdown\n if (btnObject.dropdown) {\n $button\n .addClass(\"redactor-toolbar-link-dropdown\")\n .attr(\"aria-haspopup\", true);\n\n var $dropdown = $(\n ''\n );\n $button.data(\"dropdown\", $dropdown);\n this.dropdown.build(btnName, $dropdown, btnObject.dropdown);\n }\n\n // tooltip\n if (this.utils.isDesktop()) {\n this.button.createTooltip($button, btnName, btnObject.title);\n }\n\n return $button;\n },\n setEvent: function ($button, btnName, btnObject) {\n $button.on(\n \"touchstart click\",\n $.proxy(function (e) {\n if ($button.hasClass(\"redactor-button-disabled\")) return false;\n\n var type = \"func\";\n var callback = btnObject.func;\n\n if (btnObject.command) {\n type = \"command\";\n callback = btnObject.command;\n } else if (btnObject.dropdown) {\n type = \"dropdown\";\n callback = false;\n }\n\n this.button.onClick(e, btnName, type, callback);\n }, this)\n );\n },\n createTooltip: function ($button, name, title) {\n var $tooltip = $(\" \")\n .addClass(\n \"redactor-toolbar-tooltip redactor-toolbar-tooltip-\" +\n this.uuid +\n \" redactor-toolbar-tooltip-\" +\n name\n )\n .hide()\n .html(title);\n $tooltip.appendTo(\"body\");\n\n $button.on(\"mouseover\", function () {\n if ($(this).hasClass(\"redactor-button-disabled\")) {\n return;\n }\n\n var pos = $button.offset();\n\n $tooltip.css({\n top: pos.top + $button.innerHeight() + \"px\",\n left:\n pos.left +\n $button.innerWidth() / 2 -\n $tooltip.innerWidth() / 2 +\n \"px\",\n });\n $tooltip.show();\n });\n\n $button.on(\"mouseout\", function () {\n $tooltip.hide();\n });\n },\n onClick: function (e, btnName, type, callback) {\n this.button.caretOffset = this.caret.getOffset();\n\n e.preventDefault();\n\n $(document).find(\".redactor-toolbar-tooltip\").hide();\n\n if (this.utils.browser(\"msie\")) e.returnValue = false;\n\n if (type == \"command\") this.inline.format(callback);\n else if (type == \"dropdown\") this.dropdown.show(e, btnName);\n else this.button.onClickCallback(e, callback, btnName);\n },\n onClickCallback: function (e, callback, btnName) {\n var func;\n\n if ($.isFunction(callback)) callback.call(this, btnName);\n else if (callback.search(/\\./) != \"-1\") {\n func = callback.split(\".\");\n if (typeof this[func[0]] == \"undefined\") return;\n\n this[func[0]][func[1]](btnName);\n } else this[callback](btnName);\n\n this.observe.buttons(e, btnName);\n },\n get: function (key) {\n return this.$toolbar.find(\"a.re-\" + key);\n },\n setActive: function (key) {\n this.button.get(key).addClass(\"redactor-act\");\n },\n setInactive: function (key) {\n this.button.get(key).removeClass(\"redactor-act\");\n },\n setInactiveAll: function (key) {\n if (typeof key === \"undefined\") {\n this.$toolbar.find(\"a.re-icon\").removeClass(\"redactor-act\");\n } else {\n this.$toolbar\n .find(\"a.re-icon\")\n .not(\".re-\" + key)\n .removeClass(\"redactor-act\");\n }\n },\n setActiveInVisual: function () {\n this.$toolbar\n .find(\"a.re-icon\")\n .not(\"a.re-html, a.re-fullscreen\")\n .removeClass(\"redactor-button-disabled\");\n },\n setInactiveInCode: function () {\n this.$toolbar\n .find(\"a.re-icon\")\n .not(\"a.re-html, a.re-fullscreen\")\n .addClass(\"redactor-button-disabled\");\n },\n changeIcon: function (key, classname) {\n this.button.get(key).addClass(\"re-\" + classname);\n },\n removeIcon: function (key, classname) {\n this.button.get(key).removeClass(\"re-\" + classname);\n },\n setAwesome: function (key, name) {\n var $button = this.button.get(key);\n $button.removeClass(\"redactor-btn-image\").addClass(\"fa-redactor-btn\");\n $button.html('');\n },\n addCallback: function ($btn, callback) {\n if ($btn == \"buffer\") return;\n\n var type = callback == \"dropdown\" ? \"dropdown\" : \"func\";\n var key = $btn.attr(\"rel\");\n $btn.on(\n \"touchstart click\",\n $.proxy(function (e) {\n if ($btn.hasClass(\"redactor-button-disabled\")) return false;\n this.button.onClick(e, key, type, callback);\n }, this)\n );\n },\n addDropdown: function ($btn, dropdown) {\n $btn\n .addClass(\"redactor-toolbar-link-dropdown\")\n .attr(\"aria-haspopup\", true);\n\n var key = $btn.attr(\"rel\");\n this.button.addCallback($btn, \"dropdown\");\n\n var $dropdown = $(\n ''\n );\n $btn.data(\"dropdown\", $dropdown);\n\n // build dropdown\n if (dropdown) this.dropdown.build(key, $dropdown, dropdown);\n\n return $dropdown;\n },\n add: function (key, title) {\n if (!this.opts.toolbar) return;\n\n if (this.button.isMobileUndoRedo(key)) return \"buffer\";\n\n var btn = this.button.build(key, { title: title });\n btn.addClass(\"redactor-btn-image\");\n\n this.$toolbar.append($(\" \").append(btn));\n\n return btn;\n },\n addFirst: function (key, title) {\n if (!this.opts.toolbar) return;\n\n if (this.button.isMobileUndoRedo(key)) return \"buffer\";\n\n var btn = this.button.build(key, { title: title });\n btn.addClass(\"redactor-btn-image\");\n this.$toolbar.prepend($(\"\").append(btn));\n\n return btn;\n },\n addAfter: function (afterkey, key, title) {\n if (!this.opts.toolbar) return;\n\n if (this.button.isMobileUndoRedo(key)) return \"buffer\";\n\n var btn = this.button.build(key, { title: title });\n btn.addClass(\"redactor-btn-image\");\n var $btn = this.button.get(afterkey);\n\n if ($btn.length !== 0) $btn.parent().after($(\"\").append(btn));\n else this.$toolbar.append($(\"\").append(btn));\n\n return btn;\n },\n addBefore: function (beforekey, key, title) {\n if (!this.opts.toolbar) return;\n\n if (this.button.isMobileUndoRedo(key)) return \"buffer\";\n\n var btn = this.button.build(key, { title: title });\n btn.addClass(\"redactor-btn-image\");\n var $btn = this.button.get(beforekey);\n\n if ($btn.length !== 0) $btn.parent().before($(\"\").append(btn));\n else this.$toolbar.append($(\"\").append(btn));\n\n return btn;\n },\n remove: function (key) {\n this.button.get(key).remove();\n },\n isMobileUndoRedo: function (key) {\n return (key == \"undo\" || key == \"redo\") && !this.utils.isDesktop();\n },\n };\n },\n caret: function () {\n return {\n setStart: function (node) {\n // inline tag\n if (!this.utils.isBlock(node)) {\n var space = this.utils.createSpaceElement();\n\n $(node).prepend(space);\n this.caret.setEnd(space);\n } else {\n this.caret.set(node, 0, node, 0);\n }\n },\n setEnd: function (node) {\n node = node[0] || node;\n if (node.lastChild.nodeType == 1) {\n return this.caret.setAfter(node.lastChild);\n }\n\n this.caret.set(node, 1, node, 1);\n },\n set: function (orgn, orgo, focn, foco) {\n // focus\n // disabled in 10.0.7\n // if (!this.utils.browser('msie')) this.$editor.focus();\n\n orgn = orgn[0] || orgn;\n focn = focn[0] || focn;\n\n if (this.utils.isBlockTag(orgn.tagName) && orgn.innerHTML === \"\") {\n orgn.innerHTML = this.opts.invisibleSpace;\n }\n\n if (orgn.tagName == \"BR\" && this.opts.linebreaks === false) {\n var parent = $(this.opts.emptyHtml)[0];\n $(orgn).replaceWith(parent);\n orgn = parent;\n focn = orgn;\n }\n\n this.selection.get();\n\n try {\n this.range.setStart(orgn, orgo);\n this.range.setEnd(focn, foco);\n } catch (e) {}\n\n this.selection.addRange();\n },\n setAfter: function (node) {\n try {\n var tag = $(node)[0].tagName;\n\n // inline tag\n if (tag != \"BR\" && !this.utils.isBlock(node)) {\n var space = this.utils.createSpaceElement();\n\n $(node).after(space);\n this.caret.setEnd(space);\n } else {\n if (tag != \"BR\" && this.utils.browser(\"msie\")) {\n this.caret.setStart($(node).next());\n } else {\n this.caret.setAfterOrBefore(node, \"after\");\n }\n }\n } catch (e) {\n var space = this.utils.createSpaceElement();\n $(node).after(space);\n this.caret.setEnd(space);\n }\n },\n setBefore: function (node) {\n // block tag\n if (this.utils.isBlock(node)) {\n this.caret.setEnd($(node).prev());\n } else {\n this.caret.setAfterOrBefore(node, \"before\");\n }\n },\n setAfterOrBefore: function (node, type) {\n // focus\n if (!this.utils.browser(\"msie\")) this.$editor.focus();\n\n node = node[0] || node;\n\n this.selection.get();\n\n if (type == \"after\") {\n try {\n this.range.setStartAfter(node);\n this.range.setEndAfter(node);\n } catch (e) {}\n } else {\n try {\n this.range.setStartBefore(node);\n this.range.setEndBefore(node);\n } catch (e) {}\n }\n\n this.range.collapse(false);\n this.selection.addRange();\n },\n getOffsetOfElement: function (node) {\n node = node[0] || node;\n\n this.selection.get();\n\n var cloned = this.range.cloneRange();\n cloned.selectNodeContents(node);\n cloned.setEnd(this.range.endContainer, this.range.endOffset);\n\n return $.trim(cloned.toString()).length;\n },\n getOffset: function () {\n var offset = 0;\n var sel = window.getSelection();\n\n if (sel.rangeCount > 0) {\n var range = window.getSelection().getRangeAt(0);\n var caretRange = range.cloneRange();\n caretRange.selectNodeContents(this.$editor[0]);\n caretRange.setEnd(range.endContainer, range.endOffset);\n offset = caretRange.toString().length;\n }\n\n return offset;\n },\n setOffset: function (start, end) {\n if (typeof end == \"undefined\") end = start;\n if (!this.focus.isFocused()) this.focus.setStart();\n\n var sel = this.selection.get();\n var node,\n offset = 0;\n var walker = document.createTreeWalker(\n this.$editor[0],\n NodeFilter.SHOW_TEXT,\n null,\n null\n );\n\n while ((node = walker.nextNode())) {\n offset += node.nodeValue.length;\n if (offset > start) {\n this.range.setStart(node, node.nodeValue.length + start - offset);\n start = Infinity;\n }\n\n if (offset >= end) {\n this.range.setEnd(node, node.nodeValue.length + end - offset);\n break;\n }\n }\n\n this.range.collapse(false);\n this.selection.addRange();\n },\n // deprecated\n setToPoint: function (start, end) {\n this.caret.setOffset(start, end);\n },\n getCoords: function () {\n return this.caret.getOffset();\n },\n };\n },\n clean: function () {\n return {\n onSet: function (html) {\n html = this.clean.savePreCode(html);\n\n // convert script tag\n html = html.replace(\n /\"\n );\n\n // restore form tag\n html = this.clean.restoreFormTags(html);\n\n var chars = {\n \"\\u2122\": \"™\",\n \"\\u00a9\": \"©\",\n \"\\u2026\": \"…\",\n \"\\u2014\": \"—\",\n \"\\u2010\": \"‐\",\n };\n // replace special characters\n $.each(chars, function (i, s) {\n html = html.replace(new RegExp(i, \"g\"), s);\n });\n\n // remove last br in FF\n if (this.utils.browser(\"mozilla\")) {\n html = html.replace(/ $/gi, \"\");\n }\n\n // remove br in|of li tags\n html = html.replace(new RegExp(\"
\", \"gi\"), \"\");\n html = html.replace(new RegExp(\" \", \"gi\"), \"\");\n\n // remove empty attributes\n html = html.replace(/<(.*?)rel=\"\\s*?\"(.*?[^>]?)>/gi, '<$1$2\">');\n html = html.replace(/<(.*?)style=\"\\s*?\"(.*?[^>]?)>/gi, '<$1$2\">');\n html = html.replace(/=\"\">/gi, \">\");\n html = html.replace(/\"\"\">/gi, '\">');\n html = html.replace(/\"\">/gi, '\">');\n\n // remove verified\n html = html.replace(\n / ])>/gi,\n \" \"\n );\n html = html.replace(\n /<(.*?) data-verified=\"redactor\"(.*?[^>])>/gi,\n \"<$1$2>\"\n );\n\n var $div = $(\" \").html($.parseHTML(html, document, true));\n $div.find(\"span\").removeAttr(\"rel\");\n\n $div.find(\"pre .redactor-invisible-space\").each(function () {\n $(this).contents().unwrap();\n });\n\n html = $div.html();\n\n // remove rel attribute from img\n html = html.replace(\n / ])rel=\"(.*?[^>])\"(.*?[^>])>/gi,\n \" \"\n );\n html = html.replace(\n / (.*?)<\\/span>/gi,\n \"$1\"\n );\n\n html = html.replace(/ data-save-url=\"(.*?[^>])\"/gi, \"\");\n\n // remove image resize\n html = html.replace(\n /])>([\\w\\W]*?)<\\/span>/gi,\n \"$3\"\n );\n html = html.replace(\n /])>(.*?)<\\/span>/gi,\n \"\"\n );\n html = html.replace(\n /])>(.*?)<\\/span>/gi,\n \"\"\n );\n\n // remove font tag\n html = html.replace(//gi, \"\");\n html = html.replace(/<\\/font>/gi, \"\");\n\n // tidy html\n html = this.tidy.load(html);\n\n // link nofollow\n if (this.opts.linkNofollow) {\n html = html.replace(/])>/gi, \"\");\n html = html.replace(/])>/gi, '');\n }\n\n // reconvert inline\n html = html.replace(\n /\\sdata-redactor-(tag|class|style)=\"(.*?[^>])\"/gi,\n \"\"\n );\n html = html.replace(\n new RegExp('<(.*?) data-verified=\"redactor\"(.*?[^>])>', \"gi\"),\n \"<$1$2>\"\n );\n html = html.replace(\n new RegExp('<(.*?) data-verified=\"redactor\">', \"gi\"),\n \"<$1>\"\n );\n\n html = html.replace(/&/g, \"&\");\n\n return html;\n },\n onPaste: function (html, setMode) {\n html = $.trim(html);\n html = html.replace(/\\$/g, \"$\");\n\n // convert dirty spaces\n html = html.replace(//gi, \"\");\n html = html.replace(\n / <\\/span>/gi,\n \" \"\n );\n html = html.replace(\n /]*>\\t<\\/span>/gi,\n \"\\t\"\n );\n html = html.replace(/]*>(\\s| )<\\/span>/gi, \" \");\n\n if (this.opts.pastePlainText) {\n return this.clean.getPlainText(html);\n }\n\n if (!this.utils.isSelectAll() && typeof setMode == \"undefined\") {\n if (this.utils.isCurrentOrParent([\"FIGCAPTION\", \"A\"])) {\n return this.clean.getPlainText(html, false);\n }\n\n if (this.utils.isCurrentOrParent(\"PRE\")) {\n html = html.replace(/\u201D/g, '\"');\n html = html.replace(/\u201C/g, '\"');\n html = html.replace(/\u2018/g, \"'\");\n html = html.replace(/\u2019/g, \"'\");\n\n return this.clean.getPreCode(html);\n }\n\n if (\n this.utils.isCurrentOrParent([\n \"BLOCKQUOTE\",\n \"H1\",\n \"H2\",\n \"H3\",\n \"H4\",\n \"H5\",\n \"H6\",\n ])\n ) {\n html = this.clean.getOnlyImages(html);\n\n if (!this.utils.browser(\"msie\")) {\n var block = this.selection.getBlock();\n if (block && block.tagName == \"P\") {\n html = html.replace(//gi, \"\");\n }\n }\n\n return html;\n }\n\n if (this.utils.isCurrentOrParent([\"TD\"])) {\n html = this.clean.onPasteTidy(html, \"td\");\n\n if (this.opts.linebreaks)\n html = this.clean.replaceParagraphsToBr(html);\n\n html = this.clean.replaceDivsToBr(html);\n\n return html;\n }\n\n if (this.utils.isCurrentOrParent([\"LI\"])) {\n return this.clean.onPasteTidy(html, \"li\");\n }\n }\n\n html = this.clean.isSingleLine(html, setMode);\n\n if (!this.clean.singleLine) {\n if (this.opts.linebreaks)\n html = this.clean.replaceParagraphsToBr(html);\n if (this.opts.replaceDivs) html = this.clean.replaceDivs(html);\n\n html = this.clean.saveFormTags(html);\n }\n\n html = this.clean.onPasteWord(html);\n html = this.clean.onPasteExtra(html);\n\n html = this.clean.onPasteTidy(html, \"all\");\n\n // paragraphize\n if (!this.clean.singleLine && this.opts.paragraphize) {\n html = this.paragraphize.load(html);\n }\n\n html = this.clean.removeDirtyStyles(html);\n html = this.clean.onPasteRemoveSpans(html);\n html = this.clean.onPasteRemoveEmpty(html);\n\n html = this.clean.convertInline(html);\n\n return html;\n },\n onPasteWord: function (html) {\n // comments\n html = html.replace(//gi, \"\");\n\n // style\n html = html.replace(/ |