2 lines
15 KiB
JavaScript
2 lines
15 KiB
JavaScript
import{aY as Mt,g as ft,r as P,D as U,B as X,f as kt,al as qt,w as E,o as Ct,e as N,y as Ht,l as $,aZ as Z,z as ht,Y as Pt,c as Bt,P as At,s as Wt,aw as It,H as Lt,Q as Dt,a as S,I as Rt,ax as zt,R as $t,ay as Ft,S as Kt,az as Nt,a_ as Ot,a$ as tt,b0 as jt,C as Vt,b1 as Qt,t as Yt,b2 as Gt,b3 as Jt,h as et,b as Ut,aA as Xt,au as Zt,G as te,n as q,b4 as ee,b5 as ne,as as oe}from"./index-BmjEiQ1N.js";function ae(){if(window.getSelection!==void 0){const t=window.getSelection();t.empty!==void 0?t.empty():t.removeAllRanges!==void 0&&(t.removeAllRanges(),Mt.is.mobile!==!0&&t.addRange(document.createRange()))}else document.selection!==void 0&&document.selection.empty()}const ie={target:{type:[Boolean,String,Element],default:!0},noParentEvent:Boolean},le={...ie,contextMenu:Boolean};function se({showing:t,avoidEmit:e,configureAnchorEl:o}){const{props:n,proxy:i,emit:c}=ft(),a=P(null);let r=null;function f(l){return a.value===null?!1:l===void 0||l.touches===void 0||l.touches.length<=1}const u={};o===void 0&&(Object.assign(u,{hide(l){i.hide(l)},toggle(l){i.toggle(l),l.qAnchorHandled=!0},toggleKey(l){qt(l,13)===!0&&u.toggle(l)},contextClick(l){i.hide(l),U(l),kt(()=>{i.show(l),l.qAnchorHandled=!0})},prevent:U,mobileTouch(l){if(u.mobileCleanup(l),f(l)!==!0)return;i.hide(l),a.value.classList.add("non-selectable");const d=l.target;X(u,"anchor",[[d,"touchmove","mobileCleanup","passive"],[d,"touchend","mobileCleanup","passive"],[d,"touchcancel","mobileCleanup","passive"],[a.value,"contextmenu","prevent","notPassive"]]),r=setTimeout(()=>{r=null,i.show(l),l.qAnchorHandled=!0},300)},mobileCleanup(l){a.value.classList.remove("non-selectable"),r!==null&&(clearTimeout(r),r=null),t.value===!0&&l!==void 0&&ae()}}),o=function(l=n.contextMenu){if(n.noParentEvent===!0||a.value===null)return;let d;l===!0?i.$q.platform.is.mobile===!0?d=[[a.value,"touchstart","mobileTouch","passive"]]:d=[[a.value,"mousedown","hide","passive"],[a.value,"contextmenu","contextClick","notPassive"]]:d=[[a.value,"click","toggle","passive"],[a.value,"keyup","toggleKey","passive"]],X(u,"anchor",d)});function h(){Ht(u,"anchor")}function v(l){for(a.value=l;a.value.classList.contains("q-anchor--skip");)a.value=a.value.parentNode;o()}function y(){if(n.target===!1||n.target===""||i.$el.parentNode===null)a.value=null;else if(n.target===!0)v(i.$el.parentNode);else{let l=n.target;if(typeof n.target=="string")try{l=document.querySelector(n.target)}catch{l=void 0}l!=null?(a.value=l.$el||l,o()):(a.value=null,console.error(`Anchor: target "${n.target}" not found`))}}return E(()=>n.contextMenu,l=>{a.value!==null&&(h(),o(l))}),E(()=>n.target,()=>{a.value!==null&&h(),y()}),E(()=>n.noParentEvent,l=>{a.value!==null&&(l===!0?h():o())}),Ct(()=>{y(),e!==!0&&n.modelValue===!0&&a.value===null&&c("update:modelValue",!1)}),N(()=>{r!==null&&clearTimeout(r),h()}),{anchorEl:a,canShow:f,anchorEvents:u}}function re(t,e){const o=P(null);let n;function i(r,f){const u=`${f!==void 0?"add":"remove"}EventListener`,h=f!==void 0?f:n;r!==window&&r[u]("scroll",h,$.passive),window[u]("scroll",h,$.passive),n=f}function c(){o.value!==null&&(i(o.value),o.value=null)}const a=E(()=>t.noParentEvent,()=>{o.value!==null&&(c(),e())});return N(a),{localScrollTarget:o,unconfigureScrollTarget:c,changeScrollEvent:i}}const{notPassiveCapture:B}=$,_=[];function A(t){const e=t.target;if(e===void 0||e.nodeType===8||e.classList.contains("no-pointer-events")===!0)return;let o=Z.length-1;for(;o>=0;){const n=Z[o].$;if(n.type.name==="QTooltip"){o--;continue}if(n.type.name!=="QDialog")break;if(n.props.seamless!==!0)return;o--}for(let n=_.length-1;n>=0;n--){const i=_[n];if((i.anchorEl.value===null||i.anchorEl.value.contains(e)===!1)&&(e===document.body||i.innerRef.value!==null&&i.innerRef.value.contains(e)===!1))t.qClickOutside=!0,i.onClickOutside(t);else return}}function ue(t){_.push(t),_.length===1&&(document.addEventListener("mousedown",A,B),document.addEventListener("touchstart",A,B))}function nt(t){const e=_.findIndex(o=>o===t);e!==-1&&(_.splice(e,1),_.length===0&&(document.removeEventListener("mousedown",A,B),document.removeEventListener("touchstart",A,B)))}let ot,at;function it(t){const e=t.split(" ");return e.length!==2?!1:["top","center","bottom"].includes(e[0])!==!0?(console.error("Anchor/Self position must start with one of top/center/bottom"),!1):["left","middle","right","start","end"].includes(e[1])!==!0?(console.error("Anchor/Self position must end with one of left/middle/right/start/end"),!1):!0}function ce(t){return t?!(t.length!==2||typeof t[0]!="number"||typeof t[1]!="number"):!0}const F={"start#ltr":"left","start#rtl":"right","end#ltr":"right","end#rtl":"left"};["left","middle","right"].forEach(t=>{F[`${t}#ltr`]=t,F[`${t}#rtl`]=t});function lt(t,e){const o=t.split(" ");return{vertical:o[0],horizontal:F[`${o[1]}#${e===!0?"rtl":"ltr"}`]}}function de(t,e){let{top:o,left:n,right:i,bottom:c,width:a,height:r}=t.getBoundingClientRect();return e!==void 0&&(o-=e[1],n-=e[0],c+=e[1],i+=e[0],a+=e[0],r+=e[1]),{top:o,bottom:c,height:r,left:n,right:i,width:a,middle:n+(i-n)/2,center:o+(c-o)/2}}function fe(t,e,o){let{top:n,left:i}=t.getBoundingClientRect();return n+=e.top,i+=e.left,o!==void 0&&(n+=o[1],i+=o[0]),{top:n,bottom:n+1,height:1,left:i,right:i+1,width:1,middle:i,center:n}}function he(t,e){return{top:0,center:e/2,bottom:e,left:0,middle:t/2,right:t}}function st(t,e,o,n){return{top:t[o.vertical]-e[n.vertical],left:t[o.horizontal]-e[n.horizontal]}}function mt(t,e=0){if(t.targetEl===null||t.anchorEl===null||e>5)return;if(t.targetEl.offsetHeight===0||t.targetEl.offsetWidth===0){setTimeout(()=>{mt(t,e+1)},10);return}const{targetEl:o,offset:n,anchorEl:i,anchorOrigin:c,selfOrigin:a,absoluteOffset:r,fit:f,cover:u,maxHeight:h,maxWidth:v}=t;if(ht.is.ios===!0&&window.visualViewport!==void 0){const w=document.body.style,{offsetLeft:p,offsetTop:x}=window.visualViewport;p!==ot&&(w.setProperty("--q-pe-left",p+"px"),ot=p),x!==at&&(w.setProperty("--q-pe-top",x+"px"),at=x)}const{scrollLeft:y,scrollTop:l}=o,d=r===void 0?de(i,u===!0?[0,0]:n):fe(i,r,n);Object.assign(o.style,{top:0,left:0,minWidth:null,minHeight:null,maxWidth:v,maxHeight:h,visibility:"visible"});const{offsetWidth:C,offsetHeight:M}=o,{elWidth:H,elHeight:W}=f===!0||u===!0?{elWidth:Math.max(d.width,C),elHeight:u===!0?Math.max(d.height,M):M}:{elWidth:C,elHeight:M};let g={maxWidth:v,maxHeight:h};(f===!0||u===!0)&&(g.minWidth=d.width+"px",u===!0&&(g.minHeight=d.height+"px")),Object.assign(o.style,g);const b=he(H,W);let m=st(d,b,c,a);if(r===void 0||n===void 0)z(m,d,b,c,a);else{const{top:w,left:p}=m;z(m,d,b,c,a);let x=!1;if(m.top!==w){x=!0;const T=2*n[1];d.center=d.top-=T,d.bottom-=T+2}if(m.left!==p){x=!0;const T=2*n[0];d.middle=d.left-=T,d.right-=T+2}x===!0&&(m=st(d,b,c,a),z(m,d,b,c,a))}g={top:m.top+"px",left:m.left+"px"},m.maxHeight!==void 0&&(g.maxHeight=m.maxHeight+"px",d.height>m.maxHeight&&(g.minHeight=g.maxHeight)),m.maxWidth!==void 0&&(g.maxWidth=m.maxWidth+"px",d.width>m.maxWidth&&(g.minWidth=g.maxWidth)),Object.assign(o.style,g),o.scrollTop!==l&&(o.scrollTop=l),o.scrollLeft!==y&&(o.scrollLeft=y)}function z(t,e,o,n,i){const c=o.bottom,a=o.right,r=Pt(),f=window.innerHeight-r,u=document.body.clientWidth;if(t.top<0||t.top+c>f)if(i.vertical==="center")t.top=e[n.vertical]>f/2?Math.max(0,f-c):0,t.maxHeight=Math.min(c,f);else if(e[n.vertical]>f/2){const h=Math.min(f,n.vertical==="center"?e.center:n.vertical===i.vertical?e.bottom:e.top);t.maxHeight=Math.min(c,h),t.top=Math.max(0,h-c)}else t.top=Math.max(0,n.vertical==="center"?e.center:n.vertical===i.vertical?e.top:e.bottom),t.maxHeight=Math.min(c,f-t.top);if(t.left<0||t.left+a>u)if(t.maxWidth=Math.min(a,u),i.horizontal==="middle")t.left=e[n.horizontal]>u/2?Math.max(0,u-a):0;else if(e[n.horizontal]>u/2){const h=Math.min(u,n.horizontal==="middle"?e.middle:n.horizontal===i.horizontal?e.right:e.left);t.maxWidth=Math.min(a,h),t.left=Math.max(0,h-t.maxWidth)}else t.left=Math.max(0,n.horizontal==="middle"?e.middle:n.horizontal===i.horizontal?e.left:e.right),t.maxWidth=Math.min(a,u-t.left)}const xe=Bt({name:"QMenu",inheritAttrs:!1,props:{...le,...Dt,...Lt,...It,persistent:Boolean,autoClose:Boolean,separateClosePopup:Boolean,noEscDismiss:Boolean,noRouteDismiss:Boolean,noRefocus:Boolean,noFocus:Boolean,fit:Boolean,cover:Boolean,square:Boolean,anchor:{type:String,validator:it},self:{type:String,validator:it},offset:{type:Array,validator:ce},scrollTarget:Wt,touchPosition:Boolean,maxHeight:{type:String,default:null},maxWidth:{type:String,default:null}},emits:[...At,"click","escapeKey"],setup(t,{slots:e,emit:o,attrs:n}){let i=null,c,a,r;const f=ft(),{proxy:u}=f,{$q:h}=u,v=P(null),y=P(!1),l=S(()=>t.persistent!==!0&&t.noRouteDismiss!==!0),d=Rt(t,h),{registerTick:C,removeTick:M}=zt(),{registerTimeout:H}=$t(),{transitionProps:W,transitionStyle:g}=Ft(t),{localScrollTarget:b,changeScrollEvent:m,unconfigureScrollTarget:w}=re(t,G),{anchorEl:p,canShow:x}=se({showing:y}),{hide:T}=Kt({showing:y,canShow:x,handleShow:bt,handleHide:Tt,hideOnRouteChange:l,processOnMount:!0}),{showPortal:O,hidePortal:j,renderPortal:vt}=Nt(f,v,wt,"menu"),I={anchorEl:p,innerRef:v,onClickOutside(s){if(t.persistent!==!0&&y.value===!0)return T(s),(s.type==="touchstart"||s.target.classList.contains("q-dialog__backdrop"))&&te(s),!0}},V=S(()=>lt(t.anchor||(t.cover===!0?"center middle":"bottom start"),h.lang.rtl)),yt=S(()=>t.cover===!0?V.value:lt(t.self||"top start",h.lang.rtl)),pt=S(()=>(t.square===!0?" q-menu--square":"")+(d.value===!0?" q-menu--dark q-dark":"")),xt=S(()=>t.autoClose===!0?{onClick:_t}:{}),Q=S(()=>y.value===!0&&t.persistent!==!0);E(Q,s=>{s===!0?(Ot(D),ue(I)):(tt(D),nt(I))});function L(){Zt(()=>{let s=v.value;s&&s.contains(document.activeElement)!==!0&&(s=s.querySelector("[autofocus][tabindex], [data-autofocus][tabindex]")||s.querySelector("[autofocus] [tabindex], [data-autofocus] [tabindex]")||s.querySelector("[autofocus], [data-autofocus]")||s,s.focus({preventScroll:!0}))})}function bt(s){if(i=t.noRefocus===!1?document.activeElement:null,jt(J),O(),G(),c=void 0,s!==void 0&&(t.touchPosition||t.contextMenu)){const R=Vt(s);if(R.left!==void 0){const{top:St,left:Et}=p.value.getBoundingClientRect();c={left:R.left-Et,top:R.top-St}}}a===void 0&&(a=E(()=>h.screen.width+"|"+h.screen.height+"|"+t.self+"|"+t.anchor+"|"+h.lang.rtl,k)),t.noFocus!==!0&&document.activeElement.blur(),C(()=>{k(),t.noFocus!==!0&&L()}),H(()=>{h.platform.is.ios===!0&&(r=t.autoClose,v.value.click()),k(),O(!0),o("show",s)},t.transitionDuration)}function Tt(s){M(),j(),Y(!0),i!==null&&(s===void 0||s.qClickOutside!==!0)&&(((s?.type.indexOf("key")===0?i.closest('[tabindex]:not([tabindex^="-"])'):void 0)||i).focus(),i=null),H(()=>{j(!0),o("hide",s)},t.transitionDuration)}function Y(s){c=void 0,a!==void 0&&(a(),a=void 0),(s===!0||y.value===!0)&&(Qt(J),w(),nt(I),tt(D)),s!==!0&&(i=null)}function G(){(p.value!==null||t.scrollTarget!==void 0)&&(b.value=Yt(p.value,t.scrollTarget),m(b.value,k))}function _t(s){r!==!0?(Gt(u,s),o("click",s)):r=!1}function J(s){Q.value===!0&&t.noFocus!==!0&&Jt(v.value,s.target)!==!0&&L()}function D(s){t.noEscDismiss!==!0&&(o("escapeKey"),T(s))}function k(){mt({targetEl:v.value,offset:t.offset,anchorEl:p.value,anchorOrigin:V.value,selfOrigin:yt.value,absoluteOffset:c,fit:t.fit,cover:t.cover,maxHeight:t.maxHeight,maxWidth:t.maxWidth})}function wt(){return et(Xt,W.value,()=>y.value===!0?et("div",{role:"menu",...n,ref:v,tabindex:-1,class:["q-menu q-position-engine scroll"+pt.value,n.class],style:[n.style,g.value],...xt.value},Ut(e.default)):null)}return N(Y),Object.assign(u,{focus:L,updatePosition:k}),vt}}),rt=["B","KB","MB","GB","TB","PB"];function be(t,e=1){let o=0;for(;parseInt(t,10)>=1024&&o<rt.length-1;)t/=1024,++o;return`${t.toFixed(e)}${rt[o]}`}function Te(t,e,o){return o<=e?e:Math.min(o,Math.max(e,t))}function _e(t,e,o){if(o<=e)return e;const n=o-e+1;let i=e+(t-e)%n;return i<e&&(i=n+i),i===0?0:i}function me(t){return ee(t)===!0?"__q_date|"+t.getTime():ne(t)===!0?"__q_expr|"+t.source:typeof t=="number"?"__q_numb|"+t:typeof t=="boolean"?"__q_bool|"+(t?"1":"0"):typeof t=="string"?"__q_strn|"+t:typeof t=="function"?"__q_strn|"+t.toString():t===Object(t)?"__q_objt|"+JSON.stringify(t):t}function ge(t){if(t.length<9)return t;const o=t.substring(0,8),n=t.substring(9);switch(o){case"__q_date":const i=Number(n);return new Date(Number.isNaN(i)===!0?n:i);case"__q_expr":return new RegExp(n);case"__q_numb":return Number(n);case"__q_bool":return n==="1";case"__q_strn":return""+n;case"__q_objt":return JSON.parse(n);default:return t}}function ve(){const t=()=>null;return{has:()=>!1,hasItem:()=>!1,getLength:()=>0,getItem:t,getIndex:t,getKey:t,getAll:()=>{},getAllKeys:()=>[],set:q,setItem:q,remove:q,removeItem:q,clear:q,isEmpty:()=>!0}}function ye(t){const e=window[t+"Storage"],o=a=>{const r=e.getItem(a);return r?ge(r):null},n=a=>e.getItem(a)!==null,i=(a,r)=>{e.setItem(a,me(r))},c=a=>{e.removeItem(a)};return{has:n,hasItem:n,getLength:()=>e.length,getItem:o,getIndex:a=>a<e.length?o(e.key(a)):null,getKey:a=>a<e.length?e.key(a):null,getAll:()=>{let a;const r={},f=e.length;for(let u=0;u<f;u++)a=e.key(u),r[a]=o(a);return r},getAllKeys:()=>{const a=[],r=e.length;for(let f=0;f<r;f++)a.push(e.key(f));return a},set:i,setItem:i,remove:c,removeItem:c,clear:()=>{e.clear()},isEmpty:()=>e.length===0}}const gt=ht.has.webStorage===!1?ve():ye("local"),K={install({$q:t}){t.localStorage=gt}};Object.assign(K,gt);const ut="taxstore:v1",ct={prevPreparedByUs:!1,prevDeclaration:{comments:"",attachments:[]},firstName:"",lastName:"",birthDate:"",address:{street:"",cap:"",city:"",country:{code:"",name:""},canton:""}},dt={alimentiVersati:!1,alimentiCommenti:{comments:"",attachments:[]},maritalStatus:"",spouseFirstName:"",spouseLastName:"",spouseBirthDate:"",spouseDeadDate:"",spouseTaxNumber:"",spouseAddress:{street:"",cap:"",city:"",country:{code:"",name:""},canton:""},marriageDate:"",separated:!1,spouseAlimentiVersati:!1},we=oe("taxstore",{state:()=>{try{const t=K.getItem(ut);if(t&&typeof t=="object"){const e=t;if(Array.isArray(e.items))return{items:e.items}}}catch{}return{items:[{key:"taxpayer",data:{...ct}},{key:"marital",data:{...dt}}]}},actions:{persist(){try{K.set(ut,{items:this.items})}catch{}},_findTaxpayer(){return this.items.find(t=>t.key==="taxpayer")},_findMarital(){return this.items.find(t=>t.key==="marital")},getTaxpayer(){return this._findTaxpayer()?.data},setTaxpayer(t){const e=this._findTaxpayer();e&&(e.data={...e.data,...t}),this.persist()},replaceTaxpayer(t){const e=this._findTaxpayer();e&&(e.data=t),this.persist()},resetTaxpayer(){const t=this._findTaxpayer();t&&(t.data={...ct}),this.persist()},getMarital(){return this._findMarital()?.data},setMarital(t){const e=this._findMarital();e&&(e.data={...e.data,...t}),this.persist()},replaceMarital(t){const e=this._findMarital();e&&(e.data=t),this.persist()},resetMarital(){const t=this._findMarital();t&&(t.data={...dt}),this.persist()}}});export{K as P,xe as Q,it as a,Te as b,ae as c,ie as d,re as e,se as f,ue as g,be as h,_e as n,lt as p,nt as r,mt as s,we as u,ce as v};
|