require.config({paths:{selectize:"../../../webjars/selectize.js/0.12.5/js/standalone/selectize.min"},shim:{selectize:["jquery"]}});define("xwiki-selectize",["jquery","selectize","xwiki-events-bridge"],function(f){var j=['<div class="xwiki-selectize-option" data-value="">','<span class="xwiki-selectize-option-icon" />','<span class="xwiki-selectize-option-label" />',"</div>"].join("");var g=function(r){var m=f(j);var s=(r&&typeof r==="object")?r.value:r;m.attr("data-value",s);var q=r&&r.icon;if(typeof q==="object"){if(!q.iconSetType&&q.url){q.iconSetType="IMAGE"}else{if(!q.iconSetType&&q.cssClass){q.iconSetType="FONT"}}if(q.iconSetType==="IMAGE"){var t=f('<img class="xwiki-selectize-option-icon" alt="" />').attr("src",q.url);m.find(".xwiki-selectize-option-icon").replaceWith(t)}else{if(q.iconSetType==="FONT"){m.find(".xwiki-selectize-option-icon").addClass(q.cssClass)}else{m.find(".xwiki-selectize-option-icon").remove()}}}else{m.find(".xwiki-selectize-option-icon").remove()}var p=r&&r.url;if(typeof p==="string"){var o=f('<a class="xwiki-selectize-option-label" />').attr("href",p);m.find(".xwiki-selectize-option-label").replaceWith(o)}var n=(r&&typeof r==="object")?(r.label||r.value):r;m.find(".xwiki-selectize-option-label").text(n);return m};var b=function(n){var m=g(n);m.addClass("option");m.find(".xwiki-selectize-option-icon").wrap('<span class="xwiki-selectize-option-icon-wrapper"/>');var o=n&&n.hint;if(typeof o==="string"&&o!==""){m.append(f('<div class="xwiki-selectize-option-hint"/>').text(o))}return m};var d=function(n){var m=g(n);var o=n&&n.hint;if(typeof o==="string"&&o!==""){m.attr("title",o)}return m};var h={copyClassesToDropdown:false,dropdownParent:"body",highlight:false,labelField:"label",loadThrottle:500,onDropdownClose:function(m){m.removeClass("active")},onDropdownOpen:function(m){m.addClass("active")},persist:false,preload:"focus",render:{item:d,option:b,option_create:function(n,o){var p="Select {0} ...";var m=f('<div class="create option"/>').html(o(p).replace("{0}","<em/>"));m.find("em").text(n.input);return m}},searchField:["value","label"],onType:function(m){var n=typeof this.settings.load==="function"&&!this.loadedSearches.hasOwnProperty(m);(this.$wrapper).toggleClass(this.settings.loadingClass,n)},onInitialize:function(){var m=this.$control;m.on("click","a.xwiki-selectize-option-label",function(n){n.preventDefault()})}};var c=function(){var m=this.selectize;var n=m.$wrapper;n.addClass(m.settings.loadingClass);m.loading++;m.items.reduce(function(o,p){return o.then(function(){return l(m,p)})},f.Deferred().resolve()).always(function(){m.loading=Math.max(m.loading-1,0);if(!m.loading){n.removeClass(m.settings.loadingClass)}})};var l=function(n,p){var m=f.Deferred();var o;if(typeof n.settings.loadSelected==="function"){o=n.settings.loadSelected}else{o=n.settings.load}if(p&&typeof o==="function"){o.call(n,p,function(q){f.isArray(q)&&q.forEach(function(r){var s=r[n.settings.valueField];if(n.options.hasOwnProperty(s)){n.updateOption(s,r)}else{n.addOption(r)}});m.resolve()})}else{m.resolve()}return m.promise()};var i=function(){var m=this.selectize.positionDropdown;this.selectize.positionDropdown=function(){if(this.settings.dropdownParent==="body"){m.call(this)}if(this.settings.dropdownWidth==="auto"){this["$dropdown"].css({width:"","min-width":this["$control"][0].getBoundingClientRect().width})}};a(this.selectize);if(this.selectize.settings.takeInputWidth){this.selectize["$control"].width(f(this).data("initialWidth"))}};var a=function(m){var n=m.settings.dropdownAlignment;if(!n&&m.settings.dropdownParent!=="body"){n="left"}if(n){m["$dropdown"].addClass("selectize-dropdown-"+n)}};var e=function(m){var n={};if(m.closest(".xform").length===0){n.dropdownWidth="auto"}return n};var k=function(m,n){return f.extend({},h,e(m),n,m.data("xwiki-selectize"))};f.fn.xwikiSelectize=function(m){this.each(function(){f(this).data("initialWidth",f(this).width())});return this.not(".selectized, .selectize-control").on("initialize",i).on("change",function(n){var o=f(this).closest(".xwiki-livetable-display-header-filter").closest(".xwiki-livetable").attr("id");o&&f(document).trigger("xwiki:livetable:"+o+":filtersChanged")}).each(function(){f(this).selectize(k(f(this),m))}).trigger("initialize").each(c)}});require(["jquery","xwiki-selectize","xwiki-events-bridge"],function(a){var b=function(d,e){var c=a((e&&e.elements)||document);c.find(".xwiki-selectize").xwikiSelectize()};a(document).on("xwiki:dom:updated",b);XWiki.domIsLoaded&&b()});