\n */\nexport const registerAppsSlideToggle = () => {\n\tlet buttons = $('[data-apps-slide-toggle]')\n\n\tif (buttons.length === 0) {\n\t\t$('#app-navigation').addClass('without-app-settings')\n\t}\n\n\t$(document).click(function(event) {\n\n\t\tif (dynamicSlideToggleEnabled) {\n\t\t\tbuttons = $('[data-apps-slide-toggle]')\n\t\t}\n\n\t\tbuttons.each(function(index, button) {\n\n\t\t\tconst areaSelector = $(button).data('apps-slide-toggle')\n\t\t\tconst area = $(areaSelector)\n\n\t\t\t/**\n\t\t\t *\n\t\t\t */\n\t\t\tfunction hideArea() {\n\t\t\t\tarea.slideUp(OC.menuSpeed * 4, function() {\n\t\t\t\t\tarea.trigger(new $.Event('hide'))\n\t\t\t\t})\n\t\t\t\tarea.removeClass('opened')\n\t\t\t\t$(button).removeClass('opened')\n\t\t\t\t$(button).attr('aria-expanded', 'false')\n\t\t\t}\n\n\t\t\t/**\n\t\t\t *\n\t\t\t */\n\t\t\tfunction showArea() {\n\t\t\t\tarea.slideDown(OC.menuSpeed * 4, function() {\n\t\t\t\t\tarea.trigger(new $.Event('show'))\n\t\t\t\t})\n\t\t\t\tarea.addClass('opened')\n\t\t\t\t$(button).addClass('opened')\n\t\t\t\t$(button).attr('aria-expanded', 'true')\n\t\t\t\tconst input = $(areaSelector + ' [autofocus]')\n\t\t\t\tif (input.length === 1) {\n\t\t\t\t\tinput.focus()\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// do nothing if the area is animated\n\t\t\tif (!area.is(':animated')) {\n\n\t\t\t\t// button toggles the area\n\t\t\t\tif ($(button).is($(event.target).closest('[data-apps-slide-toggle]'))) {\n\t\t\t\t\tif (area.is(':visible')) {\n\t\t\t\t\t\thideArea()\n\t\t\t\t\t} else {\n\t\t\t\t\t\tshowArea()\n\t\t\t\t\t}\n\n\t\t\t\t\t// all other areas that have not been clicked but are open\n\t\t\t\t\t// should be slid up\n\t\t\t\t} else {\n\t\t\t\t\tconst closest = $(event.target).closest(areaSelector)\n\t\t\t\t\tif (area.is(':visible') && closest[0] !== area[0]) {\n\t\t\t\t\t\thideArea()\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\n\t})\n}\n\nexport default Apps\n","/**\n * @copyright Copyright (c) 2016 Joas Schilling \n *\n * @author Christoph Wurst \n * @author John Molakvoæ \n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n */\n\nimport $ from 'jquery'\nimport { generateOcsUrl } from '@nextcloud/router'\n\nimport OC from '../OC/index.js'\n\n/**\n * @param {string} method 'post' or 'delete'\n * @param {string} endpoint endpoint\n * @param {object} [options] destructuring object\n * @param {object} [options.data] option data\n * @param {Function} [options.success] success callback\n * @param {Function} [options.error] error callback\n */\nfunction call(method, endpoint, options) {\n\tif ((method === 'post' || method === 'delete') && OC.PasswordConfirmation.requiresPasswordConfirmation()) {\n\t\tOC.PasswordConfirmation.requirePasswordConfirmation(_.bind(call, this, method, endpoint, options))\n\t\treturn\n\t}\n\n\toptions = options || {}\n\t$.ajax({\n\t\ttype: method.toUpperCase(),\n\t\turl: generateOcsUrl('apps/provisioning_api/api/v1/config/apps') + endpoint,\n\t\tdata: options.data || {},\n\t\tsuccess: options.success,\n\t\terror: options.error,\n\t})\n}\n\n/**\n * @param {object} [options] destructuring object\n * @param {Function} [options.success] success callback\n * @since 11.0.0\n */\nexport function getApps(options) {\n\tcall('get', '', options)\n}\n\n/**\n * @param {string} app app id\n * @param {object} [options] destructuring object\n * @param {Function} [options.success] success callback\n * @param {Function} [options.error] error callback\n * @since 11.0.0\n */\nexport function getKeys(app, options) {\n\tcall('get', '/' + app, options)\n}\n\n/**\n * @param {string} app app id\n * @param {string} key key\n * @param {string | Function} defaultValue default value\n * @param {object} [options] destructuring object\n * @param {Function} [options.success] success callback\n * @param {Function} [options.error] error callback\n * @since 11.0.0\n */\nexport function getValue(app, key, defaultValue, options) {\n\toptions = options || {}\n\toptions.data = {\n\t\tdefaultValue,\n\t}\n\n\tcall('get', '/' + app + '/' + key, options)\n}\n\n/**\n * @param {string} app app id\n * @param {string} key key\n * @param {string} value value\n * @param {object} [options] destructuring object\n * @param {Function} [options.success] success callback\n * @param {Function} [options.error] error callback\n * @since 11.0.0\n */\nexport function setValue(app, key, value, options) {\n\toptions = options || {}\n\toptions.data = {\n\t\tvalue,\n\t}\n\n\tcall('post', '/' + app + '/' + key, options)\n}\n\n/**\n * @param {string} app app id\n * @param {string} key key\n * @param {object} [options] destructuring object\n * @param {Function} [options.success] success callback\n * @param {Function} [options.error] error callback\n * @since 11.0.0\n */\nexport function deleteKey(app, key, options) {\n\tcall('delete', '/' + app + '/' + key, options)\n}\n","/**\n * @copyright Copyright (c) 2016 Joas Schilling \n *\n * @author Christoph Wurst \n * @author Joas Schilling \n * @author John Molakvoæ \n * @author Jörn Friedrich Dreyer \n * @author Robin Appelman \n * @author Vincent Petry \n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n */\n\n/* eslint-disable */\n import { getValue, setValue, getApps, getKeys, deleteKey } from '../OCP/appconfig.js'\n\nexport const appConfig = window.oc_appconfig || {}\n\n/**\n * @namespace\n * @deprecated 16.0.0 Use OCP.AppConfig instead\n */\nexport const AppConfig = {\n\t/**\n\t * @deprecated Use OCP.AppConfig.getValue() instead\n\t */\n\tgetValue: function(app, key, defaultValue, callback) {\n\t\tgetValue(app, key, defaultValue, {\n\t\t\tsuccess: callback\n\t\t})\n\t},\n\n\t/**\n\t * @deprecated Use OCP.AppConfig.setValue() instead\n\t */\n\tsetValue: function(app, key, value) {\n\t\tsetValue(app, key, value)\n\t},\n\n\t/**\n\t * @deprecated Use OCP.AppConfig.getApps() instead\n\t */\n\tgetApps: function(callback) {\n\t\tgetApps({\n\t\t\tsuccess: callback\n\t\t})\n\t},\n\n\t/**\n\t * @deprecated Use OCP.AppConfig.getKeys() instead\n\t */\n\tgetKeys: function(app, callback) {\n\t\tgetKeys(app, {\n\t\t\tsuccess: callback\n\t\t})\n\t},\n\n\t/**\n\t * @deprecated Use OCP.AppConfig.deleteKey() instead\n\t */\n\tdeleteKey: function(app, key) {\n\t\tdeleteKey(app, key)\n\t}\n\n}\n","/**\n * @copyright 2019 Christoph Wurst \n *\n * @author Christoph Wurst \n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n */\n\nconst appswebroots = (window._oc_appswebroots !== undefined) ? window._oc_appswebroots : false\n\nexport default appswebroots\n","/**\n * Copyright (c) 2015\n *\n * @author Christoph Wurst \n * @author John Molakvoæ \n * @author Julius Härtl \n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n */\n\n/* eslint-disable */\nimport _ from 'underscore'\nimport { dav } from 'davclient.js'\n\nconst methodMap = {\n\tcreate: 'POST',\n\tupdate: 'PROPPATCH',\n\tpatch: 'PROPPATCH',\n\tdelete: 'DELETE',\n\tread: 'PROPFIND'\n}\n\n// Throw an error when a URL is needed, and none is supplied.\nfunction urlError() {\n\tthrow new Error('A \"url\" property or function must be specified')\n}\n\n/**\n * Convert a single propfind result to JSON\n *\n * @param {Object} result\n * @param {Object} davProperties properties mapping\n */\nfunction parsePropFindResult(result, davProperties) {\n\tif (_.isArray(result)) {\n\t\treturn _.map(result, function(subResult) {\n\t\t\treturn parsePropFindResult(subResult, davProperties)\n\t\t})\n\t}\n\tvar props = {\n\t\thref: result.href\n\t}\n\n\t_.each(result.propStat, function(propStat) {\n\t\tif (propStat.status !== 'HTTP/1.1 200 OK') {\n\t\t\treturn\n\t\t}\n\n\t\tfor (var key in propStat.properties) {\n\t\t\tvar propKey = key\n\t\t\tif (key in davProperties) {\n\t\t\t\tpropKey = davProperties[key]\n\t\t\t}\n\t\t\tprops[propKey] = propStat.properties[key]\n\t\t}\n\t})\n\n\tif (!props.id) {\n\t\t// parse id from href\n\t\tprops.id = parseIdFromLocation(props.href)\n\t}\n\n\treturn props\n}\n\n/**\n * Parse ID from location\n *\n * @param {string} url url\n * @returns {string} id\n */\nfunction parseIdFromLocation(url) {\n\tvar queryPos = url.indexOf('?')\n\tif (queryPos > 0) {\n\t\turl = url.substr(0, queryPos)\n\t}\n\n\tvar parts = url.split('/')\n\tvar result\n\tdo {\n\t\tresult = parts[parts.length - 1]\n\t\tparts.pop()\n\t\t// note: first result can be empty when there is a trailing slash,\n\t\t// so we take the part before that\n\t} while (!result && parts.length > 0)\n\n\treturn result\n}\n\nfunction isSuccessStatus(status) {\n\treturn status >= 200 && status <= 299\n}\n\nfunction convertModelAttributesToDavProperties(attrs, davProperties) {\n\tvar props = {}\n\tvar key\n\tfor (key in attrs) {\n\t\tvar changedProp = davProperties[key]\n\t\tvar value = attrs[key]\n\t\tif (!changedProp) {\n\t\t\tconsole.warn('No matching DAV property for property \"' + key)\n\t\t\tchangedProp = key\n\t\t}\n\t\tif (_.isBoolean(value) || _.isNumber(value)) {\n\t\t\t// convert to string\n\t\t\tvalue = '' + value\n\t\t}\n\t\tprops[changedProp] = value\n\t}\n\treturn props\n}\n\nfunction callPropFind(client, options, model, headers) {\n\treturn client.propFind(\n\t\toptions.url,\n\t\t_.values(options.davProperties) || [],\n\t\toptions.depth,\n\t\theaders\n\t).then(function(response) {\n\t\tif (isSuccessStatus(response.status)) {\n\t\t\tif (_.isFunction(options.success)) {\n\t\t\t\tvar propsMapping = _.invert(options.davProperties)\n\t\t\t\tvar results = parsePropFindResult(response.body, propsMapping)\n\t\t\t\tif (options.depth > 0) {\n\t\t\t\t\t// discard root entry\n\t\t\t\t\tresults.shift()\n\t\t\t\t}\n\n\t\t\t\toptions.success(results)\n\n\t\t\t}\n\t\t} else if (_.isFunction(options.error)) {\n\t\t\toptions.error(response)\n\t\t}\n\t})\n}\n\nfunction callPropPatch(client, options, model, headers) {\n\treturn client.propPatch(\n\t\toptions.url,\n\t\tconvertModelAttributesToDavProperties(model.changed, options.davProperties),\n\t\theaders\n\t).then(function(result) {\n\t\tif (isSuccessStatus(result.status)) {\n\t\t\tif (_.isFunction(options.success)) {\n\t\t\t\t// pass the object's own values because the server\n\t\t\t\t// does not return the updated model\n\t\t\t\toptions.success(model.toJSON())\n\t\t\t}\n\t\t} else if (_.isFunction(options.error)) {\n\t\t\toptions.error(result)\n\t\t}\n\t})\n\n}\n\nfunction callMkCol(client, options, model, headers) {\n\t// call MKCOL without data, followed by PROPPATCH\n\treturn client.request(\n\t\toptions.type,\n\t\toptions.url,\n\t\theaders,\n\t\tnull\n\t).then(function(result) {\n\t\tif (!isSuccessStatus(result.status)) {\n\t\t\tif (_.isFunction(options.error)) {\n\t\t\t\toptions.error(result)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\n\t\tcallPropPatch(client, options, model, headers)\n\t})\n}\n\nfunction callMethod(client, options, model, headers) {\n\theaders['Content-Type'] = 'application/json'\n\treturn client.request(\n\t\toptions.type,\n\t\toptions.url,\n\t\theaders,\n\t\toptions.data\n\t).then(function(result) {\n\t\tif (!isSuccessStatus(result.status)) {\n\t\t\tif (_.isFunction(options.error)) {\n\t\t\t\toptions.error(result)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\n\t\tif (_.isFunction(options.success)) {\n\t\t\tif (options.type === 'PUT' || options.type === 'POST' || options.type === 'MKCOL') {\n\t\t\t\t// pass the object's own values because the server\n\t\t\t\t// does not return anything\n\t\t\t\tvar responseJson = result.body || model.toJSON()\n\t\t\t\tvar locationHeader = result.xhr.getResponseHeader('Content-Location')\n\t\t\t\tif (options.type === 'POST' && locationHeader) {\n\t\t\t\t\tresponseJson.id = parseIdFromLocation(locationHeader)\n\t\t\t\t}\n\t\t\t\toptions.success(responseJson)\n\t\t\t\treturn\n\t\t\t}\n\t\t\t// if multi-status, parse\n\t\t\tif (result.status === 207) {\n\t\t\t\tvar propsMapping = _.invert(options.davProperties)\n\t\t\t\toptions.success(parsePropFindResult(result.body, propsMapping))\n\t\t\t} else {\n\t\t\t\toptions.success(result.body)\n\t\t\t}\n\t\t}\n\t})\n}\n\nexport const davCall = (options, model) => {\n\tvar client = new dav.Client({\n\t\tbaseUrl: options.url,\n\t\txmlNamespaces: _.extend({\n\t\t\t'DAV:': 'd',\n\t\t\t'http://owncloud.org/ns': 'oc'\n\t\t}, options.xmlNamespaces || {})\n\t})\n\tclient.resolveUrl = function() {\n\t\treturn options.url\n\t}\n\tvar headers = _.extend({\n\t\t'X-Requested-With': 'XMLHttpRequest',\n\t\t'requesttoken': OC.requestToken\n\t}, options.headers)\n\tif (options.type === 'PROPFIND') {\n\t\treturn callPropFind(client, options, model, headers)\n\t} else if (options.type === 'PROPPATCH') {\n\t\treturn callPropPatch(client, options, model, headers)\n\t} else if (options.type === 'MKCOL') {\n\t\treturn callMkCol(client, options, model, headers)\n\t} else {\n\t\treturn callMethod(client, options, model, headers)\n\t}\n}\n\n/**\n * DAV transport\n */\nexport const davSync = Backbone => (method, model, options) => {\n\tvar params = { type: methodMap[method] || method }\n\tvar isCollection = (model instanceof Backbone.Collection)\n\n\tif (method === 'update') {\n\t\t// if a model has an inner collection, it must define an\n\t\t// attribute \"hasInnerCollection\" that evaluates to true\n\t\tif (model.hasInnerCollection) {\n\t\t\t// if the model itself is a Webdav collection, use MKCOL\n\t\t\tparams.type = 'MKCOL'\n\t\t} else if (model.usePUT || (model.collection && model.collection.usePUT)) {\n\t\t\t// use PUT instead of PROPPATCH\n\t\t\tparams.type = 'PUT'\n\t\t}\n\t}\n\n\t// Ensure that we have a URL.\n\tif (!options.url) {\n\t\tparams.url = _.result(model, 'url') || urlError()\n\t}\n\n\t// Ensure that we have the appropriate request data.\n\tif (options.data == null && model && (method === 'create' || method === 'update' || method === 'patch')) {\n\t\tparams.data = JSON.stringify(options.attrs || model.toJSON(options))\n\t}\n\n\t// Don't process data on a non-GET request.\n\tif (params.type !== 'PROPFIND') {\n\t\tparams.processData = false\n\t}\n\n\tif (params.type === 'PROPFIND' || params.type === 'PROPPATCH') {\n\t\tvar davProperties = model.davProperties\n\t\tif (!davProperties && model.model) {\n\t\t\t// use dav properties from model in case of collection\n\t\t\tdavProperties = model.model.prototype.davProperties\n\t\t}\n\t\tif (davProperties) {\n\t\t\tif (_.isFunction(davProperties)) {\n\t\t\t\tparams.davProperties = davProperties.call(model)\n\t\t\t} else {\n\t\t\t\tparams.davProperties = davProperties\n\t\t\t}\n\t\t}\n\n\t\tparams.davProperties = _.extend(params.davProperties || {}, options.davProperties)\n\n\t\tif (_.isUndefined(options.depth)) {\n\t\t\tif (isCollection) {\n\t\t\t\toptions.depth = 1\n\t\t\t} else {\n\t\t\t\toptions.depth = 0\n\t\t\t}\n\t\t}\n\t}\n\n\t// Pass along `textStatus` and `errorThrown` from jQuery.\n\tvar error = options.error\n\toptions.error = function(xhr, textStatus, errorThrown) {\n\t\toptions.textStatus = textStatus\n\t\toptions.errorThrown = errorThrown\n\t\tif (error) {\n\t\t\terror.call(options.context, xhr, textStatus, errorThrown)\n\t\t}\n\t}\n\n\t// Make the request, allowing the user to override any Ajax options.\n\tvar xhr = options.xhr = Backbone.davCall(_.extend(params, options), model)\n\tmodel.trigger('request', model, xhr, options)\n\treturn xhr\n}\n","/**\n * @copyright 2019 Christoph Wurst \n *\n * @author Christoph Wurst \n * @author John Molakvoæ \n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n */\n\nimport VendorBackbone from 'backbone'\nimport { davCall, davSync } from './backbone-webdav.js'\n\nconst Backbone = VendorBackbone.noConflict()\n\n// Patch Backbone for DAV\nObject.assign(Backbone, {\n\tdavCall,\n\tdavSync: davSync(Backbone),\n})\n\nexport default Backbone\n","/**\n * @copyright 2019 Christoph Wurst \n *\n * @author Christoph Wurst \n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n */\n\nconst config = window._oc_config || {}\n\nexport default config\n","/**\n * @copyright 2019 Christoph Wurst \n *\n * @author Christoph Wurst \n * @author Joas Schilling \n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n */\n\nconst rawUid = document\n\t.getElementsByTagName('head')[0]\n\t.getAttribute('data-user')\nconst displayName = document\n\t.getElementsByTagName('head')[0]\n\t.getAttribute('data-user-displayname')\n\nexport const currentUser = rawUid !== undefined ? rawUid : false\n\nexport const getCurrentUser = () => {\n\treturn {\n\t\tuid: currentUser,\n\t\tdisplayName,\n\t}\n}\n","/**\n * @copyright 2019 Christoph Wurst \n * @copyright Copyright (c) 2019 Gary Kim \n *\n * @author Bartek Przybylski \n * @author Christopher Schäpers \n * @author Christoph Wurst \n * @author Daniel Calviño Sánchez \n * @author Daniel Kesselberg \n * @author Florian Schunk \n * @author Gary Kim \n * @author Hendrik Leppelsack \n * @author Jan-Christoph Borchardt \n * @author Joas Schilling \n * @author John Molakvoæ \n * @author Jörn Friedrich Dreyer \n * @author Julius Härtl \n * @author Loïc Hermann \n * @author Morris Jobke \n * @author Olivier Paroz \n * @author Robin Appelman \n * @author Roeland Jago Douma \n * @author Sujith Haridasan \n * @author Thomas Citharel \n * @author Thomas Müller \n * @author Thomas Tanghus \n * @author Vincent Petry \n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n */\n\n/* eslint-disable */\nimport _ from 'underscore'\nimport $ from 'jquery'\n\nimport IconMove from '@mdi/svg/svg/folder-move.svg?raw'\nimport IconCopy from '@mdi/svg/svg/folder-multiple.svg?raw'\n\nimport OC from './index.js'\nimport { FilePickerType, getFilePickerBuilder } from '@nextcloud/dialogs'\nimport { basename } from 'path'\n\n/**\n * this class to ease the usage of jquery dialogs\n */\nconst Dialogs = {\n\t// dialog button types\n\tYES_NO_BUTTONS: 70,\n\tOK_BUTTONS: 71,\n\n\t/** @deprecated use FilePickerType from `@nextcloud/dialogs` */\n\tFILEPICKER_TYPE_CHOOSE: 1,\n\t/** @deprecated use FilePickerType from `@nextcloud/dialogs` */\n\tFILEPICKER_TYPE_MOVE: 2,\n\t/** @deprecated use FilePickerType from `@nextcloud/dialogs` */\n\tFILEPICKER_TYPE_COPY: 3,\n\t/** @deprecated use FilePickerType from `@nextcloud/dialogs` */\n\tFILEPICKER_TYPE_COPY_MOVE: 4,\n\t/** @deprecated use FilePickerType from `@nextcloud/dialogs` */\n\tFILEPICKER_TYPE_CUSTOM: 5,\n\n\t// used to name each dialog\n\tdialogsCounter: 0,\n\n\t/**\n\t * displays alert dialog\n\t * @param {string} text content of dialog\n\t * @param {string} title dialog title\n\t * @param {function} callback which will be triggered when user presses OK\n\t * @param {boolean} [modal] make the dialog modal\n\t */\n\talert: function(text, title, callback, modal) {\n\t\tthis.message(\n\t\t\ttext,\n\t\t\ttitle,\n\t\t\t'alert',\n\t\t\tDialogs.OK_BUTTON,\n\t\t\tcallback,\n\t\t\tmodal\n\t\t)\n\t},\n\t/**\n\t * displays info dialog\n\t * @param {string} text content of dialog\n\t * @param {string} title dialog title\n\t * @param {function} callback which will be triggered when user presses OK\n\t * @param {boolean} [modal] make the dialog modal\n\t */\n\tinfo: function(text, title, callback, modal) {\n\t\tthis.message(text, title, 'info', Dialogs.OK_BUTTON, callback, modal)\n\t},\n\n\t/**\n\t * displays confirmation dialog\n\t * @param {string} text content of dialog\n\t * @param {string} title dialog title\n\t * @param {function} callback which will be triggered when user presses OK (true or false would be passed to callback respectively)\n\t * @param {boolean} [modal] make the dialog modal\n\t * @returns {Promise}\n\t */\n\tconfirm: function(text, title, callback, modal) {\n\t\treturn this.message(\n\t\t\ttext,\n\t\t\ttitle,\n\t\t\t'notice',\n\t\t\tDialogs.YES_NO_BUTTONS,\n\t\t\tcallback,\n\t\t\tmodal\n\t\t)\n\t},\n\t/**\n\t * displays confirmation dialog\n\t * @param {string} text content of dialog\n\t * @param {string} title dialog title\n\t * @param {(number|{type: number, confirm: string, cancel: string, confirmClasses: string})} buttons text content of buttons\n\t * @param {function} callback which will be triggered when user presses OK (true or false would be passed to callback respectively)\n\t * @param {boolean} [modal] make the dialog modal\n\t * @returns {Promise}\n\t */\n\tconfirmDestructive: function(text, title, buttons, callback, modal) {\n\t\treturn this.message(\n\t\t\ttext,\n\t\t\ttitle,\n\t\t\t'none',\n\t\t\tbuttons,\n\t\t\tcallback,\n\t\t\tmodal === undefined ? true : modal\n\t\t)\n\t},\n\t/**\n\t * displays confirmation dialog\n\t * @param {string} text content of dialog\n\t * @param {string} title dialog title\n\t * @param {function} callback which will be triggered when user presses OK (true or false would be passed to callback respectively)\n\t * @param {boolean} [modal] make the dialog modal\n\t * @returns {Promise}\n\t */\n\tconfirmHtml: function(text, title, callback, modal) {\n\t\treturn this.message(\n\t\t\ttext,\n\t\t\ttitle,\n\t\t\t'notice',\n\t\t\tDialogs.YES_NO_BUTTONS,\n\t\t\tcallback,\n\t\t\tmodal,\n\t\t\ttrue\n\t\t)\n\t},\n\t/**\n\t * displays prompt dialog\n\t * @param {string} text content of dialog\n\t * @param {string} title dialog title\n\t * @param {function} callback which will be triggered when user presses OK (true or false would be passed to callback respectively)\n\t * @param {boolean} [modal] make the dialog modal\n\t * @param {string} name name of the input field\n\t * @param {boolean} password whether the input should be a password input\n\t * @returns {Promise}\n\t */\n\tprompt: function(text, title, callback, modal, name, password) {\n\t\treturn $.when(this._getMessageTemplate()).then(function($tmpl) {\n\t\t\tvar dialogName = 'oc-dialog-' + Dialogs.dialogsCounter + '-content'\n\t\t\tvar dialogId = '#' + dialogName\n\t\t\tvar $dlg = $tmpl.octemplate({\n\t\t\t\tdialog_name: dialogName,\n\t\t\t\ttitle: title,\n\t\t\t\tmessage: text,\n\t\t\t\ttype: 'notice'\n\t\t\t})\n\t\t\tvar input = $('')\n\t\t\tinput.attr('type', password ? 'password' : 'text').attr('id', dialogName + '-input').attr('placeholder', name)\n\t\t\tvar label = $('').attr('for', dialogName + '-input').text(name + ': ')\n\t\t\t$dlg.append(label)\n\t\t\t$dlg.append(input)\n\t\t\tif (modal === undefined) {\n\t\t\t\tmodal = false\n\t\t\t}\n\t\t\t$('body').append($dlg)\n\n\t\t\t// wrap callback in _.once():\n\t\t\t// only call callback once and not twice (button handler and close\n\t\t\t// event) but call it for the close event, if ESC or the x is hit\n\t\t\tif (callback !== undefined) {\n\t\t\t\tcallback = _.once(callback)\n\t\t\t}\n\n\t\t\tvar buttonlist = [{\n\t\t\t\ttext: t('core', 'No'),\n\t\t\t\tclick: function() {\n\t\t\t\t\tif (callback !== undefined) {\n\t\t\t\t\t\t// eslint-disable-next-line standard/no-callback-literal\n\t\t\t\t\t\tcallback(false, input.val())\n\t\t\t\t\t}\n\t\t\t\t\t$(dialogId).ocdialog('close')\n\t\t\t\t}\n\t\t\t}, {\n\t\t\t\ttext: t('core', 'Yes'),\n\t\t\t\tclick: function() {\n\t\t\t\t\tif (callback !== undefined) {\n\t\t\t\t\t\t// eslint-disable-next-line standard/no-callback-literal\n\t\t\t\t\t\tcallback(true, input.val())\n\t\t\t\t\t}\n\t\t\t\t\t$(dialogId).ocdialog('close')\n\t\t\t\t},\n\t\t\t\tdefaultButton: true\n\t\t\t}]\n\n\t\t\t$(dialogId).ocdialog({\n\t\t\t\tcloseOnEscape: true,\n\t\t\t\tmodal: modal,\n\t\t\t\tbuttons: buttonlist,\n\t\t\t\tclose: function() {\n\t\t\t\t\t// callback is already fired if Yes/No is clicked directly\n\t\t\t\t\tif (callback !== undefined) {\n\t\t\t\t\t\t// eslint-disable-next-line standard/no-callback-literal\n\t\t\t\t\t\tcallback(false, input.val())\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t})\n\t\t\tinput.focus()\n\t\t\tDialogs.dialogsCounter++\n\t\t})\n\t},\n\n\t/**\n\t * Legacy wrapper to the new Vue based filepicker from `@nextcloud/dialogs`\n\t *\n\t * Prefer to use the Vue filepicker directly instead.\n\t *\n\t * In order to pick several types of mime types they need to be passed as an\n\t * array of strings.\n\t *\n\t * When no mime type filter is given only files can be selected. In order to\n\t * be able to select both files and folders \"['*', 'httpd/unix-directory']\"\n\t * should be used instead.\n\t *\n\t * @param {string} title dialog title\n\t * @param {Function} callback which will be triggered when user presses Choose\n\t * @param {boolean} [multiselect] whether it should be possible to select multiple files\n\t * @param {string[]} [mimetype] mimetype to filter by - directories will always be included\n\t * @param {boolean} [_modal] do not use\n\t * @param {string} [type] Type of file picker : Choose, copy, move, copy and move\n\t * @param {string} [path] path to the folder that the the file can be picket from\n\t * @param {object} [options] additonal options that need to be set\n\t * @param {Function} [options.filter] filter function for advanced filtering\n\t * @param {boolean} [options.allowDirectoryChooser] Allow to select directories\n\t * @deprecated since 27.1.0 use the filepicker from `@nextcloud/dialogs` instead\n\t */\n\tfilepicker(title, callback, multiselect = false, mimetype = undefined, _modal = undefined, type = FilePickerType.Choose, path = undefined, options = undefined) {\n\n\t\t/**\n\t\t * Create legacy callback wrapper to support old filepicker syntax\n\t\t * @param fn The original callback\n\t\t * @param type The file picker type which was used to pick the file(s)\n\t\t */\n\t\tconst legacyCallback = (fn, type) => {\n\t\t\tconst getPath = (node) => {\n\t\t\t\tconst root = node?.root || ''\n\t\t\t\tlet path = node?.path || ''\n\t\t\t\t// TODO: Fix this in @nextcloud/files\n\t\t\t\tif (path.startsWith(root)) {\n\t\t\t\t\tpath = path.slice(root.length) || '/'\n\t\t\t\t}\n\t\t\t\treturn path\n\t\t\t}\n\n\t\t\tif (multiselect) {\n\t\t\t\treturn (nodes) => fn(nodes.map(getPath), type)\n\t\t\t} else {\n\t\t\t\treturn (nodes) => fn(getPath(nodes[0]), type)\n\t\t\t}\n\t\t}\n\n\t\t/**\n\t\t * Coverting a Node into a legacy file info to support the OC.dialogs.filepicker filter function\n\t\t * @param node The node to convert\n\t\t */\n\t\tconst nodeToLegacyFile = (node) => ({\n\t\t\tid: node.fileid || null,\n\t\t\tpath: node.path,\n\t\t\tmimetype: node.mime || null,\n\t\t\tmtime: node.mtime?.getTime() || null,\n\t\t\tpermissions: node.permissions,\n\t\t\tname: node.attributes?.displayName || node.basename,\n\t\t\tetag: node.attributes?.etag || null,\n\t\t\thasPreview: node.attributes?.hasPreview || null,\n\t\t\tmountType: node.attributes?.mountType || null,\n\t\t\tquotaAvailableBytes: node.attributes?.quotaAvailableBytes || null,\n\t\t\ticon: null,\n\t\t\tsharePermissions: null,\n\t\t})\n\n\t\tconst builder = getFilePickerBuilder(title)\n\n\t\t// Setup buttons\n\t\tif (type === this.FILEPICKER_TYPE_CUSTOM) {\n\t\t\t(options.buttons || []).forEach((button) => {\n\t\t\t\tbuilder.addButton({\n\t\t\t\t\tcallback: legacyCallback(callback, button.type),\n\t\t\t\t\tlabel: button.text,\n\t\t\t\t\ttype: button.defaultButton ? 'primary' : 'secondary',\n\t\t\t\t})\n\t\t\t})\n\t\t} else {\n\t\t\tbuilder.setButtonFactory((nodes, path) => {\n\t\t\t\tconst buttons = []\n\t\t\t\tconst node = nodes?.[0]?.attributes?.displayName || nodes?.[0]?.basename\n\t\t\t\tconst target = node || basename(path)\n\n\t\t\t\tif (type === FilePickerType.Choose) {\n\t\t\t\t\tbuttons.push({\n\t\t\t\t\t\tcallback: legacyCallback(callback, FilePickerType.Choose),\n\t\t\t\t\t\tlabel: node && !this.multiSelect ? t('core', 'Choose {file}', { file: node }) : t('core', 'Choose'),\n\t\t\t\t\t\ttype: 'primary',\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t\tif (type === FilePickerType.CopyMove || type === FilePickerType.Copy) {\n\t\t\t\t\tbuttons.push({\n\t\t\t\t\t\tcallback: legacyCallback(callback, FilePickerType.Copy),\n\t\t\t\t\t\tlabel: target ? t('core', 'Copy to {target}', { target }) : t('core', 'Copy'),\n\t\t\t\t\t\ttype: 'primary',\n\t\t\t\t\t\ticon: IconCopy,\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t\tif (type === FilePickerType.Move || type === FilePickerType.CopyMove) {\n\t\t\t\t\tbuttons.push({\n\t\t\t\t\t\tcallback: legacyCallback(callback, FilePickerType.Move),\n\t\t\t\t\t\tlabel: target ? t('core', 'Move to {target}', { target }) : t('core', 'Move'),\n\t\t\t\t\t\ttype: type === FilePickerType.Move ? 'primary' : 'secondary',\n\t\t\t\t\t\ticon: IconMove,\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t\treturn buttons\n\t\t\t})\n\t\t}\n\n\t\tif (mimetype) {\n\t\t\tbuilder.setMimeTypeFilter(typeof mimetype === 'string' ? [mimetype] : (mimetype || []))\n\t\t}\n\t\tif (typeof options?.filter === 'function') {\n\t\t\tbuilder.setFilter((node) => options.filter(nodeToLegacyFile(node)))\n\t\t}\n\t\tbuilder.allowDirectories(options?.allowDirectoryChooser === true || mimetype?.includes('httpd/unix-directory') || false)\n\t\t\t.setMultiSelect(multiselect)\n\t\t\t.startAt(path)\n\t\t\t.build()\n\t\t\t.pick()\n\t},\n\n\t/**\n\t * Displays raw dialog\n\t * You better use a wrapper instead ...\n\t */\n\tmessage: function(content, title, dialogType, buttons, callback, modal, allowHtml) {\n\t\treturn $.when(this._getMessageTemplate()).then(function($tmpl) {\n\t\t\tvar dialogName = 'oc-dialog-' + Dialogs.dialogsCounter + '-content'\n\t\t\tvar dialogId = '#' + dialogName\n\t\t\tvar $dlg = $tmpl.octemplate({\n\t\t\t\tdialog_name: dialogName,\n\t\t\t\ttitle: title,\n\t\t\t\tmessage: content,\n\t\t\t\ttype: dialogType\n\t\t\t}, allowHtml ? { escapeFunction: '' } : {})\n\t\t\tif (modal === undefined) {\n\t\t\t\tmodal = false\n\t\t\t}\n\t\t\t$('body').append($dlg)\n\t\t\tvar buttonlist = []\n\t\t\tswitch (buttons) {\n\t\t\tcase Dialogs.YES_NO_BUTTONS:\n\t\t\t\tbuttonlist = [{\n\t\t\t\t\ttext: t('core', 'No'),\n\t\t\t\t\tclick: function() {\n\t\t\t\t\t\tif (callback !== undefined) {\n\t\t\t\t\t\t\tcallback(false)\n\t\t\t\t\t\t}\n\t\t\t\t\t\t$(dialogId).ocdialog('close')\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\ttext: t('core', 'Yes'),\n\t\t\t\t\tclick: function() {\n\t\t\t\t\t\tif (callback !== undefined) {\n\t\t\t\t\t\t\tcallback(true)\n\t\t\t\t\t\t}\n\t\t\t\t\t\t$(dialogId).ocdialog('close')\n\t\t\t\t\t},\n\t\t\t\t\tdefaultButton: true\n\t\t\t\t}]\n\t\t\t\tbreak\n\t\t\tcase Dialogs.OK_BUTTON:\n\t\t\t\tvar functionToCall = function() {\n\t\t\t\t\t$(dialogId).ocdialog('close')\n\t\t\t\t\tif (callback !== undefined) {\n\t\t\t\t\t\tcallback()\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbuttonlist[0] = {\n\t\t\t\t\ttext: t('core', 'OK'),\n\t\t\t\t\tclick: functionToCall,\n\t\t\t\t\tdefaultButton: true\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\tdefault:\n\t\t\t\tif (typeof(buttons) === 'object') {\n\t\t\t\t\tswitch (buttons.type) {\n\t\t\t\t\t\tcase Dialogs.YES_NO_BUTTONS:\n\t\t\t\t\t\t\tbuttonlist = [{\n\t\t\t\t\t\t\t\ttext: buttons.cancel || t('core', 'No'),\n\t\t\t\t\t\t\t\tclick: function() {\n\t\t\t\t\t\t\t\t\tif (callback !== undefined) {\n\t\t\t\t\t\t\t\t\t\tcallback(false)\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t$(dialogId).ocdialog('close')\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\ttext: buttons.confirm || t('core', 'Yes'),\n\t\t\t\t\t\t\t\t\tclick: function() {\n\t\t\t\t\t\t\t\t\t\tif (callback !== undefined) {\n\t\t\t\t\t\t\t\t\t\t\tcallback(true)\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t$(dialogId).ocdialog('close')\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tdefaultButton: true,\n\t\t\t\t\t\t\t\t\tclasses: buttons.confirmClasses\n\t\t\t\t\t\t\t\t}]\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\t$(dialogId).ocdialog({\n\t\t\t\tcloseOnEscape: true,\n\t\t\t\tcloseCallback: () => { callback && callback(false) },\n\t\t\t\tmodal: modal,\n\t\t\t\tbuttons: buttonlist\n\t\t\t})\n\t\t\tDialogs.dialogsCounter++\n\t\t})\n\t\t\t.fail(function(status, error) {\n\t\t\t\t// If the method is called while navigating away from\n\t\t\t\t// the page, we still want to deliver the message.\n\t\t\t\tif (status === 0) {\n\t\t\t\t\talert(title + ': ' + content)\n\t\t\t\t} else {\n\t\t\t\t\talert(t('core', 'Error loading message template: {error}', { error: error }))\n\t\t\t\t}\n\t\t\t})\n\t},\n\t_fileexistsshown: false,\n\t/**\n\t * Displays file exists dialog\n\t * @param {object} data upload object\n\t * @param {object} original file with name, size and mtime\n\t * @param {object} replacement file with name, size and mtime\n\t * @param {object} controller with onCancel, onSkip, onReplace and onRename methods\n\t * @returns {Promise} jquery promise that resolves after the dialog template was loaded\n\t */\n\tfileexists: function(data, original, replacement, controller) {\n\t\tvar self = this\n\t\tvar dialogDeferred = new $.Deferred()\n\n\t\tvar getCroppedPreview = function(file) {\n\t\t\tvar deferred = new $.Deferred()\n\t\t\t// Only process image files.\n\t\t\tvar type = file.type && file.type.split('/').shift()\n\t\t\tif (window.FileReader && type === 'image') {\n\t\t\t\tvar reader = new FileReader()\n\t\t\t\treader.onload = function(e) {\n\t\t\t\t\tvar blob = new Blob([e.target.result])\n\t\t\t\t\twindow.URL = window.URL || window.webkitURL\n\t\t\t\t\tvar originalUrl = window.URL.createObjectURL(blob)\n\t\t\t\t\tvar image = new Image()\n\t\t\t\t\timage.src = originalUrl\n\t\t\t\t\timage.onload = function() {\n\t\t\t\t\t\tvar url = crop(image)\n\t\t\t\t\t\tdeferred.resolve(url)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treader.readAsArrayBuffer(file)\n\t\t\t} else {\n\t\t\t\tdeferred.reject()\n\t\t\t}\n\t\t\treturn deferred\n\t\t}\n\n\t\tvar crop = function(img) {\n\t\t\tvar canvas = document.createElement('canvas')\n\t\t\tvar targetSize = 96\n\t\t\tvar width = img.width\n\t\t\tvar height = img.height\n\t\t\tvar x; var y; var size\n\n\t\t\t// Calculate the width and height, constraining the proportions\n\t\t\tif (width > height) {\n\t\t\t\ty = 0\n\t\t\t\tx = (width - height) / 2\n\t\t\t} else {\n\t\t\t\ty = (height - width) / 2\n\t\t\t\tx = 0\n\t\t\t}\n\t\t\tsize = Math.min(width, height)\n\n\t\t\t// Set canvas size to the cropped area\n\t\t\tcanvas.width = size\n\t\t\tcanvas.height = size\n\t\t\tvar ctx = canvas.getContext('2d')\n\t\t\tctx.drawImage(img, x, y, size, size, 0, 0, size, size)\n\n\t\t\t// Resize the canvas to match the destination (right size uses 96px)\n\t\t\tresampleHermite(canvas, size, size, targetSize, targetSize)\n\n\t\t\treturn canvas.toDataURL('image/png', 0.7)\n\t\t}\n\n\t\t/**\n\t\t * Fast image resize/resample using Hermite filter with JavaScript.\n\t\t *\n\t\t * @author: ViliusL\n\t\t *\n\t\t * @param {*} canvas\n\t\t * @param {number} W\n\t\t * @param {number} H\n\t\t * @param {number} W2\n\t\t * @param {number} H2\n\t\t */\n\t\tvar resampleHermite = function(canvas, W, H, W2, H2) {\n\t\t\tW2 = Math.round(W2)\n\t\t\tH2 = Math.round(H2)\n\t\t\tvar img = canvas.getContext('2d').getImageData(0, 0, W, H)\n\t\t\tvar img2 = canvas.getContext('2d').getImageData(0, 0, W2, H2)\n\t\t\tvar data = img.data\n\t\t\tvar data2 = img2.data\n\t\t\tvar ratio_w = W / W2\n\t\t\tvar ratio_h = H / H2\n\t\t\tvar ratio_w_half = Math.ceil(ratio_w / 2)\n\t\t\tvar ratio_h_half = Math.ceil(ratio_h / 2)\n\n\t\t\tfor (var j = 0; j < H2; j++) {\n\t\t\t\tfor (var i = 0; i < W2; i++) {\n\t\t\t\t\tvar x2 = (i + j * W2) * 4\n\t\t\t\t\tvar weight = 0\n\t\t\t\t\tvar weights = 0\n\t\t\t\t\tvar weights_alpha = 0\n\t\t\t\t\tvar gx_r = 0\n\t\t\t\t\tvar gx_g = 0\n\t\t\t\t\tvar gx_b = 0\n\t\t\t\t\tvar gx_a = 0\n\t\t\t\t\tvar center_y = (j + 0.5) * ratio_h\n\t\t\t\t\tfor (var yy = Math.floor(j * ratio_h); yy < (j + 1) * ratio_h; yy++) {\n\t\t\t\t\t\tvar dy = Math.abs(center_y - (yy + 0.5)) / ratio_h_half\n\t\t\t\t\t\tvar center_x = (i + 0.5) * ratio_w\n\t\t\t\t\t\tvar w0 = dy * dy // pre-calc part of w\n\t\t\t\t\t\tfor (var xx = Math.floor(i * ratio_w); xx < (i + 1) * ratio_w; xx++) {\n\t\t\t\t\t\t\tvar dx = Math.abs(center_x - (xx + 0.5)) / ratio_w_half\n\t\t\t\t\t\t\tvar w = Math.sqrt(w0 + dx * dx)\n\t\t\t\t\t\t\tif (w >= -1 && w <= 1) {\n\t\t\t\t\t\t\t\t// hermite filter\n\t\t\t\t\t\t\t\tweight = 2 * w * w * w - 3 * w * w + 1\n\t\t\t\t\t\t\t\tif (weight > 0) {\n\t\t\t\t\t\t\t\t\tdx = 4 * (xx + yy * W)\n\t\t\t\t\t\t\t\t\t// alpha\n\t\t\t\t\t\t\t\t\tgx_a += weight * data[dx + 3]\n\t\t\t\t\t\t\t\t\tweights_alpha += weight\n\t\t\t\t\t\t\t\t\t// colors\n\t\t\t\t\t\t\t\t\tif (data[dx + 3] < 255) { weight = weight * data[dx + 3] / 250 }\n\t\t\t\t\t\t\t\t\tgx_r += weight * data[dx]\n\t\t\t\t\t\t\t\t\tgx_g += weight * data[dx + 1]\n\t\t\t\t\t\t\t\t\tgx_b += weight * data[dx + 2]\n\t\t\t\t\t\t\t\t\tweights += weight\n\t\t\t\t\t\t\t\t}\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\tdata2[x2] = gx_r / weights\n\t\t\t\t\tdata2[x2 + 1] = gx_g / weights\n\t\t\t\t\tdata2[x2 + 2] = gx_b / weights\n\t\t\t\t\tdata2[x2 + 3] = gx_a / weights_alpha\n\t\t\t\t}\n\t\t\t}\n\t\t\tcanvas.getContext('2d').clearRect(0, 0, Math.max(W, W2), Math.max(H, H2))\n\t\t\tcanvas.width = W2\n\t\t\tcanvas.height = H2\n\t\t\tcanvas.getContext('2d').putImageData(img2, 0, 0)\n\t\t}\n\n\t\tvar addConflict = function($conflicts, original, replacement) {\n\n\t\t\tvar $conflict = $conflicts.find('.template').clone().removeClass('template').addClass('conflict')\n\t\t\tvar $originalDiv = $conflict.find('.original')\n\t\t\tvar $replacementDiv = $conflict.find('.replacement')\n\n\t\t\t$conflict.data('data', data)\n\n\t\t\t$conflict.find('.filename').text(original.name)\n\t\t\t$originalDiv.find('.size').text(OC.Util.humanFileSize(original.size))\n\t\t\t$originalDiv.find('.mtime').text(OC.Util.formatDate(original.mtime))\n\t\t\t// ie sucks\n\t\t\tif (replacement.size && replacement.lastModified) {\n\t\t\t\t$replacementDiv.find('.size').text(OC.Util.humanFileSize(replacement.size))\n\t\t\t\t$replacementDiv.find('.mtime').text(OC.Util.formatDate(replacement.lastModified))\n\t\t\t}\n\t\t\tvar path = original.directory + '/' + original.name\n\t\t\tvar urlSpec = {\n\t\t\t\tfile: path,\n\t\t\t\tx: 96,\n\t\t\t\ty: 96,\n\t\t\t\tc: original.etag,\n\t\t\t\tforceIcon: 0\n\t\t\t}\n\t\t\tvar previewpath = Files.generatePreviewUrl(urlSpec)\n\t\t\t// Escaping single quotes\n\t\t\tpreviewpath = previewpath.replace(/'/g, '%27')\n\t\t\t$originalDiv.find('.icon').css({ 'background-image': \"url('\" + previewpath + \"')\" })\n\t\t\tgetCroppedPreview(replacement).then(\n\t\t\t\tfunction(path) {\n\t\t\t\t\t$replacementDiv.find('.icon').css('background-image', 'url(' + path + ')')\n\t\t\t\t}, function() {\n\t\t\t\t\tpath = OC.MimeType.getIconUrl(replacement.type)\n\t\t\t\t\t$replacementDiv.find('.icon').css('background-image', 'url(' + path + ')')\n\t\t\t\t}\n\t\t\t)\n\t\t\t// connect checkboxes with labels\n\t\t\tvar checkboxId = $conflicts.find('.conflict').length\n\t\t\t$originalDiv.find('input:checkbox').attr('id', 'checkbox_original_' + checkboxId)\n\t\t\t$replacementDiv.find('input:checkbox').attr('id', 'checkbox_replacement_' + checkboxId)\n\n\t\t\t$conflicts.append($conflict)\n\n\t\t\t// set more recent mtime bold\n\t\t\t// ie sucks\n\t\t\tif (replacement.lastModified > original.mtime) {\n\t\t\t\t$replacementDiv.find('.mtime').css('font-weight', 'bold')\n\t\t\t} else if (replacement.lastModified < original.mtime) {\n\t\t\t\t$originalDiv.find('.mtime').css('font-weight', 'bold')\n\t\t\t} else {\n\t\t\t\t// TODO add to same mtime collection?\n\t\t\t}\n\n\t\t\t// set bigger size bold\n\t\t\tif (replacement.size && replacement.size > original.size) {\n\t\t\t\t$replacementDiv.find('.size').css('font-weight', 'bold')\n\t\t\t} else if (replacement.size && replacement.size < original.size) {\n\t\t\t\t$originalDiv.find('.size').css('font-weight', 'bold')\n\t\t\t} else {\n\t\t\t\t// TODO add to same size collection?\n\t\t\t}\n\n\t\t\t// TODO show skip action for files with same size and mtime in bottom row\n\n\t\t\t// always keep readonly files\n\n\t\t\tif (original.status === 'readonly') {\n\t\t\t\t$originalDiv\n\t\t\t\t\t.addClass('readonly')\n\t\t\t\t\t.find('input[type=\"checkbox\"]')\n\t\t\t\t\t.prop('checked', true)\n\t\t\t\t\t.prop('disabled', true)\n\t\t\t\t$originalDiv.find('.message')\n\t\t\t\t\t.text(t('core', 'read-only'))\n\t\t\t}\n\t\t}\n\t\t// var selection = controller.getSelection(data.originalFiles);\n\t\t// if (selection.defaultAction) {\n\t\t//\tcontroller[selection.defaultAction](data);\n\t\t// } else {\n\t\tvar dialogName = 'oc-dialog-fileexists-content'\n\t\tvar dialogId = '#' + dialogName\n\t\tif (this._fileexistsshown) {\n\t\t\t// add conflict\n\n\t\t\tvar $conflicts = $(dialogId + ' .conflicts')\n\t\t\taddConflict($conflicts, original, replacement)\n\n\t\t\tvar count = $(dialogId + ' .conflict').length\n\t\t\tvar title = n('core',\n\t\t\t\t'{count} file conflict',\n\t\t\t\t'{count} file conflicts',\n\t\t\t\tcount,\n\t\t\t\t{ count: count }\n\t\t\t)\n\t\t\t$(dialogId).parent().children('.oc-dialog-title').text(title)\n\n\t\t\t// recalculate dimensions\n\t\t\t$(window).trigger('resize')\n\t\t\tdialogDeferred.resolve()\n\t\t} else {\n\t\t\t// create dialog\n\t\t\tthis._fileexistsshown = true\n\t\t\t$.when(this._getFileExistsTemplate()).then(function($tmpl) {\n\t\t\t\tvar title = t('core', 'One file conflict')\n\t\t\t\tvar $dlg = $tmpl.octemplate({\n\t\t\t\t\tdialog_name: dialogName,\n\t\t\t\t\ttitle: title,\n\t\t\t\t\ttype: 'fileexists',\n\n\t\t\t\t\tallnewfiles: t('core', 'New Files'),\n\t\t\t\t\tallexistingfiles: t('core', 'Already existing files'),\n\n\t\t\t\t\twhy: t('core', 'Which files do you want to keep?'),\n\t\t\t\t\twhat: t('core', 'If you select both versions, the copied file will have a number added to its name.')\n\t\t\t\t})\n\t\t\t\t$('body').append($dlg)\n\n\t\t\t\tif (original && replacement) {\n\t\t\t\t\tvar $conflicts = $dlg.find('.conflicts')\n\t\t\t\t\taddConflict($conflicts, original, replacement)\n\t\t\t\t}\n\n\t\t\t\tvar buttonlist = [{\n\t\t\t\t\ttext: t('core', 'Cancel'),\n\t\t\t\t\tclasses: 'cancel',\n\t\t\t\t\tclick: function() {\n\t\t\t\t\t\tif (typeof controller.onCancel !== 'undefined') {\n\t\t\t\t\t\t\tcontroller.onCancel(data)\n\t\t\t\t\t\t}\n\t\t\t\t\t\t$(dialogId).ocdialog('close')\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\ttext: t('core', 'Continue'),\n\t\t\t\t\tclasses: 'continue',\n\t\t\t\t\tclick: function() {\n\t\t\t\t\t\tif (typeof controller.onContinue !== 'undefined') {\n\t\t\t\t\t\t\tcontroller.onContinue($(dialogId + ' .conflict'))\n\t\t\t\t\t\t}\n\t\t\t\t\t\t$(dialogId).ocdialog('close')\n\t\t\t\t\t}\n\t\t\t\t}]\n\n\t\t\t\t$(dialogId).ocdialog({\n\t\t\t\t\twidth: 500,\n\t\t\t\t\tcloseOnEscape: true,\n\t\t\t\t\tmodal: true,\n\t\t\t\t\tbuttons: buttonlist,\n\t\t\t\t\tcloseButton: null,\n\t\t\t\t\tclose: function() {\n\t\t\t\t\t\tself._fileexistsshown = false\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t$(this).ocdialog('destroy').remove()\n\t\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\t\t// ignore\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t})\n\n\t\t\t\t$(dialogId).css('height', 'auto')\n\n\t\t\t\tvar $primaryButton = $dlg.closest('.oc-dialog').find('button.continue')\n\t\t\t\t$primaryButton.prop('disabled', true)\n\n\t\t\t\tfunction updatePrimaryButton() {\n\t\t\t\t\tvar checkedCount = $dlg.find('.conflicts .checkbox:checked').length\n\t\t\t\t\t$primaryButton.prop('disabled', checkedCount === 0)\n\t\t\t\t}\n\n\t\t\t\t// add checkbox toggling actions\n\t\t\t\t$(dialogId).find('.allnewfiles').on('click', function() {\n\t\t\t\t\tvar $checkboxes = $(dialogId).find('.conflict .replacement input[type=\"checkbox\"]')\n\t\t\t\t\t$checkboxes.prop('checked', $(this).prop('checked'))\n\t\t\t\t})\n\t\t\t\t$(dialogId).find('.allexistingfiles').on('click', function() {\n\t\t\t\t\tvar $checkboxes = $(dialogId).find('.conflict .original:not(.readonly) input[type=\"checkbox\"]')\n\t\t\t\t\t$checkboxes.prop('checked', $(this).prop('checked'))\n\t\t\t\t})\n\t\t\t\t$(dialogId).find('.conflicts').on('click', '.replacement,.original:not(.readonly)', function() {\n\t\t\t\t\tvar $checkbox = $(this).find('input[type=\"checkbox\"]')\n\t\t\t\t\t$checkbox.prop('checked', !$checkbox.prop('checked'))\n\t\t\t\t})\n\t\t\t\t$(dialogId).find('.conflicts').on('click', '.replacement input[type=\"checkbox\"],.original:not(.readonly) input[type=\"checkbox\"]', function() {\n\t\t\t\t\tvar $checkbox = $(this)\n\t\t\t\t\t$checkbox.prop('checked', !$checkbox.prop('checked'))\n\t\t\t\t})\n\n\t\t\t\t// update counters\n\t\t\t\t$(dialogId).on('click', '.replacement,.allnewfiles', function() {\n\t\t\t\t\tvar count = $(dialogId).find('.conflict .replacement input[type=\"checkbox\"]:checked').length\n\t\t\t\t\tif (count === $(dialogId + ' .conflict').length) {\n\t\t\t\t\t\t$(dialogId).find('.allnewfiles').prop('checked', true)\n\t\t\t\t\t\t$(dialogId).find('.allnewfiles + .count').text(t('core', '(all selected)'))\n\t\t\t\t\t} else if (count > 0) {\n\t\t\t\t\t\t$(dialogId).find('.allnewfiles').prop('checked', false)\n\t\t\t\t\t\t$(dialogId).find('.allnewfiles + .count').text(t('core', '({count} selected)', { count: count }))\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$(dialogId).find('.allnewfiles').prop('checked', false)\n\t\t\t\t\t\t$(dialogId).find('.allnewfiles + .count').text('')\n\t\t\t\t\t}\n\t\t\t\t\tupdatePrimaryButton()\n\t\t\t\t})\n\t\t\t\t$(dialogId).on('click', '.original,.allexistingfiles', function() {\n\t\t\t\t\tvar count = $(dialogId).find('.conflict .original input[type=\"checkbox\"]:checked').length\n\t\t\t\t\tif (count === $(dialogId + ' .conflict').length) {\n\t\t\t\t\t\t$(dialogId).find('.allexistingfiles').prop('checked', true)\n\t\t\t\t\t\t$(dialogId).find('.allexistingfiles + .count').text(t('core', '(all selected)'))\n\t\t\t\t\t} else if (count > 0) {\n\t\t\t\t\t\t$(dialogId).find('.allexistingfiles').prop('checked', false)\n\t\t\t\t\t\t$(dialogId).find('.allexistingfiles + .count')\n\t\t\t\t\t\t\t.text(t('core', '({count} selected)', { count: count }))\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$(dialogId).find('.allexistingfiles').prop('checked', false)\n\t\t\t\t\t\t$(dialogId).find('.allexistingfiles + .count').text('')\n\t\t\t\t\t}\n\t\t\t\t\tupdatePrimaryButton()\n\t\t\t\t})\n\n\t\t\t\tdialogDeferred.resolve()\n\t\t\t})\n\t\t\t\t.fail(function() {\n\t\t\t\t\tdialogDeferred.reject()\n\t\t\t\t\talert(t('core', 'Error loading file exists template'))\n\t\t\t\t})\n\t\t}\n\t\t// }\n\t\treturn dialogDeferred.promise()\n\t},\n\n\t_getMessageTemplate: function() {\n\t\tvar defer = $.Deferred()\n\t\tif (!this.$messageTemplate) {\n\t\t\tvar self = this\n\t\t\t$.get(OC.filePath('core', 'templates', 'message.html'), function(tmpl) {\n\t\t\t\tself.$messageTemplate = $(tmpl)\n\t\t\t\tdefer.resolve(self.$messageTemplate)\n\t\t\t})\n\t\t\t\t.fail(function(jqXHR, textStatus, errorThrown) {\n\t\t\t\t\tdefer.reject(jqXHR.status, errorThrown)\n\t\t\t\t})\n\t\t} else {\n\t\t\tdefer.resolve(this.$messageTemplate)\n\t\t}\n\t\treturn defer.promise()\n\t},\n\t_getFileExistsTemplate: function() {\n\t\tvar defer = $.Deferred()\n\t\tif (!this.$fileexistsTemplate) {\n\t\t\tvar self = this\n\t\t\t$.get(OC.filePath('files', 'templates', 'fileexists.html'), function(tmpl) {\n\t\t\t\tself.$fileexistsTemplate = $(tmpl)\n\t\t\t\tdefer.resolve(self.$fileexistsTemplate)\n\t\t\t})\n\t\t\t\t.fail(function() {\n\t\t\t\t\tdefer.reject()\n\t\t\t\t})\n\t\t} else {\n\t\t\tdefer.resolve(this.$fileexistsTemplate)\n\t\t}\n\t\treturn defer.promise()\n\t},\n}\n\nexport default Dialogs\n","/**\n * @copyright 2019 Christoph Wurst \n *\n * @author Christoph Wurst \n * @author John Molakvoæ \n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n */\n\nimport { emit } from '@nextcloud/event-bus'\n\n/**\n * @private\n * @param {Document} global the document to read the initial value from\n * @param {Function} emit the function to invoke for every new token\n * @return {object}\n */\nexport const manageToken = (global, emit) => {\n\tlet token = global.getElementsByTagName('head')[0].getAttribute('data-requesttoken')\n\n\treturn {\n\t\tgetToken: () => token,\n\t\tsetToken: newToken => {\n\t\t\ttoken = newToken\n\n\t\t\temit('csrf-token-update', {\n\t\t\t\ttoken,\n\t\t\t})\n\t\t},\n\t}\n}\n\nconst manageFromDocument = manageToken(document, emit)\n\n/**\n * @return {string}\n */\nexport const getToken = manageFromDocument.getToken\n\n/**\n * @param {string} newToken new token\n */\nexport const setToken = manageFromDocument.setToken\n","/**\n * @copyright 2012 Robin Appelman icewind1991@gmail.com\n *\n * @author Arthur Schiwon \n * @author Christoph Wurst \n * @author John Molakvoæ \n * @author Lukas Reschke \n * @author Robin Appelman \n * @author Thomas Müller \n * @author Vincent Petry \n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n */\n\n/* eslint-disable */\nimport $ from 'jquery'\n\nimport { getToken } from './requesttoken.js'\n\n/**\n * Create a new event source\n * @param {string} src\n * @param {object} [data] to be send as GET\n *\n * @constructs OCEventSource\n */\nconst OCEventSource = function(src, data) {\n\tvar dataStr = ''\n\tvar name\n\tvar joinChar\n\tthis.typelessListeners = []\n\tthis.closed = false\n\tthis.listeners = {}\n\tif (data) {\n\t\tfor (name in data) {\n\t\t\tdataStr += name + '=' + encodeURIComponent(data[name]) + '&'\n\t\t}\n\t}\n\tdataStr += 'requesttoken=' + encodeURIComponent(getToken())\n\tif (!this.useFallBack && typeof EventSource !== 'undefined') {\n\t\tjoinChar = '&'\n\t\tif (src.indexOf('?') === -1) {\n\t\t\tjoinChar = '?'\n\t\t}\n\t\tthis.source = new EventSource(src + joinChar + dataStr)\n\t\tthis.source.onmessage = function(e) {\n\t\t\tfor (var i = 0; i < this.typelessListeners.length; i++) {\n\t\t\t\tthis.typelessListeners[i](JSON.parse(e.data))\n\t\t\t}\n\t\t}.bind(this)\n\t} else {\n\t\tvar iframeId = 'oc_eventsource_iframe_' + OCEventSource.iframeCount\n\t\tOCEventSource.fallBackSources[OCEventSource.iframeCount] = this\n\t\tthis.iframe = $('')\n\t\tthis.iframe.attr('id', iframeId)\n\t\tthis.iframe.hide()\n\n\t\tjoinChar = '&'\n\t\tif (src.indexOf('?') === -1) {\n\t\t\tjoinChar = '?'\n\t\t}\n\t\tthis.iframe.attr('src', src + joinChar + 'fallback=true&fallback_id=' + OCEventSource.iframeCount + '&' + dataStr)\n\t\t$('body').append(this.iframe)\n\t\tthis.useFallBack = true\n\t\tOCEventSource.iframeCount++\n\t}\n\t// add close listener\n\tthis.listen('__internal__', function(data) {\n\t\tif (data === 'close') {\n\t\t\tthis.close()\n\t\t}\n\t}.bind(this))\n}\nOCEventSource.fallBackSources = []\nOCEventSource.iframeCount = 0// number of fallback iframes\nOCEventSource.fallBackCallBack = function(id, type, data) {\n\tOCEventSource.fallBackSources[id].fallBackCallBack(type, data)\n}\nOCEventSource.prototype = {\n\ttypelessListeners: [],\n\tiframe: null,\n\tlisteners: {}, // only for fallback\n\tuseFallBack: false,\n\t/**\n\t * Fallback callback for browsers that don't have the\n\t * native EventSource object.\n\t *\n\t * Calls the registered listeners.\n\t *\n\t * @private\n\t * @param {String} type event type\n\t * @param {Object} data received data\n\t */\n\tfallBackCallBack: function(type, data) {\n\t\tvar i\n\t\t// ignore messages that might appear after closing\n\t\tif (this.closed) {\n\t\t\treturn\n\t\t}\n\t\tif (type) {\n\t\t\tif (typeof this.listeners.done !== 'undefined') {\n\t\t\t\tfor (i = 0; i < this.listeners[type].length; i++) {\n\t\t\t\t\tthis.listeners[type][i](data)\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tfor (i = 0; i < this.typelessListeners.length; i++) {\n\t\t\t\tthis.typelessListeners[i](data)\n\t\t\t}\n\t\t}\n\t},\n\tlastLength: 0, // for fallback\n\t/**\n\t * Listen to a given type of events.\n\t *\n\t * @param {String} type event type\n\t * @param {Function} callback event callback\n\t */\n\tlisten: function(type, callback) {\n\t\tif (callback && callback.call) {\n\n\t\t\tif (type) {\n\t\t\t\tif (this.useFallBack) {\n\t\t\t\t\tif (!this.listeners[type]) {\n\t\t\t\t\t\tthis.listeners[type] = []\n\t\t\t\t\t}\n\t\t\t\t\tthis.listeners[type].push(callback)\n\t\t\t\t} else {\n\t\t\t\t\tthis.source.addEventListener(type, function(e) {\n\t\t\t\t\t\tif (typeof e.data !== 'undefined') {\n\t\t\t\t\t\t\tcallback(JSON.parse(e.data))\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tcallback('')\n\t\t\t\t\t\t}\n\t\t\t\t\t}, false)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tthis.typelessListeners.push(callback)\n\t\t\t}\n\t\t}\n\t},\n\t/**\n\t * Closes this event source.\n\t */\n\tclose: function() {\n\t\tthis.closed = true\n\t\tif (typeof this.source !== 'undefined') {\n\t\t\tthis.source.close()\n\t\t}\n\t}\n}\n\nexport default OCEventSource\n","/**\n * @copyright 2019 Christoph Wurst \n *\n * @author Christoph Wurst \n * @author Daniel Calviño Sánchez \n * @author John Molakvoæ \n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n */\n\nimport _ from 'underscore'\n/** @typedef {import('jquery')} jQuery */\nimport $ from 'jquery'\n\nimport { menuSpeed } from './constants.js'\n\nexport let currentMenu = null\nexport let currentMenuToggle = null\n\n/**\n * For menu toggling\n *\n * @param {jQuery} $toggle the toggle element\n * @param {jQuery} $menuEl the menu container element\n * @param {Function | undefined} toggle callback invoked everytime the menu is opened\n * @param {boolean} headerMenu is this a top right header menu?\n * @return {void}\n */\nexport const registerMenu = function($toggle, $menuEl, toggle, headerMenu) {\n\t$menuEl.addClass('menu')\n\tconst isClickableElement = $toggle.prop('tagName') === 'A' || $toggle.prop('tagName') === 'BUTTON'\n\n\t// On link and button, the enter key trigger a click event\n\t// Only use the click to avoid two fired events\n\t$toggle.on(isClickableElement ? 'click.menu' : 'click.menu keyup.menu', function(event) {\n\t\t// prevent the link event (append anchor to URL)\n\t\tevent.preventDefault()\n\n\t\t// allow enter key as a trigger\n\t\tif (event.key && event.key !== 'Enter') {\n\t\t\treturn\n\t\t}\n\n\t\tif ($menuEl.is(currentMenu)) {\n\t\t\thideMenus()\n\t\t\treturn\n\t\t} else if (currentMenu) {\n\t\t\t// another menu was open?\n\t\t\t// close it\n\t\t\thideMenus()\n\t\t}\n\n\t\tif (headerMenu === true) {\n\t\t\t$menuEl.parent().addClass('openedMenu')\n\t\t}\n\n\t\t// Set menu to expanded\n\t\t$toggle.attr('aria-expanded', true)\n\n\t\t$menuEl.slideToggle(menuSpeed, toggle)\n\t\tcurrentMenu = $menuEl\n\t\tcurrentMenuToggle = $toggle\n\t})\n}\n\n/**\n * Unregister a previously registered menu\n *\n * @param {jQuery} $toggle the toggle element\n * @param {jQuery} $menuEl the menu container element\n */\nexport const unregisterMenu = ($toggle, $menuEl) => {\n\t// close menu if opened\n\tif ($menuEl.is(currentMenu)) {\n\t\thideMenus()\n\t}\n\t$toggle.off('click.menu').removeClass('menutoggle')\n\t$menuEl.removeClass('menu')\n}\n\n/**\n * Hides any open menus\n *\n * @param {Function} complete callback when the hiding animation is done\n */\nexport const hideMenus = function(complete) {\n\tif (currentMenu) {\n\t\tconst lastMenu = currentMenu\n\t\tcurrentMenu.trigger(new $.Event('beforeHide'))\n\t\tcurrentMenu.slideUp(menuSpeed, function() {\n\t\t\tlastMenu.trigger(new $.Event('afterHide'))\n\t\t\tif (complete) {\n\t\t\t\tcomplete.apply(this, arguments)\n\t\t\t}\n\t\t})\n\t}\n\n\t// Set menu to closed\n\t$('.menutoggle').attr('aria-expanded', false)\n\tif (currentMenuToggle) {\n\t\tcurrentMenuToggle.attr('aria-expanded', false)\n\t}\n\n\t$('.openedMenu').removeClass('openedMenu')\n\tcurrentMenu = null\n\tcurrentMenuToggle = null\n}\n\n/**\n * Shows a given element as menu\n *\n * @param {object} [$toggle=null] menu toggle\n * @param {object} $menuEl menu element\n * @param {Function} complete callback when the showing animation is done\n */\nexport const showMenu = ($toggle, $menuEl, complete) => {\n\tif ($menuEl.is(currentMenu)) {\n\t\treturn\n\t}\n\thideMenus()\n\tcurrentMenu = $menuEl\n\tcurrentMenuToggle = $toggle\n\t$menuEl.trigger(new $.Event('beforeShow'))\n\t$menuEl.show()\n\t$menuEl.trigger(new $.Event('afterShow'))\n\t// no animation\n\tif (_.isFunction(complete)) {\n\t\tcomplete()\n\t}\n}\n","/**\n * @copyright 2019 Christoph Wurst \n *\n * @author Christoph Wurst \n * @author John Molakvoæ \n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n */\n\nexport const coreApps = ['', 'admin', 'log', 'core/search', 'core', '3rdparty']\nexport const menuSpeed = 50\nexport const PERMISSION_NONE = 0\nexport const PERMISSION_CREATE = 4\nexport const PERMISSION_READ = 1\nexport const PERMISSION_UPDATE = 2\nexport const PERMISSION_DELETE = 8\nexport const PERMISSION_SHARE = 16\nexport const PERMISSION_ALL = 31\nexport const TAG_FAVORITE = '_$!!$_'\n","/**\n * @copyright 2019 Christoph Wurst \n *\n * @author Christoph Wurst \n * @author John Molakvoæ \n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n */\n\nconst isAdmin = !!window._oc_isadmin\n\n/**\n * Returns whether the current user is an administrator\n *\n * @return {boolean} true if the user is an admin, false otherwise\n * @since 9.0.0\n */\nexport const isUserAdmin = () => isAdmin\n","/**\n * Copyright (c) 2014 Vincent Petry \n * Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)\n *\n * @author Christoph Wurst \n * @author Daniel Kesselberg \n * @author Joas Schilling \n * @author John Molakvoæ \n * @author Morris Jobke \n * @author Roeland Jago Douma \n * @author Vincent Petry \n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n */\n\nimport Handlebars from 'handlebars'\nimport {\n\tloadTranslations,\n\ttranslate,\n\ttranslatePlural,\n\tregister,\n\tunregister,\n} from '@nextcloud/l10n'\n\n/**\n * L10N namespace with localization functions.\n *\n * @namespace OC.L10n\n * @deprecated 26.0.0 use https://www.npmjs.com/package/@nextcloud/l10n\n */\nconst L10n = {\n\n\t/**\n\t * Load an app's translation bundle if not loaded already.\n\t *\n\t * @deprecated 26.0.0 use `loadTranslations` from https://www.npmjs.com/package/@nextcloud/l10n\n\t *\n\t * @param {string} appName name of the app\n\t * @param {Function} callback callback to be called when\n\t * the translations are loaded\n\t * @return {Promise} promise\n\t */\n\tload: loadTranslations,\n\n\t/**\n\t * Register an app's translation bundle.\n\t *\n\t * @deprecated 26.0.0 use `register` from https://www.npmjs.com/package/@nextcloud/l10\n\t *\n\t * @param {string} appName name of the app\n\t * @param {Object} bundle bundle\n\t */\n\tregister,\n\n\t/**\n\t * @private\n\t * @deprecated 26.0.0 use `unregister` from https://www.npmjs.com/package/@nextcloud/l10n\n\t */\n\t_unregister: unregister,\n\n\t/**\n\t * Translate a string\n\t *\n\t * @deprecated 26.0.0 use `translate` from https://www.npmjs.com/package/@nextcloud/l10n\n\t *\n\t * @param {string} app the id of the app for which to translate the string\n\t * @param {string} text the string to translate\n\t * @param {object} [vars] map of placeholder key to value\n\t * @param {number} [count] number to replace %n with\n\t * @param {Array} [options] options array\n\t * @param {boolean} [options.escape=true] enable/disable auto escape of placeholders (by default enabled)\n\t * @param {boolean} [options.sanitize=true] enable/disable sanitization (by default enabled)\n\t * @return {string}\n\t */\n\ttranslate,\n\n\t/**\n\t * Translate a plural string\n\t *\n\t * @deprecated 26.0.0 use `translatePlural` from https://www.npmjs.com/package/@nextcloud/l10n\n\t *\n\t * @param {string} app the id of the app for which to translate the string\n\t * @param {string} textSingular the string to translate for exactly one object\n\t * @param {string} textPlural the string to translate for n objects\n\t * @param {number} count number to determine whether to use singular or plural\n\t * @param {object} [vars] map of placeholder key to value\n\t * @param {Array} [options] options array\n\t * @param {boolean} [options.escape=true] enable/disable auto escape of placeholders (by default enabled)\n\t * @return {string} Translated string\n\t */\n\ttranslatePlural,\n}\n\nexport default L10n\n\nHandlebars.registerHelper('t', function(app, text) {\n\treturn translate(app, text)\n})\n","/**\n * @copyright 2019 Christoph Wurst \n *\n * @author Christoph Wurst \n * @author John Molakvoæ \n * @author Roeland Jago Douma \n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n */\n\nimport {\n\tgetRootUrl as realGetRootUrl,\n} from '@nextcloud/router'\n\n/**\n * Creates a relative url for remote use\n *\n * @param {string} service id\n * @return {string} the url\n */\nexport const linkToRemoteBase = service => {\n\treturn realGetRootUrl() + '/remote.php/' + service\n}\n","/**\n * @copyright 2019 Christoph Wurst \n *\n * @author Christoph Wurst \n * @author John Molakvoæ \n * @author rakekniven \n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n */\n\nimport $ from 'jquery'\n\n/**\n * A little class to manage a status field for a \"saving\" process.\n * It can be used to display a starting message (e.g. \"Saving...\") and then\n * replace it with a green success message or a red error message.\n *\n * @namespace OC.msg\n */\nexport default {\n\t/**\n\t * Displayes a \"Saving...\" message in the given message placeholder\n\t *\n\t * @param {object} selector Placeholder to display the message in\n\t */\n\tstartSaving(selector) {\n\t\tthis.startAction(selector, t('core', 'Saving …'))\n\t},\n\n\t/**\n\t * Displayes a custom message in the given message placeholder\n\t *\n\t * @param {object} selector Placeholder to display the message in\n\t * @param {string} message Plain text message to display (no HTML allowed)\n\t */\n\tstartAction(selector, message) {\n\t\t$(selector).text(message)\n\t\t\t.removeClass('success')\n\t\t\t.removeClass('error')\n\t\t\t.stop(true, true)\n\t\t\t.show()\n\t},\n\n\t/**\n\t * Displayes an success/error message in the given selector\n\t *\n\t * @param {object} selector Placeholder to display the message in\n\t * @param {object} response Response of the server\n\t * @param {object} response.data Data of the servers response\n\t * @param {string} response.data.message Plain text message to display (no HTML allowed)\n\t * @param {string} response.status is being used to decide whether the message\n\t * is displayed as an error/success\n\t */\n\tfinishedSaving(selector, response) {\n\t\tthis.finishedAction(selector, response)\n\t},\n\n\t/**\n\t * Displayes an success/error message in the given selector\n\t *\n\t * @param {object} selector Placeholder to display the message in\n\t * @param {object} response Response of the server\n\t * @param {object} response.data Data of the servers response\n\t * @param {string} response.data.message Plain text message to display (no HTML allowed)\n\t * @param {string} response.status is being used to decide whether the message\n\t * is displayed as an error/success\n\t */\n\tfinishedAction(selector, response) {\n\t\tif (response.status === 'success') {\n\t\t\tthis.finishedSuccess(selector, response.data.message)\n\t\t} else {\n\t\t\tthis.finishedError(selector, response.data.message)\n\t\t}\n\t},\n\n\t/**\n\t * Displayes an success message in the given selector\n\t *\n\t * @param {object} selector Placeholder to display the message in\n\t * @param {string} message Plain text success message to display (no HTML allowed)\n\t */\n\tfinishedSuccess(selector, message) {\n\t\t$(selector).text(message)\n\t\t\t.addClass('success')\n\t\t\t.removeClass('error')\n\t\t\t.stop(true, true)\n\t\t\t.delay(3000)\n\t\t\t.fadeOut(900)\n\t\t\t.show()\n\t},\n\n\t/**\n\t * Displayes an error message in the given selector\n\t *\n\t * @param {object} selector Placeholder to display the message in\n\t * @param {string} message Plain text error message to display (no HTML allowed)\n\t */\n\tfinishedError(selector, message) {\n\t\t$(selector).text(message)\n\t\t\t.addClass('error')\n\t\t\t.removeClass('success')\n\t\t\t.show()\n\t},\n}\n","/**\n * @copyright 2019 Christoph Wurst \n *\n * @author Christoph Wurst \n * @author John Molakvoæ \n * @author Roeland Jago Douma \n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n */\n\nimport { confirmPassword, isPasswordConfirmationRequired } from '@nextcloud/password-confirmation'\nimport '@nextcloud/password-confirmation/dist/style.css'\n\n/**\n * @namespace OC.PasswordConfirmation\n */\nexport default {\n\n\trequiresPasswordConfirmation() {\n\t\treturn isPasswordConfirmationRequired()\n\t},\n\n\t/**\n\t * @param {Function} callback success callback function\n\t * @param {object} options options currently not used by confirmPassword\n\t * @param {Function} rejectCallback error callback function\n\t */\n\trequirePasswordConfirmation(callback, options, rejectCallback) {\n\t\tconfirmPassword().then(callback, rejectCallback)\n\t},\n}\n","/**\n * @copyright 2019 Christoph Wurst \n *\n * @author Christoph Wurst \n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n */\n\nexport const theme = window._theme || {}\n","/**\n * @copyright 2019 Christoph Wurst \n *\n * @author Christoph Wurst \n * @author John Molakvoæ \n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n */\n\nimport _ from 'underscore'\nimport OC from './index.js'\n\n/**\n * Utility class for the history API,\n * includes fallback to using the URL hash when\n * the browser doesn't support the history API.\n *\n * @namespace OC.Util.History\n */\nexport default {\n\n\t_handlers: [],\n\n\t/**\n\t * Push the current URL parameters to the history stack\n\t * and change the visible URL.\n\t * Note: this includes a workaround for IE8/IE9 that uses\n\t * the hash part instead of the search part.\n\t *\n\t * @param {object | string} params to append to the URL, can be either a string\n\t * or a map\n\t * @param {string} [url] URL to be used, otherwise the current URL will be used,\n\t * using the params as query string\n\t * @param {boolean} [replace=false] whether to replace instead of pushing\n\t */\n\t_pushState(params, url, replace) {\n\t\tlet strParams\n\t\tif (typeof (params) === 'string') {\n\t\t\tstrParams = params\n\t\t} else {\n\t\t\tstrParams = OC.buildQueryString(params)\n\t\t}\n\n\t\tif (window.history.pushState) {\n\t\t\turl = url || location.pathname + '?' + strParams\n\t\t\t// Workaround for bug with SVG and window.history.pushState on Firefox < 51\n\t\t\t// https://bugzilla.mozilla.org/show_bug.cgi?id=652991\n\t\t\tconst isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1\n\t\t\tif (isFirefox && parseInt(navigator.userAgent.split('/').pop()) < 51) {\n\t\t\t\tconst patterns = document.querySelectorAll('[fill^=\"url(#\"], [stroke^=\"url(#\"], [filter^=\"url(#invert\"]')\n\t\t\t\tfor (let i = 0, ii = patterns.length, pattern; i < ii; i++) {\n\t\t\t\t\tpattern = patterns[i]\n\t\t\t\t\t// eslint-disable-next-line no-self-assign\n\t\t\t\t\tpattern.style.fill = pattern.style.fill\n\t\t\t\t\t// eslint-disable-next-line no-self-assign\n\t\t\t\t\tpattern.style.stroke = pattern.style.stroke\n\t\t\t\t\tpattern.removeAttribute('filter')\n\t\t\t\t\tpattern.setAttribute('filter', 'url(#invert)')\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (replace) {\n\t\t\t\twindow.history.replaceState(params, '', url)\n\t\t\t} else {\n\t\t\t\twindow.history.pushState(params, '', url)\n\t\t\t}\n\t\t} else {\n\t\t\t// use URL hash for IE8\n\t\t\twindow.location.hash = '?' + strParams\n\t\t\t// inhibit next onhashchange that just added itself\n\t\t\t// to the event queue\n\t\t\tthis._cancelPop = true\n\t\t}\n\t},\n\n\t/**\n\t * Push the current URL parameters to the history stack\n\t * and change the visible URL.\n\t * Note: this includes a workaround for IE8/IE9 that uses\n\t * the hash part instead of the search part.\n\t *\n\t * @param {object | string} params to append to the URL, can be either a string or a map\n\t * @param {string} [url] URL to be used, otherwise the current URL will be used, using the params as query string\n\t */\n\tpushState(params, url) {\n\t\tthis._pushState(params, url, false)\n\t},\n\n\t/**\n\t * Push the current URL parameters to the history stack\n\t * and change the visible URL.\n\t * Note: this includes a workaround for IE8/IE9 that uses\n\t * the hash part instead of the search part.\n\t *\n\t * @param {object | string} params to append to the URL, can be either a string\n\t * or a map\n\t * @param {string} [url] URL to be used, otherwise the current URL will be used,\n\t * using the params as query string\n\t */\n\treplaceState(params, url) {\n\t\tthis._pushState(params, url, true)\n\t},\n\n\t/**\n\t * Add a popstate handler\n\t *\n\t * @param {Function} handler handler\n\t */\n\taddOnPopStateHandler(handler) {\n\t\tthis._handlers.push(handler)\n\t},\n\n\t/**\n\t * Parse a query string from the hash part of the URL.\n\t * (workaround for IE8 / IE9)\n\t *\n\t * @return {string}\n\t */\n\t_parseHashQuery() {\n\t\tconst hash = window.location.hash\n\t\tconst pos = hash.indexOf('?')\n\t\tif (pos >= 0) {\n\t\t\treturn hash.substr(pos + 1)\n\t\t}\n\t\tif (hash.length) {\n\t\t\t// remove hash sign\n\t\t\treturn hash.substr(1)\n\t\t}\n\t\treturn ''\n\t},\n\n\t_decodeQuery(query) {\n\t\treturn query.replace(/\\+/g, ' ')\n\t},\n\n\t/**\n\t * Parse the query/search part of the URL.\n\t * Also try and parse it from the URL hash (for IE8)\n\t *\n\t * @return {object} map of parameters\n\t */\n\tparseUrlQuery() {\n\t\tconst query = this._parseHashQuery()\n\t\tlet params\n\t\t// try and parse from URL hash first\n\t\tif (query) {\n\t\t\tparams = OC.parseQueryString(this._decodeQuery(query))\n\t\t}\n\t\t// else read from query attributes\n\t\tparams = _.extend(params || {}, OC.parseQueryString(this._decodeQuery(location.search)))\n\t\treturn params || {}\n\t},\n\n\t_onPopState(e) {\n\t\tif (this._cancelPop) {\n\t\t\tthis._cancelPop = false\n\t\t\treturn\n\t\t}\n\t\tlet params\n\t\tif (!this._handlers.length) {\n\t\t\treturn\n\t\t}\n\t\tparams = (e && e.state)\n\t\tif (_.isString(params)) {\n\t\t\tparams = OC.parseQueryString(params)\n\t\t} else if (!params) {\n\t\t\tparams = this.parseUrlQuery() || {}\n\t\t}\n\t\tfor (let i = 0; i < this._handlers.length; i++) {\n\t\t\tthis._handlers[i](params)\n\t\t}\n\t},\n}\n","/**\n * @copyright 2019 Christoph Wurst \n *\n * @author Christoph Wurst \n * @author John Molakvoæ \n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n */\n\nimport moment from 'moment'\n\nimport History from './util-history.js'\nimport OC from './index.js'\nimport { formatFileSize as humanFileSize } from '@nextcloud/files'\n\n/**\n * @param {any} t -\n */\nfunction chunkify(t) {\n\t// Adapted from http://my.opera.com/GreyWyvern/blog/show.dml/1671288\n\tconst tz = []\n\tlet x = 0\n\tlet y = -1\n\tlet n = 0\n\tlet c\n\n\twhile (x < t.length) {\n\t\tc = t.charAt(x)\n\t\t// only include the dot in strings\n\t\tconst m = ((!n && c === '.') || (c >= '0' && c <= '9'))\n\t\tif (m !== n) {\n\t\t\t// next chunk\n\t\t\ty++\n\t\t\ttz[y] = ''\n\t\t\tn = m\n\t\t}\n\t\ttz[y] += c\n\t\tx++\n\t}\n\treturn tz\n}\n\n/**\n * Utility functions\n *\n * @namespace OC.Util\n */\nexport default {\n\n\tHistory,\n\n\t/**\n\t * @deprecated use https://nextcloud.github.io/nextcloud-files/functions/formatFileSize.html\n\t */\n\thumanFileSize,\n\n\t/**\n\t * Returns a file size in bytes from a humanly readable string\n\t * Makes 2kB to 2048.\n\t * Inspired by computerFileSize in helper.php\n\t *\n\t * @param {string} string file size in human-readable format\n\t * @return {number} or null if string could not be parsed\n\t *\n\t *\n\t */\n\tcomputerFileSize(string) {\n\t\tif (typeof string !== 'string') {\n\t\t\treturn null\n\t\t}\n\n\t\tconst s = string.toLowerCase().trim()\n\t\tlet bytes = null\n\n\t\tconst bytesArray = {\n\t\t\tb: 1,\n\t\t\tk: 1024,\n\t\t\tkb: 1024,\n\t\t\tmb: 1024 * 1024,\n\t\t\tm: 1024 * 1024,\n\t\t\tgb: 1024 * 1024 * 1024,\n\t\t\tg: 1024 * 1024 * 1024,\n\t\t\ttb: 1024 * 1024 * 1024 * 1024,\n\t\t\tt: 1024 * 1024 * 1024 * 1024,\n\t\t\tpb: 1024 * 1024 * 1024 * 1024 * 1024,\n\t\t\tp: 1024 * 1024 * 1024 * 1024 * 1024,\n\t\t}\n\n\t\tconst matches = s.match(/^[\\s+]?([0-9]*)(\\.([0-9]+))?( +)?([kmgtp]?b?)$/i)\n\t\tif (matches !== null) {\n\t\t\tbytes = parseFloat(s)\n\t\t\tif (!isFinite(bytes)) {\n\t\t\t\treturn null\n\t\t\t}\n\t\t} else {\n\t\t\treturn null\n\t\t}\n\t\tif (matches[5]) {\n\t\t\tbytes = bytes * bytesArray[matches[5]]\n\t\t}\n\n\t\tbytes = Math.round(bytes)\n\t\treturn bytes\n\t},\n\n\t/**\n\t * @param {string|number} timestamp timestamp\n\t * @param {string} format date format, see momentjs docs\n\t * @return {string} timestamp formatted as requested\n\t */\n\tformatDate(timestamp, format) {\n\t\tif (window.TESTING === undefined) {\n\t\t\tOC.debug && console.warn('OC.Util.formatDate is deprecated and will be removed in Nextcloud 21. See @nextcloud/moment')\n\t\t}\n\t\tformat = format || 'LLL'\n\t\treturn moment(timestamp).format(format)\n\t},\n\n\t/**\n\t * @param {string|number} timestamp timestamp\n\t * @return {string} human readable difference from now\n\t */\n\trelativeModifiedDate(timestamp) {\n\t\tif (window.TESTING === undefined) {\n\t\t\tOC.debug && console.warn('OC.Util.relativeModifiedDate is deprecated and will be removed in Nextcloud 21. See @nextcloud/moment')\n\t\t}\n\t\tconst diff = moment().diff(moment(timestamp))\n\t\tif (diff >= 0 && diff < 45000) {\n\t\t\treturn t('core', 'seconds ago')\n\t\t}\n\t\treturn moment(timestamp).fromNow()\n\t},\n\n\t/**\n\t * Returns the width of a generic browser scrollbar\n\t *\n\t * @return {number} width of scrollbar\n\t */\n\tgetScrollBarWidth() {\n\t\tif (this._scrollBarWidth) {\n\t\t\treturn this._scrollBarWidth\n\t\t}\n\n\t\tconst inner = document.createElement('p')\n\t\tinner.style.width = '100%'\n\t\tinner.style.height = '200px'\n\n\t\tconst outer = document.createElement('div')\n\t\touter.style.position = 'absolute'\n\t\touter.style.top = '0px'\n\t\touter.style.left = '0px'\n\t\touter.style.visibility = 'hidden'\n\t\touter.style.width = '200px'\n\t\touter.style.height = '150px'\n\t\touter.style.overflow = 'hidden'\n\t\touter.appendChild(inner)\n\n\t\tdocument.body.appendChild(outer)\n\t\tconst w1 = inner.offsetWidth\n\t\touter.style.overflow = 'scroll'\n\t\tlet w2 = inner.offsetWidth\n\t\tif (w1 === w2) {\n\t\t\tw2 = outer.clientWidth\n\t\t}\n\n\t\tdocument.body.removeChild(outer)\n\n\t\tthis._scrollBarWidth = (w1 - w2)\n\n\t\treturn this._scrollBarWidth\n\t},\n\n\t/**\n\t * Remove the time component from a given date\n\t *\n\t * @param {Date} date date\n\t * @return {Date} date with stripped time\n\t */\n\tstripTime(date) {\n\t\t// FIXME: likely to break when crossing DST\n\t\t// would be better to use a library like momentJS\n\t\treturn new Date(date.getFullYear(), date.getMonth(), date.getDate())\n\t},\n\n\t/**\n\t * Compare two strings to provide a natural sort\n\t *\n\t * @param {string} a first string to compare\n\t * @param {string} b second string to compare\n\t * @return {number} -1 if b comes before a, 1 if a comes before b\n\t * or 0 if the strings are identical\n\t */\n\tnaturalSortCompare(a, b) {\n\t\tlet x\n\t\tconst aa = chunkify(a)\n\t\tconst bb = chunkify(b)\n\n\t\tfor (x = 0; aa[x] && bb[x]; x++) {\n\t\t\tif (aa[x] !== bb[x]) {\n\t\t\t\tconst aNum = Number(aa[x]); const bNum = Number(bb[x])\n\t\t\t\t// note: == is correct here\n\t\t\t\t/* eslint-disable-next-line */\n\t\t\t\tif (aNum == aa[x] && bNum == bb[x]) {\n\t\t\t\t\treturn aNum - bNum\n\t\t\t\t} else {\n\t\t\t\t\t// Note: This locale setting isn't supported by all browsers but for the ones\n\t\t\t\t\t// that do there will be more consistency between client-server sorting\n\t\t\t\t\treturn aa[x].localeCompare(bb[x], OC.getLanguage())\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn aa.length - bb.length\n\t},\n\n\t/**\n\t * Calls the callback in a given interval until it returns true\n\t *\n\t * @param {Function} callback function to call on success\n\t * @param {number} interval in milliseconds\n\t */\n\twaitFor(callback, interval) {\n\t\tconst internalCallback = function() {\n\t\t\tif (callback() !== true) {\n\t\t\t\tsetTimeout(internalCallback, interval)\n\t\t\t}\n\t\t}\n\n\t\tinternalCallback()\n\t},\n\n\t/**\n\t * Checks if a cookie with the given name is present and is set to the provided value.\n\t *\n\t * @param {string} name name of the cookie\n\t * @param {string} value value of the cookie\n\t * @return {boolean} true if the cookie with the given name has the given value\n\t */\n\tisCookieSetToValue(name, value) {\n\t\tconst cookies = document.cookie.split(';')\n\t\tfor (let i = 0; i < cookies.length; i++) {\n\t\t\tconst cookie = cookies[i].split('=')\n\t\t\tif (cookie[0].trim() === name && cookie[1].trim() === value) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t\treturn false\n\t},\n}\n","/**\n * @copyright 2019 Christoph Wurst \n *\n * @author Christoph Wurst \n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n */\n\nconst base = window._oc_debug\n\nexport const debug = base\n","/**\n * @copyright 2019 Christoph Wurst \n *\n * @author Christoph Wurst \n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n */\n\nlet webroot = window._oc_webroot\n\nif (typeof webroot === 'undefined') {\n\twebroot = location.pathname\n\tconst pos = webroot.indexOf('/index.php/')\n\tif (pos !== -1) {\n\t\twebroot = webroot.substr(0, pos)\n\t} else {\n\t\twebroot = webroot.substr(0, webroot.lastIndexOf('/'))\n\t}\n}\n\nexport default webroot\n","/**\n * @copyright 2019 Christoph Wurst \n *\n * @author Christoph Wurst \n * @author John Molakvoæ \n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n */\n\nexport const get = context => name => {\n\tconst namespaces = name.split('.')\n\tconst tail = namespaces.pop()\n\n\tfor (let i = 0; i < namespaces.length; i++) {\n\t\tcontext = context[namespaces[i]]\n\t\tif (!context) {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn context[tail]\n}\n\n/**\n * Set a variable by name\n *\n * @param {string} context context\n * @return {Function} setter\n * @deprecated 19.0.0 use https://lodash.com/docs#set\n */\nexport const set = context => (name, value) => {\n\tconst namespaces = name.split('.')\n\tconst tail = namespaces.pop()\n\n\tfor (let i = 0; i < namespaces.length; i++) {\n\t\tif (!context[namespaces[i]]) {\n\t\t\tcontext[namespaces[i]] = {}\n\t\t}\n\t\tcontext = context[namespaces[i]]\n\t}\n\tcontext[tail] = value\n\treturn value\n}\n","/**\n * @copyright 2019 Christoph Wurst \n *\n * @author Christoph Wurst \n * @author John Molakvoæ \n * @author Roeland Jago Douma \n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n */\n\nimport { subscribe } from '@nextcloud/event-bus'\n\nimport {\n\tajaxConnectionLostHandler,\n\tprocessAjaxError,\n\tregisterXHRForErrorProcessing,\n} from './xhr-error.js'\nimport Apps from './apps.js'\nimport { AppConfig, appConfig } from './appconfig.js'\nimport appswebroots from './appswebroots.js'\nimport Backbone from './backbone.js'\nimport {\n\tbasename,\n\tdirname,\n\tencodePath,\n\tisSamePath,\n\tjoinPaths,\n} from '@nextcloud/paths'\nimport {\n\tbuild as buildQueryString,\n\tparse as parseQueryString,\n} from './query-string.js'\nimport Config from './config.js'\nimport {\n\tcoreApps,\n\tmenuSpeed,\n\tPERMISSION_ALL,\n\tPERMISSION_CREATE,\n\tPERMISSION_DELETE,\n\tPERMISSION_NONE,\n\tPERMISSION_READ,\n\tPERMISSION_SHARE,\n\tPERMISSION_UPDATE,\n\tTAG_FAVORITE,\n} from './constants.js'\nimport { currentUser, getCurrentUser } from './currentuser.js'\nimport Dialogs from './dialogs.js'\nimport EventSource from './eventsource.js'\nimport { get, set } from './get_set.js'\nimport { getCapabilities } from './capabilities.js'\nimport {\n\tgetHost,\n\tgetHostName,\n\tgetPort,\n\tgetProtocol,\n} from './host.js'\nimport {\n\tgetToken as getRequestToken,\n} from './requesttoken.js'\nimport {\n\thideMenus,\n\tregisterMenu,\n\tshowMenu,\n\tunregisterMenu,\n} from './menu.js'\nimport { isUserAdmin } from './admin.js'\nimport L10N from './l10n.js'\nimport {\n\tgetCanonicalLocale,\n\tgetLanguage,\n\tgetLocale,\n} from '@nextcloud/l10n'\n\nimport {\n\tgenerateUrl,\n\tgenerateFilePath,\n\tgenerateOcsUrl,\n\tgenerateRemoteUrl,\n\tgetRootUrl,\n\timagePath,\n\tlinkTo,\n} from '@nextcloud/router'\n\nimport {\n\tlinkToRemoteBase,\n} from './routing.js'\nimport msg from './msg.js'\nimport Notification from './notification.js'\nimport PasswordConfirmation from './password-confirmation.js'\nimport Plugins from './plugins.js'\nimport { theme } from './theme.js'\nimport Util from './util.js'\nimport { debug } from './debug.js'\nimport { redirect, reload } from './navigation.js'\nimport webroot from './webroot.js'\n\n/** @namespace OC */\nexport default {\n\t/*\n\t * Constants\n\t */\n\tcoreApps,\n\tmenuSpeed,\n\tPERMISSION_ALL,\n\tPERMISSION_CREATE,\n\tPERMISSION_DELETE,\n\tPERMISSION_NONE,\n\tPERMISSION_READ,\n\tPERMISSION_SHARE,\n\tPERMISSION_UPDATE,\n\tTAG_FAVORITE,\n\n\t/*\n\t * Deprecated helpers to be removed\n\t */\n\t/**\n\t * Check if a user file is allowed to be handled.\n\t *\n\t * @param {string} file to check\n\t * @return {boolean}\n\t * @deprecated 17.0.0\n\t */\n\tfileIsBlacklisted: file => !!(file.match(Config.blacklist_files_regex)),\n\tApps,\n\tAppConfig,\n\tappConfig,\n\tappswebroots,\n\tBackbone,\n\tconfig: Config,\n\t/**\n\t * Currently logged in user or null if none\n\t *\n\t * @type {string}\n\t * @deprecated use `getCurrentUser` from https://www.npmjs.com/package/@nextcloud/auth\n\t */\n\tcurrentUser,\n\tdialogs: Dialogs,\n\tEventSource,\n\t/**\n\t * Returns the currently logged in user or null if there is no logged in\n\t * user (public page mode)\n\t *\n\t * @since 9.0.0\n\t * @deprecated 19.0.0 use `getCurrentUser` from https://www.npmjs.com/package/@nextcloud/auth\n\t */\n\tgetCurrentUser,\n\tisUserAdmin,\n\tL10N,\n\n\t/**\n\t * Ajax error handlers\n\t *\n\t * @todo remove from here and keep internally -> requires new tests\n\t */\n\t_ajaxConnectionLostHandler: ajaxConnectionLostHandler,\n\t_processAjaxError: processAjaxError,\n\tregisterXHRForErrorProcessing,\n\n\t/**\n\t * Capabilities\n\t *\n\t * @type {Array}\n\t * @deprecated 20.0.0 use @nextcloud/capabilities instead\n\t */\n\tgetCapabilities,\n\n\t/*\n\t * Legacy menu helpers\n\t */\n\thideMenus,\n\tregisterMenu,\n\tshowMenu,\n\tunregisterMenu,\n\n\t/*\n\t * Path helpers\n\t */\n\t/**\n\t * @deprecated 18.0.0 use https://www.npmjs.com/package/@nextcloud/paths\n\t */\n\tbasename,\n\t/**\n\t * @deprecated 18.0.0 use https://www.npmjs.com/package/@nextcloud/paths\n\t */\n\tencodePath,\n\t/**\n\t * @deprecated 18.0.0 use https://www.npmjs.com/package/@nextcloud/paths\n\t */\n\tdirname,\n\t/**\n\t * @deprecated 18.0.0 use https://www.npmjs.com/package/@nextcloud/paths\n\t */\n\tisSamePath,\n\t/**\n\t * @deprecated 18.0.0 use https://www.npmjs.com/package/@nextcloud/paths\n\t */\n\tjoinPaths,\n\n\t/**\n\t * Host (url) helpers\n\t */\n\tgetHost,\n\tgetHostName,\n\tgetPort,\n\tgetProtocol,\n\n\t/**\n\t * @deprecated 20.0.0 use `getCanonicalLocale` from https://www.npmjs.com/package/@nextcloud/l10n\n\t */\n\tgetCanonicalLocale,\n\t/**\n\t * @deprecated 26.0.0 use `getLocale` from https://www.npmjs.com/package/@nextcloud/l10n\n\t */\n\tgetLocale,\n\t/**\n\t * @deprecated 26.0.0 use `getLanguage` from https://www.npmjs.com/package/@nextcloud/l10n\n\t */\n\tgetLanguage,\n\n\t/**\n\t * Query string helpers\n\t */\n\tbuildQueryString,\n\tparseQueryString,\n\n\tmsg,\n\tNotification,\n\t/**\n\t * @deprecated 28.0.0 use methods from '@nextcloud/password-confirmation'\n\t */\n\tPasswordConfirmation,\n\tPlugins,\n\ttheme,\n\tUtil,\n\tdebug,\n\t/**\n\t * @deprecated 19.0.0 use `generateFilePath` from https://www.npmjs.com/package/@nextcloud/router\n\t */\n\tfilePath: generateFilePath,\n\t/**\n\t * @deprecated 19.0.0 use `generateUrl` from https://www.npmjs.com/package/@nextcloud/router\n\t */\n\tgenerateUrl,\n\t/**\n\t * @deprecated 19.0.0 use https://lodash.com/docs#get\n\t */\n\tget: get(window),\n\t/**\n\t * @deprecated 19.0.0 use https://lodash.com/docs#set\n\t */\n\tset: set(window),\n\t/**\n\t * @deprecated 19.0.0 use `getRootUrl` from https://www.npmjs.com/package/@nextcloud/router\n\t */\n\tgetRootPath: getRootUrl,\n\t/**\n\t * @deprecated 19.0.0 use `imagePath` from https://www.npmjs.com/package/@nextcloud/router\n\t */\n\timagePath,\n\tredirect,\n\treload,\n\trequestToken: getRequestToken(),\n\t/**\n\t * @deprecated 19.0.0 use `linkTo` from https://www.npmjs.com/package/@nextcloud/router\n\t */\n\tlinkTo,\n\t/**\n\t * @param {string} service service name\n\t * @param {number} version OCS API version\n\t * @return {string} OCS API base path\n\t * @deprecated 19.0.0 use `generateOcsUrl` from https://www.npmjs.com/package/@nextcloud/router\n\t */\n\tlinkToOCS: (service, version) => {\n\t\treturn generateOcsUrl(service, {}, {\n\t\t\tocsVersion: version || 1,\n\t\t}) + '/'\n\t},\n\t/**\n\t * @deprecated 19.0.0 use `generateRemoteUrl` from https://www.npmjs.com/package/@nextcloud/router\n\t */\n\tlinkToRemote: generateRemoteUrl,\n\tlinkToRemoteBase,\n\t/**\n\t * Relative path to Nextcloud root.\n\t * For example: \"/nextcloud\"\n\t *\n\t * @type {string}\n\t *\n\t * @deprecated 19.0.0 use `getRootUrl` from https://www.npmjs.com/package/@nextcloud/router\n\t * @see OC#getRootPath\n\t */\n\twebroot,\n}\n\n// Keep the request token prop in sync\nsubscribe('csrf-token-update', e => {\n\tOC.requestToken = e.token\n\n\t// Logging might help debug (Sentry) issues\n\tconsole.info('OC.requestToken changed', e.token)\n})\n","/**\n * @copyright 2019 Christoph Wurst \n *\n * @author Christoph Wurst \n * @author John Molakvoæ \n * @author Roeland Jago Douma \n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n */\n\nimport { getCapabilities as realGetCapabilities } from '@nextcloud/capabilities'\n\n/**\n * Returns the capabilities\n *\n * @return {Array} capabilities\n *\n * @since 14.0.0\n */\nexport const getCapabilities = () => {\n\tOC.debug && console.warn('OC.getCapabilities is deprecated and will be removed in Nextcloud 21. See @nextcloud/capabilities')\n\treturn realGetCapabilities()\n}\n","/**\n * @copyright 2019 Christoph Wurst \n *\n * @author Christoph Wurst \n * @author John Molakvoæ \n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n */\n\nexport const getProtocol = () => window.location.protocol.split(':')[0]\n\n/**\n * Returns the host used to access this Nextcloud instance\n * Host is sometimes the same as the hostname but now always.\n *\n * Examples:\n * http://example.com => example.com\n * https://example.com => example.com\n * http://example.com:8080 => example.com:8080\n *\n * @return {string} host\n *\n * @since 8.2.0\n * @deprecated 17.0.0 use window.location.host directly\n */\nexport const getHost = () => window.location.host\n\n/**\n * Returns the hostname used to access this Nextcloud instance\n * The hostname is always stripped of the port\n *\n * @return {string} hostname\n * @since 9.0.0\n * @deprecated 17.0.0 use window.location.hostname directly\n */\nexport const getHostName = () => window.location.hostname\n\n/**\n * Returns the port number used to access this Nextcloud instance\n *\n * @return {number} port number\n *\n * @since 8.2.0\n * @deprecated 17.0.0 use window.location.port directly\n */\nexport const getPort = () => window.location.port\n","/**\n * @copyright 2019 Christoph Wurst \n *\n * @author Christoph Wurst \n * @author John Molakvoæ \n * @author Roeland Jago Douma \n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n */\n\nimport $ from 'jquery'\n\n/**\n * Parses a URL query string into a JS map\n *\n * @param {string} queryString query string in the format param1=1234¶m2=abcde¶m3=xyz\n * @return {Object} map containing key/values matching the URL parameters\n */\nexport const parse = queryString => {\n\tlet pos\n\tlet components\n\tconst result = {}\n\tlet key\n\tif (!queryString) {\n\t\treturn null\n\t}\n\tpos = queryString.indexOf('?')\n\tif (pos >= 0) {\n\t\tqueryString = queryString.substr(pos + 1)\n\t}\n\tconst parts = queryString.replace(/\\+/g, '%20').split('&')\n\tfor (let i = 0; i < parts.length; i++) {\n\t\t// split on first equal sign\n\t\tconst part = parts[i]\n\t\tpos = part.indexOf('=')\n\t\tif (pos >= 0) {\n\t\t\tcomponents = [\n\t\t\t\tpart.substr(0, pos),\n\t\t\t\tpart.substr(pos + 1),\n\t\t\t]\n\t\t} else {\n\t\t\t// key only\n\t\t\tcomponents = [part]\n\t\t}\n\t\tif (!components.length) {\n\t\t\tcontinue\n\t\t}\n\t\tkey = decodeURIComponent(components[0])\n\t\tif (!key) {\n\t\t\tcontinue\n\t\t}\n\t\t// if equal sign was there, return string\n\t\tif (components.length > 1) {\n\t\t\tresult[key] = decodeURIComponent(components[1])\n\t\t} else {\n\t\t\t// no equal sign => null value\n\t\t\tresult[key] = null\n\t\t}\n\t}\n\treturn result\n}\n\n/**\n * Builds a URL query from a JS map.\n *\n * @param {Object} params map containing key/values matching the URL parameters\n * @return {string} String containing a URL query (without question) mark\n */\nexport const build = params => {\n\tif (!params) {\n\t\treturn ''\n\t}\n\treturn $.map(params, function(value, key) {\n\t\tlet s = encodeURIComponent(key)\n\t\tif (value !== null && typeof (value) !== 'undefined') {\n\t\t\ts += '=' + encodeURIComponent(value)\n\t\t}\n\t\treturn s\n\t}).join('&')\n}\n","/**\n * @copyright 2019 Christoph Wurst \n *\n * @author Christoph Wurst \n * @author John Molakvoæ \n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n */\n\nexport default {\n\n\t/**\n\t * @type {Array.}\n\t */\n\t_plugins: {},\n\n\t/**\n\t * Register plugin\n\t *\n\t * @param {string} targetName app name / class name to hook into\n\t * @param {OC.Plugin} plugin plugin\n\t */\n\tregister(targetName, plugin) {\n\t\tlet plugins = this._plugins[targetName]\n\t\tif (!plugins) {\n\t\t\tplugins = this._plugins[targetName] = []\n\t\t}\n\t\tplugins.push(plugin)\n\t},\n\n\t/**\n\t * Returns all plugin registered to the given target\n\t * name / app name / class name.\n\t *\n\t * @param {string} targetName app name / class name to hook into\n\t * @return {Array.} array of plugins\n\t */\n\tgetPlugins(targetName) {\n\t\treturn this._plugins[targetName] || []\n\t},\n\n\t/**\n\t * Call attach() on all plugins registered to the given target name.\n\t *\n\t * @param {string} targetName app name / class name\n\t * @param {object} targetObject to be extended\n\t * @param {object} [options] options\n\t */\n\tattach(targetName, targetObject, options) {\n\t\tconst plugins = this.getPlugins(targetName)\n\t\tfor (let i = 0; i < plugins.length; i++) {\n\t\t\tif (plugins[i].attach) {\n\t\t\t\tplugins[i].attach(targetObject, options)\n\t\t\t}\n\t\t}\n\t},\n\n\t/**\n\t * Call detach() on all plugins registered to the given target name.\n\t *\n\t * @param {string} targetName app name / class name\n\t * @param {object} targetObject to be extended\n\t * @param {object} [options] options\n\t */\n\tdetach(targetName, targetObject, options) {\n\t\tconst plugins = this.getPlugins(targetName)\n\t\tfor (let i = 0; i < plugins.length; i++) {\n\t\t\tif (plugins[i].detach) {\n\t\t\t\tplugins[i].detach(targetObject, options)\n\t\t\t}\n\t\t}\n\t},\n\n}\n","/**\n * @copyright 2019 Christoph Wurst \n *\n * @author Christoph Wurst \n * @author John Molakvoæ \n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n */\n\nexport const redirect = targetURL => { window.location = targetURL }\n\n/**\n * Reloads the current page\n *\n * @deprecated 17.0.0 use window.location.reload directly\n */\nexport const reload = () => { window.location.reload() }\n","var render = function render(){var _vm=this,_c=_vm._self._c;return _c('div',{staticClass:\"guest-box login-box\"},[(!_vm.hideLoginForm || _vm.directLogin)?[_c('transition',{attrs:{\"name\":\"fade\",\"mode\":\"out-in\"}},[(!_vm.passwordlessLogin && !_vm.resetPassword && _vm.resetPasswordTarget === '')?_c('div',[_c('LoginForm',{attrs:{\"username\":_vm.user,\"redirect-url\":_vm.redirectUrl,\"direct-login\":_vm.directLogin,\"messages\":_vm.messages,\"errors\":_vm.errors,\"throttle-delay\":_vm.throttleDelay,\"auto-complete-allowed\":_vm.autoCompleteAllowed},on:{\"update:username\":function($event){_vm.user=$event},\"submit\":function($event){_vm.loading = true}}}),_vm._v(\" \"),(_vm.canResetPassword && _vm.resetPasswordLink !== '')?_c('a',{staticClass:\"login-box__link\",attrs:{\"id\":\"lost-password\",\"href\":_vm.resetPasswordLink}},[_vm._v(\"\\n\\t\\t\\t\\t\\t\"+_vm._s(_vm.t('core', 'Forgot password?'))+\"\\n\\t\\t\\t\\t\")]):(_vm.canResetPassword && !_vm.resetPassword)?_c('a',{staticClass:\"login-box__link\",attrs:{\"id\":\"lost-password\",\"href\":_vm.resetPasswordLink},on:{\"click\":function($event){$event.preventDefault();_vm.resetPassword = true}}},[_vm._v(\"\\n\\t\\t\\t\\t\\t\"+_vm._s(_vm.t('core', 'Forgot password?'))+\"\\n\\t\\t\\t\\t\")]):_vm._e(),_vm._v(\" \"),(_vm.hasPasswordless)?[(_vm.countAlternativeLogins)?_c('div',{staticClass:\"alternative-logins\"},[(_vm.hasPasswordless)?_c('a',{staticClass:\"button\",class:{ 'single-alt-login-option': _vm.countAlternativeLogins },attrs:{\"href\":\"#\"},on:{\"click\":function($event){$event.preventDefault();_vm.passwordlessLogin = true}}},[_vm._v(\"\\n\\t\\t\\t\\t\\t\\t\\t\"+_vm._s(_vm.t('core', 'Log in with a device'))+\"\\n\\t\\t\\t\\t\\t\\t\")]):_vm._e()]):_c('a',{attrs:{\"href\":\"#\"},on:{\"click\":function($event){$event.preventDefault();_vm.passwordlessLogin = true}}},[_vm._v(\"\\n\\t\\t\\t\\t\\t\\t\"+_vm._s(_vm.t('core', 'Log in with a device'))+\"\\n\\t\\t\\t\\t\\t\")])]:_vm._e()],2):(!_vm.loading && _vm.passwordlessLogin)?_c('div',{key:\"reset\",staticClass:\"login-additional login-passwordless\"},[_c('PasswordLessLoginForm',{attrs:{\"username\":_vm.user,\"redirect-url\":_vm.redirectUrl,\"auto-complete-allowed\":_vm.autoCompleteAllowed,\"is-https\":_vm.isHttps,\"is-localhost\":_vm.isLocalhost,\"has-public-key-credential\":_vm.hasPublicKeyCredential},on:{\"update:username\":function($event){_vm.user=$event},\"submit\":function($event){_vm.loading = true}}}),_vm._v(\" \"),_c('NcButton',{attrs:{\"type\":\"tertiary\",\"aria-label\":_vm.t('core', 'Back to login form'),\"wide\":true},on:{\"click\":function($event){_vm.passwordlessLogin = false}}},[_vm._v(\"\\n\\t\\t\\t\\t\\t\"+_vm._s(_vm.t('core', 'Back'))+\"\\n\\t\\t\\t\\t\")])],1):(!_vm.loading && _vm.canResetPassword)?_c('div',{key:\"reset\",staticClass:\"login-additional\"},[_c('div',{staticClass:\"lost-password-container\"},[(_vm.resetPassword)?_c('ResetPassword',{attrs:{\"username\":_vm.user,\"reset-password-link\":_vm.resetPasswordLink},on:{\"update:username\":function($event){_vm.user=$event},\"abort\":function($event){_vm.resetPassword = false}}}):_vm._e()],1)]):(_vm.resetPasswordTarget !== '')?_c('div',[_c('UpdatePassword',{attrs:{\"username\":_vm.user,\"reset-password-target\":_vm.resetPasswordTarget},on:{\"update:username\":function($event){_vm.user=$event},\"done\":_vm.passwordResetFinished}})],1):_vm._e()])]:[_c('transition',{attrs:{\"name\":\"fade\",\"mode\":\"out-in\"}},[_c('NcNoteCard',{attrs:{\"type\":\"warning\",\"title\":_vm.t('core', 'Login form is disabled.')}},[_vm._v(\"\\n\\t\\t\\t\\t\"+_vm._s(_vm.t('core', 'Please contact your administrator.'))+\"\\n\\t\\t\\t\")])],1)],_vm._v(\" \"),_c('div',{staticClass:\"alternative-logins\",attrs:{\"id\":\"alternative-logins\"}},_vm._l((_vm.alternativeLogins),function(alternativeLogin,index){return _c('NcButton',{key:index,class:[alternativeLogin.class],attrs:{\"type\":\"secondary\",\"wide\":true,\"role\":\"link\",\"href\":alternativeLogin.href}},[_vm._v(\"\\n\\t\\t\\t\"+_vm._s(alternativeLogin.name)+\"\\n\\t\\t\")])}),1)],2)\n}\nvar staticRenderFns = []\n\nexport { render, staticRenderFns }","const token = '%[a-f0-9]{2}';\nconst singleMatcher = new RegExp('(' + token + ')|([^%]+?)', 'gi');\nconst multiMatcher = new RegExp('(' + token + ')+', 'gi');\n\nfunction decodeComponents(components, split) {\n\ttry {\n\t\t// Try to decode the entire string first\n\t\treturn [decodeURIComponent(components.join(''))];\n\t} catch {\n\t\t// Do nothing\n\t}\n\n\tif (components.length === 1) {\n\t\treturn components;\n\t}\n\n\tsplit = split || 1;\n\n\t// Split the array in 2 parts\n\tconst left = components.slice(0, split);\n\tconst right = components.slice(split);\n\n\treturn Array.prototype.concat.call([], decodeComponents(left), decodeComponents(right));\n}\n\nfunction decode(input) {\n\ttry {\n\t\treturn decodeURIComponent(input);\n\t} catch {\n\t\tlet tokens = input.match(singleMatcher) || [];\n\n\t\tfor (let i = 1; i < tokens.length; i++) {\n\t\t\tinput = decodeComponents(tokens, i).join('');\n\n\t\t\ttokens = input.match(singleMatcher) || [];\n\t\t}\n\n\t\treturn input;\n\t}\n}\n\nfunction customDecodeURIComponent(input) {\n\t// Keep track of all the replacements and prefill the map with the `BOM`\n\tconst replaceMap = {\n\t\t'%FE%FF': '\\uFFFD\\uFFFD',\n\t\t'%FF%FE': '\\uFFFD\\uFFFD',\n\t};\n\n\tlet match = multiMatcher.exec(input);\n\twhile (match) {\n\t\ttry {\n\t\t\t// Decode as big chunks as possible\n\t\t\treplaceMap[match[0]] = decodeURIComponent(match[0]);\n\t\t} catch {\n\t\t\tconst result = decode(match[0]);\n\n\t\t\tif (result !== match[0]) {\n\t\t\t\treplaceMap[match[0]] = result;\n\t\t\t}\n\t\t}\n\n\t\tmatch = multiMatcher.exec(input);\n\t}\n\n\t// Add `%C2` at the end of the map to make sure it does not replace the combinator before everything else\n\treplaceMap['%C2'] = '\\uFFFD';\n\n\tconst entries = Object.keys(replaceMap);\n\n\tfor (const key of entries) {\n\t\t// Replace all decoded components\n\t\tinput = input.replace(new RegExp(key, 'g'), replaceMap[key]);\n\t}\n\n\treturn input;\n}\n\nexport default function decodeUriComponent(encodedURI) {\n\tif (typeof encodedURI !== 'string') {\n\t\tthrow new TypeError('Expected `encodedURI` to be of type `string`, got `' + typeof encodedURI + '`');\n\t}\n\n\ttry {\n\t\t// Try the built in decoder first\n\t\treturn decodeURIComponent(encodedURI);\n\t} catch {\n\t\t// Fallback to a more advanced decoder\n\t\treturn customDecodeURIComponent(encodedURI);\n\t}\n}\n","export default function splitOnFirst(string, separator) {\n\tif (!(typeof string === 'string' && typeof separator === 'string')) {\n\t\tthrow new TypeError('Expected the arguments to be of type `string`');\n\t}\n\n\tif (string === '' || separator === '') {\n\t\treturn [];\n\t}\n\n\tconst separatorIndex = string.indexOf(separator);\n\n\tif (separatorIndex === -1) {\n\t\treturn [];\n\t}\n\n\treturn [\n\t\tstring.slice(0, separatorIndex),\n\t\tstring.slice(separatorIndex + separator.length)\n\t];\n}\n","export function includeKeys(object, predicate) {\n\tconst result = {};\n\n\tif (Array.isArray(predicate)) {\n\t\tfor (const key of predicate) {\n\t\t\tconst descriptor = Object.getOwnPropertyDescriptor(object, key);\n\t\t\tif (descriptor?.enumerable) {\n\t\t\t\tObject.defineProperty(result, key, descriptor);\n\t\t\t}\n\t\t}\n\t} else {\n\t\t// `Reflect.ownKeys()` is required to retrieve symbol properties\n\t\tfor (const key of Reflect.ownKeys(object)) {\n\t\t\tconst descriptor = Object.getOwnPropertyDescriptor(object, key);\n\t\t\tif (descriptor.enumerable) {\n\t\t\t\tconst value = object[key];\n\t\t\t\tif (predicate(key, value, object)) {\n\t\t\t\t\tObject.defineProperty(result, key, descriptor);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn result;\n}\n\nexport function excludeKeys(object, predicate) {\n\tif (Array.isArray(predicate)) {\n\t\tconst set = new Set(predicate);\n\t\treturn includeKeys(object, key => !set.has(key));\n\t}\n\n\treturn includeKeys(object, (key, value, object) => !predicate(key, value, object));\n}\n","import decodeComponent from 'decode-uri-component';\nimport splitOnFirst from 'split-on-first';\nimport {includeKeys} from 'filter-obj';\n\nconst isNullOrUndefined = value => value === null || value === undefined;\n\n// eslint-disable-next-line unicorn/prefer-code-point\nconst strictUriEncode = string => encodeURIComponent(string).replace(/[!'()*]/g, x => `%${x.charCodeAt(0).toString(16).toUpperCase()}`);\n\nconst encodeFragmentIdentifier = Symbol('encodeFragmentIdentifier');\n\nfunction encoderForArrayFormat(options) {\n\tswitch (options.arrayFormat) {\n\t\tcase 'index': {\n\t\t\treturn key => (result, value) => {\n\t\t\t\tconst index = result.length;\n\n\t\t\t\tif (\n\t\t\t\t\tvalue === undefined\n\t\t\t\t\t|| (options.skipNull && value === null)\n\t\t\t\t\t|| (options.skipEmptyString && value === '')\n\t\t\t\t) {\n\t\t\t\t\treturn result;\n\t\t\t\t}\n\n\t\t\t\tif (value === null) {\n\t\t\t\t\treturn [\n\t\t\t\t\t\t...result, [encode(key, options), '[', index, ']'].join(''),\n\t\t\t\t\t];\n\t\t\t\t}\n\n\t\t\t\treturn [\n\t\t\t\t\t...result,\n\t\t\t\t\t[encode(key, options), '[', encode(index, options), ']=', encode(value, options)].join(''),\n\t\t\t\t];\n\t\t\t};\n\t\t}\n\n\t\tcase 'bracket': {\n\t\t\treturn key => (result, value) => {\n\t\t\t\tif (\n\t\t\t\t\tvalue === undefined\n\t\t\t\t\t|| (options.skipNull && value === null)\n\t\t\t\t\t|| (options.skipEmptyString && value === '')\n\t\t\t\t) {\n\t\t\t\t\treturn result;\n\t\t\t\t}\n\n\t\t\t\tif (value === null) {\n\t\t\t\t\treturn [\n\t\t\t\t\t\t...result,\n\t\t\t\t\t\t[encode(key, options), '[]'].join(''),\n\t\t\t\t\t];\n\t\t\t\t}\n\n\t\t\t\treturn [\n\t\t\t\t\t...result,\n\t\t\t\t\t[encode(key, options), '[]=', encode(value, options)].join(''),\n\t\t\t\t];\n\t\t\t};\n\t\t}\n\n\t\tcase 'colon-list-separator': {\n\t\t\treturn key => (result, value) => {\n\t\t\t\tif (\n\t\t\t\t\tvalue === undefined\n\t\t\t\t\t|| (options.skipNull && value === null)\n\t\t\t\t\t|| (options.skipEmptyString && value === '')\n\t\t\t\t) {\n\t\t\t\t\treturn result;\n\t\t\t\t}\n\n\t\t\t\tif (value === null) {\n\t\t\t\t\treturn [\n\t\t\t\t\t\t...result,\n\t\t\t\t\t\t[encode(key, options), ':list='].join(''),\n\t\t\t\t\t];\n\t\t\t\t}\n\n\t\t\t\treturn [\n\t\t\t\t\t...result,\n\t\t\t\t\t[encode(key, options), ':list=', encode(value, options)].join(''),\n\t\t\t\t];\n\t\t\t};\n\t\t}\n\n\t\tcase 'comma':\n\t\tcase 'separator':\n\t\tcase 'bracket-separator': {\n\t\t\tconst keyValueSep = options.arrayFormat === 'bracket-separator'\n\t\t\t\t? '[]='\n\t\t\t\t: '=';\n\n\t\t\treturn key => (result, value) => {\n\t\t\t\tif (\n\t\t\t\t\tvalue === undefined\n\t\t\t\t\t|| (options.skipNull && value === null)\n\t\t\t\t\t|| (options.skipEmptyString && value === '')\n\t\t\t\t) {\n\t\t\t\t\treturn result;\n\t\t\t\t}\n\n\t\t\t\t// Translate null to an empty string so that it doesn't serialize as 'null'\n\t\t\t\tvalue = value === null ? '' : value;\n\n\t\t\t\tif (result.length === 0) {\n\t\t\t\t\treturn [[encode(key, options), keyValueSep, encode(value, options)].join('')];\n\t\t\t\t}\n\n\t\t\t\treturn [[result, encode(value, options)].join(options.arrayFormatSeparator)];\n\t\t\t};\n\t\t}\n\n\t\tdefault: {\n\t\t\treturn key => (result, value) => {\n\t\t\t\tif (\n\t\t\t\t\tvalue === undefined\n\t\t\t\t\t|| (options.skipNull && value === null)\n\t\t\t\t\t|| (options.skipEmptyString && value === '')\n\t\t\t\t) {\n\t\t\t\t\treturn result;\n\t\t\t\t}\n\n\t\t\t\tif (value === null) {\n\t\t\t\t\treturn [\n\t\t\t\t\t\t...result,\n\t\t\t\t\t\tencode(key, options),\n\t\t\t\t\t];\n\t\t\t\t}\n\n\t\t\t\treturn [\n\t\t\t\t\t...result,\n\t\t\t\t\t[encode(key, options), '=', encode(value, options)].join(''),\n\t\t\t\t];\n\t\t\t};\n\t\t}\n\t}\n}\n\nfunction parserForArrayFormat(options) {\n\tlet result;\n\n\tswitch (options.arrayFormat) {\n\t\tcase 'index': {\n\t\t\treturn (key, value, accumulator) => {\n\t\t\t\tresult = /\\[(\\d*)]$/.exec(key);\n\n\t\t\t\tkey = key.replace(/\\[\\d*]$/, '');\n\n\t\t\t\tif (!result) {\n\t\t\t\t\taccumulator[key] = value;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (accumulator[key] === undefined) {\n\t\t\t\t\taccumulator[key] = {};\n\t\t\t\t}\n\n\t\t\t\taccumulator[key][result[1]] = value;\n\t\t\t};\n\t\t}\n\n\t\tcase 'bracket': {\n\t\t\treturn (key, value, accumulator) => {\n\t\t\t\tresult = /(\\[])$/.exec(key);\n\t\t\t\tkey = key.replace(/\\[]$/, '');\n\n\t\t\t\tif (!result) {\n\t\t\t\t\taccumulator[key] = value;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (accumulator[key] === undefined) {\n\t\t\t\t\taccumulator[key] = [value];\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\taccumulator[key] = [...accumulator[key], value];\n\t\t\t};\n\t\t}\n\n\t\tcase 'colon-list-separator': {\n\t\t\treturn (key, value, accumulator) => {\n\t\t\t\tresult = /(:list)$/.exec(key);\n\t\t\t\tkey = key.replace(/:list$/, '');\n\n\t\t\t\tif (!result) {\n\t\t\t\t\taccumulator[key] = value;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (accumulator[key] === undefined) {\n\t\t\t\t\taccumulator[key] = [value];\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\taccumulator[key] = [...accumulator[key], value];\n\t\t\t};\n\t\t}\n\n\t\tcase 'comma':\n\t\tcase 'separator': {\n\t\t\treturn (key, value, accumulator) => {\n\t\t\t\tconst isArray = typeof value === 'string' && value.includes(options.arrayFormatSeparator);\n\t\t\t\tconst isEncodedArray = (typeof value === 'string' && !isArray && decode(value, options).includes(options.arrayFormatSeparator));\n\t\t\t\tvalue = isEncodedArray ? decode(value, options) : value;\n\t\t\t\tconst newValue = isArray || isEncodedArray ? value.split(options.arrayFormatSeparator).map(item => decode(item, options)) : (value === null ? value : decode(value, options));\n\t\t\t\taccumulator[key] = newValue;\n\t\t\t};\n\t\t}\n\n\t\tcase 'bracket-separator': {\n\t\t\treturn (key, value, accumulator) => {\n\t\t\t\tconst isArray = /(\\[])$/.test(key);\n\t\t\t\tkey = key.replace(/\\[]$/, '');\n\n\t\t\t\tif (!isArray) {\n\t\t\t\t\taccumulator[key] = value ? decode(value, options) : value;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst arrayValue = value === null\n\t\t\t\t\t? []\n\t\t\t\t\t: value.split(options.arrayFormatSeparator).map(item => decode(item, options));\n\n\t\t\t\tif (accumulator[key] === undefined) {\n\t\t\t\t\taccumulator[key] = arrayValue;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\taccumulator[key] = [...accumulator[key], ...arrayValue];\n\t\t\t};\n\t\t}\n\n\t\tdefault: {\n\t\t\treturn (key, value, accumulator) => {\n\t\t\t\tif (accumulator[key] === undefined) {\n\t\t\t\t\taccumulator[key] = value;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\taccumulator[key] = [...[accumulator[key]].flat(), value];\n\t\t\t};\n\t\t}\n\t}\n}\n\nfunction validateArrayFormatSeparator(value) {\n\tif (typeof value !== 'string' || value.length !== 1) {\n\t\tthrow new TypeError('arrayFormatSeparator must be single character string');\n\t}\n}\n\nfunction encode(value, options) {\n\tif (options.encode) {\n\t\treturn options.strict ? strictUriEncode(value) : encodeURIComponent(value);\n\t}\n\n\treturn value;\n}\n\nfunction decode(value, options) {\n\tif (options.decode) {\n\t\treturn decodeComponent(value);\n\t}\n\n\treturn value;\n}\n\nfunction keysSorter(input) {\n\tif (Array.isArray(input)) {\n\t\treturn input.sort();\n\t}\n\n\tif (typeof input === 'object') {\n\t\treturn keysSorter(Object.keys(input))\n\t\t\t.sort((a, b) => Number(a) - Number(b))\n\t\t\t.map(key => input[key]);\n\t}\n\n\treturn input;\n}\n\nfunction removeHash(input) {\n\tconst hashStart = input.indexOf('#');\n\tif (hashStart !== -1) {\n\t\tinput = input.slice(0, hashStart);\n\t}\n\n\treturn input;\n}\n\nfunction getHash(url) {\n\tlet hash = '';\n\tconst hashStart = url.indexOf('#');\n\tif (hashStart !== -1) {\n\t\thash = url.slice(hashStart);\n\t}\n\n\treturn hash;\n}\n\nfunction parseValue(value, options) {\n\tif (options.parseNumbers && !Number.isNaN(Number(value)) && (typeof value === 'string' && value.trim() !== '')) {\n\t\tvalue = Number(value);\n\t} else if (options.parseBooleans && value !== null && (value.toLowerCase() === 'true' || value.toLowerCase() === 'false')) {\n\t\tvalue = value.toLowerCase() === 'true';\n\t}\n\n\treturn value;\n}\n\nexport function extract(input) {\n\tinput = removeHash(input);\n\tconst queryStart = input.indexOf('?');\n\tif (queryStart === -1) {\n\t\treturn '';\n\t}\n\n\treturn input.slice(queryStart + 1);\n}\n\nexport function parse(query, options) {\n\toptions = {\n\t\tdecode: true,\n\t\tsort: true,\n\t\tarrayFormat: 'none',\n\t\tarrayFormatSeparator: ',',\n\t\tparseNumbers: false,\n\t\tparseBooleans: false,\n\t\t...options,\n\t};\n\n\tvalidateArrayFormatSeparator(options.arrayFormatSeparator);\n\n\tconst formatter = parserForArrayFormat(options);\n\n\t// Create an object with no prototype\n\tconst returnValue = Object.create(null);\n\n\tif (typeof query !== 'string') {\n\t\treturn returnValue;\n\t}\n\n\tquery = query.trim().replace(/^[?#&]/, '');\n\n\tif (!query) {\n\t\treturn returnValue;\n\t}\n\n\tfor (const parameter of query.split('&')) {\n\t\tif (parameter === '') {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst parameter_ = options.decode ? parameter.replace(/\\+/g, ' ') : parameter;\n\n\t\tlet [key, value] = splitOnFirst(parameter_, '=');\n\n\t\tif (key === undefined) {\n\t\t\tkey = parameter_;\n\t\t}\n\n\t\t// Missing `=` should be `null`:\n\t\t// http://w3.org/TR/2012/WD-url-20120524/#collect-url-parameters\n\t\tvalue = value === undefined ? null : (['comma', 'separator', 'bracket-separator'].includes(options.arrayFormat) ? value : decode(value, options));\n\t\tformatter(decode(key, options), value, returnValue);\n\t}\n\n\tfor (const [key, value] of Object.entries(returnValue)) {\n\t\tif (typeof value === 'object' && value !== null) {\n\t\t\tfor (const [key2, value2] of Object.entries(value)) {\n\t\t\t\tvalue[key2] = parseValue(value2, options);\n\t\t\t}\n\t\t} else {\n\t\t\treturnValue[key] = parseValue(value, options);\n\t\t}\n\t}\n\n\tif (options.sort === false) {\n\t\treturn returnValue;\n\t}\n\n\t// TODO: Remove the use of `reduce`.\n\t// eslint-disable-next-line unicorn/no-array-reduce\n\treturn (options.sort === true ? Object.keys(returnValue).sort() : Object.keys(returnValue).sort(options.sort)).reduce((result, key) => {\n\t\tconst value = returnValue[key];\n\t\tif (Boolean(value) && typeof value === 'object' && !Array.isArray(value)) {\n\t\t\t// Sort object keys, not values\n\t\t\tresult[key] = keysSorter(value);\n\t\t} else {\n\t\t\tresult[key] = value;\n\t\t}\n\n\t\treturn result;\n\t}, Object.create(null));\n}\n\nexport function stringify(object, options) {\n\tif (!object) {\n\t\treturn '';\n\t}\n\n\toptions = {encode: true,\n\t\tstrict: true,\n\t\tarrayFormat: 'none',\n\t\tarrayFormatSeparator: ',', ...options};\n\n\tvalidateArrayFormatSeparator(options.arrayFormatSeparator);\n\n\tconst shouldFilter = key => (\n\t\t(options.skipNull && isNullOrUndefined(object[key]))\n\t\t|| (options.skipEmptyString && object[key] === '')\n\t);\n\n\tconst formatter = encoderForArrayFormat(options);\n\n\tconst objectCopy = {};\n\n\tfor (const [key, value] of Object.entries(object)) {\n\t\tif (!shouldFilter(key)) {\n\t\t\tobjectCopy[key] = value;\n\t\t}\n\t}\n\n\tconst keys = Object.keys(objectCopy);\n\n\tif (options.sort !== false) {\n\t\tkeys.sort(options.sort);\n\t}\n\n\treturn keys.map(key => {\n\t\tconst value = object[key];\n\n\t\tif (value === undefined) {\n\t\t\treturn '';\n\t\t}\n\n\t\tif (value === null) {\n\t\t\treturn encode(key, options);\n\t\t}\n\n\t\tif (Array.isArray(value)) {\n\t\t\tif (value.length === 0 && options.arrayFormat === 'bracket-separator') {\n\t\t\t\treturn encode(key, options) + '[]';\n\t\t\t}\n\n\t\t\treturn value\n\t\t\t\t.reduce(formatter(key), [])\n\t\t\t\t.join('&');\n\t\t}\n\n\t\treturn encode(key, options) + '=' + encode(value, options);\n\t}).filter(x => x.length > 0).join('&');\n}\n\nexport function parseUrl(url, options) {\n\toptions = {\n\t\tdecode: true,\n\t\t...options,\n\t};\n\n\tlet [url_, hash] = splitOnFirst(url, '#');\n\n\tif (url_ === undefined) {\n\t\turl_ = url;\n\t}\n\n\treturn {\n\t\turl: url_?.split('?')?.[0] ?? '',\n\t\tquery: parse(extract(url), options),\n\t\t...(options && options.parseFragmentIdentifier && hash ? {fragmentIdentifier: decode(hash, options)} : {}),\n\t};\n}\n\nexport function stringifyUrl(object, options) {\n\toptions = {\n\t\tencode: true,\n\t\tstrict: true,\n\t\t[encodeFragmentIdentifier]: true,\n\t\t...options,\n\t};\n\n\tconst url = removeHash(object.url).split('?')[0] || '';\n\tconst queryFromUrl = extract(object.url);\n\n\tconst query = {\n\t\t...parse(queryFromUrl, {sort: false}),\n\t\t...object.query,\n\t};\n\n\tlet queryString = stringify(query, options);\n\tif (queryString) {\n\t\tqueryString = `?${queryString}`;\n\t}\n\n\tlet hash = getHash(object.url);\n\tif (object.fragmentIdentifier) {\n\t\tconst urlObjectForFragmentEncode = new URL(url);\n\t\turlObjectForFragmentEncode.hash = object.fragmentIdentifier;\n\t\thash = options[encodeFragmentIdentifier] ? urlObjectForFragmentEncode.hash : `#${object.fragmentIdentifier}`;\n\t}\n\n\treturn `${url}${queryString}${hash}`;\n}\n\nexport function pick(input, filter, options) {\n\toptions = {\n\t\tparseFragmentIdentifier: true,\n\t\t[encodeFragmentIdentifier]: false,\n\t\t...options,\n\t};\n\n\tconst {url, query, fragmentIdentifier} = parseUrl(input, options);\n\n\treturn stringifyUrl({\n\t\turl,\n\t\tquery: includeKeys(query, filter),\n\t\tfragmentIdentifier,\n\t}, options);\n}\n\nexport function exclude(input, filter, options) {\n\tconst exclusionFilter = Array.isArray(filter) ? key => !filter.includes(key) : (key, value) => !filter(key, value);\n\n\treturn pick(input, exclusionFilter, options);\n}\n","import * as queryString from './base.js';\n\nexport default queryString;\n","import mod from \"-!../../../../node_modules/babel-loader/lib/index.js!../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./LoginButton.vue?vue&type=script&lang=js&\"; export default mod; export * from \"-!../../../../node_modules/babel-loader/lib/index.js!../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./LoginButton.vue?vue&type=script&lang=js&\"","\n\n\n\t\n\t\t{{ !loading ? value : valueLoading }}\n\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\n\n\n\n\n\n","\n import API from \"!../../../../node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js\";\n import domAPI from \"!../../../../node_modules/style-loader/dist/runtime/styleDomAPI.js\";\n import insertFn from \"!../../../../node_modules/style-loader/dist/runtime/insertBySelector.js\";\n import setAttributes from \"!../../../../node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js\";\n import insertStyleElement from \"!../../../../node_modules/style-loader/dist/runtime/insertStyleElement.js\";\n import styleTagTransformFn from \"!../../../../node_modules/style-loader/dist/runtime/styleTagTransform.js\";\n import content, * as namedExport from \"!!../../../../node_modules/css-loader/dist/cjs.js!../../../../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../../../../node_modules/sass-loader/dist/cjs.js!../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./LoginButton.vue?vue&type=style&index=0&id=3fa8511b&prod&lang=scss&scoped=true&\";\n \n \n\nvar options = {};\n\noptions.styleTagTransform = styleTagTransformFn;\noptions.setAttributes = setAttributes;\n\n options.insert = insertFn.bind(null, \"head\");\n \noptions.domAPI = domAPI;\noptions.insertStyleElement = insertStyleElement;\n\nvar update = API(content, options);\n\n\n\nexport * from \"!!../../../../node_modules/css-loader/dist/cjs.js!../../../../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../../../../node_modules/sass-loader/dist/cjs.js!../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./LoginButton.vue?vue&type=style&index=0&id=3fa8511b&prod&lang=scss&scoped=true&\";\n export default content && content.locals ? content.locals : undefined;\n","import { render, staticRenderFns } from \"./LoginButton.vue?vue&type=template&id=3fa8511b&scoped=true&\"\nimport script from \"./LoginButton.vue?vue&type=script&lang=js&\"\nexport * from \"./LoginButton.vue?vue&type=script&lang=js&\"\nimport style0 from \"./LoginButton.vue?vue&type=style&index=0&id=3fa8511b&prod&lang=scss&scoped=true&\"\n\n\n/* normalize component */\nimport normalizer from \"!../../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n script,\n render,\n staticRenderFns,\n false,\n null,\n \"3fa8511b\",\n null\n \n)\n\nexport default component.exports","var render = function render(){var _vm=this,_c=_vm._self._c;return _c('NcButton',{attrs:{\"type\":\"primary\",\"native-type\":\"submit\",\"wide\":true},on:{\"click\":function($event){return _vm.$emit('click')}},scopedSlots:_vm._u([{key:\"icon\",fn:function(){return [(_vm.loading)?_c('div',{staticClass:\"submit-wrapper__icon icon-loading-small-dark\"}):_c('ArrowRight',{staticClass:\"submit-wrapper__icon\"})]},proxy:true}])},[_vm._v(\"\\n\\t\"+_vm._s(!_vm.loading ? _vm.value : _vm.valueLoading)+\"\\n\\t\")])\n}\nvar staticRenderFns = []\n\nexport { render, staticRenderFns }","import mod from \"-!../../../../node_modules/babel-loader/lib/index.js!../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./LoginForm.vue?vue&type=script&lang=js&\"; export default mod; export * from \"-!../../../../node_modules/babel-loader/lib/index.js!../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./LoginForm.vue?vue&type=script&lang=js&\"","\n\n\n\t\n\n\n\n\n\n","\n import API from \"!../../../../node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js\";\n import domAPI from \"!../../../../node_modules/style-loader/dist/runtime/styleDomAPI.js\";\n import insertFn from \"!../../../../node_modules/style-loader/dist/runtime/insertBySelector.js\";\n import setAttributes from \"!../../../../node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js\";\n import insertStyleElement from \"!../../../../node_modules/style-loader/dist/runtime/insertStyleElement.js\";\n import styleTagTransformFn from \"!../../../../node_modules/style-loader/dist/runtime/styleTagTransform.js\";\n import content, * as namedExport from \"!!../../../../node_modules/css-loader/dist/cjs.js!../../../../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../../../../node_modules/sass-loader/dist/cjs.js!../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./LoginForm.vue?vue&type=style&index=0&id=0fbfcc31&prod&lang=scss&scoped=true&\";\n \n \n\nvar options = {};\n\noptions.styleTagTransform = styleTagTransformFn;\noptions.setAttributes = setAttributes;\n\n options.insert = insertFn.bind(null, \"head\");\n \noptions.domAPI = domAPI;\noptions.insertStyleElement = insertStyleElement;\n\nvar update = API(content, options);\n\n\n\nexport * from \"!!../../../../node_modules/css-loader/dist/cjs.js!../../../../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../../../../node_modules/sass-loader/dist/cjs.js!../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./LoginForm.vue?vue&type=style&index=0&id=0fbfcc31&prod&lang=scss&scoped=true&\";\n export default content && content.locals ? content.locals : undefined;\n","import { render, staticRenderFns } from \"./LoginForm.vue?vue&type=template&id=0fbfcc31&scoped=true&\"\nimport script from \"./LoginForm.vue?vue&type=script&lang=js&\"\nexport * from \"./LoginForm.vue?vue&type=script&lang=js&\"\nimport style0 from \"./LoginForm.vue?vue&type=style&index=0&id=0fbfcc31&prod&lang=scss&scoped=true&\"\n\n\n/* normalize component */\nimport normalizer from \"!../../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n script,\n render,\n staticRenderFns,\n false,\n null,\n \"0fbfcc31\",\n null\n \n)\n\nexport default component.exports","var render = function render(){var _vm=this,_c=_vm._self._c;return _c('form',{ref:\"loginForm\",staticClass:\"login-form\",attrs:{\"method\":\"post\",\"name\":\"login\",\"action\":_vm.loginActionUrl},on:{\"submit\":_vm.submit}},[_c('fieldset',{staticClass:\"login-form__fieldset\",attrs:{\"data-login-form\":\"\"}},[(_vm.apacheAuthFailed)?_c('NcNoteCard',{attrs:{\"title\":_vm.t('core', 'Server side authentication failed!'),\"type\":\"warning\"}},[_vm._v(\"\\n\\t\\t\\t\"+_vm._s(_vm.t('core', 'Please contact your administrator.'))+\"\\n\\t\\t\")]):_vm._e(),_vm._v(\" \"),(_vm.messages.length > 0)?_c('NcNoteCard',_vm._l((_vm.messages),function(message,index){return _c('div',{key:index},[_vm._v(\"\\n\\t\\t\\t\\t\"+_vm._s(message)),_c('br')])}),0):_vm._e(),_vm._v(\" \"),(_vm.internalException)?_c('NcNoteCard',{class:_vm.t('core', 'An internal error occurred.'),attrs:{\"type\":\"warning\"}},[_vm._v(\"\\n\\t\\t\\t\"+_vm._s(_vm.t('core', 'Please try again or contact your administrator.'))+\"\\n\\t\\t\")]):_vm._e(),_vm._v(\" \"),_c('div',{staticClass:\"hidden\",attrs:{\"id\":\"message\"}},[_c('img',{staticClass:\"float-spinner\",attrs:{\"alt\":\"\",\"src\":_vm.loadingIcon}}),_vm._v(\" \"),_c('span',{attrs:{\"id\":\"messageText\"}}),_vm._v(\" \"),_c('div',{staticStyle:{\"clear\":\"both\"}})]),_vm._v(\" \"),_c('h2',{staticClass:\"login-form__headline\",attrs:{\"data-login-form-headline\":\"\"},domProps:{\"innerHTML\":_vm._s(_vm.headline)}}),_vm._v(\" \"),_c('NcTextField',{ref:\"user\",class:{shake: _vm.invalidPassword},attrs:{\"id\":\"user\",\"label\":_vm.t('core', 'Account name or email'),\"name\":\"user\",\"value\":_vm.user,\"autocapitalize\":\"none\",\"spellchecking\":false,\"autocomplete\":_vm.autoCompleteAllowed ? 'username' : 'off',\"required\":\"\",\"data-login-form-input-user\":\"\"},on:{\"update:value\":function($event){_vm.user=$event},\"change\":_vm.updateUsername}}),_vm._v(\" \"),_c('NcPasswordField',{ref:\"password\",class:{shake: _vm.invalidPassword},attrs:{\"id\":\"password\",\"name\":\"password\",\"value\":_vm.password,\"spellchecking\":false,\"autocapitalize\":\"none\",\"autocomplete\":_vm.autoCompleteAllowed ? 'current-password' : 'off',\"label\":_vm.t('core', 'Password'),\"helper-text\":_vm.errorLabel,\"error\":_vm.isError,\"data-login-form-input-password\":\"\",\"required\":\"\"},on:{\"update:value\":function($event){_vm.password=$event}}}),_vm._v(\" \"),_c('LoginButton',{attrs:{\"data-login-form-submit\":\"\",\"loading\":_vm.loading}}),_vm._v(\" \"),(_vm.redirectUrl)?_c('input',{attrs:{\"type\":\"hidden\",\"name\":\"redirect_url\"},domProps:{\"value\":_vm.redirectUrl}}):_vm._e(),_vm._v(\" \"),_c('input',{attrs:{\"type\":\"hidden\",\"name\":\"timezone\"},domProps:{\"value\":_vm.timezone}}),_vm._v(\" \"),_c('input',{attrs:{\"type\":\"hidden\",\"name\":\"timezone_offset\"},domProps:{\"value\":_vm.timezoneOffset}}),_vm._v(\" \"),_c('input',{attrs:{\"type\":\"hidden\",\"name\":\"requesttoken\"},domProps:{\"value\":_vm.OC.requestToken}}),_vm._v(\" \"),(_vm.directLogin)?_c('input',{attrs:{\"type\":\"hidden\",\"name\":\"direct\",\"value\":\"1\"}}):_vm._e()],1)])\n}\nvar staticRenderFns = []\n\nexport { render, staticRenderFns }","import mod from \"-!../vue-loader/lib/index.js??vue-loader-options!./LockOpen.vue?vue&type=script&lang=js&\"; export default mod; export * from \"-!../vue-loader/lib/index.js??vue-loader-options!./LockOpen.vue?vue&type=script&lang=js&\"","\n \n \n \n\n\n","import { render, staticRenderFns } from \"./LockOpen.vue?vue&type=template&id=043c34a0&\"\nimport script from \"./LockOpen.vue?vue&type=script&lang=js&\"\nexport * from \"./LockOpen.vue?vue&type=script&lang=js&\"\n\n\n/* normalize component */\nimport normalizer from \"!../vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n script,\n render,\n staticRenderFns,\n false,\n null,\n null,\n null\n \n)\n\nexport default component.exports","var render = function render(){var _vm=this,_c=_vm._self._c;return _c('span',_vm._b({staticClass:\"material-design-icon lock-open-icon\",attrs:{\"aria-hidden\":!_vm.title,\"aria-label\":_vm.title,\"role\":\"img\"},on:{\"click\":function($event){return _vm.$emit('click', $event)}}},'span',_vm.$attrs,false),[_c('svg',{staticClass:\"material-design-icon__svg\",attrs:{\"fill\":_vm.fillColor,\"width\":_vm.size,\"height\":_vm.size,\"viewBox\":\"0 0 24 24\"}},[_c('path',{attrs:{\"d\":\"M18,8A2,2 0 0,1 20,10V20A2,2 0 0,1 18,22H6C4.89,22 4,21.1 4,20V10A2,2 0 0,1 6,8H15V6A3,3 0 0,0 12,3A3,3 0 0,0 9,6H7A5,5 0 0,1 12,1A5,5 0 0,1 17,6V8H18M12,17A2,2 0 0,0 14,15A2,2 0 0,0 12,13A2,2 0 0,0 10,15A2,2 0 0,0 12,17Z\"}},[(_vm.title)?_c('title',[_vm._v(_vm._s(_vm.title))]):_vm._e()])])])\n}\nvar staticRenderFns = []\n\nexport { render, staticRenderFns }","\n\t\n\t
\n\t\t\n\t\t
{{ t('core', 'Browser not supported') }}
\n\t\t
\n\t\t\t{{ t('core', 'Passwordless authentication is not supported in your browser.') }}\n\t\t
\n\t
\n\t
\n\t\t\n\t\t
{{ t('core', 'Your connection is not secure') }}
\n\t\t
\n\t\t\t{{ t('core', 'Passwordless authentication is only available over a secure connection.') }}\n\t\t
\n\t
\n\n\n\n\n\n","import mod from \"-!../../../../node_modules/babel-loader/lib/index.js!../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./PasswordLessLoginForm.vue?vue&type=script&lang=js&\"; export default mod; export * from \"-!../../../../node_modules/babel-loader/lib/index.js!../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./PasswordLessLoginForm.vue?vue&type=script&lang=js&\"","/**\n * @copyright 2020, Roeland Jago Douma \n *\n * @author Roeland Jago Douma \n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n */\n\nimport Axios from '@nextcloud/axios'\nimport { generateUrl } from '@nextcloud/router'\n\n/**\n * @param {any} loginName -\n */\nexport function startAuthentication(loginName) {\n\tconst url = generateUrl('/login/webauthn/start')\n\n\treturn Axios.post(url, { loginName })\n\t\t.then(resp => resp.data)\n}\n\n/**\n * @param {any} data -\n */\nexport function finishAuthentication(data) {\n\tconst url = generateUrl('/login/webauthn/finish')\n\n\treturn Axios.post(url, { data })\n\t\t.then(resp => resp.data)\n}\n","\n import API from \"!../../../../node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js\";\n import domAPI from \"!../../../../node_modules/style-loader/dist/runtime/styleDomAPI.js\";\n import insertFn from \"!../../../../node_modules/style-loader/dist/runtime/insertBySelector.js\";\n import setAttributes from \"!../../../../node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js\";\n import insertStyleElement from \"!../../../../node_modules/style-loader/dist/runtime/insertStyleElement.js\";\n import styleTagTransformFn from \"!../../../../node_modules/style-loader/dist/runtime/styleTagTransform.js\";\n import content, * as namedExport from \"!!../../../../node_modules/css-loader/dist/cjs.js!../../../../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../../../../node_modules/sass-loader/dist/cjs.js!../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./PasswordLessLoginForm.vue?vue&type=style&index=0&id=3ea2fa78&prod&lang=scss&scoped=true&\";\n \n \n\nvar options = {};\n\noptions.styleTagTransform = styleTagTransformFn;\noptions.setAttributes = setAttributes;\n\n options.insert = insertFn.bind(null, \"head\");\n \noptions.domAPI = domAPI;\noptions.insertStyleElement = insertStyleElement;\n\nvar update = API(content, options);\n\n\n\nexport * from \"!!../../../../node_modules/css-loader/dist/cjs.js!../../../../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../../../../node_modules/sass-loader/dist/cjs.js!../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./PasswordLessLoginForm.vue?vue&type=style&index=0&id=3ea2fa78&prod&lang=scss&scoped=true&\";\n export default content && content.locals ? content.locals : undefined;\n","import { render, staticRenderFns } from \"./PasswordLessLoginForm.vue?vue&type=template&id=3ea2fa78&scoped=true&\"\nimport script from \"./PasswordLessLoginForm.vue?vue&type=script&lang=js&\"\nexport * from \"./PasswordLessLoginForm.vue?vue&type=script&lang=js&\"\nimport style0 from \"./PasswordLessLoginForm.vue?vue&type=style&index=0&id=3ea2fa78&prod&lang=scss&scoped=true&\"\n\n\n/* normalize component */\nimport normalizer from \"!../../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n script,\n render,\n staticRenderFns,\n false,\n null,\n \"3ea2fa78\",\n null\n \n)\n\nexport default component.exports","var render = function render(){var _vm=this,_c=_vm._self._c;return ((_vm.isHttps || _vm.isLocalhost) && _vm.hasPublicKeyCredential)?_c('form',{ref:\"loginForm\",attrs:{\"method\":\"post\",\"name\":\"login\"},on:{\"submit\":function($event){$event.preventDefault();return _vm.submit.apply(null, arguments)}}},[_c('h2',[_vm._v(_vm._s(_vm.t('core', 'Log in with a device')))]),_vm._v(\" \"),_c('fieldset',[_c('NcTextField',{attrs:{\"required\":\"\",\"value\":_vm.user,\"autocomplete\":_vm.autoCompleteAllowed ? 'on' : 'off',\"error\":!_vm.validCredentials,\"label\":_vm.t('core', 'Username or email'),\"placeholder\":_vm.t('core', 'Username or email'),\"helper-text\":!_vm.validCredentials ? _vm.t('core', 'Your account is not setup for passwordless login.') : ''},on:{\"update:value\":_vm.changeUsername}}),_vm._v(\" \"),(_vm.validCredentials)?_c('LoginButton',{attrs:{\"loading\":_vm.loading},on:{\"click\":_vm.authenticate}}):_vm._e()],1)]):(!_vm.hasPublicKeyCredential)?_c('div',{staticClass:\"update\"},[_c('InformationIcon',{attrs:{\"size\":\"70\"}}),_vm._v(\" \"),_c('h2',[_vm._v(_vm._s(_vm.t('core', 'Browser not supported')))]),_vm._v(\" \"),_c('p',{staticClass:\"infogroup\"},[_vm._v(\"\\n\\t\\t\"+_vm._s(_vm.t('core', 'Passwordless authentication is not supported in your browser.'))+\"\\n\\t\")])],1):(!_vm.isHttps && !_vm.isLocalhost)?_c('div',{staticClass:\"update\"},[_c('LockOpenIcon',{attrs:{\"size\":\"70\"}}),_vm._v(\" \"),_c('h2',[_vm._v(_vm._s(_vm.t('core', 'Your connection is not secure')))]),_vm._v(\" \"),_c('p',{staticClass:\"infogroup\"},[_vm._v(\"\\n\\t\\t\"+_vm._s(_vm.t('core', 'Passwordless authentication is only available over a secure connection.'))+\"\\n\\t\")])],1):_vm._e()\n}\nvar staticRenderFns = []\n\nexport { render, staticRenderFns }","import mod from \"-!../../../../node_modules/babel-loader/lib/index.js!../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./ResetPassword.vue?vue&type=script&lang=js&\"; export default mod; export * from \"-!../../../../node_modules/babel-loader/lib/index.js!../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./ResetPassword.vue?vue&type=script&lang=js&\"","\n\n\n\t\n\n\n\n\n\n","\n import API from \"!../../../../node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js\";\n import domAPI from \"!../../../../node_modules/style-loader/dist/runtime/styleDomAPI.js\";\n import insertFn from \"!../../../../node_modules/style-loader/dist/runtime/insertBySelector.js\";\n import setAttributes from \"!../../../../node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js\";\n import insertStyleElement from \"!../../../../node_modules/style-loader/dist/runtime/insertStyleElement.js\";\n import styleTagTransformFn from \"!../../../../node_modules/style-loader/dist/runtime/styleTagTransform.js\";\n import content, * as namedExport from \"!!../../../../node_modules/css-loader/dist/cjs.js!../../../../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../../../../node_modules/sass-loader/dist/cjs.js!../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./ResetPassword.vue?vue&type=style&index=0&id=179b3658&prod&lang=scss&scoped=true&\";\n \n \n\nvar options = {};\n\noptions.styleTagTransform = styleTagTransformFn;\noptions.setAttributes = setAttributes;\n\n options.insert = insertFn.bind(null, \"head\");\n \noptions.domAPI = domAPI;\noptions.insertStyleElement = insertStyleElement;\n\nvar update = API(content, options);\n\n\n\nexport * from \"!!../../../../node_modules/css-loader/dist/cjs.js!../../../../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../../../../node_modules/sass-loader/dist/cjs.js!../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./ResetPassword.vue?vue&type=style&index=0&id=179b3658&prod&lang=scss&scoped=true&\";\n export default content && content.locals ? content.locals : undefined;\n","import { render, staticRenderFns } from \"./ResetPassword.vue?vue&type=template&id=179b3658&scoped=true&\"\nimport script from \"./ResetPassword.vue?vue&type=script&lang=js&\"\nexport * from \"./ResetPassword.vue?vue&type=script&lang=js&\"\nimport style0 from \"./ResetPassword.vue?vue&type=style&index=0&id=179b3658&prod&lang=scss&scoped=true&\"\n\n\n/* normalize component */\nimport normalizer from \"!../../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n script,\n render,\n staticRenderFns,\n false,\n null,\n \"179b3658\",\n null\n \n)\n\nexport default component.exports","var render = function render(){var _vm=this,_c=_vm._self._c;return _c('form',{staticClass:\"login-form\",on:{\"submit\":function($event){$event.preventDefault();return _vm.submit.apply(null, arguments)}}},[_c('fieldset',{staticClass:\"login-form__fieldset\"},[_c('NcTextField',{attrs:{\"id\":\"user\",\"value\":_vm.user,\"name\":\"user\",\"autocapitalize\":\"off\",\"label\":_vm.t('core', 'Account name or email'),\"required\":\"\"},on:{\"update:value\":function($event){_vm.user=$event},\"change\":_vm.updateUsername}}),_vm._v(\" \"),_c('LoginButton',{attrs:{\"value\":_vm.t('core', 'Reset password')}}),_vm._v(\" \"),(_vm.message === 'send-success')?_c('NcNoteCard',{attrs:{\"type\":\"success\"}},[_vm._v(\"\\n\\t\\t\\t\"+_vm._s(_vm.t('core', 'If this account exists, a password reset message has been sent to its email address. If you do not receive it, verify your email address and/or account name, check your spam/junk folders or ask your local administration for help.'))+\"\\n\\t\\t\")]):(_vm.message === 'send-error')?_c('NcNoteCard',{attrs:{\"type\":\"error\"}},[_vm._v(\"\\n\\t\\t\\t\"+_vm._s(_vm.t('core', 'Couldn\\'t send reset email. Please contact your administrator.'))+\"\\n\\t\\t\")]):(_vm.message === 'reset-error')?_c('NcNoteCard',{attrs:{\"type\":\"error\"}},[_vm._v(\"\\n\\t\\t\\t\"+_vm._s(_vm.t('core', 'Password cannot be changed. Please contact your administrator.'))+\"\\n\\t\\t\")]):_vm._e(),_vm._v(\" \"),_c('a',{staticClass:\"login-form__link\",attrs:{\"href\":\"#\"},on:{\"click\":function($event){$event.preventDefault();return _vm.$emit('abort')}}},[_vm._v(\"\\n\\t\\t\\t\"+_vm._s(_vm.t('core', 'Back to login'))+\"\\n\\t\\t\")])],1)])\n}\nvar staticRenderFns = []\n\nexport { render, staticRenderFns }","\n\n\n\t\n\n\n\n\n\n","import mod from \"-!../../../../node_modules/babel-loader/lib/index.js!../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./UpdatePassword.vue?vue&type=script&lang=js&\"; export default mod; export * from \"-!../../../../node_modules/babel-loader/lib/index.js!../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./UpdatePassword.vue?vue&type=script&lang=js&\"","\n import API from \"!../../../../node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js\";\n import domAPI from \"!../../../../node_modules/style-loader/dist/runtime/styleDomAPI.js\";\n import insertFn from \"!../../../../node_modules/style-loader/dist/runtime/insertBySelector.js\";\n import setAttributes from \"!../../../../node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js\";\n import insertStyleElement from \"!../../../../node_modules/style-loader/dist/runtime/insertStyleElement.js\";\n import styleTagTransformFn from \"!../../../../node_modules/style-loader/dist/runtime/styleTagTransform.js\";\n import content, * as namedExport from \"!!../../../../node_modules/css-loader/dist/cjs.js!../../../../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./UpdatePassword.vue?vue&type=style&index=0&id=b9d4933a&prod&scoped=true&lang=css&\";\n \n \n\nvar options = {};\n\noptions.styleTagTransform = styleTagTransformFn;\noptions.setAttributes = setAttributes;\n\n options.insert = insertFn.bind(null, \"head\");\n \noptions.domAPI = domAPI;\noptions.insertStyleElement = insertStyleElement;\n\nvar update = API(content, options);\n\n\n\nexport * from \"!!../../../../node_modules/css-loader/dist/cjs.js!../../../../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./UpdatePassword.vue?vue&type=style&index=0&id=b9d4933a&prod&scoped=true&lang=css&\";\n export default content && content.locals ? content.locals : undefined;\n","import { render, staticRenderFns } from \"./UpdatePassword.vue?vue&type=template&id=b9d4933a&scoped=true&\"\nimport script from \"./UpdatePassword.vue?vue&type=script&lang=js&\"\nexport * from \"./UpdatePassword.vue?vue&type=script&lang=js&\"\nimport style0 from \"./UpdatePassword.vue?vue&type=style&index=0&id=b9d4933a&prod&scoped=true&lang=css&\"\n\n\n/* normalize component */\nimport normalizer from \"!../../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n script,\n render,\n staticRenderFns,\n false,\n null,\n \"b9d4933a\",\n null\n \n)\n\nexport default component.exports","var render = function render(){var _vm=this,_c=_vm._self._c;return _c('form',{on:{\"submit\":function($event){$event.preventDefault();return _vm.submit.apply(null, arguments)}}},[_c('fieldset',[_c('p',[_c('label',{staticClass:\"infield\",attrs:{\"for\":\"password\"}},[_vm._v(_vm._s(_vm.t('core', 'New password')))]),_vm._v(\" \"),_c('input',{directives:[{name:\"model\",rawName:\"v-model\",value:(_vm.password),expression:\"password\"}],attrs:{\"id\":\"password\",\"type\":\"password\",\"name\":\"password\",\"autocomplete\":\"new-password\",\"autocapitalize\":\"none\",\"spellcheck\":\"false\",\"required\":\"\",\"placeholder\":_vm.t('core', 'New password')},domProps:{\"value\":(_vm.password)},on:{\"input\":function($event){if($event.target.composing)return;_vm.password=$event.target.value}}})]),_vm._v(\" \"),(_vm.encrypted)?_c('div',{staticClass:\"update\"},[_c('p',[_vm._v(\"\\n\\t\\t\\t\\t\"+_vm._s(_vm.t('core', 'Your files are encrypted. There will be no way to get your data back after your password is reset. If you are not sure what to do, please contact your administrator before you continue. Do you really want to continue?'))+\"\\n\\t\\t\\t\")]),_vm._v(\" \"),_c('input',{directives:[{name:\"model\",rawName:\"v-model\",value:(_vm.proceed),expression:\"proceed\"}],staticClass:\"checkbox\",attrs:{\"id\":\"encrypted-continue\",\"type\":\"checkbox\"},domProps:{\"checked\":Array.isArray(_vm.proceed)?_vm._i(_vm.proceed,null)>-1:(_vm.proceed)},on:{\"change\":function($event){var $$a=_vm.proceed,$$el=$event.target,$$c=$$el.checked?(true):(false);if(Array.isArray($$a)){var $$v=null,$$i=_vm._i($$a,$$v);if($$el.checked){$$i<0&&(_vm.proceed=$$a.concat([$$v]))}else{$$i>-1&&(_vm.proceed=$$a.slice(0,$$i).concat($$a.slice($$i+1)))}}else{_vm.proceed=$$c}}}}),_vm._v(\" \"),_c('label',{attrs:{\"for\":\"encrypted-continue\"}},[_vm._v(\"\\n\\t\\t\\t\\t\"+_vm._s(_vm.t('core', 'I know what I\\'m doing'))+\"\\n\\t\\t\\t\")])]):_vm._e(),_vm._v(\" \"),_c('LoginButton',{attrs:{\"loading\":_vm.loading,\"value\":_vm.t('core', 'Reset password'),\"value-loading\":_vm.t('core', 'Resetting password')}}),_vm._v(\" \"),(_vm.error && _vm.message)?_c('p',{class:{warning: _vm.error}},[_vm._v(\"\\n\\t\\t\\t\"+_vm._s(_vm.message)+\"\\n\\t\\t\")]):_vm._e()],1)])\n}\nvar staticRenderFns = []\n\nexport { render, staticRenderFns }","\n\n\n\t
\n\n\n\n\n\n","import mod from \"-!../../../node_modules/babel-loader/lib/index.js!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./Login.vue?vue&type=script&lang=js&\"; export default mod; export * from \"-!../../../node_modules/babel-loader/lib/index.js!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./Login.vue?vue&type=script&lang=js&\"","\n import API from \"!../../../node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js\";\n import domAPI from \"!../../../node_modules/style-loader/dist/runtime/styleDomAPI.js\";\n import insertFn from \"!../../../node_modules/style-loader/dist/runtime/insertBySelector.js\";\n import setAttributes from \"!../../../node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js\";\n import insertStyleElement from \"!../../../node_modules/style-loader/dist/runtime/insertStyleElement.js\";\n import styleTagTransformFn from \"!../../../node_modules/style-loader/dist/runtime/styleTagTransform.js\";\n import content, * as namedExport from \"!!../../../node_modules/css-loader/dist/cjs.js!../../../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../../../node_modules/sass-loader/dist/cjs.js!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./Login.vue?vue&type=style&index=0&id=2148d59c&prod&lang=scss&\";\n \n \n\nvar options = {};\n\noptions.styleTagTransform = styleTagTransformFn;\noptions.setAttributes = setAttributes;\n\n options.insert = insertFn.bind(null, \"head\");\n \noptions.domAPI = domAPI;\noptions.insertStyleElement = insertStyleElement;\n\nvar update = API(content, options);\n\n\n\nexport * from \"!!../../../node_modules/css-loader/dist/cjs.js!../../../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../../../node_modules/sass-loader/dist/cjs.js!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./Login.vue?vue&type=style&index=0&id=2148d59c&prod&lang=scss&\";\n export default content && content.locals ? content.locals : undefined;\n","import { render, staticRenderFns } from \"./Login.vue?vue&type=template&id=2148d59c&\"\nimport script from \"./Login.vue?vue&type=script&lang=js&\"\nexport * from \"./Login.vue?vue&type=script&lang=js&\"\nimport style0 from \"./Login.vue?vue&type=style&index=0&id=2148d59c&prod&lang=scss&\"\n\n\n/* normalize component */\nimport normalizer from \"!../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n script,\n render,\n staticRenderFns,\n false,\n null,\n null,\n null\n \n)\n\nexport default component.exports","/**\n * @copyright 2019 Christoph Wurst \n *\n * @author Christoph Wurst \n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n */\n\nimport L10n from '../OC/l10n.js'\nimport OC from '../OC/index.js'\n\nexport default {\n\tdata() {\n\t\treturn {\n\t\t\tOC,\n\t\t}\n\t},\n\tmethods: {\n\t\tt: L10n.translate.bind(L10n),\n\t\tn: L10n.translatePlural.bind(L10n),\n\t},\n}\n","/**\n * @copyright 2019 Christoph Wurst \n *\n * @author Christoph Wurst \n * @author John Molakvoæ \n * @author Julius Härtl \n * @author Roeland Jago Douma \n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n */\n\nimport Vue from 'vue'\n\n// eslint-disable-next-line no-unused-vars\nimport OC from './OC/index.js' // TODO: Not needed but L10n breaks if removed\nimport LoginView from './views/Login.vue'\nimport Nextcloud from './mixins/Nextcloud.js'\n\nVue.mixin(Nextcloud)\n\nconst View = Vue.extend(LoginView)\nnew View().$mount('#login')\n","// Backbone.js 1.5.0\n\n// (c) 2010-2022 Jeremy Ashkenas and DocumentCloud\n// Backbone may be freely distributed under the MIT license.\n// For all details and documentation:\n// http://backbonejs.org\n\n(function(factory) {\n\n // Establish the root object, `window` (`self`) in the browser, or `global` on the server.\n // We use `self` instead of `window` for `WebWorker` support.\n var root = typeof self == 'object' && self.self === self && self ||\n typeof global == 'object' && global.global === global && global;\n\n // Set up Backbone appropriately for the environment. Start with AMD.\n if (typeof define === 'function' && define.amd) {\n define(['underscore', 'jquery', 'exports'], function(_, $, exports) {\n // Export global even in AMD case in case this script is loaded with\n // others that may still expect a global Backbone.\n root.Backbone = factory(root, exports, _, $);\n });\n\n // Next for Node.js or CommonJS. jQuery may not be needed as a module.\n } else if (typeof exports !== 'undefined') {\n var _ = require('underscore'), $;\n try { $ = require('jquery'); } catch (e) {}\n factory(root, exports, _, $);\n\n // Finally, as a browser global.\n } else {\n root.Backbone = factory(root, {}, root._, root.jQuery || root.Zepto || root.ender || root.$);\n }\n\n})(function(root, Backbone, _, $) {\n\n // Initial Setup\n // -------------\n\n // Save the previous value of the `Backbone` variable, so that it can be\n // restored later on, if `noConflict` is used.\n var previousBackbone = root.Backbone;\n\n // Create a local reference to a common array method we'll want to use later.\n var slice = Array.prototype.slice;\n\n // Current version of the library. Keep in sync with `package.json`.\n Backbone.VERSION = '1.5.0';\n\n // For Backbone's purposes, jQuery, Zepto, Ender, or My Library (kidding) owns\n // the `$` variable.\n Backbone.$ = $;\n\n // Runs Backbone.js in *noConflict* mode, returning the `Backbone` variable\n // to its previous owner. Returns a reference to this Backbone object.\n Backbone.noConflict = function() {\n root.Backbone = previousBackbone;\n return this;\n };\n\n // Turn on `emulateHTTP` to support legacy HTTP servers. Setting this option\n // will fake `\"PATCH\"`, `\"PUT\"` and `\"DELETE\"` requests via the `_method` parameter and\n // set a `X-Http-Method-Override` header.\n Backbone.emulateHTTP = false;\n\n // Turn on `emulateJSON` to support legacy servers that can't deal with direct\n // `application/json` requests ... this will encode the body as\n // `application/x-www-form-urlencoded` instead and will send the model in a\n // form param named `model`.\n Backbone.emulateJSON = false;\n\n // Backbone.Events\n // ---------------\n\n // A module that can be mixed in to *any object* in order to provide it with\n // a custom event channel. You may bind a callback to an event with `on` or\n // remove with `off`; `trigger`-ing an event fires all callbacks in\n // succession.\n //\n // var object = {};\n // _.extend(object, Backbone.Events);\n // object.on('expand', function(){ alert('expanded'); });\n // object.trigger('expand');\n //\n var Events = Backbone.Events = {};\n\n // Regular expression used to split event strings.\n var eventSplitter = /\\s+/;\n\n // A private global variable to share between listeners and listenees.\n var _listening;\n\n // Iterates over the standard `event, callback` (as well as the fancy multiple\n // space-separated events `\"change blur\", callback` and jQuery-style event\n // maps `{event: callback}`).\n var eventsApi = function(iteratee, events, name, callback, opts) {\n var i = 0, names;\n if (name && typeof name === 'object') {\n // Handle event maps.\n if (callback !== void 0 && 'context' in opts && opts.context === void 0) opts.context = callback;\n for (names = _.keys(name); i < names.length ; i++) {\n events = eventsApi(iteratee, events, names[i], name[names[i]], opts);\n }\n } else if (name && eventSplitter.test(name)) {\n // Handle space-separated event names by delegating them individually.\n for (names = name.split(eventSplitter); i < names.length; i++) {\n events = iteratee(events, names[i], callback, opts);\n }\n } else {\n // Finally, standard events.\n events = iteratee(events, name, callback, opts);\n }\n return events;\n };\n\n // Bind an event to a `callback` function. Passing `\"all\"` will bind\n // the callback to all events fired.\n Events.on = function(name, callback, context) {\n this._events = eventsApi(onApi, this._events || {}, name, callback, {\n context: context,\n ctx: this,\n listening: _listening\n });\n\n if (_listening) {\n var listeners = this._listeners || (this._listeners = {});\n listeners[_listening.id] = _listening;\n // Allow the listening to use a counter, instead of tracking\n // callbacks for library interop\n _listening.interop = false;\n }\n\n return this;\n };\n\n // Inversion-of-control versions of `on`. Tell *this* object to listen to\n // an event in another object... keeping track of what it's listening to\n // for easier unbinding later.\n Events.listenTo = function(obj, name, callback) {\n if (!obj) return this;\n var id = obj._listenId || (obj._listenId = _.uniqueId('l'));\n var listeningTo = this._listeningTo || (this._listeningTo = {});\n var listening = _listening = listeningTo[id];\n\n // This object is not listening to any other events on `obj` yet.\n // Setup the necessary references to track the listening callbacks.\n if (!listening) {\n this._listenId || (this._listenId = _.uniqueId('l'));\n listening = _listening = listeningTo[id] = new Listening(this, obj);\n }\n\n // Bind callbacks on obj.\n var error = tryCatchOn(obj, name, callback, this);\n _listening = void 0;\n\n if (error) throw error;\n // If the target obj is not Backbone.Events, track events manually.\n if (listening.interop) listening.on(name, callback);\n\n return this;\n };\n\n // The reducing API that adds a callback to the `events` object.\n var onApi = function(events, name, callback, options) {\n if (callback) {\n var handlers = events[name] || (events[name] = []);\n var context = options.context, ctx = options.ctx, listening = options.listening;\n if (listening) listening.count++;\n\n handlers.push({callback: callback, context: context, ctx: context || ctx, listening: listening});\n }\n return events;\n };\n\n // An try-catch guarded #on function, to prevent poisoning the global\n // `_listening` variable.\n var tryCatchOn = function(obj, name, callback, context) {\n try {\n obj.on(name, callback, context);\n } catch (e) {\n return e;\n }\n };\n\n // Remove one or many callbacks. If `context` is null, removes all\n // callbacks with that function. If `callback` is null, removes all\n // callbacks for the event. If `name` is null, removes all bound\n // callbacks for all events.\n Events.off = function(name, callback, context) {\n if (!this._events) return this;\n this._events = eventsApi(offApi, this._events, name, callback, {\n context: context,\n listeners: this._listeners\n });\n\n return this;\n };\n\n // Tell this object to stop listening to either specific events ... or\n // to every object it's currently listening to.\n Events.stopListening = function(obj, name, callback) {\n var listeningTo = this._listeningTo;\n if (!listeningTo) return this;\n\n var ids = obj ? [obj._listenId] : _.keys(listeningTo);\n for (var i = 0; i < ids.length; i++) {\n var listening = listeningTo[ids[i]];\n\n // If listening doesn't exist, this object is not currently\n // listening to obj. Break out early.\n if (!listening) break;\n\n listening.obj.off(name, callback, this);\n if (listening.interop) listening.off(name, callback);\n }\n if (_.isEmpty(listeningTo)) this._listeningTo = void 0;\n\n return this;\n };\n\n // The reducing API that removes a callback from the `events` object.\n var offApi = function(events, name, callback, options) {\n if (!events) return;\n\n var context = options.context, listeners = options.listeners;\n var i = 0, names;\n\n // Delete all event listeners and \"drop\" events.\n if (!name && !context && !callback) {\n for (names = _.keys(listeners); i < names.length; i++) {\n listeners[names[i]].cleanup();\n }\n return;\n }\n\n names = name ? [name] : _.keys(events);\n for (; i < names.length; i++) {\n name = names[i];\n var handlers = events[name];\n\n // Bail out if there are no events stored.\n if (!handlers) break;\n\n // Find any remaining events.\n var remaining = [];\n for (var j = 0; j < handlers.length; j++) {\n var handler = handlers[j];\n if (\n callback && callback !== handler.callback &&\n callback !== handler.callback._callback ||\n context && context !== handler.context\n ) {\n remaining.push(handler);\n } else {\n var listening = handler.listening;\n if (listening) listening.off(name, callback);\n }\n }\n\n // Replace events if there are any remaining. Otherwise, clean up.\n if (remaining.length) {\n events[name] = remaining;\n } else {\n delete events[name];\n }\n }\n\n return events;\n };\n\n // Bind an event to only be triggered a single time. After the first time\n // the callback is invoked, its listener will be removed. If multiple events\n // are passed in using the space-separated syntax, the handler will fire\n // once for each event, not once for a combination of all events.\n Events.once = function(name, callback, context) {\n // Map the event into a `{event: once}` object.\n var events = eventsApi(onceMap, {}, name, callback, this.off.bind(this));\n if (typeof name === 'string' && context == null) callback = void 0;\n return this.on(events, callback, context);\n };\n\n // Inversion-of-control versions of `once`.\n Events.listenToOnce = function(obj, name, callback) {\n // Map the event into a `{event: once}` object.\n var events = eventsApi(onceMap, {}, name, callback, this.stopListening.bind(this, obj));\n return this.listenTo(obj, events);\n };\n\n // Reduces the event callbacks into a map of `{event: onceWrapper}`.\n // `offer` unbinds the `onceWrapper` after it has been called.\n var onceMap = function(map, name, callback, offer) {\n if (callback) {\n var once = map[name] = _.once(function() {\n offer(name, once);\n callback.apply(this, arguments);\n });\n once._callback = callback;\n }\n return map;\n };\n\n // Trigger one or many events, firing all bound callbacks. Callbacks are\n // passed the same arguments as `trigger` is, apart from the event name\n // (unless you're listening on `\"all\"`, which will cause your callback to\n // receive the true name of the event as the first argument).\n Events.trigger = function(name) {\n if (!this._events) return this;\n\n var length = Math.max(0, arguments.length - 1);\n var args = Array(length);\n for (var i = 0; i < length; i++) args[i] = arguments[i + 1];\n\n eventsApi(triggerApi, this._events, name, void 0, args);\n return this;\n };\n\n // Handles triggering the appropriate event callbacks.\n var triggerApi = function(objEvents, name, callback, args) {\n if (objEvents) {\n var events = objEvents[name];\n var allEvents = objEvents.all;\n if (events && allEvents) allEvents = allEvents.slice();\n if (events) triggerEvents(events, args);\n if (allEvents) triggerEvents(allEvents, [name].concat(args));\n }\n return objEvents;\n };\n\n // A difficult-to-believe, but optimized internal dispatch function for\n // triggering events. Tries to keep the usual cases speedy (most internal\n // Backbone events have 3 arguments).\n var triggerEvents = function(events, args) {\n var ev, i = -1, l = events.length, a1 = args[0], a2 = args[1], a3 = args[2];\n switch (args.length) {\n case 0: while (++i < l) (ev = events[i]).callback.call(ev.ctx); return;\n case 1: while (++i < l) (ev = events[i]).callback.call(ev.ctx, a1); return;\n case 2: while (++i < l) (ev = events[i]).callback.call(ev.ctx, a1, a2); return;\n case 3: while (++i < l) (ev = events[i]).callback.call(ev.ctx, a1, a2, a3); return;\n default: while (++i < l) (ev = events[i]).callback.apply(ev.ctx, args); return;\n }\n };\n\n // A listening class that tracks and cleans up memory bindings\n // when all callbacks have been offed.\n var Listening = function(listener, obj) {\n this.id = listener._listenId;\n this.listener = listener;\n this.obj = obj;\n this.interop = true;\n this.count = 0;\n this._events = void 0;\n };\n\n Listening.prototype.on = Events.on;\n\n // Offs a callback (or several).\n // Uses an optimized counter if the listenee uses Backbone.Events.\n // Otherwise, falls back to manual tracking to support events\n // library interop.\n Listening.prototype.off = function(name, callback) {\n var cleanup;\n if (this.interop) {\n this._events = eventsApi(offApi, this._events, name, callback, {\n context: void 0,\n listeners: void 0\n });\n cleanup = !this._events;\n } else {\n this.count--;\n cleanup = this.count === 0;\n }\n if (cleanup) this.cleanup();\n };\n\n // Cleans up memory bindings between the listener and the listenee.\n Listening.prototype.cleanup = function() {\n delete this.listener._listeningTo[this.obj._listenId];\n if (!this.interop) delete this.obj._listeners[this.id];\n };\n\n // Aliases for backwards compatibility.\n Events.bind = Events.on;\n Events.unbind = Events.off;\n\n // Allow the `Backbone` object to serve as a global event bus, for folks who\n // want global \"pubsub\" in a convenient place.\n _.extend(Backbone, Events);\n\n // Backbone.Model\n // --------------\n\n // Backbone **Models** are the basic data object in the framework --\n // frequently representing a row in a table in a database on your server.\n // A discrete chunk of data and a bunch of useful, related methods for\n // performing computations and transformations on that data.\n\n // Create a new model with the specified attributes. A client id (`cid`)\n // is automatically generated and assigned for you.\n var Model = Backbone.Model = function(attributes, options) {\n var attrs = attributes || {};\n options || (options = {});\n this.preinitialize.apply(this, arguments);\n this.cid = _.uniqueId(this.cidPrefix);\n this.attributes = {};\n if (options.collection) this.collection = options.collection;\n if (options.parse) attrs = this.parse(attrs, options) || {};\n var defaults = _.result(this, 'defaults');\n\n // Just _.defaults would work fine, but the additional _.extends\n // is in there for historical reasons. See #3843.\n attrs = _.defaults(_.extend({}, defaults, attrs), defaults);\n\n this.set(attrs, options);\n this.changed = {};\n this.initialize.apply(this, arguments);\n };\n\n // Attach all inheritable methods to the Model prototype.\n _.extend(Model.prototype, Events, {\n\n // A hash of attributes whose current and previous value differ.\n changed: null,\n\n // The value returned during the last failed validation.\n validationError: null,\n\n // The default name for the JSON `id` attribute is `\"id\"`. MongoDB and\n // CouchDB users may want to set this to `\"_id\"`.\n idAttribute: 'id',\n\n // The prefix is used to create the client id which is used to identify models locally.\n // You may want to override this if you're experiencing name clashes with model ids.\n cidPrefix: 'c',\n\n // preinitialize is an empty function by default. You can override it with a function\n // or object. preinitialize will run before any instantiation logic is run in the Model.\n preinitialize: function(){},\n\n // Initialize is an empty function by default. Override it with your own\n // initialization logic.\n initialize: function(){},\n\n // Return a copy of the model's `attributes` object.\n toJSON: function(options) {\n return _.clone(this.attributes);\n },\n\n // Proxy `Backbone.sync` by default -- but override this if you need\n // custom syncing semantics for *this* particular model.\n sync: function() {\n return Backbone.sync.apply(this, arguments);\n },\n\n // Get the value of an attribute.\n get: function(attr) {\n return this.attributes[attr];\n },\n\n // Get the HTML-escaped value of an attribute.\n escape: function(attr) {\n return _.escape(this.get(attr));\n },\n\n // Returns `true` if the attribute contains a value that is not null\n // or undefined.\n has: function(attr) {\n return this.get(attr) != null;\n },\n\n // Special-cased proxy to underscore's `_.matches` method.\n matches: function(attrs) {\n return !!_.iteratee(attrs, this)(this.attributes);\n },\n\n // Set a hash of model attributes on the object, firing `\"change\"`. This is\n // the core primitive operation of a model, updating the data and notifying\n // anyone who needs to know about the change in state. The heart of the beast.\n set: function(key, val, options) {\n if (key == null) return this;\n\n // Handle both `\"key\", value` and `{key: value}` -style arguments.\n var attrs;\n if (typeof key === 'object') {\n attrs = key;\n options = val;\n } else {\n (attrs = {})[key] = val;\n }\n\n options || (options = {});\n\n // Run validation.\n if (!this._validate(attrs, options)) return false;\n\n // Extract attributes and options.\n var unset = options.unset;\n var silent = options.silent;\n var changes = [];\n var changing = this._changing;\n this._changing = true;\n\n if (!changing) {\n this._previousAttributes = _.clone(this.attributes);\n this.changed = {};\n }\n\n var current = this.attributes;\n var changed = this.changed;\n var prev = this._previousAttributes;\n\n // For each `set` attribute, update or delete the current value.\n for (var attr in attrs) {\n val = attrs[attr];\n if (!_.isEqual(current[attr], val)) changes.push(attr);\n if (!_.isEqual(prev[attr], val)) {\n changed[attr] = val;\n } else {\n delete changed[attr];\n }\n unset ? delete current[attr] : current[attr] = val;\n }\n\n // Update the `id`.\n if (this.idAttribute in attrs) {\n var prevId = this.id;\n this.id = this.get(this.idAttribute);\n this.trigger('changeId', this, prevId, options);\n }\n\n // Trigger all relevant attribute changes.\n if (!silent) {\n if (changes.length) this._pending = options;\n for (var i = 0; i < changes.length; i++) {\n this.trigger('change:' + changes[i], this, current[changes[i]], options);\n }\n }\n\n // You might be wondering why there's a `while` loop here. Changes can\n // be recursively nested within `\"change\"` events.\n if (changing) return this;\n if (!silent) {\n while (this._pending) {\n options = this._pending;\n this._pending = false;\n this.trigger('change', this, options);\n }\n }\n this._pending = false;\n this._changing = false;\n return this;\n },\n\n // Remove an attribute from the model, firing `\"change\"`. `unset` is a noop\n // if the attribute doesn't exist.\n unset: function(attr, options) {\n return this.set(attr, void 0, _.extend({}, options, {unset: true}));\n },\n\n // Clear all attributes on the model, firing `\"change\"`.\n clear: function(options) {\n var attrs = {};\n for (var key in this.attributes) attrs[key] = void 0;\n return this.set(attrs, _.extend({}, options, {unset: true}));\n },\n\n // Determine if the model has changed since the last `\"change\"` event.\n // If you specify an attribute name, determine if that attribute has changed.\n hasChanged: function(attr) {\n if (attr == null) return !_.isEmpty(this.changed);\n return _.has(this.changed, attr);\n },\n\n // Return an object containing all the attributes that have changed, or\n // false if there are no changed attributes. Useful for determining what\n // parts of a view need to be updated and/or what attributes need to be\n // persisted to the server. Unset attributes will be set to undefined.\n // You can also pass an attributes object to diff against the model,\n // determining if there *would be* a change.\n changedAttributes: function(diff) {\n if (!diff) return this.hasChanged() ? _.clone(this.changed) : false;\n var old = this._changing ? this._previousAttributes : this.attributes;\n var changed = {};\n var hasChanged;\n for (var attr in diff) {\n var val = diff[attr];\n if (_.isEqual(old[attr], val)) continue;\n changed[attr] = val;\n hasChanged = true;\n }\n return hasChanged ? changed : false;\n },\n\n // Get the previous value of an attribute, recorded at the time the last\n // `\"change\"` event was fired.\n previous: function(attr) {\n if (attr == null || !this._previousAttributes) return null;\n return this._previousAttributes[attr];\n },\n\n // Get all of the attributes of the model at the time of the previous\n // `\"change\"` event.\n previousAttributes: function() {\n return _.clone(this._previousAttributes);\n },\n\n // Fetch the model from the server, merging the response with the model's\n // local attributes. Any changed attributes will trigger a \"change\" event.\n fetch: function(options) {\n options = _.extend({parse: true}, options);\n var model = this;\n var success = options.success;\n options.success = function(resp) {\n var serverAttrs = options.parse ? model.parse(resp, options) : resp;\n if (!model.set(serverAttrs, options)) return false;\n if (success) success.call(options.context, model, resp, options);\n model.trigger('sync', model, resp, options);\n };\n wrapError(this, options);\n return this.sync('read', this, options);\n },\n\n // Set a hash of model attributes, and sync the model to the server.\n // If the server returns an attributes hash that differs, the model's\n // state will be `set` again.\n save: function(key, val, options) {\n // Handle both `\"key\", value` and `{key: value}` -style arguments.\n var attrs;\n if (key == null || typeof key === 'object') {\n attrs = key;\n options = val;\n } else {\n (attrs = {})[key] = val;\n }\n\n options = _.extend({validate: true, parse: true}, options);\n var wait = options.wait;\n\n // If we're not waiting and attributes exist, save acts as\n // `set(attr).save(null, opts)` with validation. Otherwise, check if\n // the model will be valid when the attributes, if any, are set.\n if (attrs && !wait) {\n if (!this.set(attrs, options)) return false;\n } else if (!this._validate(attrs, options)) {\n return false;\n }\n\n // After a successful server-side save, the client is (optionally)\n // updated with the server-side state.\n var model = this;\n var success = options.success;\n var attributes = this.attributes;\n options.success = function(resp) {\n // Ensure attributes are restored during synchronous saves.\n model.attributes = attributes;\n var serverAttrs = options.parse ? model.parse(resp, options) : resp;\n if (wait) serverAttrs = _.extend({}, attrs, serverAttrs);\n if (serverAttrs && !model.set(serverAttrs, options)) return false;\n if (success) success.call(options.context, model, resp, options);\n model.trigger('sync', model, resp, options);\n };\n wrapError(this, options);\n\n // Set temporary attributes if `{wait: true}` to properly find new ids.\n if (attrs && wait) this.attributes = _.extend({}, attributes, attrs);\n\n var method = this.isNew() ? 'create' : options.patch ? 'patch' : 'update';\n if (method === 'patch' && !options.attrs) options.attrs = attrs;\n var xhr = this.sync(method, this, options);\n\n // Restore attributes.\n this.attributes = attributes;\n\n return xhr;\n },\n\n // Destroy this model on the server if it was already persisted.\n // Optimistically removes the model from its collection, if it has one.\n // If `wait: true` is passed, waits for the server to respond before removal.\n destroy: function(options) {\n options = options ? _.clone(options) : {};\n var model = this;\n var success = options.success;\n var wait = options.wait;\n\n var destroy = function() {\n model.stopListening();\n model.trigger('destroy', model, model.collection, options);\n };\n\n options.success = function(resp) {\n if (wait) destroy();\n if (success) success.call(options.context, model, resp, options);\n if (!model.isNew()) model.trigger('sync', model, resp, options);\n };\n\n var xhr = false;\n if (this.isNew()) {\n _.defer(options.success);\n } else {\n wrapError(this, options);\n xhr = this.sync('delete', this, options);\n }\n if (!wait) destroy();\n return xhr;\n },\n\n // Default URL for the model's representation on the server -- if you're\n // using Backbone's restful methods, override this to change the endpoint\n // that will be called.\n url: function() {\n var base =\n _.result(this, 'urlRoot') ||\n _.result(this.collection, 'url') ||\n urlError();\n if (this.isNew()) return base;\n var id = this.get(this.idAttribute);\n return base.replace(/[^\\/]$/, '$&/') + encodeURIComponent(id);\n },\n\n // **parse** converts a response into the hash of attributes to be `set` on\n // the model. The default implementation is just to pass the response along.\n parse: function(resp, options) {\n return resp;\n },\n\n // Create a new model with identical attributes to this one.\n clone: function() {\n return new this.constructor(this.attributes);\n },\n\n // A model is new if it has never been saved to the server, and lacks an id.\n isNew: function() {\n return !this.has(this.idAttribute);\n },\n\n // Check if the model is currently in a valid state.\n isValid: function(options) {\n return this._validate({}, _.extend({}, options, {validate: true}));\n },\n\n // Run validation against the next complete set of model attributes,\n // returning `true` if all is well. Otherwise, fire an `\"invalid\"` event.\n _validate: function(attrs, options) {\n if (!options.validate || !this.validate) return true;\n attrs = _.extend({}, this.attributes, attrs);\n var error = this.validationError = this.validate(attrs, options) || null;\n if (!error) return true;\n this.trigger('invalid', this, error, _.extend(options, {validationError: error}));\n return false;\n }\n\n });\n\n // Backbone.Collection\n // -------------------\n\n // If models tend to represent a single row of data, a Backbone Collection is\n // more analogous to a table full of data ... or a small slice or page of that\n // table, or a collection of rows that belong together for a particular reason\n // -- all of the messages in this particular folder, all of the documents\n // belonging to this particular author, and so on. Collections maintain\n // indexes of their models, both in order, and for lookup by `id`.\n\n // Create a new **Collection**, perhaps to contain a specific type of `model`.\n // If a `comparator` is specified, the Collection will maintain\n // its models in sort order, as they're added and removed.\n var Collection = Backbone.Collection = function(models, options) {\n options || (options = {});\n this.preinitialize.apply(this, arguments);\n if (options.model) this.model = options.model;\n if (options.comparator !== void 0) this.comparator = options.comparator;\n this._reset();\n this.initialize.apply(this, arguments);\n if (models) this.reset(models, _.extend({silent: true}, options));\n };\n\n // Default options for `Collection#set`.\n var setOptions = {add: true, remove: true, merge: true};\n var addOptions = {add: true, remove: false};\n\n // Splices `insert` into `array` at index `at`.\n var splice = function(array, insert, at) {\n at = Math.min(Math.max(at, 0), array.length);\n var tail = Array(array.length - at);\n var length = insert.length;\n var i;\n for (i = 0; i < tail.length; i++) tail[i] = array[i + at];\n for (i = 0; i < length; i++) array[i + at] = insert[i];\n for (i = 0; i < tail.length; i++) array[i + length + at] = tail[i];\n };\n\n // Define the Collection's inheritable methods.\n _.extend(Collection.prototype, Events, {\n\n // The default model for a collection is just a **Backbone.Model**.\n // This should be overridden in most cases.\n model: Model,\n\n\n // preinitialize is an empty function by default. You can override it with a function\n // or object. preinitialize will run before any instantiation logic is run in the Collection.\n preinitialize: function(){},\n\n // Initialize is an empty function by default. Override it with your own\n // initialization logic.\n initialize: function(){},\n\n // The JSON representation of a Collection is an array of the\n // models' attributes.\n toJSON: function(options) {\n return this.map(function(model) { return model.toJSON(options); });\n },\n\n // Proxy `Backbone.sync` by default.\n sync: function() {\n return Backbone.sync.apply(this, arguments);\n },\n\n // Add a model, or list of models to the set. `models` may be Backbone\n // Models or raw JavaScript objects to be converted to Models, or any\n // combination of the two.\n add: function(models, options) {\n return this.set(models, _.extend({merge: false}, options, addOptions));\n },\n\n // Remove a model, or a list of models from the set.\n remove: function(models, options) {\n options = _.extend({}, options);\n var singular = !_.isArray(models);\n models = singular ? [models] : models.slice();\n var removed = this._removeModels(models, options);\n if (!options.silent && removed.length) {\n options.changes = {added: [], merged: [], removed: removed};\n this.trigger('update', this, options);\n }\n return singular ? removed[0] : removed;\n },\n\n // Update a collection by `set`-ing a new list of models, adding new ones,\n // removing models that are no longer present, and merging models that\n // already exist in the collection, as necessary. Similar to **Model#set**,\n // the core operation for updating the data contained by the collection.\n set: function(models, options) {\n if (models == null) return;\n\n options = _.extend({}, setOptions, options);\n if (options.parse && !this._isModel(models)) {\n models = this.parse(models, options) || [];\n }\n\n var singular = !_.isArray(models);\n models = singular ? [models] : models.slice();\n\n var at = options.at;\n if (at != null) at = +at;\n if (at > this.length) at = this.length;\n if (at < 0) at += this.length + 1;\n\n var set = [];\n var toAdd = [];\n var toMerge = [];\n var toRemove = [];\n var modelMap = {};\n\n var add = options.add;\n var merge = options.merge;\n var remove = options.remove;\n\n var sort = false;\n var sortable = this.comparator && at == null && options.sort !== false;\n var sortAttr = _.isString(this.comparator) ? this.comparator : null;\n\n // Turn bare objects into model references, and prevent invalid models\n // from being added.\n var model, i;\n for (i = 0; i < models.length; i++) {\n model = models[i];\n\n // If a duplicate is found, prevent it from being added and\n // optionally merge it into the existing model.\n var existing = this.get(model);\n if (existing) {\n if (merge && model !== existing) {\n var attrs = this._isModel(model) ? model.attributes : model;\n if (options.parse) attrs = existing.parse(attrs, options);\n existing.set(attrs, options);\n toMerge.push(existing);\n if (sortable && !sort) sort = existing.hasChanged(sortAttr);\n }\n if (!modelMap[existing.cid]) {\n modelMap[existing.cid] = true;\n set.push(existing);\n }\n models[i] = existing;\n\n // If this is a new, valid model, push it to the `toAdd` list.\n } else if (add) {\n model = models[i] = this._prepareModel(model, options);\n if (model) {\n toAdd.push(model);\n this._addReference(model, options);\n modelMap[model.cid] = true;\n set.push(model);\n }\n }\n }\n\n // Remove stale models.\n if (remove) {\n for (i = 0; i < this.length; i++) {\n model = this.models[i];\n if (!modelMap[model.cid]) toRemove.push(model);\n }\n if (toRemove.length) this._removeModels(toRemove, options);\n }\n\n // See if sorting is needed, update `length` and splice in new models.\n var orderChanged = false;\n var replace = !sortable && add && remove;\n if (set.length && replace) {\n orderChanged = this.length !== set.length || _.some(this.models, function(m, index) {\n return m !== set[index];\n });\n this.models.length = 0;\n splice(this.models, set, 0);\n this.length = this.models.length;\n } else if (toAdd.length) {\n if (sortable) sort = true;\n splice(this.models, toAdd, at == null ? this.length : at);\n this.length = this.models.length;\n }\n\n // Silently sort the collection if appropriate.\n if (sort) this.sort({silent: true});\n\n // Unless silenced, it's time to fire all appropriate add/sort/update events.\n if (!options.silent) {\n for (i = 0; i < toAdd.length; i++) {\n if (at != null) options.index = at + i;\n model = toAdd[i];\n model.trigger('add', model, this, options);\n }\n if (sort || orderChanged) this.trigger('sort', this, options);\n if (toAdd.length || toRemove.length || toMerge.length) {\n options.changes = {\n added: toAdd,\n removed: toRemove,\n merged: toMerge\n };\n this.trigger('update', this, options);\n }\n }\n\n // Return the added (or merged) model (or models).\n return singular ? models[0] : models;\n },\n\n // When you have more items than you want to add or remove individually,\n // you can reset the entire set with a new list of models, without firing\n // any granular `add` or `remove` events. Fires `reset` when finished.\n // Useful for bulk operations and optimizations.\n reset: function(models, options) {\n options = options ? _.clone(options) : {};\n for (var i = 0; i < this.models.length; i++) {\n this._removeReference(this.models[i], options);\n }\n options.previousModels = this.models;\n this._reset();\n models = this.add(models, _.extend({silent: true}, options));\n if (!options.silent) this.trigger('reset', this, options);\n return models;\n },\n\n // Add a model to the end of the collection.\n push: function(model, options) {\n return this.add(model, _.extend({at: this.length}, options));\n },\n\n // Remove a model from the end of the collection.\n pop: function(options) {\n var model = this.at(this.length - 1);\n return this.remove(model, options);\n },\n\n // Add a model to the beginning of the collection.\n unshift: function(model, options) {\n return this.add(model, _.extend({at: 0}, options));\n },\n\n // Remove a model from the beginning of the collection.\n shift: function(options) {\n var model = this.at(0);\n return this.remove(model, options);\n },\n\n // Slice out a sub-array of models from the collection.\n slice: function() {\n return slice.apply(this.models, arguments);\n },\n\n // Get a model from the set by id, cid, model object with id or cid\n // properties, or an attributes object that is transformed through modelId.\n get: function(obj) {\n if (obj == null) return void 0;\n return this._byId[obj] ||\n this._byId[this.modelId(this._isModel(obj) ? obj.attributes : obj, obj.idAttribute)] ||\n obj.cid && this._byId[obj.cid];\n },\n\n // Returns `true` if the model is in the collection.\n has: function(obj) {\n return this.get(obj) != null;\n },\n\n // Get the model at the given index.\n at: function(index) {\n if (index < 0) index += this.length;\n return this.models[index];\n },\n\n // Return models with matching attributes. Useful for simple cases of\n // `filter`.\n where: function(attrs, first) {\n return this[first ? 'find' : 'filter'](attrs);\n },\n\n // Return the first model with matching attributes. Useful for simple cases\n // of `find`.\n findWhere: function(attrs) {\n return this.where(attrs, true);\n },\n\n // Force the collection to re-sort itself. You don't need to call this under\n // normal circumstances, as the set will maintain sort order as each item\n // is added.\n sort: function(options) {\n var comparator = this.comparator;\n if (!comparator) throw new Error('Cannot sort a set without a comparator');\n options || (options = {});\n\n var length = comparator.length;\n if (_.isFunction(comparator)) comparator = comparator.bind(this);\n\n // Run sort based on type of `comparator`.\n if (length === 1 || _.isString(comparator)) {\n this.models = this.sortBy(comparator);\n } else {\n this.models.sort(comparator);\n }\n if (!options.silent) this.trigger('sort', this, options);\n return this;\n },\n\n // Pluck an attribute from each model in the collection.\n pluck: function(attr) {\n return this.map(attr + '');\n },\n\n // Fetch the default set of models for this collection, resetting the\n // collection when they arrive. If `reset: true` is passed, the response\n // data will be passed through the `reset` method instead of `set`.\n fetch: function(options) {\n options = _.extend({parse: true}, options);\n var success = options.success;\n var collection = this;\n options.success = function(resp) {\n var method = options.reset ? 'reset' : 'set';\n collection[method](resp, options);\n if (success) success.call(options.context, collection, resp, options);\n collection.trigger('sync', collection, resp, options);\n };\n wrapError(this, options);\n return this.sync('read', this, options);\n },\n\n // Create a new instance of a model in this collection. Add the model to the\n // collection immediately, unless `wait: true` is passed, in which case we\n // wait for the server to agree.\n create: function(model, options) {\n options = options ? _.clone(options) : {};\n var wait = options.wait;\n model = this._prepareModel(model, options);\n if (!model) return false;\n if (!wait) this.add(model, options);\n var collection = this;\n var success = options.success;\n options.success = function(m, resp, callbackOpts) {\n if (wait) {\n m.off('error', this._forwardPristineError, this);\n collection.add(m, callbackOpts);\n }\n if (success) success.call(callbackOpts.context, m, resp, callbackOpts);\n };\n // In case of wait:true, our collection is not listening to any\n // of the model's events yet, so it will not forward the error\n // event. In this special case, we need to listen for it\n // separately and handle the event just once.\n // (The reason we don't need to do this for the sync event is\n // in the success handler above: we add the model first, which\n // causes the collection to listen, and then invoke the callback\n // that triggers the event.)\n if (wait) {\n model.once('error', this._forwardPristineError, this);\n }\n model.save(null, options);\n return model;\n },\n\n // **parse** converts a response into a list of models to be added to the\n // collection. The default implementation is just to pass it through.\n parse: function(resp, options) {\n return resp;\n },\n\n // Create a new collection with an identical list of models as this one.\n clone: function() {\n return new this.constructor(this.models, {\n model: this.model,\n comparator: this.comparator\n });\n },\n\n // Define how to uniquely identify models in the collection.\n modelId: function(attrs, idAttribute) {\n return attrs[idAttribute || this.model.prototype.idAttribute || 'id'];\n },\n\n // Get an iterator of all models in this collection.\n values: function() {\n return new CollectionIterator(this, ITERATOR_VALUES);\n },\n\n // Get an iterator of all model IDs in this collection.\n keys: function() {\n return new CollectionIterator(this, ITERATOR_KEYS);\n },\n\n // Get an iterator of all [ID, model] tuples in this collection.\n entries: function() {\n return new CollectionIterator(this, ITERATOR_KEYSVALUES);\n },\n\n // Private method to reset all internal state. Called when the collection\n // is first initialized or reset.\n _reset: function() {\n this.length = 0;\n this.models = [];\n this._byId = {};\n },\n\n // Prepare a hash of attributes (or other model) to be added to this\n // collection.\n _prepareModel: function(attrs, options) {\n if (this._isModel(attrs)) {\n if (!attrs.collection) attrs.collection = this;\n return attrs;\n }\n options = options ? _.clone(options) : {};\n options.collection = this;\n\n var model;\n if (this.model.prototype) {\n model = new this.model(attrs, options);\n } else {\n // ES class methods didn't have prototype\n model = this.model(attrs, options);\n }\n\n if (!model.validationError) return model;\n this.trigger('invalid', this, model.validationError, options);\n return false;\n },\n\n // Internal method called by both remove and set.\n _removeModels: function(models, options) {\n var removed = [];\n for (var i = 0; i < models.length; i++) {\n var model = this.get(models[i]);\n if (!model) continue;\n\n var index = this.indexOf(model);\n this.models.splice(index, 1);\n this.length--;\n\n // Remove references before triggering 'remove' event to prevent an\n // infinite loop. #3693\n delete this._byId[model.cid];\n var id = this.modelId(model.attributes, model.idAttribute);\n if (id != null) delete this._byId[id];\n\n if (!options.silent) {\n options.index = index;\n model.trigger('remove', model, this, options);\n }\n\n removed.push(model);\n this._removeReference(model, options);\n }\n if (models.length > 0 && !options.silent) delete options.index;\n return removed;\n },\n\n // Method for checking whether an object should be considered a model for\n // the purposes of adding to the collection.\n _isModel: function(model) {\n return model instanceof Model;\n },\n\n // Internal method to create a model's ties to a collection.\n _addReference: function(model, options) {\n this._byId[model.cid] = model;\n var id = this.modelId(model.attributes, model.idAttribute);\n if (id != null) this._byId[id] = model;\n model.on('all', this._onModelEvent, this);\n },\n\n // Internal method to sever a model's ties to a collection.\n _removeReference: function(model, options) {\n delete this._byId[model.cid];\n var id = this.modelId(model.attributes, model.idAttribute);\n if (id != null) delete this._byId[id];\n if (this === model.collection) delete model.collection;\n model.off('all', this._onModelEvent, this);\n },\n\n // Internal method called every time a model in the set fires an event.\n // Sets need to update their indexes when models change ids. All other\n // events simply proxy through. \"add\" and \"remove\" events that originate\n // in other collections are ignored.\n _onModelEvent: function(event, model, collection, options) {\n if (model) {\n if ((event === 'add' || event === 'remove') && collection !== this) return;\n if (event === 'destroy') this.remove(model, options);\n if (event === 'changeId') {\n var prevId = this.modelId(model.previousAttributes(), model.idAttribute);\n var id = this.modelId(model.attributes, model.idAttribute);\n if (prevId != null) delete this._byId[prevId];\n if (id != null) this._byId[id] = model;\n }\n }\n this.trigger.apply(this, arguments);\n },\n\n // Internal callback method used in `create`. It serves as a\n // stand-in for the `_onModelEvent` method, which is not yet bound\n // during the `wait` period of the `create` call. We still want to\n // forward any `'error'` event at the end of the `wait` period,\n // hence a customized callback.\n _forwardPristineError: function(model, collection, options) {\n // Prevent double forward if the model was already in the\n // collection before the call to `create`.\n if (this.has(model)) return;\n this._onModelEvent('error', model, collection, options);\n }\n });\n\n // Defining an @@iterator method implements JavaScript's Iterable protocol.\n // In modern ES2015 browsers, this value is found at Symbol.iterator.\n /* global Symbol */\n var $$iterator = typeof Symbol === 'function' && Symbol.iterator;\n if ($$iterator) {\n Collection.prototype[$$iterator] = Collection.prototype.values;\n }\n\n // CollectionIterator\n // ------------------\n\n // A CollectionIterator implements JavaScript's Iterator protocol, allowing the\n // use of `for of` loops in modern browsers and interoperation between\n // Backbone.Collection and other JavaScript functions and third-party libraries\n // which can operate on Iterables.\n var CollectionIterator = function(collection, kind) {\n this._collection = collection;\n this._kind = kind;\n this._index = 0;\n };\n\n // This \"enum\" defines the three possible kinds of values which can be emitted\n // by a CollectionIterator that correspond to the values(), keys() and entries()\n // methods on Collection, respectively.\n var ITERATOR_VALUES = 1;\n var ITERATOR_KEYS = 2;\n var ITERATOR_KEYSVALUES = 3;\n\n // All Iterators should themselves be Iterable.\n if ($$iterator) {\n CollectionIterator.prototype[$$iterator] = function() {\n return this;\n };\n }\n\n CollectionIterator.prototype.next = function() {\n if (this._collection) {\n\n // Only continue iterating if the iterated collection is long enough.\n if (this._index < this._collection.length) {\n var model = this._collection.at(this._index);\n this._index++;\n\n // Construct a value depending on what kind of values should be iterated.\n var value;\n if (this._kind === ITERATOR_VALUES) {\n value = model;\n } else {\n var id = this._collection.modelId(model.attributes, model.idAttribute);\n if (this._kind === ITERATOR_KEYS) {\n value = id;\n } else { // ITERATOR_KEYSVALUES\n value = [id, model];\n }\n }\n return {value: value, done: false};\n }\n\n // Once exhausted, remove the reference to the collection so future\n // calls to the next method always return done.\n this._collection = void 0;\n }\n\n return {value: void 0, done: true};\n };\n\n // Backbone.View\n // -------------\n\n // Backbone Views are almost more convention than they are actual code. A View\n // is simply a JavaScript object that represents a logical chunk of UI in the\n // DOM. This might be a single item, an entire list, a sidebar or panel, or\n // even the surrounding frame which wraps your whole app. Defining a chunk of\n // UI as a **View** allows you to define your DOM events declaratively, without\n // having to worry about render order ... and makes it easy for the view to\n // react to specific changes in the state of your models.\n\n // Creating a Backbone.View creates its initial element outside of the DOM,\n // if an existing element is not provided...\n var View = Backbone.View = function(options) {\n this.cid = _.uniqueId('view');\n this.preinitialize.apply(this, arguments);\n _.extend(this, _.pick(options, viewOptions));\n this._ensureElement();\n this.initialize.apply(this, arguments);\n };\n\n // Cached regex to split keys for `delegate`.\n var delegateEventSplitter = /^(\\S+)\\s*(.*)$/;\n\n // List of view options to be set as properties.\n var viewOptions = ['model', 'collection', 'el', 'id', 'attributes', 'className', 'tagName', 'events'];\n\n // Set up all inheritable **Backbone.View** properties and methods.\n _.extend(View.prototype, Events, {\n\n // The default `tagName` of a View's element is `\"div\"`.\n tagName: 'div',\n\n // jQuery delegate for element lookup, scoped to DOM elements within the\n // current view. This should be preferred to global lookups where possible.\n $: function(selector) {\n return this.$el.find(selector);\n },\n\n // preinitialize is an empty function by default. You can override it with a function\n // or object. preinitialize will run before any instantiation logic is run in the View\n preinitialize: function(){},\n\n // Initialize is an empty function by default. Override it with your own\n // initialization logic.\n initialize: function(){},\n\n // **render** is the core function that your view should override, in order\n // to populate its element (`this.el`), with the appropriate HTML. The\n // convention is for **render** to always return `this`.\n render: function() {\n return this;\n },\n\n // Remove this view by taking the element out of the DOM, and removing any\n // applicable Backbone.Events listeners.\n remove: function() {\n this._removeElement();\n this.stopListening();\n return this;\n },\n\n // Remove this view's element from the document and all event listeners\n // attached to it. Exposed for subclasses using an alternative DOM\n // manipulation API.\n _removeElement: function() {\n this.$el.remove();\n },\n\n // Change the view's element (`this.el` property) and re-delegate the\n // view's events on the new element.\n setElement: function(element) {\n this.undelegateEvents();\n this._setElement(element);\n this.delegateEvents();\n return this;\n },\n\n // Creates the `this.el` and `this.$el` references for this view using the\n // given `el`. `el` can be a CSS selector or an HTML string, a jQuery\n // context or an element. Subclasses can override this to utilize an\n // alternative DOM manipulation API and are only required to set the\n // `this.el` property.\n _setElement: function(el) {\n this.$el = el instanceof Backbone.$ ? el : Backbone.$(el);\n this.el = this.$el[0];\n },\n\n // Set callbacks, where `this.events` is a hash of\n //\n // *{\"event selector\": \"callback\"}*\n //\n // {\n // 'mousedown .title': 'edit',\n // 'click .button': 'save',\n // 'click .open': function(e) { ... }\n // }\n //\n // pairs. Callbacks will be bound to the view, with `this` set properly.\n // Uses event delegation for efficiency.\n // Omitting the selector binds the event to `this.el`.\n delegateEvents: function(events) {\n events || (events = _.result(this, 'events'));\n if (!events) return this;\n this.undelegateEvents();\n for (var key in events) {\n var method = events[key];\n if (!_.isFunction(method)) method = this[method];\n if (!method) continue;\n var match = key.match(delegateEventSplitter);\n this.delegate(match[1], match[2], method.bind(this));\n }\n return this;\n },\n\n // Add a single event listener to the view's element (or a child element\n // using `selector`). This only works for delegate-able events: not `focus`,\n // `blur`, and not `change`, `submit`, and `reset` in Internet Explorer.\n delegate: function(eventName, selector, listener) {\n this.$el.on(eventName + '.delegateEvents' + this.cid, selector, listener);\n return this;\n },\n\n // Clears all callbacks previously bound to the view by `delegateEvents`.\n // You usually don't need to use this, but may wish to if you have multiple\n // Backbone views attached to the same DOM element.\n undelegateEvents: function() {\n if (this.$el) this.$el.off('.delegateEvents' + this.cid);\n return this;\n },\n\n // A finer-grained `undelegateEvents` for removing a single delegated event.\n // `selector` and `listener` are both optional.\n undelegate: function(eventName, selector, listener) {\n this.$el.off(eventName + '.delegateEvents' + this.cid, selector, listener);\n return this;\n },\n\n // Produces a DOM element to be assigned to your view. Exposed for\n // subclasses using an alternative DOM manipulation API.\n _createElement: function(tagName) {\n return document.createElement(tagName);\n },\n\n // Ensure that the View has a DOM element to render into.\n // If `this.el` is a string, pass it through `$()`, take the first\n // matching element, and re-assign it to `el`. Otherwise, create\n // an element from the `id`, `className` and `tagName` properties.\n _ensureElement: function() {\n if (!this.el) {\n var attrs = _.extend({}, _.result(this, 'attributes'));\n if (this.id) attrs.id = _.result(this, 'id');\n if (this.className) attrs['class'] = _.result(this, 'className');\n this.setElement(this._createElement(_.result(this, 'tagName')));\n this._setAttributes(attrs);\n } else {\n this.setElement(_.result(this, 'el'));\n }\n },\n\n // Set attributes from a hash on this view's element. Exposed for\n // subclasses using an alternative DOM manipulation API.\n _setAttributes: function(attributes) {\n this.$el.attr(attributes);\n }\n\n });\n\n // Proxy Backbone class methods to Underscore functions, wrapping the model's\n // `attributes` object or collection's `models` array behind the scenes.\n //\n // collection.filter(function(model) { return model.get('age') > 10 });\n // collection.each(this.addView);\n //\n // `Function#apply` can be slow so we use the method's arg count, if we know it.\n var addMethod = function(base, length, method, attribute) {\n switch (length) {\n case 1: return function() {\n return base[method](this[attribute]);\n };\n case 2: return function(value) {\n return base[method](this[attribute], value);\n };\n case 3: return function(iteratee, context) {\n return base[method](this[attribute], cb(iteratee, this), context);\n };\n case 4: return function(iteratee, defaultVal, context) {\n return base[method](this[attribute], cb(iteratee, this), defaultVal, context);\n };\n default: return function() {\n var args = slice.call(arguments);\n args.unshift(this[attribute]);\n return base[method].apply(base, args);\n };\n }\n };\n\n var addUnderscoreMethods = function(Class, base, methods, attribute) {\n _.each(methods, function(length, method) {\n if (base[method]) Class.prototype[method] = addMethod(base, length, method, attribute);\n });\n };\n\n // Support `collection.sortBy('attr')` and `collection.findWhere({id: 1})`.\n var cb = function(iteratee, instance) {\n if (_.isFunction(iteratee)) return iteratee;\n if (_.isObject(iteratee) && !instance._isModel(iteratee)) return modelMatcher(iteratee);\n if (_.isString(iteratee)) return function(model) { return model.get(iteratee); };\n return iteratee;\n };\n var modelMatcher = function(attrs) {\n var matcher = _.matches(attrs);\n return function(model) {\n return matcher(model.attributes);\n };\n };\n\n // Underscore methods that we want to implement on the Collection.\n // 90% of the core usefulness of Backbone Collections is actually implemented\n // right here:\n var collectionMethods = {forEach: 3, each: 3, map: 3, collect: 3, reduce: 0,\n foldl: 0, inject: 0, reduceRight: 0, foldr: 0, find: 3, detect: 3, filter: 3,\n select: 3, reject: 3, every: 3, all: 3, some: 3, any: 3, include: 3, includes: 3,\n contains: 3, invoke: 0, max: 3, min: 3, toArray: 1, size: 1, first: 3,\n head: 3, take: 3, initial: 3, rest: 3, tail: 3, drop: 3, last: 3,\n without: 0, difference: 0, indexOf: 3, shuffle: 1, lastIndexOf: 3,\n isEmpty: 1, chain: 1, sample: 3, partition: 3, groupBy: 3, countBy: 3,\n sortBy: 3, indexBy: 3, findIndex: 3, findLastIndex: 3};\n\n\n // Underscore methods that we want to implement on the Model, mapped to the\n // number of arguments they take.\n var modelMethods = {keys: 1, values: 1, pairs: 1, invert: 1, pick: 0,\n omit: 0, chain: 1, isEmpty: 1};\n\n // Mix in each Underscore method as a proxy to `Collection#models`.\n\n _.each([\n [Collection, collectionMethods, 'models'],\n [Model, modelMethods, 'attributes']\n ], function(config) {\n var Base = config[0],\n methods = config[1],\n attribute = config[2];\n\n Base.mixin = function(obj) {\n var mappings = _.reduce(_.functions(obj), function(memo, name) {\n memo[name] = 0;\n return memo;\n }, {});\n addUnderscoreMethods(Base, obj, mappings, attribute);\n };\n\n addUnderscoreMethods(Base, _, methods, attribute);\n });\n\n // Backbone.sync\n // -------------\n\n // Override this function to change the manner in which Backbone persists\n // models to the server. You will be passed the type of request, and the\n // model in question. By default, makes a RESTful Ajax request\n // to the model's `url()`. Some possible customizations could be:\n //\n // * Use `setTimeout` to batch rapid-fire updates into a single request.\n // * Send up the models as XML instead of JSON.\n // * Persist models via WebSockets instead of Ajax.\n //\n // Turn on `Backbone.emulateHTTP` in order to send `PUT` and `DELETE` requests\n // as `POST`, with a `_method` parameter containing the true HTTP method,\n // as well as all requests with the body as `application/x-www-form-urlencoded`\n // instead of `application/json` with the model in a param named `model`.\n // Useful when interfacing with server-side languages like **PHP** that make\n // it difficult to read the body of `PUT` requests.\n Backbone.sync = function(method, model, options) {\n var type = methodMap[method];\n\n // Default options, unless specified.\n _.defaults(options || (options = {}), {\n emulateHTTP: Backbone.emulateHTTP,\n emulateJSON: Backbone.emulateJSON\n });\n\n // Default JSON-request options.\n var params = {type: type, dataType: 'json'};\n\n // Ensure that we have a URL.\n if (!options.url) {\n params.url = _.result(model, 'url') || urlError();\n }\n\n // Ensure that we have the appropriate request data.\n if (options.data == null && model && (method === 'create' || method === 'update' || method === 'patch')) {\n params.contentType = 'application/json';\n params.data = JSON.stringify(options.attrs || model.toJSON(options));\n }\n\n // For older servers, emulate JSON by encoding the request into an HTML-form.\n if (options.emulateJSON) {\n params.contentType = 'application/x-www-form-urlencoded';\n params.data = params.data ? {model: params.data} : {};\n }\n\n // For older servers, emulate HTTP by mimicking the HTTP method with `_method`\n // And an `X-HTTP-Method-Override` header.\n if (options.emulateHTTP && (type === 'PUT' || type === 'DELETE' || type === 'PATCH')) {\n params.type = 'POST';\n if (options.emulateJSON) params.data._method = type;\n var beforeSend = options.beforeSend;\n options.beforeSend = function(xhr) {\n xhr.setRequestHeader('X-HTTP-Method-Override', type);\n if (beforeSend) return beforeSend.apply(this, arguments);\n };\n }\n\n // Don't process data on a non-GET request.\n if (params.type !== 'GET' && !options.emulateJSON) {\n params.processData = false;\n }\n\n // Pass along `textStatus` and `errorThrown` from jQuery.\n var error = options.error;\n options.error = function(xhr, textStatus, errorThrown) {\n options.textStatus = textStatus;\n options.errorThrown = errorThrown;\n if (error) error.call(options.context, xhr, textStatus, errorThrown);\n };\n\n // Make the request, allowing the user to override any Ajax options.\n var xhr = options.xhr = Backbone.ajax(_.extend(params, options));\n model.trigger('request', model, xhr, options);\n return xhr;\n };\n\n // Map from CRUD to HTTP for our default `Backbone.sync` implementation.\n var methodMap = {\n 'create': 'POST',\n 'update': 'PUT',\n 'patch': 'PATCH',\n 'delete': 'DELETE',\n 'read': 'GET'\n };\n\n // Set the default implementation of `Backbone.ajax` to proxy through to `$`.\n // Override this if you'd like to use a different library.\n Backbone.ajax = function() {\n return Backbone.$.ajax.apply(Backbone.$, arguments);\n };\n\n // Backbone.Router\n // ---------------\n\n // Routers map faux-URLs to actions, and fire events when routes are\n // matched. Creating a new one sets its `routes` hash, if not set statically.\n var Router = Backbone.Router = function(options) {\n options || (options = {});\n this.preinitialize.apply(this, arguments);\n if (options.routes) this.routes = options.routes;\n this._bindRoutes();\n this.initialize.apply(this, arguments);\n };\n\n // Cached regular expressions for matching named param parts and splatted\n // parts of route strings.\n var optionalParam = /\\((.*?)\\)/g;\n var namedParam = /(\\(\\?)?:\\w+/g;\n var splatParam = /\\*\\w+/g;\n var escapeRegExp = /[\\-{}\\[\\]+?.,\\\\\\^$|#\\s]/g;\n\n // Set up all inheritable **Backbone.Router** properties and methods.\n _.extend(Router.prototype, Events, {\n\n // preinitialize is an empty function by default. You can override it with a function\n // or object. preinitialize will run before any instantiation logic is run in the Router.\n preinitialize: function(){},\n\n // Initialize is an empty function by default. Override it with your own\n // initialization logic.\n initialize: function(){},\n\n // Manually bind a single named route to a callback. For example:\n //\n // this.route('search/:query/p:num', 'search', function(query, num) {\n // ...\n // });\n //\n route: function(route, name, callback) {\n if (!_.isRegExp(route)) route = this._routeToRegExp(route);\n if (_.isFunction(name)) {\n callback = name;\n name = '';\n }\n if (!callback) callback = this[name];\n var router = this;\n Backbone.history.route(route, function(fragment) {\n var args = router._extractParameters(route, fragment);\n if (router.execute(callback, args, name) !== false) {\n router.trigger.apply(router, ['route:' + name].concat(args));\n router.trigger('route', name, args);\n Backbone.history.trigger('route', router, name, args);\n }\n });\n return this;\n },\n\n // Execute a route handler with the provided parameters. This is an\n // excellent place to do pre-route setup or post-route cleanup.\n execute: function(callback, args, name) {\n if (callback) callback.apply(this, args);\n },\n\n // Simple proxy to `Backbone.history` to save a fragment into the history.\n navigate: function(fragment, options) {\n Backbone.history.navigate(fragment, options);\n return this;\n },\n\n // Bind all defined routes to `Backbone.history`. We have to reverse the\n // order of the routes here to support behavior where the most general\n // routes can be defined at the bottom of the route map.\n _bindRoutes: function() {\n if (!this.routes) return;\n this.routes = _.result(this, 'routes');\n var route, routes = _.keys(this.routes);\n while ((route = routes.pop()) != null) {\n this.route(route, this.routes[route]);\n }\n },\n\n // Convert a route string into a regular expression, suitable for matching\n // against the current location hash.\n _routeToRegExp: function(route) {\n route = route.replace(escapeRegExp, '\\\\$&')\n .replace(optionalParam, '(?:$1)?')\n .replace(namedParam, function(match, optional) {\n return optional ? match : '([^/?]+)';\n })\n .replace(splatParam, '([^?]*?)');\n return new RegExp('^' + route + '(?:\\\\?([\\\\s\\\\S]*))?$');\n },\n\n // Given a route, and a URL fragment that it matches, return the array of\n // extracted decoded parameters. Empty or unmatched parameters will be\n // treated as `null` to normalize cross-browser behavior.\n _extractParameters: function(route, fragment) {\n var params = route.exec(fragment).slice(1);\n return _.map(params, function(param, i) {\n // Don't decode the search params.\n if (i === params.length - 1) return param || null;\n return param ? decodeURIComponent(param) : null;\n });\n }\n\n });\n\n // Backbone.History\n // ----------------\n\n // Handles cross-browser history management, based on either\n // [pushState](http://diveintohtml5.info/history.html) and real URLs, or\n // [onhashchange](https://developer.mozilla.org/en-US/docs/DOM/window.onhashchange)\n // and URL fragments. If the browser supports neither (old IE, natch),\n // falls back to polling.\n var History = Backbone.History = function() {\n this.handlers = [];\n this.checkUrl = this.checkUrl.bind(this);\n\n // Ensure that `History` can be used outside of the browser.\n if (typeof window !== 'undefined') {\n this.location = window.location;\n this.history = window.history;\n }\n };\n\n // Cached regex for stripping a leading hash/slash and trailing space.\n var routeStripper = /^[#\\/]|\\s+$/g;\n\n // Cached regex for stripping leading and trailing slashes.\n var rootStripper = /^\\/+|\\/+$/g;\n\n // Cached regex for stripping urls of hash.\n var pathStripper = /#.*$/;\n\n // Has the history handling already been started?\n History.started = false;\n\n // Set up all inheritable **Backbone.History** properties and methods.\n _.extend(History.prototype, Events, {\n\n // The default interval to poll for hash changes, if necessary, is\n // twenty times a second.\n interval: 50,\n\n // Are we at the app root?\n atRoot: function() {\n var path = this.location.pathname.replace(/[^\\/]$/, '$&/');\n return path === this.root && !this.getSearch();\n },\n\n // Does the pathname match the root?\n matchRoot: function() {\n var path = this.decodeFragment(this.location.pathname);\n var rootPath = path.slice(0, this.root.length - 1) + '/';\n return rootPath === this.root;\n },\n\n // Unicode characters in `location.pathname` are percent encoded so they're\n // decoded for comparison. `%25` should not be decoded since it may be part\n // of an encoded parameter.\n decodeFragment: function(fragment) {\n return decodeURI(fragment.replace(/%25/g, '%2525'));\n },\n\n // In IE6, the hash fragment and search params are incorrect if the\n // fragment contains `?`.\n getSearch: function() {\n var match = this.location.href.replace(/#.*/, '').match(/\\?.+/);\n return match ? match[0] : '';\n },\n\n // Gets the true hash value. Cannot use location.hash directly due to bug\n // in Firefox where location.hash will always be decoded.\n getHash: function(window) {\n var match = (window || this).location.href.match(/#(.*)$/);\n return match ? match[1] : '';\n },\n\n // Get the pathname and search params, without the root.\n getPath: function() {\n var path = this.decodeFragment(\n this.location.pathname + this.getSearch()\n ).slice(this.root.length - 1);\n return path.charAt(0) === '/' ? path.slice(1) : path;\n },\n\n // Get the cross-browser normalized URL fragment from the path or hash.\n getFragment: function(fragment) {\n if (fragment == null) {\n if (this._usePushState || !this._wantsHashChange) {\n fragment = this.getPath();\n } else {\n fragment = this.getHash();\n }\n }\n return fragment.replace(routeStripper, '');\n },\n\n // Start the hash change handling, returning `true` if the current URL matches\n // an existing route, and `false` otherwise.\n start: function(options) {\n if (History.started) throw new Error('Backbone.history has already been started');\n History.started = true;\n\n // Figure out the initial configuration. Do we need an iframe?\n // Is pushState desired ... is it available?\n this.options = _.extend({root: '/'}, this.options, options);\n this.root = this.options.root;\n this._trailingSlash = this.options.trailingSlash;\n this._wantsHashChange = this.options.hashChange !== false;\n this._hasHashChange = 'onhashchange' in window && (document.documentMode === void 0 || document.documentMode > 7);\n this._useHashChange = this._wantsHashChange && this._hasHashChange;\n this._wantsPushState = !!this.options.pushState;\n this._hasPushState = !!(this.history && this.history.pushState);\n this._usePushState = this._wantsPushState && this._hasPushState;\n this.fragment = this.getFragment();\n\n // Normalize root to always include a leading and trailing slash.\n this.root = ('/' + this.root + '/').replace(rootStripper, '/');\n\n // Transition from hashChange to pushState or vice versa if both are\n // requested.\n if (this._wantsHashChange && this._wantsPushState) {\n\n // If we've started off with a route from a `pushState`-enabled\n // browser, but we're currently in a browser that doesn't support it...\n if (!this._hasPushState && !this.atRoot()) {\n var rootPath = this.root.slice(0, -1) || '/';\n this.location.replace(rootPath + '#' + this.getPath());\n // Return immediately as browser will do redirect to new url\n return true;\n\n // Or if we've started out with a hash-based route, but we're currently\n // in a browser where it could be `pushState`-based instead...\n } else if (this._hasPushState && this.atRoot()) {\n this.navigate(this.getHash(), {replace: true});\n }\n\n }\n\n // Proxy an iframe to handle location events if the browser doesn't\n // support the `hashchange` event, HTML5 history, or the user wants\n // `hashChange` but not `pushState`.\n if (!this._hasHashChange && this._wantsHashChange && !this._usePushState) {\n this.iframe = document.createElement('iframe');\n this.iframe.src = 'javascript:0';\n this.iframe.style.display = 'none';\n this.iframe.tabIndex = -1;\n var body = document.body;\n // Using `appendChild` will throw on IE < 9 if the document is not ready.\n var iWindow = body.insertBefore(this.iframe, body.firstChild).contentWindow;\n iWindow.document.open();\n iWindow.document.close();\n iWindow.location.hash = '#' + this.fragment;\n }\n\n // Add a cross-platform `addEventListener` shim for older browsers.\n var addEventListener = window.addEventListener || function(eventName, listener) {\n return attachEvent('on' + eventName, listener);\n };\n\n // Depending on whether we're using pushState or hashes, and whether\n // 'onhashchange' is supported, determine how we check the URL state.\n if (this._usePushState) {\n addEventListener('popstate', this.checkUrl, false);\n } else if (this._useHashChange && !this.iframe) {\n addEventListener('hashchange', this.checkUrl, false);\n } else if (this._wantsHashChange) {\n this._checkUrlInterval = setInterval(this.checkUrl, this.interval);\n }\n\n if (!this.options.silent) return this.loadUrl();\n },\n\n // Disable Backbone.history, perhaps temporarily. Not useful in a real app,\n // but possibly useful for unit testing Routers.\n stop: function() {\n // Add a cross-platform `removeEventListener` shim for older browsers.\n var removeEventListener = window.removeEventListener || function(eventName, listener) {\n return detachEvent('on' + eventName, listener);\n };\n\n // Remove window listeners.\n if (this._usePushState) {\n removeEventListener('popstate', this.checkUrl, false);\n } else if (this._useHashChange && !this.iframe) {\n removeEventListener('hashchange', this.checkUrl, false);\n }\n\n // Clean up the iframe if necessary.\n if (this.iframe) {\n document.body.removeChild(this.iframe);\n this.iframe = null;\n }\n\n // Some environments will throw when clearing an undefined interval.\n if (this._checkUrlInterval) clearInterval(this._checkUrlInterval);\n History.started = false;\n },\n\n // Add a route to be tested when the fragment changes. Routes added later\n // may override previous routes.\n route: function(route, callback) {\n this.handlers.unshift({route: route, callback: callback});\n },\n\n // Checks the current URL to see if it has changed, and if it has,\n // calls `loadUrl`, normalizing across the hidden iframe.\n checkUrl: function(e) {\n var current = this.getFragment();\n\n // If the user pressed the back button, the iframe's hash will have\n // changed and we should use that for comparison.\n if (current === this.fragment && this.iframe) {\n current = this.getHash(this.iframe.contentWindow);\n }\n\n if (current === this.fragment) return false;\n if (this.iframe) this.navigate(current);\n this.loadUrl();\n },\n\n // Attempt to load the current URL fragment. If a route succeeds with a\n // match, returns `true`. If no defined routes matches the fragment,\n // returns `false`.\n loadUrl: function(fragment) {\n // If the root doesn't match, no routes can match either.\n if (!this.matchRoot()) return false;\n fragment = this.fragment = this.getFragment(fragment);\n return _.some(this.handlers, function(handler) {\n if (handler.route.test(fragment)) {\n handler.callback(fragment);\n return true;\n }\n });\n },\n\n // Save a fragment into the hash history, or replace the URL state if the\n // 'replace' option is passed. You are responsible for properly URL-encoding\n // the fragment in advance.\n //\n // The options object can contain `trigger: true` if you wish to have the\n // route callback be fired (not usually desirable), or `replace: true`, if\n // you wish to modify the current URL without adding an entry to the history.\n navigate: function(fragment, options) {\n if (!History.started) return false;\n if (!options || options === true) options = {trigger: !!options};\n\n // Normalize the fragment.\n fragment = this.getFragment(fragment || '');\n\n // Strip trailing slash on the root unless _trailingSlash is true\n var rootPath = this.root;\n if (!this._trailingSlash && (fragment === '' || fragment.charAt(0) === '?')) {\n rootPath = rootPath.slice(0, -1) || '/';\n }\n var url = rootPath + fragment;\n\n // Strip the fragment of the query and hash for matching.\n fragment = fragment.replace(pathStripper, '');\n\n // Decode for matching.\n var decodedFragment = this.decodeFragment(fragment);\n\n if (this.fragment === decodedFragment) return;\n this.fragment = decodedFragment;\n\n // If pushState is available, we use it to set the fragment as a real URL.\n if (this._usePushState) {\n this.history[options.replace ? 'replaceState' : 'pushState']({}, document.title, url);\n\n // If hash changes haven't been explicitly disabled, update the hash\n // fragment to store history.\n } else if (this._wantsHashChange) {\n this._updateHash(this.location, fragment, options.replace);\n if (this.iframe && fragment !== this.getHash(this.iframe.contentWindow)) {\n var iWindow = this.iframe.contentWindow;\n\n // Opening and closing the iframe tricks IE7 and earlier to push a\n // history entry on hash-tag change. When replace is true, we don't\n // want this.\n if (!options.replace) {\n iWindow.document.open();\n iWindow.document.close();\n }\n\n this._updateHash(iWindow.location, fragment, options.replace);\n }\n\n // If you've told us that you explicitly don't want fallback hashchange-\n // based history, then `navigate` becomes a page refresh.\n } else {\n return this.location.assign(url);\n }\n if (options.trigger) return this.loadUrl(fragment);\n },\n\n // Update the hash location, either replacing the current entry, or adding\n // a new one to the browser history.\n _updateHash: function(location, fragment, replace) {\n if (replace) {\n var href = location.href.replace(/(javascript:|#).*$/, '');\n location.replace(href + '#' + fragment);\n } else {\n // Some browsers require that `hash` contains a leading #.\n location.hash = '#' + fragment;\n }\n }\n\n });\n\n // Create the default Backbone.history.\n Backbone.history = new History;\n\n // Helpers\n // -------\n\n // Helper function to correctly set up the prototype chain for subclasses.\n // Similar to `goog.inherits`, but uses a hash of prototype properties and\n // class properties to be extended.\n var extend = function(protoProps, staticProps) {\n var parent = this;\n var child;\n\n // The constructor function for the new subclass is either defined by you\n // (the \"constructor\" property in your `extend` definition), or defaulted\n // by us to simply call the parent constructor.\n if (protoProps && _.has(protoProps, 'constructor')) {\n child = protoProps.constructor;\n } else {\n child = function(){ return parent.apply(this, arguments); };\n }\n\n // Add static properties to the constructor function, if supplied.\n _.extend(child, parent, staticProps);\n\n // Set the prototype chain to inherit from `parent`, without calling\n // `parent`'s constructor function and add the prototype properties.\n child.prototype = _.create(parent.prototype, protoProps);\n child.prototype.constructor = child;\n\n // Set a convenience property in case the parent's prototype is needed\n // later.\n child.__super__ = parent.prototype;\n\n return child;\n };\n\n // Set up inheritance for the model, collection, router, view and history.\n Model.extend = Collection.extend = Router.extend = View.extend = History.extend = extend;\n\n // Throw an error when a URL is needed, and none is supplied.\n var urlError = function() {\n throw new Error('A \"url\" property or function must be specified');\n };\n\n // Wrap an optional error callback with a fallback error event.\n var wrapError = function(model, options) {\n var error = options.error;\n options.error = function(resp) {\n if (error) error.call(options.context, model, resp, options);\n model.trigger('error', model, resp, options);\n };\n };\n\n return Backbone;\n});\n","// Imports\nimport ___CSS_LOADER_API_SOURCEMAP_IMPORT___ from \"../../../../node_modules/css-loader/dist/runtime/sourceMaps.js\";\nimport ___CSS_LOADER_API_IMPORT___ from \"../../../../node_modules/css-loader/dist/runtime/api.js\";\nvar ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_SOURCEMAP_IMPORT___);\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, \".button-vue[data-v-3fa8511b]{margin-top:.5rem}\", \"\",{\"version\":3,\"sources\":[\"webpack://./core/src/components/login/LoginButton.vue\"],\"names\":[],\"mappings\":\"AACA,6BACC,gBAAA\",\"sourcesContent\":[\"\\n.button-vue {\\n\\tmargin-top: .5rem;\\n}\\n\"],\"sourceRoot\":\"\"}]);\n// Exports\nexport default ___CSS_LOADER_EXPORT___;\n","// Imports\nimport ___CSS_LOADER_API_SOURCEMAP_IMPORT___ from \"../../../../node_modules/css-loader/dist/runtime/sourceMaps.js\";\nimport ___CSS_LOADER_API_IMPORT___ from \"../../../../node_modules/css-loader/dist/runtime/api.js\";\nvar ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_SOURCEMAP_IMPORT___);\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, \".login-form[data-v-0fbfcc31]{text-align:left;font-size:1rem}.login-form__fieldset[data-v-0fbfcc31]{width:100%;display:flex;flex-direction:column;gap:.5rem}.login-form__headline[data-v-0fbfcc31]{text-align:center;overflow-wrap:anywhere}\", \"\",{\"version\":3,\"sources\":[\"webpack://./core/src/components/login/LoginForm.vue\"],\"names\":[],\"mappings\":\"AACA,6BACC,eAAA,CACA,cAAA,CAEA,uCACC,UAAA,CACA,YAAA,CACA,qBAAA,CACA,SAAA,CAGD,uCACC,iBAAA,CACA,sBAAA\",\"sourcesContent\":[\"\\n.login-form {\\n\\ttext-align: left;\\n\\tfont-size: 1rem;\\n\\n\\t&__fieldset {\\n\\t\\twidth: 100%;\\n\\t\\tdisplay: flex;\\n\\t\\tflex-direction: column;\\n\\t\\tgap: .5rem;\\n\\t}\\n\\n\\t&__headline {\\n\\t\\ttext-align: center;\\n\\t\\toverflow-wrap: anywhere;\\n\\t}\\n}\\n\"],\"sourceRoot\":\"\"}]);\n// Exports\nexport default ___CSS_LOADER_EXPORT___;\n","// Imports\nimport ___CSS_LOADER_API_SOURCEMAP_IMPORT___ from \"../../../../node_modules/css-loader/dist/runtime/sourceMaps.js\";\nimport ___CSS_LOADER_API_IMPORT___ from \"../../../../node_modules/css-loader/dist/runtime/api.js\";\nvar ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_SOURCEMAP_IMPORT___);\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, \"fieldset[data-v-3ea2fa78]{display:flex;flex-direction:column;gap:.5rem}fieldset[data-v-3ea2fa78] label{text-align:initial}.update[data-v-3ea2fa78]{margin:0 auto}\", \"\",{\"version\":3,\"sources\":[\"webpack://./core/src/components/login/PasswordLessLoginForm.vue\"],\"names\":[],\"mappings\":\"AACA,0BACC,YAAA,CACA,qBAAA,CACA,SAAA,CAEA,gCACC,kBAAA,CAIF,yBACC,aAAA\",\"sourcesContent\":[\"\\nfieldset {\\n\\tdisplay: flex;\\n\\tflex-direction: column;\\n\\tgap: 0.5rem;\\n\\n\\t:deep(label) {\\n\\t\\ttext-align: initial;\\n\\t}\\n}\\n\\n.update {\\n\\tmargin: 0 auto;\\n}\\n\"],\"sourceRoot\":\"\"}]);\n// Exports\nexport default ___CSS_LOADER_EXPORT___;\n","// Imports\nimport ___CSS_LOADER_API_SOURCEMAP_IMPORT___ from \"../../../../node_modules/css-loader/dist/runtime/sourceMaps.js\";\nimport ___CSS_LOADER_API_IMPORT___ from \"../../../../node_modules/css-loader/dist/runtime/api.js\";\nvar ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_SOURCEMAP_IMPORT___);\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, \".login-form[data-v-179b3658]{text-align:left;font-size:1rem}.login-form__fieldset[data-v-179b3658]{width:100%;display:flex;flex-direction:column;gap:.5rem}.login-form__link[data-v-179b3658]{display:block;font-weight:normal !important;padding-bottom:1rem;cursor:pointer;font-size:var(--default-font-size);text-align:center;padding:.5rem 1rem 1rem 1rem}\", \"\",{\"version\":3,\"sources\":[\"webpack://./core/src/components/login/ResetPassword.vue\"],\"names\":[],\"mappings\":\"AACA,6BACC,eAAA,CACA,cAAA,CAEA,uCACC,UAAA,CACA,YAAA,CACA,qBAAA,CACA,SAAA,CAGD,mCACC,aAAA,CACA,6BAAA,CACA,mBAAA,CACA,cAAA,CACA,kCAAA,CACA,iBAAA,CACA,4BAAA\",\"sourcesContent\":[\"\\n.login-form {\\n\\ttext-align: left;\\n\\tfont-size: 1rem;\\n\\n\\t&__fieldset {\\n\\t\\twidth: 100%;\\n\\t\\tdisplay: flex;\\n\\t\\tflex-direction: column;\\n\\t\\tgap: .5rem;\\n\\t}\\n\\n\\t&__link {\\n\\t\\tdisplay: block;\\n\\t\\tfont-weight: normal !important;\\n\\t\\tpadding-bottom: 1rem;\\n\\t\\tcursor: pointer;\\n\\t\\tfont-size: var(--default-font-size);\\n\\t\\ttext-align: center;\\n\\t\\tpadding: .5rem 1rem 1rem 1rem;\\n\\t}\\n}\\n\"],\"sourceRoot\":\"\"}]);\n// Exports\nexport default ___CSS_LOADER_EXPORT___;\n","// Imports\nimport ___CSS_LOADER_API_SOURCEMAP_IMPORT___ from \"../../../node_modules/css-loader/dist/runtime/sourceMaps.js\";\nimport ___CSS_LOADER_API_IMPORT___ from \"../../../node_modules/css-loader/dist/runtime/api.js\";\nvar ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_SOURCEMAP_IMPORT___);\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, \"body{font-size:var(--default-font-size)}.login-box{width:320px;box-sizing:border-box}.login-box__link{display:block;padding:1rem;font-size:var(--default-font-size);text-align:center;font-weight:normal !important}.fade-enter-active,.fade-leave-active{transition:opacity .3s}.fade-enter,.fade-leave-to{opacity:0}.alternative-logins{display:flex;flex-direction:column;gap:.75rem}.alternative-logins .button-vue{box-sizing:border-box}.login-passwordless .button-vue{margin-top:.5rem}\", \"\",{\"version\":3,\"sources\":[\"webpack://./core/src/views/Login.vue\"],\"names\":[],\"mappings\":\"AACA,KACC,kCAAA,CAGD,WAEC,WAAA,CACA,qBAAA,CAEA,iBACC,aAAA,CACA,YAAA,CACA,kCAAA,CACA,iBAAA,CACA,6BAAA,CAIF,sCACC,sBAAA,CAED,2BACC,SAAA,CAGD,oBACC,YAAA,CACA,qBAAA,CACA,UAAA,CAEA,gCACC,qBAAA,CAKD,gCACC,gBAAA\",\"sourcesContent\":[\"\\nbody {\\n\\tfont-size: var(--default-font-size);\\n}\\n\\n.login-box {\\n\\t// Same size as dashboard panels\\n\\twidth: 320px;\\n\\tbox-sizing: border-box;\\n\\n\\t&__link {\\n\\t\\tdisplay: block;\\n\\t\\tpadding: 1rem;\\n\\t\\tfont-size: var(--default-font-size);\\n\\t\\ttext-align: center;\\n\\t\\tfont-weight: normal !important;\\n\\t}\\n}\\n\\n.fade-enter-active, .fade-leave-active {\\n\\ttransition: opacity .3s;\\n}\\n.fade-enter, .fade-leave-to /* .fade-leave-active below version 2.1.8 */ {\\n\\topacity: 0;\\n}\\n\\n.alternative-logins {\\n\\tdisplay: flex;\\n\\tflex-direction: column;\\n\\tgap: 0.75rem;\\n\\n\\t.button-vue {\\n\\t\\tbox-sizing: border-box;\\n\\t}\\n}\\n\\n.login-passwordless {\\n\\t.button-vue {\\n\\t\\tmargin-top: 0.5rem;\\n\\t}\\n}\\n\"],\"sourceRoot\":\"\"}]);\n// Exports\nexport default ___CSS_LOADER_EXPORT___;\n","// Imports\nimport ___CSS_LOADER_API_SOURCEMAP_IMPORT___ from \"../../../../node_modules/css-loader/dist/runtime/sourceMaps.js\";\nimport ___CSS_LOADER_API_IMPORT___ from \"../../../../node_modules/css-loader/dist/runtime/api.js\";\nvar ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_SOURCEMAP_IMPORT___);\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, \"\\nfieldset[data-v-b9d4933a] {\\n\\ttext-align: center;\\n}\\ninput[type=submit][data-v-b9d4933a] {\\n\\tmargin-top: 20px;\\n}\\n\", \"\",{\"version\":3,\"sources\":[\"webpack://./core/src/components/login/UpdatePassword.vue\"],\"names\":[],\"mappings\":\";AA4IA;CACA,kBAAA;AACA;AAEA;CACA,gBAAA;AACA\",\"sourcesContent\":[\"\\n\\n\\n\\t\\n\\n\\n\\n\\n\\n\"],\"sourceRoot\":\"\"}]);\n// Exports\nexport default ___CSS_LOADER_EXPORT___;\n","/*\n * vim: expandtab shiftwidth=4 softtabstop=4\n */\n\n/* global dav */\nif (typeof dav === 'undefined') { dav = {}; };\n\ndav._XML_CHAR_MAP = {\n '<': '<',\n '>': '>',\n '&': '&',\n '\"': '"',\n \"'\": '''\n};\n\ndav._escapeXml = function(s) {\n return s.replace(/[<>&\"']/g, function (ch) {\n return dav._XML_CHAR_MAP[ch];\n });\n};\n\ndav.Client = function(options) {\n var i;\n for(i in options) {\n this[i] = options[i];\n }\n\n};\n\ndav.Client.prototype = {\n\n baseUrl : null,\n\n userName : null,\n\n password : null,\n\n\n xmlNamespaces : {\n 'DAV:' : 'd'\n },\n\n /**\n * Generates a propFind request.\n *\n * @param {string} url Url to do the propfind request on\n * @param {Array} properties List of properties to retrieve.\n * @param {string} depth \"0\", \"1\" or \"infinity\"\n * @param {Object} [headers] headers\n * @return {Promise}\n */\n propFind : function(url, properties, depth, headers) {\n\n if(typeof depth === \"undefined\") {\n depth = '0';\n }\n\n // depth header must be a string, in case a number was passed in\n depth = '' + depth;\n\n headers = headers || {};\n\n headers['Depth'] = depth;\n headers['Content-Type'] = 'application/xml; charset=utf-8';\n\n var body =\n '\\n' +\n '\\n' +\n ' \\n';\n\n for(var ii in properties) {\n if (!properties.hasOwnProperty(ii)) {\n continue;\n }\n\n var property = this.parseClarkNotation(properties[ii]);\n if (this.xmlNamespaces[property.namespace]) {\n body+=' <' + this.xmlNamespaces[property.namespace] + ':' + property.name + ' />\\n';\n } else {\n body+=' \\n';\n }\n\n }\n body+=' \\n';\n body+='';\n\n return this.request('PROPFIND', url, headers, body).then(\n function(result) {\n\n if (depth === '0') {\n return {\n status: result.status,\n body: result.body[0],\n xhr: result.xhr\n };\n } else {\n return {\n status: result.status,\n body: result.body,\n xhr: result.xhr\n };\n }\n\n }.bind(this)\n );\n\n },\n\n /**\n * Renders a \"d:set\" block for the given properties.\n *\n * @param {Object.} properties\n * @return {String} XML \"\" block\n */\n _renderPropSet: function(properties) {\n var body = ' \\n' +\n ' \\n';\n\n for(var ii in properties) {\n if (!properties.hasOwnProperty(ii)) {\n continue;\n }\n\n var property = this.parseClarkNotation(ii);\n var propName;\n var propValue = properties[ii];\n if (this.xmlNamespaces[property.namespace]) {\n propName = this.xmlNamespaces[property.namespace] + ':' + property.name;\n } else {\n propName = 'x:' + property.name + ' xmlns:x=\"' + property.namespace + '\"';\n }\n\n // FIXME: hard-coded for now until we allow properties to\n // specify whether to be escaped or not\n if (propName !== 'd:resourcetype') {\n propValue = dav._escapeXml(propValue);\n }\n body += ' <' + propName + '>' + propValue + '' + propName + '>\\n';\n }\n body +=' \\n';\n body +=' \\n';\n return body;\n },\n\n /**\n * Generates a propPatch request.\n *\n * @param {string} url Url to do the proppatch request on\n * @param {Object.} properties List of properties to store.\n * @param {Object} [headers] headers\n * @return {Promise}\n */\n propPatch : function(url, properties, headers) {\n headers = headers || {};\n\n headers['Content-Type'] = 'application/xml; charset=utf-8';\n\n var body =\n '\\n' +\n '\\n' + this._renderPropSet(properties);\n body += '';\n\n return this.request('PROPPATCH', url, headers, body).then(\n function(result) {\n return {\n status: result.status,\n body: result.body,\n xhr: result.xhr\n };\n }.bind(this)\n );\n\n },\n\n /**\n * Generates a MKCOL request.\n * If attributes are given, it will use an extended MKCOL request.\n *\n * @param {string} url Url to do the proppatch request on\n * @param {Object.} [properties] list of properties to store.\n * @param {Object} [headers] headers\n * @return {Promise}\n */\n mkcol : function(url, properties, headers) {\n var body = '';\n headers = headers || {};\n headers['Content-Type'] = 'application/xml; charset=utf-8';\n\n if (properties) {\n body =\n '\\n' +\n '\\n' + this._renderPropSet(properties);\n body +='';\n }\n\n return this.request('MKCOL', url, headers, body).then(\n function(result) {\n return {\n status: result.status,\n body: result.body,\n xhr: result.xhr\n };\n }.bind(this)\n );\n\n },\n\n /**\n * Performs a HTTP request, and returns a Promise\n *\n * @param {string} method HTTP method\n * @param {string} url Relative or absolute url\n * @param {Object} headers HTTP headers as an object.\n * @param {string} body HTTP request body.\n * @param {string} responseType HTTP request response type.\n * @param {Object} options\n * @param {Function} options.onProgress progress callback\n * @return {Promise}\n */\n request : function(method, url, headers, body, responseType, options) {\n\n var self = this;\n var xhr = this.xhrProvider();\n headers = headers || {};\n responseType = responseType || \"\";\n \n if (this.userName) {\n headers['Authorization'] = 'Basic ' + btoa(this.userName + ':' + this.password);\n // xhr.open(method, this.resolveUrl(url), true, this.userName, this.password);\n }\n xhr.open(method, this.resolveUrl(url), true);\n var ii;\n for(ii in headers) {\n xhr.setRequestHeader(ii, headers[ii]);\n }\n xhr.responseType = responseType;\n\n if (options && typeof(options.onProgress) === 'function') {\n if (method === 'PUT' || method === 'POST') {\n xhr.upload.addEventListener('progress', function (e) {\n options.onProgress(e)\n }, false)\n }\n else {\n xhr.addEventListener('progress', function (e) {\n options.onProgress(e)\n }, false)\n }\n }\n\n // Work around for edge\n if (body === undefined) {\n xhr.send();\n } else {\n xhr.send(body);\n }\n\n return new Promise(function(fulfill, reject) {\n\n xhr.onreadystatechange = function() {\n\n if (xhr.readyState !== 4) {\n return;\n }\n\n var resultBody = xhr.response;\n if (xhr.status === 207) {\n resultBody = self.parseMultiStatus(xhr.response);\n }\n\n fulfill({\n body: resultBody,\n status: xhr.status,\n xhr: xhr\n });\n\n };\n\n xhr.ontimeout = function() {\n\n reject(new Error('Timeout exceeded'));\n\n };\n\n });\n\n },\n\n /**\n * Returns an XMLHttpRequest object.\n *\n * This is in its own method, so it can be easily overridden.\n *\n * @return {XMLHttpRequest}\n */\n xhrProvider : function() {\n\n return new XMLHttpRequest();\n\n },\n\n /**\n * Parses a property node.\n *\n * Either returns a string if the node only contains text, or returns an\n * array of non-text subnodes.\n *\n * @param {Object} propNode node to parse\n * @return {string|Array} text content as string or array of subnodes, excluding text nodes\n */\n _parsePropNode: function(propNode) {\n var content = null;\n if (propNode.childNodes && propNode.childNodes.length > 0) {\n var subNodes = [];\n // filter out text nodes\n for (var j = 0; j < propNode.childNodes.length; j++) {\n var node = propNode.childNodes[j];\n if (node.nodeType === 1) {\n subNodes.push(node);\n }\n }\n if (subNodes.length) {\n content = subNodes;\n }\n }\n\n return content || propNode.textContent || propNode.text || '';\n },\n\n /**\n * Parses a multi-status response body.\n *\n * @param {string} xmlBody\n * @param {Array}\n */\n parseMultiStatus : function(xmlBody) {\n\n var parser = new DOMParser();\n var doc = parser.parseFromString(xmlBody, \"application/xml\");\n\n var resolver = function(foo) {\n var ii;\n for(ii in this.xmlNamespaces) {\n if (this.xmlNamespaces[ii] === foo) {\n return ii;\n }\n }\n }.bind(this);\n\n var responseIterator = doc.evaluate('/d:multistatus/d:response', doc, resolver, XPathResult.ANY_TYPE, null);\n\n var result = [];\n var responseNode = responseIterator.iterateNext();\n\n while(responseNode) {\n\n var response = {\n href : null,\n propStat : []\n };\n\n response.href = doc.evaluate('string(d:href)', responseNode, resolver, XPathResult.ANY_TYPE, null).stringValue;\n\n var propStatIterator = doc.evaluate('d:propstat', responseNode, resolver, XPathResult.ANY_TYPE, null);\n var propStatNode = propStatIterator.iterateNext();\n\n while(propStatNode) {\n var propStat = {\n status : doc.evaluate('string(d:status)', propStatNode, resolver, XPathResult.ANY_TYPE, null).stringValue,\n properties : {},\n };\n\n var propIterator = doc.evaluate('d:prop/*', propStatNode, resolver, XPathResult.ANY_TYPE, null);\n\n var propNode = propIterator.iterateNext();\n while(propNode) {\n var content = this._parsePropNode(propNode);\n propStat.properties['{' + propNode.namespaceURI + '}' + propNode.localName] = content;\n propNode = propIterator.iterateNext();\n\n }\n response.propStat.push(propStat);\n propStatNode = propStatIterator.iterateNext();\n\n\n }\n\n result.push(response);\n responseNode = responseIterator.iterateNext();\n\n }\n\n return result;\n\n },\n\n /**\n * Takes a relative url, and maps it to an absolute url, using the baseUrl\n *\n * @param {string} url\n * @return {string}\n */\n resolveUrl : function(url) {\n\n // Note: this is rudamentary.. not sure yet if it handles every case.\n if (/^https?:\\/\\//i.test(url)) {\n // absolute\n return url;\n }\n\n var baseParts = this.parseUrl(this.baseUrl);\n if (url.charAt('/')) {\n // Url starts with a slash\n return baseParts.root + url;\n }\n\n // Url does not start with a slash, we need grab the base url right up until the last slash.\n var newUrl = baseParts.root + '/';\n if (baseParts.path.lastIndexOf('/')!==-1) {\n newUrl = newUrl = baseParts.path.subString(0, baseParts.path.lastIndexOf('/')) + '/';\n }\n newUrl+=url;\n return url;\n\n },\n\n /**\n * Parses a url and returns its individual components.\n *\n * @param {String} url\n * @return {Object}\n */\n parseUrl : function(url) {\n\n var parts = url.match(/^(?:([A-Za-z]+):)?(\\/{0,3})([0-9.\\-A-Za-z]+)(?::(\\d+))?(?:\\/([^?#]*))?(?:\\?([^#]*))?(?:#(.*))?$/);\n var result = {\n url : parts[0],\n scheme : parts[1],\n host : parts[3],\n port : parts[4],\n path : parts[5],\n query : parts[6],\n fragment : parts[7],\n };\n result.root =\n result.scheme + '://' +\n result.host +\n (result.port ? ':' + result.port : '');\n\n return result;\n\n },\n\n parseClarkNotation : function(propertyName) {\n\n var result = propertyName.match(/^{([^}]+)}(.*)$/);\n if (!result) {\n return;\n }\n\n return {\n name : result[2],\n namespace : result[1]\n };\n\n }\n\n};\n\nif (typeof module !== 'undefined' && typeof module.exports !== 'undefined') {\n module.exports.Client = dav.Client;\n}\n","var map = {\n\t\"./af\": 42786,\n\t\"./af.js\": 42786,\n\t\"./ar\": 30867,\n\t\"./ar-dz\": 14130,\n\t\"./ar-dz.js\": 14130,\n\t\"./ar-kw\": 96135,\n\t\"./ar-kw.js\": 96135,\n\t\"./ar-ly\": 56440,\n\t\"./ar-ly.js\": 56440,\n\t\"./ar-ma\": 47702,\n\t\"./ar-ma.js\": 47702,\n\t\"./ar-sa\": 16040,\n\t\"./ar-sa.js\": 16040,\n\t\"./ar-tn\": 37100,\n\t\"./ar-tn.js\": 37100,\n\t\"./ar.js\": 30867,\n\t\"./az\": 31083,\n\t\"./az.js\": 31083,\n\t\"./be\": 9808,\n\t\"./be.js\": 9808,\n\t\"./bg\": 68338,\n\t\"./bg.js\": 68338,\n\t\"./bm\": 67438,\n\t\"./bm.js\": 67438,\n\t\"./bn\": 8905,\n\t\"./bn-bd\": 76225,\n\t\"./bn-bd.js\": 76225,\n\t\"./bn.js\": 8905,\n\t\"./bo\": 11560,\n\t\"./bo.js\": 11560,\n\t\"./br\": 1278,\n\t\"./br.js\": 1278,\n\t\"./bs\": 80622,\n\t\"./bs.js\": 80622,\n\t\"./ca\": 2468,\n\t\"./ca.js\": 2468,\n\t\"./cs\": 5822,\n\t\"./cs.js\": 5822,\n\t\"./cv\": 50877,\n\t\"./cv.js\": 50877,\n\t\"./cy\": 47373,\n\t\"./cy.js\": 47373,\n\t\"./da\": 24780,\n\t\"./da.js\": 24780,\n\t\"./de\": 59740,\n\t\"./de-at\": 60217,\n\t\"./de-at.js\": 60217,\n\t\"./de-ch\": 60894,\n\t\"./de-ch.js\": 60894,\n\t\"./de.js\": 59740,\n\t\"./dv\": 5300,\n\t\"./dv.js\": 5300,\n\t\"./el\": 50837,\n\t\"./el.js\": 50837,\n\t\"./en-au\": 78348,\n\t\"./en-au.js\": 78348,\n\t\"./en-ca\": 77925,\n\t\"./en-ca.js\": 77925,\n\t\"./en-gb\": 22243,\n\t\"./en-gb.js\": 22243,\n\t\"./en-ie\": 46436,\n\t\"./en-ie.js\": 46436,\n\t\"./en-il\": 47207,\n\t\"./en-il.js\": 47207,\n\t\"./en-in\": 44175,\n\t\"./en-in.js\": 44175,\n\t\"./en-nz\": 76319,\n\t\"./en-nz.js\": 76319,\n\t\"./en-sg\": 31662,\n\t\"./en-sg.js\": 31662,\n\t\"./eo\": 92915,\n\t\"./eo.js\": 92915,\n\t\"./es\": 55655,\n\t\"./es-do\": 55251,\n\t\"./es-do.js\": 55251,\n\t\"./es-mx\": 96112,\n\t\"./es-mx.js\": 96112,\n\t\"./es-us\": 71146,\n\t\"./es-us.js\": 71146,\n\t\"./es.js\": 55655,\n\t\"./et\": 5603,\n\t\"./et.js\": 5603,\n\t\"./eu\": 77763,\n\t\"./eu.js\": 77763,\n\t\"./fa\": 76959,\n\t\"./fa.js\": 76959,\n\t\"./fi\": 11897,\n\t\"./fi.js\": 11897,\n\t\"./fil\": 42549,\n\t\"./fil.js\": 42549,\n\t\"./fo\": 94694,\n\t\"./fo.js\": 94694,\n\t\"./fr\": 94470,\n\t\"./fr-ca\": 63049,\n\t\"./fr-ca.js\": 63049,\n\t\"./fr-ch\": 52330,\n\t\"./fr-ch.js\": 52330,\n\t\"./fr.js\": 94470,\n\t\"./fy\": 5044,\n\t\"./fy.js\": 5044,\n\t\"./ga\": 29295,\n\t\"./ga.js\": 29295,\n\t\"./gd\": 2101,\n\t\"./gd.js\": 2101,\n\t\"./gl\": 38794,\n\t\"./gl.js\": 38794,\n\t\"./gom-deva\": 27884,\n\t\"./gom-deva.js\": 27884,\n\t\"./gom-latn\": 23168,\n\t\"./gom-latn.js\": 23168,\n\t\"./gu\": 95349,\n\t\"./gu.js\": 95349,\n\t\"./he\": 24206,\n\t\"./he.js\": 24206,\n\t\"./hi\": 30094,\n\t\"./hi.js\": 30094,\n\t\"./hr\": 30316,\n\t\"./hr.js\": 30316,\n\t\"./hu\": 22138,\n\t\"./hu.js\": 22138,\n\t\"./hy-am\": 11423,\n\t\"./hy-am.js\": 11423,\n\t\"./id\": 29218,\n\t\"./id.js\": 29218,\n\t\"./is\": 90135,\n\t\"./is.js\": 90135,\n\t\"./it\": 90626,\n\t\"./it-ch\": 10150,\n\t\"./it-ch.js\": 10150,\n\t\"./it.js\": 90626,\n\t\"./ja\": 39183,\n\t\"./ja.js\": 39183,\n\t\"./jv\": 24286,\n\t\"./jv.js\": 24286,\n\t\"./ka\": 12105,\n\t\"./ka.js\": 12105,\n\t\"./kk\": 47772,\n\t\"./kk.js\": 47772,\n\t\"./km\": 18758,\n\t\"./km.js\": 18758,\n\t\"./kn\": 79282,\n\t\"./kn.js\": 79282,\n\t\"./ko\": 33730,\n\t\"./ko.js\": 33730,\n\t\"./ku\": 1408,\n\t\"./ku.js\": 1408,\n\t\"./ky\": 33291,\n\t\"./ky.js\": 33291,\n\t\"./lb\": 36841,\n\t\"./lb.js\": 36841,\n\t\"./lo\": 55466,\n\t\"./lo.js\": 55466,\n\t\"./lt\": 57010,\n\t\"./lt.js\": 57010,\n\t\"./lv\": 37595,\n\t\"./lv.js\": 37595,\n\t\"./me\": 39861,\n\t\"./me.js\": 39861,\n\t\"./mi\": 35493,\n\t\"./mi.js\": 35493,\n\t\"./mk\": 95966,\n\t\"./mk.js\": 95966,\n\t\"./ml\": 87341,\n\t\"./ml.js\": 87341,\n\t\"./mn\": 5115,\n\t\"./mn.js\": 5115,\n\t\"./mr\": 10370,\n\t\"./mr.js\": 10370,\n\t\"./ms\": 9847,\n\t\"./ms-my\": 41237,\n\t\"./ms-my.js\": 41237,\n\t\"./ms.js\": 9847,\n\t\"./mt\": 72126,\n\t\"./mt.js\": 72126,\n\t\"./my\": 56165,\n\t\"./my.js\": 56165,\n\t\"./nb\": 64924,\n\t\"./nb.js\": 64924,\n\t\"./ne\": 16744,\n\t\"./ne.js\": 16744,\n\t\"./nl\": 93901,\n\t\"./nl-be\": 59814,\n\t\"./nl-be.js\": 59814,\n\t\"./nl.js\": 93901,\n\t\"./nn\": 83877,\n\t\"./nn.js\": 83877,\n\t\"./oc-lnc\": 92135,\n\t\"./oc-lnc.js\": 92135,\n\t\"./pa-in\": 15858,\n\t\"./pa-in.js\": 15858,\n\t\"./pl\": 64495,\n\t\"./pl.js\": 64495,\n\t\"./pt\": 89520,\n\t\"./pt-br\": 57971,\n\t\"./pt-br.js\": 57971,\n\t\"./pt.js\": 89520,\n\t\"./ro\": 96459,\n\t\"./ro.js\": 96459,\n\t\"./ru\": 21793,\n\t\"./ru.js\": 21793,\n\t\"./sd\": 40950,\n\t\"./sd.js\": 40950,\n\t\"./se\": 10490,\n\t\"./se.js\": 10490,\n\t\"./si\": 90124,\n\t\"./si.js\": 90124,\n\t\"./sk\": 64249,\n\t\"./sk.js\": 64249,\n\t\"./sl\": 14985,\n\t\"./sl.js\": 14985,\n\t\"./sq\": 51104,\n\t\"./sq.js\": 51104,\n\t\"./sr\": 49131,\n\t\"./sr-cyrl\": 79915,\n\t\"./sr-cyrl.js\": 79915,\n\t\"./sr.js\": 49131,\n\t\"./ss\": 85893,\n\t\"./ss.js\": 85893,\n\t\"./sv\": 98760,\n\t\"./sv.js\": 98760,\n\t\"./sw\": 91172,\n\t\"./sw.js\": 91172,\n\t\"./ta\": 27333,\n\t\"./ta.js\": 27333,\n\t\"./te\": 23110,\n\t\"./te.js\": 23110,\n\t\"./tet\": 52095,\n\t\"./tet.js\": 52095,\n\t\"./tg\": 27321,\n\t\"./tg.js\": 27321,\n\t\"./th\": 9041,\n\t\"./th.js\": 9041,\n\t\"./tk\": 19005,\n\t\"./tk.js\": 19005,\n\t\"./tl-ph\": 75768,\n\t\"./tl-ph.js\": 75768,\n\t\"./tlh\": 89444,\n\t\"./tlh.js\": 89444,\n\t\"./tr\": 72397,\n\t\"./tr.js\": 72397,\n\t\"./tzl\": 28254,\n\t\"./tzl.js\": 28254,\n\t\"./tzm\": 51106,\n\t\"./tzm-latn\": 30699,\n\t\"./tzm-latn.js\": 30699,\n\t\"./tzm.js\": 51106,\n\t\"./ug-cn\": 9288,\n\t\"./ug-cn.js\": 9288,\n\t\"./uk\": 67691,\n\t\"./uk.js\": 67691,\n\t\"./ur\": 13795,\n\t\"./ur.js\": 13795,\n\t\"./uz\": 6791,\n\t\"./uz-latn\": 60588,\n\t\"./uz-latn.js\": 60588,\n\t\"./uz.js\": 6791,\n\t\"./vi\": 65666,\n\t\"./vi.js\": 65666,\n\t\"./x-pseudo\": 14378,\n\t\"./x-pseudo.js\": 14378,\n\t\"./yo\": 75805,\n\t\"./yo.js\": 75805,\n\t\"./zh-cn\": 83839,\n\t\"./zh-cn.js\": 83839,\n\t\"./zh-hk\": 55726,\n\t\"./zh-hk.js\": 55726,\n\t\"./zh-mo\": 99807,\n\t\"./zh-mo.js\": 99807,\n\t\"./zh-tw\": 74152,\n\t\"./zh-tw.js\": 74152\n};\n\n\nfunction webpackContext(req) {\n\tvar id = webpackContextResolve(req);\n\treturn __webpack_require__(id);\n}\nfunction webpackContextResolve(req) {\n\tif(!__webpack_require__.o(map, req)) {\n\t\tvar e = new Error(\"Cannot find module '\" + req + \"'\");\n\t\te.code = 'MODULE_NOT_FOUND';\n\t\tthrow e;\n\t}\n\treturn map[req];\n}\nwebpackContext.keys = function webpackContextKeys() {\n\treturn Object.keys(map);\n};\nwebpackContext.resolve = webpackContextResolve;\nmodule.exports = webpackContext;\nwebpackContext.id = 46700;","import { getCurrentUser as A, getRequestToken as ue } from \"@nextcloud/auth\";\nimport { getLoggerBuilder as q } from \"@nextcloud/logger\";\nimport { getCanonicalLocale as de } from \"@nextcloud/l10n\";\nimport { join as ae, basename as le, extname as fe, dirname as I } from \"path\";\nimport { encodePath as ce } from \"@nextcloud/paths\";\nimport { generateRemoteUrl as he } from \"@nextcloud/router\";\nimport { createClient as pe, getPatcher as ge } from \"webdav\";\nimport { request as we } from \"webdav/dist/node/request.js\";\n/**\n * @copyright 2019 Christoph Wurst \n *\n * @author Christoph Wurst \n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n */\nconst me = (e) => e === null ? q().setApp(\"files\").build() : q().setApp(\"files\").setUid(e.uid).build(), m = me(A());\n/**\n * @copyright Copyright (c) 2021 John Molakvoæ \n *\n * @author John Molakvoæ \n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n */\nclass Ne {\n _entries = [];\n registerEntry(t) {\n this.validateEntry(t), this._entries.push(t);\n }\n unregisterEntry(t) {\n const r = typeof t == \"string\" ? this.getEntryIndex(t) : this.getEntryIndex(t.id);\n if (r === -1) {\n m.warn(\"Entry not found, nothing removed\", { entry: t, entries: this.getEntries() });\n return;\n }\n this._entries.splice(r, 1);\n }\n /**\n * Get the list of registered entries\n *\n * @param {Folder} context the creation context. Usually the current folder\n */\n getEntries(t) {\n return t ? this._entries.filter((r) => typeof r.enabled == \"function\" ? r.enabled(t) : !0) : this._entries;\n }\n getEntryIndex(t) {\n return this._entries.findIndex((r) => r.id === t);\n }\n validateEntry(t) {\n if (!t.id || !t.displayName || !(t.iconSvgInline || t.iconClass) || !t.handler)\n throw new Error(\"Invalid entry\");\n if (typeof t.id != \"string\" || typeof t.displayName != \"string\")\n throw new Error(\"Invalid id or displayName property\");\n if (t.iconClass && typeof t.iconClass != \"string\" || t.iconSvgInline && typeof t.iconSvgInline != \"string\")\n throw new Error(\"Invalid icon provided\");\n if (t.enabled !== void 0 && typeof t.enabled != \"function\")\n throw new Error(\"Invalid enabled property\");\n if (typeof t.handler != \"function\")\n throw new Error(\"Invalid handler property\");\n if (\"order\" in t && typeof t.order != \"number\")\n throw new Error(\"Invalid order property\");\n if (this.getEntryIndex(t.id) !== -1)\n throw new Error(\"Duplicate entry\");\n }\n}\nconst F = function() {\n return typeof window._nc_newfilemenu > \"u\" && (window._nc_newfilemenu = new Ne(), m.debug(\"NewFileMenu initialized\")), window._nc_newfilemenu;\n};\n/**\n * @copyright 2019 Christoph Wurst \n *\n * @author Christoph Wurst \n * @author John Molakvoæ \n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n */\nconst C = [\"B\", \"KB\", \"MB\", \"GB\", \"TB\", \"PB\"], P = [\"B\", \"KiB\", \"MiB\", \"GiB\", \"TiB\", \"PiB\"];\nfunction Jt(e, t = !1, r = !0) {\n typeof e == \"string\" && (e = Number(e));\n let s = e > 0 ? Math.floor(Math.log(e) / Math.log(r ? 1024 : 1e3)) : 0;\n s = Math.min((r ? P.length : C.length) - 1, s);\n const n = r ? P[s] : C[s];\n let i = (e / Math.pow(r ? 1024 : 1e3, s)).toFixed(1);\n return t === !0 && s === 0 ? (i !== \"0.0\" ? \"< 1 \" : \"0 \") + (r ? P[1] : C[1]) : (s < 2 ? i = parseFloat(i).toFixed(0) : i = parseFloat(i).toLocaleString(de()), i + \" \" + n);\n}\nfunction Qt(e, t = !1) {\n try {\n e = `${e}`.toLocaleLowerCase().replaceAll(/\\s+/g, \"\").replaceAll(\",\", \".\");\n } catch {\n return null;\n }\n const r = e.match(/^([0-9]*(\\.[0-9]*)?)([kmgtp]?)(i?)b?$/);\n if (r === null || r[1] === \".\" || r[1] === \"\")\n return null;\n const s = {\n \"\": 0,\n k: 1,\n m: 2,\n g: 3,\n t: 4,\n p: 5,\n e: 6\n }, n = `${r[1]}`, i = r[4] === \"i\" || t ? 1024 : 1e3;\n return Math.round(Number.parseFloat(n) * i ** s[r[3]]);\n}\n/**\n * @copyright Copyright (c) 2023 John Molakvoæ \n *\n * @author John Molakvoæ \n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n */\nvar Z = /* @__PURE__ */ ((e) => (e.DEFAULT = \"default\", e.HIDDEN = \"hidden\", e))(Z || {});\nclass Dt {\n _action;\n constructor(t) {\n this.validateAction(t), this._action = t;\n }\n get id() {\n return this._action.id;\n }\n get displayName() {\n return this._action.displayName;\n }\n get title() {\n return this._action.title;\n }\n get iconSvgInline() {\n return this._action.iconSvgInline;\n }\n get enabled() {\n return this._action.enabled;\n }\n get exec() {\n return this._action.exec;\n }\n get execBatch() {\n return this._action.execBatch;\n }\n get order() {\n return this._action.order;\n }\n get default() {\n return this._action.default;\n }\n get inline() {\n return this._action.inline;\n }\n get renderInline() {\n return this._action.renderInline;\n }\n validateAction(t) {\n if (!t.id || typeof t.id != \"string\")\n throw new Error(\"Invalid id\");\n if (!t.displayName || typeof t.displayName != \"function\")\n throw new Error(\"Invalid displayName function\");\n if (\"title\" in t && typeof t.title != \"function\")\n throw new Error(\"Invalid title function\");\n if (!t.iconSvgInline || typeof t.iconSvgInline != \"function\")\n throw new Error(\"Invalid iconSvgInline function\");\n if (!t.exec || typeof t.exec != \"function\")\n throw new Error(\"Invalid exec function\");\n if (\"enabled\" in t && typeof t.enabled != \"function\")\n throw new Error(\"Invalid enabled function\");\n if (\"execBatch\" in t && typeof t.execBatch != \"function\")\n throw new Error(\"Invalid execBatch function\");\n if (\"order\" in t && typeof t.order != \"number\")\n throw new Error(\"Invalid order\");\n if (t.default && !Object.values(Z).includes(t.default))\n throw new Error(\"Invalid default\");\n if (\"inline\" in t && typeof t.inline != \"function\")\n throw new Error(\"Invalid inline function\");\n if (\"renderInline\" in t && typeof t.renderInline != \"function\")\n throw new Error(\"Invalid renderInline function\");\n }\n}\nconst er = function(e) {\n if (typeof window._nc_fileactions > \"u\" && (window._nc_fileactions = [], m.debug(\"FileActions initialized\")), window._nc_fileactions.find((t) => t.id === e.id)) {\n m.error(`FileAction ${e.id} already registered`, { action: e });\n return;\n }\n window._nc_fileactions.push(e);\n}, tr = function() {\n return typeof window._nc_fileactions > \"u\" && (window._nc_fileactions = [], m.debug(\"FileActions initialized\")), window._nc_fileactions;\n};\n/**\n * @copyright Copyright (c) 2023 John Molakvoæ \n *\n * @author John Molakvoæ \n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n */\nclass rr {\n _header;\n constructor(t) {\n this.validateHeader(t), this._header = t;\n }\n get id() {\n return this._header.id;\n }\n get order() {\n return this._header.order;\n }\n get enabled() {\n return this._header.enabled;\n }\n get render() {\n return this._header.render;\n }\n get updated() {\n return this._header.updated;\n }\n validateHeader(t) {\n if (!t.id || !t.render || !t.updated)\n throw new Error(\"Invalid header: id, render and updated are required\");\n if (typeof t.id != \"string\")\n throw new Error(\"Invalid id property\");\n if (t.enabled !== void 0 && typeof t.enabled != \"function\")\n throw new Error(\"Invalid enabled property\");\n if (t.render && typeof t.render != \"function\")\n throw new Error(\"Invalid render property\");\n if (t.updated && typeof t.updated != \"function\")\n throw new Error(\"Invalid updated property\");\n }\n}\nconst nr = function(e) {\n if (typeof window._nc_filelistheader > \"u\" && (window._nc_filelistheader = [], m.debug(\"FileListHeaders initialized\")), window._nc_filelistheader.find((t) => t.id === e.id)) {\n m.error(`Header ${e.id} already registered`, { header: e });\n return;\n }\n window._nc_filelistheader.push(e);\n}, ir = function() {\n return typeof window._nc_filelistheader > \"u\" && (window._nc_filelistheader = [], m.debug(\"FileListHeaders initialized\")), window._nc_filelistheader;\n};\n/**\n * @copyright Copyright (c) 2022 John Molakvoæ \n *\n * @author John Molakvoæ \n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n */\nvar N = /* @__PURE__ */ ((e) => (e[e.NONE = 0] = \"NONE\", e[e.CREATE = 4] = \"CREATE\", e[e.READ = 1] = \"READ\", e[e.UPDATE = 2] = \"UPDATE\", e[e.DELETE = 8] = \"DELETE\", e[e.SHARE = 16] = \"SHARE\", e[e.ALL = 31] = \"ALL\", e))(N || {});\n/**\n * @copyright Copyright (c) 2023 John Molakvoæ \n *\n * @author John Molakvoæ \n * @author Ferdinand Thiessen \n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n */\nconst j = [\n \"d:getcontentlength\",\n \"d:getcontenttype\",\n \"d:getetag\",\n \"d:getlastmodified\",\n \"d:quota-available-bytes\",\n \"d:resourcetype\",\n \"nc:has-preview\",\n \"nc:is-encrypted\",\n \"nc:mount-type\",\n \"nc:share-attributes\",\n \"oc:comments-unread\",\n \"oc:favorite\",\n \"oc:fileid\",\n \"oc:owner-display-name\",\n \"oc:owner-id\",\n \"oc:permissions\",\n \"oc:share-types\",\n \"oc:size\",\n \"ocs:share-permissions\"\n], Y = {\n d: \"DAV:\",\n nc: \"http://nextcloud.org/ns\",\n oc: \"http://owncloud.org/ns\",\n ocs: \"http://open-collaboration-services.org/ns\"\n}, sr = function(e, t = { nc: \"http://nextcloud.org/ns\" }) {\n typeof window._nc_dav_properties > \"u\" && (window._nc_dav_properties = [...j], window._nc_dav_namespaces = { ...Y });\n const r = { ...window._nc_dav_namespaces, ...t };\n if (window._nc_dav_properties.find((n) => n === e))\n return m.error(`${e} already registered`, { prop: e }), !1;\n if (e.startsWith(\"<\") || e.split(\":\").length !== 2)\n return m.error(`${e} is not valid. See example: 'oc:fileid'`, { prop: e }), !1;\n const s = e.split(\":\")[0];\n return r[s] ? (window._nc_dav_properties.push(e), window._nc_dav_namespaces = r, !0) : (m.error(`${e} namespace unknown`, { prop: e, namespaces: r }), !1);\n}, V = function() {\n return typeof window._nc_dav_properties > \"u\" && (window._nc_dav_properties = [...j]), window._nc_dav_properties.map((e) => `<${e} />`).join(\" \");\n}, L = function() {\n return typeof window._nc_dav_namespaces > \"u\" && (window._nc_dav_namespaces = { ...Y }), Object.keys(window._nc_dav_namespaces).map((e) => `xmlns:${e}=\"${window._nc_dav_namespaces?.[e]}\"`).join(\" \");\n}, or = function() {\n return `\n\t\t\n\t\t\t\n\t\t\t\t${V()}\n\t\t\t\n\t\t`;\n}, Ee = function() {\n return `\n\t\t\n\t\t\t\n\t\t\t\t${V()}\n\t\t\t\n\t\t\t\n\t\t\t\t1\n\t\t\t\n\t\t`;\n}, ur = function(e) {\n return `\n\n\t\n\t\t\n\t\t\t\n\t\t\t\t${V()}\n\t\t\t\n\t\t\n\t\t\n\t\t\t\n\t\t\t\t/files/${A()?.uid}/\n\t\t\t\tinfinity\n\t\t\t\n\t\t\n\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\n\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\thttpd/unix-directory\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t0\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t${e}\n\t\t\t\t\n\t\t\t\n\t\t\n\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\n\t\t\n\t\t\t100\n\t\t\t0\n\t\t\n\t\n`;\n};\n/**\n * @copyright Copyright (c) 2023 John Molakvoæ \n *\n * @author John Molakvoæ \n * @author Ferdinand Thiessen \n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n */\nconst be = function(e = \"\") {\n let t = N.NONE;\n return e && ((e.includes(\"C\") || e.includes(\"K\")) && (t |= N.CREATE), e.includes(\"G\") && (t |= N.READ), (e.includes(\"W\") || e.includes(\"N\") || e.includes(\"V\")) && (t |= N.UPDATE), e.includes(\"D\") && (t |= N.DELETE), e.includes(\"R\") && (t |= N.SHARE)), t;\n};\n/**\n * @copyright Copyright (c) 2022 John Molakvoæ \n *\n * @author John Molakvoæ \n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n */\nvar S = /* @__PURE__ */ ((e) => (e.Folder = \"folder\", e.File = \"file\", e))(S || {});\n/**\n * @copyright Copyright (c) 2022 John Molakvoæ \n *\n * @author John Molakvoæ \n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n */\nconst J = function(e, t) {\n return e.match(t) !== null;\n}, X = (e, t) => {\n if (e.id && typeof e.id != \"number\")\n throw new Error(\"Invalid id type of value\");\n if (!e.source)\n throw new Error(\"Missing mandatory source\");\n try {\n new URL(e.source);\n } catch {\n throw new Error(\"Invalid source format, source must be a valid URL\");\n }\n if (!e.source.startsWith(\"http\"))\n throw new Error(\"Invalid source format, only http(s) is supported\");\n if (e.mtime && !(e.mtime instanceof Date))\n throw new Error(\"Invalid mtime type\");\n if (e.crtime && !(e.crtime instanceof Date))\n throw new Error(\"Invalid crtime type\");\n if (!e.mime || typeof e.mime != \"string\" || !e.mime.match(/^[-\\w.]+\\/[-+\\w.]+$/gi))\n throw new Error(\"Missing or invalid mandatory mime\");\n if (\"size\" in e && typeof e.size != \"number\" && e.size !== void 0)\n throw new Error(\"Invalid size type\");\n if (\"permissions\" in e && e.permissions !== void 0 && !(typeof e.permissions == \"number\" && e.permissions >= N.NONE && e.permissions <= N.ALL))\n throw new Error(\"Invalid permissions\");\n if (e.owner && e.owner !== null && typeof e.owner != \"string\")\n throw new Error(\"Invalid owner type\");\n if (e.attributes && typeof e.attributes != \"object\")\n throw new Error(\"Invalid attributes type\");\n if (e.root && typeof e.root != \"string\")\n throw new Error(\"Invalid root type\");\n if (e.root && !e.root.startsWith(\"/\"))\n throw new Error(\"Root must start with a leading slash\");\n if (e.root && !e.source.includes(e.root))\n throw new Error(\"Root must be part of the source\");\n if (e.root && J(e.source, t)) {\n const r = e.source.match(t)[0];\n if (!e.source.includes(ae(r, e.root)))\n throw new Error(\"The root must be relative to the service. e.g /files/emma\");\n }\n if (e.status && !Object.values(Q).includes(e.status))\n throw new Error(\"Status must be a valid NodeStatus\");\n};\n/**\n * @copyright Copyright (c) 2022 John Molakvoæ \n *\n * @author John Molakvoæ \n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n */\nvar Q = /* @__PURE__ */ ((e) => (e.NEW = \"new\", e.FAILED = \"failed\", e.LOADING = \"loading\", e.LOCKED = \"locked\", e))(Q || {});\nclass D {\n _data;\n _attributes;\n _knownDavService = /(remote|public)\\.php\\/(web)?dav/i;\n constructor(t, r) {\n X(t, r || this._knownDavService), this._data = t;\n const s = {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n set: (n, i, d) => (this.updateMtime(), Reflect.set(n, i, d)),\n deleteProperty: (n, i) => (this.updateMtime(), Reflect.deleteProperty(n, i))\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n };\n this._attributes = new Proxy(t.attributes || {}, s), delete this._data.attributes, r && (this._knownDavService = r);\n }\n /**\n * Get the source url to this object\n */\n get source() {\n return this._data.source.replace(/\\/$/i, \"\");\n }\n /**\n * Get the encoded source url to this object for requests purposes\n */\n get encodedSource() {\n const { origin: t } = new URL(this.source);\n return t + ce(this.source.slice(t.length));\n }\n /**\n * Get this object name\n */\n get basename() {\n return le(this.source);\n }\n /**\n * Get this object's extension\n */\n get extension() {\n return fe(this.source);\n }\n /**\n * Get the directory path leading to this object\n * Will use the relative path to root if available\n */\n get dirname() {\n if (this.root) {\n const r = this.source.indexOf(this.root);\n return I(this.source.slice(r + this.root.length) || \"/\");\n }\n const t = new URL(this.source);\n return I(t.pathname);\n }\n /**\n * Get the file mime\n */\n get mime() {\n return this._data.mime;\n }\n /**\n * Get the file modification time\n */\n get mtime() {\n return this._data.mtime;\n }\n /**\n * Get the file creation time\n */\n get crtime() {\n return this._data.crtime;\n }\n /**\n * Get the file size\n */\n get size() {\n return this._data.size;\n }\n /**\n * Get the file attribute\n */\n get attributes() {\n return this._attributes;\n }\n /**\n * Get the file permissions\n */\n get permissions() {\n return this.owner === null && !this.isDavRessource ? N.READ : this._data.permissions !== void 0 ? this._data.permissions : N.NONE;\n }\n /**\n * Get the file owner\n */\n get owner() {\n return this.isDavRessource ? this._data.owner : null;\n }\n /**\n * Is this a dav-related ressource ?\n */\n get isDavRessource() {\n return J(this.source, this._knownDavService);\n }\n /**\n * Get the dav root of this object\n */\n get root() {\n return this._data.root ? this._data.root.replace(/^(.+)\\/$/, \"$1\") : this.isDavRessource && I(this.source).split(this._knownDavService).pop() || null;\n }\n /**\n * Get the absolute path of this object relative to the root\n */\n get path() {\n if (this.root) {\n const t = this.source.indexOf(this.root);\n return this.source.slice(t + this.root.length) || \"/\";\n }\n return (this.dirname + \"/\" + this.basename).replace(/\\/\\//g, \"/\");\n }\n /**\n * Get the node id if defined.\n * Will look for the fileid in attributes if undefined.\n */\n get fileid() {\n return this._data?.id || this.attributes?.fileid;\n }\n /**\n * Get the node status.\n */\n get status() {\n return this._data?.status;\n }\n /**\n * Set the node status.\n */\n set status(t) {\n this._data.status = t;\n }\n /**\n * Move the node to a new destination\n *\n * @param {string} destination the new source.\n * e.g. https://cloud.domain.com/remote.php/dav/files/emma/Photos/picture.jpg\n */\n move(t) {\n X({ ...this._data, source: t }, this._knownDavService), this._data.source = t, this.updateMtime();\n }\n /**\n * Rename the node\n * This aliases the move method for easier usage\n *\n * @param basename The new name of the node\n */\n rename(t) {\n if (t.includes(\"/\"))\n throw new Error(\"Invalid basename\");\n this.move(I(this.source) + \"/\" + t);\n }\n /**\n * Update the mtime if exists.\n */\n updateMtime() {\n this._data.mtime && (this._data.mtime = /* @__PURE__ */ new Date());\n }\n}\n/**\n * @copyright Copyright (c) 2022 John Molakvoæ \n *\n * @author John Molakvoæ \n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n */\nclass ye extends D {\n get type() {\n return S.File;\n }\n}\n/**\n * @copyright Copyright (c) 2022 John Molakvoæ \n *\n * @author John Molakvoæ \n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see