System.register(["./index-c820db66.system.js","./model-84163fe0.system.js","./index-9ceb7f8c.system.js","./index-dc84aac6.system.js","./_commonjsHelpers-c8881874.system.js","./index-b0fe4e4c.system.js","./index-2d937df8.system.js"],(function(t){"use strict";var e,n,i,o;return{setters:[function(t){e=t.r;n=t.h;i=t.k},function(){},function(t){o=t.d},function(){},function(){},function(){},function(){}],execute:function(){var s=".sc-ig-autocomplete-input-h{display:block;font-family:var(--smoothly-font-family)}.sc-ig-autocomplete-input-h>div.sc-ig-autocomplete-input:nth-child(1){position:absolute;display:grid;grid-template-columns:auto auto;grid-template-rows:auto auto;padding:1em 0.2em 0.2em 0.2em;white-space:nowrap}.sc-ig-autocomplete-input-h>div.sc-ig-autocomplete-input:nth-child(1)>div.sc-ig-autocomplete-input:nth-child(1){color:transparent;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;font-size:1rem;font-family:var(--smoothly-font-family)}.sc-ig-autocomplete-input-h>div.sc-ig-autocomplete-input:nth-child(1) smoothly-menu-options.sc-ig-autocomplete-input{grid-column-start:2;grid-row-start:2;z-index:99}.sc-ig-autocomplete-input-h:not(:focus-within) smoothly-menu-options.sc-ig-autocomplete-input{display:none}.sc-ig-autocomplete-input-h:not([has-suggestion]) smoothly-menu-options.sc-ig-autocomplete-input,.sc-ig-autocomplete-input-h:not([show-suggestion]) smoothly-menu-options.sc-ig-autocomplete-input{display:none}.sc-ig-autocomplete-input-h smoothly-input.sc-ig-autocomplete-input input.sc-ig-autocomplete-input{color:rgb(var(--smoothly-default-contrast))}";var u=t("ig_autocomplete_input",function(){function t(t){e(this,t);this.lastValue="";this.options=[];this.showSuggestion=false;this.value=""}t.prototype.componentDidRender=function(){var t;(t=this.menuElement)===null||t===void 0?void 0:t.filterOptions("")};t.prototype.inputValueChangeHandler=function(t){if(t.detail){this.value=t.detail.value;this.setInvisibleDiv(t.detail.value)}};t.prototype.optionSelectHandler=function(t){if(t.detail){this.inputElement.setKeepFocusOnReRender(true);this.select(t.detail.value)}t.stopPropagation()};t.prototype.onKeyDown=function(t){var e=this;var n;if(t.key=="ArrowUp"||t.key=="ArrowDown")this.showSuggestion?this.menuElement.moveHighlight(t.key=="ArrowUp"?-1:1):this.showSuggestion=true;else if(t.key=="Escape")this.showSuggestion=false;else if(t.key=="Enter"&&this.showSuggestion){(n=this.menuElement)===null||n===void 0?void 0:n.getHighlighted().then((function(t){t&&e.select(t.value)}));this.options&&this.options.length>0&&t.preventDefault()}};t.prototype.onKeyUp=function(t){if(this.inputElement.value!=this.lastValue){this.lastValue=this.inputElement.value;this.suggest()}};t.prototype.suggest=function(){if(this.inputElement&&this.inputElement.value!=undefined&&this.menuElement&&this.template){var t=o.Type.complete(this.template,this.inputElement.value);var e=this.options;this.options=t.map((function(t){var e;return{value:t,name:(e=t.addon)!==null&&e!==void 0?e:"",description:t.description}}));var n=e.map((function(t){return t.value.full})).join(",")!=this.options.map((function(t){return t.value.full})).join(",");if(n)this.showSuggestion=true;this.menuElement.setHighlight(0)}};t.prototype.select=function(t){var e=t.full;this.inputElement.value=e;this.setInvisibleDiv(e);var n=t.cursor&&typeof t.cursor=="number"?t.cursor:e.length;this.inputElement.setSelectionRange(n,n)};t.prototype.setInvisibleDiv=function(t){if(t)this.invisibleDiv.innerHTML=t.replace(/ /g,"&nbsp;");if(t=="")this.invisibleDiv.innerHTML="&nbsp;"};t.prototype.render=function(){var t=this;return n(i,{"has-suggestion":this.options&&this.options.length>0,"show-suggestion":this.showSuggestion,onClick:function(){t.showSuggestion=true;t.suggest()},onKeyDown:function(e){return t.onKeyDown(e)},onKeyUp:function(e){return t.onKeyUp(e)}},n("div",null,n("div",{ref:function(e){return t.invisibleDiv=e}}," "),n("smoothly-menu-options",{ref:function(e){return t.menuElement=e},style:{width:"300px"},"empty-menu-label":"","max-menu-height":"200px",options:this.options})),n("smoothly-input",{ref:function(e){return t.inputElement=e!==null&&e!==void 0?e:t.inputElement},name:this.name,autocomplete:false,value:this.value},n("slot",null)))};return t}());u.style=s}}}));