{"version":3,"file":"url.min.js","sources":["https:\/\/immet-dist.spbstu.ru\/lib\/amd\/src\/url.js"],"sourcesContent":["\/\/ This file is part of Moodle - http:\/\/moodle.org\/\n\/\/\n\/\/ Moodle is free software: you can redistribute it and\/or modify\n\/\/ it under the terms of the GNU General Public License as published by\n\/\/ the Free Software Foundation, either version 3 of the License, or\n\/\/ (at your option) any later version.\n\/\/\n\/\/ Moodle 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 General Public License for more details.\n\/\/\n\/\/ You should have received a copy of the GNU General Public License\n\/\/ along with Moodle.  If not, see .\n\n\/**\n * URL utility functions.\n *\n * @module     core\/url\n * @copyright  2015 Damyon Wiese \n * @license    http:\/\/www.gnu.org\/copyleft\/gpl.html GNU GPL v3 or later\n * @since      2.9\n *\/\ndefine(['jquery', 'core\/config'], function($, config) {\n\n\n    return \/** @alias module:core\/url *\/ {\n        \/\/ Public variables and functions.\n        \/**\n         * Construct a file url\n         *\n         * @method fileUrl\n         * @param {string} relativeScript\n         * @param {string} slashArg\n         * @return {string}\n         *\/\n        fileUrl: function(relativeScript, slashArg) {\n\n            var url = config.wwwroot + relativeScript;\n\n            \/\/ Force a \/\n            if (slashArg.charAt(0) != '\/') {\n                slashArg = '\/' + slashArg;\n            }\n            if (config.slasharguments) {\n                url += slashArg;\n            } else {\n                url += '?file=' + encodeURIComponent(slashArg);\n            }\n            return url;\n        },\n\n        \/**\n         * Take a path relative to the moodle basedir and do some fixing (see class moodle_url in php).\n         *\n         * @method relativeUrl\n         * @param {string} relativePath The path relative to the moodle basedir.\n         * @param {object} params The query parameters for the URL.\n         * @param {bool} includeSessKey Add the session key to the query params.\n         * @return {string}\n         *\/\n        relativeUrl: function(relativePath, params, includeSessKey) {\n\n            if (relativePath.indexOf('http:') === 0 || relativePath.indexOf('https:') === 0 || relativePath.indexOf(':\/\/') >= 0) {\n                throw new Error('relativeUrl function does not accept absolute urls');\n            }\n\n            \/\/ Fix non-relative paths;\n            if (relativePath.charAt(0) != '\/') {\n                relativePath = '\/' + relativePath;\n            }\n\n            \/\/ Fix admin urls.\n            if (config.admin !== 'admin') {\n                relativePath = relativePath.replace(\/^\\\/admin\\\/\/, '\/' + config.admin + '\/');\n            }\n\n            params = params || {};\n            if (includeSessKey) {\n                params.sesskey = config.sesskey;\n            }\n\n            var queryString = '';\n            if (Object.keys(params).length) {\n                queryString = $.map(params, function(value, param) {\n                    return param + '=' + value;\n                }).join('&');\n            }\n\n            if (queryString !== '') {\n                return config.wwwroot + relativePath + '?' + queryString;\n            } else {\n                return config.wwwroot + relativePath;\n            }\n        },\n\n        \/**\n         * Wrapper for image_url function.\n         *\n         * @method imageUrl\n         * @param {string} imagename The image name (e.g. t\/edit).\n         * @param {string} component The component (e.g. mod_feedback).\n         * @return {string}\n         *\/\n        imageUrl: function(imagename, component) {\n            return M.util.image_url(imagename, component);\n        }\n    };\n});\n"],"names":["define","$","config","fileUrl","relativeScript","slashArg","url","wwwroot","charAt","slasharguments","encodeURIComponent","relativeUrl","relativePath","params","includeSessKey","indexOf","Error","admin","replace","sesskey","queryString","Object","keys","length","map","value","param","join","imageUrl","imagename","component","M","util","image_url"],"mappings":";;;;;;;;AAuBAA,kBAAO,CAAC,SAAU,gBAAgB,SAASC,EAAGC,cAGL,CAUjCC,QAAS,SAASC,eAAgBC,cAE1BC,IAAMJ,OAAOK,QAAUH,qBAGD,KAAtBC,SAASG,OAAO,KAChBH,SAAW,IAAMA,UAEjBH,OAAOO,eACPH,KAAOD,SAEPC,KAAO,SAAWI,mBAAmBL,UAElCC,KAYXK,YAAa,SAASC,aAAcC,OAAQC,mBAEF,IAAlCF,aAAaG,QAAQ,UAAqD,IAAnCH,aAAaG,QAAQ,WAAmBH,aAAaG,QAAQ,QAAU,QACxG,IAAIC,MAAM,sDAIU,KAA1BJ,aAAaJ,OAAO,KACpBI,aAAe,IAAMA,cAIJ,UAAjBV,OAAOe,QACPL,aAAeA,aAAaM,QAAQ,aAAc,IAAMhB,OAAOe,MAAQ,MAG3EJ,OAASA,QAAU,GACfC,iBACAD,OAAOM,QAAUjB,OAAOiB,aAGxBC,YAAc,UACdC,OAAOC,KAAKT,QAAQU,SACpBH,YAAcnB,EAAEuB,IAAIX,QAAQ,SAASY,MAAOC,cACjCA,MAAQ,IAAMD,SACtBE,KAAK,MAGQ,KAAhBP,YACOlB,OAAOK,QAAUK,aAAe,IAAMQ,YAEtClB,OAAOK,QAAUK,cAYhCgB,SAAU,SAASC,UAAWC,kBACnBC,EAAEC,KAAKC,UAAUJ,UAAWC"}