From a1b9fda809aa62a197bbd2f2371455983250e65a Mon Sep 17 00:00:00 2001 From: Carson Sievert Date: Thu, 26 Oct 2023 17:42:06 -0500 Subject: [PATCH] Prevent `.selectize()` updates from destroying `.data()` and event listeners (#3923) Co-authored-by: cpsievert --- inst/www/shared/selectize/js/selectize.js | 8 +- inst/www/shared/selectize/js/selectize.min.js | 2 +- inst/www/shared/shiny.js | 2371 ++++++++--------- inst/www/shared/shiny.js.map | 8 +- inst/www/shared/shiny.min.js | 2 +- inst/www/shared/shiny.min.js.map | 8 +- srcts/src/bindings/input/selectInput.ts | 24 +- .../types/src/bindings/input/selectInput.d.ts | 1 - .../008-selectize-revert-d2564a0a.patch | 32 + 9 files changed, 1226 insertions(+), 1230 deletions(-) create mode 100644 tools/selectize-patches/008-selectize-revert-d2564a0a.patch diff --git a/inst/www/shared/selectize/js/selectize.js b/inst/www/shared/selectize/js/selectize.js index 767f45e1c6..a902fae5b4 100644 --- a/inst/www/shared/selectize/js/selectize.js +++ b/inst/www/shared/selectize/js/selectize.js @@ -1064,14 +1064,8 @@ $.extend(Selectize.prototype, { self.ignoreHover = self.settings.ignoreHover; }); - var inputPlaceholder = $('
'); - var inputChildren = $input.children().detach(); - - $input.replaceWith(inputPlaceholder); - inputPlaceholder.replaceWith($input); - this.revertSettings = { - $children : inputChildren, + $children : $input.children().detach(), tabindex : $input.attr('tabindex') }; diff --git a/inst/www/shared/selectize/js/selectize.min.js b/inst/www/shared/selectize/js/selectize.min.js index 03b66e7121..5b2168fa81 100644 --- a/inst/www/shared/selectize/js/selectize.min.js +++ b/inst/www/shared/selectize/js/selectize.min.js @@ -1 +1 @@ -(function(d,z){typeof define=="function"&&define.amd?define(["jquery"],z):typeof module=="object"&&typeof module.exports=="object"?module.exports=z(require("jquery")):d.Selectize=z(d.jQuery)})(this,function(d){"use strict";var z=function(e,t){if(!(typeof t=="string"&&!t.length)){var i=typeof t=="string"?new RegExp(t,"i"):t,n=function(r){var s=0;if(r.nodeType===3){var o=r.data.search(i);if(o>=0&&r.data.length>0){var a=r.data.match(i),l=document.createElement("span");l.className="highlight";var c=r.splitText(o),u=c.splitText(a[0].length),f=c.cloneNode(!0);l.appendChild(f),c.parentNode.replaceChild(l,c),s=1}}else if(r.nodeType===1&&r.childNodes&&!/(script|style)/i.test(r.tagName)&&(r.className!=="highlight"||r.tagName!=="SPAN"))for(var h=0;hcrypto.getRandomValues(new Uint8Array(e)).reduce((t,i)=>t+=(i&=63)<36?i.toString(36):i<62?(i-26).toString(36).toUpperCase():i>62?"-":"_","");var D=function(e,t){this.items=e,this.settings=t||{diacritics:!0}};D.prototype.tokenize=function(e,t){if(e=se(String(e||"").toLowerCase()),!e||!e.length)return[];var i,n,r,s,o=[],a=e.split(/ +/);for(i=0,n=a.length;i0)&&s.items.push({score:r,id:u})}):i.iterator(i.items,function(c,u){s.items.push({score:1,id:u})}),a=i.getSortFunction(s,t),a&&s.items.sort(a),s.total=s.items.length,typeof t.limit=="number"&&(s.items=s.items.slice(0,t.limit)),s};var Q=function(e,t){return typeof e=="number"&&typeof t=="number"?e>t?1:et?1:t>e?-1:0)},re=function(e,t){var i,n,r,s;for(i=1,n=arguments.length;i/g,">").replace(/"/g,""")},Ie=function(e){return(e+"").replace(/\$/g,"$$$$")},L={};L.before=function(e,t,i){var n=e[t];e[t]=function(){return i.apply(e,arguments),n.apply(e,arguments)}},L.after=function(e,t,i){var n=e[t];e[t]=function(){var r=n.apply(e,arguments);return i.apply(e,arguments),r}};var ye=function(e){var t=!1;return function(){t||(t=!0,e.apply(this,arguments))}},Oe=function(e,t){var i;return function(){var n=this,r=arguments;window.clearTimeout(i),i=window.setTimeout(function(){e.apply(n,r)},t)}},te=function(e,t,i){var n,r=e.trigger,s={};e.trigger=function(){var o=arguments[0];if(t.indexOf(o)!==-1)s[o]=arguments;else return r.apply(e,arguments)},i.apply(e,[]),e.trigger=r;for(n in s)s.hasOwnProperty(n)&&r.apply(e,s[n])},be=function(e,t,i,n){e.on(t,i,function(r){for(var s=r.target;s&&s.parentNode!==e[0];)s=s.parentNode;return r.currentTarget=s,n.apply(this,[r])})},R=function(e){var t={};if(e===void 0)return console.warn("WARN getInputSelection cannot locate input control"),t;if("selectionStart"in e)t.start=e.selectionStart,t.length=e.selectionEnd-t.start;else if(document.selection){e.focus();var i=document.selection.createRange(),n=document.selection.createRange().text.length;i.moveStart("character",-e.value.length),t.start=i.text.length-n,t.length=n}return t},_e=function(e,t,i){var n,r,s={};if(i)for(n=0,r=i.length;n").css({position:"absolute",width:"auto",padding:0,whiteSpace:"pre"}),d("
").css({position:"absolute",width:0,height:0,overflow:"hidden"}).attr({"aria-hidden":!0}).append(m.$testInput).appendTo("body")),m.$testInput.text(e),_e(t,m.$testInput,["letterSpacing","fontSize","fontFamily","fontWeight","textTransform"]),m.$testInput.width()):0},Ce=function(e){var t=null,i=function(n,r){var s,o,a,g,l,c,u,f,h;if(n=n||window.event||{},r=r||{},!(n.metaKey||n.altKey)&&!(!r.force&&e.data("grow")===!1)){s=e.val(),n.type&&n.type.toLowerCase()==="keydown"&&(o=n.keyCode,a=o>=48&&o<=57||o>=65&&o<=90||o>=96&&o<=111||o>=186&&o<=222||o===32,o===q||o===V?(h=R(e[0]),h.length?s=s.substring(0,h.start)+s.substring(h.start+h.length):o===V&&h.start?s=s.substring(0,h.start-1)+s.substring(h.start+1):o===q&&typeof h.start!="undefined"&&(s=s.substring(0,h.start)+s.substring(h.start+1))):a&&(u=n.shiftKey,f=String.fromCharCode(n.keyCode),u?f=f.toUpperCase():f=f.toLowerCase(),s+=f));var g=e.attr("readonly")?0:4;l=e.attr("placeholder"),l?c=ie(l,e)+g:c=0,g=Math.max(ie(s,e),c)+g,g!==t&&(t=g,e.width(g),e.triggerHandler("resize"))}};e.on("keydown keyup update blur",i),i()},$e=function(e){var t=document.createElement("div");return t.appendChild(e.cloneNode(!0)),t.innerHTML},Fe=function(e,t){t||(t={});var i="Selectize";console.error(i+": "+e),t.explanation&&(console.group&&console.group(),console.error(t.explanation),console.group&&console.groupEnd())},xe=function(e){try{JSON.parse(e)}catch(t){return!1}return!0};function ne(e,t){return navigator.userAgentData?e===navigator.userAgentData.platform:t.test(navigator.userAgent)}var m=function(e,t){var i,n,r,s,o,a=this;o=e[0],o.selectize=a;var l=window.getComputedStyle&&window.getComputedStyle(o,null);if(s=l?l.getPropertyValue("direction"):o.currentStyle&&o.currentStyle.direction,s=s||e.parents("[dir]:first").attr("dir")||"",a.settings={},++m.count,d.extend(a,{order:0,settings:t,$input:e,tabIndex:e.attr("tabindex")||"",tagType:o.tagName.toLowerCase()==="select"?K:me,rtl:/rtl/i.test(s),eventNS:".selectize-"+new Date().getTime()+"-"+Math.random().toString(36).substr(2,5),highlightedValue:null,isBlurring:!1,isOpen:!1,isDisabled:!1,isRequired:e.is("[required]"),isInvalid:!1,isLocked:!1,isFocused:!1,isInputHidden:!1,isSetup:!1,isShiftDown:!1,isCmdDown:!1,isCtrlDown:!1,ignoreFocus:!1,ignoreBlur:!1,ignoreHover:!1,hasOptions:!1,currentResults:null,lastValue:"",lastValidValue:"",lastOpenTarget:!1,caretPos:0,loading:0,loadedSearches:{},isDropdownClosing:!1,$activeOption:null,$activeItems:[],optgroups:{},options:{},userOptions:{},items:[],renderCache:{},onSearchChange:t.loadThrottle===null?a.onSearchChange:Oe(a.onSearchChange,t.loadThrottle)}),a.sifter=new D(this.options,{diacritics:t.diacritics}),a.settings.options){for(n=0,r=a.settings.options.length;n").addClass(t.wrapperClass).addClass(w+" selectize-control").addClass(h),a=d("
").addClass(t.inputClass+S+" selectize-input items").appendTo(o),l=d('').appendTo(a).attr("tabindex",s.is(":disabled")?"-1":e.tabIndex),f=d(t.dropdownParent||o),c=d("
").addClass(t.dropdownClass).addClass(h+" selectize-dropdown").hide().appendTo(f),u=d("
").addClass(t.dropdownContentClass+" selectize-dropdown-content").attr("tabindex","-1").appendTo(c),(p=s.attr("id"))&&(l.attr("id",p+"-selectized"),d("label[for='"+p+"']").attr("for",p+"-selectized")),e.settings.copyClassesToDropdown&&c.addClass(w),o.css({width:s[0].style.width}),e.plugins.names.length&&(y="plugin-"+e.plugins.names.join(" plugin-"),o.addClass(y),c.addClass(y)),(t.maxItems===null||t.maxItems>1)&&e.tagType===K&&s.attr("multiple","multiple"),e.settings.placeholder&&l.attr("placeholder",t.placeholder),e.settings.search||(l.attr("readonly",!0),l.attr("inputmode","none"),a.css("cursor","pointer")),!e.settings.splitOn&&e.settings.delimiter){var _=e.settings.delimiter.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&");e.settings.splitOn=new RegExp("\\s*"+_+"+\\s*")}s.attr("autocorrect")&&l.attr("autocorrect",s.attr("autocorrect")),s.attr("autocapitalize")&&l.attr("autocapitalize",s.attr("autocapitalize")),s.is("input")&&(l[0].type=s[0].type),e.$wrapper=o,e.$control=a,e.$control_input=l,e.$dropdown=c,e.$dropdown_content=u,c.on("mouseenter mousedown mouseup click","[data-disabled]>[data-selectable]",function(O){O.stopImmediatePropagation()}),c.on("mouseenter","[data-selectable]",function(){return e.onOptionHover.apply(e,arguments)}),c.on("mouseup click","[data-selectable]",function(){return e.onOptionSelect.apply(e,arguments)}),be(a,"mouseup","*:not(input)",function(){return e.onItemSelect.apply(e,arguments)}),Ce(l),a.on({mousedown:function(){return e.onMouseDown.apply(e,arguments)},click:function(){return e.onClick.apply(e,arguments)}}),l.on({mousedown:function(O){(e.$control_input.val()!==""||e.settings.openOnFocus)&&O.stopPropagation()},keydown:function(){return e.onKeyDown.apply(e,arguments)},keypress:function(){return e.onKeyPress.apply(e,arguments)},input:function(){return e.onInput.apply(e,arguments)},resize:function(){e.positionDropdown.apply(e,[])},blur:function(){return e.onBlur.apply(e,arguments)},focus:function(){return e.onFocus.apply(e,arguments)},paste:function(){return e.onPaste.apply(e,arguments)}}),r.on("keydown"+i,function(O){e.isCmdDown=O[E?"metaKey":"ctrlKey"],e.isCtrlDown=O[E?"altKey":"ctrlKey"],e.isShiftDown=O.shiftKey}),r.on("keyup"+i,function(O){O.keyCode===ve&&(e.isCtrlDown=!1),O.keyCode===he&&(e.isShiftDown=!1),O.keyCode===ge&&(e.isCmdDown=!1)}),r.on("mousedown"+i,function(O){if(e.isFocused){if(O.target===e.$dropdown[0]||e.$dropdown.has(O.target).length)return!1;O.target!==e.$control[0]&&e.blur(O.target)}}),n.on(["scroll"+i,"resize"+i].join(" "),function(){e.isOpen&&e.positionDropdown.apply(e,arguments)}),n.on("mousemove"+i,function(){e.ignoreHover=e.settings.ignoreHover});var x=d("
"),k=s.children().detach();s.replaceWith(x),x.replaceWith(s),this.revertSettings={$children:k,tabindex:s.attr("tabindex")},s.attr("tabindex",-1).hide().after(e.$wrapper),Array.isArray(t.items)&&(e.lastValidValue=t.items,e.setValue(t.items),delete t.items),Z&&s.on("invalid"+i,function(O){O.preventDefault(),e.isInvalid=!0,e.refreshState()}),e.updateOriginalInput(),e.refreshItems(),e.refreshState(),e.updatePlaceholder(),e.isSetup=!0,s.is(":disabled")&&e.disable(),e.on("change",this.onChange),s.data("selectize",e),s.addClass("selectized"),e.trigger("initialize"),t.preload===!0&&e.onSearchChange("")},setupTemplates:function(){var e=this,t=e.settings.labelField,i=e.settings.valueField,n=e.settings.optgroupLabelField,r={optgroup:function(s){return'
'+s.html+"
"},optgroup_header:function(s,o){return'
'+o(s[n])+"
"},option:function(s,o){var a=s.classes?" "+s.classes:"";a+=s[i]===""?" selectize-dropdown-emptyoptionlabel":"";var l=s.styles?' style="'+s.styles+'"':"";return"'+o(s[t])+"
"},item:function(s,o){return'
'+o(s[t])+"
"},option_create:function(s,o){return'
Add '+o(s.input)+"
"}};e.settings.render=d.extend({},r,e.settings.render)},setupCallbacks:function(){var e,t,i={initialize:"onInitialize",change:"onChange",item_add:"onItemAdd",item_remove:"onItemRemove",clear:"onClear",option_add:"onOptionAdd",option_remove:"onOptionRemove",option_clear:"onOptionClear",optgroup_add:"onOptionGroupAdd",optgroup_remove:"onOptionGroupRemove",optgroup_clear:"onOptionGroupClear",dropdown_open:"onDropdownOpen",dropdown_close:"onDropdownClose",type:"onType",load:"onLoad",focus:"onFocus",blur:"onBlur",dropdown_item_activate:"onDropdownItemActivate",dropdown_item_deactivate:"onDropdownItemDeactivate"};for(e in i)i.hasOwnProperty(e)&&(t=this.settings[i[e]],t&&this.on(e,t))},onClick:function(e){var t=this;t.isDropdownClosing||(!t.isFocused||!t.isOpen)&&(t.focus(),e.preventDefault())},onMouseDown:function(e){var t=this,i=e.isDefaultPrevented(),n=d(e.target);if(t.isFocused||i||window.setTimeout(function(){t.isOpen||t.focus()},0),n!==t.$control_input[0]||t.$control_input.val()==="")return t.settings.mode==="single"?t.isOpen?t.close():t.open():(i||t.setActiveItem(null),t.settings.openOnFocus||(t.isOpen&&n===t.lastOpenTarget?(t.close(),t.lastOpenTarget=!1):(t.isOpen||(t.refreshOptions(),t.open()),t.lastOpenTarget=n))),!1},onChange:function(){var e=this;e.getValue()!==""&&(e.lastValidValue=e.getValue()),this.$input.trigger("input"),this.$input.trigger("change")},onPaste:function(e){var t=this;if(t.isFull()||t.isInputHidden||t.isLocked){e.preventDefault();return}t.settings.splitOn&&setTimeout(function(){var i=t.$control_input.val();if(!!i.match(t.settings.splitOn))for(var n=i.trim().split(t.settings.splitOn),r=0,s=n.length;ra&&(c=o,o=a,a=c),r=o;r<=a;r++)l=i.$control[0].childNodes[r],i.$activeItems.indexOf(l)===-1&&(d(l).addClass("active"),i.$activeItems.push(l));t.preventDefault()}else n==="mousedown"&&i.isCtrlDown||n==="keydown"&&this.isShiftDown?e.hasClass("active")?(s=i.$activeItems.indexOf(e[0]),i.$activeItems.splice(s,1),e.removeClass("active")):i.$activeItems.push(e.addClass("active")[0]):(d(i.$activeItems).removeClass("active"),i.$activeItems=[e.addClass("active")[0]]);i.hideInput(),this.isFocused||i.focus()}},setActiveOption:function(e,t,i){var n,r,s,o,a,l=this;l.$activeOption&&(l.$activeOption.removeClass("active"),l.trigger("dropdown_item_deactivate",l.$activeOption.attr("data-value"))),l.$activeOption=null,e=d(e),e.length&&(l.$activeOption=e.addClass("active"),l.isOpen&&l.trigger("dropdown_item_activate",l.$activeOption.attr("data-value")),(t||!ee(t))&&(n=l.$dropdown_content.height(),r=l.$activeOption.outerHeight(!0),t=l.$dropdown_content.scrollTop()||0,s=l.$activeOption.offset().top-l.$dropdown_content.offset().top+t,o=s,a=s-n+r,s+r>n+t?l.$dropdown_content.stop().animate({scrollTop:a},i?l.settings.scrollDuration:0):s=0;t--)o.items.indexOf(A(r.items[t].id))!==-1&&r.items.splice(t,1);return r},refreshOptions:function(e){var t,i,n,r,s,o,a,l,c,u,f,h,g,v,w,y;typeof e=="undefined"&&(e=!0);var p=this,S=p.$control_input.val().trim(),_=p.search(S),x=p.$dropdown_content,k=p.$activeOption&&A(p.$activeOption.attr("data-value"));for(r=_.items.length,typeof p.settings.maxOptions=="number"&&(r=Math.min(r,p.settings.maxOptions)),s={},o=[],t=0;t0||g&&p.settings.showAddOptionOnCreate||p.settings.setFirstOptionActive,p.hasOptions?(_.items.length>0?(w=k&&p.getOption(k),_.query!==""&&p.settings.setFirstOptionActive?v=x.find("[data-selectable]:first"):_.query!==""&&w&&w.length?v=w:p.settings.mode==="single"&&p.items.length&&(v=p.getOption(p.items[0])),(!v||!v.length)&&(y&&!p.settings.addPrecedence?v=p.getAdjacentOption(y,1):v=x.find("[data-selectable]:first"))):v=y,p.setActiveOption(v),e&&!p.isOpen&&p.open()):(p.setActiveOption(null),e&&p.isOpen&&p.close())},addOption:function(e){var t,i,n,r=this;if(Array.isArray(e)){for(t=0,i=e.length;t0?e.eq(0):d()},getAdjacentOption:function(e,t){var i=this.$dropdown.find("[data-selectable]"),n=i.index(e)+t;return n>=0&&n0),e.$control_input.data("grow",!t&&!i)},isFull:function(){return this.settings.maxItems!==null&&this.items.length>=this.settings.maxItems},updateOriginalInput:function(e){var t,i,n,r,s,o,a,l,c,u=this;e=e||{},u.tagType===K?(o=u.$input.find("option"),n=[],r=[],s=[],c=[],o.get().forEach(function(f){n.push(f.value)}),u.items.forEach(function(f){a=u.options[f][u.settings.labelField]||"",c.push(f),n.indexOf(f)==-1&&r.push('")}),s=n.filter(function(f){return c.indexOf(f)<0}).map(function(f){return'option[value="'+P(f)+'"]'}),n.length-s.length+r.length===0&&!u.$input.attr("multiple")&&r.push(''),u.$input.find(s.join(", ")).remove(),u.$input.append(r.join(""))):(u.$input.val(u.getValue()),u.$input.attr("value",u.$input.val())),u.isSetup&&(e.silent||u.trigger("change",u.$input.val()))},updatePlaceholder:function(){if(!!this.settings.placeholder){var e=this.$control_input;this.items.length?e.removeAttr("placeholder"):e.attr("placeholder",this.settings.placeholder),e.triggerHandler("update",{force:!0})}},open:function(){var e=this;e.isLocked||e.isOpen||e.settings.mode==="multi"&&e.isFull()||(e.focus(),e.isOpen=!0,e.refreshState(),e.$dropdown.css({visibility:"hidden",display:"block"}),e.setupDropdownHeight(),e.positionDropdown(),e.$dropdown.css({visibility:"visible"}),e.trigger("dropdown_open",e.$dropdown))},close:function(){var e=this,t=e.isOpen;e.settings.mode==="single"&&e.items.length&&(e.hideInput(),e.isBlurring&&e.$control_input[0].blur()),e.isOpen=!1,e.$dropdown.hide(),e.setActiveOption(null),e.refreshState(),t&&e.trigger("dropdown_close",e.$dropdown)},positionDropdown:function(){var e=this.$control,t=this.settings.dropdownParent==="body"?e.offset():e.position();t.top+=e.outerHeight(!0);var i=this.$wrapper[0].style.width!=="fit-content"?this.settings.dropdownParent==="body"?"max-content":"100%":"max-content";this.settings.minWidth&&this.settings.minWidth>i&&(i=this.settings.minWidth),this.settings.dropdownParent!=="body"&&i==="max-content"&&e.outerWidth(!0)>=this.$dropdown.outerWidth(!0)&&(i="100%"),this.$dropdown.css({width:i,minWidth:e.outerWidth(!0),top:t.top,left:t.left})},setupDropdownHeight:function(){if(typeof this.settings.dropdownSize=="object"&&this.settings.dropdownSize.sizeType!=="auto"){var e=this.settings.dropdownSize.sizeValue;if(this.settings.dropdownSize.sizeType==="numberItems"){for(var t=this.$dropdown_content.find("*").not(".optgroup, .highlight").not(this.settings.ignoreOnDropwdownHeight),i=0,n=0,r=0,s=0,o=0;o0?"last":"first")),o=u.$control.children(":not(input)").index(c),n>0&&o++,t=0,i=u.$activeItems.length;t0&&r.start===u.$control_input.val().length&&s.push(u.items[u.caretPos]));if(!s.length||typeof u.settings.onDelete=="function"&&u.settings.onDelete.apply(u,[s])===!1)return!1;for(typeof o!="undefined"&&u.setCaret(o);s.length;)u.removeItem(s.pop());return u.showInput(),u.positionDropdown(),u.refreshOptions(!0),a&&(l=u.getOption(a),l.length&&u.setActiveOption(l)),!0},advanceSelection:function(e,t){var i,n,r,s,o,a,l=this;e!==0&&(l.rtl&&(e*=-1),i=e>0?"last":"first",n=R(l.$control_input[0]),l.isFocused&&!l.isInputHidden?(s=l.$control_input.val().length,o=e<0?n.start===0&&n.length===0:n.start===s,o&&!s&&l.advanceCaret(e,t)):(a=l.$control.children(".active:"+i),a.length&&(r=l.$control.children(":not(input)").index(a),l.setActiveItem(null),l.setCaret(e>0?r+1:r))))},advanceCaret:function(e,t){var i=this,n,r;e!==0&&(n=e>0?"next":"prev",i.isShiftDown?(r=i.$control_input[n](),r.length&&(i.hideInput(),i.setActiveItem(r),t&&t.preventDefault())):i.setCaret(i.caretPos+e))},setCaret:function(e){var t=this;if(t.settings.mode==="single"?e=t.items.length:e=Math.max(0,Math.min(t.items.length,e)),!t.isPending){var i,n,r,s,o;for(s=t.$control.children(":not(input)"),i=0,n=s.length;i'+p+""+y)}var S={placeholder:w,options:[],optgroups:[],items:[]};v==="select"?f(g,S):u(g,S),h=new m(g,d.extend(!0,{},t,S,e)),h.settings_user=e}})},d.fn.selectize.defaults=m.defaults,d.fn.selectize.support={validity:Z},m.define("auto_position",function(){var e=this;const t={top:"top",bottom:"bottom"};e.positionDropdown=function(){return function(){const i=this.$control,n=this.settings.dropdownParent==="body"?i.offset():i.position();n.top+=i.outerHeight(!0);const r=this.$dropdown.prop("scrollHeight")+5,s=this.$control.get(0).getBoundingClientRect().top,o=this.$wrapper.height(),a=e.$control.get(0).getBoundingClientRect().bottom,l=s+r+o>window.innerHeight&&a-r-o>=0?t.top:t.bottom;let c=this.$wrapper[0].style.width!=="fit-content"?this.settings.dropdownParent==="body"?"max-content":"100%":"max-content";const u={width:c,minWidth:i.outerWidth(!0),left:n.left};if(l===t.top){const f={bottom:n.top,top:"unset"};this.settings.dropdownParent==="body"&&(f.top=n.top-this.$dropdown.outerHeight(!0)-i.outerHeight(!0),f.bottom="unset"),Object.assign(u,f),this.$dropdown.addClass("selectize-position-top"),this.$control.addClass("selectize-position-top")}else Object.assign(u,{top:n.top,bottom:"unset"}),this.$dropdown.removeClass("selectize-position-top"),this.$control.removeClass("selectize-position-top");this.settings.dropdownParent!=="body"&&c==="max-content"&&i.outerWidth(!0)>=this.$dropdown.outerWidth(!0)&&(c="100%"),this.$dropdown.css(u)}}()}),m.define("auto_select_on_type",function(e){var t=this;t.onBlur=function(){var i=t.onBlur;return function(n){var r=t.getFirstItemMatchedByTextContent(t.lastValue,!0);return typeof r.attr("data-value")!="undefined"&&t.getValue()!==r.attr("data-value")&&t.setValue(r.attr("data-value")),i.apply(this,arguments)}}()}),m.define("autofill_disable",function(e){var t=this;t.setup=function(){var i=t.setup;return function(){i.apply(t,arguments),t.$control_input.attr({name:G(21),autocomplete:G(21)})}}()}),m.define("clear_button",function(e){var t=this;e=d.extend({title:"Clear",className:"clear",label:"\xD7",html:function(i){return' '+i.label+""}},e),t.setup=function(){var i=t.setup;return function(){i.apply(t,arguments),t.$button_clear=d(e.html(e)),t.settings.mode==="single"&&t.$wrapper.addClass("single"),t.$wrapper.append(t.$button_clear),(t.getValue()===""||t.getValue().length===0)&&t.$wrapper.find("."+e.className).css("display","none"),t.on("change",function(){t.getValue()===""||t.getValue().length===0?t.$wrapper.find("."+e.className).css("display","none"):t.$wrapper.find("."+e.className).css("display","")}),t.$wrapper.on("click","."+e.className,function(n){n.preventDefault(),n.stopImmediatePropagation(),n.stopPropagation(),!t.isLocked&&(t.clear(),t.$wrapper.find("."+e.className).css("display","none"))})}}()}),m.define("drag_drop",function(e){if(!d.fn.sortable)throw new Error('The "drag_drop" plugin requires jQuery UI "sortable".');if(this.settings.mode==="multi"){var t=this;t.lock=function(){var i=t.lock;return function(){var n=t.$control.data("sortable");return n&&n.disable(),i.apply(t,arguments)}}(),t.unlock=function(){var i=t.unlock;return function(){var n=t.$control.data("sortable");return n&&n.enable(),i.apply(t,arguments)}}(),t.setup=function(){var i=t.setup;return function(){i.apply(this,arguments);var n=t.$control.sortable({items:"[data-value]",forcePlaceholderSize:!0,disabled:t.isLocked,start:function(r,s){s.placeholder.css("width",s.helper.css("width")),n.addClass("dragging")},stop:function(){n.removeClass("dragging");var r=t.$activeItems?t.$activeItems.slice():null,s=[];n.children("[data-value]").each(function(){s.push(d(this).attr("data-value"))}),t.isFocused=!1,t.setValue(s),t.isFocused=!0,t.setActiveItem(r),t.positionDropdown()}})}}()}}),m.define("dropdown_header",function(e){var t=this;e=d.extend({title:"Untitled",headerClass:"selectize-dropdown-header",titleRowClass:"selectize-dropdown-header-title",labelClass:"selectize-dropdown-header-label",closeClass:"selectize-dropdown-header-close",html:function(i){return'
'+i.title+'×
'}},e),t.setup=function(){var i=t.setup;return function(){i.apply(t,arguments),t.$dropdown_header=d(e.html(e)),t.$dropdown.prepend(t.$dropdown_header),t.$dropdown_header.find("."+e.closeClass).on("click",function(){t.close()})}}()}),m.define("optgroup_columns",function(e){var t=this;e=d.extend({equalizeWidth:!0,equalizeHeight:!0},e),this.getAdjacentOption=function(r,s){var o=r.closest("[data-group]").find("[data-selectable]"),a=o.index(r)+s;return a>=0&&a
',r=r.firstChild,o.body.appendChild(r),s=i.width=r.offsetWidth-r.clientWidth,o.body.removeChild(r)),s},n=function(){var r,s,o,a,l,c,u;if(u=d("[data-group]",t.$dropdown_content),s=u.length,!(!s||!t.$dropdown_content.width())){if(e.equalizeHeight){for(o=0,r=0;r1&&(l=c-a*(s-1),u.eq(s-1).css({width:l})))}};(e.equalizeHeight||e.equalizeWidth)&&(L.after(this,"positionDropdown",n),L.after(this,"refreshOptions",n))}),m.define("read-only",function(e){var t=this;this.setup=function(){var i=t.setup;return function(){i.apply(this,arguments),this.$dropdown.hasClass("read-only")&&this.$control_input.attr("readonly","readonly")}}(),this.readonly=function(){return function(i){i?(this.$control_input.attr("readonly","readonly"),this.$dropdown.addClass("read-only")):(this.$control_input.removeAttr("readonly"),this.$dropdown.removeClass("read-only"))}}()}),m.define("remove_button",function(e){if(this.settings.mode!=="single"){e=d.extend({label:"×",title:"Remove",className:"remove",append:!0},e);var t=function(i,n){var r=i,s=''+n.label+"",o=function(a,l){var c=a.search(/(<\/[^>]+>\s*)$/);return a.substring(0,c)+l+a.substring(c)};i.setup=function(){var a=r.setup;return function(){if(n.append){var l=r.settings.render.item;r.settings.render.item=function(c){return o(l.apply(i,arguments),s)}}a.apply(i,arguments),i.$control.on("click","."+n.className,function(c){if(c.preventDefault(),!r.isLocked){var u=d(c.currentTarget).parent();return r.setActiveItem(u),r.deleteSelection()&&r.setCaret(r.items.length),!1}})}}()};t(this,e)}}),m.define("restore_on_backspace",function(e){var t=this;e.text=e.text||function(i){return i[this.settings.labelField]},this.onKeyDown=function(){var i=t.onKeyDown;return function(n){var r,s;if(n.keyCode===V&&this.$control_input.val()===""&&!this.$activeItems.length&&(r=this.caretPos-1,r>=0&&r"+(o.length-a)+""))}}(),this.onFocus=function(i){const n=t.onFocus;return function(r){if(n.apply(this,r),!r)return;const s=this.$control;s.find(".item").show(),s.find("span").remove()}}()}),m}); +(function(d,k){typeof define=="function"&&define.amd?define(["jquery"],k):typeof module=="object"&&typeof module.exports=="object"?module.exports=k(require("jquery")):d.Selectize=k(d.jQuery)})(this,function(d){"use strict";var k=function(e,t){if(!(typeof t=="string"&&!t.length)){var i=typeof t=="string"?new RegExp(t,"i"):t,n=function(r){var s=0;if(r.nodeType===3){var o=r.data.search(i);if(o>=0&&r.data.length>0){var a=r.data.match(i),l=document.createElement("span");l.className="highlight";var c=r.splitText(o),u=c.splitText(a[0].length),f=c.cloneNode(!0);l.appendChild(f),c.parentNode.replaceChild(l,c),s=1}}else if(r.nodeType===1&&r.childNodes&&!/(script|style)/i.test(r.tagName)&&(r.className!=="highlight"||r.tagName!=="SPAN"))for(var h=0;hcrypto.getRandomValues(new Uint8Array(e)).reduce((t,i)=>t+=(i&=63)<36?i.toString(36):i<62?(i-26).toString(36).toUpperCase():i>62?"-":"_","");var A=function(e,t){this.items=e,this.settings=t||{diacritics:!0}};A.prototype.tokenize=function(e,t){if(e=se(String(e||"").toLowerCase()),!e||!e.length)return[];var i,n,r,s,o=[],a=e.split(/ +/);for(i=0,n=a.length;i0)&&s.items.push({score:r,id:u})}):i.iterator(i.items,function(c,u){s.items.push({score:1,id:u})}),a=i.getSortFunction(s,t),a&&s.items.sort(a),s.total=s.items.length,typeof t.limit=="number"&&(s.items=s.items.slice(0,t.limit)),s};var Q=function(e,t){return typeof e=="number"&&typeof t=="number"?e>t?1:et?1:t>e?-1:0)},re=function(e,t){var i,n,r,s;for(i=1,n=arguments.length;i/g,">").replace(/"/g,""")},Ie=function(e){return(e+"").replace(/\$/g,"$$$$")},L={};L.before=function(e,t,i){var n=e[t];e[t]=function(){return i.apply(e,arguments),n.apply(e,arguments)}},L.after=function(e,t,i){var n=e[t];e[t]=function(){var r=n.apply(e,arguments);return i.apply(e,arguments),r}};var ye=function(e){var t=!1;return function(){t||(t=!0,e.apply(this,arguments))}},Oe=function(e,t){var i;return function(){var n=this,r=arguments;window.clearTimeout(i),i=window.setTimeout(function(){e.apply(n,r)},t)}},te=function(e,t,i){var n,r=e.trigger,s={};e.trigger=function(){var o=arguments[0];if(t.indexOf(o)!==-1)s[o]=arguments;else return r.apply(e,arguments)},i.apply(e,[]),e.trigger=r;for(n in s)s.hasOwnProperty(n)&&r.apply(e,s[n])},be=function(e,t,i,n){e.on(t,i,function(r){for(var s=r.target;s&&s.parentNode!==e[0];)s=s.parentNode;return r.currentTarget=s,n.apply(this,[r])})},R=function(e){var t={};if(e===void 0)return console.warn("WARN getInputSelection cannot locate input control"),t;if("selectionStart"in e)t.start=e.selectionStart,t.length=e.selectionEnd-t.start;else if(document.selection){e.focus();var i=document.selection.createRange(),n=document.selection.createRange().text.length;i.moveStart("character",-e.value.length),t.start=i.text.length-n,t.length=n}return t},_e=function(e,t,i){var n,r,s={};if(i)for(n=0,r=i.length;n").css({position:"absolute",width:"auto",padding:0,whiteSpace:"pre"}),d("
").css({position:"absolute",width:0,height:0,overflow:"hidden"}).attr({"aria-hidden":!0}).append(w.$testInput).appendTo("body")),w.$testInput.text(e),_e(t,w.$testInput,["letterSpacing","fontSize","fontFamily","fontWeight","textTransform"]),w.$testInput.width()):0},Ce=function(e){var t=null,i=function(n,r){var s,o,a,g,l,c,u,f,h;if(n=n||window.event||{},r=r||{},!(n.metaKey||n.altKey)&&!(!r.force&&e.data("grow")===!1)){s=e.val(),n.type&&n.type.toLowerCase()==="keydown"&&(o=n.keyCode,a=o>=48&&o<=57||o>=65&&o<=90||o>=96&&o<=111||o>=186&&o<=222||o===32,o===q||o===z?(h=R(e[0]),h.length?s=s.substring(0,h.start)+s.substring(h.start+h.length):o===z&&h.start?s=s.substring(0,h.start-1)+s.substring(h.start+1):o===q&&typeof h.start!="undefined"&&(s=s.substring(0,h.start)+s.substring(h.start+1))):a&&(u=n.shiftKey,f=String.fromCharCode(n.keyCode),u?f=f.toUpperCase():f=f.toLowerCase(),s+=f));var g=e.attr("readonly")?0:4;l=e.attr("placeholder"),l?c=ie(l,e)+g:c=0,g=Math.max(ie(s,e),c)+g,g!==t&&(t=g,e.width(g),e.triggerHandler("resize"))}};e.on("keydown keyup update blur",i),i()},$e=function(e){var t=document.createElement("div");return t.appendChild(e.cloneNode(!0)),t.innerHTML},Fe=function(e,t){t||(t={});var i="Selectize";console.error(i+": "+e),t.explanation&&(console.group&&console.group(),console.error(t.explanation),console.group&&console.groupEnd())},xe=function(e){try{JSON.parse(e)}catch(t){return!1}return!0};function ne(e,t){return navigator.userAgentData?e===navigator.userAgentData.platform:t.test(navigator.userAgent)}var w=function(e,t){var i,n,r,s,o,a=this;o=e[0],o.selectize=a;var l=window.getComputedStyle&&window.getComputedStyle(o,null);if(s=l?l.getPropertyValue("direction"):o.currentStyle&&o.currentStyle.direction,s=s||e.parents("[dir]:first").attr("dir")||"",a.settings={},++w.count,d.extend(a,{order:0,settings:t,$input:e,tabIndex:e.attr("tabindex")||"",tagType:o.tagName.toLowerCase()==="select"?K:me,rtl:/rtl/i.test(s),eventNS:".selectize-"+new Date().getTime()+"-"+Math.random().toString(36).substr(2,5),highlightedValue:null,isBlurring:!1,isOpen:!1,isDisabled:!1,isRequired:e.is("[required]"),isInvalid:!1,isLocked:!1,isFocused:!1,isInputHidden:!1,isSetup:!1,isShiftDown:!1,isCmdDown:!1,isCtrlDown:!1,ignoreFocus:!1,ignoreBlur:!1,ignoreHover:!1,hasOptions:!1,currentResults:null,lastValue:"",lastValidValue:"",lastOpenTarget:!1,caretPos:0,loading:0,loadedSearches:{},isDropdownClosing:!1,$activeOption:null,$activeItems:[],optgroups:{},options:{},userOptions:{},items:[],renderCache:{},onSearchChange:t.loadThrottle===null?a.onSearchChange:Oe(a.onSearchChange,t.loadThrottle)}),a.sifter=new A(this.options,{diacritics:t.diacritics}),a.settings.options){for(n=0,r=a.settings.options.length;n").addClass(t.wrapperClass).addClass(y+" selectize-control").addClass(h),a=d("
").addClass(t.inputClass+x+" selectize-input items").appendTo(o),l=d('').appendTo(a).attr("tabindex",s.is(":disabled")?"-1":e.tabIndex),f=d(t.dropdownParent||o),c=d("
").addClass(t.dropdownClass).addClass(h+" selectize-dropdown").hide().appendTo(f),u=d("
").addClass(t.dropdownContentClass+" selectize-dropdown-content").attr("tabindex","-1").appendTo(c),(p=s.attr("id"))&&(l.attr("id",p+"-selectized"),d("label[for='"+p+"']").attr("for",p+"-selectized")),e.settings.copyClassesToDropdown&&c.addClass(y),o.css({width:s[0].style.width}),e.plugins.names.length&&(O="plugin-"+e.plugins.names.join(" plugin-"),o.addClass(O),c.addClass(O)),(t.maxItems===null||t.maxItems>1)&&e.tagType===K&&s.attr("multiple","multiple"),e.settings.placeholder&&l.attr("placeholder",t.placeholder),e.settings.search||(l.attr("readonly",!0),l.attr("inputmode","none"),a.css("cursor","pointer")),!e.settings.splitOn&&e.settings.delimiter){var _=e.settings.delimiter.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&");e.settings.splitOn=new RegExp("\\s*"+_+"+\\s*")}s.attr("autocorrect")&&l.attr("autocorrect",s.attr("autocorrect")),s.attr("autocapitalize")&&l.attr("autocapitalize",s.attr("autocapitalize")),s.is("input")&&(l[0].type=s[0].type),e.$wrapper=o,e.$control=a,e.$control_input=l,e.$dropdown=c,e.$dropdown_content=u,c.on("mouseenter mousedown mouseup click","[data-disabled]>[data-selectable]",function(m){m.stopImmediatePropagation()}),c.on("mouseenter","[data-selectable]",function(){return e.onOptionHover.apply(e,arguments)}),c.on("mouseup click","[data-selectable]",function(){return e.onOptionSelect.apply(e,arguments)}),be(a,"mouseup","*:not(input)",function(){return e.onItemSelect.apply(e,arguments)}),Ce(l),a.on({mousedown:function(){return e.onMouseDown.apply(e,arguments)},click:function(){return e.onClick.apply(e,arguments)}}),l.on({mousedown:function(m){(e.$control_input.val()!==""||e.settings.openOnFocus)&&m.stopPropagation()},keydown:function(){return e.onKeyDown.apply(e,arguments)},keypress:function(){return e.onKeyPress.apply(e,arguments)},input:function(){return e.onInput.apply(e,arguments)},resize:function(){e.positionDropdown.apply(e,[])},blur:function(){return e.onBlur.apply(e,arguments)},focus:function(){return e.onFocus.apply(e,arguments)},paste:function(){return e.onPaste.apply(e,arguments)}}),r.on("keydown"+i,function(m){e.isCmdDown=m[P?"metaKey":"ctrlKey"],e.isCtrlDown=m[P?"altKey":"ctrlKey"],e.isShiftDown=m.shiftKey}),r.on("keyup"+i,function(m){m.keyCode===ve&&(e.isCtrlDown=!1),m.keyCode===he&&(e.isShiftDown=!1),m.keyCode===ge&&(e.isCmdDown=!1)}),r.on("mousedown"+i,function(m){if(e.isFocused){if(m.target===e.$dropdown[0]||e.$dropdown.has(m.target).length)return!1;m.target!==e.$control[0]&&e.blur(m.target)}}),n.on(["scroll"+i,"resize"+i].join(" "),function(){e.isOpen&&e.positionDropdown.apply(e,arguments)}),n.on("mousemove"+i,function(){e.ignoreHover=e.settings.ignoreHover}),this.revertSettings={$children:s.children().detach(),tabindex:s.attr("tabindex")},s.attr("tabindex",-1).hide().after(e.$wrapper),Array.isArray(t.items)&&(e.lastValidValue=t.items,e.setValue(t.items),delete t.items),Z&&s.on("invalid"+i,function(m){m.preventDefault(),e.isInvalid=!0,e.refreshState()}),e.updateOriginalInput(),e.refreshItems(),e.refreshState(),e.updatePlaceholder(),e.isSetup=!0,s.is(":disabled")&&e.disable(),e.on("change",this.onChange),s.data("selectize",e),s.addClass("selectized"),e.trigger("initialize"),t.preload===!0&&e.onSearchChange("")},setupTemplates:function(){var e=this,t=e.settings.labelField,i=e.settings.valueField,n=e.settings.optgroupLabelField,r={optgroup:function(s){return'
'+s.html+"
"},optgroup_header:function(s,o){return'
'+o(s[n])+"
"},option:function(s,o){var a=s.classes?" "+s.classes:"";a+=s[i]===""?" selectize-dropdown-emptyoptionlabel":"";var l=s.styles?' style="'+s.styles+'"':"";return"'+o(s[t])+"
"},item:function(s,o){return'
'+o(s[t])+"
"},option_create:function(s,o){return'
Add '+o(s.input)+"
"}};e.settings.render=d.extend({},r,e.settings.render)},setupCallbacks:function(){var e,t,i={initialize:"onInitialize",change:"onChange",item_add:"onItemAdd",item_remove:"onItemRemove",clear:"onClear",option_add:"onOptionAdd",option_remove:"onOptionRemove",option_clear:"onOptionClear",optgroup_add:"onOptionGroupAdd",optgroup_remove:"onOptionGroupRemove",optgroup_clear:"onOptionGroupClear",dropdown_open:"onDropdownOpen",dropdown_close:"onDropdownClose",type:"onType",load:"onLoad",focus:"onFocus",blur:"onBlur",dropdown_item_activate:"onDropdownItemActivate",dropdown_item_deactivate:"onDropdownItemDeactivate"};for(e in i)i.hasOwnProperty(e)&&(t=this.settings[i[e]],t&&this.on(e,t))},onClick:function(e){var t=this;t.isDropdownClosing||(!t.isFocused||!t.isOpen)&&(t.focus(),e.preventDefault())},onMouseDown:function(e){var t=this,i=e.isDefaultPrevented(),n=d(e.target);if(t.isFocused||i||window.setTimeout(function(){t.isOpen||t.focus()},0),n!==t.$control_input[0]||t.$control_input.val()==="")return t.settings.mode==="single"?t.isOpen?t.close():t.open():(i||t.setActiveItem(null),t.settings.openOnFocus||(t.isOpen&&n===t.lastOpenTarget?(t.close(),t.lastOpenTarget=!1):(t.isOpen||(t.refreshOptions(),t.open()),t.lastOpenTarget=n))),!1},onChange:function(){var e=this;e.getValue()!==""&&(e.lastValidValue=e.getValue()),this.$input.trigger("input"),this.$input.trigger("change")},onPaste:function(e){var t=this;if(t.isFull()||t.isInputHidden||t.isLocked){e.preventDefault();return}t.settings.splitOn&&setTimeout(function(){var i=t.$control_input.val();if(!!i.match(t.settings.splitOn))for(var n=i.trim().split(t.settings.splitOn),r=0,s=n.length;ra&&(c=o,o=a,a=c),r=o;r<=a;r++)l=i.$control[0].childNodes[r],i.$activeItems.indexOf(l)===-1&&(d(l).addClass("active"),i.$activeItems.push(l));t.preventDefault()}else n==="mousedown"&&i.isCtrlDown||n==="keydown"&&this.isShiftDown?e.hasClass("active")?(s=i.$activeItems.indexOf(e[0]),i.$activeItems.splice(s,1),e.removeClass("active")):i.$activeItems.push(e.addClass("active")[0]):(d(i.$activeItems).removeClass("active"),i.$activeItems=[e.addClass("active")[0]]);i.hideInput(),this.isFocused||i.focus()}},setActiveOption:function(e,t,i){var n,r,s,o,a,l=this;l.$activeOption&&(l.$activeOption.removeClass("active"),l.trigger("dropdown_item_deactivate",l.$activeOption.attr("data-value"))),l.$activeOption=null,e=d(e),e.length&&(l.$activeOption=e.addClass("active"),l.isOpen&&l.trigger("dropdown_item_activate",l.$activeOption.attr("data-value")),(t||!ee(t))&&(n=l.$dropdown_content.height(),r=l.$activeOption.outerHeight(!0),t=l.$dropdown_content.scrollTop()||0,s=l.$activeOption.offset().top-l.$dropdown_content.offset().top+t,o=s,a=s-n+r,s+r>n+t?l.$dropdown_content.stop().animate({scrollTop:a},i?l.settings.scrollDuration:0):s=0;t--)o.items.indexOf(F(r.items[t].id))!==-1&&r.items.splice(t,1);return r},refreshOptions:function(e){var t,i,n,r,s,o,a,l,c,u,f,h,g,v,y,O;typeof e=="undefined"&&(e=!0);var p=this,x=p.$control_input.val().trim(),_=p.search(x),m=p.$dropdown_content,E=p.$activeOption&&F(p.$activeOption.attr("data-value"));for(r=_.items.length,typeof p.settings.maxOptions=="number"&&(r=Math.min(r,p.settings.maxOptions)),s={},o=[],t=0;t0||g&&p.settings.showAddOptionOnCreate||p.settings.setFirstOptionActive,p.hasOptions?(_.items.length>0?(y=E&&p.getOption(E),_.query!==""&&p.settings.setFirstOptionActive?v=m.find("[data-selectable]:first"):_.query!==""&&y&&y.length?v=y:p.settings.mode==="single"&&p.items.length&&(v=p.getOption(p.items[0])),(!v||!v.length)&&(O&&!p.settings.addPrecedence?v=p.getAdjacentOption(O,1):v=m.find("[data-selectable]:first"))):v=O,p.setActiveOption(v),e&&!p.isOpen&&p.open()):(p.setActiveOption(null),e&&p.isOpen&&p.close())},addOption:function(e){var t,i,n,r=this;if(Array.isArray(e)){for(t=0,i=e.length;t0?e.eq(0):d()},getAdjacentOption:function(e,t){var i=this.$dropdown.find("[data-selectable]"),n=i.index(e)+t;return n>=0&&n0),e.$control_input.data("grow",!t&&!i)},isFull:function(){return this.settings.maxItems!==null&&this.items.length>=this.settings.maxItems},updateOriginalInput:function(e){var t,i,n,r,s,o,a,l,c,u=this;e=e||{},u.tagType===K?(o=u.$input.find("option"),n=[],r=[],s=[],c=[],o.get().forEach(function(f){n.push(f.value)}),u.items.forEach(function(f){a=u.options[f][u.settings.labelField]||"",c.push(f),n.indexOf(f)==-1&&r.push('")}),s=n.filter(function(f){return c.indexOf(f)<0}).map(function(f){return'option[value="'+T(f)+'"]'}),n.length-s.length+r.length===0&&!u.$input.attr("multiple")&&r.push(''),u.$input.find(s.join(", ")).remove(),u.$input.append(r.join(""))):(u.$input.val(u.getValue()),u.$input.attr("value",u.$input.val())),u.isSetup&&(e.silent||u.trigger("change",u.$input.val()))},updatePlaceholder:function(){if(!!this.settings.placeholder){var e=this.$control_input;this.items.length?e.removeAttr("placeholder"):e.attr("placeholder",this.settings.placeholder),e.triggerHandler("update",{force:!0})}},open:function(){var e=this;e.isLocked||e.isOpen||e.settings.mode==="multi"&&e.isFull()||(e.focus(),e.isOpen=!0,e.refreshState(),e.$dropdown.css({visibility:"hidden",display:"block"}),e.setupDropdownHeight(),e.positionDropdown(),e.$dropdown.css({visibility:"visible"}),e.trigger("dropdown_open",e.$dropdown))},close:function(){var e=this,t=e.isOpen;e.settings.mode==="single"&&e.items.length&&(e.hideInput(),e.isBlurring&&e.$control_input[0].blur()),e.isOpen=!1,e.$dropdown.hide(),e.setActiveOption(null),e.refreshState(),t&&e.trigger("dropdown_close",e.$dropdown)},positionDropdown:function(){var e=this.$control,t=this.settings.dropdownParent==="body"?e.offset():e.position();t.top+=e.outerHeight(!0);var i=this.$wrapper[0].style.width!=="fit-content"?this.settings.dropdownParent==="body"?"max-content":"100%":"max-content";this.settings.minWidth&&this.settings.minWidth>i&&(i=this.settings.minWidth),this.settings.dropdownParent!=="body"&&i==="max-content"&&e.outerWidth(!0)>=this.$dropdown.outerWidth(!0)&&(i="100%"),this.$dropdown.css({width:i,minWidth:e.outerWidth(!0),top:t.top,left:t.left})},setupDropdownHeight:function(){if(typeof this.settings.dropdownSize=="object"&&this.settings.dropdownSize.sizeType!=="auto"){var e=this.settings.dropdownSize.sizeValue;if(this.settings.dropdownSize.sizeType==="numberItems"){for(var t=this.$dropdown_content.find("*").not(".optgroup, .highlight").not(this.settings.ignoreOnDropwdownHeight),i=0,n=0,r=0,s=0,o=0;o0?"last":"first")),o=u.$control.children(":not(input)").index(c),n>0&&o++,t=0,i=u.$activeItems.length;t0&&r.start===u.$control_input.val().length&&s.push(u.items[u.caretPos]));if(!s.length||typeof u.settings.onDelete=="function"&&u.settings.onDelete.apply(u,[s])===!1)return!1;for(typeof o!="undefined"&&u.setCaret(o);s.length;)u.removeItem(s.pop());return u.showInput(),u.positionDropdown(),u.refreshOptions(!0),a&&(l=u.getOption(a),l.length&&u.setActiveOption(l)),!0},advanceSelection:function(e,t){var i,n,r,s,o,a,l=this;e!==0&&(l.rtl&&(e*=-1),i=e>0?"last":"first",n=R(l.$control_input[0]),l.isFocused&&!l.isInputHidden?(s=l.$control_input.val().length,o=e<0?n.start===0&&n.length===0:n.start===s,o&&!s&&l.advanceCaret(e,t)):(a=l.$control.children(".active:"+i),a.length&&(r=l.$control.children(":not(input)").index(a),l.setActiveItem(null),l.setCaret(e>0?r+1:r))))},advanceCaret:function(e,t){var i=this,n,r;e!==0&&(n=e>0?"next":"prev",i.isShiftDown?(r=i.$control_input[n](),r.length&&(i.hideInput(),i.setActiveItem(r),t&&t.preventDefault())):i.setCaret(i.caretPos+e))},setCaret:function(e){var t=this;if(t.settings.mode==="single"?e=t.items.length:e=Math.max(0,Math.min(t.items.length,e)),!t.isPending){var i,n,r,s,o;for(s=t.$control.children(":not(input)"),i=0,n=s.length;i'+p+""+O)}var x={placeholder:y,options:[],optgroups:[],items:[]};v==="select"?f(g,x):u(g,x),h=new w(g,d.extend(!0,{},t,x,e)),h.settings_user=e}})},d.fn.selectize.defaults=w.defaults,d.fn.selectize.support={validity:Z},w.define("auto_position",function(){var e=this;const t={top:"top",bottom:"bottom"};e.positionDropdown=function(){return function(){const i=this.$control,n=this.settings.dropdownParent==="body"?i.offset():i.position();n.top+=i.outerHeight(!0);const r=this.$dropdown.prop("scrollHeight")+5,s=this.$control.get(0).getBoundingClientRect().top,o=this.$wrapper.height(),a=e.$control.get(0).getBoundingClientRect().bottom,l=s+r+o>window.innerHeight&&a-r-o>=0?t.top:t.bottom;let c=this.$wrapper[0].style.width!=="fit-content"?this.settings.dropdownParent==="body"?"max-content":"100%":"max-content";const u={width:c,minWidth:i.outerWidth(!0),left:n.left};if(l===t.top){const f={bottom:n.top,top:"unset"};this.settings.dropdownParent==="body"&&(f.top=n.top-this.$dropdown.outerHeight(!0)-i.outerHeight(!0),f.bottom="unset"),Object.assign(u,f),this.$dropdown.addClass("selectize-position-top"),this.$control.addClass("selectize-position-top")}else Object.assign(u,{top:n.top,bottom:"unset"}),this.$dropdown.removeClass("selectize-position-top"),this.$control.removeClass("selectize-position-top");this.settings.dropdownParent!=="body"&&c==="max-content"&&i.outerWidth(!0)>=this.$dropdown.outerWidth(!0)&&(c="100%"),this.$dropdown.css(u)}}()}),w.define("auto_select_on_type",function(e){var t=this;t.onBlur=function(){var i=t.onBlur;return function(n){var r=t.getFirstItemMatchedByTextContent(t.lastValue,!0);return typeof r.attr("data-value")!="undefined"&&t.getValue()!==r.attr("data-value")&&t.setValue(r.attr("data-value")),i.apply(this,arguments)}}()}),w.define("autofill_disable",function(e){var t=this;t.setup=function(){var i=t.setup;return function(){i.apply(t,arguments),t.$control_input.attr({name:G(21),autocomplete:G(21)})}}()}),w.define("clear_button",function(e){var t=this;e=d.extend({title:"Clear",className:"clear",label:"\xD7",html:function(i){return' '+i.label+""}},e),t.setup=function(){var i=t.setup;return function(){i.apply(t,arguments),t.$button_clear=d(e.html(e)),t.settings.mode==="single"&&t.$wrapper.addClass("single"),t.$wrapper.append(t.$button_clear),(t.getValue()===""||t.getValue().length===0)&&t.$wrapper.find("."+e.className).css("display","none"),t.on("change",function(){t.getValue()===""||t.getValue().length===0?t.$wrapper.find("."+e.className).css("display","none"):t.$wrapper.find("."+e.className).css("display","")}),t.$wrapper.on("click","."+e.className,function(n){n.preventDefault(),n.stopImmediatePropagation(),n.stopPropagation(),!t.isLocked&&(t.clear(),t.$wrapper.find("."+e.className).css("display","none"))})}}()}),w.define("drag_drop",function(e){if(!d.fn.sortable)throw new Error('The "drag_drop" plugin requires jQuery UI "sortable".');if(this.settings.mode==="multi"){var t=this;t.lock=function(){var i=t.lock;return function(){var n=t.$control.data("sortable");return n&&n.disable(),i.apply(t,arguments)}}(),t.unlock=function(){var i=t.unlock;return function(){var n=t.$control.data("sortable");return n&&n.enable(),i.apply(t,arguments)}}(),t.setup=function(){var i=t.setup;return function(){i.apply(this,arguments);var n=t.$control.sortable({items:"[data-value]",forcePlaceholderSize:!0,disabled:t.isLocked,start:function(r,s){s.placeholder.css("width",s.helper.css("width")),n.addClass("dragging")},stop:function(){n.removeClass("dragging");var r=t.$activeItems?t.$activeItems.slice():null,s=[];n.children("[data-value]").each(function(){s.push(d(this).attr("data-value"))}),t.isFocused=!1,t.setValue(s),t.isFocused=!0,t.setActiveItem(r),t.positionDropdown()}})}}()}}),w.define("dropdown_header",function(e){var t=this;e=d.extend({title:"Untitled",headerClass:"selectize-dropdown-header",titleRowClass:"selectize-dropdown-header-title",labelClass:"selectize-dropdown-header-label",closeClass:"selectize-dropdown-header-close",html:function(i){return'
'+i.title+'×
'}},e),t.setup=function(){var i=t.setup;return function(){i.apply(t,arguments),t.$dropdown_header=d(e.html(e)),t.$dropdown.prepend(t.$dropdown_header),t.$dropdown_header.find("."+e.closeClass).on("click",function(){t.close()})}}()}),w.define("optgroup_columns",function(e){var t=this;e=d.extend({equalizeWidth:!0,equalizeHeight:!0},e),this.getAdjacentOption=function(r,s){var o=r.closest("[data-group]").find("[data-selectable]"),a=o.index(r)+s;return a>=0&&a
',r=r.firstChild,o.body.appendChild(r),s=i.width=r.offsetWidth-r.clientWidth,o.body.removeChild(r)),s},n=function(){var r,s,o,a,l,c,u;if(u=d("[data-group]",t.$dropdown_content),s=u.length,!(!s||!t.$dropdown_content.width())){if(e.equalizeHeight){for(o=0,r=0;r1&&(l=c-a*(s-1),u.eq(s-1).css({width:l})))}};(e.equalizeHeight||e.equalizeWidth)&&(L.after(this,"positionDropdown",n),L.after(this,"refreshOptions",n))}),w.define("read-only",function(e){var t=this;this.setup=function(){var i=t.setup;return function(){i.apply(this,arguments),this.$dropdown.hasClass("read-only")&&this.$control_input.attr("readonly","readonly")}}(),this.readonly=function(){return function(i){i?(this.$control_input.attr("readonly","readonly"),this.$dropdown.addClass("read-only")):(this.$control_input.removeAttr("readonly"),this.$dropdown.removeClass("read-only"))}}()}),w.define("remove_button",function(e){if(this.settings.mode!=="single"){e=d.extend({label:"×",title:"Remove",className:"remove",append:!0},e);var t=function(i,n){var r=i,s=''+n.label+"",o=function(a,l){var c=a.search(/(<\/[^>]+>\s*)$/);return a.substring(0,c)+l+a.substring(c)};i.setup=function(){var a=r.setup;return function(){if(n.append){var l=r.settings.render.item;r.settings.render.item=function(c){return o(l.apply(i,arguments),s)}}a.apply(i,arguments),i.$control.on("click","."+n.className,function(c){if(c.preventDefault(),!r.isLocked){var u=d(c.currentTarget).parent();return r.setActiveItem(u),r.deleteSelection()&&r.setCaret(r.items.length),!1}})}}()};t(this,e)}}),w.define("restore_on_backspace",function(e){var t=this;e.text=e.text||function(i){return i[this.settings.labelField]},this.onKeyDown=function(){var i=t.onKeyDown;return function(n){var r,s;if(n.keyCode===z&&this.$control_input.val()===""&&!this.$activeItems.length&&(r=this.caretPos-1,r>=0&&r"+(o.length-a)+""))}}(),this.onFocus=function(i){const n=t.onFocus;return function(r){if(n.apply(this,r),!r)return;const s=this.$control;s.find(".item").show(),s.find("span").remove()}}()}),w}); diff --git a/inst/www/shared/shiny.js b/inst/www/shared/shiny.js index aeff68aa39..db9880f266 100644 --- a/inst/www/shared/shiny.js +++ b/inst/www/shared/shiny.js @@ -3227,6 +3227,194 @@ } }); + // node_modules/core-js/internals/iterator-close.js + var require_iterator_close = __commonJS({ + "node_modules/core-js/internals/iterator-close.js": function(exports, module) { + var call8 = require_function_call(); + var anObject10 = require_an_object(); + var getMethod5 = require_get_method(); + module.exports = function(iterator, kind, value) { + var innerResult, innerError; + anObject10(iterator); + try { + innerResult = getMethod5(iterator, "return"); + if (!innerResult) { + if (kind === "throw") + throw value; + return value; + } + innerResult = call8(innerResult, iterator); + } catch (error) { + innerError = true; + innerResult = error; + } + if (kind === "throw") + throw value; + if (innerError) + throw innerResult; + anObject10(innerResult); + return value; + }; + } + }); + + // node_modules/core-js/internals/call-with-safe-iteration-closing.js + var require_call_with_safe_iteration_closing = __commonJS({ + "node_modules/core-js/internals/call-with-safe-iteration-closing.js": function(exports, module) { + var anObject10 = require_an_object(); + var iteratorClose = require_iterator_close(); + module.exports = function(iterator, fn, value, ENTRIES) { + try { + return ENTRIES ? fn(anObject10(value)[0], value[1]) : fn(value); + } catch (error) { + iteratorClose(iterator, "throw", error); + } + }; + } + }); + + // node_modules/core-js/internals/is-array-iterator-method.js + var require_is_array_iterator_method = __commonJS({ + "node_modules/core-js/internals/is-array-iterator-method.js": function(exports, module) { + var wellKnownSymbol6 = require_well_known_symbol(); + var Iterators = require_iterators(); + var ITERATOR2 = wellKnownSymbol6("iterator"); + var ArrayPrototype = Array.prototype; + module.exports = function(it) { + return it !== void 0 && (Iterators.Array === it || ArrayPrototype[ITERATOR2] === it); + }; + } + }); + + // node_modules/core-js/internals/get-iterator-method.js + var require_get_iterator_method = __commonJS({ + "node_modules/core-js/internals/get-iterator-method.js": function(exports, module) { + var classof = require_classof(); + var getMethod5 = require_get_method(); + var isNullOrUndefined5 = require_is_null_or_undefined(); + var Iterators = require_iterators(); + var wellKnownSymbol6 = require_well_known_symbol(); + var ITERATOR2 = wellKnownSymbol6("iterator"); + module.exports = function(it) { + if (!isNullOrUndefined5(it)) + return getMethod5(it, ITERATOR2) || getMethod5(it, "@@iterator") || Iterators[classof(it)]; + }; + } + }); + + // node_modules/core-js/internals/get-iterator.js + var require_get_iterator = __commonJS({ + "node_modules/core-js/internals/get-iterator.js": function(exports, module) { + var call8 = require_function_call(); + var aCallable2 = require_a_callable(); + var anObject10 = require_an_object(); + var tryToString = require_try_to_string(); + var getIteratorMethod = require_get_iterator_method(); + var $TypeError = TypeError; + module.exports = function(argument, usingIterator) { + var iteratorMethod = arguments.length < 2 ? getIteratorMethod(argument) : usingIterator; + if (aCallable2(iteratorMethod)) + return anObject10(call8(iteratorMethod, argument)); + throw $TypeError(tryToString(argument) + " is not iterable"); + }; + } + }); + + // node_modules/core-js/internals/array-from.js + var require_array_from = __commonJS({ + "node_modules/core-js/internals/array-from.js": function(exports, module) { + "use strict"; + var bind2 = require_function_bind_context(); + var call8 = require_function_call(); + var toObject5 = require_to_object(); + var callWithSafeIterationClosing = require_call_with_safe_iteration_closing(); + var isArrayIteratorMethod = require_is_array_iterator_method(); + var isConstructor2 = require_is_constructor(); + var lengthOfArrayLike4 = require_length_of_array_like(); + var createProperty5 = require_create_property(); + var getIterator = require_get_iterator(); + var getIteratorMethod = require_get_iterator_method(); + var $Array2 = Array; + module.exports = function from2(arrayLike) { + var O = toObject5(arrayLike); + var IS_CONSTRUCTOR = isConstructor2(this); + var argumentsLength = arguments.length; + var mapfn = argumentsLength > 1 ? arguments[1] : void 0; + var mapping = mapfn !== void 0; + if (mapping) + mapfn = bind2(mapfn, argumentsLength > 2 ? arguments[2] : void 0); + var iteratorMethod = getIteratorMethod(O); + var index = 0; + var length, result, step, iterator, next2, value; + if (iteratorMethod && !(this === $Array2 && isArrayIteratorMethod(iteratorMethod))) { + iterator = getIterator(O, iteratorMethod); + next2 = iterator.next; + result = IS_CONSTRUCTOR ? new this() : []; + for (; !(step = call8(next2, iterator)).done; index++) { + value = mapping ? callWithSafeIterationClosing(iterator, mapfn, [step.value, index], true) : step.value; + createProperty5(result, index, value); + } + } else { + length = lengthOfArrayLike4(O); + result = IS_CONSTRUCTOR ? new this(length) : $Array2(length); + for (; length > index; index++) { + value = mapping ? mapfn(O[index], index) : O[index]; + createProperty5(result, index, value); + } + } + result.length = index; + return result; + }; + } + }); + + // node_modules/core-js/internals/check-correctness-of-iteration.js + var require_check_correctness_of_iteration = __commonJS({ + "node_modules/core-js/internals/check-correctness-of-iteration.js": function(exports, module) { + var wellKnownSymbol6 = require_well_known_symbol(); + var ITERATOR2 = wellKnownSymbol6("iterator"); + var SAFE_CLOSING = false; + try { + called = 0; + iteratorWithReturn = { + next: function() { + return { done: !!called++ }; + }, + "return": function() { + SAFE_CLOSING = true; + } + }; + iteratorWithReturn[ITERATOR2] = function() { + return this; + }; + Array.from(iteratorWithReturn, function() { + throw 2; + }); + } catch (error) { + } + var called; + var iteratorWithReturn; + module.exports = function(exec2, SKIP_CLOSING) { + if (!SKIP_CLOSING && !SAFE_CLOSING) + return false; + var ITERATION_SUPPORT = false; + try { + var object = {}; + object[ITERATOR2] = function() { + return { + next: function() { + return { done: ITERATION_SUPPORT = true }; + } + }; + }; + exec2(object); + } catch (error) { + } + return ITERATION_SUPPORT; + }; + } + }); + // node_modules/core-js/internals/engine-is-node.js var require_engine_is_node = __commonJS({ "node_modules/core-js/internals/engine-is-node.js": function(exports, module) { @@ -3935,101 +4123,23 @@ } }); - // node_modules/core-js/internals/is-array-iterator-method.js - var require_is_array_iterator_method = __commonJS({ - "node_modules/core-js/internals/is-array-iterator-method.js": function(exports, module) { - var wellKnownSymbol6 = require_well_known_symbol(); - var Iterators = require_iterators(); - var ITERATOR2 = wellKnownSymbol6("iterator"); - var ArrayPrototype = Array.prototype; - module.exports = function(it) { - return it !== void 0 && (Iterators.Array === it || ArrayPrototype[ITERATOR2] === it); - }; - } - }); - - // node_modules/core-js/internals/get-iterator-method.js - var require_get_iterator_method = __commonJS({ - "node_modules/core-js/internals/get-iterator-method.js": function(exports, module) { - var classof = require_classof(); - var getMethod5 = require_get_method(); - var isNullOrUndefined5 = require_is_null_or_undefined(); - var Iterators = require_iterators(); - var wellKnownSymbol6 = require_well_known_symbol(); - var ITERATOR2 = wellKnownSymbol6("iterator"); - module.exports = function(it) { - if (!isNullOrUndefined5(it)) - return getMethod5(it, ITERATOR2) || getMethod5(it, "@@iterator") || Iterators[classof(it)]; - }; - } - }); - - // node_modules/core-js/internals/get-iterator.js - var require_get_iterator = __commonJS({ - "node_modules/core-js/internals/get-iterator.js": function(exports, module) { + // node_modules/core-js/internals/iterate.js + var require_iterate = __commonJS({ + "node_modules/core-js/internals/iterate.js": function(exports, module) { + var bind2 = require_function_bind_context(); var call8 = require_function_call(); - var aCallable2 = require_a_callable(); var anObject10 = require_an_object(); var tryToString = require_try_to_string(); + var isArrayIteratorMethod = require_is_array_iterator_method(); + var lengthOfArrayLike4 = require_length_of_array_like(); + var isPrototypeOf3 = require_object_is_prototype_of(); + var getIterator = require_get_iterator(); var getIteratorMethod = require_get_iterator_method(); + var iteratorClose = require_iterator_close(); var $TypeError = TypeError; - module.exports = function(argument, usingIterator) { - var iteratorMethod = arguments.length < 2 ? getIteratorMethod(argument) : usingIterator; - if (aCallable2(iteratorMethod)) - return anObject10(call8(iteratorMethod, argument)); - throw $TypeError(tryToString(argument) + " is not iterable"); - }; - } - }); - - // node_modules/core-js/internals/iterator-close.js - var require_iterator_close = __commonJS({ - "node_modules/core-js/internals/iterator-close.js": function(exports, module) { - var call8 = require_function_call(); - var anObject10 = require_an_object(); - var getMethod5 = require_get_method(); - module.exports = function(iterator, kind, value) { - var innerResult, innerError; - anObject10(iterator); - try { - innerResult = getMethod5(iterator, "return"); - if (!innerResult) { - if (kind === "throw") - throw value; - return value; - } - innerResult = call8(innerResult, iterator); - } catch (error) { - innerError = true; - innerResult = error; - } - if (kind === "throw") - throw value; - if (innerError) - throw innerResult; - anObject10(innerResult); - return value; - }; - } - }); - - // node_modules/core-js/internals/iterate.js - var require_iterate = __commonJS({ - "node_modules/core-js/internals/iterate.js": function(exports, module) { - var bind2 = require_function_bind_context(); - var call8 = require_function_call(); - var anObject10 = require_an_object(); - var tryToString = require_try_to_string(); - var isArrayIteratorMethod = require_is_array_iterator_method(); - var lengthOfArrayLike4 = require_length_of_array_like(); - var isPrototypeOf3 = require_object_is_prototype_of(); - var getIterator = require_get_iterator(); - var getIteratorMethod = require_get_iterator_method(); - var iteratorClose = require_iterator_close(); - var $TypeError = TypeError; - var Result = function(stopped, result) { - this.stopped = stopped; - this.result = result; + var Result = function(stopped, result) { + this.stopped = stopped; + this.result = result; }; var ResultPrototype = Result.prototype; module.exports = function(iterable, unboundFunction, options) { @@ -4085,53 +4195,6 @@ } }); - // node_modules/core-js/internals/check-correctness-of-iteration.js - var require_check_correctness_of_iteration = __commonJS({ - "node_modules/core-js/internals/check-correctness-of-iteration.js": function(exports, module) { - var wellKnownSymbol6 = require_well_known_symbol(); - var ITERATOR2 = wellKnownSymbol6("iterator"); - var SAFE_CLOSING = false; - try { - called = 0; - iteratorWithReturn = { - next: function() { - return { done: !!called++ }; - }, - "return": function() { - SAFE_CLOSING = true; - } - }; - iteratorWithReturn[ITERATOR2] = function() { - return this; - }; - Array.from(iteratorWithReturn, function() { - throw 2; - }); - } catch (error) { - } - var called; - var iteratorWithReturn; - module.exports = function(exec2, SKIP_CLOSING) { - if (!SKIP_CLOSING && !SAFE_CLOSING) - return false; - var ITERATION_SUPPORT = false; - try { - var object = {}; - object[ITERATOR2] = function() { - return { - next: function() { - return { done: ITERATION_SUPPORT = true }; - } - }; - }; - exec2(object); - } catch (error) { - } - return ITERATION_SUPPORT; - }; - } - }); - // node_modules/core-js/internals/promise-statics-incorrect-iteration.js var require_promise_statics_incorrect_iteration = __commonJS({ "node_modules/core-js/internals/promise-statics-incorrect-iteration.js": function(exports, module) { @@ -4302,69 +4365,6 @@ } }); - // node_modules/core-js/internals/call-with-safe-iteration-closing.js - var require_call_with_safe_iteration_closing = __commonJS({ - "node_modules/core-js/internals/call-with-safe-iteration-closing.js": function(exports, module) { - var anObject10 = require_an_object(); - var iteratorClose = require_iterator_close(); - module.exports = function(iterator, fn, value, ENTRIES) { - try { - return ENTRIES ? fn(anObject10(value)[0], value[1]) : fn(value); - } catch (error) { - iteratorClose(iterator, "throw", error); - } - }; - } - }); - - // node_modules/core-js/internals/array-from.js - var require_array_from = __commonJS({ - "node_modules/core-js/internals/array-from.js": function(exports, module) { - "use strict"; - var bind2 = require_function_bind_context(); - var call8 = require_function_call(); - var toObject5 = require_to_object(); - var callWithSafeIterationClosing = require_call_with_safe_iteration_closing(); - var isArrayIteratorMethod = require_is_array_iterator_method(); - var isConstructor2 = require_is_constructor(); - var lengthOfArrayLike4 = require_length_of_array_like(); - var createProperty5 = require_create_property(); - var getIterator = require_get_iterator(); - var getIteratorMethod = require_get_iterator_method(); - var $Array2 = Array; - module.exports = function from2(arrayLike) { - var O = toObject5(arrayLike); - var IS_CONSTRUCTOR = isConstructor2(this); - var argumentsLength = arguments.length; - var mapfn = argumentsLength > 1 ? arguments[1] : void 0; - var mapping = mapfn !== void 0; - if (mapping) - mapfn = bind2(mapfn, argumentsLength > 2 ? arguments[2] : void 0); - var iteratorMethod = getIteratorMethod(O); - var index = 0; - var length, result, step, iterator, next2, value; - if (iteratorMethod && !(this === $Array2 && isArrayIteratorMethod(iteratorMethod))) { - iterator = getIterator(O, iteratorMethod); - next2 = iterator.next; - result = IS_CONSTRUCTOR ? new this() : []; - for (; !(step = call8(next2, iterator)).done; index++) { - value = mapping ? callWithSafeIterationClosing(iterator, mapfn, [step.value, index], true) : step.value; - createProperty5(result, index, value); - } - } else { - length = lengthOfArrayLike4(O); - result = IS_CONSTRUCTOR ? new this(length) : $Array2(length); - for (; length > index; index++) { - value = mapping ? mapfn(O[index], index) : O[index]; - createProperty5(result, index, value); - } - } - result.length = index; - return result; - }; - } - }); - // node_modules/core-js/internals/same-value.js var require_same_value = __commonJS({ "node_modules/core-js/internals/same-value.js": function(exports, module) { @@ -8656,58 +8656,13 @@ // srcts/src/bindings/input/selectInput.ts var import_es_json_stringify = __toESM(require_es_json_stringify()); - var import_es_array_iterator14 = __toESM(require_es_array_iterator()); + var import_es_array_iterator13 = __toESM(require_es_array_iterator()); var import_jquery15 = __toESM(require_jquery()); // srcts/src/utils/eval.ts var indirectEval = eval; - // node_modules/core-js/modules/es.promise.js - require_es_promise_constructor(); - require_es_promise_all(); - require_es_promise_catch(); - require_es_promise_race(); - require_es_promise_reject(); - require_es_promise_resolve(); - - // srcts/src/shiny/initedMethods.ts - var import_es_array_iterator13 = __toESM(require_es_array_iterator()); - - // node_modules/core-js/modules/es.symbol.async-iterator.js - var defineWellKnownSymbol3 = require_well_known_symbol_define(); - defineWellKnownSymbol3("asyncIterator"); - - // node_modules/core-js/modules/es.symbol.to-string-tag.js - var getBuiltIn2 = require_get_built_in(); - var defineWellKnownSymbol4 = require_well_known_symbol_define(); - var setToStringTag2 = require_set_to_string_tag(); - defineWellKnownSymbol4("toStringTag"); - setToStringTag2(getBuiltIn2("Symbol"), "Symbol"); - - // node_modules/core-js/modules/es.json.to-string-tag.js - var global7 = require_global(); - var setToStringTag3 = require_set_to_string_tag(); - setToStringTag3(global7.JSON, "JSON", true); - - // node_modules/core-js/modules/es.math.to-string-tag.js - var setToStringTag4 = require_set_to_string_tag(); - setToStringTag4(Math, "Math", true); - - // node_modules/core-js/modules/es.array.reverse.js - var $36 = require_export(); - var uncurryThis7 = require_function_uncurry_this(); - var isArray3 = require_is_array(); - var nativeReverse = uncurryThis7([].reverse); - var test = [1, 2]; - $36({ target: "Array", proto: true, forced: String(test) === String(test.reverse()) }, { - reverse: function reverse() { - if (isArray3(this)) - this.length = this.length; - return nativeReverse(this); - } - }); - - // srcts/src/shiny/initedMethods.ts + // srcts/src/bindings/input/selectInput.ts function _typeof13(obj) { "@babel/helpers - typeof"; return _typeof13 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) { @@ -8716,479 +8671,606 @@ return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; }, _typeof13(obj); } - function _regeneratorRuntime() { - "use strict"; - _regeneratorRuntime = function _regeneratorRuntime13() { - return exports; - }; - var exports = {}, Op = Object.prototype, hasOwn4 = Op.hasOwnProperty, defineProperty3 = Object.defineProperty || function(obj, key, desc) { - obj[key] = desc.value; - }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; - function define(obj, key, value) { - return Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }), obj[key]; - } - try { - define({}, ""); - } catch (err) { - define = function define2(obj, key, value) { - return obj[key] = value; - }; + function _classCallCheck13(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); } - function wrap(innerFn, outerFn, self2, tryLocsList) { - var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); - return defineProperty3(generator, "_invoke", { value: makeInvokeMethod(innerFn, self2, context) }), generator; + } + function _defineProperties13(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) + descriptor.writable = true; + Object.defineProperty(target, _toPropertyKey13(descriptor.key), descriptor); } - function tryCatch(fn, obj, arg) { - try { - return { type: "normal", arg: fn.call(obj, arg) }; - } catch (err) { - return { type: "throw", arg: err }; - } + } + function _createClass13(Constructor, protoProps, staticProps) { + if (protoProps) + _defineProperties13(Constructor.prototype, protoProps); + if (staticProps) + _defineProperties13(Constructor, staticProps); + Object.defineProperty(Constructor, "prototype", { writable: false }); + return Constructor; + } + function _toPropertyKey13(arg) { + var key = _toPrimitive13(arg, "string"); + return _typeof13(key) === "symbol" ? key : String(key); + } + function _toPrimitive13(input, hint) { + if (_typeof13(input) !== "object" || input === null) + return input; + var prim = input[Symbol.toPrimitive]; + if (prim !== void 0) { + var res = prim.call(input, hint || "default"); + if (_typeof13(res) !== "object") + return res; + throw new TypeError("@@toPrimitive must return a primitive value."); } - exports.wrap = wrap; - var ContinueSentinel = {}; - function Generator() { + return (hint === "string" ? String : Number)(input); + } + function _inherits11(subClass, superClass) { + if (typeof superClass !== "function" && superClass !== null) { + throw new TypeError("Super expression must either be null or a function"); } - function GeneratorFunction() { - } - function GeneratorFunctionPrototype() { - } - var IteratorPrototype = {}; - define(IteratorPrototype, iteratorSymbol, function() { - return this; - }); - var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values2([]))); - NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn4.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); - var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); - function defineIteratorMethods(prototype) { - ["next", "throw", "return"].forEach(function(method) { - define(prototype, method, function(arg) { - return this._invoke(method, arg); - }); - }); - } - function AsyncIterator(generator, PromiseImpl) { - function invoke(method, arg, resolve, reject) { - var record = tryCatch(generator[method], generator, arg); - if ("throw" !== record.type) { - var result = record.arg, value = result.value; - return value && "object" == _typeof13(value) && hasOwn4.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function(value2) { - invoke("next", value2, resolve, reject); - }, function(err) { - invoke("throw", err, resolve, reject); - }) : PromiseImpl.resolve(value).then(function(unwrapped) { - result.value = unwrapped, resolve(result); - }, function(error) { - return invoke("throw", error, resolve, reject); - }); - } - reject(record.arg); + subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); + Object.defineProperty(subClass, "prototype", { writable: false }); + if (superClass) + _setPrototypeOf11(subClass, superClass); + } + function _setPrototypeOf11(o, p) { + _setPrototypeOf11 = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf21(o2, p2) { + o2.__proto__ = p2; + return o2; + }; + return _setPrototypeOf11(o, p); + } + function _createSuper11(Derived) { + var hasNativeReflectConstruct = _isNativeReflectConstruct11(); + return function _createSuperInternal() { + var Super = _getPrototypeOf11(Derived), result; + if (hasNativeReflectConstruct) { + var NewTarget = _getPrototypeOf11(this).constructor; + result = Reflect.construct(Super, arguments, NewTarget); + } else { + result = Super.apply(this, arguments); } - var previousPromise; - defineProperty3(this, "_invoke", { value: function value(method, arg) { - function callInvokeWithMethodAndArg() { - return new PromiseImpl(function(resolve, reject) { - invoke(method, arg, resolve, reject); - }); - } - return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); - } }); - } - function makeInvokeMethod(innerFn, self2, context) { - var state = "suspendedStart"; - return function(method, arg) { - if ("executing" === state) - throw new Error("Generator is already running"); - if ("completed" === state) { - if ("throw" === method) - throw arg; - return doneResult(); - } - for (context.method = method, context.arg = arg; ; ) { - var delegate = context.delegate; - if (delegate) { - var delegateResult = maybeInvokeDelegate(delegate, context); - if (delegateResult) { - if (delegateResult === ContinueSentinel) - continue; - return delegateResult; - } - } - if ("next" === context.method) - context.sent = context._sent = context.arg; - else if ("throw" === context.method) { - if ("suspendedStart" === state) - throw state = "completed", context.arg; - context.dispatchException(context.arg); - } else - "return" === context.method && context.abrupt("return", context.arg); - state = "executing"; - var record = tryCatch(innerFn, self2, context); - if ("normal" === record.type) { - if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) - continue; - return { value: record.arg, done: context.done }; - } - "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); - } - }; + return _possibleConstructorReturn11(this, result); + }; + } + function _possibleConstructorReturn11(self2, call8) { + if (call8 && (_typeof13(call8) === "object" || typeof call8 === "function")) { + return call8; + } else if (call8 !== void 0) { + throw new TypeError("Derived constructors may only return object or undefined"); } - function maybeInvokeDelegate(delegate, context) { - var methodName = context.method, method = delegate.iterator[methodName]; - if (void 0 === method) - return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = void 0, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; - var record = tryCatch(method, delegate.iterator, context.arg); - if ("throw" === record.type) - return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; - var info = record.arg; - return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = void 0), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); + return _assertThisInitialized11(self2); + } + function _assertThisInitialized11(self2) { + if (self2 === void 0) { + throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } - function pushTryEntry(locs) { - var entry = { tryLoc: locs[0] }; - 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); + return self2; + } + function _isNativeReflectConstruct11() { + if (typeof Reflect === "undefined" || !Reflect.construct) + return false; + if (Reflect.construct.sham) + return false; + if (typeof Proxy === "function") + return true; + try { + Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() { + })); + return true; + } catch (e) { + return false; } - function resetTryEntry(entry) { - var record = entry.completion || {}; - record.type = "normal", delete record.arg, entry.completion = record; + } + function _getPrototypeOf11(o) { + _getPrototypeOf11 = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf21(o2) { + return o2.__proto__ || Object.getPrototypeOf(o2); + }; + return _getPrototypeOf11(o); + } + function getLabelNode7(el) { + var escapedId = $escape(el.id); + if (isSelectize(el)) { + escapedId += "-selectized"; } - function Context(tryLocsList) { - this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(true); + return (0, import_jquery15.default)(el).parent().parent().find('label[for="' + escapedId + '"]'); + } + function isSelectize(el) { + var config = (0, import_jquery15.default)(el).parent().find('script[data-for="' + $escape(el.id) + '"]'); + return config.length > 0; + } + var SelectInputBinding = /* @__PURE__ */ function(_InputBinding) { + _inherits11(SelectInputBinding2, _InputBinding); + var _super = _createSuper11(SelectInputBinding2); + function SelectInputBinding2() { + _classCallCheck13(this, SelectInputBinding2); + return _super.apply(this, arguments); } - function values2(iterable) { - if (iterable) { - var iteratorMethod = iterable[iteratorSymbol]; - if (iteratorMethod) - return iteratorMethod.call(iterable); - if ("function" == typeof iterable.next) - return iterable; - if (!isNaN(iterable.length)) { - var i = -1, next2 = function next3() { - for (; ++i < iterable.length; ) - if (hasOwn4.call(iterable, i)) - return next3.value = iterable[i], next3.done = false, next3; - return next3.value = void 0, next3.done = true, next3; - }; - return next2.next = next2; + _createClass13(SelectInputBinding2, [{ + key: "find", + value: function find2(scope) { + return (0, import_jquery15.default)(scope).find("select"); + } + }, { + key: "getType", + value: function getType(el) { + var $el = (0, import_jquery15.default)(el); + if (!$el.hasClass("symbol")) { + return null; + } + if ($el.attr("multiple") === "multiple") { + return "shiny.symbolList"; + } else { + return "shiny.symbol"; } } - return { next: doneResult }; - } - function doneResult() { - return { value: void 0, done: true }; - } - return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty3(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: true }), defineProperty3(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: true }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function(genFun) { - var ctor = "function" == typeof genFun && genFun.constructor; - return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); - }, exports.mark = function(genFun) { - return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; - }, exports.awrap = function(arg) { - return { __await: arg }; - }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function() { - return this; - }), exports.AsyncIterator = AsyncIterator, exports.async = function(innerFn, outerFn, self2, tryLocsList, PromiseImpl) { - void 0 === PromiseImpl && (PromiseImpl = Promise); - var iter = new AsyncIterator(wrap(innerFn, outerFn, self2, tryLocsList), PromiseImpl); - return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function(result) { - return result.done ? result.value : iter.next(); - }); - }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function() { - return this; - }), define(Gp, "toString", function() { - return "[object Generator]"; - }), exports.keys = function(val) { - var object = Object(val), keys2 = []; - for (var key in object) - keys2.push(key); - return keys2.reverse(), function next2() { - for (; keys2.length; ) { - var key2 = keys2.pop(); - if (key2 in object) - return next2.value = key2, next2.done = false, next2; + }, { + key: "getId", + value: function getId(el) { + return InputBinding.prototype.getId.call(this, el) || el.name; + } + }, { + key: "getValue", + value: function getValue(el) { + return (0, import_jquery15.default)(el).val(); + } + }, { + key: "setValue", + value: function setValue(el, value) { + if (!isSelectize(el)) { + (0, import_jquery15.default)(el).val(value); + } else { + var selectize = this._selectize(el); + selectize === null || selectize === void 0 ? void 0 : selectize.setValue(value); } - return next2.done = true, next2; - }; - }, exports.values = values2, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { - if (this.prev = 0, this.next = 0, this.sent = this._sent = void 0, this.done = false, this.delegate = null, this.method = "next", this.arg = void 0, this.tryEntries.forEach(resetTryEntry), !skipTempReset) - for (var name in this) - "t" === name.charAt(0) && hasOwn4.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = void 0); - }, stop: function stop() { - this.done = true; - var rootRecord = this.tryEntries[0].completion; - if ("throw" === rootRecord.type) - throw rootRecord.arg; - return this.rval; - }, dispatchException: function dispatchException(exception) { - if (this.done) - throw exception; - var context = this; - function handle(loc, caught) { - return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = void 0), !!caught; } - for (var i = this.tryEntries.length - 1; i >= 0; --i) { - var entry = this.tryEntries[i], record = entry.completion; - if ("root" === entry.tryLoc) - return handle("end"); - if (entry.tryLoc <= this.prev) { - var hasCatch = hasOwn4.call(entry, "catchLoc"), hasFinally = hasOwn4.call(entry, "finallyLoc"); - if (hasCatch && hasFinally) { - if (this.prev < entry.catchLoc) - return handle(entry.catchLoc, true); - if (this.prev < entry.finallyLoc) - return handle(entry.finallyLoc); - } else if (hasCatch) { - if (this.prev < entry.catchLoc) - return handle(entry.catchLoc, true); - } else { - if (!hasFinally) - throw new Error("try statement without catch or finally"); - if (this.prev < entry.finallyLoc) - return handle(entry.finallyLoc); - } + }, { + key: "getState", + value: function getState(el) { + var options = new Array(el.length); + for (var i = 0; i < el.length; i++) { + options[i] = { + value: el[i].value, + label: el[i].label + }; } + return { + label: getLabelNode7(el), + value: this.getValue(el), + options: options + }; } - }, abrupt: function abrupt(type, arg) { - for (var i = this.tryEntries.length - 1; i >= 0; --i) { - var entry = this.tryEntries[i]; - if (entry.tryLoc <= this.prev && hasOwn4.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { - var finallyEntry = entry; - break; + }, { + key: "receiveMessage", + value: function receiveMessage(el, data) { + var $el = (0, import_jquery15.default)(el); + if (hasDefinedProperty(data, "options")) { + var selectize = this._selectize(el); + selectize === null || selectize === void 0 ? void 0 : selectize.destroy(); + $el.empty().append(data.options); + this._selectize(el); } + if (hasDefinedProperty(data, "config")) { + $el.parent().find('script[data-for="' + $escape(el.id) + '"]').replaceWith(data.config); + this._selectize(el, true); + } + if (hasDefinedProperty(data, "url")) { + var _selectize2 = this._selectize(el); + _selectize2.clearOptions(); + var loaded = false; + _selectize2.settings.load = function(query, callback) { + var settings = _selectize2.settings; + import_jquery15.default.ajax({ + url: data.url, + data: { + query: query, + field: JSON.stringify([settings.searchField]), + value: settings.valueField, + conju: settings.searchConjunction, + maxop: settings.maxOptions + }, + type: "GET", + error: function error() { + callback(); + }, + success: function success(res) { + import_jquery15.default.each(res, function(index, elem) { + var optgroupId = elem[settings.optgroupField || "optgroup"]; + var optgroup = {}; + optgroup[settings.optgroupLabelField || "label"] = optgroupId; + optgroup[settings.optgroupValueField || "value"] = optgroupId; + _selectize2.addOptionGroup(optgroupId, optgroup); + }); + callback(res); + if (!loaded) { + if (hasDefinedProperty(data, "value")) { + _selectize2.setValue(data.value); + } else if (settings.maxItems === 1) { + _selectize2.setValue(res[0].value); + } + } + loaded = true; + } + }); + }; + _selectize2.load(function(callback) { + _selectize2.settings.load.apply(_selectize2, ["", callback]); + }); + } else if (hasDefinedProperty(data, "value")) { + this.setValue(el, data.value); + } + updateLabel(data.label, getLabelNode7(el)); + (0, import_jquery15.default)(el).trigger("change"); } - finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); - var record = finallyEntry ? finallyEntry.completion : {}; - return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); - }, complete: function complete(record, afterLoc) { - if ("throw" === record.type) - throw record.arg; - return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; - }, finish: function finish(finallyLoc) { - for (var i = this.tryEntries.length - 1; i >= 0; --i) { - var entry = this.tryEntries[i]; - if (entry.finallyLoc === finallyLoc) - return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; - } - }, catch: function _catch(tryLoc) { - for (var i = this.tryEntries.length - 1; i >= 0; --i) { - var entry = this.tryEntries[i]; - if (entry.tryLoc === tryLoc) { - var record = entry.completion; - if ("throw" === record.type) { - var thrown = record.arg; - resetTryEntry(entry); + }, { + key: "subscribe", + value: function subscribe(el, callback) { + var _this = this; + (0, import_jquery15.default)(el).on( + "change.selectInputBinding", + function() { + if (el.nonempty && _this.getValue(el) === "") { + return; + } + callback(false); } - return thrown; - } + ); } - throw new Error("illegal catch attempt"); - }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { - return this.delegate = { iterator: values2(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = void 0), ContinueSentinel; - } }, exports; - } - function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { - try { - var info = gen[key](arg); - var value = info.value; - } catch (error) { - reject(error); - return; - } - if (info.done) { - resolve(value); - } else { - Promise.resolve(value).then(_next, _throw); - } - } - function _asyncToGenerator(fn) { - return function() { - var self2 = this, args = arguments; - return new Promise(function(resolve, reject) { - var gen = fn.apply(self2, args); - function _next(value) { - asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); + }, { + key: "unsubscribe", + value: function unsubscribe(el) { + (0, import_jquery15.default)(el).off(".selectInputBinding"); + } + }, { + key: "initialize", + value: function initialize(el) { + this._selectize(el); + } + }, { + key: "_selectize", + value: function _selectize(el) { + var update = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false; + if (!import_jquery15.default.fn.selectize) + return void 0; + var $el = (0, import_jquery15.default)(el); + var config = $el.parent().find('script[data-for="' + $escape(el.id) + '"]'); + if (config.length === 0) + return void 0; + var options = import_jquery15.default.extend({ + labelField: "label", + valueField: "value", + searchField: ["label"] + }, JSON.parse(config.html())); + if (typeof config.data("nonempty") !== "undefined") { + el.nonempty = true; + options = import_jquery15.default.extend(options, { + onItemRemove: function onItemRemove(value) { + if (this.getValue() === "") + (0, import_jquery15.default)("select#" + $escape(el.id)).empty().append((0, import_jquery15.default)("