1 line
14 KiB
JavaScript
1 line
14 KiB
JavaScript
var requirejs,require,define;!function(a){function b(a,b){return r.call(a,b)}function c(a,b){var c,d,e,f,g,h,i,j,k,l,m,n=b&&b.split("/"),o=p.map,q=o&&o["*"]||{};if(a&&"."===a.charAt(0))if(b){for(n=n.slice(0,n.length-1),a=a.split("/"),g=a.length-1,p.nodeIdCompat&&t.test(a[g])&&(a[g]=a[g].replace(t,"")),a=n.concat(a),k=0;k<a.length;k+=1)if(m=a[k],"."===m)a.splice(k,1),k-=1;else if(".."===m){if(1===k&&(".."===a[2]||".."===a[0]))break;k>0&&(a.splice(k-1,2),k-=2)}a=a.join("/")}else 0===a.indexOf("./")&&(a=a.substring(2));if((n||q)&&o){for(c=a.split("/"),k=c.length;k>0;k-=1){if(d=c.slice(0,k).join("/"),n)for(l=n.length;l>0;l-=1)if(e=o[n.slice(0,l).join("/")],e&&(e=e[d])){f=e,h=k;break}if(f)break;!i&&q&&q[d]&&(i=q[d],j=k)}!f&&i&&(f=i,h=j),f&&(c.splice(0,h,f),a=c.join("/"))}return a}function d(b,c){return function(){return k.apply(a,s.call(arguments,0).concat([b,c]))}}function e(a){return function(b){return c(b,a)}}function f(a){return function(b){n[a]=b}}function g(c){if(b(o,c)){var d=o[c];delete o[c],q[c]=!0,j.apply(a,d)}if(!b(n,c)&&!b(q,c))throw new Error("No "+c);return n[c]}function h(a){var b,c=a?a.indexOf("!"):-1;return c>-1&&(b=a.substring(0,c),a=a.substring(c+1,a.length)),[b,a]}function i(a){return function(){return p&&p.config&&p.config[a]||{}}}var j,k,l,m,n={},o={},p={},q={},r=Object.prototype.hasOwnProperty,s=[].slice,t=/\.js$/;l=function(a,b){var d,f=h(a),i=f[0];return a=f[1],i&&(i=c(i,b),d=g(i)),i?a=d&&d.normalize?d.normalize(a,e(b)):c(a,b):(a=c(a,b),f=h(a),i=f[0],a=f[1],i&&(d=g(i))),{f:i?i+"!"+a:a,n:a,pr:i,p:d}},m={require:function(a){return d(a)},exports:function(a){var b=n[a];return"undefined"!=typeof b?b:n[a]={}},module:function(a){return{id:a,uri:"",exports:n[a],config:i(a)}}},j=function(c,e,h,i){var j,k,p,r,s,t,u=[],v=typeof h;if(i=i||c,"undefined"===v||"function"===v){for(e=!e.length&&h.length?["require","exports","module"]:e,s=0;s<e.length;s+=1)if(r=l(e[s],i),k=r.f,"require"===k)u[s]=m.require(c);else if("exports"===k)u[s]=m.exports(c),t=!0;else if("module"===k)j=u[s]=m.module(c);else if(b(n,k)||b(o,k)||b(q,k))u[s]=g(k);else{if(!r.p)throw new Error(c+" missing "+k);r.p.load(r.n,d(i,!0),f(k),{}),u[s]=n[k]}p=h?h.apply(n[c],u):void 0,c&&(j&&j.exports!==a&&j.exports!==n[c]?n[c]=j.exports:p===a&&t||(n[c]=p))}else c&&(n[c]=h)},requirejs=require=k=function(b,c,d,e,f){if("string"==typeof b)return m[b]?m[b](c):g(l(b,c).f);if(!b.splice){if(p=b,p.deps&&k(p.deps,p.callback),!c)return;c.splice?(b=c,c=d,d=null):b=a}return c=c||function(){},"function"==typeof d&&(d=e,e=f),e?j(a,b,c,d):setTimeout(function(){j(a,b,c,d)},4),k},k.config=function(a){return k(a)},requirejs._defined=n,define=function(a,c,d){c.splice||(d=c,c=[]),b(n,a)||b(o,a)||(o[a]=[a,c,d])},define.amd={jQuery:!0}}(),define("almond",function(){}),define("jquery",[],function(){return jQuery}),define("select2/utils",[],function(){function a(a){var b=a.prototype,c=[];for(var d in b){var e=b[d];"function"==typeof e&&c.push(d)}return c}var b={};b.Extend=function(a,b){function c(){this.constructor=a}var d={}.hasOwnProperty;for(var e in b)d.call(b,e)&&(a[e]=b[e]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},b.Decorate=function(b,c){function d(){var a=Array.prototype.unshift,d=c.prototype.constructor.length,e=b.prototype.constructor;d>0&&(a.call(arguments,b.prototype.constructor),e=c.prototype.constructor),e.apply(this,arguments)}function e(){this.constructor=d}var f=a(c),g=a(b);c.displayName=b.displayName,d.prototype=new e;for(var h=0;h<g.length;h++){var i=g[h];d.prototype[i]=b.prototype[i]}for(var j=(function(a){var b=function(){};a in d.prototype&&(b=d.prototype[a]);var e=c.prototype[a];return function(){var a=Array.prototype.unshift;return a.call(arguments,b),e.apply(this,arguments)}}),k=0;k<f.length;k++){var l=f[k];d.prototype[l]=j(l)}return d};var c=function(){this.listeners={}};return c.prototype.on=function(a,b){a in this.listeners?this.listeners[a].push(b):this.listeners[a]=[b]},c.prototype.trigger=function(a){var b=Array.prototype.slice;a in this.listeners&&this.invoke(this.listeners[a],b.call(arguments,1)),"*"in this.listeners&&this.invoke(this.listeners["*"],arguments)},c.prototype.invoke=function(a,b){for(var c=0,d=a.length;d>c;c++)a[c].apply(this,b)},b.Observable=c,b}),define("select2/results",["./utils"],function(a){function b(a,c,d){this.$element=a,this.data=d,b.__super__.constructor.call(this)}return a.Extend(b,a.Observable),b.prototype.render=function(){var a=$('<ul class="options"></ul>');return this.$results=a,a},b.prototype.clear=function(){this.$results.empty()},b.prototype.append=function(a){for(var b=[],c=0;c<a.length;c++){var d=a[c],e=this.option(d);b.push(e)}this.$results.append(b)},b.prototype.setClasses=function(){var a=this;this.data.current(function(b){b=$.map(b,function(a){return a.id}),a.$results.find(".option.selected").removeClass("selected");var c=a.$results.find(".option");c.each(function(){var a=$(this),c=a.data("data");b.indexOf(c.id.toString())>-1&&a.addClass("selected")})})},b.prototype.option=function(a){var b=$('<li class="option highlightable selectable"></li>');if(a.children&&a.children.length>0){b.addClass("group").removeClass("highlightable selectable");var c=$('<strong class="group-label"></strong>');c.html(a.text);for(var d=[],e=0;e<a.children.length;e++){var f=a.children[e],g=this.option(f);d.push(g)}var h=$('<ul class="options nested-options"></ul>');h.append(d),b.append(c),b.append(h)}else b.html(a.text);return a.disabled&&b.removeClass("selectable highlightable").addClass("disabled"),b.data("data",a),b},b.prototype.bind=function(){var a=this;this.on("results:all",function(b){a.clear(),a.append(b),a.setClasses()}),this.on("results:append",function(b){a.append(b),a.setClasses()}),this.$results.on("mouseup",".option.selectable",function(b){var c=$(this),d=c.data("data");return c.hasClass("selected")?(a.trigger("unselected",{originalEvent:b,data:d}),void a.setClasses()):(a.trigger("selected",{originalEvent:b,data:d}),void a.setClasses())}),this.$results.on("mouseenter",".option.highlightable",function(){a.$results.find(".option.highlighted").removeClass("highlighted"),$(this).addClass("highlighted")}),this.$results.on("mouseleave",".option",function(){$(this).removeClass("highlighted")})},b}),define("select2/dropdown",["./utils"],function(a){function b(a){this.$element=a}return a.Extend(b,a.Observable),b.prototype.render=function(){var a=$('<span class="dropdown"><span class="results"></span></span>');return a},b}),define("select2/selection/single",["../utils"],function(a){function b(a,c){this.$element=a,this.options=c,b.__super__.constructor.call(this)}return a.Extend(b,a.Observable),b.prototype.render=function(){var a=$('<span class="single-select"><span class="rendered-selection"></span></span>');return this.$selection=a,a},b.prototype.bind=function(a){var b=this;this.$selection.on("mousedown",function(a){1===a.which&&b.trigger("toggle",{originalEvent:a})}),a.on("selection:update",function(a){b.update(a.data)})},b.prototype.clear=function(){this.$selection.find(".rendered-selection").empty()},b.prototype.display=function(a){return a.text},b.prototype.update=function(a){if(0===a.length)return void this.clear();var b=a[0],c=this.display(b);this.$selection.find(".rendered-selection").html(c)},b}),define("select2/selection/multiple",["../utils"],function(a){function b(a,c){this.$element=a,this.options=c,b.__super__.constructor.call(this)}return a.Extend(b,a.Observable),b.prototype.render=function(){var a=$('<span class="multiple-select"><ul class="rendered-selection"></ul></span>');return this.$selection=a,a},b.prototype.bind=function(a){var b=this;this.$selection.on("click",function(a){b.trigger("toggle",{originalEvent:a})}),a.on("selection:update",function(a){b.update(a.data)})},b.prototype.clear=function(){this.$selection.find(".rendered-selection").empty()},b.prototype.display=function(a){return a.text},b.prototype.update=function(a){if(this.clear(),0!==a.length){for(var b=[],c=0;c<a.length;c++){var d=a[c],e=this.display(d),f=$('<ul class="choice"></ul>');f.text(e),f.data("data",a),b.push(f)}this.$selection.find(".rendered-selection").append(b)}},b}),define("select2/data/base",["../utils"],function(a){function b(){b.__super__.constructor.call(this)}return a.Extend(b,a.Observable),b.prototype.current=function(){throw new Error("The `current` method must be defined in child classes.")},b.prototype.query=function(){throw new Error("The `query` method must be defined in child classes.")},b}),define("select2/data/select",["./base","../utils","jquery"],function(a,b,c){function d(a){this.$element=a,d.__super__.constructor.call(this)}return b.Extend(d,a),d.prototype.current=function(a){var b=[],d=this;this.$element.find(":selected").each(function(){var a=c(this),e=d.item(a);b.push(e)}),a(b)},d.prototype.select=function(a){var b=this;if(this.$element.prop("multiple"))this.current(function(c){var d=[];a=[a],a.push.apply(a,c);for(var e=0;e<a.length;e++)id=a[e].id,-1===d.indexOf(id)&&d.push(id);b.$element.val(d),b.$element.trigger("change")});else{var c=a.id;this.$element.val(c),this.$element.trigger("change")}},d.prototype.unselect=function(a){var b=this;this.$element.prop("multiple")&&this.current(function(c){for(var d=[],e=0;e<c.length;e++)id=c[e].id,id!==a.id&&-1===d.indexOf(id)&&d.push(id);b.$element.val(d),b.$element.trigger("change")})},d.prototype.bind=function(a){var b=this;a.on("select",function(a){b.select(a.data)}),a.on("unselect",function(a){b.unselect(a.data)})},d.prototype.query=function(a,b){var d=[],e=this,f=this.$element.children();f.each(function(){var b=c(this);if(b.is("option")||b.is("optgroup")){var f=e.item(b),g=e.matches(a,f);null!==g&&d.push(g)}}),b(d)},d.prototype.item=function(a){var b=a.data("data");if(null==b){if(a.is("option"))b={id:a.val(),text:a.html(),disabled:a.prop("disabled")};else if(a.is("optgroup")){b={id:-1,text:a.attr("label"),children:[]};for(var d=a.children("option"),e=[],f=0;f<d.length;f++){var g=c(d[f]),h=this.item(g);e.push(h)}b.children=e}a.data("data",b)}return b},d.prototype.matches=function(a,b){var d=c.extend(!0,{},b);if(b.children){for(var e=b.children.length-1;e>=0;e--){var f=b.children[e],g=this.matches(a,f);null===g&&d.children.splice(e,1)}if(d.children.length>0)return d}return""===c.trim(a.term)?d:b.text.indexOf(a.term)>-1?d:null},d}),define("select2/data/array",["./select","../utils"],function(a,b){function c(a,b){this.data=b.options.data,c.__super__.constructor.call(this,a,b)}return b.Extend(c,a),c.prototype.select=function(a){var b=this;this.$element.find("option").each(function(){var c=$(this),d=b.item(c);d.id==a.id.toString()&&c.remove()});var d=this.option(a);this.$element.append(d),c.__super__.select.call(this,a)},c.prototype.option=function(a){var b=$("<option></option>");return b.text(a.text),b.val(a.id),b.data("data",a),b},c.prototype.query=function(a,b){var c=[],d=this;$.each(this.data,function(){var b=this;d.matches(a,b)&&c.push(b)}),b(c)},c}),define("select2/data/ajax",["./array","../utils","jquery"],function(a,b,c){function d(b,c){this.ajaxOptions=c.options.ajax,this.processResults=this.ajaxOptions.processResults||function(a){return a},a.__super__.constructor.call(this,b,c)}return b.Extend(d,a),d.prototype.query=function(a,b){var d=this,e=c.extend({type:"GET"},this.ajaxOptions);"function"==typeof e.url&&(e.url=e.url(a)),"function"==typeof e.data&&(e.data=e.data(a));var f=c.ajax(e);f.success(function(a){var c=d.processResults(a);b(c)})},d}),define("select2/options",["./results","./dropdown","./selection/single","./selection/multiple","./data/select","./data/array","./data/ajax"],function(a,b,c,d,e,f,g){function h(h){this.options=h,this.dataAdapter=h.ajax?this.dataAdapter||g:h.data?this.dataAdapter||f:this.dataAdapter||e,this.resultsAdapter=a,this.dropdownAdapter=h.dropdownAdapter||b,this.selectionAdapter=h.selectionAdapter,null==this.selectionAdapter&&(this.selectionAdapter=this.options.multiple?d:c)}return h}),define("select2/core",["jquery","./options","./utils"],function(a,b,c){var d=function(a,c){this.$element=a,c=c||{},c.multiple=c.multiple||a.prop("multiple"),this.options=new b(c),d.__super__.constructor.call(this),this.data=new this.options.dataAdapter(a,this.options);var e=this.render();this.$container=e,e.insertAfter(this.$element),e.width(a.width()),this.selection=new this.options.selectionAdapter(a,this.options);var f=e.find(".selection"),g=this.selection.render();f.append(g),this.dropdown=new this.options.dropdownAdapter(a,this.options);var h=e.find(".dropdown-wrapper"),i=this.dropdown.render();h.append(i),this.results=new this.options.resultsAdapter(a,this.options,this.data);var j=i.find(".results"),k=this.results.render();j.append(k);var l=this;this.data.bind(this,e),this.selection.bind(this,e),this.results.bind(this,e),this.$element.on("change",function(){l.data.current(function(a){l.trigger("selection:update",{data:a})})}),this.selection.on("toggle",function(){l.toggleDropdown()}),this.results.on("selected",function(a){l.trigger("select",a),l.trigger("close")}),this.results.on("unselected",function(a){l.trigger("unselect",a),l.trigger("close")}),this.on("open",function(){e.addClass("open")}),this.on("close",function(){e.removeClass("open")}),this.data.current(function(a){l.trigger("selection:update",{data:a})}),this.data.query({},function(a){l.results.trigger("results:all",a)}),a.hide()};return c.Extend(d,c.Observable),d.prototype.toggleDropdown=function(){this.trigger(this.$container.hasClass("open")?"close":"open")},d.prototype.render=function(){var b=a('<span class="select2 select2-container select2-theme-default"><span class="selection"></span><span class="dropdown-wrapper"></span></span>');return b},d}),define("jquery.select2",["jquery","select2/core"],function(a,b){return null==a.fn.select2&&(a.fn.select2=function(c){if(c=c||{},"object"==typeof c)this.each(function(){new b(a(this),c)});else{if("string"!=typeof c)throw new Error("Invalid arguments for Select2: "+c);var d=this.data("select2");d[c](arguments.slice(1))}}),b}),require("jquery.select2"); |