1"use strict";(self.webpackChunkVectorStockWebsite=self.webpackChunkVectorStockWebsite||[]).push([[8401],{2390(t,e,n){n.r(e),n.d(e,{FieldVectorSelect:()=>b});var i=n(16919),a=n(24793),r=n(15297),s=n(7546),o=n(58892),l=n(22451),u=n(40627);function c(t){return c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},c(t)}function d(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,m(i.key),i)}}function p(t,e,n){return e=v(e),h(t,f()?Reflect.construct(e,n||[],v(t).constructor):e.apply(t,n))}function h(t,e){if(e&&("object"==c(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function f(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(f=function(){return!!t})()}function v(t){return v=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},v(t)}function y(t,e){return y=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},y(t,e)}function m(t){var e=function(t){if("object"!=c(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=c(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==c(e)?e:e+""}var b=function(t){function e(t){var n,a,r,o;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),a=n=p(this,e),r="_debouncedSearch",o=s.H.debounce(function(t){var e;null!==(e=n.container)&&void 0!==e&&e.isConnected&&n.textinput.value===t&&n._search(t)},300),(r=m(r))in a?Object.defineProperty(a,r,{value:o,enumerable:!0,configurable:!0,writable:!0}):a[r]=o,n.apiService=i.apiService,n.field=t,n.container=n.field.querySelector(".vectorselect"),n.container?(n.fieldset=n.container.querySelector(".input fieldset"),n.fieldset?(n.buttonClear=n.fieldset.querySelector(".actions button.clear"),n.textinput=n.fieldset.querySelector("input"),n.suggestion=n.fieldset.querySelector(".suggestion"),n.textinput&&n.suggestion?(n.output=n.container.querySelector(".output"),n.output?(n.value=null,n.lastSuggestedId=null,n._lastValue="",n.t=null,n.translationsReady=u.translations.readyAll().catch(function(){return null}).then(function(){n.t=u.translations.pAt("form")}),n._onKeyDown=n._onKeyDown.bind(n),n._update=n._update.bind(n),n.buttonClear.addEventListener("click",function(){n.clear(),n.focus()}),n.textinput.addEventListener("blur",function(){n.fieldset.dataset.expanded="0"}),n.textinput.addEventListener("cut",n._update),n.textinput.addEventListener("change",n._update),n.textinput.addEventListener("focus",n._update),n.textinput.addEventListener("input",n._update),n.textinput.addEventListener("paste",n._update),n.textinput.addEventListener("keydown",n._onKeyDown),n):h(n)):h(n)):h(n)):h(n)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&y(t,e)}(e,t),n=e,r=[{key:"_onKeyDown",value:function(t){if(t.ctrlKey||t.metaKey){var e=t.key.toLowerCase();if(["a","c","v","x"].includes(e))return}/^\d$/.test(t.key)||/^Numpad[0-9]$/.test(t.key)||["Backspace","Delete","ArrowLeft","ArrowRight","Tab","Enter","Home","End","Escape"].includes(t.key)||t.preventDefault(),"Enter"===t.key&&t.preventDefault()}},{key:"_update",value:function(){var t=this.textinput.value,e=t.replace(/[^\d]/g,"");if(e!==t&&(this.textinput.value=e,t=e),this.fieldset.dataset.filled=""===t?"":"1",this.fieldset.dataset.expanded="0",t!==this._lastValue&&(this._lastValue=t,t.length>1)){var n=l.Routes.API.VECTOR.PREVIEW(t);this.apiService.isCached(n)?this.textinput.value===t&&this._search(t):this._debouncedSearch(t)}}},{key:"_search",value:function(t){var e=this,n=l.Routes.API.VECTOR.PREVIEW(t);if(this.apiService.isCached(n)){var i=this.apiService.getFromCache(n);this._onResults(null==i?void 0:i.data)}else this.loadicon||(this.loadicon=new o.a(this.fieldset,"small")),this.apiService.get(n,null,{cacheType:"memory"}).then(function(n){t==e.textinput.value&&e._onResults(n.data)}).catch(function(n){a.A.log("Vector Select","Failed to fetch vector ID match",{error:n}),t==e.textinput.value&&e._onResults()})}},{key:"_onResults",value:function(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};null!==(t=this.container)&&void 0!==t&&t.isConnected&&(this.loadicon&&(this.loadicon.remove(),this.loadicon=null),document.activeElement===this.textinput&&(e.id?this._showMatchingImage(e):this._showNoMatches(),this.fieldset.dataset.expanded="1"))}},{key:"_showMatchingImage",value:function(t){var e,n=this;if(null!==(e=this.container)&&void 0!==e&&e.isConnected&&(this.noresults&&(this.noresults.remove(),this.noresults=null),!this.entry||this.lastSuggestedId!==String(t.id))){this.entry&&this.entry.remove(),this.entry=document.createElement("div"),this.entry.classList.add("entry"),this.suggestion.appendChild(this.entry),this.entry.addEventListener("mousedown",function(t){t.preventDefault()}),this.entry.addEventListener("click",function(){n._select(t.id,t.title),n.entry.remove(),n.entry=null,n.fieldset.dataset.expanded=0,n.clear()}),this.lastSuggestedId=String(t.id);var i=document.createElement("span");i.classList.add("image");var a=s.H.generatePicture(t.id,{title:t.title,thumb:!0});i.appendChild(a);var r=i.querySelector("img");r&&r.complete&&0!==r.naturalHeight?i.classList.add("loaded"):r&&r.addEventListener("load",function(){i.classList.add("loaded")},{once:!0}),this.entry.appendChild(i);var o=document.createElement("span");o.classList.add("label"),this.entry.appendChild(o);var l=document.createElement("span");l.textContent=t.title,o.appendChild(l);var u=document.createElement("span");u.classList.add("link"),this.t&&(u.textContent=this.t("actions.select")),this.entry.appendChild(u)}}},{key:"_showNoMatches",value:function(){if(this.entry&&(this.entry.remove(),this.entry=null),!this.noresults){this.noresults=document.createElement("div"),this.noresults.classList.add("noresults"),this.suggestion.appendChild(this.noresults);var t=document.createElement("span");t.classList.add("label"),this.t&&(t.textContent=this.t("modules.vectorselect.nomatches")),this.noresults.appendChild(t)}this.lastSuggestedId=null}},{key:"_select",value:function(t,e){var n=this;this.output.replaceChildren();var i=document.createElement("span");i.classList.add("image");var a=s.H.generatePicture(t,{title:e,thumb:!0});i.appendChild(a),this.output.appendChild(i);var r=document.createElement("span");r.classList.add("label"),this.output.appendChild(r);var o=document.createElement("span");o.textContent="".concat(t," - ").concat(e),r.appendChild(o);var l=document.createElement("span");l.classList.add("link"),this.t&&(l.textContent=this.t("actions.remove")),this.output.appendChild(l),l.addEventListener("click",function(){return n._unselect()}),this.container.dataset.set="1",this.value=t,this.triggerEvent("select",this.value)}},{key:"_unselect",value:function(){this.output.innerHTML="",this.container.dataset.set="0",this.focus(),this.value=null,this.triggerEvent("unselect")}},{key:"focus",value:function(){this.textinput.focus()}},{key:"clear",value:function(){this.textinput.value="",this._update()}}],c=[{key:"generate",value:function(t,n){var i=document.createElement("template");i.innerHTML=s.H.populateHTMLTemplate('<div class="field"> <header> <h4>${title}</h4> </header> <div class="vectorselect" data-set="0"> <div class="input"> <fieldset data-filled="0" data-expanded="0"> <div class="actions"> <button type="button" class="search">${searchSVG}</button> <button type="button" class="clear">${clearSVG}</button> </div> <input type="text" inputmode="numeric" pattern="\\d*" maxlength="12" spellcheck="false" autocomplete="off" autocorrect="off" autocapitalize="off" required="" placeholder="${placeholder}"> <div class="suggestion"></div> </fieldset> </div> <div class="output"></div> </div> </div>',n);var a=i.content.firstElementChild;return t.appendChild(a),new e(a)}}],r&&d(n.prototype,r),c&&d(n,c),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,c}(r.b)}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.