/*! For license information please see searchPlugin_wc.js.LICENSE.txt */ (()=>{var t={466:function(t){t.exports=function(){"use strict";var t=Object.prototype.toString,e=Array.isArray||function(e){return"[object Array]"===t.call(e)};function n(t){return"function"==typeof t}function i(t){return e(t)?"array":typeof t}function o(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function s(t,e){return null!=t&&"object"==typeof t&&e in t}function r(t,e){return null!=t&&"object"!=typeof t&&t.hasOwnProperty&&t.hasOwnProperty(e)}var a=RegExp.prototype.test;function l(t,e){return a.call(t,e)}var c=/\S/;function h(t){return!l(c,t)}var u={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="};function p(t){return String(t).replace(/[&<>"'`=\/]/g,(function(t){return u[t]}))}var d=/\s*/,f=/\s+/,m=/\s*=/,g=/\s*\}/,v=/#|\^|\/|>|\{|&|=|!/;function y(t,n){if(!t)return[];var i,s,r,a=!1,l=[],c=[],u=[],p=!1,y=!1,x="",E=0;function _(){if(p&&!y)for(;u.length;)delete c[u.pop()];else u=[];p=!1,y=!1}function S(t){if("string"==typeof t&&(t=t.split(f,2)),!e(t)||2!==t.length)throw new Error("Invalid tags: "+t);i=new RegExp(o(t[0])+"\\s*"),s=new RegExp("\\s*"+o(t[1])),r=new RegExp("\\s*"+o("}"+t[1]))}S(n||k.tags);for(var L,j,R,O,T,I,F=new b(t);!F.eos();){if(L=F.pos,R=F.scanUntil(i))for(var D=0,$=R.length;D<$;++D)h(O=R.charAt(D))?(u.push(c.length),x+=O):(y=!0,a=!0,x+=" "),c.push(["text",O,L,L+1]),L+=1,"\n"===O&&(_(),x="",E=0,a=!1);if(!F.scan(i))break;if(p=!0,j=F.scan(v)||"name",F.scan(d),"="===j?(R=F.scanUntil(m),F.scan(m),F.scanUntil(s)):"{"===j?(R=F.scanUntil(r),F.scan(g),F.scanUntil(s),j="&"):R=F.scanUntil(s),!F.scan(s))throw new Error("Unclosed tag at "+F.pos);if(T=">"==j?[j,R,L,F.pos,x,E,a]:[j,R,L,F.pos],E++,c.push(T),"#"===j||"^"===j)l.push(T);else if("/"===j){if(!(I=l.pop()))throw new Error('Unopened section "'+R+'" at '+L);if(I[1]!==R)throw new Error('Unclosed section "'+I[1]+'" at '+L)}else"name"===j||"{"===j||"&"===j?y=!0:"="===j&&S(R)}if(_(),I=l.pop())throw new Error('Unclosed section "'+I[1]+'" at '+F.pos);return w(C(c))}function C(t){for(var e,n,i=[],o=0,s=t.length;o0?o[o.length-1][4]:n;break;default:i.push(e)}return n}function b(t){this.string=t,this.tail=t,this.pos=0}function x(t,e){this.view=t,this.cache={".":this.view},this.parent=e}function E(){this.templateCache={_cache:{},set:function(t,e){this._cache[t]=e},get:function(t){return this._cache[t]},clear:function(){this._cache={}}}}b.prototype.eos=function(){return""===this.tail},b.prototype.scan=function(t){var e=this.tail.match(t);if(!e||0!==e.index)return"";var n=e[0];return this.tail=this.tail.substring(n.length),this.pos+=n.length,n},b.prototype.scanUntil=function(t){var e,n=this.tail.search(t);switch(n){case-1:e=this.tail,this.tail="";break;case 0:e="";break;default:e=this.tail.substring(0,n),this.tail=this.tail.substring(n)}return this.pos+=e.length,e},x.prototype.push=function(t){return new x(t,this)},x.prototype.lookup=function(t){var e,i=this.cache;if(i.hasOwnProperty(t))e=i[t];else{for(var o,a,l,c=this,h=!1;c;){if(t.indexOf(".")>0)for(o=c.view,a=t.split("."),l=0;null!=o&&l"===r?a=this.renderPartial(s,e,n,o):"&"===r?a=this.unescapedValue(s,e):"name"===r?a=this.escapedValue(s,e,o):"text"===r&&(a=this.rawValue(s)),void 0!==a&&(l+=a);return l},E.prototype.renderSection=function(t,i,o,s,r){var a=this,l="",c=i.lookup(t[1]);function h(t){return a.render(t,i,o,r)}if(c){if(e(c))for(var u=0,p=c.length;u0||!n)&&(o[s]=i+o[s]);return o.join("\n")},E.prototype.renderPartial=function(t,e,i,o){if(i){var s=this.getConfigTags(o),r=n(i)?i(t[1]):i[t[1]];if(null!=r){var a=t[6],l=t[5],c=t[4],h=r;0==l&&c&&(h=this.indentPartial(r,c,a));var u=this.parse(h,s);return this.renderTokens(u,e,i,h,o)}}},E.prototype.unescapedValue=function(t,e){var n=e.lookup(t[1]);if(null!=n)return n},E.prototype.escapedValue=function(t,e,n){var i=this.getConfigEscape(n)||k.escape,o=e.lookup(t[1]);if(null!=o)return"number"==typeof o&&i===k.escape?String(o):i(o)},E.prototype.rawValue=function(t){return t[1]},E.prototype.getConfigTags=function(t){return e(t)?t:t&&"object"==typeof t?t.tags:void 0},E.prototype.getConfigEscape=function(t){return t&&"object"==typeof t&&!e(t)?t.escape:void 0};var k={name:"mustache.js",version:"4.2.0",tags:["{{","}}"],clearCache:void 0,escape:void 0,parse:void 0,render:void 0,Scanner:void 0,Context:void 0,Writer:void 0,set templateCache(t){_.templateCache=t},get templateCache(){return _.templateCache}},_=new E;return k.clearCache=function(){return _.clearCache()},k.parse=function(t,e){return _.parse(t,e)},k.render=function(t,e,n,o){if("string"!=typeof t)throw new TypeError('Invalid template! Template should be a "string" but "'+i(t)+'" was given as the first argument for mustache#render(template, view, partials)');return _.render(t,e,n,o)},k.escape=p,k.Scanner=b,k.Context=x,k.Writer=E,k}()},827:t=>{t.exports=class{static loading(t){t.innerHTML="
\n\t\t\t\t\t\t\t

Cargando.....

\n\t\t\t\t\t\t\t

"}static unixToDate(t){return new Date(1e3*t).toLocaleString("es-CL")}static formateMysqlDate(t){return new Date(t).toLocaleDateString("es-CL")}static formatDateToUnix(t){return new Date(t).getTime()}static dateDifference(t,e){const n=new Date(t).getTime();return new Date(date2).getTime()-n}static formatCurrency(t,e=0){return new Intl.NumberFormat("de-DE",{maximumFractionDigits:e}).format(t)}static getParamsOnUrl(t){let e=t.split("/");return e[e.length-1]}}},166:(t,e,n)=>{const i=n(466),o=n(827);t.exports=class{constructor(){this._props={helpers:{formatDate:function(){return function(t,e){return o.unixToDate(e(t))}}}},this._dataObject={},this.dom=document}async willMountComponent(){}didMountComponent(){}willSubmit(t){}async mountComponent(t){await this.willMountComponent();for(let e of Object.entries(this))null!=e[1]&&null!=e[1].html&&null!=e[1].html&&null!=e[1].dataLink&&(null!=e[1].handlerEvent&&null!=e[1].handlerEvent||this.addHandlerEvent(e[1]),null!=e[1].value&&null!=e[1].value||(e[1].value=null),null!=e[1].location&&""!=e[1].location?this.renderElement(e[1].location,e[1],this._props):this.renderElement(t,e[1],this._props));this.didMountComponent()}renderElement(t,e,n=this._props){const i=this.dom.querySelector(`[data-link='${e.dataLink}']`);if(null!=e.dataLink&&null!=i&&null!=i)i.appendChild(this.mountElement(e,n));else{let i=this.dom.querySelector(`[data-bs='${t}']`);null!=i?i.appendChild(this.mountElement(e,n)):console.log("Not real dom element are defined whith id "+t)}}mountElement(t,e){e.helpers=this._props.helpers;let n=i.render(t.html,e);const o=this.getElementFromMustage(n);return o.setAttribute("data-link",t.dataLink),this.setRealDomEvent(o,t),o}mountChild(t,e,n,i){for(let o of i){o.helpers=this._props.helpers;let i=Object.assign({},n);i.dataLink=o[`${t}`],i.location=e,i._data=o;let s=this.dom.querySelector(`[data-bs='${i.location}']`);null!=s?s.appendChild(this.mountElement(i,o)):console.log("Not real dom element are defined whith id "+i.location)}}unmountElement(t){let e=this.dom.querySelector(`[data-link='${t.dataLink}']`);null!=e&&null!=e?e.parentNode.removeChild(e):console.log(`There are not dom element whith data-link = ${t.dataLink}`)}patchComponent(t,e){if(null==t.dataLink)return void console.log("Not dataLink atribute are defined");let n=this.mountElement(t,e),i=this.dom.querySelector(`[data-link='${t.dataLink}']`);if(null!=i){i.parentElement.replaceChild(n,i)}else console.log("Not real dom element are defined whith dataLink "+t.dataLink)}removeComponent(t){let e=this.dom.querySelector(`[data-link='${t}']`);null!=e&&null!=e?e.parentNode.removeChild(e):console.log(`There are not dom element whith data-link = ${t}`)}setHandlerEvent(t,e){t.addEventListener(e.handlerEvent,(t=>{switch(t.preventDefault(),e.handlerAction){case"handlerLoadData":this.handlerLoadData();break;case"handlerChange":this.handlerChange(t.srcElement,e);break;case"handlerSelect":this.handlerSelect(t.srcElement,e);break;case"handlerCheck":this.handlerCheck(t.srcElement,e);break;case"handlerClick":this.handlerClick(t.srcElement,e);break;case"handlerSubmit":this.handlerSubmit(t.srcElement,e);break;case"handlerNext":this.handlerNext(e);default:this.haldlerDefault(t.srcElement,e)}}),!1)}handlerChange(t,e){switch(t.type){case"file":e.value=t.files,this._dataObject[e.dataLink]=t.file,this.handlerFile(e);break;case"checkbox":e.value=t.checked,this._dataObject[e.dataLink]=e.value,null==e.handlerFunction&&null==e.handlerFunction||e.handlerFunction();break;case"radio":e.value=t.value,null==e.handlerFunction&&null==e.handlerFunction||e.handlerFunction();break;default:if(e.value=t.value,this._dataObject[e.dataLink]=t.value,null!=e.handlerFunction||null!=e.handlerFunction)return void e.handlerFunction()}}handlerSelect(t,e){if(null==t.dataset.value){const n=t.parentElement;e.value=n.dataset.value,this._dataObject[e.dataLink]=n.dataset.value}else e.value=t.dataset.value,this._dataObject[e.dataLink]=t.dataset.value;if(null!=e.handlerFunction||null!=e.handlerFunction){const n=new CustomEvent(e.handlerFunction,{detail:{vDom:e,object:t,data:this._dataObject,props:this._props}});document.dispatchEvent(n)}}handlerCheck(t,e){if(e.value=t.checked,this._dataObject[e.dataLink]=t.checked,null!=e.handlerFunction||null!=e.handlerFunction){const n=new CustomEvent(e.handlerFunction,{detail:{vDom:e,object:t,data:this._dataObject,props:this._props}});document.dispatchEvent(n)}}handlerClick(t,e){if(null!=e.handlerFunction||null!=e.handlerFunction){const n=new CustomEvent(e.handlerFunction,{detail:{vDom:e,object:t,data:this._dataObject,props:this._props}});document.dispatchEvent(n)}else{const n=new CustomEvent("elementClick",{detail:{vDom:e,object:t,data:this._dataObject,props:this._props}});document.dispatchEvent(n)}}async handlerNext(t){if(null!=t.to&&""!=t.to&&null!=t.renderElement&&""!=t.renderElement)if(null!=this._props.next&&null!=this._props.next&&""!=this._props.next){await this.mountComponent(this._props.to);const t=new CustomEvent("nextReady",{});document.dispatchEvent(t)}else console.log(" this._props.next is not defined. This props have to contain the URL to call");else console.log('Virtual element have not defined properties "to" or "renderElement"')}async handlerSubmit(t,e){null!=e.loading&&1==e.loading&&this.showLoading(t),this.willSubmit(e);let n=await ApiCall.request(e.handlerOptions.url,e.handlerOptions.method,{},this._dataObject);if(null==n.data||null==n.data)return void console.log(n);this._dataObject=n.data.data,null!=e.show&&1==e.show&&console.log(n.data);const i=new CustomEvent("submitReady",{detail:{code:n.data.code,responseData:n.data.data,vDom:e,object:t,data:this._dataObject,props:this._props}});document.dispatchEvent(i)}haldlerDefault(t,e){const n=new CustomEvent(e.handlerAction,{detail:{dataLink:e.dataLink}});document.dispatchEvent(n)}getElementFromMustage(t){return(new DOMParser).parseFromString(t,"text/html").body.firstChild}addHandlerEvent(t){switch(t.tagName){case"input":t.handlerEvent="change",t.handlerAction="handlerChange";break;case"box":t.handlerEvent="change",t.handlerAction="handlerCheck";break;default:t.handlerEvent=null,t.handlerAction=null}}setRealDomEvent(t,e){const n=t.getElementsByTagName(e.tagName);for(let t of n)t.localName==e.tagName&&this.setHandlerEvent(t,e)}showLoading(t){t.outerHTML="

Loading.....

"}}},152:(t,e,n)=>{"use strict";const i=n(158),o=n(166);t.exports=class t extends o{static highlightRouteStyleElement=document.createElement("style");static routeClass="searchplugin-highlight-route";static overlayStyles=null;static config=null;static bootstrap=null;static _=(()=>{for(let e of document.styleSheets)e.href&&e.href.includes("bootstrap")&&(t.bootstrap=e.ownerNode.cloneNode(!0));t.bootstrap||console.error("Falta bootstrap"),t.config={displayCollections:!0,position:"left",productsTitle:"Productos",breakpoint:991,overlayOpacity:.2,overlayColor:"#000000",containerColor:"#ffffff",titleColor:"#000000",titleBackgroundColor:"#ffffff",linkColor:"#000000",linkColorHover:"#000000",linkBackgroundColor:"#ffffff",linkBackgroundColorHover:"#ffffff"};const e=document.currentScript.getAttribute("settings");if(e)try{const n=JSON.parse(e);Object.entries(n).forEach((([e,n])=>{null!=n&&(t.config[e]=n)}))}catch{console.error("error parsing settings json")}document.head.appendChild(t.highlightRouteStyleElement),t.overlayStyles=i.buildOverlayStyle();const n=i.buildGeneralStyle(),o=document.createElement("style");o.innerHTML=n,document.head.appendChild(o)})();static buildSearch(e,n){return e.shadowRoot?(console.error("Buscador ya existe eliminar el