isobit-ui 1.0.21 → 1.0.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/library.js CHANGED
@@ -1 +1 @@
1
- "use strict";var vue=require("vue"),pinia=require("pinia"),axios$2=require("axios"),Observable=require("ol/Observable"),ol$1=require("ol"),FullScreen=require("ol/control/FullScreen"),GeoJSON=require("ol/format/GeoJSON"),VectorLayer=require("ol/layer/Vector"),VectorSource=require("ol/source/Vector"),style=require("ol/style"),Control=require("ol/control/Control");require("ol/ol.css");var PointerInteraction=require("ol/interaction/Pointer"),Feature=require("ol/Feature"),Map=require("ol/Map");require("ol/interaction/Pointer.js"),require("ol/interaction/defaults");var View=require("ol/View"),geom=require("ol/geom");require("ol/interaction/Select");var proj=require("ol/proj"),layer=require("ol/layer"),source=require("ol/source");require("ol/interaction/Translate");var _imports_0=require("@/cdn/images/triangle-down.svg"),vueRouter=require("vue-router"),vueFontawesome=require("@fortawesome/vue-fontawesome"),freeRegularSvgIcons=require("@fortawesome/free-regular-svg-icons"),script$s={name:"InputText"};const _hoisted_1$j={type:"text"};function render$o(e,t,l,o,r,a){return vue.openBlock(),vue.createElementBlock("input",_hoisted_1$j)}script$s.render=render$o,script$s.__file="src/InputText.vue";var script$r={name:"InputTextarea"};function render$n(e,t,l,o,r,a){return" text "}script$r.render=render$n,script$r.__file="src/InputTextarea.vue";const _$1={stores:[],_id:0,axios_get:null,storeFunction:{}},log=(e,...t)=>{e&&console.log(e,...t)};let configApp={};function setupApp({pinia:e,axios:t,router:l}){configApp.pinia=e||pinia.createPinia(),t&&(configApp.axios=t),l&&(configApp.router=l),pinia.setActivePinia(configApp.pinia)}function getConfigApp(){return configApp}function getPiniaInstance(){return pinia.getActivePinia()||configApp.pinia}const id=()=>_$1._id++,num=e=>e=e?""==e?null:Number(""+e):0,date=(e,t)=>{if(e){let l;if(e instanceof Date)l=e;else if("string"==typeof e){let t=e.includes("T")?e.split("T"):e.split(" ");l=t[0].split("-"),t.length>1?(t=t[1].split(":"),l=new Date(parseInt(l[0]),parseInt(l[1])-1,parseInt(l[2]),parseInt(t[0]),parseInt(t[1]),t.length>2?parseInt(t[2]):0)):l.length>2?l=new Date(parseInt(l[0]),parseInt(l[1])-1,parseInt(l[2])):(l=e.split(":"),l=l.length>2?new Date(1981,0,6,parseInt(l[0]),parseInt(l[1]),parseInt(l[2])):new Date(e))}else l=new Date(e);if(1==t)e=l;else if("time"===t)e=pad(l.getHours(),2)+":"+pad(l.getMinutes(),2)+":"+pad(l.setSeconds()?l.setSeconds():0,2);else if("time a"==t)if("string"==typeof e||e instanceof String){let t=(e=e.split(":"))[0];e=pad(t>12?t-12:t,2)+":"+e[1]+":"+e[2]+" "+(t>12?"PM":"AM")}else h=l.getHours(),e=pad(h>12?h-12:h,2)+":"+pad(l.getMinutes(),2)+(l.setSeconds()?":"+pad(l.setSeconds(),2):"")+" "+(h>12?"PM":"AM");else e="date-"==t?pad(l.getFullYear(),4)+"-"+pad(l.getMonth()+1,2)+"-"+pad(l.getDate(),2):"dMY"==t||"date"==t?pad(l.getDate(),2)+"/"+pad(l.getMonth()+1,2)+"/"+pad(l.getFullYear(),4):"datetime"==t?pad(l.getFullYear(),4)+"-"+pad(l.getMonth()+1,2)+"-"+pad(l.getDate(),2)+"T"+pad(l.getHours(),2)+":"+pad(l.getMinutes(),2)+":"+pad(l.setSeconds()?l.setSeconds():0,2):pad(l.getDate(),2)+"/"+pad(l.getMonth()+1,2)+"/"+pad(l.getFullYear(),4)+" "+pad(l.getHours(),2)+":"+pad(l.getMinutes(),2)}return e},whichChild=e=>{let t=0;for(;null!=(e=e.previousElementSibling);)++t;return t},unmask=e=>{e&&(e.style.display="none",e.parentNode&&e.parentNode.removeChild(e))},isObject=e=>e&&"object"==typeof e&&!Array.isArray(e),mergeDeep=function(){let e=arguments[0],t=[];for(let e=1;e<arguments.length;e++)t.push(arguments[e]);if(!t.length)return e;let l,o=t.shift();if(isObject(e)&&isObject(o))for(let t in o)isObject(o[t])?(e[t]||(l={},l[t]={},Object.assign(e,l)),mergeDeep(e[t],o[t])):(l={},l[t]=o[t],Object.assign(e,l));let r=[];return r.push(e),r.concat(t),mergeDeep.apply(null,r)},buildPopupMenu=e=>{let t=e.getAttribute("v--popup");if(!t){e.setAttribute("v--popup",t=id());let l=_$1.storeFunction[t],o=e.querySelectorAll(".v-datatable-header .v-button");o&&o.length&&!l&&window.innerWidth<=700&&setTimeout((function(){l=document.createElement("ul"),l.className="v-popup-2",e.appendChild(l);let r=null;const a=e=>{l.style.display="none";let t=e.target.getAttribute("commandId"),o=document.querySelector("#"+t);"BUTTON"==o.tagName?o.click():o.children[0].click(),unmask(r)};e.style.position="relative";let n=document.createElement("div");n.className="v-mobil v-table-buttons";let s=document.createElement("i");s.className="fa fa-bars fa-w-14",n.appendChild(s),n.onclick=()=>{for(o=e.querySelectorAll(".v-datatable-header .v-button");l.firstChild;)l.removeChild(l.firstChild);for(s=0;s<o.length;s++)if("none"!=o[s].style.display){let e=document.createElement("li");if(o[s].id||(o[s].id="c-"+id()),e.setAttribute("commandId",o[s].id),"BUTTON"==o[s].tagName){if(o[s].disabled)continue;e.appendChild(o[s].children[0].cloneNode(!0)),e.appendChild(document.createTextNode(o[s].value?o[s].value:o[s].title))}else o[s].children[0].children[1]&&(e.appendChild(o[s].children[0].children[1]),e.appendChild(document.createTextNode(o[s].textContent)));e.onclick=a,l.appendChild(e)}r=mask(l),l.style.display="block",r.onclick=()=>{l.style.display="none",unmask(r)}},e.appendChild(n),_$1.storeFunction[t]=l}),500)}},resize=()=>{},mask=(e,t)=>{if(!document.body)return;let l,o=document.createElement("div");o.style="top:50%;transform:translate(-50%,-50%);position:absolute;width:100%;z-index:2; display: flex;justify-content: center;";let r=o.style;if(r.left="50%",r.textAlign="center",!1!==e)if(e instanceof Element)o=e;else{if(e){let t=document.createElement("div");t.innerHTML=e,o.append(t),o.style="padding:4px;margin-bottom:5px;color:white;font-size:24px;text-align:center"}l=document.createElement("div"),r=l.style,l.className="loading"}let a=document.createElement("div");r=a.style,r.height="100%",r.top="0px",r.position="absolute",r.left="0",r.zIndex="10000",r.width="100%";let n=document.createElement("div");return n.className="v-overlay",a.appendChild(n),o.style.zIndex="1001",a.appendChild(o),a.className="v-mask",l&&o.appendChild(l),document.body.appendChild(a),a},MsgBox$1=(e,t,l)=>{if(l||(l=["OK"]),!document.body)return;let o=document.createElement("div");o.classList.add("v-overlay"),o.style.padding="40px",o.style.zIndex="2000",document.body.appendChild(o);let r=document.createElement("div"),a=document.createElement("div"),n=document.createElement("div"),s=document.createElement("div");s.className="v-msgbox-buttons",r.classList.add("v-dialog"),r.classList.add("v-msgbox"),e instanceof Element?n=e:n.innerHTML=e,r.setAttribute("path",_$1.currentPath);let i=function(){r.style.display="none",o.style.display="none",r.parentNode.removeChild(r),o.parentNode.removeChild(o),t&&t(this.getAttribute("index"))};for(let e=0;e<l.length;e++){let t=document.createElement("button");t.innerHTML=l[e],t.type="button",t.setAttribute("index",e),t.className="v-button ui-widget ui-state-default ui-corner-all",s.appendChild(t),t.addEventListener("click",i)}a.className="v-dialog-content v-widget-content",a.appendChild(n),a.appendChild(s),r.appendChild(a),o.appendChild(r),o.style.visibility="unset",o.style.opacity="unset",o.style.overflow="auto",r.style.margin="0px auto 50%",r.style.position="unset";let u=r.querySelector(".v-js-close");if(!u){let e=document.createElement("span");r.style.position="relative",e.style.position="absolute",e.className="fa fa-close",u=document.createElement("a"),u.className="v-js-close ui-dialog-titlebar-icon ui-dialog-titlebar-close ui-corner-all",u.appendChild(e),r.appendChild(u),u.addEventListener("click",i)}},configureAxios=e=>{if(e.configured)return;let t;e.configured=1,_$1.axios_get=e.get,e.interceptors.request.use((l=>(e.noInterceptor||(_$1.eeee=l,l.mask?l.mask():t||(t=mask())),l)),(e=>(t=unmask(t),MsgBox$1("request "+id()+" "+e.message),Promise.reject(e)))),e.interceptors.response.use((l=>(t=unmask(t),delete e.noInterceptor,l)),(l=>{if(console.log("interceptors.response.use.error"),e.noInterceptor)return delete e.noInterceptor,t=unmask(t),Promise.reject(l);if(e.error&&0==e.error(l))t=unmask(t);else{let e,o=l.response;if(o&&("string"==typeof o.data?e=o.data:o.data&&(o.data.data&&(e=o.data.data.message),e||(e=o.data.msg||o.data.message)),e||(e=o.status+": "+o.statusText)),e||(e=l.message),t=unmask(t),o&&(401==o.status||403==o.status)){const e=app();if(e&&localStorage.getItem("session"))return e.axios.noInterceptor=1,void e.axios.post(e.axios.VITE_LOGIN_PATH+"/validate",{JWT:"YOUR_JWT_HERE"}).catch((t=>{console.log("e.response=",t),t.response.data.success||MsgBox$1("Session terminada!",(()=>{e.logout()}))}))}l.config?.error?l.config.error(l,e):l.request?MsgBox$1("<b>"+l.request.responseURL+"</b><br/><br/>"+e):MsgBox$1(e)}return delete e.error,Promise.reject(l)}))},pad=(e,t)=>{if(null!=e){let l=1*e+"";for(;l.length<t;)l="0"+l;return l}},clean=e=>{const t={...e};for(let e in t)""!==t[e]&&null!==t[e]&&"function"!=typeof t[e]&&void 0!==t[e]||delete t[e];return t},sum=e=>(void 0).reduce(((t,l)=>t+((l=e?l[e]:l)?Number(l):0)),0);function createGetters(){return{get networkStatus(){return _$1.app?.networkStatus||{connected:!0}},get db(){return _$1.app?.db},app:()=>_$1.app,setApp(e){_$1.app=e}}}const app=()=>_$1.app,db=()=>_$1.db,initDB=(e,t)=>{let l=window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB;if(_$1.IDBTransaction=window.IDBTransaction||window.webkitIDBTransaction||window.msIDBTransaction,_$1.IDBKeyRange=window.IDBKeyRange||window.webkitIDBKeyRange||window.msIDBKeyRange,l){if(l)return _$1.stores=t,new Promise(((o,r)=>{l.databases().then((a=>{const n=a.find((e=>"db"===e.name)),s=n&&n.version||0;if(s<e){console.log(`Eliminando base de datos (versión actual: ${s}, nueva versión: ${e})`);l.deleteDatabase("db").onsuccess=()=>{let a=l.open("db",e);a.onupgradeneeded=e=>{let l=e.target.result;t.forEach((e=>{if(!l.objectStoreNames.contains(e[0])){const{keyPath:t}=e[1];l.createObjectStore(e[0],{keyPath:t,autoIncrement:!t})}}))},a.onerror=e=>{r(e)},a.onsuccess=()=>{_$1.db=a.result,o(_$1.db)}}}else{let a=l.open("db",e);a.onupgradeneeded=e=>{let l=e.target.result;t.forEach((e=>{if(!l.objectStoreNames.contains(e[0])){const{keyPath:t}=e[1];l.createObjectStore(e[0],{keyPath:t,autoIncrement:!t})}}))},a.onerror=e=>{r(e)},a.onsuccess=()=>{_$1.db=a.result,o(_$1.db)}}}))}))}else window.alert("Your browser doesn't support a stable version of IndexedDB.");return l},getStoredList=async(e,t)=>{const l=db();let o;try{o=JSON.parse(sessionStorage.getItem("loadedStores"))}catch(e){}if(null==o&&(o={}),!o[e]&&networkStatus.connected){const t=_$1.stores.filter((t=>t[0]==e));if(t.length)throw`ERROR: store '${e}' no exists!`;let r=t[0];const{src:a}=r[1];if(!a)throw`ERROR: Url for store '${r[0]}' is empty!`;let n=a?await _$1.axios_get(a):[];n=n.data||n,await new Promise(((t,a)=>{let s=l.transaction([r[0]],"readwrite"),i=s.objectStore(r[0]);const u=i.clear();u.onsuccess=()=>{n.forEach((e=>{i.add(e).onerror=e=>{console.error(`⚠️ Store '${e[0]}' error addd data!`,e)}}))},u.onerror=()=>{console.error(`⚠️ Store '${r[0]}' error data!`,r)},s.oncomplete=()=>{o[e]=1,sessionStorage.setItem("loadedStores",JSON.stringify(o)),t()},s.onerror=e=>{console.error(`ERROR: ⚠️ Error en la transacción for store '${e[0]}'!`,e),a()}}))}return await new Promise(((t,o)=>{if(l){const o=l.transaction(e).objectStore(e).getAll();o.onsuccess=()=>{t(o.result)}}else console.log("1=========>db=",window._.db),o("=======>db is null esta faltando")}))},getters=createGetters(),{networkStatus:networkStatus,setApp:setApp}=getters,deleteAllCookies=()=>{const e=document.cookie.split(";");for(let t of e){const e=t.split("=")[0].trim();document.cookie=`${e}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;`}},useAppStore=pinia.defineStore("connection",(()=>{const e=getPiniaInstance(),t=getConfigApp();if(!e)throw new Error("Pinia no ha sido inicializado. Llama a setupPinia() en tu app.");const l=vue.ref(!1),o=vue.ref(!1),r=vue.ref(t.router),a=vue.ref(t.axios),n=vue.ref(null),s=vue.ref(null);l.value="false"!==localStorage.getItem("connected");const i=e=>{setTimeout((()=>{n.value&&(a.value.noInterceptor=1,a.value.post(a.value.VITE_LOGIN_PATH+"/refresh",{}).then((({data:t})=>{const{token:l,user_nicename:o,perms:r}=t;n.value={token:l,people:{display_name:o},perms:r},e(i)})).catch((e=>{console.error(e)})))}),6e5)};let u;vue.watch(n,(e=>{e&&e.token?(a.value.defaults.headers.common={Authorization:"Bearer "+e.token},localStorage.setItem("session",JSON.stringify(e)),u||(u=i,i(i))):(localStorage.removeItem("session"),u=null)}));const c=localStorage.getItem("session");n.value=c?JSON.parse(c):null,vue.watch(l,(e=>{localStorage.setItem("connected",String(e))}));const d=vue.computed((()=>s.value?.connected)),p=vue.computed((()=>!!n.value?.token));return{connected:l,session:n,logout:()=>{n.value=null,deleteAllCookies(),r.value.push("/login")},unauthorized:o,connect:e=>{n.value=e,r.value.push("/admin")},authenticated:p,config:({axios:e,router:t})=>{t&&(r.value=t),e&&(a.value=e,configureAxios(e))},axios:a,router:r,online:d,networkStatusChange:e=>{s.value=e}}}));var script$q={name:"VAutocomplete",props:{value:{type:Object,required:!0},data:{type:Array,default:()=>null},placeholder:String,label:String,default:Object,store:String,params:Object,autoload:{type:Boolean,default:!1},floating:{type:Boolean,default:!0},src:String,readonly:Boolean,nowrap:Boolean,disabled:Boolean,showSelection:{type:Boolean,default:!0},pagination:{type:Number,default:10}},setup(e,t){const{emit:l,slots:o}=t;useAppStore();const r=vue.ref(0),a=vue.ref(null),n=vue.ref(-1),s=vue.ref(""),i=vue.ref(null),u=vue.ref(!1),c=vue.ref(0),d=vue.ref("");vue.watch((()=>e.value),(e=>{a.value=e})),vue.watch((()=>e.data),(e=>{i.value=e})),vue.onMounted((()=>{d.value=e.inputClass,e.autoload&&v(),document.addEventListener("click",h)})),vue.onBeforeUnmount((()=>{document.removeEventListener("click",h)}));const p=vue.computed((()=>{n.value=-1;const e=s.value?s.value.trim().toLowerCase().split(/[ ,]+/):null;return i.value&&s.value?i.value.filter((t=>{const l=JSON.stringify(t).toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"");return e.every((e=>l.includes(e)))})):i.value})),v=async t=>{const{src:o,source:a}=e;let n=Number(e.pagination);if(1===t)r.value+=n;else if(r.value=0,e.data&&e.autoload)return;let d={query:s.value};e.params&&(d=mergeDeep(d,e.params)),axios$2.get((o||e.source)+(n>0?"/"+r.value+"/"+n:""),{params:d}).then((l=>{const o=l.data;console.log(o),o.error?MsgBox(o.error):(i.value=1===t?i.value.concat(o.data?o.data:o):o.data?o.data:o,console.log(i),c.value=o.size,e.autoload||(u.value=!0),console.log("========================="))})).catch(m).then((()=>{l("complete",{data:i.value,query:s.value,target:"me"})}))},m=e=>{console.log(e)},h=e=>{};return{query:s,show:u,selected:a,data2:p,focused:n,inputClass:d,search:v,remove:()=>{l("input",null)},clickout:h,focusout:e=>{},setSelected:e=>{a.value=e,l("update:modelValue",e)},getLabel:t=>{if(e.label){const l=e.label.split(".");for(let e=0;e<l.length;e++)t&&(t=t[l[e]])}return t},hasSlot:(e="default")=>!!o[e]}}};const _hoisted_1$i=["value","disabled"],_hoisted_2$9=["disabled","placeholder"],_hoisted_3$5={class:"v-list"},_hoisted_4$3=["onClick"],_hoisted_5$1={key:0,class:"center yellow",style:{padding:"5px"}};function render$m(e,t,l,o,r,a){return vue.openBlock(),vue.createElementBlock("div",{class:"v-autocomplete",onFocusout:t[7]||(t[7]=(...e)=>o.focusout&&o.focusout(...e)),value:l.value,disabled:l.disabled},[o.selected&&l.showSelection?(vue.openBlock(),vue.createElementBlock("div",{key:0,class:"v-selection",style:vue.normalizeStyle({whiteSpace:l.nowrap?"nowrap":""})},[vue.renderSlot(e.$slots,"label",{selected:o.selected}),vue.createTextVNode(" "+vue.toDisplayString(o.hasSlot("label")?" ":o.getLabel(o.selected))+"  ",1),l.readonly?vue.createCommentVNode("v-if",!0):(vue.openBlock(),vue.createElementBlock("span",{key:0,onClick:t[0]||(t[0]=(...e)=>o.remove&&o.remove(...e)),class:"remove-icon"},t[8]||(t[8]=[vue.createElementVNode("i",{class:"fa fa-times"},null,-1)])))],4)):vue.createCommentVNode("v-if",!0),o.selected?vue.createCommentVNode("v-if",!0):(vue.openBlock(),vue.createElementBlock("span",{key:1,onClick:t[1]||(t[1]=(...e)=>o.search&&o.search(...e)),class:"search-icon"},t[9]||(t[9]=[vue.createElementVNode("i",{class:"fa fa-xs fa-sync"},null,-1)]))),o.selected?vue.createCommentVNode("v-if",!0):vue.withDirectives((vue.openBlock(),vue.createElementBlock("input",{key:2,onKeyup:[t[2]||(t[2]=(...t)=>e.keyup&&e.keyup(...t)),t[3]||(t[3]=vue.withKeys(vue.withModifiers(((...e)=>o.search&&o.search(...e)),["stop","prevent"]),["enter"]))],class:vue.normalizeClass(o.inputClass),onFocus:t[4]||(t[4]=e=>o.show=!0),disabled:l.disabled,placeholder:l.placeholder,"onUpdate:modelValue":t[5]||(t[5]=e=>o.query=e)},null,42,_hoisted_2$9)),[[vue.vModelText,o.query]]),vue.createVNode(vue.Transition,{name:"fade",persisted:""},{default:vue.withCtx((()=>[vue.withDirectives(vue.createElementVNode("div",{class:"v-resultpane",style:vue.normalizeStyle({zIndex:2,width:"calc(100% - 2px)",position:l.floating?"absolute":"relative"})},[vue.createElementVNode("div",_hoisted_3$5,[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(o.data2,((t,l)=>(vue.openBlock(),vue.createElementBlock("div",{key:l,class:vue.normalizeClass({"v-selected":o.selected==t,"v-focused":o.focused==l}),onClick:e=>o.setSelected(t)},[vue.renderSlot(e.$slots,"default",{row:t})],10,_hoisted_4$3)))),128)),e.data0&&e.data0.length<e.total?(vue.openBlock(),vue.createElementBlock("div",{key:0,class:"center",onClick:t[6]||(t[6]=e=>o.search(1))},"Load more "+vue.toDisplayString(e.total-e.data0.length)+" results...",1)):vue.createCommentVNode("v-if",!0)]),o.data2&&o.data2.length<1?(vue.openBlock(),vue.createElementBlock("div",_hoisted_5$1,"No results found.")):vue.createCommentVNode("v-if",!0)],4),[[vue.vShow,o.show&&!o.selected]])])),_:3})],40,_hoisted_1$i)}script$q.render=render$m,script$q.__scopeId="data-v-72884078",script$q.__file="src/v-autocomplete.vue";var script$p={name:"VButton",mounted(){var e=this,t=document.createElement("span"),l=document.createElement("i");t.className="ui-button-text ui-c ",t.innerHTML=e.$attrs.value?e.$attrs.value:"ui-button",e.$el.addEventListener("click",(t=>{t.component=e})),e.$attrs.icon?(e.$attrs.value?e.$el.classList.add("v-button-text-icon-left"):e.$el.classList.add("v-button-icon-only"),l.dataset.icon=e.$attrs.icon,l.className="fa "+e.$attrs.icon,e.$el.appendChild(l)):(t=document.createElement("span"),e.$el.classList.add("ui-button-text-only"),e.$el.appendChild(t)),e.$attrs.value&&((t=document.createElement("span")).appendChild(document.createTextNode(e.$attrs.value)),e.$el.appendChild(t)),e.updateIcon()},methods:{updateIcon(){var e=this;setTimeout((function(){var t=e.$el.querySelector("svg");if(t){var l=t.dataset;l.icon||(l.icon=e.$attrs.icon)}}),1e3)}}};const _hoisted_1$h={type:"button",class:"_ ui-widget ui-state-default ui-corner-all v-button"};function render$l(e,t,l,o,r,a){return vue.openBlock(),vue.createElementBlock("button",_hoisted_1$h)}script$p.render=render$l,script$p.__file="src/v-button.vue";var script$o={name:"VCalendar",props:{modelValue:null,type:String,required:String,readonly:String,max:String,min:String},setup(e,{emit:t}){const{type:l,modelValue:o,max:r,min:a}=e,n=vue.ref(null),s=e=>{t("update:modelValue",e),vue.nextTick((()=>{t("changed",e)}))},i=e=>{if(e){let t;if("time"===l)return t=e.split(":"),new Date(1981,1,6,parseInt(t[0]),parseInt(t[1]),t.length>2?parseInt(t[2]):0);{if(!isNaN(e))return new Date(e);let o;if("datetime-local"===l)return o=e.split("T"),t=o[1].split(":"),o=o[0].split("-"),o=new Date(parseInt(o[0]),parseInt(o[1])-1,parseInt(o[2]),parseInt(t[0]),parseInt(t[1]),t.length>2?parseInt(t[2]):0),o;{o=e.split("-");let t=parseInt(o[0]);return t<100?e:(o=new Date(t,parseInt(o[1])-1,parseInt(o[2])),o)}}}return e};vue.watch((()=>e.modelValue),(e=>{u(e)}));const u=e=>{if(!n.value)return;let t,o=i(e);o&&(t="string"==typeof o?o:"time"===l?pad(o.getHours(),2)+":"+pad(o.getMinutes(),2):"datetime-local"===l?pad(o.getFullYear(),4)+"-"+pad(o.getMonth()+1,2)+"-"+pad(o.getDate(),2)+"T"+pad(o.getHours(),2)+":"+pad(o.getMinutes(),2):pad(o.getFullYear(),4)+"-"+pad(o.getMonth()+1,2)+"-"+pad(o.getDate(),2)),n.value.value=t};return{enterD:e=>{let o=e.target.value,n=i(o);return r&&n&&n.getTime()>=i(r).getTime()||a&&n&&n.getTime()<=i(a).getTime()?(t("invalid",{target:me,value:n}),n=null,void(e.target.value=n)):void("time"===l?s(pad(n.getHours(),2)+":"+pad(n.getMinutes(),2)+":00"):n.getTime&&s(n.getTime()))},input:n}}};const _hoisted_1$g=["required","readonly","min","max","type"];function render$k(e,t,l,o,r,a){return vue.openBlock(),vue.createElementBlock("div",null,[vue.createElementVNode("input",{required:l.required,ref:"input",readonly:l.readonly,min:l.min,max:l.max,onChange:t[0]||(t[0]=(...e)=>o.enterD&&o.enterD(...e)),type:l.type?l.type:"date"},null,40,_hoisted_1$g)])}script$o.render=render$k,script$o.__file="src/v-calendar.vue";var script$n={name:"VCheckboxGroup",props:{required:String,name:String},data:()=>({value:[],options:[],nam:null}),created(){this.nam||(this.nam=this.$props.name?this.$props.name:"input_"+id()),this.update2()},updated(){this.update2()},mounted(){this.options=this.$el.querySelectorAll("input:not(.v-chk)");for(var e=0;e<this.options.length;e++)this.options[e].classList.add("v-chk");this.update2()},methods:{update2(){var e=this.options,t=this.$attrs.value;"string"==typeof t&&(t=t.split("|"));for(var l=0;l<e.length;l++){e[l].checked=!1;for(var o=0;t&&o<t.length;o++)e[l].value==t[o]&&(e[l].checked=!0)}},onChange:function(e,t){var l=this,o=l.$attrs.value;if(("string"==typeof o||o instanceof String)&&(o=o.split("|")),t)o||(l.$attrs.value=o=[]),o.push(e);else{var r=o.indexOf(e);r>-1&&o.splice(r,1)}l.$emit("input",o)}}};function render$j(e,t,l,o,r,a){return vue.openBlock(),vue.createElementBlock("div",null,[vue.renderSlot(e.$slots,"default")])}script$n.render=render$j,script$n.__file="src/v-checkbox-group.vue";var script$m=vue.defineComponent({name:"VCheckbox",props:{value:null,modelValue:null,valueFalse:null,label:String,readonly:Boolean},emits:["update:modelValue"],setup(e,{emit:t}){const l=vue.ref(null),o=vue.ref(0),r=vue.computed((()=>e.value?e.value===e.modelValue:["true","1",!0].includes(e.modelValue)));vue.watch((()=>e.modelValue),(e=>{l.value&&(l.value.checked=r.value)}));return vue.onMounted((()=>{l.value&&(l.value.checked=r.value)})),{input:l,hadValue:o,isChecked:r,change:()=>{if(!e.readonly){const r=l.value.checked,a=r?e.value||r:e.valueFalse??r;a&&(o.value=1),t("update:modelValue",a)}},getLabel:vue.computed((()=>e.label||("string"==typeof e.value?e.value:"")))}}});const _hoisted_1$f=["innerHTML"],_hoisted_2$8=["checked","value"];function render$i(e,t,l,o,r,a){return vue.openBlock(),vue.createElementBlock("label",{style:{"font-weight":"normal !important",display:"block"},class:"v-checkbox",onClick:t[1]||(t[1]=vue.withModifiers((()=>{}),["stop"]))},[vue.createElementVNode("span",{innerHTML:e.getLabel},null,8,_hoisted_1$f),vue.createElementVNode("input",{ref:"input",type:"checkbox",checked:e.isChecked,onChange:t[0]||(t[0]=(...t)=>e.change&&e.change(...t)),value:e.value},null,40,_hoisted_2$8),t[2]||(t[2]=vue.createElementVNode("span",{class:"checkmark"},null,-1))])}script$m.render=render$i,script$m.__file="src/v-checkbox.vue";var script$l={name:"VDataview",props:{value:Array,filterKey:String,src:String,filters:Object,store:null,itemWidth:null,rowKey:String,rowStyleClass:null,pagination:null,selectable:Boolean,scrollable:Boolean,autoload:{type:Boolean,default:!0}},data:function(){return{data:null,pages:1,page:1,columns:1,w:0,row:{},error:null,size:null,sortKey:"",selected:[],sortOrders:{},rowStyleClassFunc:null}},created(){var me=this;try{me.rowStyleClass&&(eval("me.rowStyleClassFunc=function(row,item,index){return "+me.rowStyleClass+"}"),me.rowStyleClassFunc({},{},0))}catch(e){me.rowStyleClassFunc=null,console.log("Error en la expresion rowStyleClassFunc=function(row,item,index){return "+me.rowStyleClass+"}")}},updated(){console.log("updated"),this.$emit("updated"),this.resize()},mounted(){var e=this;e.$el.addEventListener("parentResize2",e.resize),e.autoload&&e.load(),e.resize()},methods:{resize(){var e=this;if(e.itemWidth){var t=1+Math.trunc(e.$el.offsetWidth/Number(e.itemWidth));t>6&&(t=6),e.columns=t}},async getStoredList(e){let t=new Promise((t=>{var l=window._.db.transaction(e).objectStore(e).getAll();l.onsuccess=function(){t(l.result)}}));return await t},async loadStore(){let e=this,t=e.store;if(null!=t){let l;return window._.db&&(l=await e.getStoredList(t)),l||(l=[]),e.data=e.data?l.concat(e.data):l,console.log("loadStore"),console.log(e.data),e.data}},getRowClass(e,t){var l=this,o=t%l.columns+1,r=["c-w-"+l.columns];return o==l.columns&&r.push("v-last"),l.rowStyleClassFunc?r.push(l.rowStyleClassFunc(e,e,t)):r.push(l.rowStyleClass),r},remove(e){e=e.id?e.id:e;var t=this.data,l=t.map((e=>e.id)).indexOf(e);t.splice(l,1)},error2(e,t){this.data=[],this.error=t},load(e){var t=this;if(this.selected=[],t.value)t.data=t.value;else{!0===e&&(t.page=1);var l=t.src;l||(l=t.$root.apiLink(window.location.pathname)),l.endsWith("/")&&(l=l.slice(0,l.length-1)),t.pagination&&(l+="/"+(t.page-1)*t.pagination+"/"+t.pagination),axios.get(l,{error:t.error2,params:t.filters}).then((function(l){if(l.data&&l.data.error)MsgBox(l.data.error);else{var o=t.value?t.value:l.data.data?l.data.data:l.data;t.data||(t.data=[]),t.data=!0===e?o:t.data?t.data.concat(o):t.data,t.size=l.data.size,l.data&&l.data.size&&(t.pages=Math.ceil(l.data.size/t.pagination),t.page>t.pages&&(t.page=1)),t.$emit("loaded",{target:t,response:l})}})).catch(t.error)}}}};const _hoisted_1$e={class:"v-dataview"};function render$h(e,t,l,o,r,a){return vue.openBlock(),vue.createElementBlock("div",_hoisted_1$e,[e.data?(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,{key:0},vue.renderList(e.data,((t,l)=>(vue.openBlock(),vue.createElementBlock("div",{class:vue.normalizeClass(a.getRowClass(t,l))},[vue.renderSlot(e.$slots,"default",{row:t,item:t,index:l})],2)))),256)):vue.createCommentVNode("v-if",!0),e.data&&!e.data.length?(vue.openBlock(),vue.createElementBlock("div",{key:1,class:vue.normalizeClass(["center v-no-results",{error:e.error}])},vue.toDisplayString(e.error?e.error:"No existen registros para mostrar"),3)):vue.createCommentVNode("v-if",!0),e.data&&e.size>e.data.length?(vue.openBlock(),vue.createElementBlock("div",{key:2,onClick:t[0]||(t[0]=t=>a.load(e.page++)),class:"center v-more-results"},"Ver mas resultados")):vue.createCommentVNode("v-if",!0)])}script$l.render=render$h,script$l.__file="src/v-dataview.vue";var script$k={name:"VFieldset",props:{legend:String,closable:null},watch:{closed(e){this.$emit("change",{target:this,closed:e}),this.$emit("input",!e)}},data:()=>({closed:!1}),created(){this.closed=this.closable},mounted(){var e=this;e.$el.addEventListener("parentResize",(t=>{t.$target=e,e.$emit("resize",t)}))},updated(){var e=this;setTimeout((function(){var t=e.$el.querySelector("legend > * > svg");if(t)try{console.log(),t.dataset.icon=t.parentNode.dataset.icon}catch(e){console.log("icon"),console.log(e)}}),50)}};const _hoisted_1$d={class:"v-fieldset"},_hoisted_2$7=["data-icon"],_hoisted_3$4=["innerHTML"],_hoisted_4$2={style:{flex:"1",display:"flex","flex-direction":"column"}};function render$g(e,t,l,o,r,a){return vue.openBlock(),vue.createElementBlock("fieldset",_hoisted_1$d,[l.legend?(vue.openBlock(),vue.createElementBlock("legend",{key:0,onClick:t[0]||(t[0]=e=>r.closed=l.closable&&!r.closed),style:vue.normalizeStyle({cursor:l.closable?"pointer":""})},[l.closable?(vue.openBlock(),vue.createElementBlock("span",{key:0,"data-icon":r.closed?"plus":"minus",style:{margin:"0px 5px 0px 0px"}},[vue.createElementVNode("i",{class:vue.normalizeClass([r.closed?"fa-plus":"fa-minus","fa"])},null,2)],8,_hoisted_2$7)):vue.createCommentVNode("v-if",!0),vue.createElementVNode("span",{innerHTML:l.legend},null,8,_hoisted_3$4)],4)):vue.createCommentVNode("v-if",!0),vue.withDirectives(vue.createElementVNode("div",_hoisted_4$2,[vue.renderSlot(e.$slots,"default")],512),[[vue.vShow,!r.closed]])])}script$k.render=render$g,script$k.__file="src/v-fieldset.vue";var script$j={name:"VForm",props:["header","store","action"],setup(e,t){const{store:l}=e,{slots:o,expose:r}=t,a=vue.ref(null),n=vue.inject("viewCollector"),s={get:()=>({...e})};return vue.provide("formCollector",s),n.push({store:l,type:"v-form",$el:a,$forceUpdate:()=>{}}),r({...e}),()=>{const t=[];return e.header&&t.push(vue.h("div",{class:"v-widget-header v-panel-titlebar"},[vue.h("span",{class:"v-panel-title"},e.header)])),t.push(vue.h("div",{ref:a,class:"v-dialog-content v-widget-content"},[vue.h("form",{action:e.action},o.default())])),vue.h("div",{class:"ui-panel"},t)}},watch:{header(e){this.setTitle(e)}},data:()=>({timer:null}),methods:{setTitle(e){var t=this.$parent.app;t&&setTimeout((()=>{t.title=e}),100)},getAbsoluteHeight(e){var t=window.getComputedStyle(e),l=parseFloat(t.marginTop)+parseFloat(t.marginBottom);return Math.ceil(e.offsetHeight+l)}},mounted(){var e=this;e.$el.querySelector("form").addEventListener("submit",(t=>{t.preventDefault();var l=e.$parent;return l.refresh&&l.refresh(),!1})),e.setTitle(e.header)},updated(){for(var e=this.$el.querySelectorAll("[type=number]:not(._)"),t=0;t<e.length;t++){var l=()=>{var e=this,t=e.value;if(t){t=n(t),e.max&&t>n(e.max)&&(t=n(e.max)),e.min&&t<n(e.min)&&(t=n(e.min));var l=this.getAttribute("decimal");null!==l&&(t=t.toFixed(1*l)),e.value=t}};e[t].oninput=l,e[t].onblur=l,e[t].classList?e[t].classList.add("_"):e[t].className="_"}e=this.$el.querySelectorAll(".numeric:not(._)");for(t=0;t<e.length;t++)e[t].addEventListener("keyup",(e=>{86==e.keyCode&&isNaN(this.value)&&(this.value="")})),e[t].addEventListener("keydown",(e=>{console.log("eeeeeee"+e.keyCode),-1!==[46,8,9,27,13,110,88,86].indexOf(e.keyCode)||65===e.keyCode&&(!0===e.ctrlKey||!0===e.metaKey)||e.keyCode>=35&&e.keyCode<=40||(e.shiftKey||e.keyCode<48||e.keyCode>57)&&(e.keyCode<96||e.keyCode>105)&&e.preventDefault()})),e[t].classList?e[t].classList.add("_"):e[t].className="_"},__file:"src/v-form.vue"},script$i={name:"VGroup",props:{required:String,name:String},data:()=>({value:null,nam:null}),updated(){this.update2()},mounted(){this.update2()},created(){this.nam||(this.nam=this.$props.name?this.$props.name:"input_"+window._.id())},methods:{getInputs(e,t){var l=this;return e.children&&Array.from(e.children).forEach((e=>{"INPUT"==e.tagName?t.push(e):e.classList.contains("v-group")||l.getInputs(e,t)})),t},update2(){for(var e=this.getInputs(this.$el,[]),t=0;t<e.length;t++)e[t].value==this.$attrs.value?e[t].checked=!0:e[t].checked=!1},onChange(e){this.value=e,""===e&&(e=null),this.$emit("input",e)}}};const _hoisted_1$c={class:"v-group"};function render$f(e,t,l,o,r,a){return vue.openBlock(),vue.createElementBlock("div",_hoisted_1$c,[vue.renderSlot(e.$slots,"default")])}script$i.render=render$f,script$i.__file="src/v-group.vue";var script$h={name:"VLayerControl",data:()=>({loaded:null,map:null,district:null,dl:null}),setup({baseURL:e="https://web.regionancash.gob.pe"},{emit:t}){const l=vue.ref(),o=vue.inject("collector"),r=vue.ref(),a=vue.ref();let n,s;return o.push((o=>{(o=>{a.value=o;let i=new ol$1.Collection;l.value=i;let u=document.createElement("i");u.setAttribute("class","fa fa-expand"),o.addControl(new FullScreen({label:u,tipLabel:"Fullscreen"}));let c=new VectorSource({url:e+"/fs/geo/02.geojson",format:new GeoJSON}),d=r.value=new VectorLayer({source:c,style:e=>new style.Style({fill:new style.Fill({color:"rgba(255, 0, 0, 0.0)"}),stroke:new style.Stroke({color:"#4073CE",width:1}),text:new style.Text({text:e.values_.name?e.values_.name.toUpperCase():"",fill:new style.Fill({color:"#4073CE"}),stroke:new style.Stroke({color:"#4073CE",width:.5})})}),id:"provinces"});d.onChange=e=>{let t=e.feature;s!=t.getId()&&(i.clear(),i.push(t),e.preventDefault&&e.preventDefault(),s=t.getId(),n=t,o.getView().fit(t.getGeometry().getExtent(),{duration:200,callback:()=>{}}))};let p=c.on("change",(()=>{let e,t=c.getFeatures();for(let l=0;l<t.length;l++)if(1*t[l].id_==1*e){d.onChange({feature:t[l]});break}Observable.unByKey(p)})),v=new VectorLayer({preload:1/0,source:new VectorSource,id:"districts",style:e=>new style.Style({fill:new style.Fill({color:"rgba(16, 110, 138, 0.0)"}),stroke:new style.Stroke({color:"#194300",width:1}),text:new style.Text({text:e.values_.name?e.values_.name.toUpperCase():"",fill:new style.Fill({color:"#194300"}),stroke:new style.Stroke({color:"#194300",width:.5})})})});o.on("moveend",(()=>{if(n){if(n.id_<1e4){v.setSource(new VectorSource({url:e+"/fs/geo/"+n.id_+".geojson",format:new GeoJSON}));let t=v.getSource().on("change",(()=>{Observable.unByKey(t)}))}t("scope",{feature:n,target:{}}),n=null}})),d.onSelect=e=>{me.$emit("select",e)},o.addLayer(d),o.addLayer(new VectorLayer({id:"district",source:new VectorSource,style:new style.Style({fill:new style.Fill({color:"rgba(255, 150, 150, 0.0)"}),stroke:new style.Stroke({color:"#4073CE",width:1})})})),new style.Style({fill:new style.Fill({color:"rgba(16, 110, 138, 5.0)"})}),new style.Style({fill:new style.Fill({color:"rgba(255, 150, 150, 0.0)"})}),v.onChange=e=>{let t=e.feature;s!=t.getId()&&(2==i.getLength()&&i.pop(),i.push(t),e.preventDefault&&e.preventDefault(),s=t.getId(),n=t,o.getView().fit(t.getGeometry().getExtent(),{duration:300}))},v.onSelect=e=>{t("select",e)},o.addLayer(v),t("render",{map:o})})(o)})),{}}};function render$e(e,t,l,o,r,a){return vue.openBlock(),vue.createElementBlock("div",null,[vue.renderSlot(e.$slots,"default")])}script$h.render=render$e,script$h.__file="src/v-layer-control.vue";var script$g={name:"VMapControl",setup(e,{emit:t}){const{visible:l}=e,o=vue.ref(null),r=vue.ref(!!l),a=vue.inject("collector"),n=vue.ref(null);a.push((e=>{e.addControl(new Control({element:o.value})),n.value=!0}));const s=vue.ref();return{el:o,ready:n,visible0:r,enter:e=>{e.stopPropagation(),s.value?clearTimeout(s.value):t("click",e),s.value=setTimeout((()=>{s.value=null}),500)}}},props:{icon:String,visible:{default:1}},computed:{slotPassed(){return!!this.$slots.default}},data:()=>({slotUsed:!1}),updated(){var e=this.$el.querySelectorAll(":scope > :not(.v-map-control-button)").length;0==e&&(e=this.$el.textContent.trim().length),this.slotUsed=e},methods:{toggle(){this.visible0=!this.visible0}}};const _hoisted_1$b={ref:"el",class:"ol-unselectable ol-control"};function render$d(e,t,l,o,r,a){return vue.withDirectives((vue.openBlock(),vue.createElementBlock("div",_hoisted_1$b,[vue.renderSlot(e.$slots,"default"),r.slotUsed?vue.createCommentVNode("v-if",!0):(vue.openBlock(),vue.createElementBlock("button",{key:0,class:"v-map-control-button",onClick:t[0]||(t[0]=vue.withModifiers(((...e)=>o.enter&&o.enter(...e)),["prevent"]))},[l.icon?(vue.openBlock(),vue.createElementBlock("i",{key:0,class:vue.normalizeClass(["fa fa-xs",l.icon])},null,2)):vue.createCommentVNode("v-if",!0)]))],512)),[[vue.vShow,o.ready&&!0]])}script$g.render=render$d,script$g.__file="src/v-map-control.vue";class Drag extends PointerInteraction{constructor(){super({handleDownEvent:handleDownEvent,handleDragEvent:handleDragEvent,handleMoveEvent:handleMoveEvent,handleUpEvent:handleUpEvent}),this.layers_=[],this.coordinate_=null,this.listeners_=[],this.cursor_="pointer",this.feature_=null,this.previousCursor_=void 0}addLayers(e){e.forEach((e=>{this.layers_.push(e)}))}$on(e,t){this.listeners_.push(t)}}function handleDownEvent(e){const t=e.map,l=this.layers_,o=t.forEachFeatureAtPixel(e.pixel,(function(e,t){if(t&&l.indexOf(t)>-1)return[e,t]}));return o&&(this.coordinate_=e.coordinate,this.feature_=o[0]),!!o}function handleDragEvent(e){const t=e.coordinate[0]-this.coordinate_[0],l=e.coordinate[1]-this.coordinate_[1];this.feature_.getGeometry().translate(t,l),this.coordinate_[0]=e.coordinate[0],this.coordinate_[1]=e.coordinate[1]}function handleMoveEvent(e){if(this.cursor_){const t=e.map,l=this.layers_,o=t.forEachFeatureAtPixel(e.pixel,(function(e,t){if(t&&l.indexOf(t)>-1)return e})),r=e.map.getTargetElement();o?r.style.cursor!=this.cursor_&&(this.previousCursor_=r.style.cursor,r.style.cursor=this.cursor_):void 0!==this.previousCursor_&&(r.style.cursor=this.previousCursor_,this.previousCursor_=void 0)}}function handleUpEvent(){return this.listeners_.forEach((e=>{e({feature:this.feature,coordinate:this.coordinate_})})),this.coordinate_=null,this.feature_=null,!1}var script$f={name:"VMap",setup(e,{emit:t,expose:l}){const o=vue.ref(null),r=vue.ref(null),a=vue.ref(null),n=vue.ref(null),s=vue.reactive([]);vue.provide("collector",{remove(e){s.splice(s.indexOf(e),1)},push(e){s.push(e)}});const i=e=>{r.value.addLayer(e),t("addlayer",e)},u=(e,l)=>{let o,a;e=e||{};const n=r.value;e.lon&&e.lat?(a=[e.lon,e.lat],o=new geom.Point(a[0]>-100?proj.fromLonLat(a):a)):o=new geom.Point(n.getView().getCenter()),a=o.flatCoordinates;const s=a[0]<-1e4?proj.toLonLat(a):a;t("translateend",{lon:s[0],lat:s[1]}),e.geometry=o;const i=new Feature(e);i.data=e,"object"==typeof e.style?i.setStyle(e.style):i.setStyle(n.styleMap[e.style?e.style:"default"]),a=o.flatCoordinates,a=a[0]<-1e4?proj.toLonLat(a):a,t("translateend",{lon:a[0],lat:a[1]});const u=e.layer||"default";let c=n.getLayerById(u);if(c?c.getSource().addFeatures(i):n.addLayer(c=new VectorLayer({id:u,source:new VectorSource({features:new ol$1.Collection([i])})})),e.draggable){let e=n.drag;e||(n.drag=e=new Drag,e.$on("up",(({coordinate:e,feature:l})=>{const o=proj.toLonLat(e);t("translateend",{lon:o[0],lat:o[1],feature:l})})),n.addInteraction(e),e.addLayers([c]))}return l&&n.getView().animate(Object.assign({center:i.getGeometry().getCoordinates(),zoom:17,duration:500},l)),i},c=e=>{const l={default:new style.Style({image:new style.Circle({radius:8,stroke:new style.Stroke({color:"#8a0000",width:2}),fill:new style.Fill({color:"#ff0000"})})}),star:[new style.Style({image:new style.RegularShape({fill:new style.Fill({color:"#ff0000"}),stroke:new style.Stroke({color:"#8a0000",width:2}),points:5,radius:10,radius2:4,angle:0})})]};let o=((e,t)=>{t||(t=window.location.href);const l=new RegExp("[?&]"+e+"=([^&#]*)").exec(t);return l&&l[1]||0})("location"),i=-1;if(o){let e=o.split("/");o=[parseFloat(e[0]),parseFloat(e[1])],i=e[2],a.value=!0}else o=!1;const c=new Map({target:e,layers:[new layer.Tile({source:new source.OSM})],view:new View({center:[0,0],zoom:2})});c.getLayerById=function(e="default"){let t;return c.getLayers().forEach((l=>{l.get("id")!==e||(t=l)})),t},c.styleMap=l,a.value?(c.getView().setCenter(o),console.log("en el momento de cargar moved to pageLocation="+o),c.getView().setZoom(i||12),r.value=c,console.log("distarar evento buid pageLocation="+o),t("build",m)):(c.getView().fit([-8756221.995832639,-1207995.483261405,-8541070.763947014,-899052.0546471546],c.getSize()),r.value=c,t("build",{map:c}),s.forEach((e=>{e(c)}))),c.getView().getZoom(),c.on("moveend",(()=>{n.value&&(n.value(m),n.value=null),c.getView().getZoom()})),c.on("singleclick",(e=>{let t=c.forEachFeatureAtPixel(e.pixel,((e,t)=>{if(t)return[e,t]}));if(t){let l=t[1],o=t[0];if(e.feature=o,e.map=c,e.preventDefault(),l.onSelect)return void l.onSelect(e)}})),c.on("dblclick",(e=>{let l=c.forEachFeatureAtPixel(e.pixel,((e,t)=>{if(t)return[e,t]}));if(l){let o=l[1];if(l=l[0],e.feature=l,e.map=c,o.onChange)return void o.onChange(e);t("change",l),c.getView().animate({center:l.getGeometry().getCoordinates(),zoom:17,duration:500},(()=>{for(let t=0;t<m.$children.length;t++){let t=m.$children[0];t.open&&t.open(e)}}))}})),r.value=c,setTimeout((()=>{c.updateSize(),c.getView().fit([-8756221.995832639,-1207995.483261405,-8541070.763947014,-899052.0546471546],c.getSize()),r.value=c,t("build",{map:c,addFeature:u})}),100)};return vue.watch(o,(e=>{e&&vue.nextTick((()=>{t("beforeBuild"),c(e)}))})),l({addFeature:u,addLayer:i,map:r,empty:(e="default")=>{if(e=r.value.getLayerById(e)){const t=e.getSource();if(t instanceof VectorSource){return 0===t.getFeatures().length}}return!0}}),{el:o,addLayer:i,addFeature:u}},data:()=>({moved:!1,map:null,movingCompleted:null,styleMap:null,coordinate:{}})};const _hoisted_1$a={ref:"el"};function render$c(e,t,l,o,r,a){return vue.openBlock(),vue.createElementBlock("div",_hoisted_1$a,[vue.renderSlot(e.$slots,"default")],512)}script$f.render=render$c,script$f.__file="src/v-map.vue";var script$e={name:"VNumber",props:{value:Number,max:Number,min:Number,delay:Number},setup(e,t){const{emit:l}=t,o=vue.ref(null);vue.onMounted((()=>{o.value=e.value})),vue.onUpdated((()=>{o.value=t.attrs.modelValue}));return{v:o,handleInput:t=>{let r=o.value;const a=t.target.getAttribute("decimal");null!==r?(r=num(r),e.max&&r>num(e.max)&&(r=num(e.max)),e.min&&r<num(e.min)&&(r=num(e.min)),null!==a&&(r=r.toFixed(Number(a)))):r=null,o.value=t.target.value;let n=_$1.calendarTimer;n&&clearTimeout(n),e.delay?_$1.calendarTimer=setTimeout((()=>{l("input",r),_$1.calendarTimer=null}),13===t.keyCode?0:e.delay):l("input",r)}}}};function render$b(e,t,l,o,r,a){return vue.withDirectives((vue.openBlock(),vue.createElementBlock("input",{type:"number",onKeyup:t[0]||(t[0]=vue.withKeys(((...e)=>o.handleInput&&o.handleInput(...e)),["enter"])),"onUpdate:modelValue":t[1]||(t[1]=e=>o.v=e),onInput:t[2]||(t[2]=(...e)=>o.handleInput&&o.handleInput(...e)),class:"_"},null,544)),[[vue.vModelText,o.v,void 0,{number:!0}]])}script$e.render=render$b,script$e.__file="src/v-number.vue";var script$d={setup(e,t){const l=e,{valueField:o,displayField:r,store:a,filter:n,name:s}=l,{expose:i,emit:u}=t,c=vue.ref([]),d=vue.ref([]),p=vue.ref([]);vue.ref(null);const v=vue.inject("collect");o&&(p.value=o.split("."));const m=vue.computed((()=>{const e=(l.data||[]).concat(d.value||[]);return n?e.filter((e=>-1!==JSON.stringify(e).toLowerCase().indexOf(n.toLowerCase()))):e}));vue.watch(m,(e=>{}));const h=(e,t)=>{const l=p.value;if(l&&l.length)for(let t=0;t<l.length;t++)e&&(e=e[l[t]]);else e&&!t&&(e=e.id?e.id:e.code?e.code:e);return e};let f=o,g=r;g||(g=f);const y=async(e=null,t=null,l=!1)=>{if(!l&&t&&e&&c.value.push([e,t]),!(c.value.length>1)){if(d.value=[],a){let t=await getStoredList(a);const[l]=e?Object.keys(e):[];if(l){let o;try{const r=t.filter((t=>(o=t,o[l].startsWith(e[l]))));d.value=r}catch(e){log(s,"options.error trying to filter ",o),console.error(e)}}else d.value=d.value.concat(t)}for(v(m),l||c.value.shift();c.value.length;){const e=c.value.shift()||[];await y(e[0],e[1],!0)}}};return y.getObjectByIndex=e=>{const t=m.value;return t?t[e]:null},y.getValueByIndex=e=>{const t=m.value;return t?h(t[e],1):null},y.getIndexByValue=(e,t)=>{e&&e.id?e=e.id:e&&e.code&&(e=e.code);for(let l=0;l<m.value.length;l++){const o=m.value[l];if(h(o)==e)return t&&t(l,o),l}return t&&t(-1),-1},v.push(y),vue.onUpdated((()=>{v((l.data||[]).concat(d.value))})),vue.onUnmounted((()=>{v.remove(y)})),i({load:y}),()=>m.value.map((e=>{const t=g?e[g]:e;return f?vue.h("option",{value:h(e)},t):vue.h("option",{value:e.id||e.code||JSON.stringify(e)},t)}))},name:"VOptions",props:{url:String,src:String,name:String,displayField:String,data:Array,store:null,valueField:String,filters:null,filter:null,mode:null},updated(){let e=this;!e.loaded&&e.data&&(e.data2=e.data)},methods:{getParentE(){return this.$el.parentElement.parentElement},getSelectedItem(){let e=this.$el.parentElement;return this.filterList[e.selectedIndex-1]}},__file:"src/v-options.vue"},ol=window.ol,_=window._,axios$1=window.axios,script$c={name:"VOverlay",props:{value:{value:Object},src:String,width:{default:400},header:String},data:()=>({coordinate:null,overlay:null,location:null,ele:null,c:0}),created(){var e=this;e.$parent.$on("beforeBuild",(t=>{console.log(t),e.overlay=new ol.Overlay({element:e.$el,positioning:"bottom-right"})})),e.$parent.$on("build",(t=>{t.map.addOverlay(e.overlay)}))},mounted(){var e=this;e.header&&e.$el.childNodes[0].addEventListener("mousedown",(function(t){const l=e.$el.parentElement;var o=window.getComputedStyle(l),r=parseFloat(o.left),a=parseFloat(o.top),n=t.clientX,s=t.clientY,i=l.parentElement;function u(e){l.style.left=r+e.clientX-n+"px",l.style.top=a+e.clientY-s+"px"}i.addEventListener("mousemove",u,!1),i.addEventListener("mouseup",(function(){i.removeEventListener("mousemove",u,!1)}),!1)}),!1)},methods:{close(){this.overlay&&this.overlay.setPosition()},hasSlot(e="default"){return!!this.$slots[e]||!!this.$scopedSlots[e]},load(){var e=this;axios$1.get(_.remoteServer+e.src).then((t=>{e.$emit("input",t.data)}))},open(e){for(var t=this,l=e.map,o=e.feature,r=t.overlay,a=r.element,n=t.$parent.$children,s=0;s<n.length;s++)n[s].close&&(n[s].$el.style.opacity=0,n[s].close());e.coordinate?t.coordinate=e.coordinate:(e.coordinate=l.getView().getCenter(),t.coordinate=null),r.setPosition(e.coordinate);var i=l.getView().getCenter(),u=l.getView().getResolution(),c=o?o.getGeometry().getCoordinates():[null],d=l.getPixelFromCoordinate(Number(c[0])?c:e.coordinate);if(this.src)axios$1.get(_.remoteServer+this.src).then((e=>{t.$emit("input",e.data),t.c++,setTimeout((function(){var e=l.viewport_.offsetWidth,o=l.viewport_.offsetHeight,n=a.children[0].children[1];n.scrollTop=0;var s=a.offsetHeight;n.style.height=s+100>=o?o-100-a.children[0].children[0].offsetHeight+"px":"300px",s=a.offsetHeight;var c=1*t.width,p=e<=c+40?e-40:c;if(a.style.zIndex=10,a.style.width=p+"px",p/=2,l.getView().animate({center:[i[0]+(d[0]+p+20>=e?+(d[0]+p+20-e):d[0]-20-p<0?-p+d[0]-20:0)*u,i[1]+(d[1]<s?s-d[1]:0)*u],duration:500}),d[0]=d[0]+p-0,d[1]=d[1]-12,r.setPosition(l.getCoordinateFromPixel(d)),t.$el.style.opacity=1,_.mobil)for(var v=r.getElement().querySelectorAll("a:not(._)"),m=0;m<v.length;m++)v[m].addEventListener("click",_.open2)}),400)})).catch((e=>{console.log(e)}));else{var p=l.viewport_.offsetWidth,v=l.viewport_.offsetHeight,m=a.children[0].children[1];m.scrollTop=0;var h=a.offsetHeight;console.log(a.offsetHeight),m.style.height=h+100>=v?v-100-a.children[0].children[0].offsetHeight+"px":"300px",h=a.offsetHeight;var f=1*t.width,g=p<=f+40?p-40:f;if(a.style.zIndex=10,a.style.width=g+"px",g/=2,l.getView().animate({center:[i[0]+(d[0]+g+20>=p?+(d[0]+g+20-p):d[0]-20-g<0?-g+d[0]-20:0)*u,i[1]+(d[1]<h?h-d[1]:0)*u],duration:500}),d[0]=d[0]+g-0,d[1]=d[1]-12,r.setPosition(l.getCoordinateFromPixel(d)),t.$el.parentNode.style.opacity=0,t.$el.style.opacity=1,t.$el.parentNode.style.top=(v-t.$el.offsetHeight)/2+"px",t.$el.parentNode.style.opacity=1,_.mobil){var y=r.getElement().querySelectorAll("a:not(._)");for(s=0;s<y.length;s++)y[s].addEventListener("click",_.open2)}t.$emit("opened",{target:t})}}}};const _hoisted_1$9={class:"v-ol-overlay"},_hoisted_2$6={key:0,class:"v-panel-titlebar"},_hoisted_3$3={key:2,style:{"text-align":"center"}};function render$a(e,t,l,o,r,a){return vue.openBlock(),vue.createElementBlock("div",_hoisted_1$9,[l.header?(vue.openBlock(),vue.createElementBlock("div",_hoisted_2$6,[vue.createElementVNode("span",{class:"v-icon v-icon-close",onClick:t[0]||(t[0]=(...e)=>a.close&&a.close(...e))},t[1]||(t[1]=[vue.createElementVNode("i",{class:"fa fa-times"},null,-1)])),vue.createTextVNode(vue.toDisplayString(l.header),1)])):vue.createCommentVNode("v-if",!0),(vue.openBlock(),vue.createElementBlock("div",{class:"v-ol-body",key:"c-"+r.c,style:{padding:"10px"}},[l.value?vue.renderSlot(e.$slots,"default",{key:0,value:l.value}):vue.createCommentVNode("v-if",!0)])),a.hasSlot("footer")&&l.value?(vue.openBlock(),vue.createElementBlock("footer",{key:"f-"+r.c},[vue.renderSlot(e.$slots,"footer",{value:l.value})])):vue.createCommentVNode("v-if",!0),r.coordinate?(vue.openBlock(),vue.createElementBlock("div",_hoisted_3$3,t[2]||(t[2]=[vue.createElementVNode("img",{src:_imports_0,width:"20",height:"18"},null,-1)]))):vue.createCommentVNode("v-if",!0)])}script$c.render=render$a,script$c.__file="src/v-overlay.vue";var script$b={name:"VPanel",props:{header:String}};const _hoisted_1$8={class:"ui-panel"},_hoisted_2$5={key:0,class:"v-panel-titlebar v-widget-header ui-helper-clearfix ui-corner-all"},_hoisted_3$2={class:"v-panel-title"},_hoisted_4$1={class:"v-panel-content v-dialog-content v-widget-content"};function render$9(e,t,l,o,r,a){return vue.openBlock(),vue.createElementBlock("div",_hoisted_1$8,[l.header?(vue.openBlock(),vue.createElementBlock("div",_hoisted_2$5,[vue.createElementVNode("span",_hoisted_3$2,vue.toDisplayString(l.header),1)])):vue.createCommentVNode("v-if",!0),vue.createElementVNode("div",_hoisted_4$1,[vue.renderSlot(e.$slots,"default")])])}script$b.render=render$9,script$b.__file="src/v-panel.vue";var script$a={name:"VPopup",data:()=>({show:null,overlay:null}),mounted(){var e=this;e.$el.addEventListener("close",(function(){e.hide()}))},destroyed(){var e=this.overlay;e&&(e.style.visibility="hidden",e.style.opacity=0,e.remove(),e=null)},methods:{hide(){var e=this.overlay;e&&(e.style.visibility="hidden",e.style.opacity=0),this.show=0},toggle(){var e=this;e.show=!e.show;var t=e.overlay;if(e.show){var l=document.querySelector(".v-layout-north");e.$el.style.top=l.offsetHeight+"px",console.log(e.$el),t||((t=document.createElement("div")).classList.add("v-overlay"),t.style.padding="40px",t.addEventListener("click",(function(){t.style.visibility="hidden",t.style.opacity=0,e.show=!1})),document.body.appendChild(e.overlay=t)),t.style.visibility="unset",t.style.opacity="unset"}else this.hide()}}};const _hoisted_1$7={class:"v-popup",style:{position:"absolute"}};function render$8(e,t,l,o,r,a){return vue.withDirectives((vue.openBlock(),vue.createElementBlock("div",_hoisted_1$7,[vue.renderSlot(e.$slots,"default")],512)),[[vue.vShow,r.show]])}script$a.render=render$8,script$a.__file="src/v-popup.vue";var script$9={name:"VRadio",props:{value:String,label:String,className:String},methods:{getClass(){return"v-radio "+this.className}},mounted(){var e=this,t=e.$el.querySelector("input");e.$parent&&e.$parent.nam&&(t.name=e.$parent.nam),t.onclick=function(){}},updated(){this.$el.querySelector("input")}};const _hoisted_1$6=["value"];function render$7(e,t,l,o,r,a){return vue.openBlock(),vue.createElementBlock("label",{class:vue.normalizeClass(a.getClass())},[vue.createTextVNode(vue.toDisplayString(l.label?l.label:l.value)+" ",1),vue.createElementVNode("input",{type:"radio",value:l.value},null,8,_hoisted_1$6),t[0]||(t[0]=vue.createElementVNode("span",{class:"checkmark"},null,-1)),vue.renderSlot(e.$slots,"default")],2)}script$9.render=render$7,script$9.__file="src/v-radio.vue";var script$8={__name:"v-radio-group",props:{required:String,name:String,modelValue:String,items:{type:Array},type:{type:String,default:"radio"},label:{type:String,default:""}},emits:["update:modelValue"],setup(e,{emit:t}){const l=e,o=t,r=vue.ref(l.modelValue),{proxy:a}=vue.getCurrentInstance(),n=new Set,s=(e,t)=>(e.children&&Array.from(e.children).forEach((e=>{"INPUT"===e.tagName?t.push(e):e.classList&&e.classList.contains("v-group")||s(e,t)})),t),i=()=>{const e=s(a.$el,[]);let t=l.name;t||(t="input_"+Date.now().toString(36)+Math.random().toString(36).substring(2,15));const o=""===a.$props.required||a.$props.required;let i=!1;for(let l=0;l<e.length;l++)e[l].name=t,n.has(e[l])||(e[l].addEventListener("change",u),n.add(e[l])),e[l].checked=e[l].value===r.value,e[l].checked&&(i=!0),e[l].required=o,o&&(r.value?e[l].nextElementSibling.classList.remove("required"):e[l].nextElementSibling.classList.add("required"));i&&removeError(e[0].parentNode.parentNode)},u=e=>{let t=e.target.value;""===t&&(t=null),r.value=t,o("update:modelValue",t)};vue.watch((()=>l.modelValue),(e=>{r.value=e,i()})),vue.onMounted((()=>{i()})),vue.onUpdated((()=>{i()}));const c=()=>{const e=[];return a.$slots.default&&e.push(...a.$slots.default()),l.items&&e.push(...l.items.map((e=>vue.h(script$9,{className:l.required&&!l.modelValue?"required":null,...e,modelValue:r.value,"onUpdate:modelValue":u})))),vue.h("div",{class:"v-radio-group"},[l.label&&vue.h("label",l.label),...e])};return(e,t)=>(vue.openBlock(),vue.createBlock(c))},__file:"src/v-radio-group.vue"},script$7={name:"VSelect",setup(e,t){const{slots:l,emit:o}=t,{valueField:r,disabled:a,readonly:n,autoload:s,name:i}=e,u=vue.ref([]),c=vue.ref([]),d=vue.ref(null),p=vue.ref([]),v=[],m=vue.ref(!(s+""=="false"||1*s==0)),h=vue.ref(null),f=t=>{u.value=t,vue.nextTick((()=>{g(e.modelValue||d.value)}))},g=t=>{let l=t||e.modelValue;if(h.value){let t=h.value,r=t.selectedIndex;l&&""!==l||(t.selectedIndex=0),log(i,"value===",l);const a=l?""+(l.id||l.code||l):l;for(let e=0;e<t.length;e++)t[e].value===a&&(t.selectedIndex=e);const n=v;for(let a=0;a<n.length;a++){if(!n[a].getValueByIndex)continue;let s=n[a].getValueByIndex(r-1);n[a].getIndexByValue(l,((r,c)=>{if(r>-1){let c=n[a].getObjectByIndex(r),p=Number(s);p=isNaN(p)?s?!!l&&(l.id?l.id==s.id:l==s):!l:p==Number(l),d.value!=e.modelValue&&(log(i,"select.value",l,"object=",c),e.modelValue&&(d.value=e.modelValue),p||(log(i,"select.updateSelect="+l+" "+JSON.stringify(u.value.length)),t.selectedIndex=r+1,o("update:modelValue",l,{value:l,select:t,object:c}),vue.nextTick((()=>{o("input",l,{value:l,select:t,object:c})}))))}else e.modelValue&&(d.value=e.modelValue),log(i,"select.updateselect.not fout",r),o("update:modelValue",null,null),vue.nextTick((()=>{o("input",null,{value:null})})),t.selectedIndex=0}))}}};f.remove=e=>{const t=v.filter((t=>t!==e));v.length=0,t.forEach((e=>v.push(e)))},f.push=e=>{v.push(e)},r&&(c.value=r.split(".")),vue.provide("collect",f);vue.watch((()=>e.modelValue),((e,t)=>{e!=t&&g()})),vue.watch((()=>e.disabled),((e,t)=>{y(e,t)}));const y=(e,t)=>{e=!!e,t=!!t;let l=p.value;log(i,"activate.newVal=",e,"oldVal=",t),!e&&!e===t&&l.length&&$(l[0],l[1])},$=(t,l)=>{e.disabled?(log(i,"select.load.params=",t),p.value=[t,l],v.forEach((e=>{e(t,l)}))):(p.value=[],v.forEach((e=>{e(t,l)})))};return vue.onMounted((()=>{m.value&&$()})),{options:u,getValueField:(e,t)=>{const l=c.value;if(l&&l.length)for(let t=0;t<l.length;t++)e&&(e=e[l[t]]);else e&&!t&&(e=e.id?e.id:e.code?e.code:e);return e},onChange:e=>{e.stopPropagation();let t=e.target.value;const l=h.value;log(i,"select.onchange=",t),t&&""!==t||(t=null,l.selectedIndex=0);let r,a=0;const n=u.value;for(let e=0;e<v.length;e++){if(a=v[e].getValueByIndex(l.selectedIndex-1),-1!=a){r=v[e].getObjectByIndex(l.selectedIndex-1);break}a=0}a?(log(i,"change=found=",a),t=a):n.length&&(l.selectedIndex=0),o("update:modelValue",t,{value:t,select:l,object:r}),vue.nextTick((()=>{o("input",t,{value:t,select:l,object:r})}))},selectRef:h,load:$,lastLoad:p,autoload_:m}},props:{modelValue:null,required:null,readonly:null,multiple:null,label:null,name:null,disabled:null,autoload:null,valueField:null},data:()=>({autoload_:!0,ik:0,data:[],popup:null,show:!1,sel:[],sela:null,tmp:[],sel2:[]}),watch:{show(e){let t=this;if(e){let e=this.$refs.button,l=this.popup;l||(l=this.$refs.popup,l.style.position="absolute",document.body.append(l));let o=e.getBoundingClientRect();const r=l.children[0];window.innerWidth<400?(l.style.padding="40px",l.style.height="100%",r.style.height="100%"):(l.style.top=o.bottom+0+"px",l.style.left=o.left+0+"px",l.style.maxHeight=window.innerHeight-o.bottom-30+"px",r.style.maxHeight=l.style.maxHeight),r.style.display="flex",r.style.flexDirection="column",t.tmp=t.sel.sort().join(",")}else{let e=t.sel;"TH"!=t.$el.parentNode.tagName&&e&&e.length?e=e.join(","):e&&0==e.length&&(e=null),t.tmp!==t.sel.sort().join(",")&&t.$parent.load&&t.$parent.load()}}}};const _hoisted_1$5={class:"v-select",style:{position:"relative"}},_hoisted_2$4=["required","disabled","click"],_hoisted_3$1={style:{border:"1px solid lightgray","background-color":"white",padding:"5px"}},_hoisted_4={class:"_ ui-widget ui-state-default ui-corner-all",style:{padding:"3px 3px 1px 3px","margin-bottom":"5px"}},_hoisted_5={class:"center",style:{"padding-top":"4px"}};function render$6(e,t,l,o,r,a){const n=vue.resolveComponent("v-checkbox"),s=vue.resolveComponent("v-checkbox-group"),i=vue.resolveComponent("v-button");return vue.openBlock(),vue.createElementBlock("div",_hoisted_1$5,[l.readonly?vue.createCommentVNode("v-if",!0):vue.withDirectives((vue.openBlock(),vue.createElementBlock("select",{key:0,style:{width:"100%"},ref:"selectRef",onChange:t[0]||(t[0]=(...e)=>o.onChange&&o.onChange(...e)),required:l.required,disabled:l.disabled,click:e.expand},[vue.renderSlot(e.$slots,"default")],40,_hoisted_2$4)),[[vue.vShow,!l.multiple]]),l.multiple?(vue.openBlock(),vue.createElementBlock(vue.Fragment,{key:1},[vue.createElementVNode("div",{class:vue.normalizeClass(["v-widget-header",{"v-selected":r.show}]),ref:"button",style:{"padding-top":"3px","padding-bottom":"3px"},onClick:t[1]||(t[1]=(...t)=>e.toggle&&e.toggle(...t))},"   ",2),vue.withDirectives(vue.createElementVNode("div",{ref:"popup",onClick:t[4]||(t[4]=(...t)=>e.close&&e.close(...t)),style:{"background-color":"#0000009c"}},[vue.createElementVNode("div",_hoisted_3$1,[vue.createElementVNode("div",_hoisted_4,[vue.createVNode(n,{modelValue:r.sela,"onUpdate:modelValue":t[2]||(t[2]=e=>r.sela=e),onInput:e.selectAll},null,8,["modelValue","onInput"])]),(vue.openBlock(),vue.createBlock(s,{class:"v-select-checkbox-group",style:{"overflow-y":"auto"},key:"p"+r.ik,modelValue:r.sel,"onUpdate:modelValue":t[3]||(t[3]=e=>r.sel=e),onInput:e.checkboxInput},{default:vue.withCtx((()=>[r.data.length?(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,{key:0},vue.renderList(r.data,(e=>(vue.openBlock(),vue.createElementBlock("div",null,[vue.createVNode(n,{value:e.value,label:e.label},null,8,["value","label"])])))),256)):vue.createCommentVNode("v-if",!0)])),_:1},8,["modelValue","onInput"])),vue.createElementVNode("div",_hoisted_5,[vue.createVNode(i,{icon:"fa-sync",value:"Filtrar"})])])],512),[[vue.vShow,r.show]])],64)):vue.createCommentVNode("v-if",!0),l.readonly?(vue.openBlock(),vue.createElementBlock(vue.Fragment,{key:2},[vue.createTextVNode(vue.toDisplayString(l.label?l.label:"---"),1)],64)):vue.createCommentVNode("v-if",!0)])}script$7.render=render$6,script$7.__file="src/v-select.vue";var script$6={name:"VSwitch",props:{value:{value:Object}},data:()=>({options:["NO","SI"],selected:null}),mounted(){var e=this,t=""+e.value;e.selected="true"===t?"SI":"false"===t?"NO":null,e.$emit("input",e.value)},updated(){var e=this,t=""+e.value;e.selected="true"===t?"SI":"false"===t?"NO":null,e.$emit("input",e.value)},methods:{onChange(e){this.selected=e,this.$emit("input","SI"===e||"NO"!==e&&null)}}};const _hoisted_1$4=["value","data-value"],_hoisted_2$3=["onClick"];function render$5(e,t,l,o,r,a){return vue.openBlock(),vue.createElementBlock("div",{value:!1===l.value?"false":l.value,"data-value":""+l.value},[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(r.options,(e=>(vue.openBlock(),vue.createElementBlock("div",{onClick:t=>a.onChange(e),style:vue.normalizeStyle("cursor:pointer;border: 1px solid #000;text-align:center;display:inline-block;width:calc(50% - 2px)"+(e===r.selected?"":";opacity: 0.5")),class:vue.normalizeClass({"v-selected":e==r.selected})},vue.toDisplayString(e),15,_hoisted_2$3)))),256))],8,_hoisted_1$4)}script$6.render=render$5,script$6.__file="src/v-switch.vue";var script$5={name:"VTable",setup(e,t){const{autoload:l,src:o,rowKey:r,store:a,groups:n}=e,s=useAppStore(),i=vue.inject("viewCollector"),u=vue.inject("formCollector"),c=vue.ref(1),d=vue.ref(0),p=vue.ref(null),v=vue.ref(1),m=vue.ref([]),h=vue.ref([]),f=vue.ref(null),g=vue.ref(1),y=vue.computed((()=>{const t=e,l=h.value;let o,r;return l.sum=sum,l.filter((e=>{for(var l in t.filters)if(o=t.filters[l],"function"==typeof o){if(!o(e))return 0}else if(o&&"string"==typeof o&&l in e&&(r=e[l],"string"==typeof r&&(r=r.toUpperCase().normalize("NFD").replace(/[\u0300-\u036f]/g,""),!r.includes(o.toUpperCase()))))return 0;return 1}))})),$=vue.computed((()=>{let e=y.value;return e=f?e.sort(((e,t)=>{t=(t=t[f])||0,e=e[f];const l=Number(e);return l&&(e=l),e<t?-1*g:e>t?1*g:0})):e,e.sum=sum,e})),b=vue.computed((()=>{const e=function(e){return this.reduce(((t,l)=>"number"==typeof e||"string"==typeof e?t+(l[e]||0):t),0)};Array.prototype.sum=e;const t={},l=n;return l?$.value.forEach((o=>{const r=o[l];if(!t[r]){const l=[];l.sum=e,t[r]=l}t[r].push(o)})):$.value.length&&(t[""]=$),Object.entries(t).map((([e,t])=>({name:e,values:t})))})),w=vue.ref(1),k=vue.ref(1),{slots:_,expose:x,emit:S}=t,E=vue.getCurrentInstance(),C=async()=>{if(null!=a){let e;db&&(e=await getStoredList(a)),e||(e=[]),h.value=h.value?e.concat(h.value):e}return h.value},V=(e,t,l)=>{-10===t?y.value.length===m.value.length?m.value=[]:m.value=y.value.map((e=>e)):l?c.value||!m.value.includes(e)?m.value=[e]:(m.value=[],e=null):m.value.includes(e)?(m.value.splice(m.value.indexOf(e),1),e=null):m.value.push(e),S("row-select",{target:this,current:e,selection:m})},N=e=>m.value.includes(e),B=t=>{const l=[];return e.selectable&&N(t)&&l.push("v-selected"),e.rowStyleClass&&("string"==typeof e.rowStyleClass?l.push(e.rowStyleClass):e.rowStyleClass&&l.push(e.rowStyleClass(t))),l},I=(e,t)=>{L(e,t)},L=(e,t)=>{(w.value!=e||t)&&(w.value=e,q())};let T=""+e.selectable;c.value="false"!=T&&"0"!=T?1:0,T=""+e.scrollable,d.value=e.scrollable&&"false"!=T&&"0"!=T?1:0;const q=()=>{const t=e;if(m.value=[],t.value&&(h.value=t.value),o){let e=o;if(!e)return;e.endsWith("/")&&(e=e.slice(0,e.length-1));const l=t.pagination;if(l&&(e+="/"+(w.value-1)*l+"/"+l),networkStatus.connected){let r;if(t.gql){const e=t.gql,a="query{"+Object.keys(e)[0]+"(offset:"+(w.value-1)*l+" limit:"+l+"){\ndata{"+e[Object.keys(e)[0]]+"}\nsize\n}\n}";r=s.axios.post(o,{query:a})}else r=s.axios.get(e,{params:clean(t.filters)});r.then((e=>{if(e.data&&e.data.error)MsgBox(e.data.error);else{let o=e.data;t.gql&&(o=e.data.data[Object.keys(t.gql)[0]]),h.value=o.data||o,o&&o.hasOwnProperty("size")&&l&&(k.value=Math.ceil(o.size/l),w.value>k.value&&(w.value=1),t.size=o.size),C(),S("loaded",{target:t}),S("row-select",{}),t.remoteLoaded=1,t.loaded=1,v.value++}})).catch(t.error)}else{h.value=[];const e=C();e.then&&e.then((e=>{h.value=e})),S("row-select",{target:t})}}else C().then((()=>S("loaded",{target:t})));v.value++,t.loaded=1},F=vue.computed((()=>m.value.length));q.rowSelectedCount=F,q.src=o,q.getForm=u.get,q.rowKey=r,q.rowSelect=V;const A=e=>p.value===e;q.is=A,q.remove=e=>{console.log(e,h.value);const t=h.value.findIndex((t=>t===e));-1!==t&&h.value.splice(t,1)},q.selected=m,q.type="v-table",i.push(q);const D=e=>{13===e.keyCode&&(e.preventDefault(),q())};return vue.onMounted((()=>{!0===l&&q(),setTimeout((()=>{const e=E.proxy,t=e.$el.querySelectorAll(".v-cloned-header div > span"),l=Math.max(...Array.from(t).map((e=>e.offsetHeight)));t.forEach((e=>{e.style.height=l+"px"}));e.$el.querySelectorAll("v-filter").forEach((e=>{console.log(e.querySelectorAll("input").forEach((e=>e.addEventListener("keyup",D))))}))}),100)})),vue.onUnmounted((()=>{i.remove(q)})),x({load:q,rowSelectedCount:F,j_is:A}),()=>{let t=0;const l=_.default({row:{}}),o=[];l.forEach(((e,l)=>{const r=e.props;e.children&&"function"==typeof e.children.filter&&(e.children.filter((e=>"v-filter"==e.type)).forEach((t=>{r.filter=t,e.children.shift()})),e.children.filter((e=>"v-footer"==e.type)).forEach((t=>{r.footer=t,e.children.shift()}))),t+=r.width?Number(r.width):0,o.push({filter:r.filter,header:r.header,width:r.width})})),t+=c.value?42:0;const r=vue.h("div",{className:"v-datatable-scrollable-header-box",style:"left: 0px;"},vue.h("table",{className:"v-cloned-header v-table",style:{width:`${t}px`}},[c.value?vue.h("th",{width:42},[vue.h("span",{onclick(){V(null,-10)},className:"v-check"},vue.h(vueFontawesome.FontAwesomeIcon,{icon:m.value.length?freeRegularSvgIcons.faSquareCheck:freeRegularSvgIcons.faSquare,class:"fa-lg"}))]):null,o.map((e=>vue.h("th",e,vue.h("div",[vue.h("span",{style:"display: flex;justify-content: center;align-items: center;"},[e.header]),vue.h("v-filter",e.filter?.children)]))))]));return vue.h("div",{ref:p,className:"v-datatable "+e.class},[_.header?vue.h("div",{className:"v-datatable-header v-widget-header ui-corner-top"},_.header()):null,e.pagination?vue.h("div",{className:"v-paginator v-paginator-top v-widget-header v-paginator-pages center"},[vue.h(script$p,{value:"|<",disabled:w.value<=1,onClick:()=>I(1)}),vue.h(script$p,{value:"<",disabled:w.value<=1,onClick:()=>I(w.value-1)}),vue.h("div",{style:"padding:3px 8px;display:inline-block"},[vue.h("input",{type:"number",style:"width:60px",value:w.value,onInput:e=>I(Number(e.target.value),!0)}),"/"+k.value]),vue.h(script$p,{value:">",disabled:w.value==k.value,onClick:()=>I(w.value+1)}),vue.h(script$p,{value:">|",disabled:w.value==k.value,onClick:()=>I(k.value)})]):null,vue.h("div",{className:"v-widget-header v-datatable-scrollable-header",style:"position: relative; margin-right: 0px;"},r),vue.h("div",{className:"v-datatable-scrollable-body",style:"overflow-y: auto; flex:1",onScroll(e){const t=e.currentTarget.scrollLeft;r.el.style.transform="translateX(-"+t+"px)"}},[vue.h("table",{className:"v-table",style:{width:`${t}px`}},[vue.h("tbody",{className:"v-datatable-data",key:v.value},b.value.length<1?vue.h("td",{colspan:o.length+(c.value?1:0)},e.emptyMessage):[b.value.map((e=>[_["header-group"]?vue.h("tr",{className:"v-header-group"},[c.value?vue.h("td"):null,_["header-group"]({group:e})]):null,(e.values.value||e.values).map(((e,t)=>{const l=_.default({row:e,index:t});return l.forEach(((e,t)=>{e.children&&"function"==typeof e.children.filter&&(e.children.filter((e=>"v-filter"==e.type)).forEach((t=>{e.children.shift()})),e.children.filter((e=>"v-footer"==e.type)).forEach((t=>{e.children.shift()})))})),vue.h("tr",{className:B(e),onclick(l){((e,t,l)=>{c.value&&0==whichChild(e.target)||V(t,l,1)})(l,e,t)}},[c.value?vue.h("td",{className:"center"},vue.h("span",{onclick(){V(e,t)},className:"v-check"},vue.h(vueFontawesome.FontAwesomeIcon,{icon:N(e)?freeRegularSvgIcons.faSquareCheck:freeRegularSvgIcons.faSquare,class:"fa-lg"}))):null,...l])})),_["footer-group"]?vue.h("tr",{className:"v-footer-group"},[c.value?vue.h("td"):null,_["footer-group"]({group:e})]):null,_["extra-group"]?_["extra-group"]({group:e,groups:b.value}):null]))])])])])}},props:{class:null,value:Array,filterKey:String,reflow:null,summary:null,src:String,gql:null,filters:Object,store:null,width:null,emptyMessage:{default:"No existen registros"},groups:{default:""},rowKey:{default:"id"},rowStyleClass:null,pagination:null,selectable:{default:!0},scrollable:null,autoload:{default:!0}},data:()=>({resizeAfterUpddate:0,active:0,keyBody:1,row:{},kt:0,size:null,sortKey:"",paginatio_:0,remoteLoaded:null,loaded:!1,sortOrders:{},rowStyleClassFunc:null}),created(){const me=this;me.$parent.tabs||(me.active=1),me.paginatio_=me.pagination?me.pagination:0,me.rowStyleClass&&eval("me.rowStyleClassFunc=function(row){return "+me.rowStyleClass+"}")},beforeUpdate(){var e=this;e.active&&e.value&&null==e.remoteLoaded&&(e.data=e.value)},filters:{capitalize:e=>e?e.charAt(0).toUpperCase()+e.slice(1):e},methods:{hasSlot(e){return!!this.$slots[e]},sortBy(){},filter(){alert(12)}},__file:"src/v-table.vue"},script$4={name:"VTabview",data:()=>({tabs:[],height:0,currentTabIndex:0,k:0}),methods:{load(e){var t=new Event("command",{bubbles:!1});t.name="refresh",t.target=this.$el,this.$el.children[1+this.currentTabIndex].dispatchEvent(t)},reset(){this.load(this.k++)}},watch:{currentTabIndex(e){var t=this,l=t.$el.children[e+1];if(t.$children[e+1],l){var o=new Event("tabChange",{bubbles:!1});o.$target=t,l.dispatchEvent(o),t.$el.style.height=t.height+"px",(o=new Event("parentResize",{bubbles:!1})).height=t.$el.offsetHeight-25,l.style.height=o.height+"px",setTimeout((()=>{l.dispatchEvent(o)}),2)}}},updated(){for(var e=this.$el.children,t=1;t<e.length;t++)e[t].tagName&&(t-1===this.currentTabIndex&&(e[t].style.display="flex",e[t].style.flex="1",e[t].style.flexDirection="column"),t-1===this.currentTabIndex?e[t].classList.remove("hide"):(e[t].style.display="none",e[t].classList.add("hide"))),console.log(e[t])},mounted(){for(var e=this,t=e.$el.children,l=1;l<t.length;l++)t[l].style.display="none",e.tabs.push({title:""+t[l].getAttribute("tab")});e.$el.addEventListener("parentResize",(l=>{e.$el.style.height=l.height+1+"px",e.height=l.height+1;var o=new Event("parentResize",{bubbles:!1});o.height=e.$el.offsetHeight-25,o.target=e.$el,o.$target=e;for(var r=1;r<t.length;r++)"none"!=t[r].style.display&&(console.log("Se envia el alto "+o.height),t[r].style.height=o.height+"px",t[r].dispatchEvent(o));e.$emit("resize",o)})),t[1+e.currentTabIndex].setAttribute("active",1);var o=new Event("tabChange",{bubbles:!1});o.$target=e,t[1+e.currentTabIndex].dispatchEvent(o)}};const _hoisted_1$3={class:"v-tab-nav"},_hoisted_2$2=["onClick"];function render$4(e,t,l,o,r,a){return vue.openBlock(),vue.createElementBlock("div",{class:"v-tabview",style:vue.normalizeStyle({height:r.height+"px"})},[vue.createElementVNode("ul",_hoisted_1$3,[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(r.tabs,((e,t)=>(vue.openBlock(),vue.createElementBlock("li",{class:vue.normalizeClass({"v-selected":t==r.currentTabIndex}),key:t,onClick:e=>r.currentTabIndex=t},vue.toDisplayString(e.title),11,_hoisted_2$2)))),128))]),vue.renderSlot(e.$slots,"default")],4)}script$4.render=render$4,script$4.__file="src/v-tabview.vue";var script$3={name:"VTextarea",props:{modelValue:String},setup(e,{emit:t}){const l=vue.ref(null),o=()=>{l.value&&(l.value.style.height="auto",l.value.value&&(l.value.style.height=`${l.value.scrollHeight}px`))},r=()=>{vue.nextTick(o)};return vue.watch((()=>e.modelValue),r,{immediate:!0}),vue.onMounted((()=>{const e=l.value;e&&(e.addEventListener("change",o),e.addEventListener("cut",r),e.addEventListener("paste",r),e.addEventListener("drop",r),e.addEventListener("keydown",r),r())})),{textarea:l,updateValue:e=>{t("update:modelValue",e.target.value),r()}}}};const _hoisted_1$2=["value"];function render$3(e,t,l,o,r,a){return vue.openBlock(),vue.createElementBlock("textarea",{ref:"textarea",value:l.modelValue,onInput:t[0]||(t[0]=(...e)=>o.updateValue&&o.updateValue(...e))},null,40,_hoisted_1$2)}script$3.render=render$3,script$3.__file="src/v-textarea.vue";var script$2={name:"VUploader",props:{value:String,onlyicon:Boolean,click:null,icon:String,domain:String},mounted(){var e=this;setTimeout((function(){e.$el.querySelector("svg").dataset.icon="image"}),1e3)},updated(){var e=this;setTimeout((function(){e.$el.querySelector("svg").dataset.icon="image"}),1e3)},data:()=>({uploadPercentage:0,showProgress:!1}),methods:{other(){this.click&&this.click(this)},handleFileUpload(){this.uploadPercentage=0,this.submitFile(this.$el.children[0].children[0].files[0])},submitFile(e,t){var l=this,o=new FormData;t=t||e.name.replace(/[^\w\s.]/gi,""),o.append("filename",t),o.append("file",e,t),l.showProgress=!0,axios$2.post((l.domain?l.domain:"")+"/api/file/upload",o,{headers:{"Content-Type":"multipart/form-data"},onUploadProgress:function(e){this.uploadPercentage=parseInt(Math.round(e.loaded/e.total*100))}.bind(this)}).then((function(e){l.$emit("input",e.data),l.showProgress=!1})).catch((function(){console.log("FAILURE!!")}))}}};const _hoisted_1$1={style:{cursor:"pointer"},class:""},_hoisted_2$1=["data-icon"],_hoisted_3=[".value"];function render$2(e,t,l,o,r,a){return vue.openBlock(),vue.createElementBlock("div",{onClick:t[1]||(t[1]=(...e)=>a.other&&a.other(...e)),class:vue.normalizeClass([l.onlyicon?"":"v-button ui-widget ui-state-default ui-corner-all","v-uploader"]),style:vue.normalizeStyle({padding:l.onlyicon?"0px":""})},[vue.createElementVNode("label",_hoisted_1$1,[l.click?vue.createCommentVNode("v-if",!0):(vue.openBlock(),vue.createElementBlock("input",{key:0,type:"file",onChange:t[0]||(t[0]=e=>a.handleFileUpload())},null,32)),vue.createElementVNode("i",{class:vue.normalizeClass(["fa",l.icon?l.icon:"fa-upload"]),"data-icon":l.icon,style:vue.normalizeStyle({marginRight:l.onlyicon||""==l.value?"":"10px"})},null,14,_hoisted_2$1),vue.createTextVNode(vue.toDisplayString(l.onlyicon?"":null!=l.value?l.value:"Adjuntar Archivo")+" ",1),r.showProgress?(vue.openBlock(),vue.createElementBlock("progress",{key:1,max:"100",style:{width:"100%"},".value":r.uploadPercentage},null,40,_hoisted_3)):vue.createCommentVNode("v-if",!0)])],6)}script$2.render=render$2,script$2.__file="src/v-uploader.vue";var script$1={name:"VItem",setup:({href:e},{emit:t})=>({click:()=>{e?useAppStore().router.push({path:e}):t("click")}}),props:{icon:String,style:Object,label:String,href:String}};function render$1(e,t,l,o,r,a){return vue.openBlock(),vue.createElementBlock(vue.Fragment,null,[vue.createElementVNode("li",{onClick:t[0]||(t[0]=(...e)=>o.click&&o.click(...e)),style:vue.normalizeStyle(l.style)},[vue.createElementVNode("i",{class:vue.normalizeClass(["fa",l.icon])},null,2),vue.createTextVNode(vue.toDisplayString(l.label)+" ",1),vue.renderSlot(e.$slots,"label")],4),vue.createElementVNode("ul",null,[vue.renderSlot(e.$slots,"default")])],64)}script$1.render=render$1,script$1.__file="src/v-item.vue";var script={name:"VCalendarRange",props:{modelValue:null,type:String,required:String,readonly:String,max:String,min:String},setup({modelValue:e},{emit:t}){const l=vue.ref(),o=vue.ref(),r=vue.ref(),a=vue.ref(),n=vue.ref();return{show:l,open:()=>{l.value=!0,vue.nextTick((()=>{n.value=mask(a.value)}))},elRef:a,from:o,to:r,click:e=>{e||(o.value="",r.value="");const l=(date(o.value,"date-")||"")+"|"+(date(r.value,"date-")||"");t("update:modelValue","|"==l?null:l),unmask(n.value)},modelValue:e}}};const _hoisted_1={key:0,ref:"elRef",style:{position:"relative","z-index":"1000",padding:"20px","max-width":"240px"},class:"v-dialog v-msgbox"},_hoisted_2={style:{display:"flex","align-items":"center","justify-content":"center","margin-top":"20px"}};function render(e,t,l,o,r,a){const n=vue.resolveComponent("VButton"),s=vue.resolveComponent("v-calendar"),i=vue.resolveComponent("v-button");return vue.openBlock(),vue.createElementBlock("div",null,[vue.createVNode(n,{icon:"fa-calendar",onClick:o.open,style:{width:"-webkit-fill-available",padding:"12px"},class:vue.normalizeClass(o.from||o.to?"marked":"")},null,8,["onClick","class"]),o.show?(vue.openBlock(),vue.createElementBlock("div",_hoisted_1,[t[4]||(t[4]=vue.createElementVNode("label",null,"Desde:",-1)),vue.createVNode(s,{modelValue:o.from,"onUpdate:modelValue":t[0]||(t[0]=e=>o.from=e)},null,8,["modelValue"]),t[5]||(t[5]=vue.createElementVNode("label",null,"Hasta:",-1)),vue.createVNode(s,{modelValue:o.to,"onUpdate:modelValue":t[1]||(t[1]=e=>o.to=e)},null,8,["modelValue"]),vue.createElementVNode("div",_hoisted_2,[vue.createVNode(i,{icon:"fa-eraser",value:"Limpiar",onClick:t[2]||(t[2]=e=>o.click())}),vue.createVNode(i,{icon:"fa-filter",value:"Aplicar",onClick:t[3]||(t[3]=e=>o.click(!0))})])],512)):vue.createCommentVNode("v-if",!0)])}script.render=render,script.__file="src/v-calendar-range.vue";var components={InputTextarea:script$r,VItem:script$1,InputText:script$s,VAutocomplete:script$q,VButton:script$p,VCalendar:script$o,VCalendarFilter:script,VCheckboxGroup:script$n,VCheckbox:script$m,VDataview:script$l,VFieldset:script$k,VForm:script$j,VGroup:script$i,VLayerControl:script$h,VMapControl:script$g,VMap:script$f,VNumber:script$e,VOptions:script$d,VOverlay:script$c,VPanel:script$b,VPopup:script$a,VRadioGroup:script$8,VRadio:script$9,VSelect:script$7,VSwitch:script$6,VTable:script$5,VTabview:script$4,VTextarea:script$3,VUploader:script$2};const VForm=components.VForm,IsobitUI={install(e){setApp(e),e.BUILT_ON=(void 0).VITE_APP_BUILT_ON;for(const t in components)if(components.hasOwnProperty(t)){const l=components[t];e.component(l.name||t,l)}}};setTimeout(resize,400),window.addEventListener("resize",(()=>{setTimeout(resize,400)}));const removeError=e=>{let t=e.previousElementSibling;t&&t.classList&&t.classList.contains("v-error")&&t.parentNode.removeChild(t)},ui=e=>{const l={computed:{user:()=>_$1.app.session,perms(){return this.session.perms||this.session.allcaps||{}}},data(){return{app2:null,ui:this,_session:null,x_connected_:null,row:{},networkStatus:{connected:null}}},methods:{get(e){let t=this.$el.querySelector("form").action;window.location.href=this.apiLink(t)+"/"+e},async sync(e){let t=this,l=t.$el.querySelector("form").getAttribute("action");if(!l){l=t.$el.parentNode.getAttribute("path");let e=l.split("/");e="edit"==e[e.length-1]?e.splice(0,e.length-2):e.splice(0,e.length-1),l=t.apiLink(e.join("/"))}let o=t.$children[0].$children[0];l=o.src;let r=await t.getStoredList(o.store),a=o.selected,n=[],s=[];for(let e=0;e<a.length;e++){let t=o.data[a[e]];if(t.tmpId&&!t.synchronized)for(let e=0;e<r.length;e++)if(r[e].tmpId==t.tmpId){let t=JSON.clone(r[e]);delete t.synchronized,s.push(t),n.push(e)}}n.length>0&&axios.post(l+"/bulk"+(e.sufix?e.sufix:""),s).then((function(e){let l=e.data;for(let e=0;e<l.length;e++){if(l[e].errors){MsgBox$1(JSON.stringify(l[e].errors));break}if(l[e].error){MsgBox$1(l[e].error);break}for(let t=0;t<r.length;t++)(l[e].ext&&l[e].ext.tmpId==r[t].tmpId||l[e].tmpId==r[t].tmpId)&&(log("ui.ok"),l[e].ext&&r.ext&&(r[t].ext.error=l[e].ext.error),l[e].id&&(r[t].id=l[e].id),r[t].synchronized=1,emit("sync",l[e],r[t]))}t.setStoredList(o.store,r),t.refresh()})).catch((function(e){e.response?MsgBox$1(e.response.data):console.log(e)}))}}};e||(e={data:{o:{}}});const{setup:o,...r}=e,a=o;return e={mixins:[l,r],setup(e,l){const o=useAppStore();setApp(o),o.config(getConfigApp());const r=e;let n=vueRouter.useRouter();const s=vue.getCurrentInstance(),u=vue.reactive([]),c={remove(e){u.splice(u.indexOf(e),1)},push(e){u.push(e)}},d=e=>{},p=async e=>{const t=s.proxy,l=_$1.db;let r;try{r=JSON.parse(sessionStorage.getItem("loadedStores"))}catch(e){}if(null==r&&(r={}),!r[e]&&t.connected){let t=_$1.stores.filter((t=>t[0]==e))[0];if(!t[2])throw`ERROR: Url for store '${t[0]}' is empty!`;let a=await o.axios.get(t[2]);a=a.data||a,await new Promise(((o,n)=>{let s=l.transaction([t[0]],"readwrite"),i=s.objectStore(t[0]);const u=i.clear();u.onsuccess=()=>{a.forEach((e=>{i.add(e).onerror=e=>{console.error(`⚠️ Store '${e[0]}' error addd data!`,e)}}))},u.onerror=()=>{console.error(`⚠️ Store '${t[0]}' error data!`,t)},s.oncomplete=()=>{r[e]=1,sessionStorage.setItem("loadedStores",JSON.stringify(r)),o()},s.onerror=e=>{console.error(`ERROR: ⚠️ Error en la transacción for store '${e[0]}'!`,e),n()}}))}return await new Promise(((t,o)=>{if(l){const o=l.transaction(e).objectStore(e).getAll();o.onsuccess=()=>{t(o.result)}}else console.log("1=========>db=",window._.db),o("=======>db is null esta faltando")}))},v=()=>{u.find((e=>"v-table"==e.type))()},m=(e,t,l)=>{if(!(e.$el||e instanceof HTMLElement)){let t=e,l=t.target;return"string"==typeof t?l=t:"ION-ITEM"==l.tagName&&l.href?(t.preventDefault(),l=l.href):(t.preventDefault(),l.pathname||(l=l.parentNode),l.pathname||(l=l.parentNode),l.pathname||(l=l.parentNode),l=l.pathname),void(n.path!==l&&n.push(l))}},h=(e,t)=>{e.$el&&(e=e.$el),removeError(e);let l=e.previousElementSibling;for(;l&&1!=l.nodeType;)l=l.previousElementSibling;if(!l)for(l=e.parentElement.previousElementSibling;l&&1!=l.nodeType;)l=l.previousElementSibling;let o=document.createElement("div");o.innerHTML=t||"Este campo es requerido!",o.classList.add("v-error"),e.parentNode.insertBefore(o,e)},f=e=>{const t=[],l=[],o=s.proxy;e=e&&0!=e?e:o.$el;const r=e?.querySelectorAll("input,select,textarea,div[required=required]");let a,n={};for(let e=0;r?.length>e;e++){let o=r[e];if("radio"!==o.type){if(o.error&&(o.error.style.display="none"),!o.disabled&&!o.getAttribute("disabled")&&(o.required||"DIV"===o.tagName))if("DIV"!=o.tagName&&!o.value||"DIV"===o.tagName&&!o.attributes.value){for(a=o.previousElementSibling;a&&1!=a.nodeType;)a=a.previousElementSibling;if(!a)for(a=o.parentElement.previousElementSibling;a&&1!=a.nodeType;)a=a.previousElementSibling;t.push(o)}else l.push(o)}else{let e=n[o.name];e||(n[o.name]=e=[]),e.push(o)}}for(let e in n)if(Object.prototype.hasOwnProperty.call(n,e)){const o=n[e];let r=!1,s=!1;for(let e=0;e<o.length;e++)o[e].required&&!o[e].disabled&&(s=!0),o[e].checked&&(r=!0);const i=o[0].parentNode.parentNode;a=i.previousElementSibling,a&&a.classList&&a.classList.contains("v-error")&&a.parentNode.removeChild(a),s&&!r?t.push(i):l.push(i)}for(const e of t)h(e);for(const e of l){let t=e.previousElementSibling;t&&t.classList&&t.classList.contains("v-error")&&t.parentNode.removeChild(t)}return!t.length},g=(e,t)=>{let l=e.parentElement;for(;l;){const e=l.querySelector(t);if(e)return e;l=l.parentElement}return null},y=e=>{console.log(l)};vue.provide("viewCollector",c);const $=vue.computed((()=>{let e=u.find((e=>e.selected?.value.length>0));return e?.rowSelectedCount||0})),b=vue.computed((()=>clean(w.value))),w=vue.reactive({}),k=vue.ref(null);let _;vue.watch(w,(()=>{u.find((e=>"v-table"==e.type))&&(k.value&&clearTimeout(k.value),k.value=setTimeout((()=>{v()}),1200))}));const x=()=>{clearTimeout(_),_=setTimeout((()=>{const e=document.querySelector(".v-datatable");e?.parentNode&&buildPopupMenu(e)}),100)};vue.onMounted((()=>{n=vueRouter.useRouter(),l.emit("sync",{u:9}),x(),window.addEventListener("resize",x)})),vue.onUnmounted((()=>{window.removeEventListener("resize",x)}));const S=vue.computed((()=>o.axios.defaults.baseURL)),E=vue.computed((()=>o.session));let C=a?a({...e,$on:(e,t)=>{},router:n,getStoredList:p,app:o},l):{};l.expose({router:n});let V={app:o,cleanedFilters:b,router:n,baseURL:S,filters:w,session:E,date:date,pad:pad,getStoredList:p,refresh:v,getSelected:()=>u.find((e=>"v-table"==e.type)).selected.value,saveAs:(e,t,l)=>{"string"==typeof t&&(t={body:t});let o="string"==typeof l?{fileName:l}:l;o||(o={}),(""+t?axios.post(e,t,{responseType:"blob"}):axios({method:"post",url:e,data:t,headers:{"Content-Type":"multipart/form-data"}})).then((e=>{const t=window.URL.createObjectURL(new Blob([e.data])),l=document.createElement("a");if(l.href=t,!o.fileName){const t=e.headers["content-disposition"];if(t&&-1!==t.indexOf("attachment")){const e=/filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/.exec(t);null!=e&&e[1]&&(o.fileName=e[1].replace(/['"]/g,"").trim())}else console.warn("content-disposition: attachment; filename = <filename>; header no es accesible o no esta definido correctamente")}l.setAttribute("download",o.fileName),document.body.appendChild(l),l.click()}))},validate:f,save:()=>{let e=u.filter((e=>"v-form"==e.type))[0];console.log(e);const a=s.proxy;e.$forceUpdate();let n=e.$el,c=n.querySelector("form");if(f(c)){let e=c.getAttribute("action"),n=a.data||a.o,s=JSON.parse(JSON.stringify(n));if(a.process&&(s=a.process(s)),"object"!=typeof s||Array.isArray(s)||null===s)return;if(console.log("action/componet==",e,a,l),e&&o.connected)o.axios.post(e,s).then((e=>{let t=e.data;if(s.tmpId){alert(12);let e=r.$children[0].store,l=window._.db.transaction([e],"readwrite").objectStore(e),o=l.get(s.tmpId);t.id&&(s.id=t.id,n.id=s.id),o.onsuccess=function(){let e;n.synchronized=1,s.synchronized=1,e=o.result?l.put(s):l.add(s),e.onerror=e=>{console.error(e)},r.$emit("sync",t,s)},o.onerror=function(){MsgBox$1("Error getting temporal record "+s.tmpId)}}o&&o.toast?o.toast("El registro fue grabado exitosamente!",(()=>{a.close({success:!0,data:t})})):MsgBox$1("El registro fue grabado exitosamente! msg",(()=>{y()}))})).catch((function(e){if(e.response){let l,o;if("string"==typeof e.response.data)MsgBox$1(e.response.data);else{l=e.response.data.propertyViolations;for(let e=0;e<l.length;e++){let t=l[e];o=c.querySelector("[name="+t.path+"]"),o&&r.showerror(o,t.message)}for(l=e.response.data.fieldViolations,i=0;i<l.length;i++)t=l[i],o=c.querySelector("[name="+t.path+"]"),o&&r.showerror(o,t.message+", valor="+t.value);MsgBox$1("Verifique el formulario, aun tiene campos obligatorio completar."),"v-dialog"==r.$el.parentNode.className&&r.$el.parentNode.parentNode.scroll({top:0,behavior:"smooth"})}}}));else{console.log("se guarda localmente");const e=u[0].store;if(!e)return void MsgBox$1("Store in form is undefined!");p(e).then((t=>{if(t||(t=[]),s.id)for(let e=0;e<t.length;e++)t[e].tmpId==s.tmpId&&(delete s.synchronized,t[e]=s);let l=_$1.db.transaction([e],"readwrite").objectStore(e);if(s.id){delete s.synchronized;let e=l.get(s.tmpId);e.onsuccess=function(){e.result?l.put(s):t.forEach((e=>{e.tmpId==s.tmpId&&l.put(s)})),r.$emit("stored",s,t,l),r.$ionic&&o.toast("El registro fue grabado exitosamente! onstored"),console.log("============2",a),a.close({success:!0,data:s})},e.onerror=function(){MsgBox$1("Error getting temporal record "+s.tmpId)}}else{s.tmpId=1*new Date,s.id=-s.tmpId;let e=l.add(s);e.onsuccess=e=>{t.unshift(s),r.$emit("stored",s,t,l),o&&o.toast&&o.toast("El registro fue grabado exitosamente! storeeeeee not connected"),n.tmpId=s.tmpId,n.id=s.id,console.log("========>>",a),a.close({success:!0,data:s})},e.onerror=e=>{o&&o.toast&&o.toast("Error!")}}}))}}else MsgBox$1("Verifique el formulario, aun tiene campos obligatorios sin completar."),"v-dialog"==n.parentNode.className?n.parentNode.parentNode.scroll({top:0,behavior:"smooth"}):n.querySelector("form > .v-form").scroll({top:0,behavior:"smooth"})},open:m,close:y,create:e=>{const t=g(e.target,".v-datatable");let l=u.filter((e=>"v-table"==e.type)).find((e=>e.is(t))).getForm().action;l||(l=window.location.pathname),l&&(l=l.replace("/api","")),o&&m(l+"/create")},edit:e=>{const t=g(e.target,".v-datatable");let l=u.filter((e=>"v-table"==e.type)).find((e=>e.is(t))),a=l.getForm().action;var n;a||(a=window.location.pathname),l&&l.src&&(a=l.src),e.action&&(a=e.action),a&&(n=a.replace("/api","").replace("/0/0",""),a="/admin"+n);const s=l.selected.value[0];let i=s[l.rowKey];s.tmpId&&(i=-s.tmpId),o?m(a+"/"+i+"/edit"):o.axios.get((_$1.currentPath=(a+"/"+i+"/edit").replace(/([^:]\/)\/+/g,"$1"))+"?modal").then(r.open).catch(d)},destroy:e=>{let t=this;const l=g(e.target,".v-datatable");let r=u.filter((e=>"v-table"==e.type)).find((e=>e.is(l)));u.find((e=>"v-table"!=e.type)).action;let a=e.$vnode?e.load:null,n=r.rowKey,s=r.selected.value[0];if(s.tmpId)MsgBox$1("Esta seguro que desea eliminar los registros temporales seleccionados ?",(function(e){if(0==e){let e=0,l=_$1.db.transaction([r.store],"readwrite").objectStore(r.store),n=[];for(let t=r.selected.length-1;t>=0;t--)s=r.data[r.selected[t]],n.push(s),s.tmpId&&l.delete(s.tmpId),e++,r.data.splice(r.selected[t],1);e&&(o&&o.toast?o.toast(e+" registros eliminados"):MsgBox$1(e+" registros eliminados")),r.rowSelect(null,-1),r.selected=[],t.$emit("destroyed",n,r.store),a&&a()}}),["SI","NO"]);else{if(!n)return alert("Table don`t have defined attribute 'rowkey'");let e=s[n];MsgBox$1("Esta seguro que desea eliminar el registro seleccionado?",(t=>{if(0==t){const t=r.src.replace("/0/0",""),l=[];let a=r.selected.value.length-1;o.axios.delete(t+"/"+e,{params:w.value}).then((()=>{for(;a>=0;a--)s=r.selected.value[a],l.push(s),r.remove(s);o&&o.toast?o.toast(l.length+" registros eliminados"):MsgBox$1(l.length+" registros eliminados"),r.rowSelect(null,-1),r.selected.value=[]})).catch(d)}}),["SI","NO"])}},rowSelectedCount:$,...C};return V}},e};exports.Drag=Drag,exports.IsobitUI=IsobitUI,exports.MsgBox=MsgBox$1,exports.VForm=VForm,exports._=_$1,exports.app=app,exports.date=date,exports.db=db,exports.getStoredList=getStoredList,exports.id=id,exports.initDB=initDB,exports.mask=mask,exports.pad=pad,exports.removeError=removeError,exports.resize=resize,exports.setupApp=setupApp,exports.ui=ui,exports.unmask=unmask,exports.useAppStore=useAppStore;
1
+ "use strict";var vue=require("vue"),pinia=require("pinia"),axios$2=require("axios"),Observable=require("ol/Observable"),ol$1=require("ol"),FullScreen=require("ol/control/FullScreen"),GeoJSON=require("ol/format/GeoJSON"),VectorLayer=require("ol/layer/Vector"),VectorSource=require("ol/source/Vector"),style=require("ol/style"),Control=require("ol/control/Control");require("ol/ol.css");var PointerInteraction=require("ol/interaction/Pointer"),Feature=require("ol/Feature"),Map=require("ol/Map");require("ol/interaction/Pointer.js"),require("ol/interaction/defaults");var View=require("ol/View"),geom=require("ol/geom");require("ol/interaction/Select");var proj=require("ol/proj"),layer=require("ol/layer"),source=require("ol/source");require("ol/interaction/Translate");var _imports_0=require("@/cdn/images/triangle-down.svg"),vueRouter=require("vue-router"),vueFontawesome=require("@fortawesome/vue-fontawesome"),freeRegularSvgIcons=require("@fortawesome/free-regular-svg-icons"),script$s={name:"InputText"};const _hoisted_1$j={type:"text"};function render$o(e,t,l,o,r,a){return vue.openBlock(),vue.createElementBlock("input",_hoisted_1$j)}script$s.render=render$o,script$s.__file="src/InputText.vue";var script$r={name:"InputTextarea"};function render$n(e,t,l,o,r,a){return" text "}script$r.render=render$n,script$r.__file="src/InputTextarea.vue";const _$1={stores:[],_id:0,axios_get:null,storeFunction:{}},log=(e,...t)=>{e&&console.log(e,...t)};let configApp={};function setupApp({pinia:e,axios:t,router:l}){configApp.pinia=e||pinia.createPinia(),t&&(configApp.axios=t),l&&(configApp.router=l),pinia.setActivePinia(configApp.pinia)}function getConfigApp(){return configApp}function getPiniaInstance(){return pinia.getActivePinia()||configApp.pinia}const id=()=>_$1._id++,num=e=>e=e?""==e?null:Number(""+e):0,date=(e,t)=>{if(e){let l;if(e instanceof Date)l=e;else if("string"==typeof e){let t=e.includes("T")?e.split("T"):e.split(" ");l=t[0].split("-"),t.length>1?(t=t[1].split(":"),l=new Date(parseInt(l[0]),parseInt(l[1])-1,parseInt(l[2]),parseInt(t[0]),parseInt(t[1]),t.length>2?parseInt(t[2]):0)):l.length>2?l=new Date(parseInt(l[0]),parseInt(l[1])-1,parseInt(l[2])):(l=e.split(":"),l=l.length>2?new Date(1981,0,6,parseInt(l[0]),parseInt(l[1]),parseInt(l[2])):new Date(e))}else l=new Date(e);if(1==t)e=l;else if("time"===t)e=pad(l.getHours(),2)+":"+pad(l.getMinutes(),2)+":"+pad(l.setSeconds()?l.setSeconds():0,2);else if("time a"==t)if("string"==typeof e||e instanceof String){let t=(e=e.split(":"))[0];e=pad(t>12?t-12:t,2)+":"+e[1]+":"+e[2]+" "+(t>12?"PM":"AM")}else h=l.getHours(),e=pad(h>12?h-12:h,2)+":"+pad(l.getMinutes(),2)+(l.setSeconds()?":"+pad(l.setSeconds(),2):"")+" "+(h>12?"PM":"AM");else e="date-"==t?pad(l.getFullYear(),4)+"-"+pad(l.getMonth()+1,2)+"-"+pad(l.getDate(),2):"dMY"==t||"date"==t?pad(l.getDate(),2)+"/"+pad(l.getMonth()+1,2)+"/"+pad(l.getFullYear(),4):"datetime"==t?pad(l.getFullYear(),4)+"-"+pad(l.getMonth()+1,2)+"-"+pad(l.getDate(),2)+"T"+pad(l.getHours(),2)+":"+pad(l.getMinutes(),2)+":"+pad(l.setSeconds()?l.setSeconds():0,2):pad(l.getDate(),2)+"/"+pad(l.getMonth()+1,2)+"/"+pad(l.getFullYear(),4)+" "+pad(l.getHours(),2)+":"+pad(l.getMinutes(),2)}return e},whichChild=e=>{let t=0;for(;null!=(e=e.previousElementSibling);)++t;return t},unmask=e=>{e&&(e.style.display="none",e.parentNode&&e.parentNode.removeChild(e))},isObject=e=>e&&"object"==typeof e&&!Array.isArray(e),mergeDeep=function(){let e=arguments[0],t=[];for(let e=1;e<arguments.length;e++)t.push(arguments[e]);if(!t.length)return e;let l,o=t.shift();if(isObject(e)&&isObject(o))for(let t in o)isObject(o[t])?(e[t]||(l={},l[t]={},Object.assign(e,l)),mergeDeep(e[t],o[t])):(l={},l[t]=o[t],Object.assign(e,l));let r=[];return r.push(e),r.concat(t),mergeDeep.apply(null,r)},buildPopupMenu=e=>{let t=e.getAttribute("v--popup");if(!t){e.setAttribute("v--popup",t=id());let l=_$1.storeFunction[t],o=e.querySelectorAll(".v-datatable-header .v-button");o&&o.length&&!l&&window.innerWidth<=700&&setTimeout((function(){l=document.createElement("ul"),l.className="v-popup-2",e.appendChild(l);let r=null;const a=e=>{l.style.display="none";let t=e.target.getAttribute("commandId"),o=document.querySelector("#"+t);"BUTTON"==o.tagName?o.click():o.children[0].click(),unmask(r)};e.style.position="relative";let n=document.createElement("div");n.className="v-mobil v-table-buttons";let s=document.createElement("i");s.className="fa fa-bars fa-w-14",n.appendChild(s),n.onclick=()=>{for(o=e.querySelectorAll(".v-datatable-header .v-button");l.firstChild;)l.removeChild(l.firstChild);for(s=0;s<o.length;s++)if("none"!=o[s].style.display){let e=document.createElement("li");if(o[s].id||(o[s].id="c-"+id()),e.setAttribute("commandId",o[s].id),"BUTTON"==o[s].tagName){if(o[s].disabled)continue;e.appendChild(o[s].children[0].cloneNode(!0)),e.appendChild(document.createTextNode(o[s].value?o[s].value:o[s].title))}else o[s].children[0].children[1]&&(e.appendChild(o[s].children[0].children[1]),e.appendChild(document.createTextNode(o[s].textContent)));e.onclick=a,l.appendChild(e)}r=mask(l),l.style.display="block",r.onclick=()=>{l.style.display="none",unmask(r)}},e.appendChild(n),_$1.storeFunction[t]=l}),500)}},resize=()=>{},mask=(e,t)=>{if(!document.body)return;let l,o=document.createElement("div");o.style="top:50%;transform:translate(-50%,-50%);position:absolute;width:100%;z-index:2; display: flex;justify-content: center;";let r=o.style;if(r.left="50%",r.textAlign="center",!1!==e)if(e instanceof Element)o=e;else{if(e){let t=document.createElement("div");t.innerHTML=e,o.append(t),o.style="padding:4px;margin-bottom:5px;color:white;font-size:24px;text-align:center"}l=document.createElement("div"),r=l.style,l.className="loading"}let a=document.createElement("div");r=a.style,r.height="100%",r.top="0px",r.position="absolute",r.left="0",r.zIndex="10000",r.width="100%";let n=document.createElement("div");return n.className="v-overlay",a.appendChild(n),o.style.zIndex="1001",a.appendChild(o),a.className="v-mask",l&&o.appendChild(l),document.body.appendChild(a),a},MsgBox$1=(e,t,l)=>{if(l||(l=["OK"]),!document.body)return;let o=document.createElement("div");o.classList.add("v-overlay"),o.style.padding="40px",o.style.zIndex="2000",document.body.appendChild(o);let r=document.createElement("div"),a=document.createElement("div"),n=document.createElement("div"),s=document.createElement("div");s.className="v-msgbox-buttons",r.classList.add("v-dialog"),r.classList.add("v-msgbox"),e instanceof Element?n=e:n.innerHTML=e,r.setAttribute("path",_$1.currentPath);let i=function(){r.style.display="none",o.style.display="none",r.parentNode.removeChild(r),o.parentNode.removeChild(o),t&&t(this.getAttribute("index"))};for(let e=0;e<l.length;e++){let t=document.createElement("button");t.innerHTML=l[e],t.type="button",t.setAttribute("index",e),t.className="v-button ui-widget ui-state-default ui-corner-all",s.appendChild(t),t.addEventListener("click",i)}a.className="v-dialog-content v-widget-content",a.appendChild(n),a.appendChild(s),r.appendChild(a),o.appendChild(r),o.style.visibility="unset",o.style.opacity="unset",o.style.overflow="auto",r.style.margin="0px auto 50%",r.style.position="unset";let u=r.querySelector(".v-js-close");if(!u){let e=document.createElement("span");r.style.position="relative",e.style.position="absolute",e.className="fa fa-close",u=document.createElement("a"),u.className="v-js-close ui-dialog-titlebar-icon ui-dialog-titlebar-close ui-corner-all",u.appendChild(e),r.appendChild(u),u.addEventListener("click",i)}},configureAxios=e=>{if(e.configured)return;let t;e.configured=1,_$1.axios_get=e.get,e.interceptors.request.use((l=>(e.noInterceptor||(_$1.eeee=l,l.mask?l.mask():t||(t=mask())),l)),(e=>(t=unmask(t),MsgBox$1("request "+id()+" "+e.message),Promise.reject(e)))),e.interceptors.response.use((l=>(t=unmask(t),delete e.noInterceptor,l)),(l=>{if(console.log("interceptors.response.use.error"),e.noInterceptor)return delete e.noInterceptor,t=unmask(t),Promise.reject(l);if(e.error&&0==e.error(l))t=unmask(t);else{let e,o=l.response;if(o&&("string"==typeof o.data?e=o.data:o.data&&(o.data.data&&(e=o.data.data.message),e||(e=o.data.msg||o.data.message)),e||(e=o.status+": "+o.statusText)),e||(e=l.message),t=unmask(t),o&&(401==o.status||403==o.status)){const e=app();if(e&&localStorage.getItem("session"))return e.axios.noInterceptor=1,void e.axios.post(e.axios.VITE_LOGIN_PATH+"/validate",{JWT:"YOUR_JWT_HERE"}).catch((t=>{console.log("e.response=",t),t.response.data.success||MsgBox$1("Session terminada!",(()=>{e.logout()}))}))}l.config?.error?l.config.error(l,e):l.request?MsgBox$1("<b>"+l.request.responseURL+"</b><br/><br/>"+e):MsgBox$1(e)}return delete e.error,Promise.reject(l)}))},pad=(e,t)=>{if(null!=e){let l=1*e+"";for(;l.length<t;)l="0"+l;return l}},clean=e=>{const t={...e};for(let e in t)""!==t[e]&&null!==t[e]&&"function"!=typeof t[e]&&void 0!==t[e]||delete t[e];return t},sum=e=>(void 0).reduce(((t,l)=>t+((l=e?l[e]:l)?Number(l):0)),0);function createGetters(){return{get networkStatus(){return _$1.app?.networkStatus||{connected:!0}},get db(){return _$1.app?.db},app:()=>_$1.app,setApp(e){_$1.app=e}}}const app=()=>_$1.app,db=()=>_$1.db,initDB=(e,t)=>{let l=window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB;if(_$1.IDBTransaction=window.IDBTransaction||window.webkitIDBTransaction||window.msIDBTransaction,_$1.IDBKeyRange=window.IDBKeyRange||window.webkitIDBKeyRange||window.msIDBKeyRange,l){if(l)return _$1.stores=t,new Promise(((o,r)=>{l.databases().then((a=>{const n=a.find((e=>"db"===e.name)),s=n&&n.version||0;if(s<e){console.log(`Eliminando base de datos (versión actual: ${s}, nueva versión: ${e})`);l.deleteDatabase("db").onsuccess=()=>{let a=l.open("db",e);a.onupgradeneeded=e=>{let l=e.target.result;t.forEach((e=>{if(!l.objectStoreNames.contains(e[0])){const{keyPath:t}=e[1];l.createObjectStore(e[0],{keyPath:t,autoIncrement:!t})}}))},a.onerror=e=>{r(e)},a.onsuccess=()=>{_$1.db=a.result,o(_$1.db)}}}else{let a=l.open("db",e);a.onupgradeneeded=e=>{let l=e.target.result;t.forEach((e=>{if(!l.objectStoreNames.contains(e[0])){const{keyPath:t}=e[1];l.createObjectStore(e[0],{keyPath:t,autoIncrement:!t})}}))},a.onerror=e=>{r(e)},a.onsuccess=()=>{_$1.db=a.result,o(_$1.db)}}}))}))}else window.alert("Your browser doesn't support a stable version of IndexedDB.");return l},getStoredList=async(e,t)=>{const l=db();let o;try{o=JSON.parse(sessionStorage.getItem("loadedStores"))}catch(e){}if(null==o&&(o={}),!o[e]&&networkStatus.connected){const t=_$1.stores.filter((t=>t[0]==e));if(!t.length)throw`ERROR: store '${e}' no exists!`;let r=t[0];const{src:a}=r[1];if(!a)throw`ERROR: Url for store '${r[0]}' is empty!`;let n=a?await _$1.axios_get(a):[];n=n.data||n,await new Promise(((t,a)=>{let s=l.transaction([r[0]],"readwrite"),i=s.objectStore(r[0]);const u=i.clear();u.onsuccess=()=>{n.forEach((e=>{i.add(e).onerror=e=>{console.error(`⚠️ Store '${e[0]}' error addd data!`,e)}}))},u.onerror=()=>{console.error(`⚠️ Store '${r[0]}' error data!`,r)},s.oncomplete=()=>{o[e]=1,sessionStorage.setItem("loadedStores",JSON.stringify(o)),t()},s.onerror=e=>{console.error(`ERROR: ⚠️ Error en la transacción for store '${e[0]}'!`,e),a()}}))}return await new Promise(((t,o)=>{if(l){const o=l.transaction(e).objectStore(e).getAll();o.onsuccess=()=>{t(o.result)}}else console.log("1=========>db=",window._.db),o("=======>db is null esta faltando")}))},getters=createGetters(),{networkStatus:networkStatus,setApp:setApp}=getters,deleteAllCookies=()=>{const e=document.cookie.split(";");for(let t of e){const e=t.split("=")[0].trim();document.cookie=`${e}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;`}},useAppStore=pinia.defineStore("connection",(()=>{const e=getPiniaInstance(),t=getConfigApp();if(!e)throw new Error("Pinia no ha sido inicializado. Llama a setupPinia() en tu app.");const l=vue.ref(!1),o=vue.ref(!1),r=vue.ref(t.router),a=vue.ref(t.axios),n=vue.ref(null),s=vue.ref(null);l.value="false"!==localStorage.getItem("connected");const i=e=>{setTimeout((()=>{n.value&&(a.value.noInterceptor=1,a.value.post(a.value.VITE_LOGIN_PATH+"/refresh",{}).then((({data:t})=>{const{token:l,user_nicename:o,perms:r}=t;n.value={token:l,people:{display_name:o},perms:r},e(i)})).catch((e=>{console.error(e)})))}),6e5)};let u;vue.watch(n,(e=>{e&&e.token?(a.value.defaults.headers.common={Authorization:"Bearer "+e.token},localStorage.setItem("session",JSON.stringify(e)),u||(u=i,i(i))):(localStorage.removeItem("session"),u=null)}));const c=localStorage.getItem("session");n.value=c?JSON.parse(c):null,vue.watch(l,(e=>{localStorage.setItem("connected",String(e))}));const d=vue.computed((()=>s.value?.connected)),p=vue.computed((()=>!!n.value?.token));return{connected:l,session:n,logout:()=>{n.value=null,deleteAllCookies(),r.value.push("/login")},unauthorized:o,connect:e=>{n.value=e,r.value.push("/admin")},authenticated:p,config:({axios:e,router:t})=>{t&&(r.value=t),e&&(a.value=e,configureAxios(e))},axios:a,router:r,online:d,networkStatusChange:e=>{s.value=e}}}));var script$q={name:"VAutocomplete",props:{value:{type:Object,required:!0},data:{type:Array,default:()=>null},placeholder:String,label:String,default:Object,store:String,params:Object,autoload:{type:Boolean,default:!1},floating:{type:Boolean,default:!0},src:String,readonly:Boolean,nowrap:Boolean,disabled:Boolean,showSelection:{type:Boolean,default:!0},pagination:{type:Number,default:10}},setup(e,t){const{emit:l,slots:o}=t;useAppStore();const r=vue.ref(0),a=vue.ref(null),n=vue.ref(-1),s=vue.ref(""),i=vue.ref(null),u=vue.ref(!1),c=vue.ref(0),d=vue.ref("");vue.watch((()=>e.value),(e=>{a.value=e})),vue.watch((()=>e.data),(e=>{i.value=e})),vue.onMounted((()=>{d.value=e.inputClass,e.autoload&&v(),document.addEventListener("click",h)})),vue.onBeforeUnmount((()=>{document.removeEventListener("click",h)}));const p=vue.computed((()=>{n.value=-1;const e=s.value?s.value.trim().toLowerCase().split(/[ ,]+/):null;return i.value&&s.value?i.value.filter((t=>{const l=JSON.stringify(t).toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"");return e.every((e=>l.includes(e)))})):i.value})),v=async t=>{const{src:o,source:a}=e;let n=Number(e.pagination);if(1===t)r.value+=n;else if(r.value=0,e.data&&e.autoload)return;let d={query:s.value};e.params&&(d=mergeDeep(d,e.params)),axios$2.get((o||e.source)+(n>0?"/"+r.value+"/"+n:""),{params:d}).then((l=>{const o=l.data;console.log(o),o.error?MsgBox(o.error):(i.value=1===t?i.value.concat(o.data?o.data:o):o.data?o.data:o,console.log(i),c.value=o.size,e.autoload||(u.value=!0),console.log("========================="))})).catch(m).then((()=>{l("complete",{data:i.value,query:s.value,target:"me"})}))},m=e=>{console.log(e)},h=e=>{};return{query:s,show:u,selected:a,data2:p,focused:n,inputClass:d,search:v,remove:()=>{l("input",null)},clickout:h,focusout:e=>{},setSelected:e=>{a.value=e,l("update:modelValue",e)},getLabel:t=>{if(e.label){const l=e.label.split(".");for(let e=0;e<l.length;e++)t&&(t=t[l[e]])}return t},hasSlot:(e="default")=>!!o[e]}}};const _hoisted_1$i=["value","disabled"],_hoisted_2$9=["disabled","placeholder"],_hoisted_3$5={class:"v-list"},_hoisted_4$3=["onClick"],_hoisted_5$1={key:0,class:"center yellow",style:{padding:"5px"}};function render$m(e,t,l,o,r,a){return vue.openBlock(),vue.createElementBlock("div",{class:"v-autocomplete",onFocusout:t[7]||(t[7]=(...e)=>o.focusout&&o.focusout(...e)),value:l.value,disabled:l.disabled},[o.selected&&l.showSelection?(vue.openBlock(),vue.createElementBlock("div",{key:0,class:"v-selection",style:vue.normalizeStyle({whiteSpace:l.nowrap?"nowrap":""})},[vue.renderSlot(e.$slots,"label",{selected:o.selected}),vue.createTextVNode(" "+vue.toDisplayString(o.hasSlot("label")?" ":o.getLabel(o.selected))+"  ",1),l.readonly?vue.createCommentVNode("v-if",!0):(vue.openBlock(),vue.createElementBlock("span",{key:0,onClick:t[0]||(t[0]=(...e)=>o.remove&&o.remove(...e)),class:"remove-icon"},t[8]||(t[8]=[vue.createElementVNode("i",{class:"fa fa-times"},null,-1)])))],4)):vue.createCommentVNode("v-if",!0),o.selected?vue.createCommentVNode("v-if",!0):(vue.openBlock(),vue.createElementBlock("span",{key:1,onClick:t[1]||(t[1]=(...e)=>o.search&&o.search(...e)),class:"search-icon"},t[9]||(t[9]=[vue.createElementVNode("i",{class:"fa fa-xs fa-sync"},null,-1)]))),o.selected?vue.createCommentVNode("v-if",!0):vue.withDirectives((vue.openBlock(),vue.createElementBlock("input",{key:2,onKeyup:[t[2]||(t[2]=(...t)=>e.keyup&&e.keyup(...t)),t[3]||(t[3]=vue.withKeys(vue.withModifiers(((...e)=>o.search&&o.search(...e)),["stop","prevent"]),["enter"]))],class:vue.normalizeClass(o.inputClass),onFocus:t[4]||(t[4]=e=>o.show=!0),disabled:l.disabled,placeholder:l.placeholder,"onUpdate:modelValue":t[5]||(t[5]=e=>o.query=e)},null,42,_hoisted_2$9)),[[vue.vModelText,o.query]]),vue.createVNode(vue.Transition,{name:"fade",persisted:""},{default:vue.withCtx((()=>[vue.withDirectives(vue.createElementVNode("div",{class:"v-resultpane",style:vue.normalizeStyle({zIndex:2,width:"calc(100% - 2px)",position:l.floating?"absolute":"relative"})},[vue.createElementVNode("div",_hoisted_3$5,[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(o.data2,((t,l)=>(vue.openBlock(),vue.createElementBlock("div",{key:l,class:vue.normalizeClass({"v-selected":o.selected==t,"v-focused":o.focused==l}),onClick:e=>o.setSelected(t)},[vue.renderSlot(e.$slots,"default",{row:t})],10,_hoisted_4$3)))),128)),e.data0&&e.data0.length<e.total?(vue.openBlock(),vue.createElementBlock("div",{key:0,class:"center",onClick:t[6]||(t[6]=e=>o.search(1))},"Load more "+vue.toDisplayString(e.total-e.data0.length)+" results...",1)):vue.createCommentVNode("v-if",!0)]),o.data2&&o.data2.length<1?(vue.openBlock(),vue.createElementBlock("div",_hoisted_5$1,"No results found.")):vue.createCommentVNode("v-if",!0)],4),[[vue.vShow,o.show&&!o.selected]])])),_:3})],40,_hoisted_1$i)}script$q.render=render$m,script$q.__scopeId="data-v-72884078",script$q.__file="src/v-autocomplete.vue";var script$p={name:"VButton",mounted(){var e=this,t=document.createElement("span"),l=document.createElement("i");t.className="ui-button-text ui-c ",t.innerHTML=e.$attrs.value?e.$attrs.value:"ui-button",e.$el.addEventListener("click",(t=>{t.component=e})),e.$attrs.icon?(e.$attrs.value?e.$el.classList.add("v-button-text-icon-left"):e.$el.classList.add("v-button-icon-only"),l.dataset.icon=e.$attrs.icon,l.className="fa "+e.$attrs.icon,e.$el.appendChild(l)):(t=document.createElement("span"),e.$el.classList.add("ui-button-text-only"),e.$el.appendChild(t)),e.$attrs.value&&((t=document.createElement("span")).appendChild(document.createTextNode(e.$attrs.value)),e.$el.appendChild(t)),e.updateIcon()},methods:{updateIcon(){var e=this;setTimeout((function(){var t=e.$el.querySelector("svg");if(t){var l=t.dataset;l.icon||(l.icon=e.$attrs.icon)}}),1e3)}}};const _hoisted_1$h={type:"button",class:"_ ui-widget ui-state-default ui-corner-all v-button"};function render$l(e,t,l,o,r,a){return vue.openBlock(),vue.createElementBlock("button",_hoisted_1$h)}script$p.render=render$l,script$p.__file="src/v-button.vue";var script$o={name:"VCalendar",props:{modelValue:null,type:String,required:String,readonly:String,max:String,min:String},setup(e,{emit:t}){const{type:l,modelValue:o,max:r,min:a}=e,n=vue.ref(null),s=e=>{t("update:modelValue",e),vue.nextTick((()=>{t("changed",e)}))},i=e=>{if(e){let t;if("time"===l)return t=e.split(":"),new Date(1981,1,6,parseInt(t[0]),parseInt(t[1]),t.length>2?parseInt(t[2]):0);{if(!isNaN(e))return new Date(e);let o;if("datetime-local"===l)return o=e.split("T"),t=o[1].split(":"),o=o[0].split("-"),o=new Date(parseInt(o[0]),parseInt(o[1])-1,parseInt(o[2]),parseInt(t[0]),parseInt(t[1]),t.length>2?parseInt(t[2]):0),o;{o=e.split("-");let t=parseInt(o[0]);return t<100?e:(o=new Date(t,parseInt(o[1])-1,parseInt(o[2])),o)}}}return e};vue.watch((()=>e.modelValue),(e=>{u(e)}));const u=e=>{if(!n.value)return;let t,o=i(e);o&&(t="string"==typeof o?o:"time"===l?pad(o.getHours(),2)+":"+pad(o.getMinutes(),2):"datetime-local"===l?pad(o.getFullYear(),4)+"-"+pad(o.getMonth()+1,2)+"-"+pad(o.getDate(),2)+"T"+pad(o.getHours(),2)+":"+pad(o.getMinutes(),2):pad(o.getFullYear(),4)+"-"+pad(o.getMonth()+1,2)+"-"+pad(o.getDate(),2)),n.value.value=t};return{enterD:e=>{let o=e.target.value,n=i(o);return r&&n&&n.getTime()>=i(r).getTime()||a&&n&&n.getTime()<=i(a).getTime()?(t("invalid",{target:me,value:n}),n=null,void(e.target.value=n)):void("time"===l?s(pad(n.getHours(),2)+":"+pad(n.getMinutes(),2)+":00"):n.getTime&&s(n.getTime()))},input:n}}};const _hoisted_1$g=["required","readonly","min","max","type"];function render$k(e,t,l,o,r,a){return vue.openBlock(),vue.createElementBlock("div",null,[vue.createElementVNode("input",{required:l.required,ref:"input",readonly:l.readonly,min:l.min,max:l.max,onChange:t[0]||(t[0]=(...e)=>o.enterD&&o.enterD(...e)),type:l.type?l.type:"date"},null,40,_hoisted_1$g)])}script$o.render=render$k,script$o.__file="src/v-calendar.vue";var script$n={name:"VCheckboxGroup",props:{required:String,name:String},data:()=>({value:[],options:[],nam:null}),created(){this.nam||(this.nam=this.$props.name?this.$props.name:"input_"+id()),this.update2()},updated(){this.update2()},mounted(){this.options=this.$el.querySelectorAll("input:not(.v-chk)");for(var e=0;e<this.options.length;e++)this.options[e].classList.add("v-chk");this.update2()},methods:{update2(){var e=this.options,t=this.$attrs.value;"string"==typeof t&&(t=t.split("|"));for(var l=0;l<e.length;l++){e[l].checked=!1;for(var o=0;t&&o<t.length;o++)e[l].value==t[o]&&(e[l].checked=!0)}},onChange:function(e,t){var l=this,o=l.$attrs.value;if(("string"==typeof o||o instanceof String)&&(o=o.split("|")),t)o||(l.$attrs.value=o=[]),o.push(e);else{var r=o.indexOf(e);r>-1&&o.splice(r,1)}l.$emit("input",o)}}};function render$j(e,t,l,o,r,a){return vue.openBlock(),vue.createElementBlock("div",null,[vue.renderSlot(e.$slots,"default")])}script$n.render=render$j,script$n.__file="src/v-checkbox-group.vue";var script$m=vue.defineComponent({name:"VCheckbox",props:{value:null,modelValue:null,valueFalse:null,label:String,readonly:Boolean},emits:["update:modelValue"],setup(e,{emit:t}){const l=vue.ref(null),o=vue.ref(0),r=vue.computed((()=>e.value?e.value===e.modelValue:["true","1",!0].includes(e.modelValue)));vue.watch((()=>e.modelValue),(e=>{l.value&&(l.value.checked=r.value)}));return vue.onMounted((()=>{l.value&&(l.value.checked=r.value)})),{input:l,hadValue:o,isChecked:r,change:()=>{if(!e.readonly){const r=l.value.checked,a=r?e.value||r:e.valueFalse??r;a&&(o.value=1),t("update:modelValue",a)}},getLabel:vue.computed((()=>e.label||("string"==typeof e.value?e.value:"")))}}});const _hoisted_1$f=["innerHTML"],_hoisted_2$8=["checked","value"];function render$i(e,t,l,o,r,a){return vue.openBlock(),vue.createElementBlock("label",{style:{"font-weight":"normal !important",display:"block"},class:"v-checkbox",onClick:t[1]||(t[1]=vue.withModifiers((()=>{}),["stop"]))},[vue.createElementVNode("span",{innerHTML:e.getLabel},null,8,_hoisted_1$f),vue.createElementVNode("input",{ref:"input",type:"checkbox",checked:e.isChecked,onChange:t[0]||(t[0]=(...t)=>e.change&&e.change(...t)),value:e.value},null,40,_hoisted_2$8),t[2]||(t[2]=vue.createElementVNode("span",{class:"checkmark"},null,-1))])}script$m.render=render$i,script$m.__file="src/v-checkbox.vue";var script$l={name:"VDataview",props:{value:Array,filterKey:String,src:String,filters:Object,store:null,itemWidth:null,rowKey:String,rowStyleClass:null,pagination:null,selectable:Boolean,scrollable:Boolean,autoload:{type:Boolean,default:!0}},data:function(){return{data:null,pages:1,page:1,columns:1,w:0,row:{},error:null,size:null,sortKey:"",selected:[],sortOrders:{},rowStyleClassFunc:null}},created(){var me=this;try{me.rowStyleClass&&(eval("me.rowStyleClassFunc=function(row,item,index){return "+me.rowStyleClass+"}"),me.rowStyleClassFunc({},{},0))}catch(e){me.rowStyleClassFunc=null,console.log("Error en la expresion rowStyleClassFunc=function(row,item,index){return "+me.rowStyleClass+"}")}},updated(){console.log("updated"),this.$emit("updated"),this.resize()},mounted(){var e=this;e.$el.addEventListener("parentResize2",e.resize),e.autoload&&e.load(),e.resize()},methods:{resize(){var e=this;if(e.itemWidth){var t=1+Math.trunc(e.$el.offsetWidth/Number(e.itemWidth));t>6&&(t=6),e.columns=t}},async getStoredList(e){let t=new Promise((t=>{var l=window._.db.transaction(e).objectStore(e).getAll();l.onsuccess=function(){t(l.result)}}));return await t},async loadStore(){let e=this,t=e.store;if(null!=t){let l;return window._.db&&(l=await e.getStoredList(t)),l||(l=[]),e.data=e.data?l.concat(e.data):l,console.log("loadStore"),console.log(e.data),e.data}},getRowClass(e,t){var l=this,o=t%l.columns+1,r=["c-w-"+l.columns];return o==l.columns&&r.push("v-last"),l.rowStyleClassFunc?r.push(l.rowStyleClassFunc(e,e,t)):r.push(l.rowStyleClass),r},remove(e){e=e.id?e.id:e;var t=this.data,l=t.map((e=>e.id)).indexOf(e);t.splice(l,1)},error2(e,t){this.data=[],this.error=t},load(e){var t=this;if(this.selected=[],t.value)t.data=t.value;else{!0===e&&(t.page=1);var l=t.src;l||(l=t.$root.apiLink(window.location.pathname)),l.endsWith("/")&&(l=l.slice(0,l.length-1)),t.pagination&&(l+="/"+(t.page-1)*t.pagination+"/"+t.pagination),axios.get(l,{error:t.error2,params:t.filters}).then((function(l){if(l.data&&l.data.error)MsgBox(l.data.error);else{var o=t.value?t.value:l.data.data?l.data.data:l.data;t.data||(t.data=[]),t.data=!0===e?o:t.data?t.data.concat(o):t.data,t.size=l.data.size,l.data&&l.data.size&&(t.pages=Math.ceil(l.data.size/t.pagination),t.page>t.pages&&(t.page=1)),t.$emit("loaded",{target:t,response:l})}})).catch(t.error)}}}};const _hoisted_1$e={class:"v-dataview"};function render$h(e,t,l,o,r,a){return vue.openBlock(),vue.createElementBlock("div",_hoisted_1$e,[e.data?(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,{key:0},vue.renderList(e.data,((t,l)=>(vue.openBlock(),vue.createElementBlock("div",{class:vue.normalizeClass(a.getRowClass(t,l))},[vue.renderSlot(e.$slots,"default",{row:t,item:t,index:l})],2)))),256)):vue.createCommentVNode("v-if",!0),e.data&&!e.data.length?(vue.openBlock(),vue.createElementBlock("div",{key:1,class:vue.normalizeClass(["center v-no-results",{error:e.error}])},vue.toDisplayString(e.error?e.error:"No existen registros para mostrar"),3)):vue.createCommentVNode("v-if",!0),e.data&&e.size>e.data.length?(vue.openBlock(),vue.createElementBlock("div",{key:2,onClick:t[0]||(t[0]=t=>a.load(e.page++)),class:"center v-more-results"},"Ver mas resultados")):vue.createCommentVNode("v-if",!0)])}script$l.render=render$h,script$l.__file="src/v-dataview.vue";var script$k={name:"VFieldset",props:{legend:String,closable:null},watch:{closed(e){this.$emit("change",{target:this,closed:e}),this.$emit("input",!e)}},data:()=>({closed:!1}),created(){this.closed=this.closable},mounted(){var e=this;e.$el.addEventListener("parentResize",(t=>{t.$target=e,e.$emit("resize",t)}))},updated(){var e=this;setTimeout((function(){var t=e.$el.querySelector("legend > * > svg");if(t)try{console.log(),t.dataset.icon=t.parentNode.dataset.icon}catch(e){console.log("icon"),console.log(e)}}),50)}};const _hoisted_1$d={class:"v-fieldset"},_hoisted_2$7=["data-icon"],_hoisted_3$4=["innerHTML"],_hoisted_4$2={style:{flex:"1",display:"flex","flex-direction":"column"}};function render$g(e,t,l,o,r,a){return vue.openBlock(),vue.createElementBlock("fieldset",_hoisted_1$d,[l.legend?(vue.openBlock(),vue.createElementBlock("legend",{key:0,onClick:t[0]||(t[0]=e=>r.closed=l.closable&&!r.closed),style:vue.normalizeStyle({cursor:l.closable?"pointer":""})},[l.closable?(vue.openBlock(),vue.createElementBlock("span",{key:0,"data-icon":r.closed?"plus":"minus",style:{margin:"0px 5px 0px 0px"}},[vue.createElementVNode("i",{class:vue.normalizeClass([r.closed?"fa-plus":"fa-minus","fa"])},null,2)],8,_hoisted_2$7)):vue.createCommentVNode("v-if",!0),vue.createElementVNode("span",{innerHTML:l.legend},null,8,_hoisted_3$4)],4)):vue.createCommentVNode("v-if",!0),vue.withDirectives(vue.createElementVNode("div",_hoisted_4$2,[vue.renderSlot(e.$slots,"default")],512),[[vue.vShow,!r.closed]])])}script$k.render=render$g,script$k.__file="src/v-fieldset.vue";var script$j={name:"VForm",props:["header","store","action"],setup(e,t){const{store:l}=e,{slots:o,expose:r}=t,a=vue.ref(null),n=vue.inject("viewCollector"),s={get:()=>({...e})};return vue.provide("formCollector",s),n.push({store:l,type:"v-form",$el:a,$forceUpdate:()=>{}}),r({...e}),()=>{const t=[];return e.header&&t.push(vue.h("div",{class:"v-widget-header v-panel-titlebar"},[vue.h("span",{class:"v-panel-title"},e.header)])),t.push(vue.h("div",{ref:a,class:"v-dialog-content v-widget-content"},[vue.h("form",{action:e.action},o.default())])),vue.h("div",{class:"ui-panel"},t)}},watch:{header(e){this.setTitle(e)}},data:()=>({timer:null}),methods:{setTitle(e){var t=this.$parent.app;t&&setTimeout((()=>{t.title=e}),100)},getAbsoluteHeight(e){var t=window.getComputedStyle(e),l=parseFloat(t.marginTop)+parseFloat(t.marginBottom);return Math.ceil(e.offsetHeight+l)}},mounted(){var e=this;e.$el.querySelector("form").addEventListener("submit",(t=>{t.preventDefault();var l=e.$parent;return l.refresh&&l.refresh(),!1})),e.setTitle(e.header)},updated(){for(var e=this.$el.querySelectorAll("[type=number]:not(._)"),t=0;t<e.length;t++){var l=()=>{var e=this,t=e.value;if(t){t=n(t),e.max&&t>n(e.max)&&(t=n(e.max)),e.min&&t<n(e.min)&&(t=n(e.min));var l=this.getAttribute("decimal");null!==l&&(t=t.toFixed(1*l)),e.value=t}};e[t].oninput=l,e[t].onblur=l,e[t].classList?e[t].classList.add("_"):e[t].className="_"}e=this.$el.querySelectorAll(".numeric:not(._)");for(t=0;t<e.length;t++)e[t].addEventListener("keyup",(e=>{86==e.keyCode&&isNaN(this.value)&&(this.value="")})),e[t].addEventListener("keydown",(e=>{console.log("eeeeeee"+e.keyCode),-1!==[46,8,9,27,13,110,88,86].indexOf(e.keyCode)||65===e.keyCode&&(!0===e.ctrlKey||!0===e.metaKey)||e.keyCode>=35&&e.keyCode<=40||(e.shiftKey||e.keyCode<48||e.keyCode>57)&&(e.keyCode<96||e.keyCode>105)&&e.preventDefault()})),e[t].classList?e[t].classList.add("_"):e[t].className="_"},__file:"src/v-form.vue"},script$i={name:"VGroup",props:{required:String,name:String},data:()=>({value:null,nam:null}),updated(){this.update2()},mounted(){this.update2()},created(){this.nam||(this.nam=this.$props.name?this.$props.name:"input_"+window._.id())},methods:{getInputs(e,t){var l=this;return e.children&&Array.from(e.children).forEach((e=>{"INPUT"==e.tagName?t.push(e):e.classList.contains("v-group")||l.getInputs(e,t)})),t},update2(){for(var e=this.getInputs(this.$el,[]),t=0;t<e.length;t++)e[t].value==this.$attrs.value?e[t].checked=!0:e[t].checked=!1},onChange(e){this.value=e,""===e&&(e=null),this.$emit("input",e)}}};const _hoisted_1$c={class:"v-group"};function render$f(e,t,l,o,r,a){return vue.openBlock(),vue.createElementBlock("div",_hoisted_1$c,[vue.renderSlot(e.$slots,"default")])}script$i.render=render$f,script$i.__file="src/v-group.vue";var script$h={name:"VLayerControl",data:()=>({loaded:null,map:null,district:null,dl:null}),setup({baseURL:e="https://web.regionancash.gob.pe"},{emit:t}){const l=vue.ref(),o=vue.inject("collector"),r=vue.ref(),a=vue.ref();let n,s;return o.push((o=>{(o=>{a.value=o;let i=new ol$1.Collection;l.value=i;let u=document.createElement("i");u.setAttribute("class","fa fa-expand"),o.addControl(new FullScreen({label:u,tipLabel:"Fullscreen"}));let c=new VectorSource({url:e+"/fs/geo/02.geojson",format:new GeoJSON}),d=r.value=new VectorLayer({source:c,style:e=>new style.Style({fill:new style.Fill({color:"rgba(255, 0, 0, 0.0)"}),stroke:new style.Stroke({color:"#4073CE",width:1}),text:new style.Text({text:e.values_.name?e.values_.name.toUpperCase():"",fill:new style.Fill({color:"#4073CE"}),stroke:new style.Stroke({color:"#4073CE",width:.5})})}),id:"provinces"});d.onChange=e=>{let t=e.feature;s!=t.getId()&&(i.clear(),i.push(t),e.preventDefault&&e.preventDefault(),s=t.getId(),n=t,o.getView().fit(t.getGeometry().getExtent(),{duration:200,callback:()=>{}}))};let p=c.on("change",(()=>{let e,t=c.getFeatures();for(let l=0;l<t.length;l++)if(1*t[l].id_==1*e){d.onChange({feature:t[l]});break}Observable.unByKey(p)})),v=new VectorLayer({preload:1/0,source:new VectorSource,id:"districts",style:e=>new style.Style({fill:new style.Fill({color:"rgba(16, 110, 138, 0.0)"}),stroke:new style.Stroke({color:"#194300",width:1}),text:new style.Text({text:e.values_.name?e.values_.name.toUpperCase():"",fill:new style.Fill({color:"#194300"}),stroke:new style.Stroke({color:"#194300",width:.5})})})});o.on("moveend",(()=>{if(n){if(n.id_<1e4){v.setSource(new VectorSource({url:e+"/fs/geo/"+n.id_+".geojson",format:new GeoJSON}));let t=v.getSource().on("change",(()=>{Observable.unByKey(t)}))}t("scope",{feature:n,target:{}}),n=null}})),d.onSelect=e=>{me.$emit("select",e)},o.addLayer(d),o.addLayer(new VectorLayer({id:"district",source:new VectorSource,style:new style.Style({fill:new style.Fill({color:"rgba(255, 150, 150, 0.0)"}),stroke:new style.Stroke({color:"#4073CE",width:1})})})),new style.Style({fill:new style.Fill({color:"rgba(16, 110, 138, 5.0)"})}),new style.Style({fill:new style.Fill({color:"rgba(255, 150, 150, 0.0)"})}),v.onChange=e=>{let t=e.feature;s!=t.getId()&&(2==i.getLength()&&i.pop(),i.push(t),e.preventDefault&&e.preventDefault(),s=t.getId(),n=t,o.getView().fit(t.getGeometry().getExtent(),{duration:300}))},v.onSelect=e=>{t("select",e)},o.addLayer(v),t("render",{map:o})})(o)})),{}}};function render$e(e,t,l,o,r,a){return vue.openBlock(),vue.createElementBlock("div",null,[vue.renderSlot(e.$slots,"default")])}script$h.render=render$e,script$h.__file="src/v-layer-control.vue";var script$g={name:"VMapControl",setup(e,{emit:t}){const{visible:l}=e,o=vue.ref(null),r=vue.ref(!!l),a=vue.inject("collector"),n=vue.ref(null);a.push((e=>{e.addControl(new Control({element:o.value})),n.value=!0}));const s=vue.ref();return{el:o,ready:n,visible0:r,enter:e=>{e.stopPropagation(),s.value?clearTimeout(s.value):t("click",e),s.value=setTimeout((()=>{s.value=null}),500)}}},props:{icon:String,visible:{default:1}},computed:{slotPassed(){return!!this.$slots.default}},data:()=>({slotUsed:!1}),updated(){var e=this.$el.querySelectorAll(":scope > :not(.v-map-control-button)").length;0==e&&(e=this.$el.textContent.trim().length),this.slotUsed=e},methods:{toggle(){this.visible0=!this.visible0}}};const _hoisted_1$b={ref:"el",class:"ol-unselectable ol-control"};function render$d(e,t,l,o,r,a){return vue.withDirectives((vue.openBlock(),vue.createElementBlock("div",_hoisted_1$b,[vue.renderSlot(e.$slots,"default"),r.slotUsed?vue.createCommentVNode("v-if",!0):(vue.openBlock(),vue.createElementBlock("button",{key:0,class:"v-map-control-button",onClick:t[0]||(t[0]=vue.withModifiers(((...e)=>o.enter&&o.enter(...e)),["prevent"]))},[l.icon?(vue.openBlock(),vue.createElementBlock("i",{key:0,class:vue.normalizeClass(["fa fa-xs",l.icon])},null,2)):vue.createCommentVNode("v-if",!0)]))],512)),[[vue.vShow,o.ready&&!0]])}script$g.render=render$d,script$g.__file="src/v-map-control.vue";class Drag extends PointerInteraction{constructor(){super({handleDownEvent:handleDownEvent,handleDragEvent:handleDragEvent,handleMoveEvent:handleMoveEvent,handleUpEvent:handleUpEvent}),this.layers_=[],this.coordinate_=null,this.listeners_=[],this.cursor_="pointer",this.feature_=null,this.previousCursor_=void 0}addLayers(e){e.forEach((e=>{this.layers_.push(e)}))}$on(e,t){this.listeners_.push(t)}}function handleDownEvent(e){const t=e.map,l=this.layers_,o=t.forEachFeatureAtPixel(e.pixel,(function(e,t){if(t&&l.indexOf(t)>-1)return[e,t]}));return o&&(this.coordinate_=e.coordinate,this.feature_=o[0]),!!o}function handleDragEvent(e){const t=e.coordinate[0]-this.coordinate_[0],l=e.coordinate[1]-this.coordinate_[1];this.feature_.getGeometry().translate(t,l),this.coordinate_[0]=e.coordinate[0],this.coordinate_[1]=e.coordinate[1]}function handleMoveEvent(e){if(this.cursor_){const t=e.map,l=this.layers_,o=t.forEachFeatureAtPixel(e.pixel,(function(e,t){if(t&&l.indexOf(t)>-1)return e})),r=e.map.getTargetElement();o?r.style.cursor!=this.cursor_&&(this.previousCursor_=r.style.cursor,r.style.cursor=this.cursor_):void 0!==this.previousCursor_&&(r.style.cursor=this.previousCursor_,this.previousCursor_=void 0)}}function handleUpEvent(){return this.listeners_.forEach((e=>{e({feature:this.feature,coordinate:this.coordinate_})})),this.coordinate_=null,this.feature_=null,!1}var script$f={name:"VMap",setup(e,{emit:t,expose:l}){const o=vue.ref(null),r=vue.ref(null),a=vue.ref(null),n=vue.ref(null),s=vue.reactive([]);vue.provide("collector",{remove(e){s.splice(s.indexOf(e),1)},push(e){s.push(e)}});const i=e=>{r.value.addLayer(e),t("addlayer",e)},u=(e,l)=>{let o,a;e=e||{};const n=r.value;e.lon&&e.lat?(a=[e.lon,e.lat],o=new geom.Point(a[0]>-100?proj.fromLonLat(a):a)):o=new geom.Point(n.getView().getCenter()),a=o.flatCoordinates;const s=a[0]<-1e4?proj.toLonLat(a):a;t("translateend",{lon:s[0],lat:s[1]}),e.geometry=o;const i=new Feature(e);i.data=e,"object"==typeof e.style?i.setStyle(e.style):i.setStyle(n.styleMap[e.style?e.style:"default"]),a=o.flatCoordinates,a=a[0]<-1e4?proj.toLonLat(a):a,t("translateend",{lon:a[0],lat:a[1]});const u=e.layer||"default";let c=n.getLayerById(u);if(c?c.getSource().addFeatures(i):n.addLayer(c=new VectorLayer({id:u,source:new VectorSource({features:new ol$1.Collection([i])})})),e.draggable){let e=n.drag;e||(n.drag=e=new Drag,e.$on("up",(({coordinate:e,feature:l})=>{const o=proj.toLonLat(e);t("translateend",{lon:o[0],lat:o[1],feature:l})})),n.addInteraction(e),e.addLayers([c]))}return l&&n.getView().animate(Object.assign({center:i.getGeometry().getCoordinates(),zoom:17,duration:500},l)),i},c=e=>{const l={default:new style.Style({image:new style.Circle({radius:8,stroke:new style.Stroke({color:"#8a0000",width:2}),fill:new style.Fill({color:"#ff0000"})})}),star:[new style.Style({image:new style.RegularShape({fill:new style.Fill({color:"#ff0000"}),stroke:new style.Stroke({color:"#8a0000",width:2}),points:5,radius:10,radius2:4,angle:0})})]};let o=((e,t)=>{t||(t=window.location.href);const l=new RegExp("[?&]"+e+"=([^&#]*)").exec(t);return l&&l[1]||0})("location"),i=-1;if(o){let e=o.split("/");o=[parseFloat(e[0]),parseFloat(e[1])],i=e[2],a.value=!0}else o=!1;const c=new Map({target:e,layers:[new layer.Tile({source:new source.OSM})],view:new View({center:[0,0],zoom:2})});c.getLayerById=function(e="default"){let t;return c.getLayers().forEach((l=>{l.get("id")!==e||(t=l)})),t},c.styleMap=l,a.value?(c.getView().setCenter(o),console.log("en el momento de cargar moved to pageLocation="+o),c.getView().setZoom(i||12),r.value=c,console.log("distarar evento buid pageLocation="+o),t("build",m)):(c.getView().fit([-8756221.995832639,-1207995.483261405,-8541070.763947014,-899052.0546471546],c.getSize()),r.value=c,t("build",{map:c}),s.forEach((e=>{e(c)}))),c.getView().getZoom(),c.on("moveend",(()=>{n.value&&(n.value(m),n.value=null),c.getView().getZoom()})),c.on("singleclick",(e=>{let t=c.forEachFeatureAtPixel(e.pixel,((e,t)=>{if(t)return[e,t]}));if(t){let l=t[1],o=t[0];if(e.feature=o,e.map=c,e.preventDefault(),l.onSelect)return void l.onSelect(e)}})),c.on("dblclick",(e=>{let l=c.forEachFeatureAtPixel(e.pixel,((e,t)=>{if(t)return[e,t]}));if(l){let o=l[1];if(l=l[0],e.feature=l,e.map=c,o.onChange)return void o.onChange(e);t("change",l),c.getView().animate({center:l.getGeometry().getCoordinates(),zoom:17,duration:500},(()=>{for(let t=0;t<m.$children.length;t++){let t=m.$children[0];t.open&&t.open(e)}}))}})),r.value=c,setTimeout((()=>{c.updateSize(),c.getView().fit([-8756221.995832639,-1207995.483261405,-8541070.763947014,-899052.0546471546],c.getSize()),r.value=c,t("build",{map:c,addFeature:u})}),100)};return vue.watch(o,(e=>{e&&vue.nextTick((()=>{t("beforeBuild"),c(e)}))})),l({addFeature:u,addLayer:i,map:r,empty:(e="default")=>{if(e=r.value.getLayerById(e)){const t=e.getSource();if(t instanceof VectorSource){return 0===t.getFeatures().length}}return!0}}),{el:o,addLayer:i,addFeature:u}},data:()=>({moved:!1,map:null,movingCompleted:null,styleMap:null,coordinate:{}})};const _hoisted_1$a={ref:"el"};function render$c(e,t,l,o,r,a){return vue.openBlock(),vue.createElementBlock("div",_hoisted_1$a,[vue.renderSlot(e.$slots,"default")],512)}script$f.render=render$c,script$f.__file="src/v-map.vue";var script$e={name:"VNumber",props:{value:Number,max:Number,min:Number,delay:Number},setup(e,t){const{emit:l}=t,o=vue.ref(null);vue.onMounted((()=>{o.value=e.value})),vue.onUpdated((()=>{o.value=t.attrs.modelValue}));return{v:o,handleInput:t=>{let r=o.value;const a=t.target.getAttribute("decimal");null!==r?(r=num(r),e.max&&r>num(e.max)&&(r=num(e.max)),e.min&&r<num(e.min)&&(r=num(e.min)),null!==a&&(r=r.toFixed(Number(a)))):r=null,o.value=t.target.value;let n=_$1.calendarTimer;n&&clearTimeout(n),e.delay?_$1.calendarTimer=setTimeout((()=>{l("input",r),_$1.calendarTimer=null}),13===t.keyCode?0:e.delay):l("input",r)}}}};function render$b(e,t,l,o,r,a){return vue.withDirectives((vue.openBlock(),vue.createElementBlock("input",{type:"number",onKeyup:t[0]||(t[0]=vue.withKeys(((...e)=>o.handleInput&&o.handleInput(...e)),["enter"])),"onUpdate:modelValue":t[1]||(t[1]=e=>o.v=e),onInput:t[2]||(t[2]=(...e)=>o.handleInput&&o.handleInput(...e)),class:"_"},null,544)),[[vue.vModelText,o.v,void 0,{number:!0}]])}script$e.render=render$b,script$e.__file="src/v-number.vue";var script$d={setup(e,t){const l=e,{valueField:o,displayField:r,store:a,filter:n,name:s}=l,{expose:i,emit:u}=t,c=vue.ref([]),d=vue.ref([]),p=vue.ref([]);vue.ref(null);const v=vue.inject("collect");o&&(p.value=o.split("."));const m=vue.computed((()=>{const e=(l.data||[]).concat(d.value||[]);return n?e.filter((e=>-1!==JSON.stringify(e).toLowerCase().indexOf(n.toLowerCase()))):e}));vue.watch(m,(e=>{}));const h=(e,t)=>{const l=p.value;if(l&&l.length)for(let t=0;t<l.length;t++)e&&(e=e[l[t]]);else e&&!t&&(e=e.id?e.id:e.code?e.code:e);return e};let f=o,g=r;g||(g=f);const y=async(e=null,t=null,l=!1)=>{if(!l&&t&&e&&c.value.push([e,t]),!(c.value.length>1)){if(d.value=[],a){let t=await getStoredList(a);const[l]=e?Object.keys(e):[];if(l){let o;try{const r=t.filter((t=>(o=t,o[l].startsWith(e[l]))));d.value=r}catch(e){log(s,"options.error trying to filter ",o),console.error(e)}}else d.value=d.value.concat(t)}for(v(m),l||c.value.shift();c.value.length;){const e=c.value.shift()||[];await y(e[0],e[1],!0)}}};return y.getObjectByIndex=e=>{const t=m.value;return t?t[e]:null},y.getValueByIndex=e=>{const t=m.value;return t?h(t[e],1):null},y.getIndexByValue=(e,t)=>{e&&e.id?e=e.id:e&&e.code&&(e=e.code);for(let l=0;l<m.value.length;l++){const o=m.value[l];if(h(o)==e)return t&&t(l,o),l}return t&&t(-1),-1},v.push(y),vue.onUpdated((()=>{v((l.data||[]).concat(d.value))})),vue.onUnmounted((()=>{v.remove(y)})),i({load:y}),()=>m.value.map((e=>{const t=g?e[g]:e;return f?vue.h("option",{value:h(e)},t):vue.h("option",{value:e.id||e.code||JSON.stringify(e)},t)}))},name:"VOptions",props:{url:String,src:String,name:String,displayField:String,data:Array,store:null,valueField:String,filters:null,filter:null,mode:null},updated(){let e=this;!e.loaded&&e.data&&(e.data2=e.data)},methods:{getParentE(){return this.$el.parentElement.parentElement},getSelectedItem(){let e=this.$el.parentElement;return this.filterList[e.selectedIndex-1]}},__file:"src/v-options.vue"},ol=window.ol,_=window._,axios$1=window.axios,script$c={name:"VOverlay",props:{value:{value:Object},src:String,width:{default:400},header:String},data:()=>({coordinate:null,overlay:null,location:null,ele:null,c:0}),created(){var e=this;e.$parent.$on("beforeBuild",(t=>{console.log(t),e.overlay=new ol.Overlay({element:e.$el,positioning:"bottom-right"})})),e.$parent.$on("build",(t=>{t.map.addOverlay(e.overlay)}))},mounted(){var e=this;e.header&&e.$el.childNodes[0].addEventListener("mousedown",(function(t){const l=e.$el.parentElement;var o=window.getComputedStyle(l),r=parseFloat(o.left),a=parseFloat(o.top),n=t.clientX,s=t.clientY,i=l.parentElement;function u(e){l.style.left=r+e.clientX-n+"px",l.style.top=a+e.clientY-s+"px"}i.addEventListener("mousemove",u,!1),i.addEventListener("mouseup",(function(){i.removeEventListener("mousemove",u,!1)}),!1)}),!1)},methods:{close(){this.overlay&&this.overlay.setPosition()},hasSlot(e="default"){return!!this.$slots[e]||!!this.$scopedSlots[e]},load(){var e=this;axios$1.get(_.remoteServer+e.src).then((t=>{e.$emit("input",t.data)}))},open(e){for(var t=this,l=e.map,o=e.feature,r=t.overlay,a=r.element,n=t.$parent.$children,s=0;s<n.length;s++)n[s].close&&(n[s].$el.style.opacity=0,n[s].close());e.coordinate?t.coordinate=e.coordinate:(e.coordinate=l.getView().getCenter(),t.coordinate=null),r.setPosition(e.coordinate);var i=l.getView().getCenter(),u=l.getView().getResolution(),c=o?o.getGeometry().getCoordinates():[null],d=l.getPixelFromCoordinate(Number(c[0])?c:e.coordinate);if(this.src)axios$1.get(_.remoteServer+this.src).then((e=>{t.$emit("input",e.data),t.c++,setTimeout((function(){var e=l.viewport_.offsetWidth,o=l.viewport_.offsetHeight,n=a.children[0].children[1];n.scrollTop=0;var s=a.offsetHeight;n.style.height=s+100>=o?o-100-a.children[0].children[0].offsetHeight+"px":"300px",s=a.offsetHeight;var c=1*t.width,p=e<=c+40?e-40:c;if(a.style.zIndex=10,a.style.width=p+"px",p/=2,l.getView().animate({center:[i[0]+(d[0]+p+20>=e?+(d[0]+p+20-e):d[0]-20-p<0?-p+d[0]-20:0)*u,i[1]+(d[1]<s?s-d[1]:0)*u],duration:500}),d[0]=d[0]+p-0,d[1]=d[1]-12,r.setPosition(l.getCoordinateFromPixel(d)),t.$el.style.opacity=1,_.mobil)for(var v=r.getElement().querySelectorAll("a:not(._)"),m=0;m<v.length;m++)v[m].addEventListener("click",_.open2)}),400)})).catch((e=>{console.log(e)}));else{var p=l.viewport_.offsetWidth,v=l.viewport_.offsetHeight,m=a.children[0].children[1];m.scrollTop=0;var h=a.offsetHeight;console.log(a.offsetHeight),m.style.height=h+100>=v?v-100-a.children[0].children[0].offsetHeight+"px":"300px",h=a.offsetHeight;var f=1*t.width,g=p<=f+40?p-40:f;if(a.style.zIndex=10,a.style.width=g+"px",g/=2,l.getView().animate({center:[i[0]+(d[0]+g+20>=p?+(d[0]+g+20-p):d[0]-20-g<0?-g+d[0]-20:0)*u,i[1]+(d[1]<h?h-d[1]:0)*u],duration:500}),d[0]=d[0]+g-0,d[1]=d[1]-12,r.setPosition(l.getCoordinateFromPixel(d)),t.$el.parentNode.style.opacity=0,t.$el.style.opacity=1,t.$el.parentNode.style.top=(v-t.$el.offsetHeight)/2+"px",t.$el.parentNode.style.opacity=1,_.mobil){var y=r.getElement().querySelectorAll("a:not(._)");for(s=0;s<y.length;s++)y[s].addEventListener("click",_.open2)}t.$emit("opened",{target:t})}}}};const _hoisted_1$9={class:"v-ol-overlay"},_hoisted_2$6={key:0,class:"v-panel-titlebar"},_hoisted_3$3={key:2,style:{"text-align":"center"}};function render$a(e,t,l,o,r,a){return vue.openBlock(),vue.createElementBlock("div",_hoisted_1$9,[l.header?(vue.openBlock(),vue.createElementBlock("div",_hoisted_2$6,[vue.createElementVNode("span",{class:"v-icon v-icon-close",onClick:t[0]||(t[0]=(...e)=>a.close&&a.close(...e))},t[1]||(t[1]=[vue.createElementVNode("i",{class:"fa fa-times"},null,-1)])),vue.createTextVNode(vue.toDisplayString(l.header),1)])):vue.createCommentVNode("v-if",!0),(vue.openBlock(),vue.createElementBlock("div",{class:"v-ol-body",key:"c-"+r.c,style:{padding:"10px"}},[l.value?vue.renderSlot(e.$slots,"default",{key:0,value:l.value}):vue.createCommentVNode("v-if",!0)])),a.hasSlot("footer")&&l.value?(vue.openBlock(),vue.createElementBlock("footer",{key:"f-"+r.c},[vue.renderSlot(e.$slots,"footer",{value:l.value})])):vue.createCommentVNode("v-if",!0),r.coordinate?(vue.openBlock(),vue.createElementBlock("div",_hoisted_3$3,t[2]||(t[2]=[vue.createElementVNode("img",{src:_imports_0,width:"20",height:"18"},null,-1)]))):vue.createCommentVNode("v-if",!0)])}script$c.render=render$a,script$c.__file="src/v-overlay.vue";var script$b={name:"VPanel",props:{header:String}};const _hoisted_1$8={class:"ui-panel"},_hoisted_2$5={key:0,class:"v-panel-titlebar v-widget-header ui-helper-clearfix ui-corner-all"},_hoisted_3$2={class:"v-panel-title"},_hoisted_4$1={class:"v-panel-content v-dialog-content v-widget-content"};function render$9(e,t,l,o,r,a){return vue.openBlock(),vue.createElementBlock("div",_hoisted_1$8,[l.header?(vue.openBlock(),vue.createElementBlock("div",_hoisted_2$5,[vue.createElementVNode("span",_hoisted_3$2,vue.toDisplayString(l.header),1)])):vue.createCommentVNode("v-if",!0),vue.createElementVNode("div",_hoisted_4$1,[vue.renderSlot(e.$slots,"default")])])}script$b.render=render$9,script$b.__file="src/v-panel.vue";var script$a={name:"VPopup",data:()=>({show:null,overlay:null}),mounted(){var e=this;e.$el.addEventListener("close",(function(){e.hide()}))},destroyed(){var e=this.overlay;e&&(e.style.visibility="hidden",e.style.opacity=0,e.remove(),e=null)},methods:{hide(){var e=this.overlay;e&&(e.style.visibility="hidden",e.style.opacity=0),this.show=0},toggle(){var e=this;e.show=!e.show;var t=e.overlay;if(e.show){var l=document.querySelector(".v-layout-north");e.$el.style.top=l.offsetHeight+"px",console.log(e.$el),t||((t=document.createElement("div")).classList.add("v-overlay"),t.style.padding="40px",t.addEventListener("click",(function(){t.style.visibility="hidden",t.style.opacity=0,e.show=!1})),document.body.appendChild(e.overlay=t)),t.style.visibility="unset",t.style.opacity="unset"}else this.hide()}}};const _hoisted_1$7={class:"v-popup",style:{position:"absolute"}};function render$8(e,t,l,o,r,a){return vue.withDirectives((vue.openBlock(),vue.createElementBlock("div",_hoisted_1$7,[vue.renderSlot(e.$slots,"default")],512)),[[vue.vShow,r.show]])}script$a.render=render$8,script$a.__file="src/v-popup.vue";var script$9={name:"VRadio",props:{value:String,label:String,className:String},methods:{getClass(){return"v-radio "+this.className}},mounted(){var e=this,t=e.$el.querySelector("input");e.$parent&&e.$parent.nam&&(t.name=e.$parent.nam),t.onclick=function(){}},updated(){this.$el.querySelector("input")}};const _hoisted_1$6=["value"];function render$7(e,t,l,o,r,a){return vue.openBlock(),vue.createElementBlock("label",{class:vue.normalizeClass(a.getClass())},[vue.createTextVNode(vue.toDisplayString(l.label?l.label:l.value)+" ",1),vue.createElementVNode("input",{type:"radio",value:l.value},null,8,_hoisted_1$6),t[0]||(t[0]=vue.createElementVNode("span",{class:"checkmark"},null,-1)),vue.renderSlot(e.$slots,"default")],2)}script$9.render=render$7,script$9.__file="src/v-radio.vue";var script$8={__name:"v-radio-group",props:{required:String,name:String,modelValue:String,items:{type:Array},type:{type:String,default:"radio"},label:{type:String,default:""}},emits:["update:modelValue"],setup(e,{emit:t}){const l=e,o=t,r=vue.ref(l.modelValue),{proxy:a}=vue.getCurrentInstance(),n=new Set,s=(e,t)=>(e.children&&Array.from(e.children).forEach((e=>{"INPUT"===e.tagName?t.push(e):e.classList&&e.classList.contains("v-group")||s(e,t)})),t),i=()=>{const e=s(a.$el,[]);let t=l.name;t||(t="input_"+Date.now().toString(36)+Math.random().toString(36).substring(2,15));const o=""===a.$props.required||a.$props.required;let i=!1;for(let l=0;l<e.length;l++)e[l].name=t,n.has(e[l])||(e[l].addEventListener("change",u),n.add(e[l])),e[l].checked=e[l].value===r.value,e[l].checked&&(i=!0),e[l].required=o,o&&(r.value?e[l].nextElementSibling.classList.remove("required"):e[l].nextElementSibling.classList.add("required"));i&&removeError(e[0].parentNode.parentNode)},u=e=>{let t=e.target.value;""===t&&(t=null),r.value=t,o("update:modelValue",t)};vue.watch((()=>l.modelValue),(e=>{r.value=e,i()})),vue.onMounted((()=>{i()})),vue.onUpdated((()=>{i()}));const c=()=>{const e=[];return a.$slots.default&&e.push(...a.$slots.default()),l.items&&e.push(...l.items.map((e=>vue.h(script$9,{className:l.required&&!l.modelValue?"required":null,...e,modelValue:r.value,"onUpdate:modelValue":u})))),vue.h("div",{class:"v-radio-group"},[l.label&&vue.h("label",l.label),...e])};return(e,t)=>(vue.openBlock(),vue.createBlock(c))},__file:"src/v-radio-group.vue"},script$7={name:"VSelect",setup(e,t){const{slots:l,emit:o}=t,{valueField:r,disabled:a,readonly:n,autoload:s,name:i}=e,u=vue.ref([]),c=vue.ref([]),d=vue.ref(null),p=vue.ref([]),v=[],m=vue.ref(!(s+""=="false"||1*s==0)),h=vue.ref(null),f=t=>{u.value=t,vue.nextTick((()=>{g(e.modelValue||d.value)}))},g=t=>{let l=t||e.modelValue;if(h.value){let t=h.value,r=t.selectedIndex;l&&""!==l||(t.selectedIndex=0),log(i,"value===",l);const a=l?""+(l.id||l.code||l):l;for(let e=0;e<t.length;e++)t[e].value===a&&(t.selectedIndex=e);const n=v;for(let a=0;a<n.length;a++){if(!n[a].getValueByIndex)continue;let s=n[a].getValueByIndex(r-1);n[a].getIndexByValue(l,((r,c)=>{if(r>-1){let c=n[a].getObjectByIndex(r),p=Number(s);p=isNaN(p)?s?!!l&&(l.id?l.id==s.id:l==s):!l:p==Number(l),d.value!=e.modelValue&&(log(i,"select.value",l,"object=",c),e.modelValue&&(d.value=e.modelValue),p||(log(i,"select.updateSelect="+l+" "+JSON.stringify(u.value.length)),t.selectedIndex=r+1,o("update:modelValue",l,{value:l,select:t,object:c}),vue.nextTick((()=>{o("input",l,{value:l,select:t,object:c})}))))}else e.modelValue&&(d.value=e.modelValue),log(i,"select.updateselect.not fout",r),o("update:modelValue",null,null),vue.nextTick((()=>{o("input",null,{value:null})})),t.selectedIndex=0}))}}};f.remove=e=>{const t=v.filter((t=>t!==e));v.length=0,t.forEach((e=>v.push(e)))},f.push=e=>{v.push(e)},r&&(c.value=r.split(".")),vue.provide("collect",f);vue.watch((()=>e.modelValue),((e,t)=>{e!=t&&g()})),vue.watch((()=>e.disabled),((e,t)=>{y(e,t)}));const y=(e,t)=>{e=!!e,t=!!t;let l=p.value;log(i,"activate.newVal=",e,"oldVal=",t),!e&&!e===t&&l.length&&$(l[0],l[1])},$=(t,l)=>{e.disabled?(log(i,"select.load.params=",t),p.value=[t,l],v.forEach((e=>{e(t,l)}))):(p.value=[],v.forEach((e=>{e(t,l)})))};return vue.onMounted((()=>{m.value&&$()})),{options:u,getValueField:(e,t)=>{const l=c.value;if(l&&l.length)for(let t=0;t<l.length;t++)e&&(e=e[l[t]]);else e&&!t&&(e=e.id?e.id:e.code?e.code:e);return e},onChange:e=>{e.stopPropagation();let t=e.target.value;const l=h.value;log(i,"select.onchange=",t),t&&""!==t||(t=null,l.selectedIndex=0);let r,a=0;const n=u.value;for(let e=0;e<v.length;e++){if(a=v[e].getValueByIndex(l.selectedIndex-1),-1!=a){r=v[e].getObjectByIndex(l.selectedIndex-1);break}a=0}a?(log(i,"change=found=",a),t=a):n.length&&(l.selectedIndex=0),o("update:modelValue",t,{value:t,select:l,object:r}),vue.nextTick((()=>{o("input",t,{value:t,select:l,object:r})}))},selectRef:h,load:$,lastLoad:p,autoload_:m}},props:{modelValue:null,required:null,readonly:null,multiple:null,label:null,name:null,disabled:null,autoload:null,valueField:null},data:()=>({autoload_:!0,ik:0,data:[],popup:null,show:!1,sel:[],sela:null,tmp:[],sel2:[]}),watch:{show(e){let t=this;if(e){let e=this.$refs.button,l=this.popup;l||(l=this.$refs.popup,l.style.position="absolute",document.body.append(l));let o=e.getBoundingClientRect();const r=l.children[0];window.innerWidth<400?(l.style.padding="40px",l.style.height="100%",r.style.height="100%"):(l.style.top=o.bottom+0+"px",l.style.left=o.left+0+"px",l.style.maxHeight=window.innerHeight-o.bottom-30+"px",r.style.maxHeight=l.style.maxHeight),r.style.display="flex",r.style.flexDirection="column",t.tmp=t.sel.sort().join(",")}else{let e=t.sel;"TH"!=t.$el.parentNode.tagName&&e&&e.length?e=e.join(","):e&&0==e.length&&(e=null),t.tmp!==t.sel.sort().join(",")&&t.$parent.load&&t.$parent.load()}}}};const _hoisted_1$5={class:"v-select",style:{position:"relative"}},_hoisted_2$4=["required","disabled","click"],_hoisted_3$1={style:{border:"1px solid lightgray","background-color":"white",padding:"5px"}},_hoisted_4={class:"_ ui-widget ui-state-default ui-corner-all",style:{padding:"3px 3px 1px 3px","margin-bottom":"5px"}},_hoisted_5={class:"center",style:{"padding-top":"4px"}};function render$6(e,t,l,o,r,a){const n=vue.resolveComponent("v-checkbox"),s=vue.resolveComponent("v-checkbox-group"),i=vue.resolveComponent("v-button");return vue.openBlock(),vue.createElementBlock("div",_hoisted_1$5,[l.readonly?vue.createCommentVNode("v-if",!0):vue.withDirectives((vue.openBlock(),vue.createElementBlock("select",{key:0,style:{width:"100%"},ref:"selectRef",onChange:t[0]||(t[0]=(...e)=>o.onChange&&o.onChange(...e)),required:l.required,disabled:l.disabled,click:e.expand},[vue.renderSlot(e.$slots,"default")],40,_hoisted_2$4)),[[vue.vShow,!l.multiple]]),l.multiple?(vue.openBlock(),vue.createElementBlock(vue.Fragment,{key:1},[vue.createElementVNode("div",{class:vue.normalizeClass(["v-widget-header",{"v-selected":r.show}]),ref:"button",style:{"padding-top":"3px","padding-bottom":"3px"},onClick:t[1]||(t[1]=(...t)=>e.toggle&&e.toggle(...t))},"   ",2),vue.withDirectives(vue.createElementVNode("div",{ref:"popup",onClick:t[4]||(t[4]=(...t)=>e.close&&e.close(...t)),style:{"background-color":"#0000009c"}},[vue.createElementVNode("div",_hoisted_3$1,[vue.createElementVNode("div",_hoisted_4,[vue.createVNode(n,{modelValue:r.sela,"onUpdate:modelValue":t[2]||(t[2]=e=>r.sela=e),onInput:e.selectAll},null,8,["modelValue","onInput"])]),(vue.openBlock(),vue.createBlock(s,{class:"v-select-checkbox-group",style:{"overflow-y":"auto"},key:"p"+r.ik,modelValue:r.sel,"onUpdate:modelValue":t[3]||(t[3]=e=>r.sel=e),onInput:e.checkboxInput},{default:vue.withCtx((()=>[r.data.length?(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,{key:0},vue.renderList(r.data,(e=>(vue.openBlock(),vue.createElementBlock("div",null,[vue.createVNode(n,{value:e.value,label:e.label},null,8,["value","label"])])))),256)):vue.createCommentVNode("v-if",!0)])),_:1},8,["modelValue","onInput"])),vue.createElementVNode("div",_hoisted_5,[vue.createVNode(i,{icon:"fa-sync",value:"Filtrar"})])])],512),[[vue.vShow,r.show]])],64)):vue.createCommentVNode("v-if",!0),l.readonly?(vue.openBlock(),vue.createElementBlock(vue.Fragment,{key:2},[vue.createTextVNode(vue.toDisplayString(l.label?l.label:"---"),1)],64)):vue.createCommentVNode("v-if",!0)])}script$7.render=render$6,script$7.__file="src/v-select.vue";var script$6={name:"VSwitch",props:{value:{value:Object}},data:()=>({options:["NO","SI"],selected:null}),mounted(){var e=this,t=""+e.value;e.selected="true"===t?"SI":"false"===t?"NO":null,e.$emit("input",e.value)},updated(){var e=this,t=""+e.value;e.selected="true"===t?"SI":"false"===t?"NO":null,e.$emit("input",e.value)},methods:{onChange(e){this.selected=e,this.$emit("input","SI"===e||"NO"!==e&&null)}}};const _hoisted_1$4=["value","data-value"],_hoisted_2$3=["onClick"];function render$5(e,t,l,o,r,a){return vue.openBlock(),vue.createElementBlock("div",{value:!1===l.value?"false":l.value,"data-value":""+l.value},[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(r.options,(e=>(vue.openBlock(),vue.createElementBlock("div",{onClick:t=>a.onChange(e),style:vue.normalizeStyle("cursor:pointer;border: 1px solid #000;text-align:center;display:inline-block;width:calc(50% - 2px)"+(e===r.selected?"":";opacity: 0.5")),class:vue.normalizeClass({"v-selected":e==r.selected})},vue.toDisplayString(e),15,_hoisted_2$3)))),256))],8,_hoisted_1$4)}script$6.render=render$5,script$6.__file="src/v-switch.vue";var script$5={name:"VTable",setup(e,t){const{autoload:l,src:o,rowKey:r,store:a,groups:n}=e,s=useAppStore(),i=vue.inject("viewCollector"),u=vue.inject("formCollector"),c=vue.ref(1),d=vue.ref(0),p=vue.ref(null),v=vue.ref(1),m=vue.ref([]),h=vue.ref([]),f=vue.ref(null),g=vue.ref(1),y=vue.computed((()=>{const t=e,l=h.value;let o,r;return l.sum=sum,l.filter((e=>{for(var l in t.filters)if(o=t.filters[l],"function"==typeof o){if(!o(e))return 0}else if(o&&"string"==typeof o&&l in e&&(r=e[l],"string"==typeof r&&(r=r.toUpperCase().normalize("NFD").replace(/[\u0300-\u036f]/g,""),!r.includes(o.toUpperCase()))))return 0;return 1}))})),$=vue.computed((()=>{let e=y.value;return e=f?e.sort(((e,t)=>{t=(t=t[f])||0,e=e[f];const l=Number(e);return l&&(e=l),e<t?-1*g:e>t?1*g:0})):e,e.sum=sum,e})),b=vue.computed((()=>{const e=function(e){return this.reduce(((t,l)=>"number"==typeof e||"string"==typeof e?t+(l[e]||0):t),0)};Array.prototype.sum=e;const t={},l=n;return l?$.value.forEach((o=>{const r=o[l];if(!t[r]){const l=[];l.sum=e,t[r]=l}t[r].push(o)})):$.value.length&&(t[""]=$),Object.entries(t).map((([e,t])=>({name:e,values:t})))})),w=vue.ref(1),k=vue.ref(1),{slots:_,expose:x,emit:S}=t,E=vue.getCurrentInstance(),C=async()=>{if(null!=a){let e;db&&(e=await getStoredList(a)),e||(e=[]),h.value=h.value?e.concat(h.value):e}return h.value},V=(e,t,l)=>{-10===t?y.value.length===m.value.length?m.value=[]:m.value=y.value.map((e=>e)):l?c.value||!m.value.includes(e)?m.value=[e]:(m.value=[],e=null):m.value.includes(e)?(m.value.splice(m.value.indexOf(e),1),e=null):m.value.push(e),S("row-select",{target:this,current:e,selection:m})},N=e=>m.value.includes(e),B=t=>{const l=[];return e.selectable&&N(t)&&l.push("v-selected"),e.rowStyleClass&&("string"==typeof e.rowStyleClass?l.push(e.rowStyleClass):e.rowStyleClass&&l.push(e.rowStyleClass(t))),l},I=(e,t)=>{L(e,t)},L=(e,t)=>{(w.value!=e||t)&&(w.value=e,q())};let T=""+e.selectable;c.value="false"!=T&&"0"!=T?1:0,T=""+e.scrollable,d.value=e.scrollable&&"false"!=T&&"0"!=T?1:0;const q=()=>{const t=e;if(m.value=[],t.value&&(h.value=t.value),o){let e=o;if(!e)return;e.endsWith("/")&&(e=e.slice(0,e.length-1));const l=t.pagination;if(l&&(e+="/"+(w.value-1)*l+"/"+l),networkStatus.connected){let r;if(t.gql){const e=t.gql,a="query{"+Object.keys(e)[0]+"(offset:"+(w.value-1)*l+" limit:"+l+"){\ndata{"+e[Object.keys(e)[0]]+"}\nsize\n}\n}";r=s.axios.post(o,{query:a})}else r=s.axios.get(e,{params:clean(t.filters)});r.then((e=>{if(e.data&&e.data.error)MsgBox(e.data.error);else{let o=e.data;t.gql&&(o=e.data.data[Object.keys(t.gql)[0]]),h.value=o.data||o,o&&o.hasOwnProperty("size")&&l&&(k.value=Math.ceil(o.size/l),w.value>k.value&&(w.value=1),t.size=o.size),C(),S("loaded",{target:t}),S("row-select",{}),t.remoteLoaded=1,t.loaded=1,v.value++}})).catch(t.error)}else{h.value=[];const e=C();e.then&&e.then((e=>{h.value=e})),S("row-select",{target:t})}}else C().then((()=>S("loaded",{target:t})));v.value++,t.loaded=1},F=vue.computed((()=>m.value.length));q.rowSelectedCount=F,q.src=o,q.getForm=u.get,q.rowKey=r,q.rowSelect=V;const A=e=>p.value===e;q.is=A,q.remove=e=>{console.log(e,h.value);const t=h.value.findIndex((t=>t===e));-1!==t&&h.value.splice(t,1)},q.selected=m,q.type="v-table",i.push(q);const D=e=>{13===e.keyCode&&(e.preventDefault(),q())};return vue.onMounted((()=>{!0===l&&q(),setTimeout((()=>{const e=E.proxy,t=e.$el.querySelectorAll(".v-cloned-header div > span"),l=Math.max(...Array.from(t).map((e=>e.offsetHeight)));t.forEach((e=>{e.style.height=l+"px"}));e.$el.querySelectorAll("v-filter").forEach((e=>{console.log(e.querySelectorAll("input").forEach((e=>e.addEventListener("keyup",D))))}))}),100)})),vue.onUnmounted((()=>{i.remove(q)})),x({load:q,rowSelectedCount:F,j_is:A}),()=>{let t=0;const l=_.default({row:{}}),o=[];l.forEach(((e,l)=>{const r=e.props;e.children&&"function"==typeof e.children.filter&&(e.children.filter((e=>"v-filter"==e.type)).forEach((t=>{r.filter=t,e.children.shift()})),e.children.filter((e=>"v-footer"==e.type)).forEach((t=>{r.footer=t,e.children.shift()}))),t+=r.width?Number(r.width):0,o.push({filter:r.filter,header:r.header,width:r.width})})),t+=c.value?42:0;const r=vue.h("div",{className:"v-datatable-scrollable-header-box",style:"left: 0px;"},vue.h("table",{className:"v-cloned-header v-table",style:{width:`${t}px`}},[c.value?vue.h("th",{width:42},[vue.h("span",{onclick(){V(null,-10)},className:"v-check"},vue.h(vueFontawesome.FontAwesomeIcon,{icon:m.value.length?freeRegularSvgIcons.faSquareCheck:freeRegularSvgIcons.faSquare,class:"fa-lg"}))]):null,o.map((e=>vue.h("th",e,vue.h("div",[vue.h("span",{style:"display: flex;justify-content: center;align-items: center;"},[e.header]),vue.h("v-filter",e.filter?.children)]))))]));return vue.h("div",{ref:p,className:"v-datatable "+e.class},[_.header?vue.h("div",{className:"v-datatable-header v-widget-header ui-corner-top"},_.header()):null,e.pagination?vue.h("div",{className:"v-paginator v-paginator-top v-widget-header v-paginator-pages center"},[vue.h(script$p,{value:"|<",disabled:w.value<=1,onClick:()=>I(1)}),vue.h(script$p,{value:"<",disabled:w.value<=1,onClick:()=>I(w.value-1)}),vue.h("div",{style:"padding:3px 8px;display:inline-block"},[vue.h("input",{type:"number",style:"width:60px",value:w.value,onInput:e=>I(Number(e.target.value),!0)}),"/"+k.value]),vue.h(script$p,{value:">",disabled:w.value==k.value,onClick:()=>I(w.value+1)}),vue.h(script$p,{value:">|",disabled:w.value==k.value,onClick:()=>I(k.value)})]):null,vue.h("div",{className:"v-widget-header v-datatable-scrollable-header",style:"position: relative; margin-right: 0px;"},r),vue.h("div",{className:"v-datatable-scrollable-body",style:"overflow-y: auto; flex:1",onScroll(e){const t=e.currentTarget.scrollLeft;r.el.style.transform="translateX(-"+t+"px)"}},[vue.h("table",{className:"v-table",style:{width:`${t}px`}},[vue.h("tbody",{className:"v-datatable-data",key:v.value},b.value.length<1?vue.h("td",{colspan:o.length+(c.value?1:0)},e.emptyMessage):[b.value.map((e=>[_["header-group"]?vue.h("tr",{className:"v-header-group"},[c.value?vue.h("td"):null,_["header-group"]({group:e})]):null,(e.values.value||e.values).map(((e,t)=>{const l=_.default({row:e,index:t});return l.forEach(((e,t)=>{e.children&&"function"==typeof e.children.filter&&(e.children.filter((e=>"v-filter"==e.type)).forEach((t=>{e.children.shift()})),e.children.filter((e=>"v-footer"==e.type)).forEach((t=>{e.children.shift()})))})),vue.h("tr",{className:B(e),onclick(l){((e,t,l)=>{c.value&&0==whichChild(e.target)||V(t,l,1)})(l,e,t)}},[c.value?vue.h("td",{className:"center"},vue.h("span",{onclick(){V(e,t)},className:"v-check"},vue.h(vueFontawesome.FontAwesomeIcon,{icon:N(e)?freeRegularSvgIcons.faSquareCheck:freeRegularSvgIcons.faSquare,class:"fa-lg"}))):null,...l])})),_["footer-group"]?vue.h("tr",{className:"v-footer-group"},[c.value?vue.h("td"):null,_["footer-group"]({group:e})]):null,_["extra-group"]?_["extra-group"]({group:e,groups:b.value}):null]))])])])])}},props:{class:null,value:Array,filterKey:String,reflow:null,summary:null,src:String,gql:null,filters:Object,store:null,width:null,emptyMessage:{default:"No existen registros"},groups:{default:""},rowKey:{default:"id"},rowStyleClass:null,pagination:null,selectable:{default:!0},scrollable:null,autoload:{default:!0}},data:()=>({resizeAfterUpddate:0,active:0,keyBody:1,row:{},kt:0,size:null,sortKey:"",paginatio_:0,remoteLoaded:null,loaded:!1,sortOrders:{},rowStyleClassFunc:null}),created(){const me=this;me.$parent.tabs||(me.active=1),me.paginatio_=me.pagination?me.pagination:0,me.rowStyleClass&&eval("me.rowStyleClassFunc=function(row){return "+me.rowStyleClass+"}")},beforeUpdate(){var e=this;e.active&&e.value&&null==e.remoteLoaded&&(e.data=e.value)},filters:{capitalize:e=>e?e.charAt(0).toUpperCase()+e.slice(1):e},methods:{hasSlot(e){return!!this.$slots[e]},sortBy(){},filter(){alert(12)}},__file:"src/v-table.vue"},script$4={name:"VTabview",data:()=>({tabs:[],height:0,currentTabIndex:0,k:0}),methods:{load(e){var t=new Event("command",{bubbles:!1});t.name="refresh",t.target=this.$el,this.$el.children[1+this.currentTabIndex].dispatchEvent(t)},reset(){this.load(this.k++)}},watch:{currentTabIndex(e){var t=this,l=t.$el.children[e+1];if(t.$children[e+1],l){var o=new Event("tabChange",{bubbles:!1});o.$target=t,l.dispatchEvent(o),t.$el.style.height=t.height+"px",(o=new Event("parentResize",{bubbles:!1})).height=t.$el.offsetHeight-25,l.style.height=o.height+"px",setTimeout((()=>{l.dispatchEvent(o)}),2)}}},updated(){for(var e=this.$el.children,t=1;t<e.length;t++)e[t].tagName&&(t-1===this.currentTabIndex&&(e[t].style.display="flex",e[t].style.flex="1",e[t].style.flexDirection="column"),t-1===this.currentTabIndex?e[t].classList.remove("hide"):(e[t].style.display="none",e[t].classList.add("hide"))),console.log(e[t])},mounted(){for(var e=this,t=e.$el.children,l=1;l<t.length;l++)t[l].style.display="none",e.tabs.push({title:""+t[l].getAttribute("tab")});e.$el.addEventListener("parentResize",(l=>{e.$el.style.height=l.height+1+"px",e.height=l.height+1;var o=new Event("parentResize",{bubbles:!1});o.height=e.$el.offsetHeight-25,o.target=e.$el,o.$target=e;for(var r=1;r<t.length;r++)"none"!=t[r].style.display&&(console.log("Se envia el alto "+o.height),t[r].style.height=o.height+"px",t[r].dispatchEvent(o));e.$emit("resize",o)})),t[1+e.currentTabIndex].setAttribute("active",1);var o=new Event("tabChange",{bubbles:!1});o.$target=e,t[1+e.currentTabIndex].dispatchEvent(o)}};const _hoisted_1$3={class:"v-tab-nav"},_hoisted_2$2=["onClick"];function render$4(e,t,l,o,r,a){return vue.openBlock(),vue.createElementBlock("div",{class:"v-tabview",style:vue.normalizeStyle({height:r.height+"px"})},[vue.createElementVNode("ul",_hoisted_1$3,[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(r.tabs,((e,t)=>(vue.openBlock(),vue.createElementBlock("li",{class:vue.normalizeClass({"v-selected":t==r.currentTabIndex}),key:t,onClick:e=>r.currentTabIndex=t},vue.toDisplayString(e.title),11,_hoisted_2$2)))),128))]),vue.renderSlot(e.$slots,"default")],4)}script$4.render=render$4,script$4.__file="src/v-tabview.vue";var script$3={name:"VTextarea",props:{modelValue:String},setup(e,{emit:t}){const l=vue.ref(null),o=()=>{l.value&&(l.value.style.height="auto",l.value.value&&(l.value.style.height=`${l.value.scrollHeight}px`))},r=()=>{vue.nextTick(o)};return vue.watch((()=>e.modelValue),r,{immediate:!0}),vue.onMounted((()=>{const e=l.value;e&&(e.addEventListener("change",o),e.addEventListener("cut",r),e.addEventListener("paste",r),e.addEventListener("drop",r),e.addEventListener("keydown",r),r())})),{textarea:l,updateValue:e=>{t("update:modelValue",e.target.value),r()}}}};const _hoisted_1$2=["value"];function render$3(e,t,l,o,r,a){return vue.openBlock(),vue.createElementBlock("textarea",{ref:"textarea",value:l.modelValue,onInput:t[0]||(t[0]=(...e)=>o.updateValue&&o.updateValue(...e))},null,40,_hoisted_1$2)}script$3.render=render$3,script$3.__file="src/v-textarea.vue";var script$2={name:"VUploader",props:{value:String,onlyicon:Boolean,click:null,icon:String,domain:String},mounted(){var e=this;setTimeout((function(){e.$el.querySelector("svg").dataset.icon="image"}),1e3)},updated(){var e=this;setTimeout((function(){e.$el.querySelector("svg").dataset.icon="image"}),1e3)},data:()=>({uploadPercentage:0,showProgress:!1}),methods:{other(){this.click&&this.click(this)},handleFileUpload(){this.uploadPercentage=0,this.submitFile(this.$el.children[0].children[0].files[0])},submitFile(e,t){var l=this,o=new FormData;t=t||e.name.replace(/[^\w\s.]/gi,""),o.append("filename",t),o.append("file",e,t),l.showProgress=!0,axios$2.post((l.domain?l.domain:"")+"/api/file/upload",o,{headers:{"Content-Type":"multipart/form-data"},onUploadProgress:function(e){this.uploadPercentage=parseInt(Math.round(e.loaded/e.total*100))}.bind(this)}).then((function(e){l.$emit("input",e.data),l.showProgress=!1})).catch((function(){console.log("FAILURE!!")}))}}};const _hoisted_1$1={style:{cursor:"pointer"},class:""},_hoisted_2$1=["data-icon"],_hoisted_3=[".value"];function render$2(e,t,l,o,r,a){return vue.openBlock(),vue.createElementBlock("div",{onClick:t[1]||(t[1]=(...e)=>a.other&&a.other(...e)),class:vue.normalizeClass([l.onlyicon?"":"v-button ui-widget ui-state-default ui-corner-all","v-uploader"]),style:vue.normalizeStyle({padding:l.onlyicon?"0px":""})},[vue.createElementVNode("label",_hoisted_1$1,[l.click?vue.createCommentVNode("v-if",!0):(vue.openBlock(),vue.createElementBlock("input",{key:0,type:"file",onChange:t[0]||(t[0]=e=>a.handleFileUpload())},null,32)),vue.createElementVNode("i",{class:vue.normalizeClass(["fa",l.icon?l.icon:"fa-upload"]),"data-icon":l.icon,style:vue.normalizeStyle({marginRight:l.onlyicon||""==l.value?"":"10px"})},null,14,_hoisted_2$1),vue.createTextVNode(vue.toDisplayString(l.onlyicon?"":null!=l.value?l.value:"Adjuntar Archivo")+" ",1),r.showProgress?(vue.openBlock(),vue.createElementBlock("progress",{key:1,max:"100",style:{width:"100%"},".value":r.uploadPercentage},null,40,_hoisted_3)):vue.createCommentVNode("v-if",!0)])],6)}script$2.render=render$2,script$2.__file="src/v-uploader.vue";var script$1={name:"VItem",setup:({href:e},{emit:t})=>({click:()=>{e?useAppStore().router.push({path:e}):t("click")}}),props:{icon:String,style:Object,label:String,href:String}};function render$1(e,t,l,o,r,a){return vue.openBlock(),vue.createElementBlock(vue.Fragment,null,[vue.createElementVNode("li",{onClick:t[0]||(t[0]=(...e)=>o.click&&o.click(...e)),style:vue.normalizeStyle(l.style)},[vue.createElementVNode("i",{class:vue.normalizeClass(["fa",l.icon])},null,2),vue.createTextVNode(vue.toDisplayString(l.label)+" ",1),vue.renderSlot(e.$slots,"label")],4),vue.createElementVNode("ul",null,[vue.renderSlot(e.$slots,"default")])],64)}script$1.render=render$1,script$1.__file="src/v-item.vue";var script={name:"VCalendarRange",props:{modelValue:null,type:String,required:String,readonly:String,max:String,min:String},setup({modelValue:e},{emit:t}){const l=vue.ref(),o=vue.ref(),r=vue.ref(),a=vue.ref(),n=vue.ref();return{show:l,open:()=>{l.value=!0,vue.nextTick((()=>{n.value=mask(a.value)}))},elRef:a,from:o,to:r,click:e=>{e||(o.value="",r.value="");const l=(date(o.value,"date-")||"")+"|"+(date(r.value,"date-")||"");t("update:modelValue","|"==l?null:l),unmask(n.value)},modelValue:e}}};const _hoisted_1={key:0,ref:"elRef",style:{position:"relative","z-index":"1000",padding:"20px","max-width":"240px"},class:"v-dialog v-msgbox"},_hoisted_2={style:{display:"flex","align-items":"center","justify-content":"center","margin-top":"20px"}};function render(e,t,l,o,r,a){const n=vue.resolveComponent("VButton"),s=vue.resolveComponent("v-calendar"),i=vue.resolveComponent("v-button");return vue.openBlock(),vue.createElementBlock("div",null,[vue.createVNode(n,{icon:"fa-calendar",onClick:o.open,style:{width:"-webkit-fill-available",padding:"12px"},class:vue.normalizeClass(o.from||o.to?"marked":"")},null,8,["onClick","class"]),o.show?(vue.openBlock(),vue.createElementBlock("div",_hoisted_1,[t[4]||(t[4]=vue.createElementVNode("label",null,"Desde:",-1)),vue.createVNode(s,{modelValue:o.from,"onUpdate:modelValue":t[0]||(t[0]=e=>o.from=e)},null,8,["modelValue"]),t[5]||(t[5]=vue.createElementVNode("label",null,"Hasta:",-1)),vue.createVNode(s,{modelValue:o.to,"onUpdate:modelValue":t[1]||(t[1]=e=>o.to=e)},null,8,["modelValue"]),vue.createElementVNode("div",_hoisted_2,[vue.createVNode(i,{icon:"fa-eraser",value:"Limpiar",onClick:t[2]||(t[2]=e=>o.click())}),vue.createVNode(i,{icon:"fa-filter",value:"Aplicar",onClick:t[3]||(t[3]=e=>o.click(!0))})])],512)):vue.createCommentVNode("v-if",!0)])}script.render=render,script.__file="src/v-calendar-range.vue";var components={InputTextarea:script$r,VItem:script$1,InputText:script$s,VAutocomplete:script$q,VButton:script$p,VCalendar:script$o,VCalendarFilter:script,VCheckboxGroup:script$n,VCheckbox:script$m,VDataview:script$l,VFieldset:script$k,VForm:script$j,VGroup:script$i,VLayerControl:script$h,VMapControl:script$g,VMap:script$f,VNumber:script$e,VOptions:script$d,VOverlay:script$c,VPanel:script$b,VPopup:script$a,VRadioGroup:script$8,VRadio:script$9,VSelect:script$7,VSwitch:script$6,VTable:script$5,VTabview:script$4,VTextarea:script$3,VUploader:script$2};const VForm=components.VForm,IsobitUI={install(e){setApp(e),e.BUILT_ON=(void 0).VITE_APP_BUILT_ON;for(const t in components)if(components.hasOwnProperty(t)){const l=components[t];e.component(l.name||t,l)}}};setTimeout(resize,400),window.addEventListener("resize",(()=>{setTimeout(resize,400)}));const removeError=e=>{let t=e.previousElementSibling;t&&t.classList&&t.classList.contains("v-error")&&t.parentNode.removeChild(t)},ui=e=>{const l={computed:{user:()=>_$1.app.session,perms(){return this.session.perms||this.session.allcaps||{}}},data(){return{app2:null,ui:this,_session:null,x_connected_:null,row:{},networkStatus:{connected:null}}},methods:{get(e){let t=this.$el.querySelector("form").action;window.location.href=this.apiLink(t)+"/"+e},async sync(e){let t=this,l=t.$el.querySelector("form").getAttribute("action");if(!l){l=t.$el.parentNode.getAttribute("path");let e=l.split("/");e="edit"==e[e.length-1]?e.splice(0,e.length-2):e.splice(0,e.length-1),l=t.apiLink(e.join("/"))}let o=t.$children[0].$children[0];l=o.src;let r=await t.getStoredList(o.store),a=o.selected,n=[],s=[];for(let e=0;e<a.length;e++){let t=o.data[a[e]];if(t.tmpId&&!t.synchronized)for(let e=0;e<r.length;e++)if(r[e].tmpId==t.tmpId){let t=JSON.clone(r[e]);delete t.synchronized,s.push(t),n.push(e)}}n.length>0&&axios.post(l+"/bulk"+(e.sufix?e.sufix:""),s).then((function(e){let l=e.data;for(let e=0;e<l.length;e++){if(l[e].errors){MsgBox$1(JSON.stringify(l[e].errors));break}if(l[e].error){MsgBox$1(l[e].error);break}for(let t=0;t<r.length;t++)(l[e].ext&&l[e].ext.tmpId==r[t].tmpId||l[e].tmpId==r[t].tmpId)&&(log("ui.ok"),l[e].ext&&r.ext&&(r[t].ext.error=l[e].ext.error),l[e].id&&(r[t].id=l[e].id),r[t].synchronized=1,emit("sync",l[e],r[t]))}t.setStoredList(o.store,r),t.refresh()})).catch((function(e){e.response?MsgBox$1(e.response.data):console.log(e)}))}}};e||(e={data:{o:{}}});const{setup:o,...r}=e,a=o;return e={mixins:[l,r],setup(e,l){const o=useAppStore();setApp(o),o.config(getConfigApp());const r=e;let n=vueRouter.useRouter();const s=vue.getCurrentInstance(),u=vue.reactive([]),c={remove(e){u.splice(u.indexOf(e),1)},push(e){u.push(e)}},d=e=>{},p=async e=>{const t=s.proxy,l=_$1.db;let r;try{r=JSON.parse(sessionStorage.getItem("loadedStores"))}catch(e){}if(null==r&&(r={}),!r[e]&&t.connected){let t=_$1.stores.filter((t=>t[0]==e))[0];if(!t[2])throw`ERROR: Url for store '${t[0]}' is empty!`;let a=await o.axios.get(t[2]);a=a.data||a,await new Promise(((o,n)=>{let s=l.transaction([t[0]],"readwrite"),i=s.objectStore(t[0]);const u=i.clear();u.onsuccess=()=>{a.forEach((e=>{i.add(e).onerror=e=>{console.error(`⚠️ Store '${e[0]}' error addd data!`,e)}}))},u.onerror=()=>{console.error(`⚠️ Store '${t[0]}' error data!`,t)},s.oncomplete=()=>{r[e]=1,sessionStorage.setItem("loadedStores",JSON.stringify(r)),o()},s.onerror=e=>{console.error(`ERROR: ⚠️ Error en la transacción for store '${e[0]}'!`,e),n()}}))}return await new Promise(((t,o)=>{if(l){const o=l.transaction(e).objectStore(e).getAll();o.onsuccess=()=>{t(o.result)}}else console.log("1=========>db=",window._.db),o("=======>db is null esta faltando")}))},v=()=>{u.find((e=>"v-table"==e.type))()},m=(e,t,l)=>{if(!(e.$el||e instanceof HTMLElement)){let t=e,l=t.target;return"string"==typeof t?l=t:"ION-ITEM"==l.tagName&&l.href?(t.preventDefault(),l=l.href):(t.preventDefault(),l.pathname||(l=l.parentNode),l.pathname||(l=l.parentNode),l.pathname||(l=l.parentNode),l=l.pathname),void(n.path!==l&&n.push(l))}},h=(e,t)=>{e.$el&&(e=e.$el),removeError(e);let l=e.previousElementSibling;for(;l&&1!=l.nodeType;)l=l.previousElementSibling;if(!l)for(l=e.parentElement.previousElementSibling;l&&1!=l.nodeType;)l=l.previousElementSibling;let o=document.createElement("div");o.innerHTML=t||"Este campo es requerido!",o.classList.add("v-error"),e.parentNode.insertBefore(o,e)},f=e=>{const t=[],l=[],o=s.proxy;e=e&&0!=e?e:o.$el;const r=e?.querySelectorAll("input,select,textarea,div[required=required]");let a,n={};for(let e=0;r?.length>e;e++){let o=r[e];if("radio"!==o.type){if(o.error&&(o.error.style.display="none"),!o.disabled&&!o.getAttribute("disabled")&&(o.required||"DIV"===o.tagName))if("DIV"!=o.tagName&&!o.value||"DIV"===o.tagName&&!o.attributes.value){for(a=o.previousElementSibling;a&&1!=a.nodeType;)a=a.previousElementSibling;if(!a)for(a=o.parentElement.previousElementSibling;a&&1!=a.nodeType;)a=a.previousElementSibling;t.push(o)}else l.push(o)}else{let e=n[o.name];e||(n[o.name]=e=[]),e.push(o)}}for(let e in n)if(Object.prototype.hasOwnProperty.call(n,e)){const o=n[e];let r=!1,s=!1;for(let e=0;e<o.length;e++)o[e].required&&!o[e].disabled&&(s=!0),o[e].checked&&(r=!0);const i=o[0].parentNode.parentNode;a=i.previousElementSibling,a&&a.classList&&a.classList.contains("v-error")&&a.parentNode.removeChild(a),s&&!r?t.push(i):l.push(i)}for(const e of t)h(e);for(const e of l){let t=e.previousElementSibling;t&&t.classList&&t.classList.contains("v-error")&&t.parentNode.removeChild(t)}return!t.length},g=(e,t)=>{let l=e.parentElement;for(;l;){const e=l.querySelector(t);if(e)return e;l=l.parentElement}return null},y=e=>{console.log(l)};vue.provide("viewCollector",c);const $=vue.computed((()=>{let e=u.find((e=>e.selected?.value.length>0));return e?.rowSelectedCount||0})),b=vue.computed((()=>clean(w.value))),w=vue.reactive({}),k=vue.ref(null);let _;vue.watch(w,(()=>{u.find((e=>"v-table"==e.type))&&(k.value&&clearTimeout(k.value),k.value=setTimeout((()=>{v()}),1200))}));const x=()=>{clearTimeout(_),_=setTimeout((()=>{const e=document.querySelector(".v-datatable");e?.parentNode&&buildPopupMenu(e)}),100)};vue.onMounted((()=>{n=vueRouter.useRouter(),l.emit("sync",{u:9}),x(),window.addEventListener("resize",x)})),vue.onUnmounted((()=>{window.removeEventListener("resize",x)}));const S=vue.computed((()=>o.axios.defaults.baseURL)),E=vue.computed((()=>o.session));let C=a?a({...e,$on:(e,t)=>{},router:n,getStoredList:p,app:o},l):{};l.expose({router:n});let V={app:o,cleanedFilters:b,router:n,baseURL:S,filters:w,session:E,date:date,pad:pad,getStoredList:p,refresh:v,getSelected:()=>u.find((e=>"v-table"==e.type)).selected.value,saveAs:(e,t,l)=>{"string"==typeof t&&(t={body:t});let o="string"==typeof l?{fileName:l}:l;o||(o={}),(""+t?axios.post(e,t,{responseType:"blob"}):axios({method:"post",url:e,data:t,headers:{"Content-Type":"multipart/form-data"}})).then((e=>{const t=window.URL.createObjectURL(new Blob([e.data])),l=document.createElement("a");if(l.href=t,!o.fileName){const t=e.headers["content-disposition"];if(t&&-1!==t.indexOf("attachment")){const e=/filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/.exec(t);null!=e&&e[1]&&(o.fileName=e[1].replace(/['"]/g,"").trim())}else console.warn("content-disposition: attachment; filename = <filename>; header no es accesible o no esta definido correctamente")}l.setAttribute("download",o.fileName),document.body.appendChild(l),l.click()}))},validate:f,save:()=>{let e=u.filter((e=>"v-form"==e.type))[0];console.log(e);const a=s.proxy;e.$forceUpdate();let n=e.$el,c=n.querySelector("form");if(f(c)){let e=c.getAttribute("action"),n=a.data||a.o,s=JSON.parse(JSON.stringify(n));if(a.process&&(s=a.process(s)),"object"!=typeof s||Array.isArray(s)||null===s)return;if(console.log("action/componet==",e,a,l),e&&o.connected)o.axios.post(e,s).then((e=>{let t=e.data;if(s.tmpId){alert(12);let e=r.$children[0].store,l=window._.db.transaction([e],"readwrite").objectStore(e),o=l.get(s.tmpId);t.id&&(s.id=t.id,n.id=s.id),o.onsuccess=function(){let e;n.synchronized=1,s.synchronized=1,e=o.result?l.put(s):l.add(s),e.onerror=e=>{console.error(e)},r.$emit("sync",t,s)},o.onerror=function(){MsgBox$1("Error getting temporal record "+s.tmpId)}}o&&o.toast?o.toast("El registro fue grabado exitosamente!",(()=>{a.close({success:!0,data:t})})):MsgBox$1("El registro fue grabado exitosamente! msg",(()=>{y()}))})).catch((function(e){if(e.response){let l,o;if("string"==typeof e.response.data)MsgBox$1(e.response.data);else{l=e.response.data.propertyViolations;for(let e=0;e<l.length;e++){let t=l[e];o=c.querySelector("[name="+t.path+"]"),o&&r.showerror(o,t.message)}for(l=e.response.data.fieldViolations,i=0;i<l.length;i++)t=l[i],o=c.querySelector("[name="+t.path+"]"),o&&r.showerror(o,t.message+", valor="+t.value);MsgBox$1("Verifique el formulario, aun tiene campos obligatorio completar."),"v-dialog"==r.$el.parentNode.className&&r.$el.parentNode.parentNode.scroll({top:0,behavior:"smooth"})}}}));else{console.log("se guarda localmente");const e=u[0].store;if(!e)return void MsgBox$1("Store in form is undefined!");p(e).then((t=>{if(t||(t=[]),s.id)for(let e=0;e<t.length;e++)t[e].tmpId==s.tmpId&&(delete s.synchronized,t[e]=s);let l=_$1.db.transaction([e],"readwrite").objectStore(e);if(s.id){delete s.synchronized;let e=l.get(s.tmpId);e.onsuccess=function(){e.result?l.put(s):t.forEach((e=>{e.tmpId==s.tmpId&&l.put(s)})),r.$emit("stored",s,t,l),r.$ionic&&o.toast("El registro fue grabado exitosamente! onstored"),console.log("============2",a),a.close({success:!0,data:s})},e.onerror=function(){MsgBox$1("Error getting temporal record "+s.tmpId)}}else{s.tmpId=1*new Date,s.id=-s.tmpId;let e=l.add(s);e.onsuccess=e=>{t.unshift(s),r.$emit("stored",s,t,l),o&&o.toast&&o.toast("El registro fue grabado exitosamente! storeeeeee not connected"),n.tmpId=s.tmpId,n.id=s.id,console.log("========>>",a),a.close({success:!0,data:s})},e.onerror=e=>{o&&o.toast&&o.toast("Error!")}}}))}}else MsgBox$1("Verifique el formulario, aun tiene campos obligatorios sin completar."),"v-dialog"==n.parentNode.className?n.parentNode.parentNode.scroll({top:0,behavior:"smooth"}):n.querySelector("form > .v-form").scroll({top:0,behavior:"smooth"})},open:m,close:y,create:e=>{const t=g(e.target,".v-datatable");let l=u.filter((e=>"v-table"==e.type)).find((e=>e.is(t))).getForm().action;l||(l=window.location.pathname),l&&(l=l.replace("/api","")),o&&m(l+"/create")},edit:e=>{const t=g(e.target,".v-datatable");let l=u.filter((e=>"v-table"==e.type)).find((e=>e.is(t))),a=l.getForm().action;var n;a||(a=window.location.pathname),l&&l.src&&(a=l.src),e.action&&(a=e.action),a&&(n=a.replace("/api","").replace("/0/0",""),a="/admin"+n);const s=l.selected.value[0];let i=s[l.rowKey];s.tmpId&&(i=-s.tmpId),o?m(a+"/"+i+"/edit"):o.axios.get((_$1.currentPath=(a+"/"+i+"/edit").replace(/([^:]\/)\/+/g,"$1"))+"?modal").then(r.open).catch(d)},destroy:e=>{let t=this;const l=g(e.target,".v-datatable");let r=u.filter((e=>"v-table"==e.type)).find((e=>e.is(l)));u.find((e=>"v-table"!=e.type)).action;let a=e.$vnode?e.load:null,n=r.rowKey,s=r.selected.value[0];if(s.tmpId)MsgBox$1("Esta seguro que desea eliminar los registros temporales seleccionados ?",(function(e){if(0==e){let e=0,l=_$1.db.transaction([r.store],"readwrite").objectStore(r.store),n=[];for(let t=r.selected.length-1;t>=0;t--)s=r.data[r.selected[t]],n.push(s),s.tmpId&&l.delete(s.tmpId),e++,r.data.splice(r.selected[t],1);e&&(o&&o.toast?o.toast(e+" registros eliminados"):MsgBox$1(e+" registros eliminados")),r.rowSelect(null,-1),r.selected=[],t.$emit("destroyed",n,r.store),a&&a()}}),["SI","NO"]);else{if(!n)return alert("Table don`t have defined attribute 'rowkey'");let e=s[n];MsgBox$1("Esta seguro que desea eliminar el registro seleccionado?",(t=>{if(0==t){const t=r.src.replace("/0/0",""),l=[];let a=r.selected.value.length-1;o.axios.delete(t+"/"+e,{params:w.value}).then((()=>{for(;a>=0;a--)s=r.selected.value[a],l.push(s),r.remove(s);o&&o.toast?o.toast(l.length+" registros eliminados"):MsgBox$1(l.length+" registros eliminados"),r.rowSelect(null,-1),r.selected.value=[]})).catch(d)}}),["SI","NO"])}},rowSelectedCount:$,...C};return V}},e};exports.Drag=Drag,exports.IsobitUI=IsobitUI,exports.MsgBox=MsgBox$1,exports.VForm=VForm,exports._=_$1,exports.app=app,exports.date=date,exports.db=db,exports.getStoredList=getStoredList,exports.id=id,exports.initDB=initDB,exports.mask=mask,exports.pad=pad,exports.removeError=removeError,exports.resize=resize,exports.setupApp=setupApp,exports.ui=ui,exports.unmask=unmask,exports.useAppStore=useAppStore;
package/dist/library.mjs CHANGED
@@ -1 +1 @@
1
- import{openBlock,createElementBlock,ref,watch,computed,onMounted,onBeforeUnmount,normalizeStyle,renderSlot,createTextVNode,toDisplayString,createElementVNode,createCommentVNode,withDirectives,withKeys,withModifiers,normalizeClass,vModelText,createVNode,Transition,withCtx,Fragment,renderList,vShow,nextTick,defineComponent,inject,provide,h as h$1,reactive,onUpdated,onUnmounted,getCurrentInstance,createBlock,resolveComponent}from"vue";import{createPinia,setActivePinia,getActivePinia,defineStore}from"pinia";import axios$2 from"axios";import{unByKey}from"ol/Observable";import{Collection}from"ol";import FullScreen from"ol/control/FullScreen";import GeoJSON from"ol/format/GeoJSON";import VectorLayer from"ol/layer/Vector";import VectorSource from"ol/source/Vector";import{Style,Fill,Stroke,Text,Circle,RegularShape}from"ol/style";import Control from"ol/control/Control";import"ol/ol.css";import PointerInteraction from"ol/interaction/Pointer";import Feature from"ol/Feature";import Map from"ol/Map";import"ol/interaction/Pointer.js";import"ol/interaction/defaults";import View from"ol/View";import{Point}from"ol/geom";import"ol/interaction/Select";import{fromLonLat,toLonLat}from"ol/proj";import{Tile}from"ol/layer";import{OSM}from"ol/source";import"ol/interaction/Translate";import _imports_0 from"@/cdn/images/triangle-down.svg";import{useRouter}from"vue-router";import{FontAwesomeIcon}from"@fortawesome/vue-fontawesome";import{faSquareCheck,faSquare}from"@fortawesome/free-regular-svg-icons";var script$s={name:"InputText"};const _hoisted_1$j={type:"text"};function render$o(e,t,l,o,a,r){return openBlock(),createElementBlock("input",_hoisted_1$j)}script$s.render=render$o,script$s.__file="src/InputText.vue";var script$r={name:"InputTextarea"};function render$n(e,t,l,o,a,r){return" text "}script$r.render=render$n,script$r.__file="src/InputTextarea.vue";const _$1={stores:[],_id:0,axios_get:null,storeFunction:{}},log=(e,...t)=>{e&&console.log(e,...t)};let configApp={};function setupApp({pinia:e,axios:t,router:l}){configApp.pinia=e||createPinia(),t&&(configApp.axios=t),l&&(configApp.router=l),setActivePinia(configApp.pinia)}function getConfigApp(){return configApp}function getPiniaInstance(){return getActivePinia()||configApp.pinia}const id=()=>_$1._id++,num=e=>e=e?""==e?null:Number(""+e):0,date=(e,t)=>{if(e){let l;if(e instanceof Date)l=e;else if("string"==typeof e){let t=e.includes("T")?e.split("T"):e.split(" ");l=t[0].split("-"),t.length>1?(t=t[1].split(":"),l=new Date(parseInt(l[0]),parseInt(l[1])-1,parseInt(l[2]),parseInt(t[0]),parseInt(t[1]),t.length>2?parseInt(t[2]):0)):l.length>2?l=new Date(parseInt(l[0]),parseInt(l[1])-1,parseInt(l[2])):(l=e.split(":"),l=l.length>2?new Date(1981,0,6,parseInt(l[0]),parseInt(l[1]),parseInt(l[2])):new Date(e))}else l=new Date(e);if(1==t)e=l;else if("time"===t)e=pad(l.getHours(),2)+":"+pad(l.getMinutes(),2)+":"+pad(l.setSeconds()?l.setSeconds():0,2);else if("time a"==t)if("string"==typeof e||e instanceof String){let t=(e=e.split(":"))[0];e=pad(t>12?t-12:t,2)+":"+e[1]+":"+e[2]+" "+(t>12?"PM":"AM")}else h=l.getHours(),e=pad(h>12?h-12:h,2)+":"+pad(l.getMinutes(),2)+(l.setSeconds()?":"+pad(l.setSeconds(),2):"")+" "+(h>12?"PM":"AM");else e="date-"==t?pad(l.getFullYear(),4)+"-"+pad(l.getMonth()+1,2)+"-"+pad(l.getDate(),2):"dMY"==t||"date"==t?pad(l.getDate(),2)+"/"+pad(l.getMonth()+1,2)+"/"+pad(l.getFullYear(),4):"datetime"==t?pad(l.getFullYear(),4)+"-"+pad(l.getMonth()+1,2)+"-"+pad(l.getDate(),2)+"T"+pad(l.getHours(),2)+":"+pad(l.getMinutes(),2)+":"+pad(l.setSeconds()?l.setSeconds():0,2):pad(l.getDate(),2)+"/"+pad(l.getMonth()+1,2)+"/"+pad(l.getFullYear(),4)+" "+pad(l.getHours(),2)+":"+pad(l.getMinutes(),2)}return e},whichChild=e=>{let t=0;for(;null!=(e=e.previousElementSibling);)++t;return t},unmask=e=>{e&&(e.style.display="none",e.parentNode&&e.parentNode.removeChild(e))},isObject=e=>e&&"object"==typeof e&&!Array.isArray(e),mergeDeep=function(){let e=arguments[0],t=[];for(let e=1;e<arguments.length;e++)t.push(arguments[e]);if(!t.length)return e;let l,o=t.shift();if(isObject(e)&&isObject(o))for(let t in o)isObject(o[t])?(e[t]||(l={},l[t]={},Object.assign(e,l)),mergeDeep(e[t],o[t])):(l={},l[t]=o[t],Object.assign(e,l));let a=[];return a.push(e),a.concat(t),mergeDeep.apply(null,a)},buildPopupMenu=e=>{let t=e.getAttribute("v--popup");if(!t){e.setAttribute("v--popup",t=id());let l=_$1.storeFunction[t],o=e.querySelectorAll(".v-datatable-header .v-button");o&&o.length&&!l&&window.innerWidth<=700&&setTimeout((function(){l=document.createElement("ul"),l.className="v-popup-2",e.appendChild(l);let a=null;const r=e=>{l.style.display="none";let t=e.target.getAttribute("commandId"),o=document.querySelector("#"+t);"BUTTON"==o.tagName?o.click():o.children[0].click(),unmask(a)};e.style.position="relative";let n=document.createElement("div");n.className="v-mobil v-table-buttons";let s=document.createElement("i");s.className="fa fa-bars fa-w-14",n.appendChild(s),n.onclick=()=>{for(o=e.querySelectorAll(".v-datatable-header .v-button");l.firstChild;)l.removeChild(l.firstChild);for(s=0;s<o.length;s++)if("none"!=o[s].style.display){let e=document.createElement("li");if(o[s].id||(o[s].id="c-"+id()),e.setAttribute("commandId",o[s].id),"BUTTON"==o[s].tagName){if(o[s].disabled)continue;e.appendChild(o[s].children[0].cloneNode(!0)),e.appendChild(document.createTextNode(o[s].value?o[s].value:o[s].title))}else o[s].children[0].children[1]&&(e.appendChild(o[s].children[0].children[1]),e.appendChild(document.createTextNode(o[s].textContent)));e.onclick=r,l.appendChild(e)}a=mask(l),l.style.display="block",a.onclick=()=>{l.style.display="none",unmask(a)}},e.appendChild(n),_$1.storeFunction[t]=l}),500)}},resize=()=>{},mask=(e,t)=>{if(!document.body)return;let l,o=document.createElement("div");o.style="top:50%;transform:translate(-50%,-50%);position:absolute;width:100%;z-index:2; display: flex;justify-content: center;";let a=o.style;if(a.left="50%",a.textAlign="center",!1!==e)if(e instanceof Element)o=e;else{if(e){let t=document.createElement("div");t.innerHTML=e,o.append(t),o.style="padding:4px;margin-bottom:5px;color:white;font-size:24px;text-align:center"}l=document.createElement("div"),a=l.style,l.className="loading"}let r=document.createElement("div");a=r.style,a.height="100%",a.top="0px",a.position="absolute",a.left="0",a.zIndex="10000",a.width="100%";let n=document.createElement("div");return n.className="v-overlay",r.appendChild(n),o.style.zIndex="1001",r.appendChild(o),r.className="v-mask",l&&o.appendChild(l),document.body.appendChild(r),r},MsgBox$1=(e,t,l)=>{if(l||(l=["OK"]),!document.body)return;let o=document.createElement("div");o.classList.add("v-overlay"),o.style.padding="40px",o.style.zIndex="2000",document.body.appendChild(o);let a=document.createElement("div"),r=document.createElement("div"),n=document.createElement("div"),s=document.createElement("div");s.className="v-msgbox-buttons",a.classList.add("v-dialog"),a.classList.add("v-msgbox"),e instanceof Element?n=e:n.innerHTML=e,a.setAttribute("path",_$1.currentPath);let i=function(){a.style.display="none",o.style.display="none",a.parentNode.removeChild(a),o.parentNode.removeChild(o),t&&t(this.getAttribute("index"))};for(let e=0;e<l.length;e++){let t=document.createElement("button");t.innerHTML=l[e],t.type="button",t.setAttribute("index",e),t.className="v-button ui-widget ui-state-default ui-corner-all",s.appendChild(t),t.addEventListener("click",i)}r.className="v-dialog-content v-widget-content",r.appendChild(n),r.appendChild(s),a.appendChild(r),o.appendChild(a),o.style.visibility="unset",o.style.opacity="unset",o.style.overflow="auto",a.style.margin="0px auto 50%",a.style.position="unset";let c=a.querySelector(".v-js-close");if(!c){let e=document.createElement("span");a.style.position="relative",e.style.position="absolute",e.className="fa fa-close",c=document.createElement("a"),c.className="v-js-close ui-dialog-titlebar-icon ui-dialog-titlebar-close ui-corner-all",c.appendChild(e),a.appendChild(c),c.addEventListener("click",i)}},configureAxios=e=>{if(e.configured)return;let t;e.configured=1,_$1.axios_get=e.get,e.interceptors.request.use((l=>(e.noInterceptor||(_$1.eeee=l,l.mask?l.mask():t||(t=mask())),l)),(e=>(t=unmask(t),MsgBox$1("request "+id()+" "+e.message),Promise.reject(e)))),e.interceptors.response.use((l=>(t=unmask(t),delete e.noInterceptor,l)),(l=>{if(console.log("interceptors.response.use.error"),e.noInterceptor)return delete e.noInterceptor,t=unmask(t),Promise.reject(l);if(e.error&&0==e.error(l))t=unmask(t);else{let e,o=l.response;if(o&&("string"==typeof o.data?e=o.data:o.data&&(o.data.data&&(e=o.data.data.message),e||(e=o.data.msg||o.data.message)),e||(e=o.status+": "+o.statusText)),e||(e=l.message),t=unmask(t),o&&(401==o.status||403==o.status)){const e=app();if(e&&localStorage.getItem("session"))return e.axios.noInterceptor=1,void e.axios.post(e.axios.VITE_LOGIN_PATH+"/validate",{JWT:"YOUR_JWT_HERE"}).catch((t=>{console.log("e.response=",t),t.response.data.success||MsgBox$1("Session terminada!",(()=>{e.logout()}))}))}l.config?.error?l.config.error(l,e):l.request?MsgBox$1("<b>"+l.request.responseURL+"</b><br/><br/>"+e):MsgBox$1(e)}return delete e.error,Promise.reject(l)}))},pad=(e,t)=>{if(null!=e){let l=1*e+"";for(;l.length<t;)l="0"+l;return l}},clean=e=>{const t={...e};for(let e in t)""!==t[e]&&null!==t[e]&&"function"!=typeof t[e]&&void 0!==t[e]||delete t[e];return t},sum=e=>(void 0).reduce(((t,l)=>t+((l=e?l[e]:l)?Number(l):0)),0);function createGetters(){return{get networkStatus(){return _$1.app?.networkStatus||{connected:!0}},get db(){return _$1.app?.db},app:()=>_$1.app,setApp(e){_$1.app=e}}}const app=()=>_$1.app,db=()=>_$1.db,initDB=(e,t)=>{let l=window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB;if(_$1.IDBTransaction=window.IDBTransaction||window.webkitIDBTransaction||window.msIDBTransaction,_$1.IDBKeyRange=window.IDBKeyRange||window.webkitIDBKeyRange||window.msIDBKeyRange,l){if(l)return _$1.stores=t,new Promise(((o,a)=>{l.databases().then((r=>{const n=r.find((e=>"db"===e.name)),s=n&&n.version||0;if(s<e){console.log(`Eliminando base de datos (versión actual: ${s}, nueva versión: ${e})`);l.deleteDatabase("db").onsuccess=()=>{let r=l.open("db",e);r.onupgradeneeded=e=>{let l=e.target.result;t.forEach((e=>{if(!l.objectStoreNames.contains(e[0])){const{keyPath:t}=e[1];l.createObjectStore(e[0],{keyPath:t,autoIncrement:!t})}}))},r.onerror=e=>{a(e)},r.onsuccess=()=>{_$1.db=r.result,o(_$1.db)}}}else{let r=l.open("db",e);r.onupgradeneeded=e=>{let l=e.target.result;t.forEach((e=>{if(!l.objectStoreNames.contains(e[0])){const{keyPath:t}=e[1];l.createObjectStore(e[0],{keyPath:t,autoIncrement:!t})}}))},r.onerror=e=>{a(e)},r.onsuccess=()=>{_$1.db=r.result,o(_$1.db)}}}))}))}else window.alert("Your browser doesn't support a stable version of IndexedDB.");return l},getStoredList=async(e,t)=>{const l=db();let o;try{o=JSON.parse(sessionStorage.getItem("loadedStores"))}catch(e){}if(null==o&&(o={}),!o[e]&&networkStatus.connected){const t=_$1.stores.filter((t=>t[0]==e));if(t.length)throw`ERROR: store '${e}' no exists!`;let a=t[0];const{src:r}=a[1];if(!r)throw`ERROR: Url for store '${a[0]}' is empty!`;let n=r?await _$1.axios_get(r):[];n=n.data||n,await new Promise(((t,r)=>{let s=l.transaction([a[0]],"readwrite"),i=s.objectStore(a[0]);const c=i.clear();c.onsuccess=()=>{n.forEach((e=>{i.add(e).onerror=e=>{console.error(`⚠️ Store '${e[0]}' error addd data!`,e)}}))},c.onerror=()=>{console.error(`⚠️ Store '${a[0]}' error data!`,a)},s.oncomplete=()=>{o[e]=1,sessionStorage.setItem("loadedStores",JSON.stringify(o)),t()},s.onerror=e=>{console.error(`ERROR: ⚠️ Error en la transacción for store '${e[0]}'!`,e),r()}}))}return await new Promise(((t,o)=>{if(l){const o=l.transaction(e).objectStore(e).getAll();o.onsuccess=()=>{t(o.result)}}else console.log("1=========>db=",window._.db),o("=======>db is null esta faltando")}))},getters=createGetters(),{networkStatus:networkStatus,setApp:setApp}=getters,deleteAllCookies=()=>{const e=document.cookie.split(";");for(let t of e){const e=t.split("=")[0].trim();document.cookie=`${e}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;`}},useAppStore=defineStore("connection",(()=>{const e=getPiniaInstance(),t=getConfigApp();if(!e)throw new Error("Pinia no ha sido inicializado. Llama a setupPinia() en tu app.");const l=ref(!1),o=ref(!1),a=ref(t.router),r=ref(t.axios),n=ref(null),s=ref(null);l.value="false"!==localStorage.getItem("connected");const i=e=>{setTimeout((()=>{n.value&&(r.value.noInterceptor=1,r.value.post(r.value.VITE_LOGIN_PATH+"/refresh",{}).then((({data:t})=>{const{token:l,user_nicename:o,perms:a}=t;n.value={token:l,people:{display_name:o},perms:a},e(i)})).catch((e=>{console.error(e)})))}),6e5)};let c;watch(n,(e=>{e&&e.token?(r.value.defaults.headers.common={Authorization:"Bearer "+e.token},localStorage.setItem("session",JSON.stringify(e)),c||(c=i,i(i))):(localStorage.removeItem("session"),c=null)}));const d=localStorage.getItem("session");n.value=d?JSON.parse(d):null,watch(l,(e=>{localStorage.setItem("connected",String(e))}));const u=computed((()=>s.value?.connected)),p=computed((()=>!!n.value?.token));return{connected:l,session:n,logout:()=>{n.value=null,deleteAllCookies(),a.value.push("/login")},unauthorized:o,connect:e=>{n.value=e,a.value.push("/admin")},authenticated:p,config:({axios:e,router:t})=>{t&&(a.value=t),e&&(r.value=e,configureAxios(e))},axios:r,router:a,online:u,networkStatusChange:e=>{s.value=e}}}));var script$q={name:"VAutocomplete",props:{value:{type:Object,required:!0},data:{type:Array,default:()=>null},placeholder:String,label:String,default:Object,store:String,params:Object,autoload:{type:Boolean,default:!1},floating:{type:Boolean,default:!0},src:String,readonly:Boolean,nowrap:Boolean,disabled:Boolean,showSelection:{type:Boolean,default:!0},pagination:{type:Number,default:10}},setup(e,t){const{emit:l,slots:o}=t;useAppStore();const a=ref(0),r=ref(null),n=ref(-1),s=ref(""),i=ref(null),c=ref(!1),d=ref(0),u=ref("");watch((()=>e.value),(e=>{r.value=e})),watch((()=>e.data),(e=>{i.value=e})),onMounted((()=>{u.value=e.inputClass,e.autoload&&m(),document.addEventListener("click",v)})),onBeforeUnmount((()=>{document.removeEventListener("click",v)}));const p=computed((()=>{n.value=-1;const e=s.value?s.value.trim().toLowerCase().split(/[ ,]+/):null;return i.value&&s.value?i.value.filter((t=>{const l=JSON.stringify(t).toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"");return e.every((e=>l.includes(e)))})):i.value})),m=async t=>{const{src:o,source:r}=e;let n=Number(e.pagination);if(1===t)a.value+=n;else if(a.value=0,e.data&&e.autoload)return;let u={query:s.value};e.params&&(u=mergeDeep(u,e.params)),axios$2.get((o||e.source)+(n>0?"/"+a.value+"/"+n:""),{params:u}).then((l=>{const o=l.data;console.log(o),o.error?MsgBox(o.error):(i.value=1===t?i.value.concat(o.data?o.data:o):o.data?o.data:o,console.log(i),d.value=o.size,e.autoload||(c.value=!0),console.log("========================="))})).catch(h).then((()=>{l("complete",{data:i.value,query:s.value,target:"me"})}))},h=e=>{console.log(e)},v=e=>{};return{query:s,show:c,selected:r,data2:p,focused:n,inputClass:u,search:m,remove:()=>{l("input",null)},clickout:v,focusout:e=>{},setSelected:e=>{r.value=e,l("update:modelValue",e)},getLabel:t=>{if(e.label){const l=e.label.split(".");for(let e=0;e<l.length;e++)t&&(t=t[l[e]])}return t},hasSlot:(e="default")=>!!o[e]}}};const _hoisted_1$i=["value","disabled"],_hoisted_2$9=["disabled","placeholder"],_hoisted_3$5={class:"v-list"},_hoisted_4$3=["onClick"],_hoisted_5$1={key:0,class:"center yellow",style:{padding:"5px"}};function render$m(e,t,l,o,a,r){return openBlock(),createElementBlock("div",{class:"v-autocomplete",onFocusout:t[7]||(t[7]=(...e)=>o.focusout&&o.focusout(...e)),value:l.value,disabled:l.disabled},[o.selected&&l.showSelection?(openBlock(),createElementBlock("div",{key:0,class:"v-selection",style:normalizeStyle({whiteSpace:l.nowrap?"nowrap":""})},[renderSlot(e.$slots,"label",{selected:o.selected}),createTextVNode(" "+toDisplayString(o.hasSlot("label")?" ":o.getLabel(o.selected))+"  ",1),l.readonly?createCommentVNode("v-if",!0):(openBlock(),createElementBlock("span",{key:0,onClick:t[0]||(t[0]=(...e)=>o.remove&&o.remove(...e)),class:"remove-icon"},t[8]||(t[8]=[createElementVNode("i",{class:"fa fa-times"},null,-1)])))],4)):createCommentVNode("v-if",!0),o.selected?createCommentVNode("v-if",!0):(openBlock(),createElementBlock("span",{key:1,onClick:t[1]||(t[1]=(...e)=>o.search&&o.search(...e)),class:"search-icon"},t[9]||(t[9]=[createElementVNode("i",{class:"fa fa-xs fa-sync"},null,-1)]))),o.selected?createCommentVNode("v-if",!0):withDirectives((openBlock(),createElementBlock("input",{key:2,onKeyup:[t[2]||(t[2]=(...t)=>e.keyup&&e.keyup(...t)),t[3]||(t[3]=withKeys(withModifiers(((...e)=>o.search&&o.search(...e)),["stop","prevent"]),["enter"]))],class:normalizeClass(o.inputClass),onFocus:t[4]||(t[4]=e=>o.show=!0),disabled:l.disabled,placeholder:l.placeholder,"onUpdate:modelValue":t[5]||(t[5]=e=>o.query=e)},null,42,_hoisted_2$9)),[[vModelText,o.query]]),createVNode(Transition,{name:"fade",persisted:""},{default:withCtx((()=>[withDirectives(createElementVNode("div",{class:"v-resultpane",style:normalizeStyle({zIndex:2,width:"calc(100% - 2px)",position:l.floating?"absolute":"relative"})},[createElementVNode("div",_hoisted_3$5,[(openBlock(!0),createElementBlock(Fragment,null,renderList(o.data2,((t,l)=>(openBlock(),createElementBlock("div",{key:l,class:normalizeClass({"v-selected":o.selected==t,"v-focused":o.focused==l}),onClick:e=>o.setSelected(t)},[renderSlot(e.$slots,"default",{row:t})],10,_hoisted_4$3)))),128)),e.data0&&e.data0.length<e.total?(openBlock(),createElementBlock("div",{key:0,class:"center",onClick:t[6]||(t[6]=e=>o.search(1))},"Load more "+toDisplayString(e.total-e.data0.length)+" results...",1)):createCommentVNode("v-if",!0)]),o.data2&&o.data2.length<1?(openBlock(),createElementBlock("div",_hoisted_5$1,"No results found.")):createCommentVNode("v-if",!0)],4),[[vShow,o.show&&!o.selected]])])),_:3})],40,_hoisted_1$i)}script$q.render=render$m,script$q.__scopeId="data-v-72884078",script$q.__file="src/v-autocomplete.vue";var script$p={name:"VButton",mounted(){var e=this,t=document.createElement("span"),l=document.createElement("i");t.className="ui-button-text ui-c ",t.innerHTML=e.$attrs.value?e.$attrs.value:"ui-button",e.$el.addEventListener("click",(t=>{t.component=e})),e.$attrs.icon?(e.$attrs.value?e.$el.classList.add("v-button-text-icon-left"):e.$el.classList.add("v-button-icon-only"),l.dataset.icon=e.$attrs.icon,l.className="fa "+e.$attrs.icon,e.$el.appendChild(l)):(t=document.createElement("span"),e.$el.classList.add("ui-button-text-only"),e.$el.appendChild(t)),e.$attrs.value&&((t=document.createElement("span")).appendChild(document.createTextNode(e.$attrs.value)),e.$el.appendChild(t)),e.updateIcon()},methods:{updateIcon(){var e=this;setTimeout((function(){var t=e.$el.querySelector("svg");if(t){var l=t.dataset;l.icon||(l.icon=e.$attrs.icon)}}),1e3)}}};const _hoisted_1$h={type:"button",class:"_ ui-widget ui-state-default ui-corner-all v-button"};function render$l(e,t,l,o,a,r){return openBlock(),createElementBlock("button",_hoisted_1$h)}script$p.render=render$l,script$p.__file="src/v-button.vue";var script$o={name:"VCalendar",props:{modelValue:null,type:String,required:String,readonly:String,max:String,min:String},setup(e,{emit:t}){const{type:l,modelValue:o,max:a,min:r}=e,n=ref(null),s=e=>{t("update:modelValue",e),nextTick((()=>{t("changed",e)}))},i=e=>{if(e){let t;if("time"===l)return t=e.split(":"),new Date(1981,1,6,parseInt(t[0]),parseInt(t[1]),t.length>2?parseInt(t[2]):0);{if(!isNaN(e))return new Date(e);let o;if("datetime-local"===l)return o=e.split("T"),t=o[1].split(":"),o=o[0].split("-"),o=new Date(parseInt(o[0]),parseInt(o[1])-1,parseInt(o[2]),parseInt(t[0]),parseInt(t[1]),t.length>2?parseInt(t[2]):0),o;{o=e.split("-");let t=parseInt(o[0]);return t<100?e:(o=new Date(t,parseInt(o[1])-1,parseInt(o[2])),o)}}}return e};watch((()=>e.modelValue),(e=>{c(e)}));const c=e=>{if(!n.value)return;let t,o=i(e);o&&(t="string"==typeof o?o:"time"===l?pad(o.getHours(),2)+":"+pad(o.getMinutes(),2):"datetime-local"===l?pad(o.getFullYear(),4)+"-"+pad(o.getMonth()+1,2)+"-"+pad(o.getDate(),2)+"T"+pad(o.getHours(),2)+":"+pad(o.getMinutes(),2):pad(o.getFullYear(),4)+"-"+pad(o.getMonth()+1,2)+"-"+pad(o.getDate(),2)),n.value.value=t};return{enterD:e=>{let o=e.target.value,n=i(o);return a&&n&&n.getTime()>=i(a).getTime()||r&&n&&n.getTime()<=i(r).getTime()?(t("invalid",{target:me,value:n}),n=null,void(e.target.value=n)):void("time"===l?s(pad(n.getHours(),2)+":"+pad(n.getMinutes(),2)+":00"):n.getTime&&s(n.getTime()))},input:n}}};const _hoisted_1$g=["required","readonly","min","max","type"];function render$k(e,t,l,o,a,r){return openBlock(),createElementBlock("div",null,[createElementVNode("input",{required:l.required,ref:"input",readonly:l.readonly,min:l.min,max:l.max,onChange:t[0]||(t[0]=(...e)=>o.enterD&&o.enterD(...e)),type:l.type?l.type:"date"},null,40,_hoisted_1$g)])}script$o.render=render$k,script$o.__file="src/v-calendar.vue";var script$n={name:"VCheckboxGroup",props:{required:String,name:String},data:()=>({value:[],options:[],nam:null}),created(){this.nam||(this.nam=this.$props.name?this.$props.name:"input_"+id()),this.update2()},updated(){this.update2()},mounted(){this.options=this.$el.querySelectorAll("input:not(.v-chk)");for(var e=0;e<this.options.length;e++)this.options[e].classList.add("v-chk");this.update2()},methods:{update2(){var e=this.options,t=this.$attrs.value;"string"==typeof t&&(t=t.split("|"));for(var l=0;l<e.length;l++){e[l].checked=!1;for(var o=0;t&&o<t.length;o++)e[l].value==t[o]&&(e[l].checked=!0)}},onChange:function(e,t){var l=this,o=l.$attrs.value;if(("string"==typeof o||o instanceof String)&&(o=o.split("|")),t)o||(l.$attrs.value=o=[]),o.push(e);else{var a=o.indexOf(e);a>-1&&o.splice(a,1)}l.$emit("input",o)}}};function render$j(e,t,l,o,a,r){return openBlock(),createElementBlock("div",null,[renderSlot(e.$slots,"default")])}script$n.render=render$j,script$n.__file="src/v-checkbox-group.vue";var script$m=defineComponent({name:"VCheckbox",props:{value:null,modelValue:null,valueFalse:null,label:String,readonly:Boolean},emits:["update:modelValue"],setup(e,{emit:t}){const l=ref(null),o=ref(0),a=computed((()=>e.value?e.value===e.modelValue:["true","1",!0].includes(e.modelValue)));watch((()=>e.modelValue),(e=>{l.value&&(l.value.checked=a.value)}));return onMounted((()=>{l.value&&(l.value.checked=a.value)})),{input:l,hadValue:o,isChecked:a,change:()=>{if(!e.readonly){const a=l.value.checked,r=a?e.value||a:e.valueFalse??a;r&&(o.value=1),t("update:modelValue",r)}},getLabel:computed((()=>e.label||("string"==typeof e.value?e.value:"")))}}});const _hoisted_1$f=["innerHTML"],_hoisted_2$8=["checked","value"];function render$i(e,t,l,o,a,r){return openBlock(),createElementBlock("label",{style:{"font-weight":"normal !important",display:"block"},class:"v-checkbox",onClick:t[1]||(t[1]=withModifiers((()=>{}),["stop"]))},[createElementVNode("span",{innerHTML:e.getLabel},null,8,_hoisted_1$f),createElementVNode("input",{ref:"input",type:"checkbox",checked:e.isChecked,onChange:t[0]||(t[0]=(...t)=>e.change&&e.change(...t)),value:e.value},null,40,_hoisted_2$8),t[2]||(t[2]=createElementVNode("span",{class:"checkmark"},null,-1))])}script$m.render=render$i,script$m.__file="src/v-checkbox.vue";var script$l={name:"VDataview",props:{value:Array,filterKey:String,src:String,filters:Object,store:null,itemWidth:null,rowKey:String,rowStyleClass:null,pagination:null,selectable:Boolean,scrollable:Boolean,autoload:{type:Boolean,default:!0}},data:function(){return{data:null,pages:1,page:1,columns:1,w:0,row:{},error:null,size:null,sortKey:"",selected:[],sortOrders:{},rowStyleClassFunc:null}},created(){var me=this;try{me.rowStyleClass&&(eval("me.rowStyleClassFunc=function(row,item,index){return "+me.rowStyleClass+"}"),me.rowStyleClassFunc({},{},0))}catch(e){me.rowStyleClassFunc=null,console.log("Error en la expresion rowStyleClassFunc=function(row,item,index){return "+me.rowStyleClass+"}")}},updated(){console.log("updated"),this.$emit("updated"),this.resize()},mounted(){var e=this;e.$el.addEventListener("parentResize2",e.resize),e.autoload&&e.load(),e.resize()},methods:{resize(){var e=this;if(e.itemWidth){var t=1+Math.trunc(e.$el.offsetWidth/Number(e.itemWidth));t>6&&(t=6),e.columns=t}},async getStoredList(e){let t=new Promise((t=>{var l=window._.db.transaction(e).objectStore(e).getAll();l.onsuccess=function(){t(l.result)}}));return await t},async loadStore(){let e=this,t=e.store;if(null!=t){let l;return window._.db&&(l=await e.getStoredList(t)),l||(l=[]),e.data=e.data?l.concat(e.data):l,console.log("loadStore"),console.log(e.data),e.data}},getRowClass(e,t){var l=this,o=t%l.columns+1,a=["c-w-"+l.columns];return o==l.columns&&a.push("v-last"),l.rowStyleClassFunc?a.push(l.rowStyleClassFunc(e,e,t)):a.push(l.rowStyleClass),a},remove(e){e=e.id?e.id:e;var t=this.data,l=t.map((e=>e.id)).indexOf(e);t.splice(l,1)},error2(e,t){this.data=[],this.error=t},load(e){var t=this;if(this.selected=[],t.value)t.data=t.value;else{!0===e&&(t.page=1);var l=t.src;l||(l=t.$root.apiLink(window.location.pathname)),l.endsWith("/")&&(l=l.slice(0,l.length-1)),t.pagination&&(l+="/"+(t.page-1)*t.pagination+"/"+t.pagination),axios.get(l,{error:t.error2,params:t.filters}).then((function(l){if(l.data&&l.data.error)MsgBox(l.data.error);else{var o=t.value?t.value:l.data.data?l.data.data:l.data;t.data||(t.data=[]),t.data=!0===e?o:t.data?t.data.concat(o):t.data,t.size=l.data.size,l.data&&l.data.size&&(t.pages=Math.ceil(l.data.size/t.pagination),t.page>t.pages&&(t.page=1)),t.$emit("loaded",{target:t,response:l})}})).catch(t.error)}}}};const _hoisted_1$e={class:"v-dataview"};function render$h(e,t,l,o,a,r){return openBlock(),createElementBlock("div",_hoisted_1$e,[e.data?(openBlock(!0),createElementBlock(Fragment,{key:0},renderList(e.data,((t,l)=>(openBlock(),createElementBlock("div",{class:normalizeClass(r.getRowClass(t,l))},[renderSlot(e.$slots,"default",{row:t,item:t,index:l})],2)))),256)):createCommentVNode("v-if",!0),e.data&&!e.data.length?(openBlock(),createElementBlock("div",{key:1,class:normalizeClass(["center v-no-results",{error:e.error}])},toDisplayString(e.error?e.error:"No existen registros para mostrar"),3)):createCommentVNode("v-if",!0),e.data&&e.size>e.data.length?(openBlock(),createElementBlock("div",{key:2,onClick:t[0]||(t[0]=t=>r.load(e.page++)),class:"center v-more-results"},"Ver mas resultados")):createCommentVNode("v-if",!0)])}script$l.render=render$h,script$l.__file="src/v-dataview.vue";var script$k={name:"VFieldset",props:{legend:String,closable:null},watch:{closed(e){this.$emit("change",{target:this,closed:e}),this.$emit("input",!e)}},data:()=>({closed:!1}),created(){this.closed=this.closable},mounted(){var e=this;e.$el.addEventListener("parentResize",(t=>{t.$target=e,e.$emit("resize",t)}))},updated(){var e=this;setTimeout((function(){var t=e.$el.querySelector("legend > * > svg");if(t)try{console.log(),t.dataset.icon=t.parentNode.dataset.icon}catch(e){console.log("icon"),console.log(e)}}),50)}};const _hoisted_1$d={class:"v-fieldset"},_hoisted_2$7=["data-icon"],_hoisted_3$4=["innerHTML"],_hoisted_4$2={style:{flex:"1",display:"flex","flex-direction":"column"}};function render$g(e,t,l,o,a,r){return openBlock(),createElementBlock("fieldset",_hoisted_1$d,[l.legend?(openBlock(),createElementBlock("legend",{key:0,onClick:t[0]||(t[0]=e=>a.closed=l.closable&&!a.closed),style:normalizeStyle({cursor:l.closable?"pointer":""})},[l.closable?(openBlock(),createElementBlock("span",{key:0,"data-icon":a.closed?"plus":"minus",style:{margin:"0px 5px 0px 0px"}},[createElementVNode("i",{class:normalizeClass([a.closed?"fa-plus":"fa-minus","fa"])},null,2)],8,_hoisted_2$7)):createCommentVNode("v-if",!0),createElementVNode("span",{innerHTML:l.legend},null,8,_hoisted_3$4)],4)):createCommentVNode("v-if",!0),withDirectives(createElementVNode("div",_hoisted_4$2,[renderSlot(e.$slots,"default")],512),[[vShow,!a.closed]])])}script$k.render=render$g,script$k.__file="src/v-fieldset.vue";var script$j={name:"VForm",props:["header","store","action"],setup(e,t){const{store:l}=e,{slots:o,expose:a}=t,r=ref(null),n=inject("viewCollector");return provide("formCollector",{get:()=>({...e})}),n.push({store:l,type:"v-form",$el:r,$forceUpdate:()=>{}}),a({...e}),()=>{const t=[];return e.header&&t.push(h$1("div",{class:"v-widget-header v-panel-titlebar"},[h$1("span",{class:"v-panel-title"},e.header)])),t.push(h$1("div",{ref:r,class:"v-dialog-content v-widget-content"},[h$1("form",{action:e.action},o.default())])),h$1("div",{class:"ui-panel"},t)}},watch:{header(e){this.setTitle(e)}},data:()=>({timer:null}),methods:{setTitle(e){var t=this.$parent.app;t&&setTimeout((()=>{t.title=e}),100)},getAbsoluteHeight(e){var t=window.getComputedStyle(e),l=parseFloat(t.marginTop)+parseFloat(t.marginBottom);return Math.ceil(e.offsetHeight+l)}},mounted(){var e=this;e.$el.querySelector("form").addEventListener("submit",(t=>{t.preventDefault();var l=e.$parent;return l.refresh&&l.refresh(),!1})),e.setTitle(e.header)},updated(){for(var e=this.$el.querySelectorAll("[type=number]:not(._)"),t=0;t<e.length;t++){var l=()=>{var e=this,t=e.value;if(t){t=n(t),e.max&&t>n(e.max)&&(t=n(e.max)),e.min&&t<n(e.min)&&(t=n(e.min));var l=this.getAttribute("decimal");null!==l&&(t=t.toFixed(1*l)),e.value=t}};e[t].oninput=l,e[t].onblur=l,e[t].classList?e[t].classList.add("_"):e[t].className="_"}e=this.$el.querySelectorAll(".numeric:not(._)");for(t=0;t<e.length;t++)e[t].addEventListener("keyup",(e=>{86==e.keyCode&&isNaN(this.value)&&(this.value="")})),e[t].addEventListener("keydown",(e=>{console.log("eeeeeee"+e.keyCode),-1!==[46,8,9,27,13,110,88,86].indexOf(e.keyCode)||65===e.keyCode&&(!0===e.ctrlKey||!0===e.metaKey)||e.keyCode>=35&&e.keyCode<=40||(e.shiftKey||e.keyCode<48||e.keyCode>57)&&(e.keyCode<96||e.keyCode>105)&&e.preventDefault()})),e[t].classList?e[t].classList.add("_"):e[t].className="_"},__file:"src/v-form.vue"},script$i={name:"VGroup",props:{required:String,name:String},data:()=>({value:null,nam:null}),updated(){this.update2()},mounted(){this.update2()},created(){this.nam||(this.nam=this.$props.name?this.$props.name:"input_"+window._.id())},methods:{getInputs(e,t){var l=this;return e.children&&Array.from(e.children).forEach((e=>{"INPUT"==e.tagName?t.push(e):e.classList.contains("v-group")||l.getInputs(e,t)})),t},update2(){for(var e=this.getInputs(this.$el,[]),t=0;t<e.length;t++)e[t].value==this.$attrs.value?e[t].checked=!0:e[t].checked=!1},onChange(e){this.value=e,""===e&&(e=null),this.$emit("input",e)}}};const _hoisted_1$c={class:"v-group"};function render$f(e,t,l,o,a,r){return openBlock(),createElementBlock("div",_hoisted_1$c,[renderSlot(e.$slots,"default")])}script$i.render=render$f,script$i.__file="src/v-group.vue";var script$h={name:"VLayerControl",data:()=>({loaded:null,map:null,district:null,dl:null}),setup({baseURL:e="https://web.regionancash.gob.pe"},{emit:t}){const l=ref(),o=inject("collector"),a=ref(),r=ref();let n,s;return o.push((o=>{(o=>{r.value=o;let i=new Collection;l.value=i;let c=document.createElement("i");c.setAttribute("class","fa fa-expand"),o.addControl(new FullScreen({label:c,tipLabel:"Fullscreen"}));let d=new VectorSource({url:e+"/fs/geo/02.geojson",format:new GeoJSON}),u=a.value=new VectorLayer({source:d,style:e=>new Style({fill:new Fill({color:"rgba(255, 0, 0, 0.0)"}),stroke:new Stroke({color:"#4073CE",width:1}),text:new Text({text:e.values_.name?e.values_.name.toUpperCase():"",fill:new Fill({color:"#4073CE"}),stroke:new Stroke({color:"#4073CE",width:.5})})}),id:"provinces"});u.onChange=e=>{let t=e.feature;s!=t.getId()&&(i.clear(),i.push(t),e.preventDefault&&e.preventDefault(),s=t.getId(),n=t,o.getView().fit(t.getGeometry().getExtent(),{duration:200,callback:()=>{}}))};let p=d.on("change",(()=>{let e,t=d.getFeatures();for(let l=0;l<t.length;l++)if(1*t[l].id_==1*e){u.onChange({feature:t[l]});break}unByKey(p)})),m=new VectorLayer({preload:1/0,source:new VectorSource,id:"districts",style:e=>new Style({fill:new Fill({color:"rgba(16, 110, 138, 0.0)"}),stroke:new Stroke({color:"#194300",width:1}),text:new Text({text:e.values_.name?e.values_.name.toUpperCase():"",fill:new Fill({color:"#194300"}),stroke:new Stroke({color:"#194300",width:.5})})})});o.on("moveend",(()=>{if(n){if(n.id_<1e4){m.setSource(new VectorSource({url:e+"/fs/geo/"+n.id_+".geojson",format:new GeoJSON}));let t=m.getSource().on("change",(()=>{unByKey(t)}))}t("scope",{feature:n,target:{}}),n=null}})),u.onSelect=e=>{me.$emit("select",e)},o.addLayer(u),o.addLayer(new VectorLayer({id:"district",source:new VectorSource,style:new Style({fill:new Fill({color:"rgba(255, 150, 150, 0.0)"}),stroke:new Stroke({color:"#4073CE",width:1})})})),new Style({fill:new Fill({color:"rgba(16, 110, 138, 5.0)"})}),new Style({fill:new Fill({color:"rgba(255, 150, 150, 0.0)"})}),m.onChange=e=>{let t=e.feature;s!=t.getId()&&(2==i.getLength()&&i.pop(),i.push(t),e.preventDefault&&e.preventDefault(),s=t.getId(),n=t,o.getView().fit(t.getGeometry().getExtent(),{duration:300}))},m.onSelect=e=>{t("select",e)},o.addLayer(m),t("render",{map:o})})(o)})),{}}};function render$e(e,t,l,o,a,r){return openBlock(),createElementBlock("div",null,[renderSlot(e.$slots,"default")])}script$h.render=render$e,script$h.__file="src/v-layer-control.vue";var script$g={name:"VMapControl",setup(e,{emit:t}){const{visible:l}=e,o=ref(null),a=ref(!!l),r=inject("collector"),n=ref(null);r.push((e=>{e.addControl(new Control({element:o.value})),n.value=!0}));const s=ref();return{el:o,ready:n,visible0:a,enter:e=>{e.stopPropagation(),s.value?clearTimeout(s.value):t("click",e),s.value=setTimeout((()=>{s.value=null}),500)}}},props:{icon:String,visible:{default:1}},computed:{slotPassed(){return!!this.$slots.default}},data:()=>({slotUsed:!1}),updated(){var e=this.$el.querySelectorAll(":scope > :not(.v-map-control-button)").length;0==e&&(e=this.$el.textContent.trim().length),this.slotUsed=e},methods:{toggle(){this.visible0=!this.visible0}}};const _hoisted_1$b={ref:"el",class:"ol-unselectable ol-control"};function render$d(e,t,l,o,a,r){return withDirectives((openBlock(),createElementBlock("div",_hoisted_1$b,[renderSlot(e.$slots,"default"),a.slotUsed?createCommentVNode("v-if",!0):(openBlock(),createElementBlock("button",{key:0,class:"v-map-control-button",onClick:t[0]||(t[0]=withModifiers(((...e)=>o.enter&&o.enter(...e)),["prevent"]))},[l.icon?(openBlock(),createElementBlock("i",{key:0,class:normalizeClass(["fa fa-xs",l.icon])},null,2)):createCommentVNode("v-if",!0)]))],512)),[[vShow,o.ready&&!0]])}script$g.render=render$d,script$g.__file="src/v-map-control.vue";class Drag extends PointerInteraction{constructor(){super({handleDownEvent:handleDownEvent,handleDragEvent:handleDragEvent,handleMoveEvent:handleMoveEvent,handleUpEvent:handleUpEvent}),this.layers_=[],this.coordinate_=null,this.listeners_=[],this.cursor_="pointer",this.feature_=null,this.previousCursor_=void 0}addLayers(e){e.forEach((e=>{this.layers_.push(e)}))}$on(e,t){this.listeners_.push(t)}}function handleDownEvent(e){const t=e.map,l=this.layers_,o=t.forEachFeatureAtPixel(e.pixel,(function(e,t){if(t&&l.indexOf(t)>-1)return[e,t]}));return o&&(this.coordinate_=e.coordinate,this.feature_=o[0]),!!o}function handleDragEvent(e){const t=e.coordinate[0]-this.coordinate_[0],l=e.coordinate[1]-this.coordinate_[1];this.feature_.getGeometry().translate(t,l),this.coordinate_[0]=e.coordinate[0],this.coordinate_[1]=e.coordinate[1]}function handleMoveEvent(e){if(this.cursor_){const t=e.map,l=this.layers_,o=t.forEachFeatureAtPixel(e.pixel,(function(e,t){if(t&&l.indexOf(t)>-1)return e})),a=e.map.getTargetElement();o?a.style.cursor!=this.cursor_&&(this.previousCursor_=a.style.cursor,a.style.cursor=this.cursor_):void 0!==this.previousCursor_&&(a.style.cursor=this.previousCursor_,this.previousCursor_=void 0)}}function handleUpEvent(){return this.listeners_.forEach((e=>{e({feature:this.feature,coordinate:this.coordinate_})})),this.coordinate_=null,this.feature_=null,!1}var script$f={name:"VMap",setup(e,{emit:t,expose:l}){const o=ref(null),a=ref(null),r=ref(null),n=ref(null),s=reactive([]);provide("collector",{remove(e){s.splice(s.indexOf(e),1)},push(e){s.push(e)}});const i=e=>{a.value.addLayer(e),t("addlayer",e)},c=(e,l)=>{let o,r;e=e||{};const n=a.value;e.lon&&e.lat?(r=[e.lon,e.lat],o=new Point(r[0]>-100?fromLonLat(r):r)):o=new Point(n.getView().getCenter()),r=o.flatCoordinates;const s=r[0]<-1e4?toLonLat(r):r;t("translateend",{lon:s[0],lat:s[1]}),e.geometry=o;const i=new Feature(e);i.data=e,"object"==typeof e.style?i.setStyle(e.style):i.setStyle(n.styleMap[e.style?e.style:"default"]),r=o.flatCoordinates,r=r[0]<-1e4?toLonLat(r):r,t("translateend",{lon:r[0],lat:r[1]});const c=e.layer||"default";let d=n.getLayerById(c);if(d?d.getSource().addFeatures(i):n.addLayer(d=new VectorLayer({id:c,source:new VectorSource({features:new Collection([i])})})),e.draggable){let e=n.drag;e||(n.drag=e=new Drag,e.$on("up",(({coordinate:e,feature:l})=>{const o=toLonLat(e);t("translateend",{lon:o[0],lat:o[1],feature:l})})),n.addInteraction(e),e.addLayers([d]))}return l&&n.getView().animate(Object.assign({center:i.getGeometry().getCoordinates(),zoom:17,duration:500},l)),i},d=e=>{const l={default:new Style({image:new Circle({radius:8,stroke:new Stroke({color:"#8a0000",width:2}),fill:new Fill({color:"#ff0000"})})}),star:[new Style({image:new RegularShape({fill:new Fill({color:"#ff0000"}),stroke:new Stroke({color:"#8a0000",width:2}),points:5,radius:10,radius2:4,angle:0})})]};let o=((e,t)=>{t||(t=window.location.href);const l=new RegExp("[?&]"+e+"=([^&#]*)").exec(t);return l&&l[1]||0})("location"),i=-1;if(o){let e=o.split("/");o=[parseFloat(e[0]),parseFloat(e[1])],i=e[2],r.value=!0}else o=!1;const d=new Map({target:e,layers:[new Tile({source:new OSM})],view:new View({center:[0,0],zoom:2})});d.getLayerById=function(e="default"){let t;return d.getLayers().forEach((l=>{l.get("id")!==e||(t=l)})),t},d.styleMap=l,r.value?(d.getView().setCenter(o),console.log("en el momento de cargar moved to pageLocation="+o),d.getView().setZoom(i||12),a.value=d,console.log("distarar evento buid pageLocation="+o),t("build",m)):(d.getView().fit([-8756221.995832639,-1207995.483261405,-8541070.763947014,-899052.0546471546],d.getSize()),a.value=d,t("build",{map:d}),s.forEach((e=>{e(d)}))),d.getView().getZoom(),d.on("moveend",(()=>{n.value&&(n.value(m),n.value=null),d.getView().getZoom()})),d.on("singleclick",(e=>{let t=d.forEachFeatureAtPixel(e.pixel,((e,t)=>{if(t)return[e,t]}));if(t){let l=t[1],o=t[0];if(e.feature=o,e.map=d,e.preventDefault(),l.onSelect)return void l.onSelect(e)}})),d.on("dblclick",(e=>{let l=d.forEachFeatureAtPixel(e.pixel,((e,t)=>{if(t)return[e,t]}));if(l){let o=l[1];if(l=l[0],e.feature=l,e.map=d,o.onChange)return void o.onChange(e);t("change",l),d.getView().animate({center:l.getGeometry().getCoordinates(),zoom:17,duration:500},(()=>{for(let t=0;t<m.$children.length;t++){let t=m.$children[0];t.open&&t.open(e)}}))}})),a.value=d,setTimeout((()=>{d.updateSize(),d.getView().fit([-8756221.995832639,-1207995.483261405,-8541070.763947014,-899052.0546471546],d.getSize()),a.value=d,t("build",{map:d,addFeature:c})}),100)};return watch(o,(e=>{e&&nextTick((()=>{t("beforeBuild"),d(e)}))})),l({addFeature:c,addLayer:i,map:a,empty:(e="default")=>{if(e=a.value.getLayerById(e)){const t=e.getSource();if(t instanceof VectorSource){return 0===t.getFeatures().length}}return!0}}),{el:o,addLayer:i,addFeature:c}},data:()=>({moved:!1,map:null,movingCompleted:null,styleMap:null,coordinate:{}})};const _hoisted_1$a={ref:"el"};function render$c(e,t,l,o,a,r){return openBlock(),createElementBlock("div",_hoisted_1$a,[renderSlot(e.$slots,"default")],512)}script$f.render=render$c,script$f.__file="src/v-map.vue";var script$e={name:"VNumber",props:{value:Number,max:Number,min:Number,delay:Number},setup(e,t){const{emit:l}=t,o=ref(null);onMounted((()=>{o.value=e.value})),onUpdated((()=>{o.value=t.attrs.modelValue}));return{v:o,handleInput:t=>{let a=o.value;const r=t.target.getAttribute("decimal");null!==a?(a=num(a),e.max&&a>num(e.max)&&(a=num(e.max)),e.min&&a<num(e.min)&&(a=num(e.min)),null!==r&&(a=a.toFixed(Number(r)))):a=null,o.value=t.target.value;let n=_$1.calendarTimer;n&&clearTimeout(n),e.delay?_$1.calendarTimer=setTimeout((()=>{l("input",a),_$1.calendarTimer=null}),13===t.keyCode?0:e.delay):l("input",a)}}}};function render$b(e,t,l,o,a,r){return withDirectives((openBlock(),createElementBlock("input",{type:"number",onKeyup:t[0]||(t[0]=withKeys(((...e)=>o.handleInput&&o.handleInput(...e)),["enter"])),"onUpdate:modelValue":t[1]||(t[1]=e=>o.v=e),onInput:t[2]||(t[2]=(...e)=>o.handleInput&&o.handleInput(...e)),class:"_"},null,544)),[[vModelText,o.v,void 0,{number:!0}]])}script$e.render=render$b,script$e.__file="src/v-number.vue";var script$d={setup(e,t){const l=e,{valueField:o,displayField:a,store:r,filter:n,name:s}=l,{expose:i,emit:c}=t,d=ref([]),u=ref([]),p=ref([]);ref(null);const m=inject("collect");o&&(p.value=o.split("."));const h=computed((()=>{const e=(l.data||[]).concat(u.value||[]);return n?e.filter((e=>-1!==JSON.stringify(e).toLowerCase().indexOf(n.toLowerCase()))):e}));watch(h,(e=>{}));const v=(e,t)=>{const l=p.value;if(l&&l.length)for(let t=0;t<l.length;t++)e&&(e=e[l[t]]);else e&&!t&&(e=e.id?e.id:e.code?e.code:e);return e};let f=o,g=a;g||(g=f);const y=async(e=null,t=null,l=!1)=>{if(!l&&t&&e&&d.value.push([e,t]),!(d.value.length>1)){if(u.value=[],r){let t=await getStoredList(r);const[l]=e?Object.keys(e):[];if(l){let o;try{const a=t.filter((t=>(o=t,o[l].startsWith(e[l]))));u.value=a}catch(e){log(s,"options.error trying to filter ",o),console.error(e)}}else u.value=u.value.concat(t)}for(m(h),l||d.value.shift();d.value.length;){const e=d.value.shift()||[];await y(e[0],e[1],!0)}}};return y.getObjectByIndex=e=>{const t=h.value;return t?t[e]:null},y.getValueByIndex=e=>{const t=h.value;return t?v(t[e],1):null},y.getIndexByValue=(e,t)=>{e&&e.id?e=e.id:e&&e.code&&(e=e.code);for(let l=0;l<h.value.length;l++){const o=h.value[l];if(v(o)==e)return t&&t(l,o),l}return t&&t(-1),-1},m.push(y),onUpdated((()=>{m((l.data||[]).concat(u.value))})),onUnmounted((()=>{m.remove(y)})),i({load:y}),()=>h.value.map((e=>{const t=g?e[g]:e;return h$1("option",f?{value:v(e)}:{value:e.id||e.code||JSON.stringify(e)},t)}))},name:"VOptions",props:{url:String,src:String,name:String,displayField:String,data:Array,store:null,valueField:String,filters:null,filter:null,mode:null},updated(){let e=this;!e.loaded&&e.data&&(e.data2=e.data)},methods:{getParentE(){return this.$el.parentElement.parentElement},getSelectedItem(){let e=this.$el.parentElement;return this.filterList[e.selectedIndex-1]}},__file:"src/v-options.vue"},ol=window.ol,_=window._,axios$1=window.axios,script$c={name:"VOverlay",props:{value:{value:Object},src:String,width:{default:400},header:String},data:()=>({coordinate:null,overlay:null,location:null,ele:null,c:0}),created(){var e=this;e.$parent.$on("beforeBuild",(t=>{console.log(t),e.overlay=new ol.Overlay({element:e.$el,positioning:"bottom-right"})})),e.$parent.$on("build",(t=>{t.map.addOverlay(e.overlay)}))},mounted(){var e=this;e.header&&e.$el.childNodes[0].addEventListener("mousedown",(function(t){const l=e.$el.parentElement;var o=window.getComputedStyle(l),a=parseFloat(o.left),r=parseFloat(o.top),n=t.clientX,s=t.clientY,i=l.parentElement;function c(e){l.style.left=a+e.clientX-n+"px",l.style.top=r+e.clientY-s+"px"}i.addEventListener("mousemove",c,!1),i.addEventListener("mouseup",(function(){i.removeEventListener("mousemove",c,!1)}),!1)}),!1)},methods:{close(){this.overlay&&this.overlay.setPosition()},hasSlot(e="default"){return!!this.$slots[e]||!!this.$scopedSlots[e]},load(){var e=this;axios$1.get(_.remoteServer+e.src).then((t=>{e.$emit("input",t.data)}))},open(e){for(var t=this,l=e.map,o=e.feature,a=t.overlay,r=a.element,n=t.$parent.$children,s=0;s<n.length;s++)n[s].close&&(n[s].$el.style.opacity=0,n[s].close());e.coordinate?t.coordinate=e.coordinate:(e.coordinate=l.getView().getCenter(),t.coordinate=null),a.setPosition(e.coordinate);var i=l.getView().getCenter(),c=l.getView().getResolution(),d=o?o.getGeometry().getCoordinates():[null],u=l.getPixelFromCoordinate(Number(d[0])?d:e.coordinate);if(this.src)axios$1.get(_.remoteServer+this.src).then((e=>{t.$emit("input",e.data),t.c++,setTimeout((function(){var e=l.viewport_.offsetWidth,o=l.viewport_.offsetHeight,n=r.children[0].children[1];n.scrollTop=0;var s=r.offsetHeight;n.style.height=s+100>=o?o-100-r.children[0].children[0].offsetHeight+"px":"300px",s=r.offsetHeight;var d=1*t.width,p=e<=d+40?e-40:d;if(r.style.zIndex=10,r.style.width=p+"px",p/=2,l.getView().animate({center:[i[0]+(u[0]+p+20>=e?+(u[0]+p+20-e):u[0]-20-p<0?-p+u[0]-20:0)*c,i[1]+(u[1]<s?s-u[1]:0)*c],duration:500}),u[0]=u[0]+p-0,u[1]=u[1]-12,a.setPosition(l.getCoordinateFromPixel(u)),t.$el.style.opacity=1,_.mobil)for(var m=a.getElement().querySelectorAll("a:not(._)"),h=0;h<m.length;h++)m[h].addEventListener("click",_.open2)}),400)})).catch((e=>{console.log(e)}));else{var p=l.viewport_.offsetWidth,m=l.viewport_.offsetHeight,h=r.children[0].children[1];h.scrollTop=0;var v=r.offsetHeight;console.log(r.offsetHeight),h.style.height=v+100>=m?m-100-r.children[0].children[0].offsetHeight+"px":"300px",v=r.offsetHeight;var f=1*t.width,g=p<=f+40?p-40:f;if(r.style.zIndex=10,r.style.width=g+"px",g/=2,l.getView().animate({center:[i[0]+(u[0]+g+20>=p?+(u[0]+g+20-p):u[0]-20-g<0?-g+u[0]-20:0)*c,i[1]+(u[1]<v?v-u[1]:0)*c],duration:500}),u[0]=u[0]+g-0,u[1]=u[1]-12,a.setPosition(l.getCoordinateFromPixel(u)),t.$el.parentNode.style.opacity=0,t.$el.style.opacity=1,t.$el.parentNode.style.top=(m-t.$el.offsetHeight)/2+"px",t.$el.parentNode.style.opacity=1,_.mobil){var y=a.getElement().querySelectorAll("a:not(._)");for(s=0;s<y.length;s++)y[s].addEventListener("click",_.open2)}t.$emit("opened",{target:t})}}}};const _hoisted_1$9={class:"v-ol-overlay"},_hoisted_2$6={key:0,class:"v-panel-titlebar"},_hoisted_3$3={key:2,style:{"text-align":"center"}};function render$a(e,t,l,o,a,r){return openBlock(),createElementBlock("div",_hoisted_1$9,[l.header?(openBlock(),createElementBlock("div",_hoisted_2$6,[createElementVNode("span",{class:"v-icon v-icon-close",onClick:t[0]||(t[0]=(...e)=>r.close&&r.close(...e))},t[1]||(t[1]=[createElementVNode("i",{class:"fa fa-times"},null,-1)])),createTextVNode(toDisplayString(l.header),1)])):createCommentVNode("v-if",!0),(openBlock(),createElementBlock("div",{class:"v-ol-body",key:"c-"+a.c,style:{padding:"10px"}},[l.value?renderSlot(e.$slots,"default",{key:0,value:l.value}):createCommentVNode("v-if",!0)])),r.hasSlot("footer")&&l.value?(openBlock(),createElementBlock("footer",{key:"f-"+a.c},[renderSlot(e.$slots,"footer",{value:l.value})])):createCommentVNode("v-if",!0),a.coordinate?(openBlock(),createElementBlock("div",_hoisted_3$3,t[2]||(t[2]=[createElementVNode("img",{src:_imports_0,width:"20",height:"18"},null,-1)]))):createCommentVNode("v-if",!0)])}script$c.render=render$a,script$c.__file="src/v-overlay.vue";var script$b={name:"VPanel",props:{header:String}};const _hoisted_1$8={class:"ui-panel"},_hoisted_2$5={key:0,class:"v-panel-titlebar v-widget-header ui-helper-clearfix ui-corner-all"},_hoisted_3$2={class:"v-panel-title"},_hoisted_4$1={class:"v-panel-content v-dialog-content v-widget-content"};function render$9(e,t,l,o,a,r){return openBlock(),createElementBlock("div",_hoisted_1$8,[l.header?(openBlock(),createElementBlock("div",_hoisted_2$5,[createElementVNode("span",_hoisted_3$2,toDisplayString(l.header),1)])):createCommentVNode("v-if",!0),createElementVNode("div",_hoisted_4$1,[renderSlot(e.$slots,"default")])])}script$b.render=render$9,script$b.__file="src/v-panel.vue";var script$a={name:"VPopup",data:()=>({show:null,overlay:null}),mounted(){var e=this;e.$el.addEventListener("close",(function(){e.hide()}))},destroyed(){var e=this.overlay;e&&(e.style.visibility="hidden",e.style.opacity=0,e.remove(),e=null)},methods:{hide(){var e=this.overlay;e&&(e.style.visibility="hidden",e.style.opacity=0),this.show=0},toggle(){var e=this;e.show=!e.show;var t=e.overlay;if(e.show){var l=document.querySelector(".v-layout-north");e.$el.style.top=l.offsetHeight+"px",console.log(e.$el),t||((t=document.createElement("div")).classList.add("v-overlay"),t.style.padding="40px",t.addEventListener("click",(function(){t.style.visibility="hidden",t.style.opacity=0,e.show=!1})),document.body.appendChild(e.overlay=t)),t.style.visibility="unset",t.style.opacity="unset"}else this.hide()}}};const _hoisted_1$7={class:"v-popup",style:{position:"absolute"}};function render$8(e,t,l,o,a,r){return withDirectives((openBlock(),createElementBlock("div",_hoisted_1$7,[renderSlot(e.$slots,"default")],512)),[[vShow,a.show]])}script$a.render=render$8,script$a.__file="src/v-popup.vue";var script$9={name:"VRadio",props:{value:String,label:String,className:String},methods:{getClass(){return"v-radio "+this.className}},mounted(){var e=this,t=e.$el.querySelector("input");e.$parent&&e.$parent.nam&&(t.name=e.$parent.nam),t.onclick=function(){}},updated(){this.$el.querySelector("input")}};const _hoisted_1$6=["value"];function render$7(e,t,l,o,a,r){return openBlock(),createElementBlock("label",{class:normalizeClass(r.getClass())},[createTextVNode(toDisplayString(l.label?l.label:l.value)+" ",1),createElementVNode("input",{type:"radio",value:l.value},null,8,_hoisted_1$6),t[0]||(t[0]=createElementVNode("span",{class:"checkmark"},null,-1)),renderSlot(e.$slots,"default")],2)}script$9.render=render$7,script$9.__file="src/v-radio.vue";var script$8={__name:"v-radio-group",props:{required:String,name:String,modelValue:String,items:{type:Array},type:{type:String,default:"radio"},label:{type:String,default:""}},emits:["update:modelValue"],setup(e,{emit:t}){const l=e,o=t,a=ref(l.modelValue),{proxy:r}=getCurrentInstance(),n=new Set,s=(e,t)=>(e.children&&Array.from(e.children).forEach((e=>{"INPUT"===e.tagName?t.push(e):e.classList&&e.classList.contains("v-group")||s(e,t)})),t),i=()=>{const e=s(r.$el,[]);let t=l.name;t||(t="input_"+Date.now().toString(36)+Math.random().toString(36).substring(2,15));const o=""===r.$props.required||r.$props.required;let i=!1;for(let l=0;l<e.length;l++)e[l].name=t,n.has(e[l])||(e[l].addEventListener("change",c),n.add(e[l])),e[l].checked=e[l].value===a.value,e[l].checked&&(i=!0),e[l].required=o,o&&(a.value?e[l].nextElementSibling.classList.remove("required"):e[l].nextElementSibling.classList.add("required"));i&&removeError(e[0].parentNode.parentNode)},c=e=>{let t=e.target.value;""===t&&(t=null),a.value=t,o("update:modelValue",t)};watch((()=>l.modelValue),(e=>{a.value=e,i()})),onMounted((()=>{i()})),onUpdated((()=>{i()}));const d=()=>{const e=[];return r.$slots.default&&e.push(...r.$slots.default()),l.items&&e.push(...l.items.map((e=>h$1(script$9,{className:l.required&&!l.modelValue?"required":null,...e,modelValue:a.value,"onUpdate:modelValue":c})))),h$1("div",{class:"v-radio-group"},[l.label&&h$1("label",l.label),...e])};return(e,t)=>(openBlock(),createBlock(d))},__file:"src/v-radio-group.vue"},script$7={name:"VSelect",setup(e,t){const{slots:l,emit:o}=t,{valueField:a,disabled:r,readonly:n,autoload:s,name:i}=e,c=ref([]),d=ref([]),u=ref(null),p=ref([]),m=[],h=ref(!(s+""=="false"||1*s==0)),v=ref(null),f=t=>{c.value=t,nextTick((()=>{g(e.modelValue||u.value)}))},g=t=>{let l=t||e.modelValue;if(v.value){let t=v.value,a=t.selectedIndex;l&&""!==l||(t.selectedIndex=0),log(i,"value===",l);const r=l?""+(l.id||l.code||l):l;for(let e=0;e<t.length;e++)t[e].value===r&&(t.selectedIndex=e);const n=m;for(let r=0;r<n.length;r++){if(!n[r].getValueByIndex)continue;let s=n[r].getValueByIndex(a-1);n[r].getIndexByValue(l,((a,d)=>{if(a>-1){let d=n[r].getObjectByIndex(a),p=Number(s);p=isNaN(p)?s?!!l&&(l.id?l.id==s.id:l==s):!l:p==Number(l),u.value!=e.modelValue&&(log(i,"select.value",l,"object=",d),e.modelValue&&(u.value=e.modelValue),p||(log(i,"select.updateSelect="+l+" "+JSON.stringify(c.value.length)),t.selectedIndex=a+1,o("update:modelValue",l,{value:l,select:t,object:d}),nextTick((()=>{o("input",l,{value:l,select:t,object:d})}))))}else e.modelValue&&(u.value=e.modelValue),log(i,"select.updateselect.not fout",a),o("update:modelValue",null,null),nextTick((()=>{o("input",null,{value:null})})),t.selectedIndex=0}))}}};f.remove=e=>{const t=m.filter((t=>t!==e));m.length=0,t.forEach((e=>m.push(e)))},f.push=e=>{m.push(e)},a&&(d.value=a.split(".")),provide("collect",f);watch((()=>e.modelValue),((e,t)=>{e!=t&&g()})),watch((()=>e.disabled),((e,t)=>{y(e,t)}));const y=(e,t)=>{e=!!e,t=!!t;let l=p.value;log(i,"activate.newVal=",e,"oldVal=",t),!e&&!e===t&&l.length&&$(l[0],l[1])},$=(t,l)=>{e.disabled?(log(i,"select.load.params=",t),p.value=[t,l],m.forEach((e=>{e(t,l)}))):(p.value=[],m.forEach((e=>{e(t,l)})))};return onMounted((()=>{h.value&&$()})),{options:c,getValueField:(e,t)=>{const l=d.value;if(l&&l.length)for(let t=0;t<l.length;t++)e&&(e=e[l[t]]);else e&&!t&&(e=e.id?e.id:e.code?e.code:e);return e},onChange:e=>{e.stopPropagation();let t=e.target.value;const l=v.value;log(i,"select.onchange=",t),t&&""!==t||(t=null,l.selectedIndex=0);let a,r=0;const n=c.value;for(let e=0;e<m.length;e++){if(r=m[e].getValueByIndex(l.selectedIndex-1),-1!=r){a=m[e].getObjectByIndex(l.selectedIndex-1);break}r=0}r?(log(i,"change=found=",r),t=r):n.length&&(l.selectedIndex=0),o("update:modelValue",t,{value:t,select:l,object:a}),nextTick((()=>{o("input",t,{value:t,select:l,object:a})}))},selectRef:v,load:$,lastLoad:p,autoload_:h}},props:{modelValue:null,required:null,readonly:null,multiple:null,label:null,name:null,disabled:null,autoload:null,valueField:null},data:()=>({autoload_:!0,ik:0,data:[],popup:null,show:!1,sel:[],sela:null,tmp:[],sel2:[]}),watch:{show(e){let t=this;if(e){let e=this.$refs.button,l=this.popup;l||(l=this.$refs.popup,l.style.position="absolute",document.body.append(l));let o=e.getBoundingClientRect();const a=l.children[0];window.innerWidth<400?(l.style.padding="40px",l.style.height="100%",a.style.height="100%"):(l.style.top=o.bottom+0+"px",l.style.left=o.left+0+"px",l.style.maxHeight=window.innerHeight-o.bottom-30+"px",a.style.maxHeight=l.style.maxHeight),a.style.display="flex",a.style.flexDirection="column",t.tmp=t.sel.sort().join(",")}else{let e=t.sel;"TH"!=t.$el.parentNode.tagName&&e&&e.length?e=e.join(","):e&&0==e.length&&(e=null),t.tmp!==t.sel.sort().join(",")&&t.$parent.load&&t.$parent.load()}}}};const _hoisted_1$5={class:"v-select",style:{position:"relative"}},_hoisted_2$4=["required","disabled","click"],_hoisted_3$1={style:{border:"1px solid lightgray","background-color":"white",padding:"5px"}},_hoisted_4={class:"_ ui-widget ui-state-default ui-corner-all",style:{padding:"3px 3px 1px 3px","margin-bottom":"5px"}},_hoisted_5={class:"center",style:{"padding-top":"4px"}};function render$6(e,t,l,o,a,r){const n=resolveComponent("v-checkbox"),s=resolveComponent("v-checkbox-group"),i=resolveComponent("v-button");return openBlock(),createElementBlock("div",_hoisted_1$5,[l.readonly?createCommentVNode("v-if",!0):withDirectives((openBlock(),createElementBlock("select",{key:0,style:{width:"100%"},ref:"selectRef",onChange:t[0]||(t[0]=(...e)=>o.onChange&&o.onChange(...e)),required:l.required,disabled:l.disabled,click:e.expand},[renderSlot(e.$slots,"default")],40,_hoisted_2$4)),[[vShow,!l.multiple]]),l.multiple?(openBlock(),createElementBlock(Fragment,{key:1},[createElementVNode("div",{class:normalizeClass(["v-widget-header",{"v-selected":a.show}]),ref:"button",style:{"padding-top":"3px","padding-bottom":"3px"},onClick:t[1]||(t[1]=(...t)=>e.toggle&&e.toggle(...t))},"   ",2),withDirectives(createElementVNode("div",{ref:"popup",onClick:t[4]||(t[4]=(...t)=>e.close&&e.close(...t)),style:{"background-color":"#0000009c"}},[createElementVNode("div",_hoisted_3$1,[createElementVNode("div",_hoisted_4,[createVNode(n,{modelValue:a.sela,"onUpdate:modelValue":t[2]||(t[2]=e=>a.sela=e),onInput:e.selectAll},null,8,["modelValue","onInput"])]),(openBlock(),createBlock(s,{class:"v-select-checkbox-group",style:{"overflow-y":"auto"},key:"p"+a.ik,modelValue:a.sel,"onUpdate:modelValue":t[3]||(t[3]=e=>a.sel=e),onInput:e.checkboxInput},{default:withCtx((()=>[a.data.length?(openBlock(!0),createElementBlock(Fragment,{key:0},renderList(a.data,(e=>(openBlock(),createElementBlock("div",null,[createVNode(n,{value:e.value,label:e.label},null,8,["value","label"])])))),256)):createCommentVNode("v-if",!0)])),_:1},8,["modelValue","onInput"])),createElementVNode("div",_hoisted_5,[createVNode(i,{icon:"fa-sync",value:"Filtrar"})])])],512),[[vShow,a.show]])],64)):createCommentVNode("v-if",!0),l.readonly?(openBlock(),createElementBlock(Fragment,{key:2},[createTextVNode(toDisplayString(l.label?l.label:"---"),1)],64)):createCommentVNode("v-if",!0)])}script$7.render=render$6,script$7.__file="src/v-select.vue";var script$6={name:"VSwitch",props:{value:{value:Object}},data:()=>({options:["NO","SI"],selected:null}),mounted(){var e=this,t=""+e.value;e.selected="true"===t?"SI":"false"===t?"NO":null,e.$emit("input",e.value)},updated(){var e=this,t=""+e.value;e.selected="true"===t?"SI":"false"===t?"NO":null,e.$emit("input",e.value)},methods:{onChange(e){this.selected=e,this.$emit("input","SI"===e||"NO"!==e&&null)}}};const _hoisted_1$4=["value","data-value"],_hoisted_2$3=["onClick"];function render$5(e,t,l,o,a,r){return openBlock(),createElementBlock("div",{value:!1===l.value?"false":l.value,"data-value":""+l.value},[(openBlock(!0),createElementBlock(Fragment,null,renderList(a.options,(e=>(openBlock(),createElementBlock("div",{onClick:t=>r.onChange(e),style:normalizeStyle("cursor:pointer;border: 1px solid #000;text-align:center;display:inline-block;width:calc(50% - 2px)"+(e===a.selected?"":";opacity: 0.5")),class:normalizeClass({"v-selected":e==a.selected})},toDisplayString(e),15,_hoisted_2$3)))),256))],8,_hoisted_1$4)}script$6.render=render$5,script$6.__file="src/v-switch.vue";var script$5={name:"VTable",setup(e,t){const{autoload:l,src:o,rowKey:a,store:r,groups:n}=e,s=useAppStore(),i=inject("viewCollector"),c=inject("formCollector"),d=ref(1),u=ref(0),p=ref(null),m=ref(1),h=ref([]),v=ref([]),f=ref(null),g=ref(1),y=computed((()=>{const t=e,l=v.value;let o,a;return l.sum=sum,l.filter((e=>{for(var l in t.filters)if(o=t.filters[l],"function"==typeof o){if(!o(e))return 0}else if(o&&"string"==typeof o&&l in e&&(a=e[l],"string"==typeof a&&(a=a.toUpperCase().normalize("NFD").replace(/[\u0300-\u036f]/g,""),!a.includes(o.toUpperCase()))))return 0;return 1}))})),$=computed((()=>{let e=y.value;return e=f?e.sort(((e,t)=>{t=(t=t[f])||0,e=e[f];const l=Number(e);return l&&(e=l),e<t?-1*g:e>t?1*g:0})):e,e.sum=sum,e})),b=computed((()=>{const e=function(e){return this.reduce(((t,l)=>"number"==typeof e||"string"==typeof e?t+(l[e]||0):t),0)};Array.prototype.sum=e;const t={},l=n;return l?$.value.forEach((o=>{const a=o[l];if(!t[a]){const l=[];l.sum=e,t[a]=l}t[a].push(o)})):$.value.length&&(t[""]=$),Object.entries(t).map((([e,t])=>({name:e,values:t})))})),w=ref(1),k=ref(1),{slots:_,expose:S,emit:x}=t,E=getCurrentInstance(),C=async()=>{if(null!=r){let e;db&&(e=await getStoredList(r)),e||(e=[]),v.value=v.value?e.concat(v.value):e}return v.value},V=(e,t,l)=>{-10===t?y.value.length===h.value.length?h.value=[]:h.value=y.value.map((e=>e)):l?d.value||!h.value.includes(e)?h.value=[e]:(h.value=[],e=null):h.value.includes(e)?(h.value.splice(h.value.indexOf(e),1),e=null):h.value.push(e),x("row-select",{target:this,current:e,selection:h})},N=e=>h.value.includes(e),B=t=>{const l=[];return e.selectable&&N(t)&&l.push("v-selected"),e.rowStyleClass&&("string"==typeof e.rowStyleClass?l.push(e.rowStyleClass):e.rowStyleClass&&l.push(e.rowStyleClass(t))),l},I=(e,t)=>{L(e,t)},L=(e,t)=>{(w.value!=e||t)&&(w.value=e,A())};let T=""+e.selectable;d.value="false"!=T&&"0"!=T?1:0,T=""+e.scrollable,u.value=e.scrollable&&"false"!=T&&"0"!=T?1:0;const A=()=>{const t=e;if(h.value=[],t.value&&(v.value=t.value),o){let e=o;if(!e)return;e.endsWith("/")&&(e=e.slice(0,e.length-1));const l=t.pagination;if(l&&(e+="/"+(w.value-1)*l+"/"+l),networkStatus.connected){let a;if(t.gql){const e=t.gql,r="query{"+Object.keys(e)[0]+"(offset:"+(w.value-1)*l+" limit:"+l+"){\ndata{"+e[Object.keys(e)[0]]+"}\nsize\n}\n}";a=s.axios.post(o,{query:r})}else a=s.axios.get(e,{params:clean(t.filters)});a.then((e=>{if(e.data&&e.data.error)MsgBox(e.data.error);else{let o=e.data;t.gql&&(o=e.data.data[Object.keys(t.gql)[0]]),v.value=o.data||o,o&&o.hasOwnProperty("size")&&l&&(k.value=Math.ceil(o.size/l),w.value>k.value&&(w.value=1),t.size=o.size),C(),x("loaded",{target:t}),x("row-select",{}),t.remoteLoaded=1,t.loaded=1,m.value++}})).catch(t.error)}else{v.value=[];const e=C();e.then&&e.then((e=>{v.value=e})),x("row-select",{target:t})}}else C().then((()=>x("loaded",{target:t})));m.value++,t.loaded=1},F=computed((()=>h.value.length));A.rowSelectedCount=F,A.src=o,A.getForm=c.get,A.rowKey=a,A.rowSelect=V;const M=e=>p.value===e;A.is=M,A.remove=e=>{console.log(e,v.value);const t=v.value.findIndex((t=>t===e));-1!==t&&v.value.splice(t,1)},A.selected=h,A.type="v-table",i.push(A);const D=e=>{13===e.keyCode&&(e.preventDefault(),A())};return onMounted((()=>{!0===l&&A(),setTimeout((()=>{const e=E.proxy,t=e.$el.querySelectorAll(".v-cloned-header div > span"),l=Math.max(...Array.from(t).map((e=>e.offsetHeight)));t.forEach((e=>{e.style.height=l+"px"}));e.$el.querySelectorAll("v-filter").forEach((e=>{console.log(e.querySelectorAll("input").forEach((e=>e.addEventListener("keyup",D))))}))}),100)})),onUnmounted((()=>{i.remove(A)})),S({load:A,rowSelectedCount:F,j_is:M}),()=>{let t=0;const l=_.default({row:{}}),o=[];l.forEach(((e,l)=>{const a=e.props;e.children&&"function"==typeof e.children.filter&&(e.children.filter((e=>"v-filter"==e.type)).forEach((t=>{a.filter=t,e.children.shift()})),e.children.filter((e=>"v-footer"==e.type)).forEach((t=>{a.footer=t,e.children.shift()}))),t+=a.width?Number(a.width):0,o.push({filter:a.filter,header:a.header,width:a.width})})),t+=d.value?42:0;const a=h$1("div",{className:"v-datatable-scrollable-header-box",style:"left: 0px;"},h$1("table",{className:"v-cloned-header v-table",style:{width:`${t}px`}},[d.value?h$1("th",{width:42},[h$1("span",{onclick(){V(null,-10)},className:"v-check"},h$1(FontAwesomeIcon,{icon:h.value.length?faSquareCheck:faSquare,class:"fa-lg"}))]):null,o.map((e=>h$1("th",e,h$1("div",[h$1("span",{style:"display: flex;justify-content: center;align-items: center;"},[e.header]),h$1("v-filter",e.filter?.children)]))))]));return h$1("div",{ref:p,className:"v-datatable "+e.class},[_.header?h$1("div",{className:"v-datatable-header v-widget-header ui-corner-top"},_.header()):null,e.pagination?h$1("div",{className:"v-paginator v-paginator-top v-widget-header v-paginator-pages center"},[h$1(script$p,{value:"|<",disabled:w.value<=1,onClick:()=>I(1)}),h$1(script$p,{value:"<",disabled:w.value<=1,onClick:()=>I(w.value-1)}),h$1("div",{style:"padding:3px 8px;display:inline-block"},[h$1("input",{type:"number",style:"width:60px",value:w.value,onInput:e=>I(Number(e.target.value),!0)}),"/"+k.value]),h$1(script$p,{value:">",disabled:w.value==k.value,onClick:()=>I(w.value+1)}),h$1(script$p,{value:">|",disabled:w.value==k.value,onClick:()=>I(k.value)})]):null,h$1("div",{className:"v-widget-header v-datatable-scrollable-header",style:"position: relative; margin-right: 0px;"},a),h$1("div",{className:"v-datatable-scrollable-body",style:"overflow-y: auto; flex:1",onScroll(e){const t=e.currentTarget.scrollLeft;a.el.style.transform="translateX(-"+t+"px)"}},[h$1("table",{className:"v-table",style:{width:`${t}px`}},[h$1("tbody",{className:"v-datatable-data",key:m.value},b.value.length<1?h$1("td",{colspan:o.length+(d.value?1:0)},e.emptyMessage):[b.value.map((e=>[_["header-group"]?h$1("tr",{className:"v-header-group"},[d.value?h$1("td"):null,_["header-group"]({group:e})]):null,(e.values.value||e.values).map(((e,t)=>{const l=_.default({row:e,index:t});return l.forEach(((e,t)=>{e.children&&"function"==typeof e.children.filter&&(e.children.filter((e=>"v-filter"==e.type)).forEach((t=>{e.children.shift()})),e.children.filter((e=>"v-footer"==e.type)).forEach((t=>{e.children.shift()})))})),h$1("tr",{className:B(e),onclick(l){((e,t,l)=>{d.value&&0==whichChild(e.target)||V(t,l,1)})(l,e,t)}},[d.value?h$1("td",{className:"center"},h$1("span",{onclick(){V(e,t)},className:"v-check"},h$1(FontAwesomeIcon,{icon:N(e)?faSquareCheck:faSquare,class:"fa-lg"}))):null,...l])})),_["footer-group"]?h$1("tr",{className:"v-footer-group"},[d.value?h$1("td"):null,_["footer-group"]({group:e})]):null,_["extra-group"]?_["extra-group"]({group:e,groups:b.value}):null]))])])])])}},props:{class:null,value:Array,filterKey:String,reflow:null,summary:null,src:String,gql:null,filters:Object,store:null,width:null,emptyMessage:{default:"No existen registros"},groups:{default:""},rowKey:{default:"id"},rowStyleClass:null,pagination:null,selectable:{default:!0},scrollable:null,autoload:{default:!0}},data:()=>({resizeAfterUpddate:0,active:0,keyBody:1,row:{},kt:0,size:null,sortKey:"",paginatio_:0,remoteLoaded:null,loaded:!1,sortOrders:{},rowStyleClassFunc:null}),created(){const me=this;me.$parent.tabs||(me.active=1),me.paginatio_=me.pagination?me.pagination:0,me.rowStyleClass&&eval("me.rowStyleClassFunc=function(row){return "+me.rowStyleClass+"}")},beforeUpdate(){var e=this;e.active&&e.value&&null==e.remoteLoaded&&(e.data=e.value)},filters:{capitalize:e=>e?e.charAt(0).toUpperCase()+e.slice(1):e},methods:{hasSlot(e){return!!this.$slots[e]},sortBy(){},filter(){alert(12)}},__file:"src/v-table.vue"},script$4={name:"VTabview",data:()=>({tabs:[],height:0,currentTabIndex:0,k:0}),methods:{load(e){var t=new Event("command",{bubbles:!1});t.name="refresh",t.target=this.$el,this.$el.children[1+this.currentTabIndex].dispatchEvent(t)},reset(){this.load(this.k++)}},watch:{currentTabIndex(e){var t=this,l=t.$el.children[e+1];if(t.$children[e+1],l){var o=new Event("tabChange",{bubbles:!1});o.$target=t,l.dispatchEvent(o),t.$el.style.height=t.height+"px",(o=new Event("parentResize",{bubbles:!1})).height=t.$el.offsetHeight-25,l.style.height=o.height+"px",setTimeout((()=>{l.dispatchEvent(o)}),2)}}},updated(){for(var e=this.$el.children,t=1;t<e.length;t++)e[t].tagName&&(t-1===this.currentTabIndex&&(e[t].style.display="flex",e[t].style.flex="1",e[t].style.flexDirection="column"),t-1===this.currentTabIndex?e[t].classList.remove("hide"):(e[t].style.display="none",e[t].classList.add("hide"))),console.log(e[t])},mounted(){for(var e=this,t=e.$el.children,l=1;l<t.length;l++)t[l].style.display="none",e.tabs.push({title:""+t[l].getAttribute("tab")});e.$el.addEventListener("parentResize",(l=>{e.$el.style.height=l.height+1+"px",e.height=l.height+1;var o=new Event("parentResize",{bubbles:!1});o.height=e.$el.offsetHeight-25,o.target=e.$el,o.$target=e;for(var a=1;a<t.length;a++)"none"!=t[a].style.display&&(console.log("Se envia el alto "+o.height),t[a].style.height=o.height+"px",t[a].dispatchEvent(o));e.$emit("resize",o)})),t[1+e.currentTabIndex].setAttribute("active",1);var o=new Event("tabChange",{bubbles:!1});o.$target=e,t[1+e.currentTabIndex].dispatchEvent(o)}};const _hoisted_1$3={class:"v-tab-nav"},_hoisted_2$2=["onClick"];function render$4(e,t,l,o,a,r){return openBlock(),createElementBlock("div",{class:"v-tabview",style:normalizeStyle({height:a.height+"px"})},[createElementVNode("ul",_hoisted_1$3,[(openBlock(!0),createElementBlock(Fragment,null,renderList(a.tabs,((e,t)=>(openBlock(),createElementBlock("li",{class:normalizeClass({"v-selected":t==a.currentTabIndex}),key:t,onClick:e=>a.currentTabIndex=t},toDisplayString(e.title),11,_hoisted_2$2)))),128))]),renderSlot(e.$slots,"default")],4)}script$4.render=render$4,script$4.__file="src/v-tabview.vue";var script$3={name:"VTextarea",props:{modelValue:String},setup(e,{emit:t}){const l=ref(null),o=()=>{l.value&&(l.value.style.height="auto",l.value.value&&(l.value.style.height=`${l.value.scrollHeight}px`))},a=()=>{nextTick(o)};return watch((()=>e.modelValue),a,{immediate:!0}),onMounted((()=>{const e=l.value;e&&(e.addEventListener("change",o),e.addEventListener("cut",a),e.addEventListener("paste",a),e.addEventListener("drop",a),e.addEventListener("keydown",a),a())})),{textarea:l,updateValue:e=>{t("update:modelValue",e.target.value),a()}}}};const _hoisted_1$2=["value"];function render$3(e,t,l,o,a,r){return openBlock(),createElementBlock("textarea",{ref:"textarea",value:l.modelValue,onInput:t[0]||(t[0]=(...e)=>o.updateValue&&o.updateValue(...e))},null,40,_hoisted_1$2)}script$3.render=render$3,script$3.__file="src/v-textarea.vue";var script$2={name:"VUploader",props:{value:String,onlyicon:Boolean,click:null,icon:String,domain:String},mounted(){var e=this;setTimeout((function(){e.$el.querySelector("svg").dataset.icon="image"}),1e3)},updated(){var e=this;setTimeout((function(){e.$el.querySelector("svg").dataset.icon="image"}),1e3)},data:()=>({uploadPercentage:0,showProgress:!1}),methods:{other(){this.click&&this.click(this)},handleFileUpload(){this.uploadPercentage=0,this.submitFile(this.$el.children[0].children[0].files[0])},submitFile(e,t){var l=this,o=new FormData;t=t||e.name.replace(/[^\w\s.]/gi,""),o.append("filename",t),o.append("file",e,t),l.showProgress=!0,axios$2.post((l.domain?l.domain:"")+"/api/file/upload",o,{headers:{"Content-Type":"multipart/form-data"},onUploadProgress:function(e){this.uploadPercentage=parseInt(Math.round(e.loaded/e.total*100))}.bind(this)}).then((function(e){l.$emit("input",e.data),l.showProgress=!1})).catch((function(){console.log("FAILURE!!")}))}}};const _hoisted_1$1={style:{cursor:"pointer"},class:""},_hoisted_2$1=["data-icon"],_hoisted_3=[".value"];function render$2(e,t,l,o,a,r){return openBlock(),createElementBlock("div",{onClick:t[1]||(t[1]=(...e)=>r.other&&r.other(...e)),class:normalizeClass([l.onlyicon?"":"v-button ui-widget ui-state-default ui-corner-all","v-uploader"]),style:normalizeStyle({padding:l.onlyicon?"0px":""})},[createElementVNode("label",_hoisted_1$1,[l.click?createCommentVNode("v-if",!0):(openBlock(),createElementBlock("input",{key:0,type:"file",onChange:t[0]||(t[0]=e=>r.handleFileUpload())},null,32)),createElementVNode("i",{class:normalizeClass(["fa",l.icon?l.icon:"fa-upload"]),"data-icon":l.icon,style:normalizeStyle({marginRight:l.onlyicon||""==l.value?"":"10px"})},null,14,_hoisted_2$1),createTextVNode(toDisplayString(l.onlyicon?"":null!=l.value?l.value:"Adjuntar Archivo")+" ",1),a.showProgress?(openBlock(),createElementBlock("progress",{key:1,max:"100",style:{width:"100%"},".value":a.uploadPercentage},null,40,_hoisted_3)):createCommentVNode("v-if",!0)])],6)}script$2.render=render$2,script$2.__file="src/v-uploader.vue";var script$1={name:"VItem",setup:({href:e},{emit:t})=>({click:()=>{e?useAppStore().router.push({path:e}):t("click")}}),props:{icon:String,style:Object,label:String,href:String}};function render$1(e,t,l,o,a,r){return openBlock(),createElementBlock(Fragment,null,[createElementVNode("li",{onClick:t[0]||(t[0]=(...e)=>o.click&&o.click(...e)),style:normalizeStyle(l.style)},[createElementVNode("i",{class:normalizeClass(["fa",l.icon])},null,2),createTextVNode(toDisplayString(l.label)+" ",1),renderSlot(e.$slots,"label")],4),createElementVNode("ul",null,[renderSlot(e.$slots,"default")])],64)}script$1.render=render$1,script$1.__file="src/v-item.vue";var script={name:"VCalendarRange",props:{modelValue:null,type:String,required:String,readonly:String,max:String,min:String},setup({modelValue:e},{emit:t}){const l=ref(),o=ref(),a=ref(),r=ref(),n=ref();return{show:l,open:()=>{l.value=!0,nextTick((()=>{n.value=mask(r.value)}))},elRef:r,from:o,to:a,click:e=>{e||(o.value="",a.value="");const l=(date(o.value,"date-")||"")+"|"+(date(a.value,"date-")||"");t("update:modelValue","|"==l?null:l),unmask(n.value)},modelValue:e}}};const _hoisted_1={key:0,ref:"elRef",style:{position:"relative","z-index":"1000",padding:"20px","max-width":"240px"},class:"v-dialog v-msgbox"},_hoisted_2={style:{display:"flex","align-items":"center","justify-content":"center","margin-top":"20px"}};function render(e,t,l,o,a,r){const n=resolveComponent("VButton"),s=resolveComponent("v-calendar"),i=resolveComponent("v-button");return openBlock(),createElementBlock("div",null,[createVNode(n,{icon:"fa-calendar",onClick:o.open,style:{width:"-webkit-fill-available",padding:"12px"},class:normalizeClass(o.from||o.to?"marked":"")},null,8,["onClick","class"]),o.show?(openBlock(),createElementBlock("div",_hoisted_1,[t[4]||(t[4]=createElementVNode("label",null,"Desde:",-1)),createVNode(s,{modelValue:o.from,"onUpdate:modelValue":t[0]||(t[0]=e=>o.from=e)},null,8,["modelValue"]),t[5]||(t[5]=createElementVNode("label",null,"Hasta:",-1)),createVNode(s,{modelValue:o.to,"onUpdate:modelValue":t[1]||(t[1]=e=>o.to=e)},null,8,["modelValue"]),createElementVNode("div",_hoisted_2,[createVNode(i,{icon:"fa-eraser",value:"Limpiar",onClick:t[2]||(t[2]=e=>o.click())}),createVNode(i,{icon:"fa-filter",value:"Aplicar",onClick:t[3]||(t[3]=e=>o.click(!0))})])],512)):createCommentVNode("v-if",!0)])}script.render=render,script.__file="src/v-calendar-range.vue";var components={InputTextarea:script$r,VItem:script$1,InputText:script$s,VAutocomplete:script$q,VButton:script$p,VCalendar:script$o,VCalendarFilter:script,VCheckboxGroup:script$n,VCheckbox:script$m,VDataview:script$l,VFieldset:script$k,VForm:script$j,VGroup:script$i,VLayerControl:script$h,VMapControl:script$g,VMap:script$f,VNumber:script$e,VOptions:script$d,VOverlay:script$c,VPanel:script$b,VPopup:script$a,VRadioGroup:script$8,VRadio:script$9,VSelect:script$7,VSwitch:script$6,VTable:script$5,VTabview:script$4,VTextarea:script$3,VUploader:script$2};const VForm=components.VForm,IsobitUI={install(e){setApp(e),e.BUILT_ON=import.meta.env.VITE_APP_BUILT_ON;for(const t in components)if(components.hasOwnProperty(t)){const l=components[t];e.component(l.name||t,l)}}};setTimeout(resize,400),window.addEventListener("resize",(()=>{setTimeout(resize,400)}));const removeError=e=>{let t=e.previousElementSibling;t&&t.classList&&t.classList.contains("v-error")&&t.parentNode.removeChild(t)},ui=e=>{const l={computed:{user:()=>_$1.app.session,perms(){return this.session.perms||this.session.allcaps||{}}},data(){return{app2:null,ui:this,_session:null,x_connected_:null,row:{},networkStatus:{connected:null}}},methods:{get(e){let t=this.$el.querySelector("form").action;window.location.href=this.apiLink(t)+"/"+e},async sync(e){let t=this,l=t.$el.querySelector("form").getAttribute("action");if(!l){l=t.$el.parentNode.getAttribute("path");let e=l.split("/");e="edit"==e[e.length-1]?e.splice(0,e.length-2):e.splice(0,e.length-1),l=t.apiLink(e.join("/"))}let o=t.$children[0].$children[0];l=o.src;let a=await t.getStoredList(o.store),r=o.selected,n=[],s=[];for(let e=0;e<r.length;e++){let t=o.data[r[e]];if(t.tmpId&&!t.synchronized)for(let e=0;e<a.length;e++)if(a[e].tmpId==t.tmpId){let t=JSON.clone(a[e]);delete t.synchronized,s.push(t),n.push(e)}}n.length>0&&axios.post(l+"/bulk"+(e.sufix?e.sufix:""),s).then((function(e){let l=e.data;for(let e=0;e<l.length;e++){if(l[e].errors){MsgBox$1(JSON.stringify(l[e].errors));break}if(l[e].error){MsgBox$1(l[e].error);break}for(let t=0;t<a.length;t++)(l[e].ext&&l[e].ext.tmpId==a[t].tmpId||l[e].tmpId==a[t].tmpId)&&(log("ui.ok"),l[e].ext&&a.ext&&(a[t].ext.error=l[e].ext.error),l[e].id&&(a[t].id=l[e].id),a[t].synchronized=1,emit("sync",l[e],a[t]))}t.setStoredList(o.store,a),t.refresh()})).catch((function(e){e.response?MsgBox$1(e.response.data):console.log(e)}))}}};e||(e={data:{o:{}}});const{setup:o,...a}=e,r=o;return e={mixins:[l,a],setup(e,l){const o=useAppStore();setApp(o),o.config(getConfigApp());const a=e;let n=useRouter();const s=getCurrentInstance(),c=reactive([]),d=e=>{},u=async e=>{const t=s.proxy,l=_$1.db;let a;try{a=JSON.parse(sessionStorage.getItem("loadedStores"))}catch(e){}if(null==a&&(a={}),!a[e]&&t.connected){let t=_$1.stores.filter((t=>t[0]==e))[0];if(!t[2])throw`ERROR: Url for store '${t[0]}' is empty!`;let r=await o.axios.get(t[2]);r=r.data||r,await new Promise(((o,n)=>{let s=l.transaction([t[0]],"readwrite"),i=s.objectStore(t[0]);const c=i.clear();c.onsuccess=()=>{r.forEach((e=>{i.add(e).onerror=e=>{console.error(`⚠️ Store '${e[0]}' error addd data!`,e)}}))},c.onerror=()=>{console.error(`⚠️ Store '${t[0]}' error data!`,t)},s.oncomplete=()=>{a[e]=1,sessionStorage.setItem("loadedStores",JSON.stringify(a)),o()},s.onerror=e=>{console.error(`ERROR: ⚠️ Error en la transacción for store '${e[0]}'!`,e),n()}}))}return await new Promise(((t,o)=>{if(l){const o=l.transaction(e).objectStore(e).getAll();o.onsuccess=()=>{t(o.result)}}else console.log("1=========>db=",window._.db),o("=======>db is null esta faltando")}))},p=()=>{c.find((e=>"v-table"==e.type))()},m=(e,t,l)=>{if(!(e.$el||e instanceof HTMLElement)){let t=e,l=t.target;return"string"==typeof t?l=t:"ION-ITEM"==l.tagName&&l.href?(t.preventDefault(),l=l.href):(t.preventDefault(),l.pathname||(l=l.parentNode),l.pathname||(l=l.parentNode),l.pathname||(l=l.parentNode),l=l.pathname),void(n.path!==l&&n.push(l))}},h=(e,t)=>{e.$el&&(e=e.$el),removeError(e);let l=e.previousElementSibling;for(;l&&1!=l.nodeType;)l=l.previousElementSibling;if(!l)for(l=e.parentElement.previousElementSibling;l&&1!=l.nodeType;)l=l.previousElementSibling;let o=document.createElement("div");o.innerHTML=t||"Este campo es requerido!",o.classList.add("v-error"),e.parentNode.insertBefore(o,e)},v=e=>{const t=[],l=[],o=s.proxy;e=e&&0!=e?e:o.$el;const a=e?.querySelectorAll("input,select,textarea,div[required=required]");let r,n={};for(let e=0;a?.length>e;e++){let o=a[e];if("radio"!==o.type){if(o.error&&(o.error.style.display="none"),!o.disabled&&!o.getAttribute("disabled")&&(o.required||"DIV"===o.tagName))if("DIV"!=o.tagName&&!o.value||"DIV"===o.tagName&&!o.attributes.value){for(r=o.previousElementSibling;r&&1!=r.nodeType;)r=r.previousElementSibling;if(!r)for(r=o.parentElement.previousElementSibling;r&&1!=r.nodeType;)r=r.previousElementSibling;t.push(o)}else l.push(o)}else{let e=n[o.name];e||(n[o.name]=e=[]),e.push(o)}}for(let e in n)if(Object.prototype.hasOwnProperty.call(n,e)){const o=n[e];let a=!1,s=!1;for(let e=0;e<o.length;e++)o[e].required&&!o[e].disabled&&(s=!0),o[e].checked&&(a=!0);const i=o[0].parentNode.parentNode;r=i.previousElementSibling,r&&r.classList&&r.classList.contains("v-error")&&r.parentNode.removeChild(r),s&&!a?t.push(i):l.push(i)}for(const e of t)h(e);for(const e of l){let t=e.previousElementSibling;t&&t.classList&&t.classList.contains("v-error")&&t.parentNode.removeChild(t)}return!t.length},f=(e,t)=>{let l=e.parentElement;for(;l;){const e=l.querySelector(t);if(e)return e;l=l.parentElement}return null},g=e=>{console.log(l)};provide("viewCollector",{remove(e){c.splice(c.indexOf(e),1)},push(e){c.push(e)}});const y=computed((()=>{let e=c.find((e=>e.selected?.value.length>0));return e?.rowSelectedCount||0})),$=computed((()=>clean(b.value))),b=reactive({}),w=ref(null);let k;watch(b,(()=>{c.find((e=>"v-table"==e.type))&&(w.value&&clearTimeout(w.value),w.value=setTimeout((()=>{p()}),1200))}));const _=()=>{clearTimeout(k),k=setTimeout((()=>{const e=document.querySelector(".v-datatable");e?.parentNode&&buildPopupMenu(e)}),100)};onMounted((()=>{n=useRouter(),l.emit("sync",{u:9}),_(),window.addEventListener("resize",_)})),onUnmounted((()=>{window.removeEventListener("resize",_)}));const S=computed((()=>o.axios.defaults.baseURL)),x=computed((()=>o.session));let E=r?r({...e,$on:(e,t)=>{},router:n,getStoredList:u,app:o},l):{};l.expose({router:n});let C={app:o,cleanedFilters:$,router:n,baseURL:S,filters:b,session:x,date:date,pad:pad,getStoredList:u,refresh:p,getSelected:()=>c.find((e=>"v-table"==e.type)).selected.value,saveAs:(e,t,l)=>{"string"==typeof t&&(t={body:t});let o="string"==typeof l?{fileName:l}:l;o||(o={}),(""+t?axios.post(e,t,{responseType:"blob"}):axios({method:"post",url:e,data:t,headers:{"Content-Type":"multipart/form-data"}})).then((e=>{const t=window.URL.createObjectURL(new Blob([e.data])),l=document.createElement("a");if(l.href=t,!o.fileName){const t=e.headers["content-disposition"];if(t&&-1!==t.indexOf("attachment")){const e=/filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/.exec(t);null!=e&&e[1]&&(o.fileName=e[1].replace(/['"]/g,"").trim())}else console.warn("content-disposition: attachment; filename = <filename>; header no es accesible o no esta definido correctamente")}l.setAttribute("download",o.fileName),document.body.appendChild(l),l.click()}))},validate:v,save:()=>{let e=c.filter((e=>"v-form"==e.type))[0];console.log(e);const r=s.proxy;e.$forceUpdate();let n=e.$el,d=n.querySelector("form");if(v(d)){let e=d.getAttribute("action"),n=r.data||r.o,s=JSON.parse(JSON.stringify(n));if(r.process&&(s=r.process(s)),"object"!=typeof s||Array.isArray(s)||null===s)return;if(console.log("action/componet==",e,r,l),e&&o.connected)o.axios.post(e,s).then((e=>{let t=e.data;if(s.tmpId){alert(12);let e=a.$children[0].store,l=window._.db.transaction([e],"readwrite").objectStore(e),o=l.get(s.tmpId);t.id&&(s.id=t.id,n.id=s.id),o.onsuccess=function(){let e;n.synchronized=1,s.synchronized=1,e=o.result?l.put(s):l.add(s),e.onerror=e=>{console.error(e)},a.$emit("sync",t,s)},o.onerror=function(){MsgBox$1("Error getting temporal record "+s.tmpId)}}o&&o.toast?o.toast("El registro fue grabado exitosamente!",(()=>{r.close({success:!0,data:t})})):MsgBox$1("El registro fue grabado exitosamente! msg",(()=>{g()}))})).catch((function(e){if(e.response){let l,o;if("string"==typeof e.response.data)MsgBox$1(e.response.data);else{l=e.response.data.propertyViolations;for(let e=0;e<l.length;e++){let t=l[e];o=d.querySelector("[name="+t.path+"]"),o&&a.showerror(o,t.message)}for(l=e.response.data.fieldViolations,i=0;i<l.length;i++)t=l[i],o=d.querySelector("[name="+t.path+"]"),o&&a.showerror(o,t.message+", valor="+t.value);MsgBox$1("Verifique el formulario, aun tiene campos obligatorio completar."),"v-dialog"==a.$el.parentNode.className&&a.$el.parentNode.parentNode.scroll({top:0,behavior:"smooth"})}}}));else{console.log("se guarda localmente");const e=c[0].store;if(!e)return void MsgBox$1("Store in form is undefined!");u(e).then((t=>{if(t||(t=[]),s.id)for(let e=0;e<t.length;e++)t[e].tmpId==s.tmpId&&(delete s.synchronized,t[e]=s);let l=_$1.db.transaction([e],"readwrite").objectStore(e);if(s.id){delete s.synchronized;let e=l.get(s.tmpId);e.onsuccess=function(){e.result?l.put(s):t.forEach((e=>{e.tmpId==s.tmpId&&l.put(s)})),a.$emit("stored",s,t,l),a.$ionic&&o.toast("El registro fue grabado exitosamente! onstored"),console.log("============2",r),r.close({success:!0,data:s})},e.onerror=function(){MsgBox$1("Error getting temporal record "+s.tmpId)}}else{s.tmpId=1*new Date,s.id=-s.tmpId;let e=l.add(s);e.onsuccess=e=>{t.unshift(s),a.$emit("stored",s,t,l),o&&o.toast&&o.toast("El registro fue grabado exitosamente! storeeeeee not connected"),n.tmpId=s.tmpId,n.id=s.id,console.log("========>>",r),r.close({success:!0,data:s})},e.onerror=e=>{o&&o.toast&&o.toast("Error!")}}}))}}else MsgBox$1("Verifique el formulario, aun tiene campos obligatorios sin completar."),"v-dialog"==n.parentNode.className?n.parentNode.parentNode.scroll({top:0,behavior:"smooth"}):n.querySelector("form > .v-form").scroll({top:0,behavior:"smooth"})},open:m,close:g,create:e=>{const t=f(e.target,".v-datatable");let l=c.filter((e=>"v-table"==e.type)).find((e=>e.is(t))).getForm().action;l||(l=window.location.pathname),l&&(l=l.replace("/api","")),o&&m(l+"/create")},edit:e=>{const t=f(e.target,".v-datatable");let l=c.filter((e=>"v-table"==e.type)).find((e=>e.is(t))),r=l.getForm().action;var n;r||(r=window.location.pathname),l&&l.src&&(r=l.src),e.action&&(r=e.action),r&&(n=r.replace("/api","").replace("/0/0",""),r="/admin"+n);const s=l.selected.value[0];let i=s[l.rowKey];s.tmpId&&(i=-s.tmpId),o?m(r+"/"+i+"/edit"):o.axios.get((_$1.currentPath=(r+"/"+i+"/edit").replace(/([^:]\/)\/+/g,"$1"))+"?modal").then(a.open).catch(d)},destroy:e=>{let t=this;const l=f(e.target,".v-datatable");let a=c.filter((e=>"v-table"==e.type)).find((e=>e.is(l)));c.find((e=>"v-table"!=e.type)).action;let r=e.$vnode?e.load:null,n=a.rowKey,s=a.selected.value[0];if(s.tmpId)MsgBox$1("Esta seguro que desea eliminar los registros temporales seleccionados ?",(function(e){if(0==e){let e=0,l=_$1.db.transaction([a.store],"readwrite").objectStore(a.store),n=[];for(let t=a.selected.length-1;t>=0;t--)s=a.data[a.selected[t]],n.push(s),s.tmpId&&l.delete(s.tmpId),e++,a.data.splice(a.selected[t],1);e&&(o&&o.toast?o.toast(e+" registros eliminados"):MsgBox$1(e+" registros eliminados")),a.rowSelect(null,-1),a.selected=[],t.$emit("destroyed",n,a.store),r&&r()}}),["SI","NO"]);else{if(!n)return alert("Table don`t have defined attribute 'rowkey'");let e=s[n];MsgBox$1("Esta seguro que desea eliminar el registro seleccionado?",(t=>{if(0==t){const t=a.src.replace("/0/0",""),l=[];let r=a.selected.value.length-1;o.axios.delete(t+"/"+e,{params:b.value}).then((()=>{for(;r>=0;r--)s=a.selected.value[r],l.push(s),a.remove(s);o&&o.toast?o.toast(l.length+" registros eliminados"):MsgBox$1(l.length+" registros eliminados"),a.rowSelect(null,-1),a.selected.value=[]})).catch(d)}}),["SI","NO"])}},rowSelectedCount:y,...E};return C}},e};export{Drag,IsobitUI,MsgBox$1 as MsgBox,VForm,_$1 as _,app,date,db,getStoredList,id,initDB,mask,pad,removeError,resize,setupApp,ui,unmask,useAppStore};
1
+ import{openBlock,createElementBlock,ref,watch,computed,onMounted,onBeforeUnmount,normalizeStyle,renderSlot,createTextVNode,toDisplayString,createElementVNode,createCommentVNode,withDirectives,withKeys,withModifiers,normalizeClass,vModelText,createVNode,Transition,withCtx,Fragment,renderList,vShow,nextTick,defineComponent,inject,provide,h as h$1,reactive,onUpdated,onUnmounted,getCurrentInstance,createBlock,resolveComponent}from"vue";import{createPinia,setActivePinia,getActivePinia,defineStore}from"pinia";import axios$2 from"axios";import{unByKey}from"ol/Observable";import{Collection}from"ol";import FullScreen from"ol/control/FullScreen";import GeoJSON from"ol/format/GeoJSON";import VectorLayer from"ol/layer/Vector";import VectorSource from"ol/source/Vector";import{Style,Fill,Stroke,Text,Circle,RegularShape}from"ol/style";import Control from"ol/control/Control";import"ol/ol.css";import PointerInteraction from"ol/interaction/Pointer";import Feature from"ol/Feature";import Map from"ol/Map";import"ol/interaction/Pointer.js";import"ol/interaction/defaults";import View from"ol/View";import{Point}from"ol/geom";import"ol/interaction/Select";import{fromLonLat,toLonLat}from"ol/proj";import{Tile}from"ol/layer";import{OSM}from"ol/source";import"ol/interaction/Translate";import _imports_0 from"@/cdn/images/triangle-down.svg";import{useRouter}from"vue-router";import{FontAwesomeIcon}from"@fortawesome/vue-fontawesome";import{faSquareCheck,faSquare}from"@fortawesome/free-regular-svg-icons";var script$s={name:"InputText"};const _hoisted_1$j={type:"text"};function render$o(e,t,l,o,a,r){return openBlock(),createElementBlock("input",_hoisted_1$j)}script$s.render=render$o,script$s.__file="src/InputText.vue";var script$r={name:"InputTextarea"};function render$n(e,t,l,o,a,r){return" text "}script$r.render=render$n,script$r.__file="src/InputTextarea.vue";const _$1={stores:[],_id:0,axios_get:null,storeFunction:{}},log=(e,...t)=>{e&&console.log(e,...t)};let configApp={};function setupApp({pinia:e,axios:t,router:l}){configApp.pinia=e||createPinia(),t&&(configApp.axios=t),l&&(configApp.router=l),setActivePinia(configApp.pinia)}function getConfigApp(){return configApp}function getPiniaInstance(){return getActivePinia()||configApp.pinia}const id=()=>_$1._id++,num=e=>e=e?""==e?null:Number(""+e):0,date=(e,t)=>{if(e){let l;if(e instanceof Date)l=e;else if("string"==typeof e){let t=e.includes("T")?e.split("T"):e.split(" ");l=t[0].split("-"),t.length>1?(t=t[1].split(":"),l=new Date(parseInt(l[0]),parseInt(l[1])-1,parseInt(l[2]),parseInt(t[0]),parseInt(t[1]),t.length>2?parseInt(t[2]):0)):l.length>2?l=new Date(parseInt(l[0]),parseInt(l[1])-1,parseInt(l[2])):(l=e.split(":"),l=l.length>2?new Date(1981,0,6,parseInt(l[0]),parseInt(l[1]),parseInt(l[2])):new Date(e))}else l=new Date(e);if(1==t)e=l;else if("time"===t)e=pad(l.getHours(),2)+":"+pad(l.getMinutes(),2)+":"+pad(l.setSeconds()?l.setSeconds():0,2);else if("time a"==t)if("string"==typeof e||e instanceof String){let t=(e=e.split(":"))[0];e=pad(t>12?t-12:t,2)+":"+e[1]+":"+e[2]+" "+(t>12?"PM":"AM")}else h=l.getHours(),e=pad(h>12?h-12:h,2)+":"+pad(l.getMinutes(),2)+(l.setSeconds()?":"+pad(l.setSeconds(),2):"")+" "+(h>12?"PM":"AM");else e="date-"==t?pad(l.getFullYear(),4)+"-"+pad(l.getMonth()+1,2)+"-"+pad(l.getDate(),2):"dMY"==t||"date"==t?pad(l.getDate(),2)+"/"+pad(l.getMonth()+1,2)+"/"+pad(l.getFullYear(),4):"datetime"==t?pad(l.getFullYear(),4)+"-"+pad(l.getMonth()+1,2)+"-"+pad(l.getDate(),2)+"T"+pad(l.getHours(),2)+":"+pad(l.getMinutes(),2)+":"+pad(l.setSeconds()?l.setSeconds():0,2):pad(l.getDate(),2)+"/"+pad(l.getMonth()+1,2)+"/"+pad(l.getFullYear(),4)+" "+pad(l.getHours(),2)+":"+pad(l.getMinutes(),2)}return e},whichChild=e=>{let t=0;for(;null!=(e=e.previousElementSibling);)++t;return t},unmask=e=>{e&&(e.style.display="none",e.parentNode&&e.parentNode.removeChild(e))},isObject=e=>e&&"object"==typeof e&&!Array.isArray(e),mergeDeep=function(){let e=arguments[0],t=[];for(let e=1;e<arguments.length;e++)t.push(arguments[e]);if(!t.length)return e;let l,o=t.shift();if(isObject(e)&&isObject(o))for(let t in o)isObject(o[t])?(e[t]||(l={},l[t]={},Object.assign(e,l)),mergeDeep(e[t],o[t])):(l={},l[t]=o[t],Object.assign(e,l));let a=[];return a.push(e),a.concat(t),mergeDeep.apply(null,a)},buildPopupMenu=e=>{let t=e.getAttribute("v--popup");if(!t){e.setAttribute("v--popup",t=id());let l=_$1.storeFunction[t],o=e.querySelectorAll(".v-datatable-header .v-button");o&&o.length&&!l&&window.innerWidth<=700&&setTimeout((function(){l=document.createElement("ul"),l.className="v-popup-2",e.appendChild(l);let a=null;const r=e=>{l.style.display="none";let t=e.target.getAttribute("commandId"),o=document.querySelector("#"+t);"BUTTON"==o.tagName?o.click():o.children[0].click(),unmask(a)};e.style.position="relative";let n=document.createElement("div");n.className="v-mobil v-table-buttons";let s=document.createElement("i");s.className="fa fa-bars fa-w-14",n.appendChild(s),n.onclick=()=>{for(o=e.querySelectorAll(".v-datatable-header .v-button");l.firstChild;)l.removeChild(l.firstChild);for(s=0;s<o.length;s++)if("none"!=o[s].style.display){let e=document.createElement("li");if(o[s].id||(o[s].id="c-"+id()),e.setAttribute("commandId",o[s].id),"BUTTON"==o[s].tagName){if(o[s].disabled)continue;e.appendChild(o[s].children[0].cloneNode(!0)),e.appendChild(document.createTextNode(o[s].value?o[s].value:o[s].title))}else o[s].children[0].children[1]&&(e.appendChild(o[s].children[0].children[1]),e.appendChild(document.createTextNode(o[s].textContent)));e.onclick=r,l.appendChild(e)}a=mask(l),l.style.display="block",a.onclick=()=>{l.style.display="none",unmask(a)}},e.appendChild(n),_$1.storeFunction[t]=l}),500)}},resize=()=>{},mask=(e,t)=>{if(!document.body)return;let l,o=document.createElement("div");o.style="top:50%;transform:translate(-50%,-50%);position:absolute;width:100%;z-index:2; display: flex;justify-content: center;";let a=o.style;if(a.left="50%",a.textAlign="center",!1!==e)if(e instanceof Element)o=e;else{if(e){let t=document.createElement("div");t.innerHTML=e,o.append(t),o.style="padding:4px;margin-bottom:5px;color:white;font-size:24px;text-align:center"}l=document.createElement("div"),a=l.style,l.className="loading"}let r=document.createElement("div");a=r.style,a.height="100%",a.top="0px",a.position="absolute",a.left="0",a.zIndex="10000",a.width="100%";let n=document.createElement("div");return n.className="v-overlay",r.appendChild(n),o.style.zIndex="1001",r.appendChild(o),r.className="v-mask",l&&o.appendChild(l),document.body.appendChild(r),r},MsgBox$1=(e,t,l)=>{if(l||(l=["OK"]),!document.body)return;let o=document.createElement("div");o.classList.add("v-overlay"),o.style.padding="40px",o.style.zIndex="2000",document.body.appendChild(o);let a=document.createElement("div"),r=document.createElement("div"),n=document.createElement("div"),s=document.createElement("div");s.className="v-msgbox-buttons",a.classList.add("v-dialog"),a.classList.add("v-msgbox"),e instanceof Element?n=e:n.innerHTML=e,a.setAttribute("path",_$1.currentPath);let i=function(){a.style.display="none",o.style.display="none",a.parentNode.removeChild(a),o.parentNode.removeChild(o),t&&t(this.getAttribute("index"))};for(let e=0;e<l.length;e++){let t=document.createElement("button");t.innerHTML=l[e],t.type="button",t.setAttribute("index",e),t.className="v-button ui-widget ui-state-default ui-corner-all",s.appendChild(t),t.addEventListener("click",i)}r.className="v-dialog-content v-widget-content",r.appendChild(n),r.appendChild(s),a.appendChild(r),o.appendChild(a),o.style.visibility="unset",o.style.opacity="unset",o.style.overflow="auto",a.style.margin="0px auto 50%",a.style.position="unset";let c=a.querySelector(".v-js-close");if(!c){let e=document.createElement("span");a.style.position="relative",e.style.position="absolute",e.className="fa fa-close",c=document.createElement("a"),c.className="v-js-close ui-dialog-titlebar-icon ui-dialog-titlebar-close ui-corner-all",c.appendChild(e),a.appendChild(c),c.addEventListener("click",i)}},configureAxios=e=>{if(e.configured)return;let t;e.configured=1,_$1.axios_get=e.get,e.interceptors.request.use((l=>(e.noInterceptor||(_$1.eeee=l,l.mask?l.mask():t||(t=mask())),l)),(e=>(t=unmask(t),MsgBox$1("request "+id()+" "+e.message),Promise.reject(e)))),e.interceptors.response.use((l=>(t=unmask(t),delete e.noInterceptor,l)),(l=>{if(console.log("interceptors.response.use.error"),e.noInterceptor)return delete e.noInterceptor,t=unmask(t),Promise.reject(l);if(e.error&&0==e.error(l))t=unmask(t);else{let e,o=l.response;if(o&&("string"==typeof o.data?e=o.data:o.data&&(o.data.data&&(e=o.data.data.message),e||(e=o.data.msg||o.data.message)),e||(e=o.status+": "+o.statusText)),e||(e=l.message),t=unmask(t),o&&(401==o.status||403==o.status)){const e=app();if(e&&localStorage.getItem("session"))return e.axios.noInterceptor=1,void e.axios.post(e.axios.VITE_LOGIN_PATH+"/validate",{JWT:"YOUR_JWT_HERE"}).catch((t=>{console.log("e.response=",t),t.response.data.success||MsgBox$1("Session terminada!",(()=>{e.logout()}))}))}l.config?.error?l.config.error(l,e):l.request?MsgBox$1("<b>"+l.request.responseURL+"</b><br/><br/>"+e):MsgBox$1(e)}return delete e.error,Promise.reject(l)}))},pad=(e,t)=>{if(null!=e){let l=1*e+"";for(;l.length<t;)l="0"+l;return l}},clean=e=>{const t={...e};for(let e in t)""!==t[e]&&null!==t[e]&&"function"!=typeof t[e]&&void 0!==t[e]||delete t[e];return t},sum=e=>(void 0).reduce(((t,l)=>t+((l=e?l[e]:l)?Number(l):0)),0);function createGetters(){return{get networkStatus(){return _$1.app?.networkStatus||{connected:!0}},get db(){return _$1.app?.db},app:()=>_$1.app,setApp(e){_$1.app=e}}}const app=()=>_$1.app,db=()=>_$1.db,initDB=(e,t)=>{let l=window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB;if(_$1.IDBTransaction=window.IDBTransaction||window.webkitIDBTransaction||window.msIDBTransaction,_$1.IDBKeyRange=window.IDBKeyRange||window.webkitIDBKeyRange||window.msIDBKeyRange,l){if(l)return _$1.stores=t,new Promise(((o,a)=>{l.databases().then((r=>{const n=r.find((e=>"db"===e.name)),s=n&&n.version||0;if(s<e){console.log(`Eliminando base de datos (versión actual: ${s}, nueva versión: ${e})`);l.deleteDatabase("db").onsuccess=()=>{let r=l.open("db",e);r.onupgradeneeded=e=>{let l=e.target.result;t.forEach((e=>{if(!l.objectStoreNames.contains(e[0])){const{keyPath:t}=e[1];l.createObjectStore(e[0],{keyPath:t,autoIncrement:!t})}}))},r.onerror=e=>{a(e)},r.onsuccess=()=>{_$1.db=r.result,o(_$1.db)}}}else{let r=l.open("db",e);r.onupgradeneeded=e=>{let l=e.target.result;t.forEach((e=>{if(!l.objectStoreNames.contains(e[0])){const{keyPath:t}=e[1];l.createObjectStore(e[0],{keyPath:t,autoIncrement:!t})}}))},r.onerror=e=>{a(e)},r.onsuccess=()=>{_$1.db=r.result,o(_$1.db)}}}))}))}else window.alert("Your browser doesn't support a stable version of IndexedDB.");return l},getStoredList=async(e,t)=>{const l=db();let o;try{o=JSON.parse(sessionStorage.getItem("loadedStores"))}catch(e){}if(null==o&&(o={}),!o[e]&&networkStatus.connected){const t=_$1.stores.filter((t=>t[0]==e));if(!t.length)throw`ERROR: store '${e}' no exists!`;let a=t[0];const{src:r}=a[1];if(!r)throw`ERROR: Url for store '${a[0]}' is empty!`;let n=r?await _$1.axios_get(r):[];n=n.data||n,await new Promise(((t,r)=>{let s=l.transaction([a[0]],"readwrite"),i=s.objectStore(a[0]);const c=i.clear();c.onsuccess=()=>{n.forEach((e=>{i.add(e).onerror=e=>{console.error(`⚠️ Store '${e[0]}' error addd data!`,e)}}))},c.onerror=()=>{console.error(`⚠️ Store '${a[0]}' error data!`,a)},s.oncomplete=()=>{o[e]=1,sessionStorage.setItem("loadedStores",JSON.stringify(o)),t()},s.onerror=e=>{console.error(`ERROR: ⚠️ Error en la transacción for store '${e[0]}'!`,e),r()}}))}return await new Promise(((t,o)=>{if(l){const o=l.transaction(e).objectStore(e).getAll();o.onsuccess=()=>{t(o.result)}}else console.log("1=========>db=",window._.db),o("=======>db is null esta faltando")}))},getters=createGetters(),{networkStatus:networkStatus,setApp:setApp}=getters,deleteAllCookies=()=>{const e=document.cookie.split(";");for(let t of e){const e=t.split("=")[0].trim();document.cookie=`${e}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;`}},useAppStore=defineStore("connection",(()=>{const e=getPiniaInstance(),t=getConfigApp();if(!e)throw new Error("Pinia no ha sido inicializado. Llama a setupPinia() en tu app.");const l=ref(!1),o=ref(!1),a=ref(t.router),r=ref(t.axios),n=ref(null),s=ref(null);l.value="false"!==localStorage.getItem("connected");const i=e=>{setTimeout((()=>{n.value&&(r.value.noInterceptor=1,r.value.post(r.value.VITE_LOGIN_PATH+"/refresh",{}).then((({data:t})=>{const{token:l,user_nicename:o,perms:a}=t;n.value={token:l,people:{display_name:o},perms:a},e(i)})).catch((e=>{console.error(e)})))}),6e5)};let c;watch(n,(e=>{e&&e.token?(r.value.defaults.headers.common={Authorization:"Bearer "+e.token},localStorage.setItem("session",JSON.stringify(e)),c||(c=i,i(i))):(localStorage.removeItem("session"),c=null)}));const d=localStorage.getItem("session");n.value=d?JSON.parse(d):null,watch(l,(e=>{localStorage.setItem("connected",String(e))}));const u=computed((()=>s.value?.connected)),p=computed((()=>!!n.value?.token));return{connected:l,session:n,logout:()=>{n.value=null,deleteAllCookies(),a.value.push("/login")},unauthorized:o,connect:e=>{n.value=e,a.value.push("/admin")},authenticated:p,config:({axios:e,router:t})=>{t&&(a.value=t),e&&(r.value=e,configureAxios(e))},axios:r,router:a,online:u,networkStatusChange:e=>{s.value=e}}}));var script$q={name:"VAutocomplete",props:{value:{type:Object,required:!0},data:{type:Array,default:()=>null},placeholder:String,label:String,default:Object,store:String,params:Object,autoload:{type:Boolean,default:!1},floating:{type:Boolean,default:!0},src:String,readonly:Boolean,nowrap:Boolean,disabled:Boolean,showSelection:{type:Boolean,default:!0},pagination:{type:Number,default:10}},setup(e,t){const{emit:l,slots:o}=t;useAppStore();const a=ref(0),r=ref(null),n=ref(-1),s=ref(""),i=ref(null),c=ref(!1),d=ref(0),u=ref("");watch((()=>e.value),(e=>{r.value=e})),watch((()=>e.data),(e=>{i.value=e})),onMounted((()=>{u.value=e.inputClass,e.autoload&&m(),document.addEventListener("click",v)})),onBeforeUnmount((()=>{document.removeEventListener("click",v)}));const p=computed((()=>{n.value=-1;const e=s.value?s.value.trim().toLowerCase().split(/[ ,]+/):null;return i.value&&s.value?i.value.filter((t=>{const l=JSON.stringify(t).toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"");return e.every((e=>l.includes(e)))})):i.value})),m=async t=>{const{src:o,source:r}=e;let n=Number(e.pagination);if(1===t)a.value+=n;else if(a.value=0,e.data&&e.autoload)return;let u={query:s.value};e.params&&(u=mergeDeep(u,e.params)),axios$2.get((o||e.source)+(n>0?"/"+a.value+"/"+n:""),{params:u}).then((l=>{const o=l.data;console.log(o),o.error?MsgBox(o.error):(i.value=1===t?i.value.concat(o.data?o.data:o):o.data?o.data:o,console.log(i),d.value=o.size,e.autoload||(c.value=!0),console.log("========================="))})).catch(h).then((()=>{l("complete",{data:i.value,query:s.value,target:"me"})}))},h=e=>{console.log(e)},v=e=>{};return{query:s,show:c,selected:r,data2:p,focused:n,inputClass:u,search:m,remove:()=>{l("input",null)},clickout:v,focusout:e=>{},setSelected:e=>{r.value=e,l("update:modelValue",e)},getLabel:t=>{if(e.label){const l=e.label.split(".");for(let e=0;e<l.length;e++)t&&(t=t[l[e]])}return t},hasSlot:(e="default")=>!!o[e]}}};const _hoisted_1$i=["value","disabled"],_hoisted_2$9=["disabled","placeholder"],_hoisted_3$5={class:"v-list"},_hoisted_4$3=["onClick"],_hoisted_5$1={key:0,class:"center yellow",style:{padding:"5px"}};function render$m(e,t,l,o,a,r){return openBlock(),createElementBlock("div",{class:"v-autocomplete",onFocusout:t[7]||(t[7]=(...e)=>o.focusout&&o.focusout(...e)),value:l.value,disabled:l.disabled},[o.selected&&l.showSelection?(openBlock(),createElementBlock("div",{key:0,class:"v-selection",style:normalizeStyle({whiteSpace:l.nowrap?"nowrap":""})},[renderSlot(e.$slots,"label",{selected:o.selected}),createTextVNode(" "+toDisplayString(o.hasSlot("label")?" ":o.getLabel(o.selected))+"  ",1),l.readonly?createCommentVNode("v-if",!0):(openBlock(),createElementBlock("span",{key:0,onClick:t[0]||(t[0]=(...e)=>o.remove&&o.remove(...e)),class:"remove-icon"},t[8]||(t[8]=[createElementVNode("i",{class:"fa fa-times"},null,-1)])))],4)):createCommentVNode("v-if",!0),o.selected?createCommentVNode("v-if",!0):(openBlock(),createElementBlock("span",{key:1,onClick:t[1]||(t[1]=(...e)=>o.search&&o.search(...e)),class:"search-icon"},t[9]||(t[9]=[createElementVNode("i",{class:"fa fa-xs fa-sync"},null,-1)]))),o.selected?createCommentVNode("v-if",!0):withDirectives((openBlock(),createElementBlock("input",{key:2,onKeyup:[t[2]||(t[2]=(...t)=>e.keyup&&e.keyup(...t)),t[3]||(t[3]=withKeys(withModifiers(((...e)=>o.search&&o.search(...e)),["stop","prevent"]),["enter"]))],class:normalizeClass(o.inputClass),onFocus:t[4]||(t[4]=e=>o.show=!0),disabled:l.disabled,placeholder:l.placeholder,"onUpdate:modelValue":t[5]||(t[5]=e=>o.query=e)},null,42,_hoisted_2$9)),[[vModelText,o.query]]),createVNode(Transition,{name:"fade",persisted:""},{default:withCtx((()=>[withDirectives(createElementVNode("div",{class:"v-resultpane",style:normalizeStyle({zIndex:2,width:"calc(100% - 2px)",position:l.floating?"absolute":"relative"})},[createElementVNode("div",_hoisted_3$5,[(openBlock(!0),createElementBlock(Fragment,null,renderList(o.data2,((t,l)=>(openBlock(),createElementBlock("div",{key:l,class:normalizeClass({"v-selected":o.selected==t,"v-focused":o.focused==l}),onClick:e=>o.setSelected(t)},[renderSlot(e.$slots,"default",{row:t})],10,_hoisted_4$3)))),128)),e.data0&&e.data0.length<e.total?(openBlock(),createElementBlock("div",{key:0,class:"center",onClick:t[6]||(t[6]=e=>o.search(1))},"Load more "+toDisplayString(e.total-e.data0.length)+" results...",1)):createCommentVNode("v-if",!0)]),o.data2&&o.data2.length<1?(openBlock(),createElementBlock("div",_hoisted_5$1,"No results found.")):createCommentVNode("v-if",!0)],4),[[vShow,o.show&&!o.selected]])])),_:3})],40,_hoisted_1$i)}script$q.render=render$m,script$q.__scopeId="data-v-72884078",script$q.__file="src/v-autocomplete.vue";var script$p={name:"VButton",mounted(){var e=this,t=document.createElement("span"),l=document.createElement("i");t.className="ui-button-text ui-c ",t.innerHTML=e.$attrs.value?e.$attrs.value:"ui-button",e.$el.addEventListener("click",(t=>{t.component=e})),e.$attrs.icon?(e.$attrs.value?e.$el.classList.add("v-button-text-icon-left"):e.$el.classList.add("v-button-icon-only"),l.dataset.icon=e.$attrs.icon,l.className="fa "+e.$attrs.icon,e.$el.appendChild(l)):(t=document.createElement("span"),e.$el.classList.add("ui-button-text-only"),e.$el.appendChild(t)),e.$attrs.value&&((t=document.createElement("span")).appendChild(document.createTextNode(e.$attrs.value)),e.$el.appendChild(t)),e.updateIcon()},methods:{updateIcon(){var e=this;setTimeout((function(){var t=e.$el.querySelector("svg");if(t){var l=t.dataset;l.icon||(l.icon=e.$attrs.icon)}}),1e3)}}};const _hoisted_1$h={type:"button",class:"_ ui-widget ui-state-default ui-corner-all v-button"};function render$l(e,t,l,o,a,r){return openBlock(),createElementBlock("button",_hoisted_1$h)}script$p.render=render$l,script$p.__file="src/v-button.vue";var script$o={name:"VCalendar",props:{modelValue:null,type:String,required:String,readonly:String,max:String,min:String},setup(e,{emit:t}){const{type:l,modelValue:o,max:a,min:r}=e,n=ref(null),s=e=>{t("update:modelValue",e),nextTick((()=>{t("changed",e)}))},i=e=>{if(e){let t;if("time"===l)return t=e.split(":"),new Date(1981,1,6,parseInt(t[0]),parseInt(t[1]),t.length>2?parseInt(t[2]):0);{if(!isNaN(e))return new Date(e);let o;if("datetime-local"===l)return o=e.split("T"),t=o[1].split(":"),o=o[0].split("-"),o=new Date(parseInt(o[0]),parseInt(o[1])-1,parseInt(o[2]),parseInt(t[0]),parseInt(t[1]),t.length>2?parseInt(t[2]):0),o;{o=e.split("-");let t=parseInt(o[0]);return t<100?e:(o=new Date(t,parseInt(o[1])-1,parseInt(o[2])),o)}}}return e};watch((()=>e.modelValue),(e=>{c(e)}));const c=e=>{if(!n.value)return;let t,o=i(e);o&&(t="string"==typeof o?o:"time"===l?pad(o.getHours(),2)+":"+pad(o.getMinutes(),2):"datetime-local"===l?pad(o.getFullYear(),4)+"-"+pad(o.getMonth()+1,2)+"-"+pad(o.getDate(),2)+"T"+pad(o.getHours(),2)+":"+pad(o.getMinutes(),2):pad(o.getFullYear(),4)+"-"+pad(o.getMonth()+1,2)+"-"+pad(o.getDate(),2)),n.value.value=t};return{enterD:e=>{let o=e.target.value,n=i(o);return a&&n&&n.getTime()>=i(a).getTime()||r&&n&&n.getTime()<=i(r).getTime()?(t("invalid",{target:me,value:n}),n=null,void(e.target.value=n)):void("time"===l?s(pad(n.getHours(),2)+":"+pad(n.getMinutes(),2)+":00"):n.getTime&&s(n.getTime()))},input:n}}};const _hoisted_1$g=["required","readonly","min","max","type"];function render$k(e,t,l,o,a,r){return openBlock(),createElementBlock("div",null,[createElementVNode("input",{required:l.required,ref:"input",readonly:l.readonly,min:l.min,max:l.max,onChange:t[0]||(t[0]=(...e)=>o.enterD&&o.enterD(...e)),type:l.type?l.type:"date"},null,40,_hoisted_1$g)])}script$o.render=render$k,script$o.__file="src/v-calendar.vue";var script$n={name:"VCheckboxGroup",props:{required:String,name:String},data:()=>({value:[],options:[],nam:null}),created(){this.nam||(this.nam=this.$props.name?this.$props.name:"input_"+id()),this.update2()},updated(){this.update2()},mounted(){this.options=this.$el.querySelectorAll("input:not(.v-chk)");for(var e=0;e<this.options.length;e++)this.options[e].classList.add("v-chk");this.update2()},methods:{update2(){var e=this.options,t=this.$attrs.value;"string"==typeof t&&(t=t.split("|"));for(var l=0;l<e.length;l++){e[l].checked=!1;for(var o=0;t&&o<t.length;o++)e[l].value==t[o]&&(e[l].checked=!0)}},onChange:function(e,t){var l=this,o=l.$attrs.value;if(("string"==typeof o||o instanceof String)&&(o=o.split("|")),t)o||(l.$attrs.value=o=[]),o.push(e);else{var a=o.indexOf(e);a>-1&&o.splice(a,1)}l.$emit("input",o)}}};function render$j(e,t,l,o,a,r){return openBlock(),createElementBlock("div",null,[renderSlot(e.$slots,"default")])}script$n.render=render$j,script$n.__file="src/v-checkbox-group.vue";var script$m=defineComponent({name:"VCheckbox",props:{value:null,modelValue:null,valueFalse:null,label:String,readonly:Boolean},emits:["update:modelValue"],setup(e,{emit:t}){const l=ref(null),o=ref(0),a=computed((()=>e.value?e.value===e.modelValue:["true","1",!0].includes(e.modelValue)));watch((()=>e.modelValue),(e=>{l.value&&(l.value.checked=a.value)}));return onMounted((()=>{l.value&&(l.value.checked=a.value)})),{input:l,hadValue:o,isChecked:a,change:()=>{if(!e.readonly){const a=l.value.checked,r=a?e.value||a:e.valueFalse??a;r&&(o.value=1),t("update:modelValue",r)}},getLabel:computed((()=>e.label||("string"==typeof e.value?e.value:"")))}}});const _hoisted_1$f=["innerHTML"],_hoisted_2$8=["checked","value"];function render$i(e,t,l,o,a,r){return openBlock(),createElementBlock("label",{style:{"font-weight":"normal !important",display:"block"},class:"v-checkbox",onClick:t[1]||(t[1]=withModifiers((()=>{}),["stop"]))},[createElementVNode("span",{innerHTML:e.getLabel},null,8,_hoisted_1$f),createElementVNode("input",{ref:"input",type:"checkbox",checked:e.isChecked,onChange:t[0]||(t[0]=(...t)=>e.change&&e.change(...t)),value:e.value},null,40,_hoisted_2$8),t[2]||(t[2]=createElementVNode("span",{class:"checkmark"},null,-1))])}script$m.render=render$i,script$m.__file="src/v-checkbox.vue";var script$l={name:"VDataview",props:{value:Array,filterKey:String,src:String,filters:Object,store:null,itemWidth:null,rowKey:String,rowStyleClass:null,pagination:null,selectable:Boolean,scrollable:Boolean,autoload:{type:Boolean,default:!0}},data:function(){return{data:null,pages:1,page:1,columns:1,w:0,row:{},error:null,size:null,sortKey:"",selected:[],sortOrders:{},rowStyleClassFunc:null}},created(){var me=this;try{me.rowStyleClass&&(eval("me.rowStyleClassFunc=function(row,item,index){return "+me.rowStyleClass+"}"),me.rowStyleClassFunc({},{},0))}catch(e){me.rowStyleClassFunc=null,console.log("Error en la expresion rowStyleClassFunc=function(row,item,index){return "+me.rowStyleClass+"}")}},updated(){console.log("updated"),this.$emit("updated"),this.resize()},mounted(){var e=this;e.$el.addEventListener("parentResize2",e.resize),e.autoload&&e.load(),e.resize()},methods:{resize(){var e=this;if(e.itemWidth){var t=1+Math.trunc(e.$el.offsetWidth/Number(e.itemWidth));t>6&&(t=6),e.columns=t}},async getStoredList(e){let t=new Promise((t=>{var l=window._.db.transaction(e).objectStore(e).getAll();l.onsuccess=function(){t(l.result)}}));return await t},async loadStore(){let e=this,t=e.store;if(null!=t){let l;return window._.db&&(l=await e.getStoredList(t)),l||(l=[]),e.data=e.data?l.concat(e.data):l,console.log("loadStore"),console.log(e.data),e.data}},getRowClass(e,t){var l=this,o=t%l.columns+1,a=["c-w-"+l.columns];return o==l.columns&&a.push("v-last"),l.rowStyleClassFunc?a.push(l.rowStyleClassFunc(e,e,t)):a.push(l.rowStyleClass),a},remove(e){e=e.id?e.id:e;var t=this.data,l=t.map((e=>e.id)).indexOf(e);t.splice(l,1)},error2(e,t){this.data=[],this.error=t},load(e){var t=this;if(this.selected=[],t.value)t.data=t.value;else{!0===e&&(t.page=1);var l=t.src;l||(l=t.$root.apiLink(window.location.pathname)),l.endsWith("/")&&(l=l.slice(0,l.length-1)),t.pagination&&(l+="/"+(t.page-1)*t.pagination+"/"+t.pagination),axios.get(l,{error:t.error2,params:t.filters}).then((function(l){if(l.data&&l.data.error)MsgBox(l.data.error);else{var o=t.value?t.value:l.data.data?l.data.data:l.data;t.data||(t.data=[]),t.data=!0===e?o:t.data?t.data.concat(o):t.data,t.size=l.data.size,l.data&&l.data.size&&(t.pages=Math.ceil(l.data.size/t.pagination),t.page>t.pages&&(t.page=1)),t.$emit("loaded",{target:t,response:l})}})).catch(t.error)}}}};const _hoisted_1$e={class:"v-dataview"};function render$h(e,t,l,o,a,r){return openBlock(),createElementBlock("div",_hoisted_1$e,[e.data?(openBlock(!0),createElementBlock(Fragment,{key:0},renderList(e.data,((t,l)=>(openBlock(),createElementBlock("div",{class:normalizeClass(r.getRowClass(t,l))},[renderSlot(e.$slots,"default",{row:t,item:t,index:l})],2)))),256)):createCommentVNode("v-if",!0),e.data&&!e.data.length?(openBlock(),createElementBlock("div",{key:1,class:normalizeClass(["center v-no-results",{error:e.error}])},toDisplayString(e.error?e.error:"No existen registros para mostrar"),3)):createCommentVNode("v-if",!0),e.data&&e.size>e.data.length?(openBlock(),createElementBlock("div",{key:2,onClick:t[0]||(t[0]=t=>r.load(e.page++)),class:"center v-more-results"},"Ver mas resultados")):createCommentVNode("v-if",!0)])}script$l.render=render$h,script$l.__file="src/v-dataview.vue";var script$k={name:"VFieldset",props:{legend:String,closable:null},watch:{closed(e){this.$emit("change",{target:this,closed:e}),this.$emit("input",!e)}},data:()=>({closed:!1}),created(){this.closed=this.closable},mounted(){var e=this;e.$el.addEventListener("parentResize",(t=>{t.$target=e,e.$emit("resize",t)}))},updated(){var e=this;setTimeout((function(){var t=e.$el.querySelector("legend > * > svg");if(t)try{console.log(),t.dataset.icon=t.parentNode.dataset.icon}catch(e){console.log("icon"),console.log(e)}}),50)}};const _hoisted_1$d={class:"v-fieldset"},_hoisted_2$7=["data-icon"],_hoisted_3$4=["innerHTML"],_hoisted_4$2={style:{flex:"1",display:"flex","flex-direction":"column"}};function render$g(e,t,l,o,a,r){return openBlock(),createElementBlock("fieldset",_hoisted_1$d,[l.legend?(openBlock(),createElementBlock("legend",{key:0,onClick:t[0]||(t[0]=e=>a.closed=l.closable&&!a.closed),style:normalizeStyle({cursor:l.closable?"pointer":""})},[l.closable?(openBlock(),createElementBlock("span",{key:0,"data-icon":a.closed?"plus":"minus",style:{margin:"0px 5px 0px 0px"}},[createElementVNode("i",{class:normalizeClass([a.closed?"fa-plus":"fa-minus","fa"])},null,2)],8,_hoisted_2$7)):createCommentVNode("v-if",!0),createElementVNode("span",{innerHTML:l.legend},null,8,_hoisted_3$4)],4)):createCommentVNode("v-if",!0),withDirectives(createElementVNode("div",_hoisted_4$2,[renderSlot(e.$slots,"default")],512),[[vShow,!a.closed]])])}script$k.render=render$g,script$k.__file="src/v-fieldset.vue";var script$j={name:"VForm",props:["header","store","action"],setup(e,t){const{store:l}=e,{slots:o,expose:a}=t,r=ref(null),n=inject("viewCollector");return provide("formCollector",{get:()=>({...e})}),n.push({store:l,type:"v-form",$el:r,$forceUpdate:()=>{}}),a({...e}),()=>{const t=[];return e.header&&t.push(h$1("div",{class:"v-widget-header v-panel-titlebar"},[h$1("span",{class:"v-panel-title"},e.header)])),t.push(h$1("div",{ref:r,class:"v-dialog-content v-widget-content"},[h$1("form",{action:e.action},o.default())])),h$1("div",{class:"ui-panel"},t)}},watch:{header(e){this.setTitle(e)}},data:()=>({timer:null}),methods:{setTitle(e){var t=this.$parent.app;t&&setTimeout((()=>{t.title=e}),100)},getAbsoluteHeight(e){var t=window.getComputedStyle(e),l=parseFloat(t.marginTop)+parseFloat(t.marginBottom);return Math.ceil(e.offsetHeight+l)}},mounted(){var e=this;e.$el.querySelector("form").addEventListener("submit",(t=>{t.preventDefault();var l=e.$parent;return l.refresh&&l.refresh(),!1})),e.setTitle(e.header)},updated(){for(var e=this.$el.querySelectorAll("[type=number]:not(._)"),t=0;t<e.length;t++){var l=()=>{var e=this,t=e.value;if(t){t=n(t),e.max&&t>n(e.max)&&(t=n(e.max)),e.min&&t<n(e.min)&&(t=n(e.min));var l=this.getAttribute("decimal");null!==l&&(t=t.toFixed(1*l)),e.value=t}};e[t].oninput=l,e[t].onblur=l,e[t].classList?e[t].classList.add("_"):e[t].className="_"}e=this.$el.querySelectorAll(".numeric:not(._)");for(t=0;t<e.length;t++)e[t].addEventListener("keyup",(e=>{86==e.keyCode&&isNaN(this.value)&&(this.value="")})),e[t].addEventListener("keydown",(e=>{console.log("eeeeeee"+e.keyCode),-1!==[46,8,9,27,13,110,88,86].indexOf(e.keyCode)||65===e.keyCode&&(!0===e.ctrlKey||!0===e.metaKey)||e.keyCode>=35&&e.keyCode<=40||(e.shiftKey||e.keyCode<48||e.keyCode>57)&&(e.keyCode<96||e.keyCode>105)&&e.preventDefault()})),e[t].classList?e[t].classList.add("_"):e[t].className="_"},__file:"src/v-form.vue"},script$i={name:"VGroup",props:{required:String,name:String},data:()=>({value:null,nam:null}),updated(){this.update2()},mounted(){this.update2()},created(){this.nam||(this.nam=this.$props.name?this.$props.name:"input_"+window._.id())},methods:{getInputs(e,t){var l=this;return e.children&&Array.from(e.children).forEach((e=>{"INPUT"==e.tagName?t.push(e):e.classList.contains("v-group")||l.getInputs(e,t)})),t},update2(){for(var e=this.getInputs(this.$el,[]),t=0;t<e.length;t++)e[t].value==this.$attrs.value?e[t].checked=!0:e[t].checked=!1},onChange(e){this.value=e,""===e&&(e=null),this.$emit("input",e)}}};const _hoisted_1$c={class:"v-group"};function render$f(e,t,l,o,a,r){return openBlock(),createElementBlock("div",_hoisted_1$c,[renderSlot(e.$slots,"default")])}script$i.render=render$f,script$i.__file="src/v-group.vue";var script$h={name:"VLayerControl",data:()=>({loaded:null,map:null,district:null,dl:null}),setup({baseURL:e="https://web.regionancash.gob.pe"},{emit:t}){const l=ref(),o=inject("collector"),a=ref(),r=ref();let n,s;return o.push((o=>{(o=>{r.value=o;let i=new Collection;l.value=i;let c=document.createElement("i");c.setAttribute("class","fa fa-expand"),o.addControl(new FullScreen({label:c,tipLabel:"Fullscreen"}));let d=new VectorSource({url:e+"/fs/geo/02.geojson",format:new GeoJSON}),u=a.value=new VectorLayer({source:d,style:e=>new Style({fill:new Fill({color:"rgba(255, 0, 0, 0.0)"}),stroke:new Stroke({color:"#4073CE",width:1}),text:new Text({text:e.values_.name?e.values_.name.toUpperCase():"",fill:new Fill({color:"#4073CE"}),stroke:new Stroke({color:"#4073CE",width:.5})})}),id:"provinces"});u.onChange=e=>{let t=e.feature;s!=t.getId()&&(i.clear(),i.push(t),e.preventDefault&&e.preventDefault(),s=t.getId(),n=t,o.getView().fit(t.getGeometry().getExtent(),{duration:200,callback:()=>{}}))};let p=d.on("change",(()=>{let e,t=d.getFeatures();for(let l=0;l<t.length;l++)if(1*t[l].id_==1*e){u.onChange({feature:t[l]});break}unByKey(p)})),m=new VectorLayer({preload:1/0,source:new VectorSource,id:"districts",style:e=>new Style({fill:new Fill({color:"rgba(16, 110, 138, 0.0)"}),stroke:new Stroke({color:"#194300",width:1}),text:new Text({text:e.values_.name?e.values_.name.toUpperCase():"",fill:new Fill({color:"#194300"}),stroke:new Stroke({color:"#194300",width:.5})})})});o.on("moveend",(()=>{if(n){if(n.id_<1e4){m.setSource(new VectorSource({url:e+"/fs/geo/"+n.id_+".geojson",format:new GeoJSON}));let t=m.getSource().on("change",(()=>{unByKey(t)}))}t("scope",{feature:n,target:{}}),n=null}})),u.onSelect=e=>{me.$emit("select",e)},o.addLayer(u),o.addLayer(new VectorLayer({id:"district",source:new VectorSource,style:new Style({fill:new Fill({color:"rgba(255, 150, 150, 0.0)"}),stroke:new Stroke({color:"#4073CE",width:1})})})),new Style({fill:new Fill({color:"rgba(16, 110, 138, 5.0)"})}),new Style({fill:new Fill({color:"rgba(255, 150, 150, 0.0)"})}),m.onChange=e=>{let t=e.feature;s!=t.getId()&&(2==i.getLength()&&i.pop(),i.push(t),e.preventDefault&&e.preventDefault(),s=t.getId(),n=t,o.getView().fit(t.getGeometry().getExtent(),{duration:300}))},m.onSelect=e=>{t("select",e)},o.addLayer(m),t("render",{map:o})})(o)})),{}}};function render$e(e,t,l,o,a,r){return openBlock(),createElementBlock("div",null,[renderSlot(e.$slots,"default")])}script$h.render=render$e,script$h.__file="src/v-layer-control.vue";var script$g={name:"VMapControl",setup(e,{emit:t}){const{visible:l}=e,o=ref(null),a=ref(!!l),r=inject("collector"),n=ref(null);r.push((e=>{e.addControl(new Control({element:o.value})),n.value=!0}));const s=ref();return{el:o,ready:n,visible0:a,enter:e=>{e.stopPropagation(),s.value?clearTimeout(s.value):t("click",e),s.value=setTimeout((()=>{s.value=null}),500)}}},props:{icon:String,visible:{default:1}},computed:{slotPassed(){return!!this.$slots.default}},data:()=>({slotUsed:!1}),updated(){var e=this.$el.querySelectorAll(":scope > :not(.v-map-control-button)").length;0==e&&(e=this.$el.textContent.trim().length),this.slotUsed=e},methods:{toggle(){this.visible0=!this.visible0}}};const _hoisted_1$b={ref:"el",class:"ol-unselectable ol-control"};function render$d(e,t,l,o,a,r){return withDirectives((openBlock(),createElementBlock("div",_hoisted_1$b,[renderSlot(e.$slots,"default"),a.slotUsed?createCommentVNode("v-if",!0):(openBlock(),createElementBlock("button",{key:0,class:"v-map-control-button",onClick:t[0]||(t[0]=withModifiers(((...e)=>o.enter&&o.enter(...e)),["prevent"]))},[l.icon?(openBlock(),createElementBlock("i",{key:0,class:normalizeClass(["fa fa-xs",l.icon])},null,2)):createCommentVNode("v-if",!0)]))],512)),[[vShow,o.ready&&!0]])}script$g.render=render$d,script$g.__file="src/v-map-control.vue";class Drag extends PointerInteraction{constructor(){super({handleDownEvent:handleDownEvent,handleDragEvent:handleDragEvent,handleMoveEvent:handleMoveEvent,handleUpEvent:handleUpEvent}),this.layers_=[],this.coordinate_=null,this.listeners_=[],this.cursor_="pointer",this.feature_=null,this.previousCursor_=void 0}addLayers(e){e.forEach((e=>{this.layers_.push(e)}))}$on(e,t){this.listeners_.push(t)}}function handleDownEvent(e){const t=e.map,l=this.layers_,o=t.forEachFeatureAtPixel(e.pixel,(function(e,t){if(t&&l.indexOf(t)>-1)return[e,t]}));return o&&(this.coordinate_=e.coordinate,this.feature_=o[0]),!!o}function handleDragEvent(e){const t=e.coordinate[0]-this.coordinate_[0],l=e.coordinate[1]-this.coordinate_[1];this.feature_.getGeometry().translate(t,l),this.coordinate_[0]=e.coordinate[0],this.coordinate_[1]=e.coordinate[1]}function handleMoveEvent(e){if(this.cursor_){const t=e.map,l=this.layers_,o=t.forEachFeatureAtPixel(e.pixel,(function(e,t){if(t&&l.indexOf(t)>-1)return e})),a=e.map.getTargetElement();o?a.style.cursor!=this.cursor_&&(this.previousCursor_=a.style.cursor,a.style.cursor=this.cursor_):void 0!==this.previousCursor_&&(a.style.cursor=this.previousCursor_,this.previousCursor_=void 0)}}function handleUpEvent(){return this.listeners_.forEach((e=>{e({feature:this.feature,coordinate:this.coordinate_})})),this.coordinate_=null,this.feature_=null,!1}var script$f={name:"VMap",setup(e,{emit:t,expose:l}){const o=ref(null),a=ref(null),r=ref(null),n=ref(null),s=reactive([]);provide("collector",{remove(e){s.splice(s.indexOf(e),1)},push(e){s.push(e)}});const i=e=>{a.value.addLayer(e),t("addlayer",e)},c=(e,l)=>{let o,r;e=e||{};const n=a.value;e.lon&&e.lat?(r=[e.lon,e.lat],o=new Point(r[0]>-100?fromLonLat(r):r)):o=new Point(n.getView().getCenter()),r=o.flatCoordinates;const s=r[0]<-1e4?toLonLat(r):r;t("translateend",{lon:s[0],lat:s[1]}),e.geometry=o;const i=new Feature(e);i.data=e,"object"==typeof e.style?i.setStyle(e.style):i.setStyle(n.styleMap[e.style?e.style:"default"]),r=o.flatCoordinates,r=r[0]<-1e4?toLonLat(r):r,t("translateend",{lon:r[0],lat:r[1]});const c=e.layer||"default";let d=n.getLayerById(c);if(d?d.getSource().addFeatures(i):n.addLayer(d=new VectorLayer({id:c,source:new VectorSource({features:new Collection([i])})})),e.draggable){let e=n.drag;e||(n.drag=e=new Drag,e.$on("up",(({coordinate:e,feature:l})=>{const o=toLonLat(e);t("translateend",{lon:o[0],lat:o[1],feature:l})})),n.addInteraction(e),e.addLayers([d]))}return l&&n.getView().animate(Object.assign({center:i.getGeometry().getCoordinates(),zoom:17,duration:500},l)),i},d=e=>{const l={default:new Style({image:new Circle({radius:8,stroke:new Stroke({color:"#8a0000",width:2}),fill:new Fill({color:"#ff0000"})})}),star:[new Style({image:new RegularShape({fill:new Fill({color:"#ff0000"}),stroke:new Stroke({color:"#8a0000",width:2}),points:5,radius:10,radius2:4,angle:0})})]};let o=((e,t)=>{t||(t=window.location.href);const l=new RegExp("[?&]"+e+"=([^&#]*)").exec(t);return l&&l[1]||0})("location"),i=-1;if(o){let e=o.split("/");o=[parseFloat(e[0]),parseFloat(e[1])],i=e[2],r.value=!0}else o=!1;const d=new Map({target:e,layers:[new Tile({source:new OSM})],view:new View({center:[0,0],zoom:2})});d.getLayerById=function(e="default"){let t;return d.getLayers().forEach((l=>{l.get("id")!==e||(t=l)})),t},d.styleMap=l,r.value?(d.getView().setCenter(o),console.log("en el momento de cargar moved to pageLocation="+o),d.getView().setZoom(i||12),a.value=d,console.log("distarar evento buid pageLocation="+o),t("build",m)):(d.getView().fit([-8756221.995832639,-1207995.483261405,-8541070.763947014,-899052.0546471546],d.getSize()),a.value=d,t("build",{map:d}),s.forEach((e=>{e(d)}))),d.getView().getZoom(),d.on("moveend",(()=>{n.value&&(n.value(m),n.value=null),d.getView().getZoom()})),d.on("singleclick",(e=>{let t=d.forEachFeatureAtPixel(e.pixel,((e,t)=>{if(t)return[e,t]}));if(t){let l=t[1],o=t[0];if(e.feature=o,e.map=d,e.preventDefault(),l.onSelect)return void l.onSelect(e)}})),d.on("dblclick",(e=>{let l=d.forEachFeatureAtPixel(e.pixel,((e,t)=>{if(t)return[e,t]}));if(l){let o=l[1];if(l=l[0],e.feature=l,e.map=d,o.onChange)return void o.onChange(e);t("change",l),d.getView().animate({center:l.getGeometry().getCoordinates(),zoom:17,duration:500},(()=>{for(let t=0;t<m.$children.length;t++){let t=m.$children[0];t.open&&t.open(e)}}))}})),a.value=d,setTimeout((()=>{d.updateSize(),d.getView().fit([-8756221.995832639,-1207995.483261405,-8541070.763947014,-899052.0546471546],d.getSize()),a.value=d,t("build",{map:d,addFeature:c})}),100)};return watch(o,(e=>{e&&nextTick((()=>{t("beforeBuild"),d(e)}))})),l({addFeature:c,addLayer:i,map:a,empty:(e="default")=>{if(e=a.value.getLayerById(e)){const t=e.getSource();if(t instanceof VectorSource){return 0===t.getFeatures().length}}return!0}}),{el:o,addLayer:i,addFeature:c}},data:()=>({moved:!1,map:null,movingCompleted:null,styleMap:null,coordinate:{}})};const _hoisted_1$a={ref:"el"};function render$c(e,t,l,o,a,r){return openBlock(),createElementBlock("div",_hoisted_1$a,[renderSlot(e.$slots,"default")],512)}script$f.render=render$c,script$f.__file="src/v-map.vue";var script$e={name:"VNumber",props:{value:Number,max:Number,min:Number,delay:Number},setup(e,t){const{emit:l}=t,o=ref(null);onMounted((()=>{o.value=e.value})),onUpdated((()=>{o.value=t.attrs.modelValue}));return{v:o,handleInput:t=>{let a=o.value;const r=t.target.getAttribute("decimal");null!==a?(a=num(a),e.max&&a>num(e.max)&&(a=num(e.max)),e.min&&a<num(e.min)&&(a=num(e.min)),null!==r&&(a=a.toFixed(Number(r)))):a=null,o.value=t.target.value;let n=_$1.calendarTimer;n&&clearTimeout(n),e.delay?_$1.calendarTimer=setTimeout((()=>{l("input",a),_$1.calendarTimer=null}),13===t.keyCode?0:e.delay):l("input",a)}}}};function render$b(e,t,l,o,a,r){return withDirectives((openBlock(),createElementBlock("input",{type:"number",onKeyup:t[0]||(t[0]=withKeys(((...e)=>o.handleInput&&o.handleInput(...e)),["enter"])),"onUpdate:modelValue":t[1]||(t[1]=e=>o.v=e),onInput:t[2]||(t[2]=(...e)=>o.handleInput&&o.handleInput(...e)),class:"_"},null,544)),[[vModelText,o.v,void 0,{number:!0}]])}script$e.render=render$b,script$e.__file="src/v-number.vue";var script$d={setup(e,t){const l=e,{valueField:o,displayField:a,store:r,filter:n,name:s}=l,{expose:i,emit:c}=t,d=ref([]),u=ref([]),p=ref([]);ref(null);const m=inject("collect");o&&(p.value=o.split("."));const h=computed((()=>{const e=(l.data||[]).concat(u.value||[]);return n?e.filter((e=>-1!==JSON.stringify(e).toLowerCase().indexOf(n.toLowerCase()))):e}));watch(h,(e=>{}));const v=(e,t)=>{const l=p.value;if(l&&l.length)for(let t=0;t<l.length;t++)e&&(e=e[l[t]]);else e&&!t&&(e=e.id?e.id:e.code?e.code:e);return e};let f=o,g=a;g||(g=f);const y=async(e=null,t=null,l=!1)=>{if(!l&&t&&e&&d.value.push([e,t]),!(d.value.length>1)){if(u.value=[],r){let t=await getStoredList(r);const[l]=e?Object.keys(e):[];if(l){let o;try{const a=t.filter((t=>(o=t,o[l].startsWith(e[l]))));u.value=a}catch(e){log(s,"options.error trying to filter ",o),console.error(e)}}else u.value=u.value.concat(t)}for(m(h),l||d.value.shift();d.value.length;){const e=d.value.shift()||[];await y(e[0],e[1],!0)}}};return y.getObjectByIndex=e=>{const t=h.value;return t?t[e]:null},y.getValueByIndex=e=>{const t=h.value;return t?v(t[e],1):null},y.getIndexByValue=(e,t)=>{e&&e.id?e=e.id:e&&e.code&&(e=e.code);for(let l=0;l<h.value.length;l++){const o=h.value[l];if(v(o)==e)return t&&t(l,o),l}return t&&t(-1),-1},m.push(y),onUpdated((()=>{m((l.data||[]).concat(u.value))})),onUnmounted((()=>{m.remove(y)})),i({load:y}),()=>h.value.map((e=>{const t=g?e[g]:e;return h$1("option",f?{value:v(e)}:{value:e.id||e.code||JSON.stringify(e)},t)}))},name:"VOptions",props:{url:String,src:String,name:String,displayField:String,data:Array,store:null,valueField:String,filters:null,filter:null,mode:null},updated(){let e=this;!e.loaded&&e.data&&(e.data2=e.data)},methods:{getParentE(){return this.$el.parentElement.parentElement},getSelectedItem(){let e=this.$el.parentElement;return this.filterList[e.selectedIndex-1]}},__file:"src/v-options.vue"},ol=window.ol,_=window._,axios$1=window.axios,script$c={name:"VOverlay",props:{value:{value:Object},src:String,width:{default:400},header:String},data:()=>({coordinate:null,overlay:null,location:null,ele:null,c:0}),created(){var e=this;e.$parent.$on("beforeBuild",(t=>{console.log(t),e.overlay=new ol.Overlay({element:e.$el,positioning:"bottom-right"})})),e.$parent.$on("build",(t=>{t.map.addOverlay(e.overlay)}))},mounted(){var e=this;e.header&&e.$el.childNodes[0].addEventListener("mousedown",(function(t){const l=e.$el.parentElement;var o=window.getComputedStyle(l),a=parseFloat(o.left),r=parseFloat(o.top),n=t.clientX,s=t.clientY,i=l.parentElement;function c(e){l.style.left=a+e.clientX-n+"px",l.style.top=r+e.clientY-s+"px"}i.addEventListener("mousemove",c,!1),i.addEventListener("mouseup",(function(){i.removeEventListener("mousemove",c,!1)}),!1)}),!1)},methods:{close(){this.overlay&&this.overlay.setPosition()},hasSlot(e="default"){return!!this.$slots[e]||!!this.$scopedSlots[e]},load(){var e=this;axios$1.get(_.remoteServer+e.src).then((t=>{e.$emit("input",t.data)}))},open(e){for(var t=this,l=e.map,o=e.feature,a=t.overlay,r=a.element,n=t.$parent.$children,s=0;s<n.length;s++)n[s].close&&(n[s].$el.style.opacity=0,n[s].close());e.coordinate?t.coordinate=e.coordinate:(e.coordinate=l.getView().getCenter(),t.coordinate=null),a.setPosition(e.coordinate);var i=l.getView().getCenter(),c=l.getView().getResolution(),d=o?o.getGeometry().getCoordinates():[null],u=l.getPixelFromCoordinate(Number(d[0])?d:e.coordinate);if(this.src)axios$1.get(_.remoteServer+this.src).then((e=>{t.$emit("input",e.data),t.c++,setTimeout((function(){var e=l.viewport_.offsetWidth,o=l.viewport_.offsetHeight,n=r.children[0].children[1];n.scrollTop=0;var s=r.offsetHeight;n.style.height=s+100>=o?o-100-r.children[0].children[0].offsetHeight+"px":"300px",s=r.offsetHeight;var d=1*t.width,p=e<=d+40?e-40:d;if(r.style.zIndex=10,r.style.width=p+"px",p/=2,l.getView().animate({center:[i[0]+(u[0]+p+20>=e?+(u[0]+p+20-e):u[0]-20-p<0?-p+u[0]-20:0)*c,i[1]+(u[1]<s?s-u[1]:0)*c],duration:500}),u[0]=u[0]+p-0,u[1]=u[1]-12,a.setPosition(l.getCoordinateFromPixel(u)),t.$el.style.opacity=1,_.mobil)for(var m=a.getElement().querySelectorAll("a:not(._)"),h=0;h<m.length;h++)m[h].addEventListener("click",_.open2)}),400)})).catch((e=>{console.log(e)}));else{var p=l.viewport_.offsetWidth,m=l.viewport_.offsetHeight,h=r.children[0].children[1];h.scrollTop=0;var v=r.offsetHeight;console.log(r.offsetHeight),h.style.height=v+100>=m?m-100-r.children[0].children[0].offsetHeight+"px":"300px",v=r.offsetHeight;var f=1*t.width,g=p<=f+40?p-40:f;if(r.style.zIndex=10,r.style.width=g+"px",g/=2,l.getView().animate({center:[i[0]+(u[0]+g+20>=p?+(u[0]+g+20-p):u[0]-20-g<0?-g+u[0]-20:0)*c,i[1]+(u[1]<v?v-u[1]:0)*c],duration:500}),u[0]=u[0]+g-0,u[1]=u[1]-12,a.setPosition(l.getCoordinateFromPixel(u)),t.$el.parentNode.style.opacity=0,t.$el.style.opacity=1,t.$el.parentNode.style.top=(m-t.$el.offsetHeight)/2+"px",t.$el.parentNode.style.opacity=1,_.mobil){var y=a.getElement().querySelectorAll("a:not(._)");for(s=0;s<y.length;s++)y[s].addEventListener("click",_.open2)}t.$emit("opened",{target:t})}}}};const _hoisted_1$9={class:"v-ol-overlay"},_hoisted_2$6={key:0,class:"v-panel-titlebar"},_hoisted_3$3={key:2,style:{"text-align":"center"}};function render$a(e,t,l,o,a,r){return openBlock(),createElementBlock("div",_hoisted_1$9,[l.header?(openBlock(),createElementBlock("div",_hoisted_2$6,[createElementVNode("span",{class:"v-icon v-icon-close",onClick:t[0]||(t[0]=(...e)=>r.close&&r.close(...e))},t[1]||(t[1]=[createElementVNode("i",{class:"fa fa-times"},null,-1)])),createTextVNode(toDisplayString(l.header),1)])):createCommentVNode("v-if",!0),(openBlock(),createElementBlock("div",{class:"v-ol-body",key:"c-"+a.c,style:{padding:"10px"}},[l.value?renderSlot(e.$slots,"default",{key:0,value:l.value}):createCommentVNode("v-if",!0)])),r.hasSlot("footer")&&l.value?(openBlock(),createElementBlock("footer",{key:"f-"+a.c},[renderSlot(e.$slots,"footer",{value:l.value})])):createCommentVNode("v-if",!0),a.coordinate?(openBlock(),createElementBlock("div",_hoisted_3$3,t[2]||(t[2]=[createElementVNode("img",{src:_imports_0,width:"20",height:"18"},null,-1)]))):createCommentVNode("v-if",!0)])}script$c.render=render$a,script$c.__file="src/v-overlay.vue";var script$b={name:"VPanel",props:{header:String}};const _hoisted_1$8={class:"ui-panel"},_hoisted_2$5={key:0,class:"v-panel-titlebar v-widget-header ui-helper-clearfix ui-corner-all"},_hoisted_3$2={class:"v-panel-title"},_hoisted_4$1={class:"v-panel-content v-dialog-content v-widget-content"};function render$9(e,t,l,o,a,r){return openBlock(),createElementBlock("div",_hoisted_1$8,[l.header?(openBlock(),createElementBlock("div",_hoisted_2$5,[createElementVNode("span",_hoisted_3$2,toDisplayString(l.header),1)])):createCommentVNode("v-if",!0),createElementVNode("div",_hoisted_4$1,[renderSlot(e.$slots,"default")])])}script$b.render=render$9,script$b.__file="src/v-panel.vue";var script$a={name:"VPopup",data:()=>({show:null,overlay:null}),mounted(){var e=this;e.$el.addEventListener("close",(function(){e.hide()}))},destroyed(){var e=this.overlay;e&&(e.style.visibility="hidden",e.style.opacity=0,e.remove(),e=null)},methods:{hide(){var e=this.overlay;e&&(e.style.visibility="hidden",e.style.opacity=0),this.show=0},toggle(){var e=this;e.show=!e.show;var t=e.overlay;if(e.show){var l=document.querySelector(".v-layout-north");e.$el.style.top=l.offsetHeight+"px",console.log(e.$el),t||((t=document.createElement("div")).classList.add("v-overlay"),t.style.padding="40px",t.addEventListener("click",(function(){t.style.visibility="hidden",t.style.opacity=0,e.show=!1})),document.body.appendChild(e.overlay=t)),t.style.visibility="unset",t.style.opacity="unset"}else this.hide()}}};const _hoisted_1$7={class:"v-popup",style:{position:"absolute"}};function render$8(e,t,l,o,a,r){return withDirectives((openBlock(),createElementBlock("div",_hoisted_1$7,[renderSlot(e.$slots,"default")],512)),[[vShow,a.show]])}script$a.render=render$8,script$a.__file="src/v-popup.vue";var script$9={name:"VRadio",props:{value:String,label:String,className:String},methods:{getClass(){return"v-radio "+this.className}},mounted(){var e=this,t=e.$el.querySelector("input");e.$parent&&e.$parent.nam&&(t.name=e.$parent.nam),t.onclick=function(){}},updated(){this.$el.querySelector("input")}};const _hoisted_1$6=["value"];function render$7(e,t,l,o,a,r){return openBlock(),createElementBlock("label",{class:normalizeClass(r.getClass())},[createTextVNode(toDisplayString(l.label?l.label:l.value)+" ",1),createElementVNode("input",{type:"radio",value:l.value},null,8,_hoisted_1$6),t[0]||(t[0]=createElementVNode("span",{class:"checkmark"},null,-1)),renderSlot(e.$slots,"default")],2)}script$9.render=render$7,script$9.__file="src/v-radio.vue";var script$8={__name:"v-radio-group",props:{required:String,name:String,modelValue:String,items:{type:Array},type:{type:String,default:"radio"},label:{type:String,default:""}},emits:["update:modelValue"],setup(e,{emit:t}){const l=e,o=t,a=ref(l.modelValue),{proxy:r}=getCurrentInstance(),n=new Set,s=(e,t)=>(e.children&&Array.from(e.children).forEach((e=>{"INPUT"===e.tagName?t.push(e):e.classList&&e.classList.contains("v-group")||s(e,t)})),t),i=()=>{const e=s(r.$el,[]);let t=l.name;t||(t="input_"+Date.now().toString(36)+Math.random().toString(36).substring(2,15));const o=""===r.$props.required||r.$props.required;let i=!1;for(let l=0;l<e.length;l++)e[l].name=t,n.has(e[l])||(e[l].addEventListener("change",c),n.add(e[l])),e[l].checked=e[l].value===a.value,e[l].checked&&(i=!0),e[l].required=o,o&&(a.value?e[l].nextElementSibling.classList.remove("required"):e[l].nextElementSibling.classList.add("required"));i&&removeError(e[0].parentNode.parentNode)},c=e=>{let t=e.target.value;""===t&&(t=null),a.value=t,o("update:modelValue",t)};watch((()=>l.modelValue),(e=>{a.value=e,i()})),onMounted((()=>{i()})),onUpdated((()=>{i()}));const d=()=>{const e=[];return r.$slots.default&&e.push(...r.$slots.default()),l.items&&e.push(...l.items.map((e=>h$1(script$9,{className:l.required&&!l.modelValue?"required":null,...e,modelValue:a.value,"onUpdate:modelValue":c})))),h$1("div",{class:"v-radio-group"},[l.label&&h$1("label",l.label),...e])};return(e,t)=>(openBlock(),createBlock(d))},__file:"src/v-radio-group.vue"},script$7={name:"VSelect",setup(e,t){const{slots:l,emit:o}=t,{valueField:a,disabled:r,readonly:n,autoload:s,name:i}=e,c=ref([]),d=ref([]),u=ref(null),p=ref([]),m=[],h=ref(!(s+""=="false"||1*s==0)),v=ref(null),f=t=>{c.value=t,nextTick((()=>{g(e.modelValue||u.value)}))},g=t=>{let l=t||e.modelValue;if(v.value){let t=v.value,a=t.selectedIndex;l&&""!==l||(t.selectedIndex=0),log(i,"value===",l);const r=l?""+(l.id||l.code||l):l;for(let e=0;e<t.length;e++)t[e].value===r&&(t.selectedIndex=e);const n=m;for(let r=0;r<n.length;r++){if(!n[r].getValueByIndex)continue;let s=n[r].getValueByIndex(a-1);n[r].getIndexByValue(l,((a,d)=>{if(a>-1){let d=n[r].getObjectByIndex(a),p=Number(s);p=isNaN(p)?s?!!l&&(l.id?l.id==s.id:l==s):!l:p==Number(l),u.value!=e.modelValue&&(log(i,"select.value",l,"object=",d),e.modelValue&&(u.value=e.modelValue),p||(log(i,"select.updateSelect="+l+" "+JSON.stringify(c.value.length)),t.selectedIndex=a+1,o("update:modelValue",l,{value:l,select:t,object:d}),nextTick((()=>{o("input",l,{value:l,select:t,object:d})}))))}else e.modelValue&&(u.value=e.modelValue),log(i,"select.updateselect.not fout",a),o("update:modelValue",null,null),nextTick((()=>{o("input",null,{value:null})})),t.selectedIndex=0}))}}};f.remove=e=>{const t=m.filter((t=>t!==e));m.length=0,t.forEach((e=>m.push(e)))},f.push=e=>{m.push(e)},a&&(d.value=a.split(".")),provide("collect",f);watch((()=>e.modelValue),((e,t)=>{e!=t&&g()})),watch((()=>e.disabled),((e,t)=>{y(e,t)}));const y=(e,t)=>{e=!!e,t=!!t;let l=p.value;log(i,"activate.newVal=",e,"oldVal=",t),!e&&!e===t&&l.length&&$(l[0],l[1])},$=(t,l)=>{e.disabled?(log(i,"select.load.params=",t),p.value=[t,l],m.forEach((e=>{e(t,l)}))):(p.value=[],m.forEach((e=>{e(t,l)})))};return onMounted((()=>{h.value&&$()})),{options:c,getValueField:(e,t)=>{const l=d.value;if(l&&l.length)for(let t=0;t<l.length;t++)e&&(e=e[l[t]]);else e&&!t&&(e=e.id?e.id:e.code?e.code:e);return e},onChange:e=>{e.stopPropagation();let t=e.target.value;const l=v.value;log(i,"select.onchange=",t),t&&""!==t||(t=null,l.selectedIndex=0);let a,r=0;const n=c.value;for(let e=0;e<m.length;e++){if(r=m[e].getValueByIndex(l.selectedIndex-1),-1!=r){a=m[e].getObjectByIndex(l.selectedIndex-1);break}r=0}r?(log(i,"change=found=",r),t=r):n.length&&(l.selectedIndex=0),o("update:modelValue",t,{value:t,select:l,object:a}),nextTick((()=>{o("input",t,{value:t,select:l,object:a})}))},selectRef:v,load:$,lastLoad:p,autoload_:h}},props:{modelValue:null,required:null,readonly:null,multiple:null,label:null,name:null,disabled:null,autoload:null,valueField:null},data:()=>({autoload_:!0,ik:0,data:[],popup:null,show:!1,sel:[],sela:null,tmp:[],sel2:[]}),watch:{show(e){let t=this;if(e){let e=this.$refs.button,l=this.popup;l||(l=this.$refs.popup,l.style.position="absolute",document.body.append(l));let o=e.getBoundingClientRect();const a=l.children[0];window.innerWidth<400?(l.style.padding="40px",l.style.height="100%",a.style.height="100%"):(l.style.top=o.bottom+0+"px",l.style.left=o.left+0+"px",l.style.maxHeight=window.innerHeight-o.bottom-30+"px",a.style.maxHeight=l.style.maxHeight),a.style.display="flex",a.style.flexDirection="column",t.tmp=t.sel.sort().join(",")}else{let e=t.sel;"TH"!=t.$el.parentNode.tagName&&e&&e.length?e=e.join(","):e&&0==e.length&&(e=null),t.tmp!==t.sel.sort().join(",")&&t.$parent.load&&t.$parent.load()}}}};const _hoisted_1$5={class:"v-select",style:{position:"relative"}},_hoisted_2$4=["required","disabled","click"],_hoisted_3$1={style:{border:"1px solid lightgray","background-color":"white",padding:"5px"}},_hoisted_4={class:"_ ui-widget ui-state-default ui-corner-all",style:{padding:"3px 3px 1px 3px","margin-bottom":"5px"}},_hoisted_5={class:"center",style:{"padding-top":"4px"}};function render$6(e,t,l,o,a,r){const n=resolveComponent("v-checkbox"),s=resolveComponent("v-checkbox-group"),i=resolveComponent("v-button");return openBlock(),createElementBlock("div",_hoisted_1$5,[l.readonly?createCommentVNode("v-if",!0):withDirectives((openBlock(),createElementBlock("select",{key:0,style:{width:"100%"},ref:"selectRef",onChange:t[0]||(t[0]=(...e)=>o.onChange&&o.onChange(...e)),required:l.required,disabled:l.disabled,click:e.expand},[renderSlot(e.$slots,"default")],40,_hoisted_2$4)),[[vShow,!l.multiple]]),l.multiple?(openBlock(),createElementBlock(Fragment,{key:1},[createElementVNode("div",{class:normalizeClass(["v-widget-header",{"v-selected":a.show}]),ref:"button",style:{"padding-top":"3px","padding-bottom":"3px"},onClick:t[1]||(t[1]=(...t)=>e.toggle&&e.toggle(...t))},"   ",2),withDirectives(createElementVNode("div",{ref:"popup",onClick:t[4]||(t[4]=(...t)=>e.close&&e.close(...t)),style:{"background-color":"#0000009c"}},[createElementVNode("div",_hoisted_3$1,[createElementVNode("div",_hoisted_4,[createVNode(n,{modelValue:a.sela,"onUpdate:modelValue":t[2]||(t[2]=e=>a.sela=e),onInput:e.selectAll},null,8,["modelValue","onInput"])]),(openBlock(),createBlock(s,{class:"v-select-checkbox-group",style:{"overflow-y":"auto"},key:"p"+a.ik,modelValue:a.sel,"onUpdate:modelValue":t[3]||(t[3]=e=>a.sel=e),onInput:e.checkboxInput},{default:withCtx((()=>[a.data.length?(openBlock(!0),createElementBlock(Fragment,{key:0},renderList(a.data,(e=>(openBlock(),createElementBlock("div",null,[createVNode(n,{value:e.value,label:e.label},null,8,["value","label"])])))),256)):createCommentVNode("v-if",!0)])),_:1},8,["modelValue","onInput"])),createElementVNode("div",_hoisted_5,[createVNode(i,{icon:"fa-sync",value:"Filtrar"})])])],512),[[vShow,a.show]])],64)):createCommentVNode("v-if",!0),l.readonly?(openBlock(),createElementBlock(Fragment,{key:2},[createTextVNode(toDisplayString(l.label?l.label:"---"),1)],64)):createCommentVNode("v-if",!0)])}script$7.render=render$6,script$7.__file="src/v-select.vue";var script$6={name:"VSwitch",props:{value:{value:Object}},data:()=>({options:["NO","SI"],selected:null}),mounted(){var e=this,t=""+e.value;e.selected="true"===t?"SI":"false"===t?"NO":null,e.$emit("input",e.value)},updated(){var e=this,t=""+e.value;e.selected="true"===t?"SI":"false"===t?"NO":null,e.$emit("input",e.value)},methods:{onChange(e){this.selected=e,this.$emit("input","SI"===e||"NO"!==e&&null)}}};const _hoisted_1$4=["value","data-value"],_hoisted_2$3=["onClick"];function render$5(e,t,l,o,a,r){return openBlock(),createElementBlock("div",{value:!1===l.value?"false":l.value,"data-value":""+l.value},[(openBlock(!0),createElementBlock(Fragment,null,renderList(a.options,(e=>(openBlock(),createElementBlock("div",{onClick:t=>r.onChange(e),style:normalizeStyle("cursor:pointer;border: 1px solid #000;text-align:center;display:inline-block;width:calc(50% - 2px)"+(e===a.selected?"":";opacity: 0.5")),class:normalizeClass({"v-selected":e==a.selected})},toDisplayString(e),15,_hoisted_2$3)))),256))],8,_hoisted_1$4)}script$6.render=render$5,script$6.__file="src/v-switch.vue";var script$5={name:"VTable",setup(e,t){const{autoload:l,src:o,rowKey:a,store:r,groups:n}=e,s=useAppStore(),i=inject("viewCollector"),c=inject("formCollector"),d=ref(1),u=ref(0),p=ref(null),m=ref(1),h=ref([]),v=ref([]),f=ref(null),g=ref(1),y=computed((()=>{const t=e,l=v.value;let o,a;return l.sum=sum,l.filter((e=>{for(var l in t.filters)if(o=t.filters[l],"function"==typeof o){if(!o(e))return 0}else if(o&&"string"==typeof o&&l in e&&(a=e[l],"string"==typeof a&&(a=a.toUpperCase().normalize("NFD").replace(/[\u0300-\u036f]/g,""),!a.includes(o.toUpperCase()))))return 0;return 1}))})),$=computed((()=>{let e=y.value;return e=f?e.sort(((e,t)=>{t=(t=t[f])||0,e=e[f];const l=Number(e);return l&&(e=l),e<t?-1*g:e>t?1*g:0})):e,e.sum=sum,e})),b=computed((()=>{const e=function(e){return this.reduce(((t,l)=>"number"==typeof e||"string"==typeof e?t+(l[e]||0):t),0)};Array.prototype.sum=e;const t={},l=n;return l?$.value.forEach((o=>{const a=o[l];if(!t[a]){const l=[];l.sum=e,t[a]=l}t[a].push(o)})):$.value.length&&(t[""]=$),Object.entries(t).map((([e,t])=>({name:e,values:t})))})),w=ref(1),k=ref(1),{slots:_,expose:S,emit:x}=t,E=getCurrentInstance(),C=async()=>{if(null!=r){let e;db&&(e=await getStoredList(r)),e||(e=[]),v.value=v.value?e.concat(v.value):e}return v.value},V=(e,t,l)=>{-10===t?y.value.length===h.value.length?h.value=[]:h.value=y.value.map((e=>e)):l?d.value||!h.value.includes(e)?h.value=[e]:(h.value=[],e=null):h.value.includes(e)?(h.value.splice(h.value.indexOf(e),1),e=null):h.value.push(e),x("row-select",{target:this,current:e,selection:h})},N=e=>h.value.includes(e),B=t=>{const l=[];return e.selectable&&N(t)&&l.push("v-selected"),e.rowStyleClass&&("string"==typeof e.rowStyleClass?l.push(e.rowStyleClass):e.rowStyleClass&&l.push(e.rowStyleClass(t))),l},I=(e,t)=>{L(e,t)},L=(e,t)=>{(w.value!=e||t)&&(w.value=e,A())};let T=""+e.selectable;d.value="false"!=T&&"0"!=T?1:0,T=""+e.scrollable,u.value=e.scrollable&&"false"!=T&&"0"!=T?1:0;const A=()=>{const t=e;if(h.value=[],t.value&&(v.value=t.value),o){let e=o;if(!e)return;e.endsWith("/")&&(e=e.slice(0,e.length-1));const l=t.pagination;if(l&&(e+="/"+(w.value-1)*l+"/"+l),networkStatus.connected){let a;if(t.gql){const e=t.gql,r="query{"+Object.keys(e)[0]+"(offset:"+(w.value-1)*l+" limit:"+l+"){\ndata{"+e[Object.keys(e)[0]]+"}\nsize\n}\n}";a=s.axios.post(o,{query:r})}else a=s.axios.get(e,{params:clean(t.filters)});a.then((e=>{if(e.data&&e.data.error)MsgBox(e.data.error);else{let o=e.data;t.gql&&(o=e.data.data[Object.keys(t.gql)[0]]),v.value=o.data||o,o&&o.hasOwnProperty("size")&&l&&(k.value=Math.ceil(o.size/l),w.value>k.value&&(w.value=1),t.size=o.size),C(),x("loaded",{target:t}),x("row-select",{}),t.remoteLoaded=1,t.loaded=1,m.value++}})).catch(t.error)}else{v.value=[];const e=C();e.then&&e.then((e=>{v.value=e})),x("row-select",{target:t})}}else C().then((()=>x("loaded",{target:t})));m.value++,t.loaded=1},F=computed((()=>h.value.length));A.rowSelectedCount=F,A.src=o,A.getForm=c.get,A.rowKey=a,A.rowSelect=V;const M=e=>p.value===e;A.is=M,A.remove=e=>{console.log(e,v.value);const t=v.value.findIndex((t=>t===e));-1!==t&&v.value.splice(t,1)},A.selected=h,A.type="v-table",i.push(A);const D=e=>{13===e.keyCode&&(e.preventDefault(),A())};return onMounted((()=>{!0===l&&A(),setTimeout((()=>{const e=E.proxy,t=e.$el.querySelectorAll(".v-cloned-header div > span"),l=Math.max(...Array.from(t).map((e=>e.offsetHeight)));t.forEach((e=>{e.style.height=l+"px"}));e.$el.querySelectorAll("v-filter").forEach((e=>{console.log(e.querySelectorAll("input").forEach((e=>e.addEventListener("keyup",D))))}))}),100)})),onUnmounted((()=>{i.remove(A)})),S({load:A,rowSelectedCount:F,j_is:M}),()=>{let t=0;const l=_.default({row:{}}),o=[];l.forEach(((e,l)=>{const a=e.props;e.children&&"function"==typeof e.children.filter&&(e.children.filter((e=>"v-filter"==e.type)).forEach((t=>{a.filter=t,e.children.shift()})),e.children.filter((e=>"v-footer"==e.type)).forEach((t=>{a.footer=t,e.children.shift()}))),t+=a.width?Number(a.width):0,o.push({filter:a.filter,header:a.header,width:a.width})})),t+=d.value?42:0;const a=h$1("div",{className:"v-datatable-scrollable-header-box",style:"left: 0px;"},h$1("table",{className:"v-cloned-header v-table",style:{width:`${t}px`}},[d.value?h$1("th",{width:42},[h$1("span",{onclick(){V(null,-10)},className:"v-check"},h$1(FontAwesomeIcon,{icon:h.value.length?faSquareCheck:faSquare,class:"fa-lg"}))]):null,o.map((e=>h$1("th",e,h$1("div",[h$1("span",{style:"display: flex;justify-content: center;align-items: center;"},[e.header]),h$1("v-filter",e.filter?.children)]))))]));return h$1("div",{ref:p,className:"v-datatable "+e.class},[_.header?h$1("div",{className:"v-datatable-header v-widget-header ui-corner-top"},_.header()):null,e.pagination?h$1("div",{className:"v-paginator v-paginator-top v-widget-header v-paginator-pages center"},[h$1(script$p,{value:"|<",disabled:w.value<=1,onClick:()=>I(1)}),h$1(script$p,{value:"<",disabled:w.value<=1,onClick:()=>I(w.value-1)}),h$1("div",{style:"padding:3px 8px;display:inline-block"},[h$1("input",{type:"number",style:"width:60px",value:w.value,onInput:e=>I(Number(e.target.value),!0)}),"/"+k.value]),h$1(script$p,{value:">",disabled:w.value==k.value,onClick:()=>I(w.value+1)}),h$1(script$p,{value:">|",disabled:w.value==k.value,onClick:()=>I(k.value)})]):null,h$1("div",{className:"v-widget-header v-datatable-scrollable-header",style:"position: relative; margin-right: 0px;"},a),h$1("div",{className:"v-datatable-scrollable-body",style:"overflow-y: auto; flex:1",onScroll(e){const t=e.currentTarget.scrollLeft;a.el.style.transform="translateX(-"+t+"px)"}},[h$1("table",{className:"v-table",style:{width:`${t}px`}},[h$1("tbody",{className:"v-datatable-data",key:m.value},b.value.length<1?h$1("td",{colspan:o.length+(d.value?1:0)},e.emptyMessage):[b.value.map((e=>[_["header-group"]?h$1("tr",{className:"v-header-group"},[d.value?h$1("td"):null,_["header-group"]({group:e})]):null,(e.values.value||e.values).map(((e,t)=>{const l=_.default({row:e,index:t});return l.forEach(((e,t)=>{e.children&&"function"==typeof e.children.filter&&(e.children.filter((e=>"v-filter"==e.type)).forEach((t=>{e.children.shift()})),e.children.filter((e=>"v-footer"==e.type)).forEach((t=>{e.children.shift()})))})),h$1("tr",{className:B(e),onclick(l){((e,t,l)=>{d.value&&0==whichChild(e.target)||V(t,l,1)})(l,e,t)}},[d.value?h$1("td",{className:"center"},h$1("span",{onclick(){V(e,t)},className:"v-check"},h$1(FontAwesomeIcon,{icon:N(e)?faSquareCheck:faSquare,class:"fa-lg"}))):null,...l])})),_["footer-group"]?h$1("tr",{className:"v-footer-group"},[d.value?h$1("td"):null,_["footer-group"]({group:e})]):null,_["extra-group"]?_["extra-group"]({group:e,groups:b.value}):null]))])])])])}},props:{class:null,value:Array,filterKey:String,reflow:null,summary:null,src:String,gql:null,filters:Object,store:null,width:null,emptyMessage:{default:"No existen registros"},groups:{default:""},rowKey:{default:"id"},rowStyleClass:null,pagination:null,selectable:{default:!0},scrollable:null,autoload:{default:!0}},data:()=>({resizeAfterUpddate:0,active:0,keyBody:1,row:{},kt:0,size:null,sortKey:"",paginatio_:0,remoteLoaded:null,loaded:!1,sortOrders:{},rowStyleClassFunc:null}),created(){const me=this;me.$parent.tabs||(me.active=1),me.paginatio_=me.pagination?me.pagination:0,me.rowStyleClass&&eval("me.rowStyleClassFunc=function(row){return "+me.rowStyleClass+"}")},beforeUpdate(){var e=this;e.active&&e.value&&null==e.remoteLoaded&&(e.data=e.value)},filters:{capitalize:e=>e?e.charAt(0).toUpperCase()+e.slice(1):e},methods:{hasSlot(e){return!!this.$slots[e]},sortBy(){},filter(){alert(12)}},__file:"src/v-table.vue"},script$4={name:"VTabview",data:()=>({tabs:[],height:0,currentTabIndex:0,k:0}),methods:{load(e){var t=new Event("command",{bubbles:!1});t.name="refresh",t.target=this.$el,this.$el.children[1+this.currentTabIndex].dispatchEvent(t)},reset(){this.load(this.k++)}},watch:{currentTabIndex(e){var t=this,l=t.$el.children[e+1];if(t.$children[e+1],l){var o=new Event("tabChange",{bubbles:!1});o.$target=t,l.dispatchEvent(o),t.$el.style.height=t.height+"px",(o=new Event("parentResize",{bubbles:!1})).height=t.$el.offsetHeight-25,l.style.height=o.height+"px",setTimeout((()=>{l.dispatchEvent(o)}),2)}}},updated(){for(var e=this.$el.children,t=1;t<e.length;t++)e[t].tagName&&(t-1===this.currentTabIndex&&(e[t].style.display="flex",e[t].style.flex="1",e[t].style.flexDirection="column"),t-1===this.currentTabIndex?e[t].classList.remove("hide"):(e[t].style.display="none",e[t].classList.add("hide"))),console.log(e[t])},mounted(){for(var e=this,t=e.$el.children,l=1;l<t.length;l++)t[l].style.display="none",e.tabs.push({title:""+t[l].getAttribute("tab")});e.$el.addEventListener("parentResize",(l=>{e.$el.style.height=l.height+1+"px",e.height=l.height+1;var o=new Event("parentResize",{bubbles:!1});o.height=e.$el.offsetHeight-25,o.target=e.$el,o.$target=e;for(var a=1;a<t.length;a++)"none"!=t[a].style.display&&(console.log("Se envia el alto "+o.height),t[a].style.height=o.height+"px",t[a].dispatchEvent(o));e.$emit("resize",o)})),t[1+e.currentTabIndex].setAttribute("active",1);var o=new Event("tabChange",{bubbles:!1});o.$target=e,t[1+e.currentTabIndex].dispatchEvent(o)}};const _hoisted_1$3={class:"v-tab-nav"},_hoisted_2$2=["onClick"];function render$4(e,t,l,o,a,r){return openBlock(),createElementBlock("div",{class:"v-tabview",style:normalizeStyle({height:a.height+"px"})},[createElementVNode("ul",_hoisted_1$3,[(openBlock(!0),createElementBlock(Fragment,null,renderList(a.tabs,((e,t)=>(openBlock(),createElementBlock("li",{class:normalizeClass({"v-selected":t==a.currentTabIndex}),key:t,onClick:e=>a.currentTabIndex=t},toDisplayString(e.title),11,_hoisted_2$2)))),128))]),renderSlot(e.$slots,"default")],4)}script$4.render=render$4,script$4.__file="src/v-tabview.vue";var script$3={name:"VTextarea",props:{modelValue:String},setup(e,{emit:t}){const l=ref(null),o=()=>{l.value&&(l.value.style.height="auto",l.value.value&&(l.value.style.height=`${l.value.scrollHeight}px`))},a=()=>{nextTick(o)};return watch((()=>e.modelValue),a,{immediate:!0}),onMounted((()=>{const e=l.value;e&&(e.addEventListener("change",o),e.addEventListener("cut",a),e.addEventListener("paste",a),e.addEventListener("drop",a),e.addEventListener("keydown",a),a())})),{textarea:l,updateValue:e=>{t("update:modelValue",e.target.value),a()}}}};const _hoisted_1$2=["value"];function render$3(e,t,l,o,a,r){return openBlock(),createElementBlock("textarea",{ref:"textarea",value:l.modelValue,onInput:t[0]||(t[0]=(...e)=>o.updateValue&&o.updateValue(...e))},null,40,_hoisted_1$2)}script$3.render=render$3,script$3.__file="src/v-textarea.vue";var script$2={name:"VUploader",props:{value:String,onlyicon:Boolean,click:null,icon:String,domain:String},mounted(){var e=this;setTimeout((function(){e.$el.querySelector("svg").dataset.icon="image"}),1e3)},updated(){var e=this;setTimeout((function(){e.$el.querySelector("svg").dataset.icon="image"}),1e3)},data:()=>({uploadPercentage:0,showProgress:!1}),methods:{other(){this.click&&this.click(this)},handleFileUpload(){this.uploadPercentage=0,this.submitFile(this.$el.children[0].children[0].files[0])},submitFile(e,t){var l=this,o=new FormData;t=t||e.name.replace(/[^\w\s.]/gi,""),o.append("filename",t),o.append("file",e,t),l.showProgress=!0,axios$2.post((l.domain?l.domain:"")+"/api/file/upload",o,{headers:{"Content-Type":"multipart/form-data"},onUploadProgress:function(e){this.uploadPercentage=parseInt(Math.round(e.loaded/e.total*100))}.bind(this)}).then((function(e){l.$emit("input",e.data),l.showProgress=!1})).catch((function(){console.log("FAILURE!!")}))}}};const _hoisted_1$1={style:{cursor:"pointer"},class:""},_hoisted_2$1=["data-icon"],_hoisted_3=[".value"];function render$2(e,t,l,o,a,r){return openBlock(),createElementBlock("div",{onClick:t[1]||(t[1]=(...e)=>r.other&&r.other(...e)),class:normalizeClass([l.onlyicon?"":"v-button ui-widget ui-state-default ui-corner-all","v-uploader"]),style:normalizeStyle({padding:l.onlyicon?"0px":""})},[createElementVNode("label",_hoisted_1$1,[l.click?createCommentVNode("v-if",!0):(openBlock(),createElementBlock("input",{key:0,type:"file",onChange:t[0]||(t[0]=e=>r.handleFileUpload())},null,32)),createElementVNode("i",{class:normalizeClass(["fa",l.icon?l.icon:"fa-upload"]),"data-icon":l.icon,style:normalizeStyle({marginRight:l.onlyicon||""==l.value?"":"10px"})},null,14,_hoisted_2$1),createTextVNode(toDisplayString(l.onlyicon?"":null!=l.value?l.value:"Adjuntar Archivo")+" ",1),a.showProgress?(openBlock(),createElementBlock("progress",{key:1,max:"100",style:{width:"100%"},".value":a.uploadPercentage},null,40,_hoisted_3)):createCommentVNode("v-if",!0)])],6)}script$2.render=render$2,script$2.__file="src/v-uploader.vue";var script$1={name:"VItem",setup:({href:e},{emit:t})=>({click:()=>{e?useAppStore().router.push({path:e}):t("click")}}),props:{icon:String,style:Object,label:String,href:String}};function render$1(e,t,l,o,a,r){return openBlock(),createElementBlock(Fragment,null,[createElementVNode("li",{onClick:t[0]||(t[0]=(...e)=>o.click&&o.click(...e)),style:normalizeStyle(l.style)},[createElementVNode("i",{class:normalizeClass(["fa",l.icon])},null,2),createTextVNode(toDisplayString(l.label)+" ",1),renderSlot(e.$slots,"label")],4),createElementVNode("ul",null,[renderSlot(e.$slots,"default")])],64)}script$1.render=render$1,script$1.__file="src/v-item.vue";var script={name:"VCalendarRange",props:{modelValue:null,type:String,required:String,readonly:String,max:String,min:String},setup({modelValue:e},{emit:t}){const l=ref(),o=ref(),a=ref(),r=ref(),n=ref();return{show:l,open:()=>{l.value=!0,nextTick((()=>{n.value=mask(r.value)}))},elRef:r,from:o,to:a,click:e=>{e||(o.value="",a.value="");const l=(date(o.value,"date-")||"")+"|"+(date(a.value,"date-")||"");t("update:modelValue","|"==l?null:l),unmask(n.value)},modelValue:e}}};const _hoisted_1={key:0,ref:"elRef",style:{position:"relative","z-index":"1000",padding:"20px","max-width":"240px"},class:"v-dialog v-msgbox"},_hoisted_2={style:{display:"flex","align-items":"center","justify-content":"center","margin-top":"20px"}};function render(e,t,l,o,a,r){const n=resolveComponent("VButton"),s=resolveComponent("v-calendar"),i=resolveComponent("v-button");return openBlock(),createElementBlock("div",null,[createVNode(n,{icon:"fa-calendar",onClick:o.open,style:{width:"-webkit-fill-available",padding:"12px"},class:normalizeClass(o.from||o.to?"marked":"")},null,8,["onClick","class"]),o.show?(openBlock(),createElementBlock("div",_hoisted_1,[t[4]||(t[4]=createElementVNode("label",null,"Desde:",-1)),createVNode(s,{modelValue:o.from,"onUpdate:modelValue":t[0]||(t[0]=e=>o.from=e)},null,8,["modelValue"]),t[5]||(t[5]=createElementVNode("label",null,"Hasta:",-1)),createVNode(s,{modelValue:o.to,"onUpdate:modelValue":t[1]||(t[1]=e=>o.to=e)},null,8,["modelValue"]),createElementVNode("div",_hoisted_2,[createVNode(i,{icon:"fa-eraser",value:"Limpiar",onClick:t[2]||(t[2]=e=>o.click())}),createVNode(i,{icon:"fa-filter",value:"Aplicar",onClick:t[3]||(t[3]=e=>o.click(!0))})])],512)):createCommentVNode("v-if",!0)])}script.render=render,script.__file="src/v-calendar-range.vue";var components={InputTextarea:script$r,VItem:script$1,InputText:script$s,VAutocomplete:script$q,VButton:script$p,VCalendar:script$o,VCalendarFilter:script,VCheckboxGroup:script$n,VCheckbox:script$m,VDataview:script$l,VFieldset:script$k,VForm:script$j,VGroup:script$i,VLayerControl:script$h,VMapControl:script$g,VMap:script$f,VNumber:script$e,VOptions:script$d,VOverlay:script$c,VPanel:script$b,VPopup:script$a,VRadioGroup:script$8,VRadio:script$9,VSelect:script$7,VSwitch:script$6,VTable:script$5,VTabview:script$4,VTextarea:script$3,VUploader:script$2};const VForm=components.VForm,IsobitUI={install(e){setApp(e),e.BUILT_ON=import.meta.env.VITE_APP_BUILT_ON;for(const t in components)if(components.hasOwnProperty(t)){const l=components[t];e.component(l.name||t,l)}}};setTimeout(resize,400),window.addEventListener("resize",(()=>{setTimeout(resize,400)}));const removeError=e=>{let t=e.previousElementSibling;t&&t.classList&&t.classList.contains("v-error")&&t.parentNode.removeChild(t)},ui=e=>{const l={computed:{user:()=>_$1.app.session,perms(){return this.session.perms||this.session.allcaps||{}}},data(){return{app2:null,ui:this,_session:null,x_connected_:null,row:{},networkStatus:{connected:null}}},methods:{get(e){let t=this.$el.querySelector("form").action;window.location.href=this.apiLink(t)+"/"+e},async sync(e){let t=this,l=t.$el.querySelector("form").getAttribute("action");if(!l){l=t.$el.parentNode.getAttribute("path");let e=l.split("/");e="edit"==e[e.length-1]?e.splice(0,e.length-2):e.splice(0,e.length-1),l=t.apiLink(e.join("/"))}let o=t.$children[0].$children[0];l=o.src;let a=await t.getStoredList(o.store),r=o.selected,n=[],s=[];for(let e=0;e<r.length;e++){let t=o.data[r[e]];if(t.tmpId&&!t.synchronized)for(let e=0;e<a.length;e++)if(a[e].tmpId==t.tmpId){let t=JSON.clone(a[e]);delete t.synchronized,s.push(t),n.push(e)}}n.length>0&&axios.post(l+"/bulk"+(e.sufix?e.sufix:""),s).then((function(e){let l=e.data;for(let e=0;e<l.length;e++){if(l[e].errors){MsgBox$1(JSON.stringify(l[e].errors));break}if(l[e].error){MsgBox$1(l[e].error);break}for(let t=0;t<a.length;t++)(l[e].ext&&l[e].ext.tmpId==a[t].tmpId||l[e].tmpId==a[t].tmpId)&&(log("ui.ok"),l[e].ext&&a.ext&&(a[t].ext.error=l[e].ext.error),l[e].id&&(a[t].id=l[e].id),a[t].synchronized=1,emit("sync",l[e],a[t]))}t.setStoredList(o.store,a),t.refresh()})).catch((function(e){e.response?MsgBox$1(e.response.data):console.log(e)}))}}};e||(e={data:{o:{}}});const{setup:o,...a}=e,r=o;return e={mixins:[l,a],setup(e,l){const o=useAppStore();setApp(o),o.config(getConfigApp());const a=e;let n=useRouter();const s=getCurrentInstance(),c=reactive([]),d=e=>{},u=async e=>{const t=s.proxy,l=_$1.db;let a;try{a=JSON.parse(sessionStorage.getItem("loadedStores"))}catch(e){}if(null==a&&(a={}),!a[e]&&t.connected){let t=_$1.stores.filter((t=>t[0]==e))[0];if(!t[2])throw`ERROR: Url for store '${t[0]}' is empty!`;let r=await o.axios.get(t[2]);r=r.data||r,await new Promise(((o,n)=>{let s=l.transaction([t[0]],"readwrite"),i=s.objectStore(t[0]);const c=i.clear();c.onsuccess=()=>{r.forEach((e=>{i.add(e).onerror=e=>{console.error(`⚠️ Store '${e[0]}' error addd data!`,e)}}))},c.onerror=()=>{console.error(`⚠️ Store '${t[0]}' error data!`,t)},s.oncomplete=()=>{a[e]=1,sessionStorage.setItem("loadedStores",JSON.stringify(a)),o()},s.onerror=e=>{console.error(`ERROR: ⚠️ Error en la transacción for store '${e[0]}'!`,e),n()}}))}return await new Promise(((t,o)=>{if(l){const o=l.transaction(e).objectStore(e).getAll();o.onsuccess=()=>{t(o.result)}}else console.log("1=========>db=",window._.db),o("=======>db is null esta faltando")}))},p=()=>{c.find((e=>"v-table"==e.type))()},m=(e,t,l)=>{if(!(e.$el||e instanceof HTMLElement)){let t=e,l=t.target;return"string"==typeof t?l=t:"ION-ITEM"==l.tagName&&l.href?(t.preventDefault(),l=l.href):(t.preventDefault(),l.pathname||(l=l.parentNode),l.pathname||(l=l.parentNode),l.pathname||(l=l.parentNode),l=l.pathname),void(n.path!==l&&n.push(l))}},h=(e,t)=>{e.$el&&(e=e.$el),removeError(e);let l=e.previousElementSibling;for(;l&&1!=l.nodeType;)l=l.previousElementSibling;if(!l)for(l=e.parentElement.previousElementSibling;l&&1!=l.nodeType;)l=l.previousElementSibling;let o=document.createElement("div");o.innerHTML=t||"Este campo es requerido!",o.classList.add("v-error"),e.parentNode.insertBefore(o,e)},v=e=>{const t=[],l=[],o=s.proxy;e=e&&0!=e?e:o.$el;const a=e?.querySelectorAll("input,select,textarea,div[required=required]");let r,n={};for(let e=0;a?.length>e;e++){let o=a[e];if("radio"!==o.type){if(o.error&&(o.error.style.display="none"),!o.disabled&&!o.getAttribute("disabled")&&(o.required||"DIV"===o.tagName))if("DIV"!=o.tagName&&!o.value||"DIV"===o.tagName&&!o.attributes.value){for(r=o.previousElementSibling;r&&1!=r.nodeType;)r=r.previousElementSibling;if(!r)for(r=o.parentElement.previousElementSibling;r&&1!=r.nodeType;)r=r.previousElementSibling;t.push(o)}else l.push(o)}else{let e=n[o.name];e||(n[o.name]=e=[]),e.push(o)}}for(let e in n)if(Object.prototype.hasOwnProperty.call(n,e)){const o=n[e];let a=!1,s=!1;for(let e=0;e<o.length;e++)o[e].required&&!o[e].disabled&&(s=!0),o[e].checked&&(a=!0);const i=o[0].parentNode.parentNode;r=i.previousElementSibling,r&&r.classList&&r.classList.contains("v-error")&&r.parentNode.removeChild(r),s&&!a?t.push(i):l.push(i)}for(const e of t)h(e);for(const e of l){let t=e.previousElementSibling;t&&t.classList&&t.classList.contains("v-error")&&t.parentNode.removeChild(t)}return!t.length},f=(e,t)=>{let l=e.parentElement;for(;l;){const e=l.querySelector(t);if(e)return e;l=l.parentElement}return null},g=e=>{console.log(l)};provide("viewCollector",{remove(e){c.splice(c.indexOf(e),1)},push(e){c.push(e)}});const y=computed((()=>{let e=c.find((e=>e.selected?.value.length>0));return e?.rowSelectedCount||0})),$=computed((()=>clean(b.value))),b=reactive({}),w=ref(null);let k;watch(b,(()=>{c.find((e=>"v-table"==e.type))&&(w.value&&clearTimeout(w.value),w.value=setTimeout((()=>{p()}),1200))}));const _=()=>{clearTimeout(k),k=setTimeout((()=>{const e=document.querySelector(".v-datatable");e?.parentNode&&buildPopupMenu(e)}),100)};onMounted((()=>{n=useRouter(),l.emit("sync",{u:9}),_(),window.addEventListener("resize",_)})),onUnmounted((()=>{window.removeEventListener("resize",_)}));const S=computed((()=>o.axios.defaults.baseURL)),x=computed((()=>o.session));let E=r?r({...e,$on:(e,t)=>{},router:n,getStoredList:u,app:o},l):{};l.expose({router:n});let C={app:o,cleanedFilters:$,router:n,baseURL:S,filters:b,session:x,date:date,pad:pad,getStoredList:u,refresh:p,getSelected:()=>c.find((e=>"v-table"==e.type)).selected.value,saveAs:(e,t,l)=>{"string"==typeof t&&(t={body:t});let o="string"==typeof l?{fileName:l}:l;o||(o={}),(""+t?axios.post(e,t,{responseType:"blob"}):axios({method:"post",url:e,data:t,headers:{"Content-Type":"multipart/form-data"}})).then((e=>{const t=window.URL.createObjectURL(new Blob([e.data])),l=document.createElement("a");if(l.href=t,!o.fileName){const t=e.headers["content-disposition"];if(t&&-1!==t.indexOf("attachment")){const e=/filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/.exec(t);null!=e&&e[1]&&(o.fileName=e[1].replace(/['"]/g,"").trim())}else console.warn("content-disposition: attachment; filename = <filename>; header no es accesible o no esta definido correctamente")}l.setAttribute("download",o.fileName),document.body.appendChild(l),l.click()}))},validate:v,save:()=>{let e=c.filter((e=>"v-form"==e.type))[0];console.log(e);const r=s.proxy;e.$forceUpdate();let n=e.$el,d=n.querySelector("form");if(v(d)){let e=d.getAttribute("action"),n=r.data||r.o,s=JSON.parse(JSON.stringify(n));if(r.process&&(s=r.process(s)),"object"!=typeof s||Array.isArray(s)||null===s)return;if(console.log("action/componet==",e,r,l),e&&o.connected)o.axios.post(e,s).then((e=>{let t=e.data;if(s.tmpId){alert(12);let e=a.$children[0].store,l=window._.db.transaction([e],"readwrite").objectStore(e),o=l.get(s.tmpId);t.id&&(s.id=t.id,n.id=s.id),o.onsuccess=function(){let e;n.synchronized=1,s.synchronized=1,e=o.result?l.put(s):l.add(s),e.onerror=e=>{console.error(e)},a.$emit("sync",t,s)},o.onerror=function(){MsgBox$1("Error getting temporal record "+s.tmpId)}}o&&o.toast?o.toast("El registro fue grabado exitosamente!",(()=>{r.close({success:!0,data:t})})):MsgBox$1("El registro fue grabado exitosamente! msg",(()=>{g()}))})).catch((function(e){if(e.response){let l,o;if("string"==typeof e.response.data)MsgBox$1(e.response.data);else{l=e.response.data.propertyViolations;for(let e=0;e<l.length;e++){let t=l[e];o=d.querySelector("[name="+t.path+"]"),o&&a.showerror(o,t.message)}for(l=e.response.data.fieldViolations,i=0;i<l.length;i++)t=l[i],o=d.querySelector("[name="+t.path+"]"),o&&a.showerror(o,t.message+", valor="+t.value);MsgBox$1("Verifique el formulario, aun tiene campos obligatorio completar."),"v-dialog"==a.$el.parentNode.className&&a.$el.parentNode.parentNode.scroll({top:0,behavior:"smooth"})}}}));else{console.log("se guarda localmente");const e=c[0].store;if(!e)return void MsgBox$1("Store in form is undefined!");u(e).then((t=>{if(t||(t=[]),s.id)for(let e=0;e<t.length;e++)t[e].tmpId==s.tmpId&&(delete s.synchronized,t[e]=s);let l=_$1.db.transaction([e],"readwrite").objectStore(e);if(s.id){delete s.synchronized;let e=l.get(s.tmpId);e.onsuccess=function(){e.result?l.put(s):t.forEach((e=>{e.tmpId==s.tmpId&&l.put(s)})),a.$emit("stored",s,t,l),a.$ionic&&o.toast("El registro fue grabado exitosamente! onstored"),console.log("============2",r),r.close({success:!0,data:s})},e.onerror=function(){MsgBox$1("Error getting temporal record "+s.tmpId)}}else{s.tmpId=1*new Date,s.id=-s.tmpId;let e=l.add(s);e.onsuccess=e=>{t.unshift(s),a.$emit("stored",s,t,l),o&&o.toast&&o.toast("El registro fue grabado exitosamente! storeeeeee not connected"),n.tmpId=s.tmpId,n.id=s.id,console.log("========>>",r),r.close({success:!0,data:s})},e.onerror=e=>{o&&o.toast&&o.toast("Error!")}}}))}}else MsgBox$1("Verifique el formulario, aun tiene campos obligatorios sin completar."),"v-dialog"==n.parentNode.className?n.parentNode.parentNode.scroll({top:0,behavior:"smooth"}):n.querySelector("form > .v-form").scroll({top:0,behavior:"smooth"})},open:m,close:g,create:e=>{const t=f(e.target,".v-datatable");let l=c.filter((e=>"v-table"==e.type)).find((e=>e.is(t))).getForm().action;l||(l=window.location.pathname),l&&(l=l.replace("/api","")),o&&m(l+"/create")},edit:e=>{const t=f(e.target,".v-datatable");let l=c.filter((e=>"v-table"==e.type)).find((e=>e.is(t))),r=l.getForm().action;var n;r||(r=window.location.pathname),l&&l.src&&(r=l.src),e.action&&(r=e.action),r&&(n=r.replace("/api","").replace("/0/0",""),r="/admin"+n);const s=l.selected.value[0];let i=s[l.rowKey];s.tmpId&&(i=-s.tmpId),o?m(r+"/"+i+"/edit"):o.axios.get((_$1.currentPath=(r+"/"+i+"/edit").replace(/([^:]\/)\/+/g,"$1"))+"?modal").then(a.open).catch(d)},destroy:e=>{let t=this;const l=f(e.target,".v-datatable");let a=c.filter((e=>"v-table"==e.type)).find((e=>e.is(l)));c.find((e=>"v-table"!=e.type)).action;let r=e.$vnode?e.load:null,n=a.rowKey,s=a.selected.value[0];if(s.tmpId)MsgBox$1("Esta seguro que desea eliminar los registros temporales seleccionados ?",(function(e){if(0==e){let e=0,l=_$1.db.transaction([a.store],"readwrite").objectStore(a.store),n=[];for(let t=a.selected.length-1;t>=0;t--)s=a.data[a.selected[t]],n.push(s),s.tmpId&&l.delete(s.tmpId),e++,a.data.splice(a.selected[t],1);e&&(o&&o.toast?o.toast(e+" registros eliminados"):MsgBox$1(e+" registros eliminados")),a.rowSelect(null,-1),a.selected=[],t.$emit("destroyed",n,a.store),r&&r()}}),["SI","NO"]);else{if(!n)return alert("Table don`t have defined attribute 'rowkey'");let e=s[n];MsgBox$1("Esta seguro que desea eliminar el registro seleccionado?",(t=>{if(0==t){const t=a.src.replace("/0/0",""),l=[];let r=a.selected.value.length-1;o.axios.delete(t+"/"+e,{params:b.value}).then((()=>{for(;r>=0;r--)s=a.selected.value[r],l.push(s),a.remove(s);o&&o.toast?o.toast(l.length+" registros eliminados"):MsgBox$1(l.length+" registros eliminados"),a.rowSelect(null,-1),a.selected.value=[]})).catch(d)}}),["SI","NO"])}},rowSelectedCount:y,...E};return C}},e};export{Drag,IsobitUI,MsgBox$1 as MsgBox,VForm,_$1 as _,app,date,db,getStoredList,id,initDB,mask,pad,removeError,resize,setupApp,ui,unmask,useAppStore};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isobit-ui",
3
- "version": "1.0.21",
3
+ "version": "1.0.22",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "dist/library.js",