cic-kit 0.0.9 → 0.0.12
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/README.md +29 -3
- package/dist/cic-kit.css +1 -1
- package/dist/cmp/firebase/firebase.d.ts +1 -0
- package/dist/cmp/localStorage/LS.d.ts +2 -0
- package/dist/index.cjs +2 -2
- package/dist/index.d.ts +4 -5
- package/dist/index.mjs +13 -9
- package/docs/Btn.md +26 -0
- package/docs/LS.md +27 -0
- package/docs/Modal.md +43 -0
- package/docs/_.md +0 -0
- package/docs/toast.md +29 -0
- package/package.json +24 -5
package/README.md
CHANGED
|
@@ -14,6 +14,11 @@ Il progetto che usa `cic-kit` deve avere già installati:
|
|
|
14
14
|
}
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
+
Requisiti opzionali:
|
|
18
|
+
|
|
19
|
+
- Vite
|
|
20
|
+
- vite-plugin-pwa
|
|
21
|
+
|
|
17
22
|
---
|
|
18
23
|
|
|
19
24
|
## Installazione
|
|
@@ -45,7 +50,19 @@ poi importa lo style su un scss con
|
|
|
45
50
|
|
|
46
51
|
Tra i componenti ci sono file di utility .ts e componenti .vue che possono utilizzare store globali basati su reactive() per controllarli
|
|
47
52
|
|
|
48
|
-
|
|
53
|
+
### docs
|
|
54
|
+
|
|
55
|
+
### docs
|
|
56
|
+
|
|
57
|
+
- [Btn](https://unpkg.com/cic-kit/docs/Btn.md)
|
|
58
|
+
- [LocalStorage(LS)](https://unpkg.com/cic-kit/docs/LS.md)
|
|
59
|
+
- [Modal](https://unpkg.com/cic-kit/docs/Modal.md)
|
|
60
|
+
|
|
61
|
+
## Changelog
|
|
62
|
+
|
|
63
|
+
- [CHANGELOG.md](./CHANGELOG.md)
|
|
64
|
+
|
|
65
|
+
#### Btn
|
|
49
66
|
|
|
50
67
|
Button Bootstrap con varianti, icona, loading e navigazione router.
|
|
51
68
|
|
|
@@ -64,10 +81,19 @@ Button Bootstrap con varianti, icona, loading e navigazione router.
|
|
|
64
81
|
|
|
65
82
|
```vue
|
|
66
83
|
<script setup lang="ts">
|
|
67
|
-
import {
|
|
84
|
+
import { Btn } from "cic-kit";
|
|
68
85
|
</script>
|
|
69
86
|
|
|
70
87
|
<template>
|
|
71
|
-
<
|
|
88
|
+
<Btn color="primary">Salva</Btn>
|
|
72
89
|
</template>
|
|
73
90
|
```
|
|
91
|
+
|
|
92
|
+
## PWA Update Modal
|
|
93
|
+
|
|
94
|
+
Questo componente sfrutta `vite-plugin-pwa`.
|
|
95
|
+
|
|
96
|
+
Se il plugin non è presente nel progetto host:
|
|
97
|
+
|
|
98
|
+
- il componente non registra il Service Worker
|
|
99
|
+
- non viene mostrato alcun errore
|
package/dist/cic-kit.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.spinner-border[data-v-
|
|
1
|
+
.spinner-border[data-v-1caf3817]{vertical-align:middle}.btn-ms-link[data-v-1caf3817]{background-color:transparent!important;border:none;color:var(--bs-btn-color)!important}.btn-ms-link[data-v-1caf3817]:hover{text-decoration:underline}.hideAfter[data-v-1caf3817]:after{display:none}.toast-wrapper[data-v-2cc28e46]{position:fixed;bottom:20px;right:20px;display:flex;flex-direction:column;gap:6px;z-index:999999}.toast-card[data-v-2cc28e46]{width:330px;min-height:80px;border-radius:8px;padding:10px 12px;background-color:#fff;box-shadow:0 8px 24px #00000026;display:flex;align-items:center;justify-content:center;gap:12px;cursor:default;transition:all .3s ease,transform .3s ease;overflow:hidden;opacity:1}.toast-card .icon-container[data-v-2cc28e46]{width:35px;height:35px;display:flex;justify-content:center;align-items:center;border-radius:50%;flex-shrink:0;transition:all .3s ease}.toast-card .message-text[data-v-2cc28e46]{font-size:17px;font-weight:700}.toast-card .sub-text[data-v-2cc28e46]{color:#555;font-size:14px}.toast-card .cross-icon[data-v-2cc28e46]{width:18px;height:18px;color:#555;cursor:pointer;flex-shrink:0}.toast-card[data-v-2cc28e46]:not(.expanded){min-height:40px;max-height:40px;padding-top:6px;padding-bottom:6px;opacity:.7}.toast-card:not(.expanded) .icon-container[data-v-2cc28e46]{width:18px;height:18px}.toast-card:not(.expanded) .message-text[data-v-2cc28e46]{font-size:14px}.toast-card:not(.expanded) .sub-content[data-v-2cc28e46]{display:none}.toast-card:not(.expanded) .cross-icon[data-v-2cc28e46]{width:14px;height:14px}.toast-fade-enter-from[data-v-2cc28e46],.toast-fade-leave-to[data-v-2cc28e46]{opacity:0;transform:translateY(20px)}.toast-fade-enter-active[data-v-2cc28e46],.toast-fade-leave-active[data-v-2cc28e46]{transition:all .3s ease}.message-text-container[data-v-2cc28e46]{flex-grow:1}.toast-card.info[data-v-2cc28e46]{border-right:5px solid var(--bs-info)}.toast-card.info .icon-container[data-v-2cc28e46]{color:var(--bs-info)}.toast-card.success[data-v-2cc28e46]{border-right:5px solid var(--bs-success)}.toast-card.success .icon-container[data-v-2cc28e46]{color:var(--bs-success)}.toast-card.warning[data-v-2cc28e46]{border-right:5px solid var(--bs-warning)}.toast-card.warning .icon-container[data-v-2cc28e46]{color:var(--bs-warning)}.toast-card.error[data-v-2cc28e46]{border-right:5px solid var(--bs-danger)}.toast-card.error .icon-container[data-v-2cc28e46]{color:var(--bs-danger)}.toast-card.primary[data-v-2cc28e46]{border-right:5px solid var(--bs-primary)}.toast-card.primary .icon-container[data-v-2cc28e46]{color:var(--bs-primary)}.toast-card.secondary[data-v-2cc28e46]{border-right:5px solid var(--bs-secondary)}.toast-card.secondary .icon-container[data-v-2cc28e46]{color:var(--bs-secondary)}.prefix-width[data-v-d70bf135]{width:60px}
|
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const _=require("vue"),gm=require("vue-router"),_m=["id"],ym={class:"accordion-item"},Tm={class:"accordion-header"},wm=["data-bs-target","aria-controls","disabled"],Em=["id","data-bs-parent"],vm={class:"accordion-body"},Im={key:0},Eh=_.defineComponent({inheritAttrs:!1,__name:"AccordionCmp",props:{id:{},title:{},defaultOpen:{type:Boolean},disabled:{type:Boolean}},emits:["open"],setup(n,{emit:e}){const t=n,r=e,s=_.useSlots(),i=_.useAttrs(),a=_.computed(()=>t.id??"accordionDefault"),c=_.computed(()=>!!t.disabled),u=_.computed(()=>!!s.default?.().length),h=_.computed(()=>!!s.header?.().length);function f(m){if(c.value){m.preventDefault(),m.stopPropagation();return}r("open",m)}return(m,y)=>(_.openBlock(),_.createElementBlock("div",_.mergeProps({class:"accordion",id:a.value},_.unref(i)),[_.createElementVNode("div",ym,[_.createElementVNode("h2",Tm,[_.createElementVNode("button",{class:"accordion-button collapsed p-2",type:"button","data-bs-toggle":"collapse","data-bs-target":`#collapseOne-${a.value}`,"aria-expanded":"false","aria-controls":`collapseOne-${a.value}`,disabled:c.value,onClick:f},[h.value?_.renderSlot(m.$slots,"header",{key:0}):(_.openBlock(),_.createElementBlock(_.Fragment,{key:1},[_.createTextVNode(_.toDisplayString(t.title??"- default -"),1)],64))],8,wm)]),_.createElementVNode("div",{id:`collapseOne-${a.value}`,class:"accordion-collapse collapse","data-bs-parent":`#${a.value}`},[_.createElementVNode("div",vm,[u.value?_.createCommentVNode("",!0):(_.openBlock(),_.createElementBlock("p",Im,[...y[0]||(y[0]=[_.createTextVNode(" - ",-1),_.createElementVNode("span",{class:"material-symbols-outlined text-warning"}," warning ",-1),_.createTextVNode(" - ",-1)])])),_.renderSlot(m.$slots,"default")])],8,Em)])],16,_m))}});let Am=(n=21)=>crypto.getRandomValues(new Uint8Array(n)).reduce((e,t)=>(t&=63,t<36?e+=t.toString(36):t<62?e+=(t-26).toString(36).toUpperCase():t>62?e+="-":e+="_",e),"");class vh{type;id;title;message;duration;timer;createdAt;logo;component;componentProps;actions;closeAction;constructor({type:e="info",title:t,message:r,logo:s,duration:i=3e3,component:a,componentProps:c,actions:u,closeAction:h}){if(this.type=e,this.id=Am(),this.title=t,this.message=r,this.duration=i,this.component=a,this.componentProps=c,this.actions=u,this.closeAction=h,this.timer=null,this.createdAt=null,this.logo=s,!this.logo)switch(e){case"info":this.logo='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 -960 960 960" fill="currentcolor"><path d="M480-80q-33 0-56.5-23.5T400-160h160q0 33-23.5 56.5T480-80ZM320-200v-80h320v80H320Zm10-120q-69-41-109.5-110T180-580q0-125 87.5-212.5T480-880q125 0 212.5 87.5T780-580q0 81-40.5 150T630-320H330Zm24-80h252q45-32 69.5-79T700-580q0-92-64-156t-156-64q-92 0-156 64t-64 156q0 54 24.5 101t69.5 79Zm126 0Z"/></svg>';break;case"error":this.logo='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 -960 960 960" fill="currentcolor"><path d="M480-280q17 0 28.5-11.5T520-320q0-17-11.5-28.5T480-360q-17 0-28.5 11.5T440-320q0 17 11.5 28.5T480-280Zm-40-160h80v-240h-80v240Zm40 360q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-80q134 0 227-93t93-227q0-134-93-227t-227-93q-134 0-227 93t-93 227q0 134 93 227t227 93Zm0-320Z" /></svg>';break;case"success":this.logo='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 -960 960 960" fill="currentcolor"><path d="M480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q65 0 123 19t107 53l-58 59q-38-24-81-37.5T480-800q-133 0-226.5 93.5T160-480q0 133 93.5 226.5T480-160q133 0 226.5-93.5T800-480q0-18-2-36t-6-35l65-65q11 32 17 66t6 70q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm-56-216L254-466l56-56 114 114 400-401 56 56-456 457Z" /></svg>';break;case"warning":this.logo='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 -960 960 960" fill="currentcolor"><path d="m40-120 440-760 440 760H40Zm138-80h604L480-720 178-200Zm302-40q17 0 28.5-11.5T520-280q0-17-11.5-28.5T480-320q-17 0-28.5 11.5T440-280q0 17 11.5 28.5T480-240Zm-40-120h80v-200h-80v200Zm40-100Z"/></svg>';break;case"primary":this.logo='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 -960 960 960" fill="currentcolor"><path d="M480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-80q134 0 227-93t93-227q0-134-93-227t-227-93q-134 0-227 93t-93 227q0 134 93 227t227 93Zm0-80q-100 0-170-70t-70-170q0-100 70-170t170-70q100 0 170 70t70 170q0 100-70 170t-170 70Zm0-80q66 0 113-47t47-113q0-66-47-113t-113-47q-66 0-113 47t-47 113q0 66 47 113t113 47Zm0-80q-33 0-56.5-23.5T400-480q0-33 23.5-56.5T480-560q33 0 56.5 23.5T560-480q0 33-23.5 56.5T480-400Z"/></svg>';break;case"log":this.logo='<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#0400ffff"><path d="M480-200q66 0 113-47t47-113v-160q0-66-47-113t-113-47q-66 0-113 47t-47 113v160q0 66 47 113t113 47Zm-80-120h160v-80H400v80Zm0-160h160v-80H400v80Zm80 40Zm0 320q-65 0-120.5-32T272-240H160v-80h84q-3-20-3.5-40t-.5-40h-80v-80h80q0-20 .5-40t3.5-40h-84v-80h112q14-23 31.5-43t40.5-35l-64-66 56-56 86 86q28-9 57-9t57 9l88-86 56 56-66 66q23 15 41.5 34.5T688-640h112v80h-84q3 20 3.5 40t.5 40h80v80h-80q0 20-.5 40t-3.5 40h84v80H688q-32 56-87.5 88T480-120Z"/></svg>';break;case"logError":this.logo='<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#ff0000ff"><path d="M480-200q66 0 113-47t47-113v-160q0-66-47-113t-113-47q-66 0-113 47t-47 113v160q0 66 47 113t113 47Zm-80-120h160v-80H400v80Zm0-160h160v-80H400v80Zm80 40Zm0 320q-65 0-120.5-32T272-240H160v-80h84q-3-20-3.5-40t-.5-40h-80v-80h80q0-20 .5-40t3.5-40h-84v-80h112q14-23 31.5-43t40.5-35l-64-66 56-56 86 86q28-9 57-9t57 9l88-86 56 56-66 66q23 15 41.5 34.5T688-640h112v80h-84q3 20 3.5 40t.5 40h80v80h-80q0 20-.5 40t-3.5 40h84v80H688q-32 56-87.5 88T480-120ZM40-720v-120q0-33 23.5-56.5T120-920h120v80H120v120H40ZM240-40H120q-33 0-56.5-23.5T40-120v-120h80v120h120v80Zm480 0v-80h120v-120h80v120q0 33-23.5 56.5T840-40H720Zm120-680v-120H720v-80h120q33 0 56.5 23.5T920-840v120h-80Z"/></svg>';break;default:this.logo='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 -960 960 960" fill="currentcolor"><path d="M160-200v-80h80v-280q0-83 50-147.5T420-792v-28q0-25 17.5-42.5T480-880q25 0 42.5 17.5T540-820v28q80 20 130 84.5T720-560v280h80v80H160Zm320-300Zm0 420q-33 0-56.5-23.5T400-160h160q0 33-23.5 56.5T480-80ZM320-280h320v-280q0-66-47-113t-113-47q-66 0-113 47t-47 113v280Z" /></svg>';break}}start(e){if(this.duration===null){this.createdAt=null,this.timer=null;return}this.createdAt=Date.now(),this.timer=e}stop(){if(this.timer){if(clearTimeout(this.timer),this.timer=null,this.duration===null){this.createdAt=null;return}const e=Date.now()-(this.createdAt??Date.now()),t=this.duration-e;this.duration=Math.max(t,0)}}}function bm(n,e){try{return JSON.parse(n)}catch{U.logError(`Errore${e?' "'+e+'"':""} nel JSON.parse`);return}}const Ce={defaultKey:{isDev:"isDev",debugMod:"debugMod",currentUser:"currentUser"},getStr(n){const e=localStorage.getItem(n);if(e)return e},getParsed(n){const e=this.getStr(n);return e&&bm(e,n)},set(n,e){try{const t=JSON.stringify(e);return localStorage.setItem(n,t),t}catch(t){const r=t?.name==="QuotaExceededError"?"Spazio di archiviazione locale esaurito":`Errore nel salvataggio di "${n}"`;return U.logError(r),null}},update(n,e){const t=this.getParsed(n);return Array.isArray(t)?(t.push(e),this.set(n,t)):t&&typeof t=="object"?this.set(n,{...t,...e}):(U.logError("Devi usare set. typeof existing non è un object o array"),t)},push(n,...e){const t=this.getParsed(n);return Array.isArray(t)?(t.push(...e),this.set(n,t)):(U.logError(`push fallito: "${n}" non è un array`),t)},remove(n){try{localStorage.removeItem(n)}catch{U.logError(`Errore nella rimozione di "${n}"`)}},delete(n){this.remove(n)},has(n){try{return localStorage.getItem(n)!==null}catch{return!1}},keys(){return Object.keys(localStorage)},clear(n){try{const e=new Set(n?Array.isArray(n)?n:[n]:[]);for(let t=localStorage.length-1;t>=0;t--){const r=localStorage.key(t);r&&(e.has(r)||localStorage.removeItem(r))}}catch{U.logError("Errore nel pulire lo storage")}},migrate(n,e){const t=this.getStr(n);t!==void 0&&(this.set(e,t),this.remove(n))}},je=_.reactive({isDev:Ce.getParsed(Ce.defaultKey.isDev)!==void 0?Ce.getParsed(Ce.defaultKey.isDev):location.hostname==="localhost"||location.hostname==="127.0.0.1",debugMod:Ce.getParsed(Ce.defaultKey.debugMod),debugFirestore:!1}),U=_.reactive({queue:[],start(n){if(n.duration===null){n.start(null);return}n.start(setTimeout(()=>this.removeToastById(n.id),n.duration))},startAll(){for(const n of this.queue)this.start(n)},stop(n){if(n.timer){if(clearTimeout(n.timer),n.timer=null,n.duration===null){n.createdAt=null;return}const e=Date.now()-(n.createdAt??Date.now()),t=n.duration-e;n.duration=Math.max(t,0)}},stopAll(){for(const n of this.queue)n.stop()},removeToastByIndex(n){const e=this.queue[n];e?this.stop(e):console.error("toast to stop not found"),this.queue.splice(n,1)},removeToastById(n){for(const e in this.queue){const t=Number(e);if(this.queue[t]?.id===n){this.removeToastByIndex(t);break}}},_addToast(n,e,t){t=t===void 0?3e3:t;const r=new vh({type:n,title:typeof e=="object"?e.title:e,message:typeof e=="object"?e.message:void 0,logo:typeof e=="object"?e.logo:void 0,component:typeof e=="object"?e.component:void 0,componentProps:typeof e=="object"?e.componentProps:void 0,actions:typeof e=="object"?e.actions:void 0,closeAction:typeof e=="object"?e.closeAction:void 0,duration:t});this.queue.push(r),this.start(r)},info(n,e){this._addToast("info",n,e)},error(n,e){if(je.debugMod){const t=typeof n=="object"?`${n.title} ${n?.message??""} `:n;console.log("[ERROR]: "+t),console.error(t)}this._addToast("error",n,e)},danger(n,e){this.error(n,e)},success(n,e){this._addToast("success",n,e)},warning(n,e){if(je.debugMod){const t=typeof n=="object"?`${n.title} ${n?.message??""} `:n;console.log("[WARNING]: "+t),console.warn(t)}this._addToast("warning",n,e)},primary(n,e){this._addToast("primary",n,e)},secondary(n,e){this._addToast("secondary",n,e)},log(n,e){je.debugMod&&(console.log(typeof n=="object"?`${n.title} ${n?.message??""} `:n),this._addToast("log",n,e===void 0?5e3:e))},logError(n,e){if(!je.debugMod)return;const t=typeof n=="object"?`${n.title} ${n?.message??""} `:n;console.log("[ERROR]: "+t),console.error(t),this._addToast("logError",n,e===void 0?5e3:e)}});async function Ih({url:n,text:e,title:t}){if(navigator.share)try{await navigator.share({title:t??"Condividi",text:e??"",url:n})}catch{await navigator.clipboard.writeText(n),U.success("Link copiato negli appunti")}else await navigator.clipboard.writeText(n),U.success("Link copiato negli appunti")}const Sm=["type","disabled","aria-busy"],Rm={class:"material-symbols-outlined","aria-hidden":"true"},Pm=_.defineComponent({inheritAttrs:!1,__name:"BtnCmp",props:{variant:{},color:{},size:{},block:{type:Boolean},disabled:{type:Boolean},type:{},to:{},loading:{type:Boolean},icon:{},share:{}},emits:["click"],setup(n,{emit:e}){const t=n,r=e,s=_.useSlots(),i=_.useAttrs(),a=gm.useRouter(),c=_.computed(()=>!!t.disabled||!!t.loading),u=_.computed(()=>{const k=t.color??"dark",V=(t.variant??"solid")==="solid"?`btn-${k}`:`btn-outline-${k}`,N=t.variant==="ghost"?"border-0":"",$=t.size?`btn-${t.size}`:"",W=t.block?"w-100":"",Q=t.variant==="link"?"btn-ms-link":"";return["btn",V,Q,N,$,W].filter(Boolean).join(" ")}),h=_.computed(()=>!!s.default?.().length),f=_.computed(()=>{if(t.icon&&t.icon.trim().length>0)return t.icon.trim();if(!h.value)return"error"});function m(S){if(c.value){S.preventDefault(),S.stopPropagation();return}r("click",S),t.share&&Ih(t.share),t.to&&(t.type==="submit"&&S.preventDefault(),S.stopPropagation(),a.push(t.to))}const y=_.computed(()=>t.to?"button":t.type??"button");return(S,k)=>(_.openBlock(),_.createElementBlock("button",_.mergeProps(_.unref(i),{class:[u.value,_.unref(i).class],type:y.value,disabled:c.value,"aria-busy":n.loading||void 0,onClick:m}),[n.loading&&f.value?(_.openBlock(),_.createElementBlock(_.Fragment,{key:0},[k[0]||(k[0]=_.createElementVNode("span",{class:"me-2 d-inline-flex align-middle"},[_.createElementVNode("span",{class:"spinner-border spinner-border-sm align-middle",role:"status","aria-hidden":"true"})],-1)),_.renderSlot(S.$slots,"default",{},void 0,!0)],64)):n.loading&&!f.value?(_.openBlock(),_.createElementBlock(_.Fragment,{key:1},[k[1]||(k[1]=_.createElementVNode("span",{class:"spinner-border spinner-border-sm align-middle",role:"status","aria-hidden":"true"},null,-1)),k[2]||(k[2]=_.createElementVNode("span",{class:"visually-hidden"},"Loading…",-1))],64)):(_.openBlock(),_.createElementBlock(_.Fragment,{key:2},[f.value?(_.openBlock(),_.createElementBlock("span",{key:0,class:_.normalizeClass(`${h.value?"me-2 ":""}d-inline-flex align-middle`)},[_.createElementVNode("span",Rm,_.toDisplayString(f.value),1)],2)):_.createCommentVNode("",!0),_.renderSlot(S.$slots,"default",{},void 0,!0)],64))],16,Sm))}}),ca=(n,e)=>{const t=n.__vccOpts||n;for(const[r,s]of e)t[r]=s;return t},gr=ca(Pm,[["__scopeId","data-v-2280ac85"]]),Cm=["onMouseenter"],km=["innerHTML"],Nm={class:"message-text-container text-dark"},Dm={class:"message-text mb-0"},Vm={class:"sub-content"},Om={key:0,class:"sub-text mb-0"},Lm={key:2,class:"text-end"},Mm=["onClick"],xm=_.defineComponent({__name:"ToastCmp",setup(n){const e=_.ref(null),t=_.computed(()=>U.queue||[]);function r(a){e.value=a,U.stopAll()}function s(){e.value=null,U.startAll()}function i(a){e.value=null,U.removeToastById(a)}return(a,c)=>(_.openBlock(),_.createBlock(_.TransitionGroup,{name:"toast-fade",tag:"div",class:"toast-wrapper"},{default:_.withCtx(()=>[(_.openBlock(!0),_.createElementBlock(_.Fragment,null,_.renderList(t.value,(u,h)=>(_.openBlock(),_.createElementBlock("div",{key:u.id,class:_.normalizeClass(["toast-card",[u.type,{expanded:e.value===null?h===t.value.length-1:e.value===u.id}]]),onMouseenter:f=>r(u.id),onMouseleave:s},[_.createElementVNode("div",{class:"icon-container",innerHTML:u.logo},null,8,km),_.createElementVNode("div",Nm,[_.createElementVNode("p",Dm,_.toDisplayString(u.title),1),_.createElementVNode("div",Vm,[u.message?(_.openBlock(),_.createElementBlock("p",Om,_.toDisplayString(u.message),1)):_.createCommentVNode("",!0),u.component?(_.openBlock(),_.createBlock(_.resolveDynamicComponent(u.component),_.mergeProps({key:1,ref_for:!0},u.componentProps,{class:"mt-2 me-2"}),_.createSlots({_:2},[u.componentProps?.children?{name:"default",fn:_.withCtx(()=>[_.createTextVNode(_.toDisplayString(typeof u.componentProps.children=="function"?u.componentProps.children():u.componentProps.children),1)]),key:"0"}:void 0]),1040)):_.createCommentVNode("",!0),u.actions?(_.openBlock(),_.createElementBlock("div",Lm,[u.closeAction!==!1?(_.openBlock(),_.createBlock(gr,{key:0,variant:"link",class:"mt-2 me-1"},{default:_.withCtx(()=>[...c[0]||(c[0]=[_.createTextVNode("close",-1)])]),_:1})):_.createCommentVNode("",!0),(_.openBlock(!0),_.createElementBlock(_.Fragment,null,_.renderList(u.actions,(f,m)=>(_.openBlock(),_.createElementBlock(_.Fragment,{key:u.id+"-action-"+m},[f.content?(_.openBlock(),_.createBlock(gr,{key:0,onClick:()=>{f.onClick(),i(u.id)},icon:f.icon,variant:f.variant,color:f.color,disabled:typeof f.disabled=="function"?f.disabled():f.disabled,class:_.normalizeClass(["mt-2","me-2",f.class]),style:_.normalizeStyle(f.style)},{default:_.withCtx(()=>[_.createTextVNode(_.toDisplayString(f.content),1)]),_:2},1032,["onClick","icon","variant","color","disabled","class","style"])):(_.openBlock(),_.createBlock(gr,{key:1,onClick:()=>{f.onClick(),i(u.id)},icon:f.icon,variant:f.variant,color:f.color,disabled:typeof f.disabled=="function"?f.disabled():f.disabled,class:_.normalizeClass(["mt-2","me-2",f.class]),style:_.normalizeStyle(f.style)},null,8,["onClick","icon","variant","color","disabled","class","style"]))],64))),128))])):_.createCommentVNode("",!0)])]),(_.openBlock(),_.createElementBlock("svg",{class:"cross-icon",viewBox:"0 0 15 15",fill:"currentColor",onClick:f=>i(u.id)},[...c[1]||(c[1]=[_.createElementVNode("path",{d:"M11.78 4.03c.23-.23.23-.6 0-.83s-.6-.23-.83 0L7.5 6.69 4.03 3.2c-.23-.23-.6-.23-.83 0s-.23.6 0 .83L6.69 7.5 3.2 10.97c-.23.23-.23.6 0 .83s.6.23.83 0L7.5 8.31l3.47 3.47c.23.23.6.23.83 0s.23-.6 0-.83L8.31 7.5l3.47-3.47z"},null,-1)])],8,Mm))],42,Cm))),128))]),_:1}))}}),Ah=ca(xm,[["__scopeId","data-v-821bd999"]]),Fm=["for"],Um={key:0,class:"text-danger"},Bm=["disabled","readonly"],qm={value:""},$m=["id"],bh=_.defineComponent({__name:"FieldGender",props:{modelValue:{},field:{},fv:{},label:{type:[String,Boolean],default:!1},placeholder:{default:"—"},errors:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},required:{type:Boolean,default:!1},class:{},style:{},classLabel:{}},emits:["update:modelValue"],setup(n,{emit:e}){const t=n,r=e,s=_.computed({get(){return t.modelValue??""},set(a){r("update:modelValue",a??"")}}),i=_.computed(()=>typeof t.label!="string"&&t.label!==!0&&t.label!==!1);return(a,c)=>(_.openBlock(),_.createElementBlock(_.Fragment,null,[n.label&&!i.value?(_.openBlock(),_.createElementBlock("label",{key:0,class:_.normalizeClass(["form-label",t.classLabel]),for:n.fv.getFieldId(n.field)},[_.createTextVNode(_.toDisplayString(n.label===!0?n.field:n.label)+" ",1),n.required?(_.openBlock(),_.createElementBlock("span",Um," *")):_.createCommentVNode("",!0)],10,Fm)):n.label&&i.value?(_.openBlock(),_.createBlock(_.resolveDynamicComponent(n.label),{key:1,for:n.fv.getFieldId(n.field)},null,8,["for"])):_.createCommentVNode("",!0),_.withDirectives(_.createElementVNode("select",_.mergeProps({class:"form-select","onUpdate:modelValue":c[0]||(c[0]=u=>s.value=u)},n.fv.getFieldProps(n.field),{class:t.class,style:t.style,disabled:n.disabled,readonly:n.readonly}),[_.createElementVNode("option",qm,_.toDisplayString(n.placeholder),1),c[1]||(c[1]=_.createElementVNode("option",{value:"m"},"Maschio",-1)),c[2]||(c[2]=_.createElementVNode("option",{value:"f"},"Femmina",-1)),c[3]||(c[3]=_.createElementVNode("option",{value:"o"},"Altro / Preferisco non dirlo",-1))],16,Bm),[[_.vModelSelect,s.value]]),n.errors?(_.openBlock(),_.createElementBlock("div",{key:2,id:n.fv.getFieldIdError(n.field),class:"invalid-feedback"},_.toDisplayString(n.fv.showError(n.field)),9,$m)):_.createCommentVNode("",!0)],64))}}),jm=["for"],zm={class:"d-flex gap-2"},Hm=["placeholder","disabled","readonly"],Gm=["placeholder","disabled","readonly"],Km=["id"],Wm=_.defineComponent({__name:"FieldPhoneNumber",props:{modelValue:{},field:{},fv:{},label:{type:[String,Boolean],default:!1},placeholder:{default:"333 1234567"},placeholderPrefix:{default:"+39"},errors:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},class:{},style:{},disabledPrefix:{type:Boolean},disabledNumber:{type:Boolean},readonlyPrefix:{type:Boolean},readonlyNumber:{type:Boolean},classPrefix:{},classNumber:{},stylePrefix:{},styleNumber:{}},emits:["update:modelValue"],setup(n,{emit:e}){const t=n,r=e,s=_.computed({get(){return t.modelValue?.[0]??t.placeholderPrefix??""},set(k){r("update:modelValue",[k,t.modelValue?.[1]??""])}}),i=_.computed({get(){return t.modelValue?.[1]??""},set(k){r("update:modelValue",[t.modelValue?.[0]??t.placeholderPrefix??"",k])}}),a=_.computed(()=>t.disabledPrefix??t.disabled),c=_.computed(()=>t.disabledNumber??t.disabled),u=_.computed(()=>t.readonlyPrefix??t.readonly),h=_.computed(()=>t.readonlyNumber??t.readonly),f=_.computed(()=>[t.class,t.classPrefix]),m=_.computed(()=>[t.class,t.classNumber]),y=_.computed(()=>[t.style,t.stylePrefix]),S=_.computed(()=>[t.style,t.styleNumber]);return(k,V)=>(_.openBlock(),_.createElementBlock(_.Fragment,null,[n.label?(_.openBlock(),_.createElementBlock("label",{key:0,class:"form-label",for:n.fv.getFieldId(n.field)},_.toDisplayString(n.label===!0?n.field:n.label),9,jm)):_.createCommentVNode("",!0),_.createElementVNode("div",zm,[_.withDirectives(_.createElementVNode("input",{type:"text","onUpdate:modelValue":V[0]||(V[0]=N=>s.value=N),class:_.normalizeClass(["form-control prefix-width",f.value]),style:_.normalizeStyle(y.value),placeholder:n.placeholderPrefix,disabled:a.value,readonly:u.value,autocomplete:"tel-country-code",inputmode:"tel"},null,14,Hm),[[_.vModelText,s.value]]),_.withDirectives(_.createElementVNode("input",_.mergeProps({type:"text","onUpdate:modelValue":V[1]||(V[1]=N=>i.value=N)},n.fv.getFieldProps(n.field),{class:["form-control",m.value],style:S.value,placeholder:n.placeholder,disabled:c.value,readonly:h.value,autocomplete:"tel",inputmode:"tel"}),null,16,Gm),[[_.vModelText,i.value]])]),n.errors?(_.openBlock(),_.createElementBlock("div",{key:1,id:n.fv.getFieldIdError(n.field),class:"invalid-feedback"},_.toDisplayString(n.fv.showError(n.field)),9,Km)):_.createCommentVNode("",!0)],64))}}),Sh=ca(Wm,[["__scopeId","data-v-d70bf135"]]),Qm=["for"],Jm={key:0,class:"text-danger"},Ym=["type","placeholder","disabled","readonly","autocomplete","inputmode"],Xm=["id"],Rh=_.defineComponent({__name:"InputField",props:{modelValue:{},field:{},fv:{},label:{type:[String,Boolean],default:!1},placeholder:{default:""},errors:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},required:{type:Boolean,default:!1},class:{},style:{},classLabel:{},type:{default:"text"},autocomplete:{},inputmode:{}},emits:["update:modelValue"],setup(n,{emit:e}){const t=n,r=e,s=_.computed({get(){return t.modelValue??""},set(a){r("update:modelValue",a??"")}}),i=_.computed(()=>typeof t.label!="string"&&t.label!==!0&&t.label!==!1);return(a,c)=>(_.openBlock(),_.createElementBlock(_.Fragment,null,[n.label&&!i.value?(_.openBlock(),_.createElementBlock("label",{key:0,class:_.normalizeClass(["form-label",t.classLabel]),for:n.fv.getFieldId(n.field)},[_.createTextVNode(_.toDisplayString(n.label===!0?n.field:n.label)+" ",1),n.required?(_.openBlock(),_.createElementBlock("span",Jm," *")):_.createCommentVNode("",!0)],10,Qm)):n.label&&i.value?(_.openBlock(),_.createBlock(_.resolveDynamicComponent(n.label),{key:1,for:n.fv.getFieldId(n.field)},null,8,["for"])):_.createCommentVNode("",!0),_.withDirectives(_.createElementVNode("input",_.mergeProps({type:n.type,"onUpdate:modelValue":c[0]||(c[0]=u=>s.value=u)},n.fv.getFieldProps(n.field),{class:["form-control",t.class],style:t.style,placeholder:n.placeholder,disabled:n.disabled,readonly:n.readonly,autocomplete:n.autocomplete,inputmode:n.inputmode}),null,16,Ym),[[_.vModelDynamic,s.value]]),n.errors?(_.openBlock(),_.createElementBlock("div",{key:2,id:n.fv.getFieldIdError(n.field),class:"invalid-feedback"},_.toDisplayString(n.fv.showError(n.field)),9,Xm)):_.createCommentVNode("",!0)],64))}}),Zm=()=>{};const Ph=function(n){const e=[];let t=0;for(let r=0;r<n.length;r++){let s=n.charCodeAt(r);s<128?e[t++]=s:s<2048?(e[t++]=s>>6|192,e[t++]=s&63|128):(s&64512)===55296&&r+1<n.length&&(n.charCodeAt(r+1)&64512)===56320?(s=65536+((s&1023)<<10)+(n.charCodeAt(++r)&1023),e[t++]=s>>18|240,e[t++]=s>>12&63|128,e[t++]=s>>6&63|128,e[t++]=s&63|128):(e[t++]=s>>12|224,e[t++]=s>>6&63|128,e[t++]=s&63|128)}return e},eg=function(n){const e=[];let t=0,r=0;for(;t<n.length;){const s=n[t++];if(s<128)e[r++]=String.fromCharCode(s);else if(s>191&&s<224){const i=n[t++];e[r++]=String.fromCharCode((s&31)<<6|i&63)}else if(s>239&&s<365){const i=n[t++],a=n[t++],c=n[t++],u=((s&7)<<18|(i&63)<<12|(a&63)<<6|c&63)-65536;e[r++]=String.fromCharCode(55296+(u>>10)),e[r++]=String.fromCharCode(56320+(u&1023))}else{const i=n[t++],a=n[t++];e[r++]=String.fromCharCode((s&15)<<12|(i&63)<<6|a&63)}}return e.join("")},Ch={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:typeof atob=="function",encodeByteArray(n,e){if(!Array.isArray(n))throw Error("encodeByteArray takes an array as a parameter");this.init_();const t=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[];for(let s=0;s<n.length;s+=3){const i=n[s],a=s+1<n.length,c=a?n[s+1]:0,u=s+2<n.length,h=u?n[s+2]:0,f=i>>2,m=(i&3)<<4|c>>4;let y=(c&15)<<2|h>>6,S=h&63;u||(S=64,a||(y=64)),r.push(t[f],t[m],t[y],t[S])}return r.join("")},encodeString(n,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(n):this.encodeByteArray(Ph(n),e)},decodeString(n,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(n):eg(this.decodeStringToByteArray(n,e))},decodeStringToByteArray(n,e){this.init_();const t=e?this.charToByteMapWebSafe_:this.charToByteMap_,r=[];for(let s=0;s<n.length;){const i=t[n.charAt(s++)],c=s<n.length?t[n.charAt(s)]:0;++s;const h=s<n.length?t[n.charAt(s)]:64;++s;const m=s<n.length?t[n.charAt(s)]:64;if(++s,i==null||c==null||h==null||m==null)throw new tg;const y=i<<2|c>>4;if(r.push(y),h!==64){const S=c<<4&240|h>>2;if(r.push(S),m!==64){const k=h<<6&192|m;r.push(k)}}}return r},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let n=0;n<this.ENCODED_VALS.length;n++)this.byteToCharMap_[n]=this.ENCODED_VALS.charAt(n),this.charToByteMap_[this.byteToCharMap_[n]]=n,this.byteToCharMapWebSafe_[n]=this.ENCODED_VALS_WEBSAFE.charAt(n),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[n]]=n,n>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(n)]=n,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(n)]=n)}}};class tg extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const ng=function(n){const e=Ph(n);return Ch.encodeByteArray(e,!0)},Ss=function(n){return ng(n).replace(/\./g,"")},kh=function(n){try{return Ch.decodeString(n,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};function rg(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("Unable to locate global object.")}const sg=()=>rg().__FIREBASE_DEFAULTS__,ig=()=>{if(typeof process>"u"||typeof process.env>"u")return;const n=process.env.__FIREBASE_DEFAULTS__;if(n)return JSON.parse(n)},og=()=>{if(typeof document>"u")return;let n;try{n=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}const e=n&&kh(n[1]);return e&&JSON.parse(e)},si=()=>{try{return Zm()||sg()||ig()||og()}catch(n){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${n}`);return}},Nh=n=>si()?.emulatorHosts?.[n],la=n=>{const e=Nh(n);if(!e)return;const t=e.lastIndexOf(":");if(t<=0||t+1===e.length)throw new Error(`Invalid host ${e} with no separate hostname and port!`);const r=parseInt(e.substring(t+1),10);return e[0]==="["?[e.substring(1,t-1),r]:[e.substring(0,t),r]},Dh=()=>si()?.config,Vh=n=>si()?.[`_${n}`];class ag{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}wrapCallback(e){return(t,r)=>{t?this.reject(t):this.resolve(r),typeof e=="function"&&(this.promise.catch(()=>{}),e.length===1?e(t):e(t,r))}}}function vt(n){try{return(n.startsWith("http://")||n.startsWith("https://")?new URL(n).hostname:n).endsWith(".cloudworkstations.dev")}catch{return!1}}async function ii(n){return(await fetch(n,{credentials:"include"})).ok}function Oh(n,e){if(n.uid)throw new Error('The "uid" field is no longer supported by mockUserToken. Please use "sub" instead for Firebase Auth User ID.');const t={alg:"none",type:"JWT"},r=e||"demo-project",s=n.iat||0,i=n.sub||n.user_id;if(!i)throw new Error("mockUserToken must contain 'sub' or 'user_id' field!");const a={iss:`https://securetoken.google.com/${r}`,aud:r,iat:s,exp:s+3600,auth_time:s,sub:i,user_id:i,firebase:{sign_in_provider:"custom",identities:{}},...n};return[Ss(JSON.stringify(t)),Ss(JSON.stringify(a)),""].join(".")}const _r={};function cg(){const n={prod:[],emulator:[]};for(const e of Object.keys(_r))_r[e]?n.emulator.push(e):n.prod.push(e);return n}function lg(n){let e=document.getElementById(n),t=!1;return e||(e=document.createElement("div"),e.setAttribute("id",n),t=!0),{created:t,element:e}}let Il=!1;function oi(n,e){if(typeof window>"u"||typeof document>"u"||!vt(window.location.host)||_r[n]===e||_r[n]||Il)return;_r[n]=e;function t(y){return`__firebase__banner__${y}`}const r="__firebase__banner",i=cg().prod.length>0;function a(){const y=document.getElementById(r);y&&y.remove()}function c(y){y.style.display="flex",y.style.background="#7faaf0",y.style.position="fixed",y.style.bottom="5px",y.style.left="5px",y.style.padding=".5em",y.style.borderRadius="5px",y.style.alignItems="center"}function u(y,S){y.setAttribute("width","24"),y.setAttribute("id",S),y.setAttribute("height","24"),y.setAttribute("viewBox","0 0 24 24"),y.setAttribute("fill","none"),y.style.marginLeft="-6px"}function h(){const y=document.createElement("span");return y.style.cursor="pointer",y.style.marginLeft="16px",y.style.fontSize="24px",y.innerHTML=" ×",y.onclick=()=>{Il=!0,a()},y}function f(y,S){y.setAttribute("id",S),y.innerText="Learn more",y.href="https://firebase.google.com/docs/studio/preview-apps#preview-backend",y.setAttribute("target","__blank"),y.style.paddingLeft="5px",y.style.textDecoration="underline"}function m(){const y=lg(r),S=t("text"),k=document.getElementById(S)||document.createElement("span"),V=t("learnmore"),N=document.getElementById(V)||document.createElement("a"),$=t("preprendIcon"),W=document.getElementById($)||document.createElementNS("http://www.w3.org/2000/svg","svg");if(y.created){const Q=y.element;c(Q),f(N,V);const te=h();u(W,$),Q.append(W,k,N,te),document.body.appendChild(Q)}i?(k.innerText="Preview backend disconnected.",W.innerHTML=`<g clip-path="url(#clip0_6013_33858)">
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("vue"),gm=require("vue-router"),_m=["id"],ym={class:"accordion-item"},Tm={class:"accordion-header"},wm=["data-bs-target","aria-controls","disabled"],Em=["id","data-bs-parent"],vm={class:"accordion-body"},Im={key:0},Eh=_.defineComponent({inheritAttrs:!1,__name:"Accordion",props:{id:{},title:{},defaultOpen:{type:Boolean},disabled:{type:Boolean}},emits:["open"],setup(n,{emit:e}){const t=n,r=e,s=_.useSlots(),i=_.useAttrs(),a=_.computed(()=>t.id??"accordionDefault"),c=_.computed(()=>!!t.disabled),u=_.computed(()=>!!s.default?.().length),h=_.computed(()=>!!s.header?.().length);function f(m){if(c.value){m.preventDefault(),m.stopPropagation();return}r("open",m)}return(m,y)=>(_.openBlock(),_.createElementBlock("div",_.mergeProps({class:"accordion",id:a.value},_.unref(i)),[_.createElementVNode("div",ym,[_.createElementVNode("h2",Tm,[_.createElementVNode("button",{class:"accordion-button collapsed p-2",type:"button","data-bs-toggle":"collapse","data-bs-target":`#collapseOne-${a.value}`,"aria-expanded":"false","aria-controls":`collapseOne-${a.value}`,disabled:c.value,onClick:f},[h.value?_.renderSlot(m.$slots,"header",{key:0}):(_.openBlock(),_.createElementBlock(_.Fragment,{key:1},[_.createTextVNode(_.toDisplayString(t.title??"- default -"),1)],64))],8,wm)]),_.createElementVNode("div",{id:`collapseOne-${a.value}`,class:"accordion-collapse collapse","data-bs-parent":`#${a.value}`},[_.createElementVNode("div",vm,[u.value?_.createCommentVNode("",!0):(_.openBlock(),_.createElementBlock("p",Im,[...y[0]||(y[0]=[_.createTextVNode(" - ",-1),_.createElementVNode("span",{class:"material-symbols-outlined text-warning"}," warning ",-1),_.createTextVNode(" - ",-1)])])),_.renderSlot(m.$slots,"default")])],8,Em)])],16,_m))}});let Am=(n=21)=>crypto.getRandomValues(new Uint8Array(n)).reduce((e,t)=>(t&=63,t<36?e+=t.toString(36):t<62?e+=(t-26).toString(36).toUpperCase():t>62?e+="-":e+="_",e),"");class vh{type;id;title;message;duration;timer;createdAt;logo;component;componentProps;actions;closeAction;constructor({type:e="info",title:t,message:r,logo:s,duration:i=3e3,component:a,componentProps:c,actions:u,closeAction:h}){if(this.type=e,this.id=Am(),this.title=t,this.message=r,this.duration=i,this.component=a,this.componentProps=c,this.actions=u,this.closeAction=h,this.timer=null,this.createdAt=null,this.logo=s,!this.logo)switch(e){case"info":this.logo='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 -960 960 960" fill="currentcolor"><path d="M480-80q-33 0-56.5-23.5T400-160h160q0 33-23.5 56.5T480-80ZM320-200v-80h320v80H320Zm10-120q-69-41-109.5-110T180-580q0-125 87.5-212.5T480-880q125 0 212.5 87.5T780-580q0 81-40.5 150T630-320H330Zm24-80h252q45-32 69.5-79T700-580q0-92-64-156t-156-64q-92 0-156 64t-64 156q0 54 24.5 101t69.5 79Zm126 0Z"/></svg>';break;case"error":this.logo='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 -960 960 960" fill="currentcolor"><path d="M480-280q17 0 28.5-11.5T520-320q0-17-11.5-28.5T480-360q-17 0-28.5 11.5T440-320q0 17 11.5 28.5T480-280Zm-40-160h80v-240h-80v240Zm40 360q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-80q134 0 227-93t93-227q0-134-93-227t-227-93q-134 0-227 93t-93 227q0 134 93 227t227 93Zm0-320Z" /></svg>';break;case"success":this.logo='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 -960 960 960" fill="currentcolor"><path d="M480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q65 0 123 19t107 53l-58 59q-38-24-81-37.5T480-800q-133 0-226.5 93.5T160-480q0 133 93.5 226.5T480-160q133 0 226.5-93.5T800-480q0-18-2-36t-6-35l65-65q11 32 17 66t6 70q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm-56-216L254-466l56-56 114 114 400-401 56 56-456 457Z" /></svg>';break;case"warning":this.logo='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 -960 960 960" fill="currentcolor"><path d="m40-120 440-760 440 760H40Zm138-80h604L480-720 178-200Zm302-40q17 0 28.5-11.5T520-280q0-17-11.5-28.5T480-320q-17 0-28.5 11.5T440-280q0 17 11.5 28.5T480-240Zm-40-120h80v-200h-80v200Zm40-100Z"/></svg>';break;case"primary":this.logo='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 -960 960 960" fill="currentcolor"><path d="M480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-80q134 0 227-93t93-227q0-134-93-227t-227-93q-134 0-227 93t-93 227q0 134 93 227t227 93Zm0-80q-100 0-170-70t-70-170q0-100 70-170t170-70q100 0 170 70t70 170q0 100-70 170t-170 70Zm0-80q66 0 113-47t47-113q0-66-47-113t-113-47q-66 0-113 47t-47 113q0 66 47 113t113 47Zm0-80q-33 0-56.5-23.5T400-480q0-33 23.5-56.5T480-560q33 0 56.5 23.5T560-480q0 33-23.5 56.5T480-400Z"/></svg>';break;case"log":this.logo='<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#0400ffff"><path d="M480-200q66 0 113-47t47-113v-160q0-66-47-113t-113-47q-66 0-113 47t-47 113v160q0 66 47 113t113 47Zm-80-120h160v-80H400v80Zm0-160h160v-80H400v80Zm80 40Zm0 320q-65 0-120.5-32T272-240H160v-80h84q-3-20-3.5-40t-.5-40h-80v-80h80q0-20 .5-40t3.5-40h-84v-80h112q14-23 31.5-43t40.5-35l-64-66 56-56 86 86q28-9 57-9t57 9l88-86 56 56-66 66q23 15 41.5 34.5T688-640h112v80h-84q3 20 3.5 40t.5 40h80v80h-80q0 20-.5 40t-3.5 40h84v80H688q-32 56-87.5 88T480-120Z"/></svg>';break;case"logError":this.logo='<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#ff0000ff"><path d="M480-200q66 0 113-47t47-113v-160q0-66-47-113t-113-47q-66 0-113 47t-47 113v160q0 66 47 113t113 47Zm-80-120h160v-80H400v80Zm0-160h160v-80H400v80Zm80 40Zm0 320q-65 0-120.5-32T272-240H160v-80h84q-3-20-3.5-40t-.5-40h-80v-80h80q0-20 .5-40t3.5-40h-84v-80h112q14-23 31.5-43t40.5-35l-64-66 56-56 86 86q28-9 57-9t57 9l88-86 56 56-66 66q23 15 41.5 34.5T688-640h112v80h-84q3 20 3.5 40t.5 40h80v80h-80q0 20-.5 40t-3.5 40h84v80H688q-32 56-87.5 88T480-120ZM40-720v-120q0-33 23.5-56.5T120-920h120v80H120v120H40ZM240-40H120q-33 0-56.5-23.5T40-120v-120h80v120h120v80Zm480 0v-80h120v-120h80v120q0 33-23.5 56.5T840-40H720Zm120-680v-120H720v-80h120q33 0 56.5 23.5T920-840v120h-80Z"/></svg>';break;default:this.logo='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 -960 960 960" fill="currentcolor"><path d="M160-200v-80h80v-280q0-83 50-147.5T420-792v-28q0-25 17.5-42.5T480-880q25 0 42.5 17.5T540-820v28q80 20 130 84.5T720-560v280h80v80H160Zm320-300Zm0 420q-33 0-56.5-23.5T400-160h160q0 33-23.5 56.5T480-80ZM320-280h320v-280q0-66-47-113t-113-47q-66 0-113 47t-47 113v280Z" /></svg>';break}}start(e){if(this.duration===null){this.createdAt=null,this.timer=null;return}this.createdAt=Date.now(),this.timer=e}stop(){if(this.timer){if(clearTimeout(this.timer),this.timer=null,this.duration===null){this.createdAt=null;return}const e=Date.now()-(this.createdAt??Date.now()),t=this.duration-e;this.duration=Math.max(t,0)}}}function bm(n,e){try{return JSON.parse(n)}catch{U.logError(`Errore${e?' "'+e+'"':""} nel JSON.parse`);return}}const Ce={defaultKey:{isDev:"isDev",debugMod:"debugMod",currentUser:"currentUser",appConfig:"appConfig",lastLoginCurrentUser:"lastLoginCurrentUser"},getStr(n){const e=localStorage.getItem(n);if(e)return e},getParsed(n){const e=this.getStr(n);return e&&bm(e,n)},set(n,e){try{const t=JSON.stringify(e);return localStorage.setItem(n,t),t}catch(t){const r=t?.name==="QuotaExceededError"?"Spazio di archiviazione locale esaurito":`Errore nel salvataggio di "${n}"`;return U.logError(r),null}},update(n,e){const t=this.getParsed(n);return Array.isArray(t)?(t.push(e),this.set(n,t)):t&&typeof t=="object"?this.set(n,{...t,...e}):(U.logError("Devi usare set. typeof existing non è un object o array"),t)},push(n,...e){const t=this.getParsed(n);return Array.isArray(t)?(t.push(...e),this.set(n,t)):(U.logError(`push fallito: "${n}" non è un array`),t)},remove(n){try{localStorage.removeItem(n)}catch{U.logError(`Errore nella rimozione di "${n}"`)}},delete(n){this.remove(n)},has(n){try{return localStorage.getItem(n)!==null}catch{return!1}},keys(){return Object.keys(localStorage)},clear(n){try{const e=new Set(n?Array.isArray(n)?n:[n]:[]);for(let t=localStorage.length-1;t>=0;t--){const r=localStorage.key(t);r&&(e.has(r)||localStorage.removeItem(r))}}catch{U.logError("Errore nel pulire lo storage")}},migrate(n,e){const t=this.getStr(n);t!==void 0&&(this.set(e,t),this.remove(n))}},je=_.reactive({isDev:Ce.getParsed(Ce.defaultKey.isDev)!==void 0?Ce.getParsed(Ce.defaultKey.isDev):location.hostname==="localhost"||location.hostname==="127.0.0.1",debugMod:Ce.getParsed(Ce.defaultKey.debugMod),debugFirestore:!1}),U=_.reactive({queue:[],start(n){if(n.duration===null){n.start(null);return}n.start(setTimeout(()=>this.removeToastById(n.id),n.duration))},startAll(){for(const n of this.queue)this.start(n)},stop(n){if(n.timer){if(clearTimeout(n.timer),n.timer=null,n.duration===null){n.createdAt=null;return}const e=Date.now()-(n.createdAt??Date.now()),t=n.duration-e;n.duration=Math.max(t,0)}},stopAll(){for(const n of this.queue)n.stop()},removeToastByIndex(n){const e=this.queue[n];e?this.stop(e):console.error("toast to stop not found"),this.queue.splice(n,1)},removeToastById(n){for(const e in this.queue){const t=Number(e);if(this.queue[t]?.id===n){this.removeToastByIndex(t);break}}},_addToast(n,e,t){t=t===void 0?3e3:t;const r=new vh({type:n,title:typeof e=="object"?e.title:e,message:typeof e=="object"?e.message:void 0,logo:typeof e=="object"?e.logo:void 0,component:typeof e=="object"?e.component:void 0,componentProps:typeof e=="object"?e.componentProps:void 0,actions:typeof e=="object"?e.actions:void 0,closeAction:typeof e=="object"?e.closeAction:void 0,duration:t});this.queue.push(r),this.start(r)},info(n,e){this._addToast("info",n,e)},error(n,e){if(je.debugMod){const t=typeof n=="object"?`${n.title} ${n?.message??""} `:n;console.log("[ERROR]: "+t),console.error(t)}this._addToast("error",n,e)},danger(n,e){this.error(n,e)},success(n,e){this._addToast("success",n,e)},warning(n,e){if(je.debugMod){const t=typeof n=="object"?`${n.title} ${n?.message??""} `:n;console.log("[WARNING]: "+t),console.warn(t)}this._addToast("warning",n,e)},primary(n,e){this._addToast("primary",n,e)},secondary(n,e){this._addToast("secondary",n,e)},log(n,e){je.debugMod&&(console.log(typeof n=="object"?`${n.title} ${n?.message??""} `:n),this._addToast("log",n,e===void 0?5e3:e))},logError(n,e){if(!je.debugMod)return;const t=typeof n=="object"?`${n.title} ${n?.message??""} `:n;console.log("[ERROR]: "+t),console.error(t),this._addToast("logError",n,e===void 0?5e3:e)}});async function Ih({url:n,text:e,title:t}){if(navigator.share)try{await navigator.share({title:t??"Condividi",text:e??"",url:n})}catch{await navigator.clipboard.writeText(n),U.success("Link copiato negli appunti")}else await navigator.clipboard.writeText(n),U.success("Link copiato negli appunti")}const Sm=["type","disabled","aria-busy"],Rm={class:"material-symbols-outlined","aria-hidden":"true"},Pm=_.defineComponent({inheritAttrs:!1,__name:"Btn",props:{variant:{},color:{},size:{},block:{type:Boolean},disabled:{type:Boolean},type:{},to:{},loading:{type:Boolean},icon:{},share:{}},emits:["click"],setup(n,{emit:e}){const t=n,r=e,s=_.useSlots(),i=_.useAttrs(),a=gm.useRouter(),c=_.computed(()=>!!t.disabled||!!t.loading),u=_.computed(()=>{const k=t.color??"dark",V=(t.variant??"solid")==="solid"?`btn-${k}`:`btn-outline-${k}`,N=t.variant==="ghost"?"border-0":"",$=t.size?`btn-${t.size}`:"",W=t.block?"w-100":"",Q=t.variant==="link"?"btn-ms-link":"";return["btn",V,Q,N,$,W].filter(Boolean).join(" ")}),h=_.computed(()=>!!s.default?.().length),f=_.computed(()=>{if(t.icon&&t.icon.trim().length>0)return t.icon.trim();if(!h.value)return"error"});function m(S){if(c.value){S.preventDefault(),S.stopPropagation();return}r("click",S),t.share&&Ih(t.share),t.to&&(t.type==="submit"&&S.preventDefault(),S.stopPropagation(),a.push(t.to))}const y=_.computed(()=>t.to?"button":t.type??"button");return(S,k)=>(_.openBlock(),_.createElementBlock("button",_.mergeProps(_.unref(i),{class:[u.value,_.unref(i).class],type:y.value,disabled:c.value,"aria-busy":n.loading||void 0,onClick:m}),[n.loading&&f.value?(_.openBlock(),_.createElementBlock(_.Fragment,{key:0},[k[0]||(k[0]=_.createElementVNode("span",{class:"me-2 d-inline-flex align-middle"},[_.createElementVNode("span",{class:"spinner-border spinner-border-sm align-middle",role:"status","aria-hidden":"true"})],-1)),_.renderSlot(S.$slots,"default",{},void 0,!0)],64)):n.loading&&!f.value?(_.openBlock(),_.createElementBlock(_.Fragment,{key:1},[k[1]||(k[1]=_.createElementVNode("span",{class:"spinner-border spinner-border-sm align-middle",role:"status","aria-hidden":"true"},null,-1)),k[2]||(k[2]=_.createElementVNode("span",{class:"visually-hidden"},"Loading…",-1))],64)):(_.openBlock(),_.createElementBlock(_.Fragment,{key:2},[f.value?(_.openBlock(),_.createElementBlock("span",{key:0,class:_.normalizeClass(`${h.value?"me-2 ":""}d-inline-flex align-middle`)},[_.createElementVNode("span",Rm,_.toDisplayString(f.value),1)],2)):_.createCommentVNode("",!0),_.renderSlot(S.$slots,"default",{},void 0,!0)],64))],16,Sm))}}),ca=(n,e)=>{const t=n.__vccOpts||n;for(const[r,s]of e)t[r]=s;return t},gr=ca(Pm,[["__scopeId","data-v-1caf3817"]]),Cm=["onMouseenter"],km=["innerHTML"],Nm={class:"message-text-container text-dark"},Dm={class:"message-text mb-0"},Vm={class:"sub-content"},Om={key:0,class:"sub-text mb-0"},Lm={key:2,class:"text-end"},Mm=["onClick"],xm=_.defineComponent({__name:"ToastCmp",setup(n){const e=_.ref(null),t=_.computed(()=>U.queue||[]);function r(a){e.value=a,U.stopAll()}function s(){e.value=null,U.startAll()}function i(a){e.value=null,U.removeToastById(a)}return(a,c)=>(_.openBlock(),_.createBlock(_.TransitionGroup,{name:"toast-fade",tag:"div",class:"toast-wrapper"},{default:_.withCtx(()=>[(_.openBlock(!0),_.createElementBlock(_.Fragment,null,_.renderList(t.value,(u,h)=>(_.openBlock(),_.createElementBlock("div",{key:u.id,class:_.normalizeClass(["toast-card",[u.type,{expanded:e.value===null?h===t.value.length-1:e.value===u.id}]]),onMouseenter:f=>r(u.id),onMouseleave:s},[_.createElementVNode("div",{class:"icon-container",innerHTML:u.logo},null,8,km),_.createElementVNode("div",Nm,[_.createElementVNode("p",Dm,_.toDisplayString(u.title),1),_.createElementVNode("div",Vm,[u.message?(_.openBlock(),_.createElementBlock("p",Om,_.toDisplayString(u.message),1)):_.createCommentVNode("",!0),u.component?(_.openBlock(),_.createBlock(_.resolveDynamicComponent(u.component),_.mergeProps({key:1,ref_for:!0},u.componentProps,{class:"mt-2 me-2"}),_.createSlots({_:2},[u.componentProps?.children?{name:"default",fn:_.withCtx(()=>[_.createTextVNode(_.toDisplayString(typeof u.componentProps.children=="function"?u.componentProps.children():u.componentProps.children),1)]),key:"0"}:void 0]),1040)):_.createCommentVNode("",!0),u.actions?(_.openBlock(),_.createElementBlock("div",Lm,[u.closeAction!==!1?(_.openBlock(),_.createBlock(gr,{key:0,variant:"link",class:"mt-2 me-1"},{default:_.withCtx(()=>[...c[0]||(c[0]=[_.createTextVNode("close",-1)])]),_:1})):_.createCommentVNode("",!0),(_.openBlock(!0),_.createElementBlock(_.Fragment,null,_.renderList(u.actions,(f,m)=>(_.openBlock(),_.createElementBlock(_.Fragment,{key:u.id+"-action-"+m},[f.content?(_.openBlock(),_.createBlock(gr,{key:0,onClick:()=>{f.onClick(),i(u.id)},icon:f.icon,variant:f.variant,color:f.color,disabled:typeof f.disabled=="function"?f.disabled():f.disabled,class:_.normalizeClass(["mt-2","me-2",f.class]),style:_.normalizeStyle(f.style)},{default:_.withCtx(()=>[_.createTextVNode(_.toDisplayString(f.content),1)]),_:2},1032,["onClick","icon","variant","color","disabled","class","style"])):(_.openBlock(),_.createBlock(gr,{key:1,onClick:()=>{f.onClick(),i(u.id)},icon:f.icon,variant:f.variant,color:f.color,disabled:typeof f.disabled=="function"?f.disabled():f.disabled,class:_.normalizeClass(["mt-2","me-2",f.class]),style:_.normalizeStyle(f.style)},null,8,["onClick","icon","variant","color","disabled","class","style"]))],64))),128))])):_.createCommentVNode("",!0)])]),(_.openBlock(),_.createElementBlock("svg",{class:"cross-icon",viewBox:"0 0 15 15",fill:"currentColor",onClick:f=>i(u.id)},[...c[1]||(c[1]=[_.createElementVNode("path",{d:"M11.78 4.03c.23-.23.23-.6 0-.83s-.6-.23-.83 0L7.5 6.69 4.03 3.2c-.23-.23-.6-.23-.83 0s-.23.6 0 .83L6.69 7.5 3.2 10.97c-.23.23-.23.6 0 .83s.6.23.83 0L7.5 8.31l3.47 3.47c.23.23.6.23.83 0s.23-.6 0-.83L8.31 7.5l3.47-3.47z"},null,-1)])],8,Mm))],42,Cm))),128))]),_:1}))}}),Ah=ca(xm,[["__scopeId","data-v-2cc28e46"]]),Fm=["for"],Um={key:0,class:"text-danger"},Bm=["disabled","readonly"],qm={value:""},$m=["id"],bh=_.defineComponent({__name:"FieldGender",props:{modelValue:{},field:{},fv:{},label:{type:[String,Boolean],default:!1},placeholder:{default:"—"},errors:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},required:{type:Boolean,default:!1},class:{},style:{},classLabel:{}},emits:["update:modelValue"],setup(n,{emit:e}){const t=n,r=e,s=_.computed({get(){return t.modelValue??""},set(a){r("update:modelValue",a??"")}}),i=_.computed(()=>typeof t.label!="string"&&t.label!==!0&&t.label!==!1);return(a,c)=>(_.openBlock(),_.createElementBlock(_.Fragment,null,[n.label&&!i.value?(_.openBlock(),_.createElementBlock("label",{key:0,class:_.normalizeClass(["form-label",t.classLabel]),for:n.fv.getFieldId(n.field)},[_.createTextVNode(_.toDisplayString(n.label===!0?n.field:n.label)+" ",1),n.required?(_.openBlock(),_.createElementBlock("span",Um," *")):_.createCommentVNode("",!0)],10,Fm)):n.label&&i.value?(_.openBlock(),_.createBlock(_.resolveDynamicComponent(n.label),{key:1,for:n.fv.getFieldId(n.field)},null,8,["for"])):_.createCommentVNode("",!0),_.withDirectives(_.createElementVNode("select",_.mergeProps({class:"form-select","onUpdate:modelValue":c[0]||(c[0]=u=>s.value=u)},n.fv.getFieldProps(n.field),{class:t.class,style:t.style,disabled:n.disabled,readonly:n.readonly}),[_.createElementVNode("option",qm,_.toDisplayString(n.placeholder),1),c[1]||(c[1]=_.createElementVNode("option",{value:"m"},"Maschio",-1)),c[2]||(c[2]=_.createElementVNode("option",{value:"f"},"Femmina",-1)),c[3]||(c[3]=_.createElementVNode("option",{value:"o"},"Altro / Preferisco non dirlo",-1))],16,Bm),[[_.vModelSelect,s.value]]),n.errors?(_.openBlock(),_.createElementBlock("div",{key:2,id:n.fv.getFieldIdError(n.field),class:"invalid-feedback"},_.toDisplayString(n.fv.showError(n.field)),9,$m)):_.createCommentVNode("",!0)],64))}}),jm=["for"],zm={class:"d-flex gap-2"},Hm=["placeholder","disabled","readonly"],Gm=["placeholder","disabled","readonly"],Km=["id"],Wm=_.defineComponent({__name:"FieldPhoneNumber",props:{modelValue:{},field:{},fv:{},label:{type:[String,Boolean],default:!1},placeholder:{default:"333 1234567"},placeholderPrefix:{default:"+39"},errors:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},class:{},style:{},disabledPrefix:{type:Boolean},disabledNumber:{type:Boolean},readonlyPrefix:{type:Boolean},readonlyNumber:{type:Boolean},classPrefix:{},classNumber:{},stylePrefix:{},styleNumber:{}},emits:["update:modelValue"],setup(n,{emit:e}){const t=n,r=e,s=_.computed({get(){return t.modelValue?.[0]??t.placeholderPrefix??""},set(k){r("update:modelValue",[k,t.modelValue?.[1]??""])}}),i=_.computed({get(){return t.modelValue?.[1]??""},set(k){r("update:modelValue",[t.modelValue?.[0]??t.placeholderPrefix??"",k])}}),a=_.computed(()=>t.disabledPrefix??t.disabled),c=_.computed(()=>t.disabledNumber??t.disabled),u=_.computed(()=>t.readonlyPrefix??t.readonly),h=_.computed(()=>t.readonlyNumber??t.readonly),f=_.computed(()=>[t.class,t.classPrefix]),m=_.computed(()=>[t.class,t.classNumber]),y=_.computed(()=>[t.style,t.stylePrefix]),S=_.computed(()=>[t.style,t.styleNumber]);return(k,V)=>(_.openBlock(),_.createElementBlock(_.Fragment,null,[n.label?(_.openBlock(),_.createElementBlock("label",{key:0,class:"form-label",for:n.fv.getFieldId(n.field)},_.toDisplayString(n.label===!0?n.field:n.label),9,jm)):_.createCommentVNode("",!0),_.createElementVNode("div",zm,[_.withDirectives(_.createElementVNode("input",{type:"text","onUpdate:modelValue":V[0]||(V[0]=N=>s.value=N),class:_.normalizeClass(["form-control prefix-width",f.value]),style:_.normalizeStyle(y.value),placeholder:n.placeholderPrefix,disabled:a.value,readonly:u.value,autocomplete:"tel-country-code",inputmode:"tel"},null,14,Hm),[[_.vModelText,s.value]]),_.withDirectives(_.createElementVNode("input",_.mergeProps({type:"text","onUpdate:modelValue":V[1]||(V[1]=N=>i.value=N)},n.fv.getFieldProps(n.field),{class:["form-control",m.value],style:S.value,placeholder:n.placeholder,disabled:c.value,readonly:h.value,autocomplete:"tel",inputmode:"tel"}),null,16,Gm),[[_.vModelText,i.value]])]),n.errors?(_.openBlock(),_.createElementBlock("div",{key:1,id:n.fv.getFieldIdError(n.field),class:"invalid-feedback"},_.toDisplayString(n.fv.showError(n.field)),9,Km)):_.createCommentVNode("",!0)],64))}}),Sh=ca(Wm,[["__scopeId","data-v-d70bf135"]]),Qm=["for"],Jm={key:0,class:"text-danger"},Ym=["type","placeholder","disabled","readonly","autocomplete","inputmode"],Xm=["id"],Rh=_.defineComponent({__name:"InputField",props:{modelValue:{},field:{},fv:{},label:{type:[String,Boolean],default:!1},placeholder:{default:""},errors:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},required:{type:Boolean,default:!1},class:{},style:{},classLabel:{},type:{default:"text"},autocomplete:{},inputmode:{}},emits:["update:modelValue"],setup(n,{emit:e}){const t=n,r=e,s=_.computed({get(){return t.modelValue??""},set(a){r("update:modelValue",a??"")}}),i=_.computed(()=>typeof t.label!="string"&&t.label!==!0&&t.label!==!1);return(a,c)=>(_.openBlock(),_.createElementBlock(_.Fragment,null,[n.label&&!i.value?(_.openBlock(),_.createElementBlock("label",{key:0,class:_.normalizeClass(["form-label",t.classLabel]),for:n.fv.getFieldId(n.field)},[_.createTextVNode(_.toDisplayString(n.label===!0?n.field:n.label)+" ",1),n.required?(_.openBlock(),_.createElementBlock("span",Jm," *")):_.createCommentVNode("",!0)],10,Qm)):n.label&&i.value?(_.openBlock(),_.createBlock(_.resolveDynamicComponent(n.label),{key:1,for:n.fv.getFieldId(n.field)},null,8,["for"])):_.createCommentVNode("",!0),_.withDirectives(_.createElementVNode("input",_.mergeProps({type:n.type,"onUpdate:modelValue":c[0]||(c[0]=u=>s.value=u)},n.fv.getFieldProps(n.field),{class:["form-control",t.class],style:t.style,placeholder:n.placeholder,disabled:n.disabled,readonly:n.readonly,autocomplete:n.autocomplete,inputmode:n.inputmode}),null,16,Ym),[[_.vModelDynamic,s.value]]),n.errors?(_.openBlock(),_.createElementBlock("div",{key:2,id:n.fv.getFieldIdError(n.field),class:"invalid-feedback"},_.toDisplayString(n.fv.showError(n.field)),9,Xm)):_.createCommentVNode("",!0)],64))}}),Zm=()=>{};const Ph=function(n){const e=[];let t=0;for(let r=0;r<n.length;r++){let s=n.charCodeAt(r);s<128?e[t++]=s:s<2048?(e[t++]=s>>6|192,e[t++]=s&63|128):(s&64512)===55296&&r+1<n.length&&(n.charCodeAt(r+1)&64512)===56320?(s=65536+((s&1023)<<10)+(n.charCodeAt(++r)&1023),e[t++]=s>>18|240,e[t++]=s>>12&63|128,e[t++]=s>>6&63|128,e[t++]=s&63|128):(e[t++]=s>>12|224,e[t++]=s>>6&63|128,e[t++]=s&63|128)}return e},eg=function(n){const e=[];let t=0,r=0;for(;t<n.length;){const s=n[t++];if(s<128)e[r++]=String.fromCharCode(s);else if(s>191&&s<224){const i=n[t++];e[r++]=String.fromCharCode((s&31)<<6|i&63)}else if(s>239&&s<365){const i=n[t++],a=n[t++],c=n[t++],u=((s&7)<<18|(i&63)<<12|(a&63)<<6|c&63)-65536;e[r++]=String.fromCharCode(55296+(u>>10)),e[r++]=String.fromCharCode(56320+(u&1023))}else{const i=n[t++],a=n[t++];e[r++]=String.fromCharCode((s&15)<<12|(i&63)<<6|a&63)}}return e.join("")},Ch={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:typeof atob=="function",encodeByteArray(n,e){if(!Array.isArray(n))throw Error("encodeByteArray takes an array as a parameter");this.init_();const t=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[];for(let s=0;s<n.length;s+=3){const i=n[s],a=s+1<n.length,c=a?n[s+1]:0,u=s+2<n.length,h=u?n[s+2]:0,f=i>>2,m=(i&3)<<4|c>>4;let y=(c&15)<<2|h>>6,S=h&63;u||(S=64,a||(y=64)),r.push(t[f],t[m],t[y],t[S])}return r.join("")},encodeString(n,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(n):this.encodeByteArray(Ph(n),e)},decodeString(n,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(n):eg(this.decodeStringToByteArray(n,e))},decodeStringToByteArray(n,e){this.init_();const t=e?this.charToByteMapWebSafe_:this.charToByteMap_,r=[];for(let s=0;s<n.length;){const i=t[n.charAt(s++)],c=s<n.length?t[n.charAt(s)]:0;++s;const h=s<n.length?t[n.charAt(s)]:64;++s;const m=s<n.length?t[n.charAt(s)]:64;if(++s,i==null||c==null||h==null||m==null)throw new tg;const y=i<<2|c>>4;if(r.push(y),h!==64){const S=c<<4&240|h>>2;if(r.push(S),m!==64){const k=h<<6&192|m;r.push(k)}}}return r},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let n=0;n<this.ENCODED_VALS.length;n++)this.byteToCharMap_[n]=this.ENCODED_VALS.charAt(n),this.charToByteMap_[this.byteToCharMap_[n]]=n,this.byteToCharMapWebSafe_[n]=this.ENCODED_VALS_WEBSAFE.charAt(n),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[n]]=n,n>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(n)]=n,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(n)]=n)}}};class tg extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const ng=function(n){const e=Ph(n);return Ch.encodeByteArray(e,!0)},Ss=function(n){return ng(n).replace(/\./g,"")},kh=function(n){try{return Ch.decodeString(n,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};function rg(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("Unable to locate global object.")}const sg=()=>rg().__FIREBASE_DEFAULTS__,ig=()=>{if(typeof process>"u"||typeof process.env>"u")return;const n=process.env.__FIREBASE_DEFAULTS__;if(n)return JSON.parse(n)},og=()=>{if(typeof document>"u")return;let n;try{n=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}const e=n&&kh(n[1]);return e&&JSON.parse(e)},si=()=>{try{return Zm()||sg()||ig()||og()}catch(n){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${n}`);return}},Nh=n=>si()?.emulatorHosts?.[n],la=n=>{const e=Nh(n);if(!e)return;const t=e.lastIndexOf(":");if(t<=0||t+1===e.length)throw new Error(`Invalid host ${e} with no separate hostname and port!`);const r=parseInt(e.substring(t+1),10);return e[0]==="["?[e.substring(1,t-1),r]:[e.substring(0,t),r]},Dh=()=>si()?.config,Vh=n=>si()?.[`_${n}`];class ag{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}wrapCallback(e){return(t,r)=>{t?this.reject(t):this.resolve(r),typeof e=="function"&&(this.promise.catch(()=>{}),e.length===1?e(t):e(t,r))}}}function vt(n){try{return(n.startsWith("http://")||n.startsWith("https://")?new URL(n).hostname:n).endsWith(".cloudworkstations.dev")}catch{return!1}}async function ii(n){return(await fetch(n,{credentials:"include"})).ok}function Oh(n,e){if(n.uid)throw new Error('The "uid" field is no longer supported by mockUserToken. Please use "sub" instead for Firebase Auth User ID.');const t={alg:"none",type:"JWT"},r=e||"demo-project",s=n.iat||0,i=n.sub||n.user_id;if(!i)throw new Error("mockUserToken must contain 'sub' or 'user_id' field!");const a={iss:`https://securetoken.google.com/${r}`,aud:r,iat:s,exp:s+3600,auth_time:s,sub:i,user_id:i,firebase:{sign_in_provider:"custom",identities:{}},...n};return[Ss(JSON.stringify(t)),Ss(JSON.stringify(a)),""].join(".")}const _r={};function cg(){const n={prod:[],emulator:[]};for(const e of Object.keys(_r))_r[e]?n.emulator.push(e):n.prod.push(e);return n}function lg(n){let e=document.getElementById(n),t=!1;return e||(e=document.createElement("div"),e.setAttribute("id",n),t=!0),{created:t,element:e}}let Il=!1;function oi(n,e){if(typeof window>"u"||typeof document>"u"||!vt(window.location.host)||_r[n]===e||_r[n]||Il)return;_r[n]=e;function t(y){return`__firebase__banner__${y}`}const r="__firebase__banner",i=cg().prod.length>0;function a(){const y=document.getElementById(r);y&&y.remove()}function c(y){y.style.display="flex",y.style.background="#7faaf0",y.style.position="fixed",y.style.bottom="5px",y.style.left="5px",y.style.padding=".5em",y.style.borderRadius="5px",y.style.alignItems="center"}function u(y,S){y.setAttribute("width","24"),y.setAttribute("id",S),y.setAttribute("height","24"),y.setAttribute("viewBox","0 0 24 24"),y.setAttribute("fill","none"),y.style.marginLeft="-6px"}function h(){const y=document.createElement("span");return y.style.cursor="pointer",y.style.marginLeft="16px",y.style.fontSize="24px",y.innerHTML=" ×",y.onclick=()=>{Il=!0,a()},y}function f(y,S){y.setAttribute("id",S),y.innerText="Learn more",y.href="https://firebase.google.com/docs/studio/preview-apps#preview-backend",y.setAttribute("target","__blank"),y.style.paddingLeft="5px",y.style.textDecoration="underline"}function m(){const y=lg(r),S=t("text"),k=document.getElementById(S)||document.createElement("span"),V=t("learnmore"),N=document.getElementById(V)||document.createElement("a"),$=t("preprendIcon"),W=document.getElementById($)||document.createElementNS("http://www.w3.org/2000/svg","svg");if(y.created){const Q=y.element;c(Q),f(N,V);const te=h();u(W,$),Q.append(W,k,N,te),document.body.appendChild(Q)}i?(k.innerText="Preview backend disconnected.",W.innerHTML=`<g clip-path="url(#clip0_6013_33858)">
|
|
2
2
|
<path d="M4.8 17.6L12 5.6L19.2 17.6H4.8ZM6.91667 16.4H17.0833L12 7.93333L6.91667 16.4ZM12 15.6C12.1667 15.6 12.3056 15.5444 12.4167 15.4333C12.5389 15.3111 12.6 15.1667 12.6 15C12.6 14.8333 12.5389 14.6944 12.4167 14.5833C12.3056 14.4611 12.1667 14.4 12 14.4C11.8333 14.4 11.6889 14.4611 11.5667 14.5833C11.4556 14.6944 11.4 14.8333 11.4 15C11.4 15.1667 11.4556 15.3111 11.5667 15.4333C11.6889 15.5444 11.8333 15.6 12 15.6ZM11.4 13.6H12.6V10.4H11.4V13.6Z" fill="#212121"/>
|
|
3
3
|
</g>
|
|
4
4
|
<defs>
|
|
@@ -35,4 +35,4 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
35
35
|
)`}copy(e,t){const r=new Vn;return r.comparator=this.comparator,r.keyedMap=e,r.sortedSet=t,r}}class qu{constructor(){this.ga=new re(M.comparator)}track(e){const t=e.doc.key,r=this.ga.get(t);r?e.type!==0&&r.type===3?this.ga=this.ga.insert(t,e):e.type===3&&r.type!==1?this.ga=this.ga.insert(t,{type:r.type,doc:e.doc}):e.type===2&&r.type===2?this.ga=this.ga.insert(t,{type:2,doc:e.doc}):e.type===2&&r.type===0?this.ga=this.ga.insert(t,{type:0,doc:e.doc}):e.type===1&&r.type===0?this.ga=this.ga.remove(t):e.type===1&&r.type===2?this.ga=this.ga.insert(t,{type:1,doc:r.doc}):e.type===0&&r.type===1?this.ga=this.ga.insert(t,{type:2,doc:e.doc}):x(63341,{Vt:e,pa:r}):this.ga=this.ga.insert(t,e)}ya(){const e=[];return this.ga.inorderTraversal(((t,r)=>{e.push(r)})),e}}class Bn{constructor(e,t,r,s,i,a,c,u,h){this.query=e,this.docs=t,this.oldDocs=r,this.docChanges=s,this.mutatedKeys=i,this.fromCache=a,this.syncStateChanged=c,this.excludesMetadataChanges=u,this.hasCachedResults=h}static fromInitialDocuments(e,t,r,s,i){const a=[];return t.forEach((c=>{a.push({type:0,doc:c})})),new Bn(e,t,Vn.emptySet(t),a,r,s,!0,!1,i)}get hasPendingWrites(){return!this.mutatedKeys.isEmpty()}isEqual(e){if(!(this.fromCache===e.fromCache&&this.hasCachedResults===e.hasCachedResults&&this.syncStateChanged===e.syncStateChanged&&this.mutatedKeys.isEqual(e.mutatedKeys)&&Ti(this.query,e.query)&&this.docs.isEqual(e.docs)&&this.oldDocs.isEqual(e.oldDocs)))return!1;const t=this.docChanges,r=e.docChanges;if(t.length!==r.length)return!1;for(let s=0;s<t.length;s++)if(t[s].type!==r[s].type||!t[s].doc.isEqual(r[s].doc))return!1;return!0}}class CI{constructor(){this.wa=void 0,this.ba=[]}Sa(){return this.ba.some((e=>e.Da()))}}class kI{constructor(){this.queries=$u(),this.onlineState="Unknown",this.Ca=new Set}terminate(){(function(t,r){const s=q(t),i=s.queries;s.queries=$u(),i.forEach(((a,c)=>{for(const u of c.ba)u.onError(r)}))})(this,new O(P.ABORTED,"Firestore shutting down"))}}function $u(){return new Tn((n=>pf(n)),Ti)}async function Ya(n,e){const t=q(n);let r=3;const s=e.query;let i=t.queries.get(s);i?!i.Sa()&&e.Da()&&(r=2):(i=new CI,r=e.Da()?0:1);try{switch(r){case 0:i.wa=await t.onListen(s,!0);break;case 1:i.wa=await t.onListen(s,!1);break;case 2:await t.onFirstRemoteStoreListen(s)}}catch(a){const c=Ja(a,`Initialization of query '${bn(e.query)}' failed`);return void e.onError(c)}t.queries.set(s,i),i.ba.push(e),e.va(t.onlineState),i.wa&&e.Fa(i.wa)&&Za(t)}async function Xa(n,e){const t=q(n),r=e.query;let s=3;const i=t.queries.get(r);if(i){const a=i.ba.indexOf(e);a>=0&&(i.ba.splice(a,1),i.ba.length===0?s=e.Da()?0:1:!i.Sa()&&e.Da()&&(s=2))}switch(s){case 0:return t.queries.delete(r),t.onUnlisten(r,!0);case 1:return t.queries.delete(r),t.onUnlisten(r,!1);case 2:return t.onLastRemoteStoreUnlisten(r);default:return}}function NI(n,e){const t=q(n);let r=!1;for(const s of e){const i=s.query,a=t.queries.get(i);if(a){for(const c of a.ba)c.Fa(s)&&(r=!0);a.wa=s}}r&&Za(t)}function DI(n,e,t){const r=q(n),s=r.queries.get(e);if(s)for(const i of s.ba)i.onError(t);r.queries.delete(e)}function Za(n){n.Ca.forEach((e=>{e.next()}))}var Qo,ju;(ju=Qo||(Qo={})).Ma="default",ju.Cache="cache";class ec{constructor(e,t,r){this.query=e,this.xa=t,this.Oa=!1,this.Na=null,this.onlineState="Unknown",this.options=r||{}}Fa(e){if(!this.options.includeMetadataChanges){const r=[];for(const s of e.docChanges)s.type!==3&&r.push(s);e=new Bn(e.query,e.docs,e.oldDocs,r,e.mutatedKeys,e.fromCache,e.syncStateChanged,!0,e.hasCachedResults)}let t=!1;return this.Oa?this.Ba(e)&&(this.xa.next(e),t=!0):this.La(e,this.onlineState)&&(this.ka(e),t=!0),this.Na=e,t}onError(e){this.xa.error(e)}va(e){this.onlineState=e;let t=!1;return this.Na&&!this.Oa&&this.La(this.Na,e)&&(this.ka(this.Na),t=!0),t}La(e,t){if(!e.fromCache||!this.Da())return!0;const r=t!=="Offline";return(!this.options.Ka||!r)&&(!e.docs.isEmpty()||e.hasCachedResults||t==="Offline")}Ba(e){if(e.docChanges.length>0)return!0;const t=this.Na&&this.Na.hasPendingWrites!==e.hasPendingWrites;return!(!e.syncStateChanged&&!t)&&this.options.includeMetadataChanges===!0}ka(e){e=Bn.fromInitialDocuments(e.query,e.docs,e.mutatedKeys,e.fromCache,e.hasCachedResults),this.Oa=!0,this.xa.next(e)}Da(){return this.options.source!==Qo.Cache}}class Qf{constructor(e){this.key=e}}class Jf{constructor(e){this.key=e}}class VI{constructor(e,t){this.query=e,this.Za=t,this.Xa=null,this.hasCachedResults=!1,this.current=!1,this.Ya=K(),this.mutatedKeys=K(),this.eu=mf(e),this.tu=new Vn(this.eu)}get nu(){return this.Za}ru(e,t){const r=t?t.iu:new qu,s=t?t.tu:this.tu;let i=t?t.mutatedKeys:this.mutatedKeys,a=s,c=!1;const u=this.query.limitType==="F"&&s.size===this.query.limit?s.last():null,h=this.query.limitType==="L"&&s.size===this.query.limit?s.first():null;if(e.inorderTraversal(((f,m)=>{const y=s.get(f),S=wi(this.query,m)?m:null,k=!!y&&this.mutatedKeys.has(y.key),V=!!S&&(S.hasLocalMutations||this.mutatedKeys.has(S.key)&&S.hasCommittedMutations);let N=!1;y&&S?y.data.isEqual(S.data)?k!==V&&(r.track({type:3,doc:S}),N=!0):this.su(y,S)||(r.track({type:2,doc:S}),N=!0,(u&&this.eu(S,u)>0||h&&this.eu(S,h)<0)&&(c=!0)):!y&&S?(r.track({type:0,doc:S}),N=!0):y&&!S&&(r.track({type:1,doc:y}),N=!0,(u||h)&&(c=!0)),N&&(S?(a=a.add(S),i=V?i.add(f):i.delete(f)):(a=a.delete(f),i=i.delete(f)))})),this.query.limit!==null)for(;a.size>this.query.limit;){const f=this.query.limitType==="F"?a.last():a.first();a=a.delete(f.key),i=i.delete(f.key),r.track({type:1,doc:f})}return{tu:a,iu:r,Ss:c,mutatedKeys:i}}su(e,t){return e.hasLocalMutations&&t.hasCommittedMutations&&!t.hasLocalMutations}applyChanges(e,t,r,s){const i=this.tu;this.tu=e.tu,this.mutatedKeys=e.mutatedKeys;const a=e.iu.ya();a.sort(((f,m)=>(function(S,k){const V=N=>{switch(N){case 0:return 1;case 2:case 3:return 2;case 1:return 0;default:return x(20277,{Vt:N})}};return V(S)-V(k)})(f.type,m.type)||this.eu(f.doc,m.doc))),this.ou(r),s=s??!1;const c=t&&!s?this._u():[],u=this.Ya.size===0&&this.current&&!s?1:0,h=u!==this.Xa;return this.Xa=u,a.length!==0||h?{snapshot:new Bn(this.query,e.tu,i,a,e.mutatedKeys,u===0,h,!1,!!r&&r.resumeToken.approximateByteSize()>0),au:c}:{au:c}}va(e){return this.current&&e==="Offline"?(this.current=!1,this.applyChanges({tu:this.tu,iu:new qu,mutatedKeys:this.mutatedKeys,Ss:!1},!1)):{au:[]}}uu(e){return!this.Za.has(e)&&!!this.tu.has(e)&&!this.tu.get(e).hasLocalMutations}ou(e){e&&(e.addedDocuments.forEach((t=>this.Za=this.Za.add(t))),e.modifiedDocuments.forEach((t=>{})),e.removedDocuments.forEach((t=>this.Za=this.Za.delete(t))),this.current=e.current)}_u(){if(!this.current)return[];const e=this.Ya;this.Ya=K(),this.tu.forEach((r=>{this.uu(r.key)&&(this.Ya=this.Ya.add(r.key))}));const t=[];return e.forEach((r=>{this.Ya.has(r)||t.push(new Jf(r))})),this.Ya.forEach((r=>{e.has(r)||t.push(new Qf(r))})),t}cu(e){this.Za=e.ks,this.Ya=K();const t=this.ru(e.documents);return this.applyChanges(t,!0)}lu(){return Bn.fromInitialDocuments(this.query,this.tu,this.mutatedKeys,this.Xa===0,this.hasCachedResults)}}const tc="SyncEngine";class OI{constructor(e,t,r){this.query=e,this.targetId=t,this.view=r}}class LI{constructor(e){this.key=e,this.hu=!1}}class MI{constructor(e,t,r,s,i,a){this.localStore=e,this.remoteStore=t,this.eventManager=r,this.sharedClientState=s,this.currentUser=i,this.maxConcurrentLimboResolutions=a,this.Pu={},this.Tu=new Tn((c=>pf(c)),Ti),this.Iu=new Map,this.Eu=new Set,this.Ru=new re(M.comparator),this.Au=new Map,this.Vu=new qa,this.du={},this.mu=new Map,this.fu=Un.ar(),this.onlineState="Unknown",this.gu=void 0}get isPrimaryClient(){return this.gu===!0}}async function xI(n,e,t=!0){const r=np(n);let s;const i=r.Tu.get(e);return i?(r.sharedClientState.addLocalQueryTarget(i.targetId),s=i.view.lu()):s=await Yf(r,e,t,!0),s}async function FI(n,e){const t=np(n);await Yf(t,e,!0,!1)}async function Yf(n,e,t,r){const s=await rI(n.localStore,st(e)),i=s.targetId,a=n.sharedClientState.addLocalQueryTarget(i,t);let c;return r&&(c=await UI(n,e,i,a==="current",s.resumeToken)),n.isPrimaryClient&&t&&jf(n.remoteStore,s),c}async function UI(n,e,t,r,s){n.pu=(m,y,S)=>(async function(V,N,$,W){let Q=N.view.ru($);Q.Ss&&(Q=await Lu(V.localStore,N.query,!1).then((({documents:v})=>N.view.ru(v,Q))));const te=W&&W.targetChanges.get(N.targetId),we=W&&W.targetMismatches.get(N.targetId)!=null,oe=N.view.applyChanges(Q,V.isPrimaryClient,te,we);return Hu(V,N.targetId,oe.au),oe.snapshot})(n,m,y,S);const i=await Lu(n.localStore,e,!0),a=new VI(e,i.ks),c=a.ru(i.documents),u=$r.createSynthesizedTargetChangeForCurrentChange(t,r&&n.onlineState!=="Offline",s),h=a.applyChanges(c,n.isPrimaryClient,u);Hu(n,t,h.au);const f=new OI(e,t,a);return n.Tu.set(e,f),n.Iu.has(t)?n.Iu.get(t).push(e):n.Iu.set(t,[e]),h.snapshot}async function BI(n,e,t){const r=q(n),s=r.Tu.get(e),i=r.Iu.get(s.targetId);if(i.length>1)return r.Iu.set(s.targetId,i.filter((a=>!Ti(a,e)))),void r.Tu.delete(e);r.isPrimaryClient?(r.sharedClientState.removeLocalQueryTarget(s.targetId),r.sharedClientState.isActiveQueryTarget(s.targetId)||await Ko(r.localStore,s.targetId,!1).then((()=>{r.sharedClientState.clearQueryState(s.targetId),t&&Ha(r.remoteStore,s.targetId),Jo(r,s.targetId)})).catch(Hn)):(Jo(r,s.targetId),await Ko(r.localStore,s.targetId,!0))}async function qI(n,e){const t=q(n),r=t.Tu.get(e),s=t.Iu.get(r.targetId);t.isPrimaryClient&&s.length===1&&(t.sharedClientState.removeLocalQueryTarget(r.targetId),Ha(t.remoteStore,r.targetId))}async function $I(n,e,t){const r=QI(n);try{const s=await(function(a,c){const u=q(a),h=z.now(),f=c.reduce(((S,k)=>S.add(k.key)),K());let m,y;return u.persistence.runTransaction("Locally write mutations","readwrite",(S=>{let k=Et(),V=K();return u.xs.getEntries(S,f).next((N=>{k=N,k.forEach((($,W)=>{W.isValidDocument()||(V=V.add($))}))})).next((()=>u.localDocuments.getOverlayedDocuments(S,k))).next((N=>{m=N;const $=[];for(const W of c){const Q=nv(W,m.get(W.key).overlayedDocument);Q!=null&&$.push(new Qt(W.key,Q,of(Q.value.mapValue),Je.exists(!0)))}return u.mutationQueue.addMutationBatch(S,h,$,c)})).next((N=>{y=N;const $=N.applyToLocalDocumentSet(m,V);return u.documentOverlayCache.saveOverlays(S,N.batchId,$)}))})).then((()=>({batchId:y.batchId,changes:_f(m)})))})(r.localStore,e);r.sharedClientState.addPendingMutation(s.batchId),(function(a,c,u){let h=a.du[a.currentUser.toKey()];h||(h=new re(G)),h=h.insert(c,u),a.du[a.currentUser.toKey()]=h})(r,s.batchId,t),await zr(r,s.changes),await Si(r.remoteStore)}catch(s){const i=Ja(s,"Failed to persist write");t.reject(i)}}async function Xf(n,e){const t=q(n);try{const r=await eI(t.localStore,e);e.targetChanges.forEach(((s,i)=>{const a=t.Au.get(i);a&&(Y(s.addedDocuments.size+s.modifiedDocuments.size+s.removedDocuments.size<=1,22616),s.addedDocuments.size>0?a.hu=!0:s.modifiedDocuments.size>0?Y(a.hu,14607):s.removedDocuments.size>0&&(Y(a.hu,42227),a.hu=!1))})),await zr(t,r,e)}catch(r){await Hn(r)}}function zu(n,e,t){const r=q(n);if(r.isPrimaryClient&&t===0||!r.isPrimaryClient&&t===1){const s=[];r.Tu.forEach(((i,a)=>{const c=a.view.va(e);c.snapshot&&s.push(c.snapshot)})),(function(a,c){const u=q(a);u.onlineState=c;let h=!1;u.queries.forEach(((f,m)=>{for(const y of m.ba)y.va(c)&&(h=!0)})),h&&Za(u)})(r.eventManager,e),s.length&&r.Pu.J_(s),r.onlineState=e,r.isPrimaryClient&&r.sharedClientState.setOnlineState(e)}}async function jI(n,e,t){const r=q(n);r.sharedClientState.updateQueryState(e,"rejected",t);const s=r.Au.get(e),i=s&&s.key;if(i){let a=new re(M.comparator);a=a.insert(i,Ae.newNoDocument(i,B.min()));const c=K().add(i),u=new Ii(B.min(),new Map,new re(G),a,c);await Xf(r,u),r.Ru=r.Ru.remove(i),r.Au.delete(e),nc(r)}else await Ko(r.localStore,e,!1).then((()=>Jo(r,e,t))).catch(Hn)}async function zI(n,e){const t=q(n),r=e.batch.batchId;try{const s=await Zv(t.localStore,e);ep(t,r,null),Zf(t,r),t.sharedClientState.updateMutationState(r,"acknowledged"),await zr(t,s)}catch(s){await Hn(s)}}async function HI(n,e,t){const r=q(n);try{const s=await(function(a,c){const u=q(a);return u.persistence.runTransaction("Reject batch","readwrite-primary",(h=>{let f;return u.mutationQueue.lookupMutationBatch(h,c).next((m=>(Y(m!==null,37113),f=m.keys(),u.mutationQueue.removeMutationBatch(h,m)))).next((()=>u.mutationQueue.performConsistencyCheck(h))).next((()=>u.documentOverlayCache.removeOverlaysForBatchId(h,f,c))).next((()=>u.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(h,f))).next((()=>u.localDocuments.getDocuments(h,f)))}))})(r.localStore,e);ep(r,e,t),Zf(r,e),r.sharedClientState.updateMutationState(e,"rejected",t),await zr(r,s)}catch(s){await Hn(s)}}function Zf(n,e){(n.mu.get(e)||[]).forEach((t=>{t.resolve()})),n.mu.delete(e)}function ep(n,e,t){const r=q(n);let s=r.du[r.currentUser.toKey()];if(s){const i=s.get(e);i&&(t?i.reject(t):i.resolve(),s=s.remove(e)),r.du[r.currentUser.toKey()]=s}}function Jo(n,e,t=null){n.sharedClientState.removeLocalQueryTarget(e);for(const r of n.Iu.get(e))n.Tu.delete(r),t&&n.Pu.yu(r,t);n.Iu.delete(e),n.isPrimaryClient&&n.Vu.Gr(e).forEach((r=>{n.Vu.containsKey(r)||tp(n,r)}))}function tp(n,e){n.Eu.delete(e.path.canonicalString());const t=n.Ru.get(e);t!==null&&(Ha(n.remoteStore,t),n.Ru=n.Ru.remove(e),n.Au.delete(t),nc(n))}function Hu(n,e,t){for(const r of t)r instanceof Qf?(n.Vu.addReference(r.key,e),GI(n,r)):r instanceof Jf?(L(tc,"Document no longer in limbo: "+r.key),n.Vu.removeReference(r.key,e),n.Vu.containsKey(r.key)||tp(n,r.key)):x(19791,{wu:r})}function GI(n,e){const t=e.key,r=t.path.canonicalString();n.Ru.get(t)||n.Eu.has(r)||(L(tc,"New document in limbo: "+t),n.Eu.add(r),nc(n))}function nc(n){for(;n.Eu.size>0&&n.Ru.size<n.maxConcurrentLimboResolutions;){const e=n.Eu.values().next().value;n.Eu.delete(e);const t=new M(Z.fromString(e)),r=n.fu.next();n.Au.set(r,new LI(t)),n.Ru=n.Ru.insert(t,r),jf(n.remoteStore,new Lt(st(yi(t.path)),r,"TargetPurposeLimboResolution",mi.ce))}}async function zr(n,e,t){const r=q(n),s=[],i=[],a=[];r.Tu.isEmpty()||(r.Tu.forEach(((c,u)=>{a.push(r.pu(u,e,t).then((h=>{if((h||t)&&r.isPrimaryClient){const f=h?!h.fromCache:t?.targetChanges.get(u.targetId)?.current;r.sharedClientState.updateQueryState(u.targetId,f?"current":"not-current")}if(h){s.push(h);const f=ja.Es(u.targetId,h);i.push(f)}})))})),await Promise.all(a),r.Pu.J_(s),await(async function(u,h){const f=q(u);try{await f.persistence.runTransaction("notifyLocalViewChanges","readwrite",(m=>C.forEach(h,(y=>C.forEach(y.Ts,(S=>f.persistence.referenceDelegate.addReference(m,y.targetId,S))).next((()=>C.forEach(y.Is,(S=>f.persistence.referenceDelegate.removeReference(m,y.targetId,S)))))))))}catch(m){if(!Gn(m))throw m;L(za,"Failed to update sequence numbers: "+m)}for(const m of h){const y=m.targetId;if(!m.fromCache){const S=f.vs.get(y),k=S.snapshotVersion,V=S.withLastLimboFreeSnapshotVersion(k);f.vs=f.vs.insert(y,V)}}})(r.localStore,i))}async function KI(n,e){const t=q(n);if(!t.currentUser.isEqual(e)){L(tc,"User change. New user:",e.toKey());const r=await Uf(t.localStore,e);t.currentUser=e,(function(i,a){i.mu.forEach((c=>{c.forEach((u=>{u.reject(new O(P.CANCELLED,a))}))})),i.mu.clear()})(t,"'waitForPendingWrites' promise is rejected due to a user change."),t.sharedClientState.handleUserChange(e,r.removedBatchIds,r.addedBatchIds),await zr(t,r.Ns)}}function WI(n,e){const t=q(n),r=t.Au.get(e);if(r&&r.hu)return K().add(r.key);{let s=K();const i=t.Iu.get(e);if(!i)return s;for(const a of i){const c=t.Tu.get(a);s=s.unionWith(c.view.nu)}return s}}function np(n){const e=q(n);return e.remoteStore.remoteSyncer.applyRemoteEvent=Xf.bind(null,e),e.remoteStore.remoteSyncer.getRemoteKeysForTarget=WI.bind(null,e),e.remoteStore.remoteSyncer.rejectListen=jI.bind(null,e),e.Pu.J_=NI.bind(null,e.eventManager),e.Pu.yu=DI.bind(null,e.eventManager),e}function QI(n){const e=q(n);return e.remoteStore.remoteSyncer.applySuccessfulWrite=zI.bind(null,e),e.remoteStore.remoteSyncer.rejectFailedWrite=HI.bind(null,e),e}class Gs{constructor(){this.kind="memory",this.synchronizeTabs=!1}async initialize(e){this.serializer=Ai(e.databaseInfo.databaseId),this.sharedClientState=this.Du(e),this.persistence=this.Cu(e),await this.persistence.start(),this.localStore=this.vu(e),this.gcScheduler=this.Fu(e,this.localStore),this.indexBackfillerScheduler=this.Mu(e,this.localStore)}Fu(e,t){return null}Mu(e,t){return null}vu(e){return Xv(this.persistence,new Qv,e.initialUser,this.serializer)}Cu(e){return new Ff($a.Vi,this.serializer)}Du(e){return new iI}async terminate(){this.gcScheduler?.stop(),this.indexBackfillerScheduler?.stop(),this.sharedClientState.shutdown(),await this.persistence.shutdown()}}Gs.provider={build:()=>new Gs};class JI extends Gs{constructor(e){super(),this.cacheSizeBytes=e}Fu(e,t){Y(this.persistence.referenceDelegate instanceof zs,46915);const r=this.persistence.referenceDelegate.garbageCollector;return new Ov(r,e.asyncQueue,t)}Cu(e){const t=this.cacheSizeBytes!==void 0?Ve.withCacheSize(this.cacheSizeBytes):Ve.DEFAULT;return new Ff((r=>zs.Vi(r,t)),this.serializer)}}class Yo{async initialize(e,t){this.localStore||(this.localStore=e.localStore,this.sharedClientState=e.sharedClientState,this.datastore=this.createDatastore(t),this.remoteStore=this.createRemoteStore(t),this.eventManager=this.createEventManager(t),this.syncEngine=this.createSyncEngine(t,!e.synchronizeTabs),this.sharedClientState.onlineStateHandler=r=>zu(this.syncEngine,r,1),this.remoteStore.remoteSyncer.handleCredentialChange=KI.bind(null,this.syncEngine),await PI(this.remoteStore,this.syncEngine.isPrimaryClient))}createEventManager(e){return(function(){return new kI})()}createDatastore(e){const t=Ai(e.databaseInfo.databaseId),r=uI(e.databaseInfo);return mI(e.authCredentials,e.appCheckCredentials,r,t)}createRemoteStore(e){return(function(r,s,i,a,c){return new _I(r,s,i,a,c)})(this.localStore,this.datastore,e.asyncQueue,(t=>zu(this.syncEngine,t,0)),(function(){return Fu.v()?new Fu:new oI})())}createSyncEngine(e,t){return(function(s,i,a,c,u,h,f){const m=new MI(s,i,a,c,u,h);return f&&(m.gu=!0),m})(this.localStore,this.remoteStore,this.eventManager,this.sharedClientState,e.initialUser,e.maxConcurrentLimboResolutions,t)}async terminate(){await(async function(t){const r=q(t);L(mn,"RemoteStore shutting down."),r.Ea.add(5),await jr(r),r.Aa.shutdown(),r.Va.set("Unknown")})(this.remoteStore),this.datastore?.terminate(),this.eventManager?.terminate()}}Yo.provider={build:()=>new Yo};class rc{constructor(e){this.observer=e,this.muted=!1}next(e){this.muted||this.observer.next&&this.Ou(this.observer.next,e)}error(e){this.muted||(this.observer.error?this.Ou(this.observer.error,e):wt("Uncaught Error in snapshot listener:",e.toString()))}Nu(){this.muted=!0}Ou(e,t){setTimeout((()=>{this.muted||e(t)}),0)}}const Ht="FirestoreClient";class YI{constructor(e,t,r,s,i){this.authCredentials=e,this.appCheckCredentials=t,this.asyncQueue=r,this._databaseInfo=s,this.user=Ie.UNAUTHENTICATED,this.clientId=ka.newId(),this.authCredentialListener=()=>Promise.resolve(),this.appCheckCredentialListener=()=>Promise.resolve(),this._uninitializedComponentsProvider=i,this.authCredentials.start(r,(async a=>{L(Ht,"Received user=",a.uid),await this.authCredentialListener(a),this.user=a})),this.appCheckCredentials.start(r,(a=>(L(Ht,"Received new app check token=",a),this.appCheckCredentialListener(a,this.user))))}get configuration(){return{asyncQueue:this.asyncQueue,databaseInfo:this._databaseInfo,clientId:this.clientId,authCredentials:this.authCredentials,appCheckCredentials:this.appCheckCredentials,initialUser:this.user,maxConcurrentLimboResolutions:100}}setCredentialChangeListener(e){this.authCredentialListener=e}setAppCheckTokenChangeListener(e){this.appCheckCredentialListener=e}terminate(){this.asyncQueue.enterRestrictedMode();const e=new _t;return this.asyncQueue.enqueueAndForgetEvenWhileRestricted((async()=>{try{this._onlineComponents&&await this._onlineComponents.terminate(),this._offlineComponents&&await this._offlineComponents.terminate(),this.authCredentials.shutdown(),this.appCheckCredentials.shutdown(),e.resolve()}catch(t){const r=Ja(t,"Failed to shutdown persistence");e.reject(r)}})),e.promise}}async function yo(n,e){n.asyncQueue.verifyOperationInProgress(),L(Ht,"Initializing OfflineComponentProvider");const t=n.configuration;await e.initialize(t);let r=t.initialUser;n.setCredentialChangeListener((async s=>{r.isEqual(s)||(await Uf(e.localStore,s),r=s)})),e.persistence.setDatabaseDeletedListener((()=>n.terminate())),n._offlineComponents=e}async function Gu(n,e){n.asyncQueue.verifyOperationInProgress();const t=await XI(n);L(Ht,"Initializing OnlineComponentProvider"),await e.initialize(t,n.configuration),n.setCredentialChangeListener((r=>Bu(e.remoteStore,r))),n.setAppCheckTokenChangeListener(((r,s)=>Bu(e.remoteStore,s))),n._onlineComponents=e}async function XI(n){if(!n._offlineComponents)if(n._uninitializedComponentsProvider){L(Ht,"Using user provided OfflineComponentProvider");try{await yo(n,n._uninitializedComponentsProvider._offline)}catch(e){const t=e;if(!(function(s){return s.name==="FirebaseError"?s.code===P.FAILED_PRECONDITION||s.code===P.UNIMPLEMENTED:!(typeof DOMException<"u"&&s instanceof DOMException)||s.code===22||s.code===20||s.code===11})(t))throw t;Ln("Error using user provided cache. Falling back to memory cache: "+t),await yo(n,new Gs)}}else L(Ht,"Using default OfflineComponentProvider"),await yo(n,new JI(void 0));return n._offlineComponents}async function rp(n){return n._onlineComponents||(n._uninitializedComponentsProvider?(L(Ht,"Using user provided OnlineComponentProvider"),await Gu(n,n._uninitializedComponentsProvider._online)):(L(Ht,"Using default OnlineComponentProvider"),await Gu(n,new Yo))),n._onlineComponents}function ZI(n){return rp(n).then((e=>e.syncEngine))}async function Ks(n){const e=await rp(n),t=e.eventManager;return t.onListen=xI.bind(null,e.syncEngine),t.onUnlisten=BI.bind(null,e.syncEngine),t.onFirstRemoteStoreListen=FI.bind(null,e.syncEngine),t.onLastRemoteStoreUnlisten=qI.bind(null,e.syncEngine),t}function eA(n,e,t,r){const s=new rc(r),i=new ec(e,s,t);return n.asyncQueue.enqueueAndForget((async()=>Ya(await Ks(n),i))),()=>{s.Nu(),n.asyncQueue.enqueueAndForget((async()=>Xa(await Ks(n),i)))}}function tA(n,e,t={}){const r=new _t;return n.asyncQueue.enqueueAndForget((async()=>(function(i,a,c,u,h){const f=new rc({next:y=>{f.Nu(),a.enqueueAndForget((()=>Xa(i,m)));const S=y.docs.has(c);!S&&y.fromCache?h.reject(new O(P.UNAVAILABLE,"Failed to get document because the client is offline.")):S&&y.fromCache&&u&&u.source==="server"?h.reject(new O(P.UNAVAILABLE,'Failed to get document from server. (However, this document does exist in the local cache. Run again without setting source to "server" to retrieve the cached document.)')):h.resolve(y)},error:y=>h.reject(y)}),m=new ec(yi(c.path),f,{includeMetadataChanges:!0,Ka:!0});return Ya(i,m)})(await Ks(n),n.asyncQueue,e,t,r))),r.promise}function nA(n,e,t={}){const r=new _t;return n.asyncQueue.enqueueAndForget((async()=>(function(i,a,c,u,h){const f=new rc({next:y=>{f.Nu(),a.enqueueAndForget((()=>Xa(i,m))),y.fromCache&&u.source==="server"?h.reject(new O(P.UNAVAILABLE,'Failed to get documents from server. (However, these documents may exist in the local cache. Run again without setting source to "server" to retrieve the cached documents.)')):h.resolve(y)},error:y=>h.reject(y)}),m=new ec(c,f,{includeMetadataChanges:!0,Ka:!0});return Ya(i,m)})(await Ks(n),n.asyncQueue,e,t,r))),r.promise}function rA(n,e){const t=new _t;return n.asyncQueue.enqueueAndForget((async()=>$I(await ZI(n),e,t))),t.promise}function sp(n){const e={};return n.timeoutSeconds!==void 0&&(e.timeoutSeconds=n.timeoutSeconds),e}const sA="ComponentProvider",Ku=new Map;function iA(n,e,t,r,s){return new AE(n,e,t,s.host,s.ssl,s.experimentalForceLongPolling,s.experimentalAutoDetectLongPolling,sp(s.experimentalLongPollingOptions),s.useFetchStreams,s.isUsingEmulator,r)}const ip="firestore.googleapis.com",Wu=!0;class Qu{constructor(e){if(e.host===void 0){if(e.ssl!==void 0)throw new O(P.INVALID_ARGUMENT,"Can't provide ssl option if host option is not set");this.host=ip,this.ssl=Wu}else this.host=e.host,this.ssl=e.ssl??Wu;if(this.isUsingEmulator=e.emulatorOptions!==void 0,this.credentials=e.credentials,this.ignoreUndefinedProperties=!!e.ignoreUndefinedProperties,this.localCache=e.localCache,e.cacheSizeBytes===void 0)this.cacheSizeBytes=xf;else{if(e.cacheSizeBytes!==-1&&e.cacheSizeBytes<Dv)throw new O(P.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");this.cacheSizeBytes=e.cacheSizeBytes}dE("experimentalForceLongPolling",e.experimentalForceLongPolling,"experimentalAutoDetectLongPolling",e.experimentalAutoDetectLongPolling),this.experimentalForceLongPolling=!!e.experimentalForceLongPolling,this.experimentalForceLongPolling?this.experimentalAutoDetectLongPolling=!1:e.experimentalAutoDetectLongPolling===void 0?this.experimentalAutoDetectLongPolling=!0:this.experimentalAutoDetectLongPolling=!!e.experimentalAutoDetectLongPolling,this.experimentalLongPollingOptions=sp(e.experimentalLongPollingOptions??{}),(function(r){if(r.timeoutSeconds!==void 0){if(isNaN(r.timeoutSeconds))throw new O(P.INVALID_ARGUMENT,`invalid long polling timeout: ${r.timeoutSeconds} (must not be NaN)`);if(r.timeoutSeconds<5)throw new O(P.INVALID_ARGUMENT,`invalid long polling timeout: ${r.timeoutSeconds} (minimum allowed value is 5)`);if(r.timeoutSeconds>30)throw new O(P.INVALID_ARGUMENT,`invalid long polling timeout: ${r.timeoutSeconds} (maximum allowed value is 30)`)}})(this.experimentalLongPollingOptions),this.useFetchStreams=!!e.useFetchStreams}isEqual(e){return this.host===e.host&&this.ssl===e.ssl&&this.credentials===e.credentials&&this.cacheSizeBytes===e.cacheSizeBytes&&this.experimentalForceLongPolling===e.experimentalForceLongPolling&&this.experimentalAutoDetectLongPolling===e.experimentalAutoDetectLongPolling&&(function(r,s){return r.timeoutSeconds===s.timeoutSeconds})(this.experimentalLongPollingOptions,e.experimentalLongPollingOptions)&&this.ignoreUndefinedProperties===e.ignoreUndefinedProperties&&this.useFetchStreams===e.useFetchStreams}}class Ri{constructor(e,t,r,s){this._authCredentials=e,this._appCheckCredentials=t,this._databaseId=r,this._app=s,this.type="firestore-lite",this._persistenceKey="(lite)",this._settings=new Qu({}),this._settingsFrozen=!1,this._emulatorOptions={},this._terminateTask="notTerminated"}get app(){if(!this._app)throw new O(P.FAILED_PRECONDITION,"Firestore was not initialized using the Firebase SDK. 'app' is not available");return this._app}get _initialized(){return this._settingsFrozen}get _terminated(){return this._terminateTask!=="notTerminated"}_setSettings(e){if(this._settingsFrozen)throw new O(P.FAILED_PRECONDITION,"Firestore has already been started and its settings can no longer be changed. You can only modify settings before calling any other methods on a Firestore object.");this._settings=new Qu(e),this._emulatorOptions=e.emulatorOptions||{},e.credentials!==void 0&&(this._authCredentials=(function(r){if(!r)return new nE;switch(r.type){case"firstParty":return new oE(r.sessionIndex||"0",r.iamToken||null,r.authTokenFactory||null);case"provider":return r.client;default:throw new O(P.INVALID_ARGUMENT,"makeAuthCredentialsProvider failed due to invalid credential type")}})(e.credentials))}_getSettings(){return this._settings}_getEmulatorOptions(){return this._emulatorOptions}_freezeSettings(){return this._settingsFrozen=!0,this._settings}_delete(){return this._terminateTask==="notTerminated"&&(this._terminateTask=this._terminate()),this._terminateTask}async _restart(){this._terminateTask==="notTerminated"?await this._terminate():this._terminateTask="notTerminated"}toJSON(){return{app:this._app,databaseId:this._databaseId,settings:this._settings}}_terminate(){return(function(t){const r=Ku.get(t);r&&(L(sA,"Removing Datastore"),Ku.delete(t),r.terminate())})(this),Promise.resolve()}}function op(n,e,t,r={}){n=qe(n,Ri);const s=vt(e),i=n._getSettings(),a={...i,emulatorOptions:n._getEmulatorOptions()},c=`${e}:${t}`;s&&(ii(`https://${c}`),oi("Firestore",!0)),i.host!==ip&&i.host!==c&&Ln("Host has been set in both settings() and connectFirestoreEmulator(), emulator host will be used.");const u={...i,host:c,ssl:s,emulatorOptions:r};if(!Ut(u,a)&&(n._setSettings(u),r.mockUserToken)){let h,f;if(typeof r.mockUserToken=="string")h=r.mockUserToken,f=Ie.MOCK_USER;else{h=Oh(r.mockUserToken,n._app?.options.projectId);const m=r.mockUserToken.sub||r.mockUserToken.user_id;if(!m)throw new O(P.INVALID_ARGUMENT,"mockUserToken must contain 'sub' or 'user_id' field!");f=new Ie(m)}n._authCredentials=new rE(new Kd(h,f))}}class It{constructor(e,t,r){this.converter=t,this._query=r,this.type="query",this.firestore=e}withConverter(e){return new It(this.firestore,e,this._query)}}class ie{constructor(e,t,r){this.converter=t,this._key=r,this.type="document",this.firestore=e}get _path(){return this._key.path}get id(){return this._key.path.lastSegment()}get path(){return this._key.path.canonicalString()}get parent(){return new Ft(this.firestore,this.converter,this._key.path.popLast())}withConverter(e){return new ie(this.firestore,e,this._key)}toJSON(){return{type:ie._jsonSchemaVersion,referencePath:this._key.toString()}}static fromJSON(e,t,r){if(Br(t,ie._jsonSchema))return new ie(e,r||null,new M(Z.fromString(t.referencePath)))}}ie._jsonSchemaVersion="firestore/documentReference/1.0",ie._jsonSchema={type:ue("string",ie._jsonSchemaVersion),referencePath:ue("string")};class Ft extends It{constructor(e,t,r){super(e,t,yi(r)),this._path=r,this.type="collection"}get id(){return this._query.path.lastSegment()}get path(){return this._query.path.canonicalString()}get parent(){const e=this._path.popLast();return e.isEmpty()?null:new ie(this.firestore,null,new M(e))}withConverter(e){return new Ft(this.firestore,e,this._path)}}function oA(n,e,...t){if(n=ee(n),Wd("collection","path",e),n instanceof Ri){const r=Z.fromString(e,...t);return cu(r),new Ft(n,null,r)}{if(!(n instanceof ie||n instanceof Ft))throw new O(P.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const r=n._path.child(Z.fromString(e,...t));return cu(r),new Ft(n.firestore,null,r)}}function Ir(n,e,...t){if(n=ee(n),arguments.length===1&&(e=ka.newId()),Wd("doc","path",e),n instanceof Ri){const r=Z.fromString(e,...t);return au(r),new ie(n,null,new M(r))}{if(!(n instanceof ie||n instanceof Ft))throw new O(P.INVALID_ARGUMENT,"Expected first argument to doc() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const r=n._path.child(Z.fromString(e,...t));return au(r),new ie(n.firestore,n instanceof Ft?n.converter:null,new M(r))}}const Ju="AsyncQueue";class Yu{constructor(e=Promise.resolve()){this.Yu=[],this.ec=!1,this.tc=[],this.nc=null,this.rc=!1,this.sc=!1,this.oc=[],this.M_=new qf(this,"async_queue_retry"),this._c=()=>{const r=_o();r&&L(Ju,"Visibility state changed to "+r.visibilityState),this.M_.w_()},this.ac=e;const t=_o();t&&typeof t.addEventListener=="function"&&t.addEventListener("visibilitychange",this._c)}get isShuttingDown(){return this.ec}enqueueAndForget(e){this.enqueue(e)}enqueueAndForgetEvenWhileRestricted(e){this.uc(),this.cc(e)}enterRestrictedMode(e){if(!this.ec){this.ec=!0,this.sc=e||!1;const t=_o();t&&typeof t.removeEventListener=="function"&&t.removeEventListener("visibilitychange",this._c)}}enqueue(e){if(this.uc(),this.ec)return new Promise((()=>{}));const t=new _t;return this.cc((()=>this.ec&&this.sc?Promise.resolve():(e().then(t.resolve,t.reject),t.promise))).then((()=>t.promise))}enqueueRetryable(e){this.enqueueAndForget((()=>(this.Yu.push(e),this.lc())))}async lc(){if(this.Yu.length!==0){try{await this.Yu[0](),this.Yu.shift(),this.M_.reset()}catch(e){if(!Gn(e))throw e;L(Ju,"Operation failed with retryable error: "+e)}this.Yu.length>0&&this.M_.p_((()=>this.lc()))}}cc(e){const t=this.ac.then((()=>(this.rc=!0,e().catch((r=>{throw this.nc=r,this.rc=!1,wt("INTERNAL UNHANDLED ERROR: ",Xu(r)),r})).then((r=>(this.rc=!1,r))))));return this.ac=t,t}enqueueAfterDelay(e,t,r){this.uc(),this.oc.indexOf(e)>-1&&(t=0);const s=Qa.createAndSchedule(this,e,t,r,(i=>this.hc(i)));return this.tc.push(s),s}uc(){this.nc&&x(47125,{Pc:Xu(this.nc)})}verifyOperationInProgress(){}async Tc(){let e;do e=this.ac,await e;while(e!==this.ac)}Ic(e){for(const t of this.tc)if(t.timerId===e)return!0;return!1}Ec(e){return this.Tc().then((()=>{this.tc.sort(((t,r)=>t.targetTimeMs-r.targetTimeMs));for(const t of this.tc)if(t.skipDelay(),e!=="all"&&t.timerId===e)break;return this.Tc()}))}Rc(e){this.oc.push(e)}hc(e){const t=this.tc.indexOf(e);this.tc.splice(t,1)}}function Xu(n){let e=n.message||"";return n.stack&&(e=n.stack.includes(n.message)?n.stack:n.message+`
|
|
36
36
|
`+n.stack),e}class Gt extends Ri{constructor(e,t,r,s){super(e,t,r,s),this.type="firestore",this._queue=new Yu,this._persistenceKey=s?.name||"[DEFAULT]"}async _terminate(){if(this._firestoreClient){const e=this._firestoreClient.terminate();this._queue=new Yu(e),this._firestoreClient=void 0,await e}}}function aA(n,e){const t=typeof n=="object"?n:$n(),r=typeof n=="string"?n:xs,s=ut(t,"firestore").getImmediate({identifier:r});if(!s._initialized){const i=la("firestore");i&&op(s,...i)}return s}function Pi(n){if(n._terminated)throw new O(P.FAILED_PRECONDITION,"The client has already been terminated.");return n._firestoreClient||cA(n),n._firestoreClient}function cA(n){const e=n._freezeSettings(),t=iA(n._databaseId,n._app?.options.appId||"",n._persistenceKey,n._app?.options.apiKey,e);n._componentsProvider||e.localCache?._offlineComponentProvider&&e.localCache?._onlineComponentProvider&&(n._componentsProvider={_offline:e.localCache._offlineComponentProvider,_online:e.localCache._onlineComponentProvider}),n._firestoreClient=new YI(n._authCredentials,n._appCheckCredentials,n._queue,t,n._componentsProvider&&(function(s){const i=s?._online.build();return{_offline:s?._offline.build(i),_online:i}})(n._componentsProvider))}class ze{constructor(e){this._byteString=e}static fromBase64String(e){try{return new ze(Te.fromBase64String(e))}catch(t){throw new O(P.INVALID_ARGUMENT,"Failed to construct data from Base64 string: "+t)}}static fromUint8Array(e){return new ze(Te.fromUint8Array(e))}toBase64(){return this._byteString.toBase64()}toUint8Array(){return this._byteString.toUint8Array()}toString(){return"Bytes(base64: "+this.toBase64()+")"}isEqual(e){return this._byteString.isEqual(e._byteString)}toJSON(){return{type:ze._jsonSchemaVersion,bytes:this.toBase64()}}static fromJSON(e){if(Br(e,ze._jsonSchema))return ze.fromBase64String(e.bytes)}}ze._jsonSchemaVersion="firestore/bytes/1.0",ze._jsonSchema={type:ue("string",ze._jsonSchemaVersion),bytes:ue("string")};class Ci{constructor(...e){for(let t=0;t<e.length;++t)if(e[t].length===0)throw new O(P.INVALID_ARGUMENT,"Invalid field name at argument $(i + 1). Field names must not be empty.");this._internalPath=new ye(e)}isEqual(e){return this._internalPath.isEqual(e._internalPath)}}function Xo(){return new Ci(xo)}class Or{constructor(e){this._methodName=e}}class ot{constructor(e,t){if(!isFinite(e)||e<-90||e>90)throw new O(P.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+e);if(!isFinite(t)||t<-180||t>180)throw new O(P.INVALID_ARGUMENT,"Longitude must be a number between -180 and 180, but was: "+t);this._lat=e,this._long=t}get latitude(){return this._lat}get longitude(){return this._long}isEqual(e){return this._lat===e._lat&&this._long===e._long}_compareTo(e){return G(this._lat,e._lat)||G(this._long,e._long)}toJSON(){return{latitude:this._lat,longitude:this._long,type:ot._jsonSchemaVersion}}static fromJSON(e){if(Br(e,ot._jsonSchema))return new ot(e.latitude,e.longitude)}}ot._jsonSchemaVersion="firestore/geoPoint/1.0",ot._jsonSchema={type:ue("string",ot._jsonSchemaVersion),latitude:ue("number"),longitude:ue("number")};class Ye{constructor(e){this._values=(e||[]).map((t=>t))}toArray(){return this._values.map((e=>e))}isEqual(e){return(function(r,s){if(r.length!==s.length)return!1;for(let i=0;i<r.length;++i)if(r[i]!==s[i])return!1;return!0})(this._values,e._values)}toJSON(){return{type:Ye._jsonSchemaVersion,vectorValues:this._values}}static fromJSON(e){if(Br(e,Ye._jsonSchema)){if(Array.isArray(e.vectorValues)&&e.vectorValues.every((t=>typeof t=="number")))return new Ye(e.vectorValues);throw new O(P.INVALID_ARGUMENT,"Expected 'vectorValues' field to be a number array")}}}Ye._jsonSchemaVersion="firestore/vectorValue/1.0",Ye._jsonSchema={type:ue("string",Ye._jsonSchemaVersion),vectorValues:ue("object")};const lA=/^__.*__$/;class uA{constructor(e,t,r){this.data=e,this.fieldMask=t,this.fieldTransforms=r}toMutation(e,t){return this.fieldMask!==null?new Qt(e,this.data,this.fieldMask,t,this.fieldTransforms):new qr(e,this.data,t,this.fieldTransforms)}}class ap{constructor(e,t,r){this.data=e,this.fieldMask=t,this.fieldTransforms=r}toMutation(e,t){return new Qt(e,this.data,this.fieldMask,t,this.fieldTransforms)}}function cp(n){switch(n){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw x(40011,{dataSource:n})}}class sc{constructor(e,t,r,s,i,a){this.settings=e,this.databaseId=t,this.serializer=r,this.ignoreUndefinedProperties=s,i===void 0&&this.validatePath(),this.fieldTransforms=i||[],this.fieldMask=a||[]}get path(){return this.settings.path}get dataSource(){return this.settings.dataSource}contextWith(e){return new sc({...this.settings,...e},this.databaseId,this.serializer,this.ignoreUndefinedProperties,this.fieldTransforms,this.fieldMask)}childContextForField(e){const t=this.path?.child(e),r=this.contextWith({path:t,arrayElement:!1});return r.validatePathSegment(e),r}childContextForFieldPath(e){const t=this.path?.child(e),r=this.contextWith({path:t,arrayElement:!1});return r.validatePath(),r}childContextForArray(e){return this.contextWith({path:void 0,arrayElement:!0})}createError(e){return Ws(e,this.settings.methodName,this.settings.hasConverter||!1,this.path,this.settings.targetDoc)}contains(e){return this.fieldMask.find((t=>e.isPrefixOf(t)))!==void 0||this.fieldTransforms.find((t=>e.isPrefixOf(t.field)))!==void 0}validatePath(){if(this.path)for(let e=0;e<this.path.length;e++)this.validatePathSegment(this.path.get(e))}validatePathSegment(e){if(e.length===0)throw this.createError("Document fields must not be empty");if(cp(this.dataSource)&&lA.test(e))throw this.createError('Document fields cannot begin and end with "__"')}}class hA{constructor(e,t,r){this.databaseId=e,this.ignoreUndefinedProperties=t,this.serializer=r||Ai(e)}createContext(e,t,r,s=!1){return new sc({dataSource:e,methodName:t,targetDoc:r,path:ye.emptyPath(),arrayElement:!1,hasConverter:s},this.databaseId,this.serializer,this.ignoreUndefinedProperties)}}function ic(n){const e=n._freezeSettings(),t=Ai(n._databaseId);return new hA(n._databaseId,!!e.ignoreUndefinedProperties,t)}function dA(n,e,t,r,s,i={}){const a=n.createContext(i.merge||i.mergeFields?2:0,e,t,s);oc("Data must be an object, but it was:",a,r);const c=lp(r,a);let u,h;if(i.merge)u=new Ue(a.fieldMask),h=a.fieldTransforms;else if(i.mergeFields){const f=[];for(const m of i.mergeFields){const y=gn(e,m,t);if(!a.contains(y))throw new O(P.INVALID_ARGUMENT,`Field '${y}' is specified in your field mask but missing from your input data.`);dp(f,y)||f.push(y)}u=new Ue(f),h=a.fieldTransforms.filter((m=>u.covers(m.field)))}else u=null,h=a.fieldTransforms;return new uA(new Oe(c),u,h)}class Hr extends Or{_toFieldTransform(e){if(e.dataSource!==2)throw e.dataSource===1?e.createError(`${this._methodName}() can only appear at the top level of your update data`):e.createError(`${this._methodName}() cannot be used with set() unless you pass {merge:true}`);return e.fieldMask.push(e.path),null}isEqual(e){return e instanceof Hr}}function fA(n,e,t,r){const s=n.createContext(1,e,t);oc("Data must be an object, but it was:",s,r);const i=[],a=Oe.empty();Wt(r,((u,h)=>{const f=hp(e,u,t);h=ee(h);const m=s.childContextForFieldPath(f);if(h instanceof Hr)i.push(f);else{const y=Gr(h,m);y!=null&&(i.push(f),a.set(f,y))}}));const c=new Ue(i);return new ap(a,c,s.fieldTransforms)}function pA(n,e,t,r,s,i){const a=n.createContext(1,e,t),c=[gn(e,r,t)],u=[s];if(i.length%2!=0)throw new O(P.INVALID_ARGUMENT,`Function ${e}() needs to be called with an even number of arguments that alternate between field names and values.`);for(let y=0;y<i.length;y+=2)c.push(gn(e,i[y])),u.push(i[y+1]);const h=[],f=Oe.empty();for(let y=c.length-1;y>=0;--y)if(!dp(h,c[y])){const S=c[y];let k=u[y];k=ee(k);const V=a.childContextForFieldPath(S);if(k instanceof Hr)h.push(S);else{const N=Gr(k,V);N!=null&&(h.push(S),f.set(S,N))}}const m=new Ue(h);return new ap(f,m,a.fieldTransforms)}function mA(n,e,t,r=!1){return Gr(t,n.createContext(r?4:3,e))}function Gr(n,e){if(up(n=ee(n)))return oc("Unsupported field value:",e,n),lp(n,e);if(n instanceof Or)return(function(r,s){if(!cp(s.dataSource))throw s.createError(`${r._methodName}() can only be used with update() and set()`);if(!s.path)throw s.createError(`${r._methodName}() is not currently supported inside arrays`);const i=r._toFieldTransform(s);i&&s.fieldTransforms.push(i)})(n,e),null;if(n===void 0&&e.ignoreUndefinedProperties)return null;if(e.path&&e.fieldMask.push(e.path),n instanceof Array){if(e.settings.arrayElement&&e.dataSource!==4)throw e.createError("Nested arrays are not supported");return(function(r,s){const i=[];let a=0;for(const c of r){let u=Gr(c,s.childContextForArray(a));u==null&&(u={nullValue:"NULL_VALUE"}),i.push(u),a++}return{arrayValue:{values:i}}})(n,e)}return(function(r,s){if((r=ee(r))===null)return{nullValue:"NULL_VALUE"};if(typeof r=="number")return JE(s.serializer,r);if(typeof r=="boolean")return{booleanValue:r};if(typeof r=="string")return{stringValue:r};if(r instanceof Date){const i=z.fromDate(r);return{timestampValue:js(s.serializer,i)}}if(r instanceof z){const i=new z(r.seconds,1e3*Math.floor(r.nanoseconds/1e3));return{timestampValue:js(s.serializer,i)}}if(r instanceof ot)return{geoPointValue:{latitude:r.latitude,longitude:r.longitude}};if(r instanceof ze)return{bytesValue:Cf(s.serializer,r._byteString)};if(r instanceof ie){const i=s.databaseId,a=r.firestore._databaseId;if(!a.isEqual(i))throw s.createError(`Document reference is for database ${a.projectId}/${a.database} but should be for database ${i.projectId}/${i.database}`);return{referenceValue:Ba(r.firestore._databaseId||s.databaseId,r._key.path)}}if(r instanceof Ye)return(function(a,c){const u=a instanceof Ye?a.toArray():a;return{mapValue:{fields:{[rf]:{stringValue:sf},[Fs]:{arrayValue:{values:u.map((f=>{if(typeof f!="number")throw c.createError("VectorValues must only contain numeric values.");return Ma(c.serializer,f)}))}}}}}})(r,s);if(Mf(r))return r._toProto(s.serializer);throw s.createError(`Unsupported field value: ${pi(r)}`)})(n,e)}function lp(n,e){const t={};return Yd(n)?e.path&&e.path.length>0&&e.fieldMask.push(e.path):Wt(n,((r,s)=>{const i=Gr(s,e.childContextForField(r));i!=null&&(t[r]=i)})),{mapValue:{fields:t}}}function up(n){return!(typeof n!="object"||n===null||n instanceof Array||n instanceof Date||n instanceof z||n instanceof ot||n instanceof ze||n instanceof ie||n instanceof Or||n instanceof Ye||Mf(n))}function oc(n,e,t){if(!up(t)||!Qd(t)){const r=pi(t);throw r==="an object"?e.createError(n+" a custom object"):e.createError(n+" "+r)}}function gn(n,e,t){if((e=ee(e))instanceof Ci)return e._internalPath;if(typeof e=="string")return hp(n,e);throw Ws("Field path arguments must be of type string or ",n,!1,void 0,t)}const gA=new RegExp("[~\\*/\\[\\]]");function hp(n,e,t){if(e.search(gA)>=0)throw Ws(`Invalid field path (${e}). Paths must not contain '~', '*', '/', '[', or ']'`,n,!1,void 0,t);try{return new Ci(...e.split("."))._internalPath}catch{throw Ws(`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`,n,!1,void 0,t)}}function Ws(n,e,t,r,s){const i=r&&!r.isEmpty(),a=s!==void 0;let c=`Function ${e}() called with invalid data`;t&&(c+=" (via `toFirestore()`)"),c+=". ";let u="";return(i||a)&&(u+=" (found",i&&(u+=` in field ${r}`),a&&(u+=` in document ${s}`),u+=")"),new O(P.INVALID_ARGUMENT,c+n+u)}function dp(n,e){return n.some((t=>t.isEqual(e)))}class _A{convertValue(e,t="none"){switch(jt(e)){case 0:return null;case 1:return e.booleanValue;case 2:return ae(e.integerValue||e.doubleValue);case 3:return this.convertTimestamp(e.timestampValue);case 4:return this.convertServerTimestamp(e,t);case 5:return e.stringValue;case 6:return this.convertBytes($t(e.bytesValue));case 7:return this.convertReference(e.referenceValue);case 8:return this.convertGeoPoint(e.geoPointValue);case 9:return this.convertArray(e.arrayValue,t);case 11:return this.convertObject(e.mapValue,t);case 10:return this.convertVectorValue(e.mapValue);default:throw x(62114,{value:e})}}convertObject(e,t){return this.convertObjectMap(e.fields,t)}convertObjectMap(e,t="none"){const r={};return Wt(e,((s,i)=>{r[s]=this.convertValue(i,t)})),r}convertVectorValue(e){const t=e.fields?.[Fs].arrayValue?.values?.map((r=>ae(r.doubleValue)));return new Ye(t)}convertGeoPoint(e){return new ot(ae(e.latitude),ae(e.longitude))}convertArray(e,t){return(e.values||[]).map((r=>this.convertValue(r,t)))}convertServerTimestamp(e,t){switch(t){case"previous":const r=_i(e);return r==null?null:this.convertValue(r,t);case"estimate":return this.convertTimestamp(Pr(e));default:return null}}convertTimestamp(e){const t=qt(e);return new z(t.seconds,t.nanos)}convertDocumentKey(e,t){const r=Z.fromString(e);Y(Lf(r),9688,{name:e});const s=new Cr(r.get(1),r.get(3)),i=new M(r.popFirst(5));return s.isEqual(t)||wt(`Document ${i} contains a document reference within a different database (${s.projectId}/${s.database}) which is not supported. It will be treated as a reference in the current database (${t.projectId}/${t.database}) instead.`),i}}class ac extends _A{constructor(e){super(),this.firestore=e}convertBytes(e){return new ze(e)}convertReference(e){const t=this.convertDocumentKey(e,this.firestore._databaseId);return new ie(this.firestore,null,t)}}function Zo(){return new Hr("deleteField")}const Zu="@firebase/firestore",eh="4.10.0";function th(n){return(function(t,r){if(typeof t!="object"||t===null)return!1;const s=t;for(const i of r)if(i in s&&typeof s[i]=="function")return!0;return!1})(n,["next","error","complete"])}class fp{constructor(e,t,r,s,i){this._firestore=e,this._userDataWriter=t,this._key=r,this._document=s,this._converter=i}get id(){return this._key.path.lastSegment()}get ref(){return new ie(this._firestore,this._converter,this._key)}exists(){return this._document!==null}data(){if(this._document){if(this._converter){const e=new yA(this._firestore,this._userDataWriter,this._key,this._document,null);return this._converter.fromFirestore(e)}return this._userDataWriter.convertValue(this._document.data.value)}}_fieldsProto(){return this._document?.data.clone().value.mapValue.fields??void 0}get(e){if(this._document){const t=this._document.data.field(gn("DocumentSnapshot.get",e));if(t!==null)return this._userDataWriter.convertValue(t)}}}class yA extends fp{data(){return super.data()}}function pp(n){if(n.limitType==="L"&&n.explicitOrderBy.length===0)throw new O(P.UNIMPLEMENTED,"limitToLast() queries require specifying at least one orderBy() clause")}class cc{}class lc extends cc{}function nh(n,e,...t){let r=[];e instanceof cc&&r.push(e),r=r.concat(t),(function(i){const a=i.filter((u=>u instanceof uc)).length,c=i.filter((u=>u instanceof ki)).length;if(a>1||a>0&&c>0)throw new O(P.INVALID_ARGUMENT,"InvalidQuery. When using composite filters, you cannot use more than one filter at the top level. Consider nesting the multiple filters within an `and(...)` statement. For example: change `query(query, where(...), or(...))` to `query(query, and(where(...), or(...)))`.")})(r);for(const s of r)n=s._apply(n);return n}class ki extends lc{constructor(e,t,r){super(),this._field=e,this._op=t,this._value=r,this.type="where"}static _create(e,t,r){return new ki(e,t,r)}_apply(e){const t=this._parse(e);return mp(e._query,t),new It(e.firestore,e.converter,$o(e._query,t))}_parse(e){const t=ic(e.firestore);return(function(i,a,c,u,h,f,m){let y;if(h.isKeyField()){if(f==="array-contains"||f==="array-contains-any")throw new O(P.INVALID_ARGUMENT,`Invalid Query. You can't perform '${f}' queries on documentId().`);if(f==="in"||f==="not-in"){sh(m,f);const k=[];for(const V of m)k.push(rh(u,i,V));y={arrayValue:{values:k}}}else y=rh(u,i,m)}else f!=="in"&&f!=="not-in"&&f!=="array-contains-any"||sh(m,f),y=mA(c,a,m,f==="in"||f==="not-in");return le.create(h,f,y)})(e._query,"where",t,e.firestore._databaseId,this._field,this._op,this._value)}}function ea(n,e,t){const r=e,s=gn("where",n);return ki._create(s,r,t)}class uc extends cc{constructor(e,t){super(),this.type=e,this._queryConstraints=t}static _create(e,t){return new uc(e,t)}_parse(e){const t=this._queryConstraints.map((r=>r._parse(e))).filter((r=>r.getFilters().length>0));return t.length===1?t[0]:Xe.create(t,this._getOperator())}_apply(e){const t=this._parse(e);return t.getFilters().length===0?e:((function(s,i){let a=s;const c=i.getFlattenedFilters();for(const u of c)mp(a,u),a=$o(a,u)})(e._query,t),new It(e.firestore,e.converter,$o(e._query,t)))}_getQueryConstraints(){return this._queryConstraints}_getOperator(){return this.type==="and"?"and":"or"}}class hc extends lc{constructor(e,t){super(),this._field=e,this._direction=t,this.type="orderBy"}static _create(e,t){return new hc(e,t)}_apply(e){const t=(function(s,i,a){if(s.startAt!==null)throw new O(P.INVALID_ARGUMENT,"Invalid query. You must not call startAt() or startAfter() before calling orderBy().");if(s.endAt!==null)throw new O(P.INVALID_ARGUMENT,"Invalid query. You must not call endAt() or endBefore() before calling orderBy().");return new Nr(i,a)})(e._query,this._field,this._direction);return new It(e.firestore,e.converter,$E(e._query,t))}}function To(n,e="asc"){const t=e,r=gn("orderBy",n);return hc._create(r,t)}class dc extends lc{constructor(e,t,r){super(),this.type=e,this._limit=t,this._limitType=r}static _create(e,t,r){return new dc(e,t,r)}_apply(e){return new It(e.firestore,e.converter,Bs(e._query,this._limit,this._limitType))}}function wo(n){return fE("limit",n),dc._create("limit",n,"F")}function rh(n,e,t){if(typeof(t=ee(t))=="string"){if(t==="")throw new O(P.INVALID_ARGUMENT,"Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");if(!ff(e)&&t.indexOf("/")!==-1)throw new O(P.INVALID_ARGUMENT,`Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${t}' contains a '/' character.`);const r=e.path.child(Z.fromString(t));if(!M.isDocumentKey(r))throw new O(P.INVALID_ARGUMENT,`Invalid query. When querying a collection group by documentId(), the value provided must result in a valid document path, but '${r}' is not because it has an odd number of segments (${r.length}).`);return gu(n,new M(r))}if(t instanceof ie)return gu(n,t._key);throw new O(P.INVALID_ARGUMENT,`Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${pi(t)}.`)}function sh(n,e){if(!Array.isArray(n)||n.length===0)throw new O(P.INVALID_ARGUMENT,`Invalid Query. A non-empty array is required for '${e.toString()}' filters.`)}function mp(n,e){const t=(function(s,i){for(const a of s)for(const c of a.getFlattenedFilters())if(i.indexOf(c.op)>=0)return c.op;return null})(n.filters,(function(s){switch(s){case"!=":return["!=","not-in"];case"array-contains-any":case"in":return["not-in"];case"not-in":return["array-contains-any","in","not-in","!="];default:return[]}})(e.op));if(t!==null)throw t===e.op?new O(P.INVALID_ARGUMENT,`Invalid query. You cannot use more than one '${e.op.toString()}' filter.`):new O(P.INVALID_ARGUMENT,`Invalid query. You cannot use '${e.op.toString()}' filters with '${t.toString()}' filters.`)}function TA(n,e,t){let r;return r=n?t&&(t.merge||t.mergeFields)?n.toFirestore(e,t):n.toFirestore(e):e,r}class mr{constructor(e,t){this.hasPendingWrites=e,this.fromCache=t}isEqual(e){return this.hasPendingWrites===e.hasPendingWrites&&this.fromCache===e.fromCache}}class cn extends fp{constructor(e,t,r,s,i,a){super(e,t,r,s,a),this._firestore=e,this._firestoreImpl=e,this.metadata=i}exists(){return super.exists()}data(e={}){if(this._document){if(this._converter){const t=new As(this._firestore,this._userDataWriter,this._key,this._document,this.metadata,null);return this._converter.fromFirestore(t,e)}return this._userDataWriter.convertValue(this._document.data.value,e.serverTimestamps)}}get(e,t={}){if(this._document){const r=this._document.data.field(gn("DocumentSnapshot.get",e));if(r!==null)return this._userDataWriter.convertValue(r,t.serverTimestamps)}}toJSON(){if(this.metadata.hasPendingWrites)throw new O(P.FAILED_PRECONDITION,"DocumentSnapshot.toJSON() attempted to serialize a document with pending writes. Await waitForPendingWrites() before invoking toJSON().");const e=this._document,t={};return t.type=cn._jsonSchemaVersion,t.bundle="",t.bundleSource="DocumentSnapshot",t.bundleName=this._key.toString(),!e||!e.isValidDocument()||!e.isFoundDocument()?t:(this._userDataWriter.convertObjectMap(e.data.value.mapValue.fields,"previous"),t.bundle=(this._firestore,this.ref.path,"NOT SUPPORTED"),t)}}cn._jsonSchemaVersion="firestore/documentSnapshot/1.0",cn._jsonSchema={type:ue("string",cn._jsonSchemaVersion),bundleSource:ue("string","DocumentSnapshot"),bundleName:ue("string"),bundle:ue("string")};class As extends cn{data(e={}){return super.data(e)}}class ln{constructor(e,t,r,s){this._firestore=e,this._userDataWriter=t,this._snapshot=s,this.metadata=new mr(s.hasPendingWrites,s.fromCache),this.query=r}get docs(){const e=[];return this.forEach((t=>e.push(t))),e}get size(){return this._snapshot.docs.size}get empty(){return this.size===0}forEach(e,t){this._snapshot.docs.forEach((r=>{e.call(t,new As(this._firestore,this._userDataWriter,r.key,r,new mr(this._snapshot.mutatedKeys.has(r.key),this._snapshot.fromCache),this.query.converter))}))}docChanges(e={}){const t=!!e.includeMetadataChanges;if(t&&this._snapshot.excludesMetadataChanges)throw new O(P.INVALID_ARGUMENT,"To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().");return this._cachedChanges&&this._cachedChangesIncludeMetadataChanges===t||(this._cachedChanges=(function(s,i){if(s._snapshot.oldDocs.isEmpty()){let a=0;return s._snapshot.docChanges.map((c=>{const u=new As(s._firestore,s._userDataWriter,c.doc.key,c.doc,new mr(s._snapshot.mutatedKeys.has(c.doc.key),s._snapshot.fromCache),s.query.converter);return c.doc,{type:"added",doc:u,oldIndex:-1,newIndex:a++}}))}{let a=s._snapshot.oldDocs;return s._snapshot.docChanges.filter((c=>i||c.type!==3)).map((c=>{const u=new As(s._firestore,s._userDataWriter,c.doc.key,c.doc,new mr(s._snapshot.mutatedKeys.has(c.doc.key),s._snapshot.fromCache),s.query.converter);let h=-1,f=-1;return c.type!==0&&(h=a.indexOf(c.doc.key),a=a.delete(c.doc.key)),c.type!==1&&(a=a.add(c.doc),f=a.indexOf(c.doc.key)),{type:wA(c.type),doc:u,oldIndex:h,newIndex:f}}))}})(this,t),this._cachedChangesIncludeMetadataChanges=t),this._cachedChanges}toJSON(){if(this.metadata.hasPendingWrites)throw new O(P.FAILED_PRECONDITION,"QuerySnapshot.toJSON() attempted to serialize a document with pending writes. Await waitForPendingWrites() before invoking toJSON().");const e={};e.type=ln._jsonSchemaVersion,e.bundleSource="QuerySnapshot",e.bundleName=ka.newId(),this._firestore._databaseId.database,this._firestore._databaseId.projectId;const t=[],r=[],s=[];return this.docs.forEach((i=>{i._document!==null&&(t.push(i._document),r.push(this._userDataWriter.convertObjectMap(i._document.data.value.mapValue.fields,"previous")),s.push(i.ref.path))})),e.bundle=(this._firestore,this.query._query,e.bundleName,"NOT SUPPORTED"),e}}function wA(n){switch(n){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return x(61501,{type:n})}}ln._jsonSchemaVersion="firestore/querySnapshot/1.0",ln._jsonSchema={type:ue("string",ln._jsonSchemaVersion),bundleSource:ue("string","QuerySnapshot"),bundleName:ue("string"),bundle:ue("string")};function ta(n){n=qe(n,ie);const e=qe(n.firestore,Gt),t=Pi(e);return tA(t,n._key).then((r=>_p(e,n,r)))}function EA(n){n=qe(n,It);const e=qe(n.firestore,Gt),t=Pi(e),r=new ac(e);return pp(n._query),nA(t,n._query).then((s=>new ln(e,r,n,s)))}function gp(n,e,t){n=qe(n,ie);const r=qe(n.firestore,Gt),s=TA(n.converter,e,t),i=ic(r);return fc(r,[dA(i,"setDoc",n._key,s,n.converter!==null,t).toMutation(n._key,Je.none())])}function vA(n,e,t,...r){n=qe(n,ie);const s=qe(n.firestore,Gt),i=ic(s);let a;return a=typeof(e=ee(e))=="string"||e instanceof Ci?pA(i,"updateDoc",n._key,e,t,r):fA(i,"updateDoc",n._key,e),fc(s,[a.toMutation(n._key,Je.exists(!0))])}function IA(n){return fc(qe(n.firestore,Gt),[new xa(n._key,Je.none())])}function AA(n,...e){n=ee(n);let t={includeMetadataChanges:!1,source:"default"},r=0;typeof e[r]!="object"||th(e[r])||(t=e[r++]);const s={includeMetadataChanges:t.includeMetadataChanges,source:t.source};if(th(e[r])){const h=e[r];e[r]=h.next?.bind(h),e[r+1]=h.error?.bind(h),e[r+2]=h.complete?.bind(h)}let i,a,c;if(n instanceof ie)a=qe(n.firestore,Gt),c=yi(n._key.path),i={next:h=>{e[r]&&e[r](_p(a,n,h))},error:e[r+1],complete:e[r+2]};else{const h=qe(n,It);a=qe(h.firestore,Gt),c=h._query;const f=new ac(a);i={next:m=>{e[r]&&e[r](new ln(a,f,h,m))},error:e[r+1],complete:e[r+2]},pp(n._query)}const u=Pi(a);return eA(u,c,s,i)}function fc(n,e){const t=Pi(n);return rA(t,e)}function _p(n,e,t){const r=t.docs.get(e._key),s=new ac(n);return new cn(n,s,e._key,r,new mr(t.hasPendingWrites,t.fromCache),e.converter)}(function(e,t=!0){tE(yn),Me(new Ne("firestore",((r,{instanceIdentifier:s,options:i})=>{const a=r.getProvider("app").getImmediate(),c=new Gt(new sE(r.getProvider("auth-internal")),new aE(a,r.getProvider("app-check-internal")),bE(a,s),a);return i={useFetchStreams:t,...i},c._setSettings(i),c}),"PUBLIC").setMultipleInstances(!0)),me(Zu,eh,e),me(Zu,eh,"esm2020")})();const yp="firebasestorage.googleapis.com",bA="storageBucket",SA=120*1e3,RA=600*1e3;class ht extends $e{constructor(e,t,r=0){super(Eo(e),`Firebase Storage: ${t} (${Eo(e)})`),this.status_=r,this.customData={serverResponse:null},this._baseMessage=this.message,Object.setPrototypeOf(this,ht.prototype)}get status(){return this.status_}set status(e){this.status_=e}_codeEquals(e){return Eo(e)===this.code}get serverResponse(){return this.customData.serverResponse}set serverResponse(e){this.customData.serverResponse=e,this.customData.serverResponse?this.message=`${this._baseMessage}
|
|
37
37
|
${this.customData.serverResponse}`:this.message=this._baseMessage}}var lt;(function(n){n.UNKNOWN="unknown",n.OBJECT_NOT_FOUND="object-not-found",n.BUCKET_NOT_FOUND="bucket-not-found",n.PROJECT_NOT_FOUND="project-not-found",n.QUOTA_EXCEEDED="quota-exceeded",n.UNAUTHENTICATED="unauthenticated",n.UNAUTHORIZED="unauthorized",n.UNAUTHORIZED_APP="unauthorized-app",n.RETRY_LIMIT_EXCEEDED="retry-limit-exceeded",n.INVALID_CHECKSUM="invalid-checksum",n.CANCELED="canceled",n.INVALID_EVENT_NAME="invalid-event-name",n.INVALID_URL="invalid-url",n.INVALID_DEFAULT_BUCKET="invalid-default-bucket",n.NO_DEFAULT_BUCKET="no-default-bucket",n.CANNOT_SLICE_BLOB="cannot-slice-blob",n.SERVER_FILE_WRONG_SIZE="server-file-wrong-size",n.NO_DOWNLOAD_URL="no-download-url",n.INVALID_ARGUMENT="invalid-argument",n.INVALID_ARGUMENT_COUNT="invalid-argument-count",n.APP_DELETED="app-deleted",n.INVALID_ROOT_OPERATION="invalid-root-operation",n.INVALID_FORMAT="invalid-format",n.INTERNAL_ERROR="internal-error",n.UNSUPPORTED_ENVIRONMENT="unsupported-environment"})(lt||(lt={}));function Eo(n){return"storage/"+n}function PA(){const n="An unknown error occurred, please check the error payload for server response.";return new ht(lt.UNKNOWN,n)}function CA(){return new ht(lt.RETRY_LIMIT_EXCEEDED,"Max retry time for operation exceeded, please try again.")}function kA(){return new ht(lt.CANCELED,"User canceled the upload/download.")}function NA(n){return new ht(lt.INVALID_URL,"Invalid URL '"+n+"'.")}function DA(n){return new ht(lt.INVALID_DEFAULT_BUCKET,"Invalid default bucket '"+n+"'.")}function ih(n){return new ht(lt.INVALID_ARGUMENT,n)}function Tp(){return new ht(lt.APP_DELETED,"The Firebase app was deleted.")}function VA(n){return new ht(lt.INVALID_ROOT_OPERATION,"The operation '"+n+"' cannot be performed on a root reference, create a non-root reference using child, such as .child('file.png').")}class We{constructor(e,t){this.bucket=e,this.path_=t}get path(){return this.path_}get isRoot(){return this.path.length===0}fullServerUrl(){const e=encodeURIComponent;return"/b/"+e(this.bucket)+"/o/"+e(this.path)}bucketOnlyServerUrl(){return"/b/"+encodeURIComponent(this.bucket)+"/o"}static makeFromBucketSpec(e,t){let r;try{r=We.makeFromUrl(e,t)}catch{return new We(e,"")}if(r.path==="")return r;throw DA(e)}static makeFromUrl(e,t){let r=null;const s="([A-Za-z0-9.\\-_]+)";function i(te){te.path.charAt(te.path.length-1)==="/"&&(te.path_=te.path_.slice(0,-1))}const a="(/(.*))?$",c=new RegExp("^gs://"+s+a,"i"),u={bucket:1,path:3};function h(te){te.path_=decodeURIComponent(te.path)}const f="v[A-Za-z0-9_]+",m=t.replace(/[.]/g,"\\."),y="(/([^?#]*).*)?$",S=new RegExp(`^https?://${m}/${f}/b/${s}/o${y}`,"i"),k={bucket:1,path:3},V=t===yp?"(?:storage.googleapis.com|storage.cloud.google.com)":t,N="([^?#]*)",$=new RegExp(`^https?://${V}/${s}/${N}`,"i"),Q=[{regex:c,indices:u,postModify:i},{regex:S,indices:k,postModify:h},{regex:$,indices:{bucket:1,path:2},postModify:h}];for(let te=0;te<Q.length;te++){const we=Q[te],oe=we.regex.exec(e);if(oe){const v=oe[we.indices.bucket];let g=oe[we.indices.path];g||(g=""),r=new We(v,g),we.postModify(r);break}}if(r==null)throw NA(e);return r}}class OA{constructor(e){this.promise_=Promise.reject(e)}getPromise(){return this.promise_}cancel(e=!1){}}function LA(n,e,t){let r=1,s=null,i=null,a=!1,c=0;function u(){return c===2}let h=!1;function f(...N){h||(h=!0,e.apply(null,N))}function m(N){s=setTimeout(()=>{s=null,n(S,u())},N)}function y(){i&&clearTimeout(i)}function S(N,...$){if(h){y();return}if(N){y(),f.call(null,N,...$);return}if(u()||a){y(),f.call(null,N,...$);return}r<64&&(r*=2);let Q;c===1?(c=2,Q=0):Q=(r+Math.random())*1e3,m(Q)}let k=!1;function V(N){k||(k=!0,y(),!h&&(s!==null?(N||(c=2),clearTimeout(s),m(0)):N||(c=1)))}return m(0),i=setTimeout(()=>{a=!0,V(!0)},t),V}function MA(n){n(!1)}function xA(n){return n!==void 0}function oh(n,e,t,r){if(r<e)throw ih(`Invalid value for '${n}'. Expected ${e} or greater.`);if(r>t)throw ih(`Invalid value for '${n}'. Expected ${t} or less.`)}function FA(n){const e=encodeURIComponent;let t="?";for(const r in n)if(n.hasOwnProperty(r)){const s=e(r)+"="+e(n[r]);t=t+s+"&"}return t=t.slice(0,-1),t}var Qs;(function(n){n[n.NO_ERROR=0]="NO_ERROR",n[n.NETWORK_ERROR=1]="NETWORK_ERROR",n[n.ABORT=2]="ABORT"})(Qs||(Qs={}));function UA(n,e){const t=n>=500&&n<600,s=[408,429].indexOf(n)!==-1,i=e.indexOf(n)!==-1;return t||s||i}class BA{constructor(e,t,r,s,i,a,c,u,h,f,m,y=!0,S=!1){this.url_=e,this.method_=t,this.headers_=r,this.body_=s,this.successCodes_=i,this.additionalRetryCodes_=a,this.callback_=c,this.errorCallback_=u,this.timeout_=h,this.progressCallback_=f,this.connectionFactory_=m,this.retry=y,this.isUsingEmulator=S,this.pendingConnection_=null,this.backoffId_=null,this.canceled_=!1,this.appDelete_=!1,this.promise_=new Promise((k,V)=>{this.resolve_=k,this.reject_=V,this.start_()})}start_(){const e=(r,s)=>{if(s){r(!1,new ps(!1,null,!0));return}const i=this.connectionFactory_();this.pendingConnection_=i;const a=c=>{const u=c.loaded,h=c.lengthComputable?c.total:-1;this.progressCallback_!==null&&this.progressCallback_(u,h)};this.progressCallback_!==null&&i.addUploadProgressListener(a),i.send(this.url_,this.method_,this.isUsingEmulator,this.body_,this.headers_).then(()=>{this.progressCallback_!==null&&i.removeUploadProgressListener(a),this.pendingConnection_=null;const c=i.getErrorCode()===Qs.NO_ERROR,u=i.getStatus();if(!c||UA(u,this.additionalRetryCodes_)&&this.retry){const f=i.getErrorCode()===Qs.ABORT;r(!1,new ps(!1,null,f));return}const h=this.successCodes_.indexOf(u)!==-1;r(!0,new ps(h,i))})},t=(r,s)=>{const i=this.resolve_,a=this.reject_,c=s.connection;if(s.wasSuccessCode)try{const u=this.callback_(c,c.getResponse());xA(u)?i(u):i()}catch(u){a(u)}else if(c!==null){const u=PA();u.serverResponse=c.getErrorText(),this.errorCallback_?a(this.errorCallback_(c,u)):a(u)}else if(s.canceled){const u=this.appDelete_?Tp():kA();a(u)}else{const u=CA();a(u)}};this.canceled_?t(!1,new ps(!1,null,!0)):this.backoffId_=LA(e,t,this.timeout_)}getPromise(){return this.promise_}cancel(e){this.canceled_=!0,this.appDelete_=e||!1,this.backoffId_!==null&&MA(this.backoffId_),this.pendingConnection_!==null&&this.pendingConnection_.abort()}}class ps{constructor(e,t,r){this.wasSuccessCode=e,this.connection=t,this.canceled=!!r}}function qA(n,e){e!==null&&e.length>0&&(n.Authorization="Firebase "+e)}function $A(n,e){n["X-Firebase-Storage-Version"]="webjs/"+(e??"AppManager")}function jA(n,e){e&&(n["X-Firebase-GMPID"]=e)}function zA(n,e){e!==null&&(n["X-Firebase-AppCheck"]=e)}function HA(n,e,t,r,s,i,a=!0,c=!1){const u=FA(n.urlParams),h=n.url+u,f=Object.assign({},n.headers);return jA(f,e),qA(f,t),$A(f,i),zA(f,r),new BA(h,n.method,f,n.body,n.successCodes,n.additionalRetryCodes,n.handler,n.errorHandler,n.timeout,n.progressCallback,s,a,c)}function GA(n){if(n.length===0)return null;const e=n.lastIndexOf("/");return e===-1?"":n.slice(0,e)}function KA(n){const e=n.lastIndexOf("/",n.length-2);return e===-1?n:n.slice(e+1)}class Js{constructor(e,t){this._service=e,t instanceof We?this._location=t:this._location=We.makeFromUrl(t,e.host)}toString(){return"gs://"+this._location.bucket+"/"+this._location.path}_newRef(e,t){return new Js(e,t)}get root(){const e=new We(this._location.bucket,"");return this._newRef(this._service,e)}get bucket(){return this._location.bucket}get fullPath(){return this._location.path}get name(){return KA(this._location.path)}get storage(){return this._service}get parent(){const e=GA(this._location.path);if(e===null)return null;const t=new We(this._location.bucket,e);return new Js(this._service,t)}_throwIfRoot(e){if(this._location.path==="")throw VA(e)}}function ah(n,e){const t=e?.[bA];return t==null?null:We.makeFromBucketSpec(t,n)}function WA(n,e,t,r={}){n.host=`${e}:${t}`;const s=vt(e);s&&(ii(`https://${n.host}/b`),oi("Storage",!0)),n._isUsingEmulator=!0,n._protocol=s?"https":"http";const{mockUserToken:i}=r;i&&(n._overrideAuthToken=typeof i=="string"?i:Oh(i,n.app.options.projectId))}class QA{constructor(e,t,r,s,i,a=!1){this.app=e,this._authProvider=t,this._appCheckProvider=r,this._url=s,this._firebaseVersion=i,this._isUsingEmulator=a,this._bucket=null,this._host=yp,this._protocol="https",this._appId=null,this._deleted=!1,this._maxOperationRetryTime=SA,this._maxUploadRetryTime=RA,this._requests=new Set,s!=null?this._bucket=We.makeFromBucketSpec(s,this._host):this._bucket=ah(this._host,this.app.options)}get host(){return this._host}set host(e){this._host=e,this._url!=null?this._bucket=We.makeFromBucketSpec(this._url,e):this._bucket=ah(e,this.app.options)}get maxUploadRetryTime(){return this._maxUploadRetryTime}set maxUploadRetryTime(e){oh("time",0,Number.POSITIVE_INFINITY,e),this._maxUploadRetryTime=e}get maxOperationRetryTime(){return this._maxOperationRetryTime}set maxOperationRetryTime(e){oh("time",0,Number.POSITIVE_INFINITY,e),this._maxOperationRetryTime=e}async _getAuthToken(){if(this._overrideAuthToken)return this._overrideAuthToken;const e=this._authProvider.getImmediate({optional:!0});if(e){const t=await e.getToken();if(t!==null)return t.accessToken}return null}async _getAppCheckToken(){if(Fe(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;const e=this._appCheckProvider.getImmediate({optional:!0});return e?(await e.getToken()).token:null}_delete(){return this._deleted||(this._deleted=!0,this._requests.forEach(e=>e.cancel()),this._requests.clear()),Promise.resolve()}_makeStorageReference(e){return new Js(this,e)}_makeRequest(e,t,r,s,i=!0){if(this._deleted)return new OA(Tp());{const a=HA(e,this._appId,r,s,t,this._firebaseVersion,i,this._isUsingEmulator);return this._requests.add(a),a.getPromise().then(()=>this._requests.delete(a),()=>this._requests.delete(a)),a}}async makeRequestWithTokens(e,t){const[r,s]=await Promise.all([this._getAuthToken(),this._getAppCheckToken()]);return this._makeRequest(e,t,r,s).getPromise()}}const ch="@firebase/storage",lh="0.14.0";const wp="storage";function JA(n=$n(),e){n=ee(n);const r=ut(n,wp).getImmediate({identifier:e}),s=la("storage");return s&&Ep(r,...s),r}function Ep(n,e,t,r={}){WA(n,e,t,r)}function YA(n,{instanceIdentifier:e}){const t=n.getProvider("app").getImmediate(),r=n.getProvider("auth-internal"),s=n.getProvider("app-check-internal");return new QA(t,r,s,e,yn)}function XA(){Me(new Ne(wp,YA,"PUBLIC").setMultipleInstances(!0)),me(ch,lh,""),me(ch,lh,"esm2020")}XA();const ZA="type.googleapis.com/google.protobuf.Int64Value",e0="type.googleapis.com/google.protobuf.UInt64Value";function vp(n,e){const t={};for(const r in n)n.hasOwnProperty(r)&&(t[r]=e(n[r]));return t}function Ys(n){if(n==null)return null;if(n instanceof Number&&(n=n.valueOf()),typeof n=="number"&&isFinite(n)||n===!0||n===!1||Object.prototype.toString.call(n)==="[object String]")return n;if(n instanceof Date)return n.toISOString();if(Array.isArray(n))return n.map(e=>Ys(e));if(typeof n=="function"||typeof n=="object")return vp(n,e=>Ys(e));throw new Error("Data cannot be encoded in JSON: "+n)}function qn(n){if(n==null)return n;if(n["@type"])switch(n["@type"]){case ZA:case e0:{const e=Number(n.value);if(isNaN(e))throw new Error("Data cannot be decoded from JSON: "+n);return e}default:throw new Error("Data cannot be decoded from JSON: "+n)}return Array.isArray(n)?n.map(e=>qn(e)):typeof n=="function"||typeof n=="object"?vp(n,e=>qn(e)):n}const pc="functions";const uh={OK:"ok",CANCELLED:"cancelled",UNKNOWN:"unknown",INVALID_ARGUMENT:"invalid-argument",DEADLINE_EXCEEDED:"deadline-exceeded",NOT_FOUND:"not-found",ALREADY_EXISTS:"already-exists",PERMISSION_DENIED:"permission-denied",UNAUTHENTICATED:"unauthenticated",RESOURCE_EXHAUSTED:"resource-exhausted",FAILED_PRECONDITION:"failed-precondition",ABORTED:"aborted",OUT_OF_RANGE:"out-of-range",UNIMPLEMENTED:"unimplemented",INTERNAL:"internal",UNAVAILABLE:"unavailable",DATA_LOSS:"data-loss"};class Le extends $e{constructor(e,t,r){super(`${pc}/${e}`,t||""),this.details=r,Object.setPrototypeOf(this,Le.prototype)}}function t0(n){if(n>=200&&n<300)return"ok";switch(n){case 0:return"internal";case 400:return"invalid-argument";case 401:return"unauthenticated";case 403:return"permission-denied";case 404:return"not-found";case 409:return"aborted";case 429:return"resource-exhausted";case 499:return"cancelled";case 500:return"internal";case 501:return"unimplemented";case 503:return"unavailable";case 504:return"deadline-exceeded"}return"unknown"}function Xs(n,e){let t=t0(n),r=t,s;try{const i=e&&e.error;if(i){const a=i.status;if(typeof a=="string"){if(!uh[a])return new Le("internal","internal");t=uh[a],r=a}const c=i.message;typeof c=="string"&&(r=c),s=i.details,s!==void 0&&(s=qn(s))}}catch{}return t==="ok"?null:new Le(t,r,s)}class n0{constructor(e,t,r,s){this.app=e,this.auth=null,this.messaging=null,this.appCheck=null,this.serverAppAppCheckToken=null,Fe(e)&&e.settings.appCheckToken&&(this.serverAppAppCheckToken=e.settings.appCheckToken),this.auth=t.getImmediate({optional:!0}),this.messaging=r.getImmediate({optional:!0}),this.auth||t.get().then(i=>this.auth=i,()=>{}),this.messaging||r.get().then(i=>this.messaging=i,()=>{}),this.appCheck||s?.get().then(i=>this.appCheck=i,()=>{})}async getAuthToken(){if(this.auth)try{return(await this.auth.getToken())?.accessToken}catch{return}}async getMessagingToken(){if(!(!this.messaging||!("Notification"in self)||Notification.permission!=="granted"))try{return await this.messaging.getToken()}catch{return}}async getAppCheckToken(e){if(this.serverAppAppCheckToken)return this.serverAppAppCheckToken;if(this.appCheck){const t=e?await this.appCheck.getLimitedUseToken():await this.appCheck.getToken();return t.error?null:t.token}return null}async getContext(e){const t=await this.getAuthToken(),r=await this.getMessagingToken(),s=await this.getAppCheckToken(e);return{authToken:t,messagingToken:r,appCheckToken:s}}}const na="us-central1",r0=/^data: (.*?)(?:\n|$)/;function s0(n){let e=null;return{promise:new Promise((t,r)=>{e=setTimeout(()=>{r(new Le("deadline-exceeded","deadline-exceeded"))},n)}),cancel:()=>{e&&clearTimeout(e)}}}class i0{constructor(e,t,r,s,i=na,a=(...c)=>fetch(...c)){this.app=e,this.fetchImpl=a,this.emulatorOrigin=null,this.contextProvider=new n0(e,t,r,s),this.cancelAllRequests=new Promise(c=>{this.deleteService=()=>Promise.resolve(c())});try{const c=new URL(i);this.customDomain=c.origin+(c.pathname==="/"?"":c.pathname),this.region=na}catch{this.customDomain=null,this.region=i}}_delete(){return this.deleteService()}_url(e){const t=this.app.options.projectId;return this.emulatorOrigin!==null?`${this.emulatorOrigin}/${t}/${this.region}/${e}`:this.customDomain!==null?`${this.customDomain}/${e}`:`https://${this.region}-${t}.cloudfunctions.net/${e}`}}function o0(n,e,t){const r=vt(e);n.emulatorOrigin=`http${r?"s":""}://${e}:${t}`,r&&(ii(n.emulatorOrigin+"/backends"),oi("Functions",!0))}function a0(n,e,t){const r=s=>l0(n,e,s,{});return r.stream=(s,i)=>h0(n,e,s,i),r}function Ip(n){return n.emulatorOrigin&&vt(n.emulatorOrigin)?"include":void 0}async function c0(n,e,t,r,s){t["Content-Type"]="application/json";let i;try{i=await r(n,{method:"POST",body:JSON.stringify(e),headers:t,credentials:Ip(s)})}catch{return{status:0,json:null}}let a=null;try{a=await i.json()}catch{}return{status:i.status,json:a}}async function Ap(n,e){const t={},r=await n.contextProvider.getContext(e.limitedUseAppCheckTokens);return r.authToken&&(t.Authorization="Bearer "+r.authToken),r.messagingToken&&(t["Firebase-Instance-ID-Token"]=r.messagingToken),r.appCheckToken!==null&&(t["X-Firebase-AppCheck"]=r.appCheckToken),t}function l0(n,e,t,r){const s=n._url(e);return u0(n,s,t,r)}async function u0(n,e,t,r){t=Ys(t);const s={data:t},i=await Ap(n,r),a=r.timeout||7e4,c=s0(a),u=await Promise.race([c0(e,s,i,n.fetchImpl,n),c.promise,n.cancelAllRequests]);if(c.cancel(),!u)throw new Le("cancelled","Firebase Functions instance was deleted.");const h=Xs(u.status,u.json);if(h)throw h;if(!u.json)throw new Le("internal","Response is not valid JSON object.");let f=u.json.data;if(typeof f>"u"&&(f=u.json.result),typeof f>"u")throw new Le("internal","Response is missing data field.");return{data:qn(f)}}function h0(n,e,t,r){const s=n._url(e);return d0(n,s,t,r||{})}async function d0(n,e,t,r){t=Ys(t);const s={data:t},i=await Ap(n,r);i["Content-Type"]="application/json",i.Accept="text/event-stream";let a;try{a=await n.fetchImpl(e,{method:"POST",body:JSON.stringify(s),headers:i,signal:r?.signal,credentials:Ip(n)})}catch(y){if(y instanceof Error&&y.name==="AbortError"){const k=new Le("cancelled","Request was cancelled.");return{data:Promise.reject(k),stream:{[Symbol.asyncIterator](){return{next(){return Promise.reject(k)}}}}}}const S=Xs(0,null);return{data:Promise.reject(S),stream:{[Symbol.asyncIterator](){return{next(){return Promise.reject(S)}}}}}}let c,u;const h=new Promise((y,S)=>{c=y,u=S});r?.signal?.addEventListener("abort",()=>{const y=new Le("cancelled","Request was cancelled.");u(y)});const f=a.body.getReader(),m=f0(f,c,u,r?.signal);return{stream:{[Symbol.asyncIterator](){const y=m.getReader();return{async next(){const{value:S,done:k}=await y.read();return{value:S,done:k}},async return(){return await y.cancel(),{done:!0,value:void 0}}}}},data:h}}function f0(n,e,t,r){const s=(a,c)=>{const u=a.match(r0);if(!u)return;const h=u[1];try{const f=JSON.parse(h);if("result"in f){e(qn(f.result));return}if("message"in f){c.enqueue(qn(f.message));return}if("error"in f){const m=Xs(0,f);c.error(m),t(m);return}}catch(f){if(f instanceof Le){c.error(f),t(f);return}}},i=new TextDecoder;return new ReadableStream({start(a){let c="";return u();async function u(){if(r?.aborted){const h=new Le("cancelled","Request was cancelled");return a.error(h),t(h),Promise.resolve()}try{const{value:h,done:f}=await n.read();if(f){c.trim()&&s(c.trim(),a),a.close();return}if(r?.aborted){const y=new Le("cancelled","Request was cancelled");a.error(y),t(y),await n.cancel();return}c+=i.decode(h,{stream:!0});const m=c.split(`
|
|
38
|
-
`);c=m.pop()||"";for(const y of m)y.trim()&&s(y.trim(),a);return u()}catch(h){const f=h instanceof Le?h:Xs(0,null);a.error(f),t(f)}}},cancel(){return n.cancel()}})}const hh="@firebase/functions",dh="0.13.1";const p0="auth-internal",m0="app-check-internal",g0="messaging-internal";function _0(n){const e=(t,{instanceIdentifier:r})=>{const s=t.getProvider("app").getImmediate(),i=t.getProvider(p0),a=t.getProvider(g0),c=t.getProvider(m0);return new i0(s,i,a,c,r)};Me(new Ne(pc,e,"PUBLIC").setMultipleInstances(!0)),me(hh,dh,n),me(hh,dh,"esm2020")}function y0(n=$n(),e=na){const r=ut(ee(n),pc).getImmediate({identifier:e}),s=la("functions");return s&&bp(r,...s),r}function bp(n,e,t){o0(ee(n),e,t)}function T0(n,e,t){return a0(ee(n),e)}_0();const w0="/firebase-messaging-sw.js",E0="/firebase-cloud-messaging-push-scope",Sp="BDOU99-h67HcA6JeFXHbSNMu7e2yNNu3RzoMj8TM4W88jITfq7ZmPvIM1Iv-4_l2LxQcYwhqby2xGpWwzjfAnG4",v0="https://fcmregistrations.googleapis.com/v1",Rp="google.c.a.c_id",I0="google.c.a.c_l",A0="google.c.a.ts",b0="google.c.a.e",fh=1e4;var ph;(function(n){n[n.DATA_MESSAGE=1]="DATA_MESSAGE",n[n.DISPLAY_NOTIFICATION=3]="DISPLAY_NOTIFICATION"})(ph||(ph={}));var Lr;(function(n){n.PUSH_RECEIVED="push-received",n.NOTIFICATION_CLICKED="notification-clicked"})(Lr||(Lr={}));function dt(n){const e=new Uint8Array(n);return btoa(String.fromCharCode(...e)).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function S0(n){const e="=".repeat((4-n.length%4)%4),t=(n+e).replace(/\-/g,"+").replace(/_/g,"/"),r=atob(t),s=new Uint8Array(r.length);for(let i=0;i<r.length;++i)s[i]=r.charCodeAt(i);return s}const vo="fcm_token_details_db",R0=5,mh="fcm_token_object_Store";async function P0(n){if("databases"in indexedDB&&!(await indexedDB.databases()).map(i=>i.name).includes(vo))return null;let e=null;return(await ci(vo,R0,{upgrade:async(r,s,i,a)=>{if(s<2||!r.objectStoreNames.contains(mh))return;const c=a.objectStore(mh),u=await c.index("fcmSenderId").get(n);if(await c.clear(),!!u){if(s===2){const h=u;if(!h.auth||!h.p256dh||!h.endpoint)return;e={token:h.fcmToken,createTime:h.createTime??Date.now(),subscriptionOptions:{auth:h.auth,p256dh:h.p256dh,endpoint:h.endpoint,swScope:h.swScope,vapidKey:typeof h.vapidKey=="string"?h.vapidKey:dt(h.vapidKey)}}}else if(s===3){const h=u;e={token:h.fcmToken,createTime:h.createTime,subscriptionOptions:{auth:dt(h.auth),p256dh:dt(h.p256dh),endpoint:h.endpoint,swScope:h.swScope,vapidKey:dt(h.vapidKey)}}}else if(s===4){const h=u;e={token:h.fcmToken,createTime:h.createTime,subscriptionOptions:{auth:dt(h.auth),p256dh:dt(h.p256dh),endpoint:h.endpoint,swScope:h.swScope,vapidKey:dt(h.vapidKey)}}}}}})).close(),await io(vo),await io("fcm_vapid_details_db"),await io("undefined"),C0(e)?e:null}function C0(n){if(!n||!n.subscriptionOptions)return!1;const{subscriptionOptions:e}=n;return typeof n.createTime=="number"&&n.createTime>0&&typeof n.token=="string"&&n.token.length>0&&typeof e.auth=="string"&&e.auth.length>0&&typeof e.p256dh=="string"&&e.p256dh.length>0&&typeof e.endpoint=="string"&&e.endpoint.length>0&&typeof e.swScope=="string"&&e.swScope.length>0&&typeof e.vapidKey=="string"&&e.vapidKey.length>0}const k0="firebase-messaging-database",N0=1,_n="firebase-messaging-store";let Io=null;function mc(){return Io||(Io=ci(k0,N0,{upgrade:(n,e)=>{e===0&&n.createObjectStore(_n)}})),Io}async function Pp(n){const e=_c(n),r=await(await mc()).transaction(_n).objectStore(_n).get(e);if(r)return r;{const s=await P0(n.appConfig.senderId);if(s)return await gc(n,s),s}}async function gc(n,e){const t=_c(n),s=(await mc()).transaction(_n,"readwrite");return await s.objectStore(_n).put(e,t),await s.done,e}async function D0(n){const e=_c(n),r=(await mc()).transaction(_n,"readwrite");await r.objectStore(_n).delete(e),await r.done}function _c({appConfig:n}){return n.appId}const V0={"missing-app-config-values":'Missing App configuration value: "{$valueName}"',"only-available-in-window":"This method is available in a Window context.","only-available-in-sw":"This method is available in a service worker context.","permission-default":"The notification permission was not granted and dismissed instead.","permission-blocked":"The notification permission was not granted and blocked instead.","unsupported-browser":"This browser doesn't support the API's required to use the Firebase SDK.","indexed-db-unsupported":"This browser doesn't support indexedDb.open() (ex. Safari iFrame, Firefox Private Browsing, etc)","failed-service-worker-registration":"We are unable to register the default service worker. {$browserErrorMessage}","token-subscribe-failed":"A problem occurred while subscribing the user to FCM: {$errorInfo}","token-subscribe-no-token":"FCM returned no token when subscribing the user to push.","token-unsubscribe-failed":"A problem occurred while unsubscribing the user from FCM: {$errorInfo}","token-update-failed":"A problem occurred while updating the user from FCM: {$errorInfo}","token-update-no-token":"FCM returned no token when updating the user to push.","use-sw-after-get-token":"The useServiceWorker() method may only be called once and must be called before calling getToken() to ensure your service worker is used.","invalid-sw-registration":"The input to useServiceWorker() must be a ServiceWorkerRegistration.","invalid-bg-handler":"The input to setBackgroundMessageHandler() must be a function.","invalid-vapid-key":"The public VAPID key must be a string.","use-vapid-key-after-get-token":"The usePublicVapidKey() method may only be called once and must be called before calling getToken() to ensure your VAPID key is used."},be=new Kt("messaging","Messaging",V0);async function O0(n,e){const t=await Tc(n),r=kp(e),s={method:"POST",headers:t,body:JSON.stringify(r)};let i;try{i=await(await fetch(yc(n.appConfig),s)).json()}catch(a){throw be.create("token-subscribe-failed",{errorInfo:a?.toString()})}if(i.error){const a=i.error.message;throw be.create("token-subscribe-failed",{errorInfo:a})}if(!i.token)throw be.create("token-subscribe-no-token");return i.token}async function L0(n,e){const t=await Tc(n),r=kp(e.subscriptionOptions),s={method:"PATCH",headers:t,body:JSON.stringify(r)};let i;try{i=await(await fetch(`${yc(n.appConfig)}/${e.token}`,s)).json()}catch(a){throw be.create("token-update-failed",{errorInfo:a?.toString()})}if(i.error){const a=i.error.message;throw be.create("token-update-failed",{errorInfo:a})}if(!i.token)throw be.create("token-update-no-token");return i.token}async function Cp(n,e){const r={method:"DELETE",headers:await Tc(n)};try{const i=await(await fetch(`${yc(n.appConfig)}/${e}`,r)).json();if(i.error){const a=i.error.message;throw be.create("token-unsubscribe-failed",{errorInfo:a})}}catch(s){throw be.create("token-unsubscribe-failed",{errorInfo:s?.toString()})}}function yc({projectId:n}){return`${v0}/projects/${n}/registrations`}async function Tc({appConfig:n,installations:e}){const t=await e.getToken();return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":n.apiKey,"x-goog-firebase-installations-auth":`FIS ${t}`})}function kp({p256dh:n,auth:e,endpoint:t,vapidKey:r}){const s={web:{endpoint:t,auth:e,p256dh:n}};return r!==Sp&&(s.web.applicationPubKey=r),s}const M0=10080*60*1e3;async function x0(n){const e=await B0(n.swRegistration,n.vapidKey),t={vapidKey:n.vapidKey,swScope:n.swRegistration.scope,endpoint:e.endpoint,auth:dt(e.getKey("auth")),p256dh:dt(e.getKey("p256dh"))},r=await Pp(n.firebaseDependencies);if(r){if(q0(r.subscriptionOptions,t))return Date.now()>=r.createTime+M0?U0(n,{token:r.token,createTime:Date.now(),subscriptionOptions:t}):r.token;try{await Cp(n.firebaseDependencies,r.token)}catch(s){console.warn(s)}return gh(n.firebaseDependencies,t)}else return gh(n.firebaseDependencies,t)}async function F0(n){const e=await Pp(n.firebaseDependencies);e&&(await Cp(n.firebaseDependencies,e.token),await D0(n.firebaseDependencies));const t=await n.swRegistration.pushManager.getSubscription();return t?t.unsubscribe():!0}async function U0(n,e){try{const t=await L0(n.firebaseDependencies,e),r={...e,token:t,createTime:Date.now()};return await gc(n.firebaseDependencies,r),t}catch(t){throw t}}async function gh(n,e){const r={token:await O0(n,e),createTime:Date.now(),subscriptionOptions:e};return await gc(n,r),r.token}async function B0(n,e){const t=await n.pushManager.getSubscription();return t||n.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:S0(e)})}function q0(n,e){const t=e.vapidKey===n.vapidKey,r=e.endpoint===n.endpoint,s=e.auth===n.auth,i=e.p256dh===n.p256dh;return t&&r&&s&&i}function _h(n){const e={from:n.from,collapseKey:n.collapse_key,messageId:n.fcmMessageId};return $0(e,n),j0(e,n),z0(e,n),e}function $0(n,e){if(!e.notification)return;n.notification={};const t=e.notification.title;t&&(n.notification.title=t);const r=e.notification.body;r&&(n.notification.body=r);const s=e.notification.image;s&&(n.notification.image=s);const i=e.notification.icon;i&&(n.notification.icon=i)}function j0(n,e){e.data&&(n.data=e.data)}function z0(n,e){if(!e.fcmOptions&&!e.notification?.click_action)return;n.fcmOptions={};const t=e.fcmOptions?.link??e.notification?.click_action;t&&(n.fcmOptions.link=t);const r=e.fcmOptions?.analytics_label;r&&(n.fcmOptions.analyticsLabel=r)}function H0(n){return typeof n=="object"&&!!n&&Rp in n}function G0(n){if(!n||!n.options)throw Ao("App Configuration Object");if(!n.name)throw Ao("App Name");const e=["projectId","apiKey","appId","messagingSenderId"],{options:t}=n;for(const r of e)if(!t[r])throw Ao(r);return{appName:n.name,projectId:t.projectId,apiKey:t.apiKey,appId:t.appId,senderId:t.messagingSenderId}}function Ao(n){return be.create("missing-app-config-values",{valueName:n})}class K0{constructor(e,t,r){this.deliveryMetricsExportedToBigQueryEnabled=!1,this.onBackgroundMessageHandler=null,this.onMessageHandler=null,this.logEvents=[],this.isLogServiceStarted=!1;const s=G0(e);this.firebaseDependencies={app:e,appConfig:s,installations:t,analyticsProvider:r}}_delete(){return Promise.resolve()}}async function Np(n){try{n.swRegistration=await navigator.serviceWorker.register(w0,{scope:E0}),n.swRegistration.update().catch(()=>{}),await W0(n.swRegistration)}catch(e){throw be.create("failed-service-worker-registration",{browserErrorMessage:e?.message})}}async function W0(n){return new Promise((e,t)=>{const r=setTimeout(()=>t(new Error(`Service worker not registered after ${fh} ms`)),fh),s=n.installing||n.waiting;n.active?(clearTimeout(r),e()):s?s.onstatechange=i=>{i.target?.state==="activated"&&(s.onstatechange=null,clearTimeout(r),e())}:(clearTimeout(r),t(new Error("No incoming service worker found.")))})}async function Q0(n,e){if(!e&&!n.swRegistration&&await Np(n),!(!e&&n.swRegistration)){if(!(e instanceof ServiceWorkerRegistration))throw be.create("invalid-sw-registration");n.swRegistration=e}}async function J0(n,e){e?n.vapidKey=e:n.vapidKey||(n.vapidKey=Sp)}async function Dp(n,e){if(!navigator)throw be.create("only-available-in-window");if(Notification.permission==="default"&&await Notification.requestPermission(),Notification.permission!=="granted")throw be.create("permission-blocked");return await J0(n,e?.vapidKey),await Q0(n,e?.serviceWorkerRegistration),x0(n)}async function Y0(n,e,t){const r=X0(e);(await n.firebaseDependencies.analyticsProvider.get()).logEvent(r,{message_id:t[Rp],message_name:t[I0],message_time:t[A0],message_device_time:Math.floor(Date.now()/1e3)})}function X0(n){switch(n){case Lr.NOTIFICATION_CLICKED:return"notification_open";case Lr.PUSH_RECEIVED:return"notification_foreground";default:throw new Error}}async function Z0(n,e){const t=e.data;if(!t.isFirebaseMessaging)return;n.onMessageHandler&&t.messageType===Lr.PUSH_RECEIVED&&(typeof n.onMessageHandler=="function"?n.onMessageHandler(_h(t)):n.onMessageHandler.next(_h(t)));const r=t.data;H0(r)&&r[b0]==="1"&&await Y0(n,t.messageType,r)}const yh="@firebase/messaging",Th="0.12.23";const eb=n=>{const e=new K0(n.getProvider("app").getImmediate(),n.getProvider("installations-internal").getImmediate(),n.getProvider("analytics-internal"));return navigator.serviceWorker.addEventListener("message",t=>Z0(e,t)),e},tb=n=>{const e=n.getProvider("messaging").getImmediate();return{getToken:r=>Dp(e,r)}};function nb(){Me(new Ne("messaging",eb,"PUBLIC")),Me(new Ne("messaging-internal",tb,"PRIVATE")),me(yh,Th),me(yh,Th,"esm2020")}async function rb(){try{await ha()}catch{return!1}return typeof window<"u"&&ua()&&Mh()&&"serviceWorker"in navigator&&"PushManager"in window&&"Notification"in window&&"fetch"in window&&ServiceWorkerRegistration.prototype.hasOwnProperty("showNotification")&&PushSubscription.prototype.hasOwnProperty("getKey")}async function sb(n){if(!navigator)throw be.create("only-available-in-window");return n.swRegistration||await Np(n),F0(n)}function ib(n=$n()){return rb().then(e=>{if(!e)throw be.create("unsupported-browser")},e=>{throw be.create("indexed-db-unsupported")}),ut(ee(n),"messaging").getImmediate()}async function ob(n,e){return n=ee(n),Dp(n,e)}function ab(n){return n=ee(n),sb(n)}nb();let He=null;exports.auth=void 0;exports.provider=void 0;exports.analytics=void 0;exports.db=void 0;exports.storage=void 0;exports.functions=void 0;exports.messaging=void 0;function cb(n){return He||(He=Uh(n),exports.auth=Zw(He),exports.provider=new ft,exports.analytics=Xy(He),exports.db=aA(He),exports.storage=JA(He),exports.functions=y0(He,"europe-west1"),exports.messaging=ib(He),je.isDev&&(op(exports.db,"localhost",8080),bd(exports.auth,"http://localhost:9099"),bp(exports.functions,"localhost",5001),Ep(exports.storage,"localhost",9199)),He)}function ra(){if(!He)throw new Error("[cic-kit] Firebase non inizializzato. Chiama setupFirebase(firebaseConfig) nel main.")}const Zs="Sei offline: cancello in locale, sincronizzo quando torni online.";function Vp(){return typeof navigator<"u"?!!navigator.onLine:!0}function wc(){return!Vp()}function Ar(n){if(n instanceof z)return n;try{return new z(n.seconds,n.nanoseconds)}catch{return U.logError({title:"reviveTimestamp errore:",message:`seconds:${n.seconds}; nanoseconds:${n.nanoseconds};`}),z.now()}}function sa(n){try{if(n==null||n instanceof z)return n;if(typeof n=="object"&&n.type==="firestore/timestamp/1.0"&&typeof n.seconds=="number"&&typeof n.nanoseconds=="number")return Ar(n);if(Array.isArray(n))return n.map(e=>sa(e));if(typeof n=="object"){const e={};for(const[t,r]of Object.entries(n))e[t]=sa(r);return e}return n}catch(e){return U.logError({title:"reviveTimestampsDeep error",message:e?.message??"Errore sconosciuto"}),n}}const ei=n=>{if(n==null)return n;if(n instanceof z)return n.toJSON();if(n&&typeof n=="object"&&n._methodName==="serverTimestamp")return U.logError("non puoi salvare un serverTimestamp devi usare Timestamp.now()"),z.now().toJSON();if(Array.isArray(n))return n.map(e=>ei(e));if(typeof n=="object"){const e={};for(const[t,r]of Object.entries(n))e[t]=ei(r);return e}return n},ia={unknown:"Errore sconosciuto.",undefined:"Non trovato.",cancelled:"Operazione annullata.","invalid-argument":"Argomento non valido.","deadline-exceeded":"Timeout dell’operazione.","not-found":"Risorsa non trovata.","already-exists":"La risorsa esiste già.","permission-denied":"Non hai i permessi necessari.","resource-exhausted":"Limite superato, riprova più tardi.","failed-precondition":"Stato non valido per questa operazione.",aborted:"Conflitto, operazione annullata.",unavailable:"Servizio momentaneamente non disponibile.","auth/email-already-in-use":"Questa email è già registrata.","auth/wrong-password":"Password errata.","auth/user-not-found":"Utente non trovato.","auth/invalid-email":"Indirizzo email non valido.","auth/too-many-requests":"Troppi tentativi, riprova più tardi.","auth/requires-recent-login":"Per favore effettua di nuovo il login.","storage/object-not-found":"File non trovato.","storage/unauthenticated":"Devi effettuare il login.","storage/unauthorized":"Non hai accesso a questo file.","storage/quota-exceeded":"Quota di archiviazione superata."};function lb(n){return n in ia}function nt(n,e){if(e===!1)return;const t=typeof n?.code=="string"?n?.code:"",r=lb(t)?ia[t]:!1;if(r)U.error(r);else{U.error(ia.unknown),console.log(`%cTodo gestire error.code "%c${n?.code}%c"`,"color:#fb9005; font-weight:bold;","color:#0dfb05; font-weight:bold;","color:#fb9005; font-weight:bold;");try{U.logError(String(n))}catch{U.logError("on try to parse error")}finally{console.log("[ERROR from middlewareCatchCall]:",n)}}}function ti(n,e,t,...r){!je.debugFirestore||!(i=>{if(!i)return;if(typeof je.debugFirestore=="boolean")return je.debugFirestore;const a=typeof je.debugFirestore=="string"?[je.debugFirestore]:je.debugFirestore;return a.length>0?a.includes(i):!1})(n)||console.log(`${e}[${t}] [${n??"no collectionName"}]`,...r)}function bo(n){if(wc()){if(n!==!0)throw Zs;U.warning(Zs)}}const ge={offlineAllow:!1,touchUpdate:!0,localSet:!0};class Ge{id;createdAt;updatedAt;deleteAt;constructor(e){this.id=e.id,Object.assign(this,e);const t=z.now();this.createdAt=e.createdAt?Ar(e.createdAt):t,this.updatedAt=e.updatedAt?Ar(e.updatedAt):t,this.deleteAt=e.deleteAt&&e.deleteAt!==null?Ar(e.deleteAt):null}static collectionName;debugLog(e,...t){ti(this?.collectionName??"no-collectionName","🔥📡🏪",e,t)}get ref(){const e=this.constructor,r=this.getCollectionPath?.()??e.collectionName;if(!r)throw new Error(`${e.name}: nessuna collectionName statica e nessuna getCollectionPath() definita.`);return Ir(exports.db,r,this.id)}static async get(e,t){try{ti(this?.collectionName??"no-collectionName","🔥📡🏪","get");const r=t?.collectionPath??this.collectionName;if(!r)throw new Error(`${this.name}.get: serve opts.collectionPath per collezioni dinamiche, oppure definisci static collectionName.`);const s=Ir(exports.db,r,e),i=await ta(s);if(!i.exists())return;const a=new this({id:e,...i.data()}),c=await a.onGetBeforeStoreSet(a);return c.canLocalSave(t?.localSet)&&c.localSet(),c}catch(r){throw nt(r),r}}static cleanDataAAA(e){return Object.fromEntries(Object.entries(e).map(([t,r])=>{if(r==null)return[t,Zo()];if(typeof r=="object"&&r!==null&&!(r instanceof z)&&!(r instanceof Date))try{return[t,structuredClone(r)]}catch{return[t,JSON.parse(JSON.stringify(r))]}return[t,r]}))}static isPlainObject(e){return!!e&&typeof e=="object"}static stripUndefinedDeep(e){if(e!==void 0){if(e===null)return null;if(e instanceof z||e instanceof Date||e instanceof Or)return e;if(Array.isArray(e))return e.map(t=>Ge.stripUndefinedDeep(t)).filter(t=>t!==void 0);if(Ge.isPlainObject(e)){const t={};for(const[r,s]of Object.entries(e)){const i=Ge.stripUndefinedDeep(s);i!==void 0&&(t[r]=i)}return t}return e}}static cleanData(e){const t=Ge.stripUndefinedDeep(e);return Object.fromEntries(Object.entries(t??{}).map(([s,i])=>{if(i==null)return[s,Zo()];if((Ge.isPlainObject(i)||Array.isArray(i))&&!(i instanceof z)&&!(i instanceof Date)&&!(i instanceof Or))try{return[s,structuredClone(i)]}catch{return[s,JSON.parse(JSON.stringify(i))]}return[s,i]}))}async onGetBeforeStoreSet(e){return e}async save({offlineAllow:e=ge.offlineAllow,touchUpdate:t=ge.touchUpdate,localSet:r=ge.localSet}=ge){this.debugLog("save");try{bo(e);const s=this.toData(),i=Ge.cleanData(s);t&&!i.updatedAt&&(i.updatedAt=this.touchUpdated()),await gp(this.ref,{...i},{merge:!0}),this.canLocalSave(r)&&this.localSet()}catch(s){throw nt(s),s}}async update(e,{offlineAllow:t=ge.offlineAllow,touchUpdate:r=ge.touchUpdate,localSet:s=ge.localSet}=ge){this.debugLog("update");try{bo(t);const i=Ge.cleanData(e);r&&!i.updatedAt&&(i.updatedAt=this.touchUpdated()),await vA(this.ref,i),Object.assign(this,e),this.canLocalSave(s)&&this.localSet()}catch(i){throw nt(i),i}}async delete(e,t=ge){return this.debugLog("deleteUsingStore",`[id=${this.id}]`),await e.delete(this.id,t)}async deleteJustOnline_NotLocalStore({offlineAllow:e=ge.offlineAllow,localSet:t=ge.localSet}=ge){this.debugLog("delete");try{bo(e),await IA(this.ref),this.canLocalSave(t)&&this.localSet(!0)}catch(r){throw nt(r),r}}get isDeleted(){return this.deleteAt!==null}timestampbleProps(){return{createdAt:this.createdAt,updatedAt:this.updatedAt,deleteAt:this.deleteAt}}touchUpdated(){const e=z.now();return this.updatedAt=e,e}async softDelete(e){if(this.debugLog("softDelete"),this.deleteAt!==null){U.warning("Elemento già nel cestino.");return}const t=z.now();this.deleteAt=t,await this.update({deleteAt:t},e)}async restore(e){if(this.debugLog("restore"),this.deleteAt===null){U.warning("Elemento non è nel cestino.");return}this.deleteAt=null,await this.update({deleteAt:null},e)}canLocalSave(e){if(e===!1)return!1;try{return!!this?.localStorageKey?.()}catch{return!1}}localSet(e){this.debugLog("localSet");const t=this?.localStorageKey?.();if(!t)return;const r=this?.toData?.()??{id:this.id},s=ei(r),i=Ce.getParsed(t);if(i&&typeof i=="object"&&!Array.isArray(i)){if(e){i[this.id]&&(delete i[this.id],Ce.set(t,i));return}Ce.set(t,{...i,[this.id]:s})}else Ce.set(t,{[this.id]:s})}}function ub(n){if(wc()){if(n!==!0)throw Zs;U.warning(Zs)}}class hb{ModelInstnce;makeModel(e,t){return new this.ModelInstnce({id:e,...t})}_collectionPath;debugLog(e,...t){ti(this.collectionPath,"🔥📡📦",e,t)}items={};snapshotFnStop=null;isFirstRun=!0;prevStartQuery="";get live(){return!!this.snapshotFnStop}get ref(){return oA(exports.db,this.collectionPath)}constructor(e,t){this.ModelInstnce=e,this._collectionPath=t?.collectionPath}get collectionPath(){const e=this._collectionPath??this.ModelInstnce.collectionName;if(!e)throw new Error("collectionPath non definita");return e}get name(){return this.collectionPath}get itemsActive(){return Object.fromEntries(Object.entries(this.items).filter(([,e])=>!e.isDeleted))}get itemsDeleted(){return Object.fromEntries(Object.entries(this.items).filter(([,e])=>e.isDeleted))}get itemsArray(){return Object.values(this.items)}get itemsActiveArray(){return Object.values(this.items).filter(e=>!e.isDeleted)}get itemsDeletedArray(){return Object.values(this.items).filter(e=>e.isDeleted)}get isEmpty(){return Object.keys(this.items).length===0}get isActiveEmpty(){return this.itemsActiveArray.length===0}get isDeletedEmpty(){return this.itemsDeletedArray.length===0}get localStorageKey(){const e=this.ModelInstnce?.prototype?.localStorageKey?.();if(!e){U.logError("Impossibile svuotare LocalStorage: localStorageKey() non definita nel Model.");return}return e}itemsArrayOrderedBy(e,t){return[...t===void 0?this.itemsArray:t?this.itemsDeletedArray:this.itemsActiveArray].sort((s,i)=>{const a=s[e]?.toMillis?.()??0;return(i[e]?.toMillis?.()??0)-a})}findItemsById(e){if(!(!e||e===""))return this.items?.[e]}async get(e={}){this.debugLog("get");try{const t=oa(e),r=t?nh(this.ref,...t):this.ref,s=await EA(r);e.forceLocalSet&&(this.items={},this.localClear());for(const i of s.docs){const a=this.makeModel(i.id,i.data()),c=await a.onGetBeforeStoreSet(a);this.items[i.id]=c,(c.canLocalSave(e.localSet)||e.forceLocalSet&&c.canLocalSave())&&c.localSet()}return this.items}catch(t){throw nt(t),t}}async getIds(e){this.debugLog("getIds");const t=Array.from(new Set((e??[]).map(u=>(u??"").trim()).filter(Boolean)));if(t.length===0)return{foundIds:!1,notFoundIds:!1};const r=(u,h)=>{const f=[];for(let m=0;m<u.length;m+=h)f.push(u.slice(m,m+h));return f},s=new Set,i=r(t,10);for(const u of i){const h=await this.get({query:ea(Xo(),"in",u)});for(const f of Object.keys(h))s.add(f)}const a=Array.from(s),c=t.filter(u=>!s.has(u));return{foundIds:a.length>0?a:!1,notFoundIds:c.length>0?c:!1}}localGet(){const e=this.localStorageKey;try{if(!e){U.logError({title:"localGet "+e,message:"LocalStorageKey not found"});return}const t=Ce.getParsed(e);for(const r in t)this.items[r]=this.makeModel(r,t[r])}catch{U.logError({title:"localGet "+e,message:"errore try parse o makeModel"})}}async start(e={}){if(this.debugLog("👂 start"),!Ec(e))return;const t=JSON.stringify([e.ids,e.query,e.limit,e.orderBy].map(i=>i?.toString?.()??String(i)));if(this.live&&this.prevStartQuery===t)return;this.stop(),this.prevStartQuery=t;const r=oa(e,!0),s=r?nh(this.ref,...r):this.ref;this.snapshotFnStop=AA(s,async i=>{const a=i.docChanges();this.isFirstRun&&(this.debugLog("👂 firstRun"),this.isFirstRun=!1,this.onStartFirstRun(a,e.forceLocalSet),e.forceLocalSet&&(this.items={},this.localClear()));for(const c of a){const u=c.doc.id;if(c.type==="removed"){this.items[u]?.localSet(!0),delete this.items[u];continue}const h=c.doc.data(),f=this.makeModel(u,h),m=await f.onGetBeforeStoreSet(f);this.items[u]=m,m.canLocalSave(e.localSet)&&m.localSet()}},i=>{this.stop(),nt(i)})}onStartFirstRun(e,t){}stop(){this.snapshotFnStop&&(this.debugLog("🛑 stop"),this.prevStartQuery=null,this.snapshotFnStop(),this.snapshotFnStop=null,this.isFirstRun=!0)}async add(e,{offlineAllow:t=ge.offlineAllow,localSet:r=ge.localSet}=ge){try{this.debugLog("add"),ub(t);const{id:s,...i}=e,a=Ge.stripUndefinedDeep(i);let c=s??"";if(s){const h=Ir(exports.db,this.collectionPath,s);if((await ta(h)).exists())throw new Error("Documento già esistente")}else c=Ir(this.ref).id;const u=this.makeModel(c,a);return await u.save({offlineAllow:t,touchUpdate:!0,localSet:r}),this.items[c]=u,u}catch(s){throw nt(s),s}}async delete(e,t=ge){try{if(this.items[e]){const r=this.items[e].deleteJustOnline_NotLocalStore(t);return delete this.items[e],await r}}catch(r){throw nt(r),r}}findByUid(e){if(!(!this.itemsArray||!this.itemsArray.length))return this.itemsArray.find(t=>t.uid===e)}async getOne(e,t){this.debugLog("getOne");try{const r=Ir(exports.db,this.collectionPath,e),s=await ta(r);if(!s.exists())throw this.items[e]&&delete this.items[e],new Error("[404] non trovato");const i=s.data(),a=this.makeModel(e,i),c=await a.onGetBeforeStoreSet(a);return this.items[e]=c,c.canLocalSave(t?.localSet)&&c.localSet(),c}catch(r){throw nt(r),r}}async ensureOne(e){const t=this.items[e];return t||this.getOne(e)}localClear(){const e=this.localStorageKey;Ce.has(e)?(Ce.remove(e),U.log(`LocalStorage "${e}" svuotato con successo.`)):U.log(`Nessun dato trovato per LocalStorage "${e}".`)}}function Ec(n){if(n.ids&&n.ids.length>0){if(n.ids.length>10)return U.logError("Non puoi lanciare start con più di 10 id"),!1;if(n.query)return U.logError('Non è supportato usare "query" insieme a "ids" in start()'),!1}if(n.lastByCreate||n.lastByUpdate){if(n.lastByCreate&&n.lastByUpdate)return U.logError("Non puoi usare lastByCreate e lastByUpdate insieme"),!1;if(n.limit||n.orderBy)return U.logError("Non puoi usare limit o orderBy insieme a lastByCreate / lastByUpdate"),!1}return!0}function oa(n,e=!1){if(!e&&!Ec(n))return!1;const t=[];if(n.ids&&n.ids.length>0){const r=Array.from(new Set(n.ids.map(s=>(s??"").trim()).filter(Boolean)));r.length===1?t.push(ea(Xo(),"==",r[0])):r.length>1&&t.push(ea(Xo(),"in",r))}else n.query&&t.push(...Array.isArray(n.query)?n.query:[n.query]);return n.lastByCreate?(t.push(To("createdAt","desc")),t.push(wo(n.lastByCreate)),t):n.lastByUpdate?(t.push(To("updatedAt","desc")),t.push(wo(n.lastByUpdate)),t):(n.orderBy&&t.push(To(n.orderBy.fieldPath,n.orderBy.directionStr??"asc")),n.limit&&t.push(wo(n.limit)),t)}function db(n){let e=null;_.onBeforeUnmount(()=>{e?.(),e=null;for(const t of n)t.store.stop()})}const Op={SUPERADMIN:"SUPERADMIN",ADMIN:"ADMIN",MODAL_DEV_ON:"MODAL_DEV_ON",MANAGE_USERS:"MANAGE_USERS",OFFLINE_ALLOW:"OFFLINE_ALLOW",BETA_FEATURES:"BETA_FEATURES"};class fb extends Ge{static collectionName="users";localStorageKey(){return Ce.defaultKey.currentUser}userPublicId;name;surname;email;birthDate;phoneNumber;photoURL;description;permissions;gender;birthHideYear;fcmTokens;constructor(e){super(e),this.userPublicId=e.userPublicId,this.name=e.name,this.surname=e.surname,this.email=e.email,this.birthDate=e.birthDate,this.phoneNumber=e.phoneNumber,this.photoURL=e.photoURL,this.description=e.description,this.permissions=e.permissions??[],this.gender=e.gender,this.birthHideYear=e.birthHideYear,this.fcmTokens=e.fcmTokens}toData(){return{id:this.id,userPublicId:this.userPublicId,name:this.name,surname:this.surname,email:this.email,birthDate:this.birthDate,phoneNumber:this.phoneNumber,photoURL:this.photoURL,description:this.description,permissions:this.permissions,gender:this.gender,birthHideYear:this.birthHideYear,fcmTokens:this.fcmTokens}}async create(){try{const e=this.toData(),t=Object.fromEntries(Object.entries(e).map(([r,s])=>s==null?[r,Zo()]:[r,s]));t.permissions!==void 0&&delete t.permissions,await gp(this.ref,t,{merge:!0})}catch(e){throw U.error(String(e)),e}}get fullName(){let e=`${this.name} ${this.surname}`.trim();return e===""&&(e="-"),e}get fullNameInitials(){const e=this.fullName,t=e.split(" ").filter(Boolean);return((t[0]?.[0]||"")+(t[1]?.[0]||"")||e?.[0]||"?").toUpperCase()}async updateName(e,t){await this.update({name:e,surname:t})}async updateBirthDate(e){await this.update({birthDate:e})}hasPermission(e){return Array.isArray(this.permissions)&&this.permissions.includes(e)}hasAnyPermissions(){return Array.isArray(this.permissions)&&this.permissions.length>0}hasAnyPermissionsExclud(e){return!Array.isArray(this.permissions)||this.permissions.length===0?!1:this.permissions.some(t=>!e.includes(t))}get offlineAllow(){return this.hasPermission(Op.OFFLINE_ALLOW)}async addPermissions(e){const r=(Array.isArray(e)?e:[e]).filter(s=>!this.permissions.includes(s));return r.length===0?!1:(this.permissions.push(...r),this.update({permissions:this.permissions}).then(()=>!0))}async deletePermissions(e){const t=Array.isArray(e)?e:[e],r=this.permissions.length;return this.permissions=this.permissions.filter(s=>!t.includes(s)),this.permissions.length===r?!1:this.update({permissions:this.permissions}).then(()=>!0)}hasFcmToken(e){return e?(this.fcmTokens??[]).includes(e):!1}async addFcmToken(e){return Array.isArray(this.fcmTokens)||(this.fcmTokens=[]),this.hasFcmToken(e)?!1:(this.fcmTokens.push(e),this.update({fcmTokens:this.fcmTokens}).then(()=>!0))}async removeFcmToken(e){if(!Array.isArray(this.fcmTokens)||this.fcmTokens.length===0)return!1;const t=this.fcmTokens.length;return this.fcmTokens=this.fcmTokens.filter(r=>r!==e),this.fcmTokens.length===t?!1:this.update({fcmTokens:this.fcmTokens}).then(()=>!0)}}function wh(n){const e=typeof n=="string"?{title:n}:n,{title:t,...r}=e;return r.icon||(r.icon="/img/logo/pwa.png"),r.tag||(r.tag=`default-${new Date().toISOString().slice(0,10)}`),r.data||(r.data={url:"/"}),r?.data?.url||(r.data.url="/"),{title:t,options:r}}const aa=_.reactive({reg:void 0,VAPID_PUBLIC_KEY:void 0,isNotificationSupported:typeof Notification<"u",get permission(){return this.isNotificationSupported?Notification.permission:"denied"},get needToAskPermission(){return this.isNotificationSupported?Notification.permission==="default":!1},async askPermission(n){if(!aa.isNotificationSupported)return U.error("Le notifiche non sono supportate su questo dispositivo"),"denied";aa.permission==="denied"&&U.warning("Notifiche disabilitate. Per abilitarle cercare nelle impostazioni del browser.");const e=await Notification.requestPermission();return e!=="granted"?U.warning("Hai disabilitato le notifiche. Per abilitarle cercare nelle impostazioni del browser."):this.registerFcmToken(n),e},async send(n,e){if(!this.isNotificationSupported){U.error("Le notifiche non sono supportate su questo dispositivo");return}if(this.permission!=="granted"&&await this.askPermission(n)!=="granted")return;const{title:t,options:r}=wh(e);this.reg?await this.reg.showNotification(t,r):new Notification(t,r)},async sendTo(n,e){let t=!1;try{const r=T0(exports.functions,"sendUserPush"),{title:s,options:i}=wh(e);console.log({title:s,options:i}),await r({toUid:n,title:s,options:i}),t=!0}catch(r){console.error(r),U.error("Errore invio notifica")}return t},async getCurrentFcmToken(){return ra(),this.isNotificationSupported?this.reg?this.VAPID_PUBLIC_KEY?await ob(exports.messaging,{vapidKey:this.VAPID_PUBLIC_KEY,serviceWorkerRegistration:this.reg}).catch(()=>null)||null:(U.error("VAPID_PUBLIC_KEY mancante"),null):(U.error("ServiceWorker non registrato"),null):null},async registerFcmToken(n){if(ra(),!this.isNotificationSupported)return null;this.needToAskPermission&&await this.askPermission(n);const e=await this.getCurrentFcmToken();return e?(await n.addFcmToken(e)?U.success("Abilitato"):U.warning("Token non aggiunto possibilmente già presente."),e):null},async removeThisDeviceToken(n){const e=await this.getCurrentFcmToken();let t=!1;try{t=await ab(exports.messaging)}catch(s){console.warn("deleteToken() failed (continuo con cleanup lato currentUser):",s)}let r=!1;if(e)try{r=await n.removeFcmToken(e)}catch(s){console.warn("removeFcmToken() user failed:",s)}return t||r?(U.success("Notifiche disattivate per questo dispositivo."),!0):(U.warning("Nessun token da rimuovere per questo dispositivo."),!1)}});function bs(n){const e=globalThis.structuredClone;if(typeof e=="function")try{return e(n)}catch{return Nt(n)}return Nt(n)}function Nt(n,e=new WeakMap){if(n===null||typeof n!="object")return n;if(e.has(n))return e.get(n);if(n instanceof Date)return new Date(n.getTime());if(n instanceof Map){const r=new Map;return e.set(n,r),n.forEach((s,i)=>r.set(Nt(i,e),Nt(s,e))),r}if(n instanceof Set){const r=new Set;return e.set(n,r),n.forEach(s=>r.add(Nt(s,e))),r}if(Array.isArray(n)){const r=new Array(n.length);e.set(n,r);for(let s=0;s<n.length;s++)r[s]=Nt(n[s],e);return r}const t={};e.set(n,t);for(const r of Object.keys(n))t[r]=Nt(n[r],e);for(const r of Object.getOwnPropertySymbols(n))t[r]=Nt(n[r],e);return t}const pb=(n,e="")=>{const t=n.trim();if(t.startsWith("+")){const r=t.match(/^\+(\d{1,3})\s*(.+)$/);if(r)return[`+${r[1]}`,(r[2]??"").replace(/\s+/g,"")]}return[e,t.replace(/\s+/g,"")]};class mb{id;values;errors;touched;_initial;schema;_onSubmit;_onInvalid;_validateOnChangeMap;_touchOnChangeMap;_stopWatch;_fieldCache={};_allFields;_submitOnChange;_suspendAutoSubmit=!1;_debouncedSubmit;_syncPreference;_effects;_onAnyChange;_makeDebouncedSubmit(e){let t;return()=>{t&&clearTimeout(t),t=window.setTimeout(()=>{this._suspendAutoSubmit||this.submit()},e)}}constructor(e,t){this.id=e.id??"";const r=S=>"initialValues"in S;this._syncPreference=r(e)&&e.syncPreference?e.syncPreference:"db";const s=r(e)?e.initialValues:e,i=Object.keys(s),a=(S,k)=>{const V={};for(const N of i)V[N]=k;if(typeof S=="boolean")for(const N of i)V[N]=S;else S&&typeof S=="object"&&Object.assign(V,S);return V},c=(r(e)?e.validator:t)??{},u=r(e)?e.onSubmit:void 0,h=r(e)?e.onInvalid:void 0,f=r(e)?e.validateOnChange:void 0,m=r(e)?e.touchOnChange:void 0;this._validateOnChangeMap=a(f,!0),this._touchOnChangeMap=a(m,!0);const y=r(e)?e.syncWith:void 0;this._initial=bs(s),this.values=_.reactive(bs(s)),this.errors=_.reactive(Object.keys(s).reduce((S,k)=>(S[k]=null,S),{})),this.touched=_.reactive(Object.keys(s).reduce((S,k)=>(S[k]=!1,S),{})),this.schema=c,this._onSubmit=u,this._onInvalid=h,this._submitOnChange=r(e)?e.submitOnChange:void 0,this._effects=r(e)?e.effects:void 0,this._onAnyChange=r(e)?e.onAnyChange:void 0,typeof this._submitOnChange=="number"&&this._submitOnChange>=0&&(this._debouncedSubmit=this._makeDebouncedSubmit(this._submitOnChange)),y&&(_.isRef(y)?this._stopWatch=_.watch(y,S=>{S&&this.fill(S)},{immediate:!0}):typeof y=="function"&&(this._stopWatch=_.watch(y,S=>{S&&this.fill(S)},{immediate:!0})))}touch(e){this.touched[e]=!0}touchAll(){for(const e of Object.keys(this.touched))this.touched[e]=!0}field(e){const t=this._fieldCache[e];if(t)return t;const r=_.computed({get:()=>this.values[e],set:s=>this.set(e,s)});return this._fieldCache[e]=r,r}fields(){if(!this._allFields){const e={};for(const t of Object.keys(this.values))e[t]=this.field(t);this._allFields=e}return this._allFields}set(e,t,r){this.values[e]=t,!this.touched[e]&&(this._touchOnChangeMap[e]??!1)&&(this.touched[e]=!0),(r??!!this._validateOnChangeMap[e])&&this.validateField(e),this._effects?.[e]?.(t,this),this._onAnyChange?.(e,t,this),!this._suspendAutoSubmit&&this._submitOnChange&&(this._submitOnChange===!0?this.submit():typeof this._submitOnChange=="number"&&this._debouncedSubmit?.())}validateField(e){const t=this.schema[e]??[];for(const r of t){const s=r(this.values[e]);if(this.errors[e]=s,s)return!1}return this.errors[e]=null,!0}validateAll(){let e=!0;for(const t of Object.keys(this.values))this.validateField(t)||(this.touch(t),e=!1);return e}fill(e,t){let{validate:r}=t??{};r===void 0&&(r=!1),this._suspendAutoSubmit=!0;try{for(const s in e){if(!(s in this.values))continue;const i=s;this._syncPreference==="local"&&this.touched[i]||(this.values[i]=e[i])}r&&this.validateAll()}finally{this._suspendAutoSubmit=!1}}reset({keepTouched:e=!1}={}){for(const t of Object.keys(this._initial))this.values[t]=this._initial[t];for(const t of Object.keys(this.errors))this.errors[t]=null;if(!e)for(const t of Object.keys(this.touched))this.touched[t]=!1}resetWithInitialValues(e){this._initial=bs(e),this.reset()}bindField(e,t){return _.computed({get:()=>this.values[e],set:r=>this.set(e,r,t??this._validateOnChangeMap[e]??!1)})}showError(e){return this.touched[e]?this.errors[e]:null}hasError(e){return!!this.showError(e)}getFieldId(e){return`${this.id!==""?this.id+"_":""}field_${String(e)}`}getFieldIdError(e){return`${this.getFieldId(e)}-error`}getFieldProps(e){return{id:this.getFieldId(e),"aria-invalid":this.hasError(e),"aria-describedby":this.getFieldIdError(e),class:{"is-invalid":!!this.showError(e)}}}get isValid(){return Object.values(this.errors).every(e=>e==null)}get isDirty(){return JSON.stringify(this.values)!==JSON.stringify(this._initial)}get touchedValues(){const e={};for(const t of Object.keys(this.values))this.touched[t]&&(e[t]=this.values[t]);return e}dispose(){this._stopWatch?.()}submit=async()=>{if(!this.validateAll()){this._onInvalid?.(this.errors);return}await this._onSubmit?.(this.values,this.touchedValues,this.touched)};setSyncPreference(e){this._syncPreference=e}}const gb=(n="Obbligatorio")=>e=>e==null||typeof e=="string"&&e.trim().length===0||Array.isArray(e)&&e.length===0?n:null,_b=(n="Email non valida")=>e=>e?/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)?null:n:null,yb=(n="Formato richiesto: AAAA-MM-GG")=>e=>e?/^\d{4}-\d{2}-\d{2}$/.test(e)?null:n:null,Tb=(n="URL non valido")=>e=>{if(!e)return null;try{return new URL(e),null}catch{return n}},wb=(n,e="Seleziona un’opzione")=>t=>t?n.includes(t)?null:e:null,Eb=(n="Devi accettare")=>e=>e?null:n,vb=(n="Deve essere un numero")=>e=>e==null||e===""?null:isNaN(Number(e))?n:null,Ib=(n,e)=>t=>{if(t==null||t==="")return null;const r=Number(t);return isNaN(r)?e??"Deve essere un numero":r<n?e??`Il numero deve essere ≥ ${n}`:null},Ab=(n,e)=>t=>{if(t==null||t==="")return null;const r=Number(t);return isNaN(r)?e??"Deve essere un numero":r>n?e??`Il numero deve essere ≤ ${n}`:null},bb=(n,e)=>t=>t&&t.length<n?e??`Minimo ${n} caratteri`:null,Sb=(n,e)=>t=>t&&t.length>n?e??`Massimo ${n} caratteri`:null,Lp=/^(?=.*[A-Z])(?=.*\d)(?!.*\s).+$/,Rb=(n="La password deve contenere almeno una maiuscola, un numero e nessuno spazio")=>e=>e?Lp.test(e)?null:n:null,Pb=(n,e)=>t=>t?t.length<n?e??`La password deve avere almeno ${n} caratteri`:Lp.test(t)?null:e??"La password deve contenere almeno una maiuscola, un numero e nessuno spazio":null,Cb=(n,e="Le password non coincidono")=>t=>{if(!t)return null;const r=n()??"";return t===r?null:e};function un(n){if(!n)return null;if(n instanceof Date)return isNaN(n.getTime())?null:n;if(/^\d{4}-\d{2}-\d{2}$/.test(n)){const e=new Date(n+"T00:00:00");return isNaN(e.getTime())?null:e}return null}const kb=(n,e="La data deve essere successiva")=>t=>{if(!t)return null;const r=un(t),s=un(n());return!r||!s||r>=s?null:e},Nb=(n,e="La data deve essere precedente")=>t=>{if(!t)return null;const r=un(t),s=un(n());return!r||!s||r<=s?null:e},Db=(n,e,t="La data deve essere compresa nell’intervallo")=>r=>{if(!r)return null;const s=un(r),i=un(n()),a=un(e());return!s||!i||!a||s>=i&&s<=a?null:t},ni=n=>String(n).padStart(2,"0");function ri(n){return n instanceof Date&&!isNaN(n.getTime())}function Ni(n){if(!n)return null;if(n instanceof Date)return ri(n)?n:null;if(n instanceof z)return n.toDate();if(typeof n=="string"||typeof n=="number"){const e=new Date(n);return ri(e)?e:null}return null}function Mp(n){const e=Ni(n);return e?`${e.getFullYear()}-${ni(e.getMonth()+1)}-${ni(e.getDate())}`:""}function xp(n){const e=Ni(n);return e?`${ni(e.getHours())}:${ni(e.getMinutes())}`:""}function Vb(n){const e=Ni(n);return e?`${Mp(e)}T${xp(e)}`:""}function Ob(n){if(!n)return null;const e=new Date(`${n}T00:00:00`);return ri(e)?e:null}function Lb(n,e){if(!n)return null;console.log(e);const t=e&&e!==""?e:"00:00";console.log(`${n}T${t}:00`);const r=new Date(`${n}T${t}:00`);return ri(r)?z.fromDate(r):null}function Mb(n,e=""){return n==null?e:String(n)}function xb(n){if(n==null||n==="")return"";const e=Number(n);return isNaN(e)?"":e}function Fb(n){return!!n}function Ub(n){return Array.isArray(n)?n.map(e=>String(e)).filter(Boolean):[]}function Bb(n,e){if(!n)return"";const t=String(n);return e&&!e.includes(t)?"":t}function qb(n,e=void 0){const t=Ni(n);return t?t.toLocaleString(e):""}function $b(n){if(n==null)return"-";const e=String(n).trim();return e===""?"-":e}const jb={install(n){n.component("AccordionCmp",Eh),n.component("BtnCmp",gr),n.component("ToastCmp",Ah),n.component("FieldGender",bh),n.component("FieldPhoneNumber",Sh),n.component("InputField",Rh)}};exports.AccordionCmp=Eh;exports.BtnCmp=gr;exports.FieldGender=bh;exports.FieldPhoneNumber=Sh;exports.FirestoreModel=Ge;exports.FirestoreStore=hb;exports.FormValidator=mb;exports.InputField=Rh;exports.LS=Ce;exports.Toast=vh;exports.ToastCmp=Ah;exports.User=fb;exports.buildConstraintsFromGetProps=oa;exports.cicKitStore=je;exports.clone=bs;exports.dateAfter=kb;exports.dateBefore=Nb;exports.dateBetween=Db;exports.dateISO=yb;exports.default=jb;exports.defaultUserPermission=Op;exports.email=_b;exports.emptyToDash=$b;exports.ensureFirebase=ra;exports.fireDebugLog=ti;exports.inputDateTimeToTimestamp=Lb;exports.inputDateToDate=Ob;exports.isBrowserOffline=wc;exports.isBrowserOnline=Vp;exports.isNumber=vb;exports.maxLength=Sb;exports.maxNumber=Ab;exports.middlewareCatchCall=nt;exports.minLength=bb;exports.minNumber=Ib;exports.oneOf=wb;exports.optionFireModelDefault=ge;exports.password=Rb;exports.passwordRetype=Cb;exports.passwordWithMin=Pb;exports.phoneNumberFromString=pb;exports.pushMsg=aa;exports.required=gb;exports.requiredTrue=Eb;exports.reviveTimestamp=Ar;exports.reviveTimestampsDeep=sa;exports.serializeTimestamp=ei;exports.setupFirebase=cb;exports.shareLink=Ih;exports.signInWithPopup=cw;exports.timestampInputDate=Mp;exports.timestampInputDateTimeLocal=Vb;exports.timestampInputTime=xp;exports.timestampToLocale=qb;exports.toast=U;exports.url=Tb;exports.useStoreWatch=db;exports.validateQueryGetOpts=Ec;exports.valueToInputBoolean=Fb;exports.valueToInputNumber=xb;exports.valueToInputString=Mb;exports.valueToSelect=Bb;exports.valueToStringArray=Ub;
|
|
38
|
+
`);c=m.pop()||"";for(const y of m)y.trim()&&s(y.trim(),a);return u()}catch(h){const f=h instanceof Le?h:Xs(0,null);a.error(f),t(f)}}},cancel(){return n.cancel()}})}const hh="@firebase/functions",dh="0.13.1";const p0="auth-internal",m0="app-check-internal",g0="messaging-internal";function _0(n){const e=(t,{instanceIdentifier:r})=>{const s=t.getProvider("app").getImmediate(),i=t.getProvider(p0),a=t.getProvider(g0),c=t.getProvider(m0);return new i0(s,i,a,c,r)};Me(new Ne(pc,e,"PUBLIC").setMultipleInstances(!0)),me(hh,dh,n),me(hh,dh,"esm2020")}function y0(n=$n(),e=na){const r=ut(ee(n),pc).getImmediate({identifier:e}),s=la("functions");return s&&bp(r,...s),r}function bp(n,e,t){o0(ee(n),e,t)}function T0(n,e,t){return a0(ee(n),e)}_0();const w0="/firebase-messaging-sw.js",E0="/firebase-cloud-messaging-push-scope",Sp="BDOU99-h67HcA6JeFXHbSNMu7e2yNNu3RzoMj8TM4W88jITfq7ZmPvIM1Iv-4_l2LxQcYwhqby2xGpWwzjfAnG4",v0="https://fcmregistrations.googleapis.com/v1",Rp="google.c.a.c_id",I0="google.c.a.c_l",A0="google.c.a.ts",b0="google.c.a.e",fh=1e4;var ph;(function(n){n[n.DATA_MESSAGE=1]="DATA_MESSAGE",n[n.DISPLAY_NOTIFICATION=3]="DISPLAY_NOTIFICATION"})(ph||(ph={}));var Lr;(function(n){n.PUSH_RECEIVED="push-received",n.NOTIFICATION_CLICKED="notification-clicked"})(Lr||(Lr={}));function dt(n){const e=new Uint8Array(n);return btoa(String.fromCharCode(...e)).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function S0(n){const e="=".repeat((4-n.length%4)%4),t=(n+e).replace(/\-/g,"+").replace(/_/g,"/"),r=atob(t),s=new Uint8Array(r.length);for(let i=0;i<r.length;++i)s[i]=r.charCodeAt(i);return s}const vo="fcm_token_details_db",R0=5,mh="fcm_token_object_Store";async function P0(n){if("databases"in indexedDB&&!(await indexedDB.databases()).map(i=>i.name).includes(vo))return null;let e=null;return(await ci(vo,R0,{upgrade:async(r,s,i,a)=>{if(s<2||!r.objectStoreNames.contains(mh))return;const c=a.objectStore(mh),u=await c.index("fcmSenderId").get(n);if(await c.clear(),!!u){if(s===2){const h=u;if(!h.auth||!h.p256dh||!h.endpoint)return;e={token:h.fcmToken,createTime:h.createTime??Date.now(),subscriptionOptions:{auth:h.auth,p256dh:h.p256dh,endpoint:h.endpoint,swScope:h.swScope,vapidKey:typeof h.vapidKey=="string"?h.vapidKey:dt(h.vapidKey)}}}else if(s===3){const h=u;e={token:h.fcmToken,createTime:h.createTime,subscriptionOptions:{auth:dt(h.auth),p256dh:dt(h.p256dh),endpoint:h.endpoint,swScope:h.swScope,vapidKey:dt(h.vapidKey)}}}else if(s===4){const h=u;e={token:h.fcmToken,createTime:h.createTime,subscriptionOptions:{auth:dt(h.auth),p256dh:dt(h.p256dh),endpoint:h.endpoint,swScope:h.swScope,vapidKey:dt(h.vapidKey)}}}}}})).close(),await io(vo),await io("fcm_vapid_details_db"),await io("undefined"),C0(e)?e:null}function C0(n){if(!n||!n.subscriptionOptions)return!1;const{subscriptionOptions:e}=n;return typeof n.createTime=="number"&&n.createTime>0&&typeof n.token=="string"&&n.token.length>0&&typeof e.auth=="string"&&e.auth.length>0&&typeof e.p256dh=="string"&&e.p256dh.length>0&&typeof e.endpoint=="string"&&e.endpoint.length>0&&typeof e.swScope=="string"&&e.swScope.length>0&&typeof e.vapidKey=="string"&&e.vapidKey.length>0}const k0="firebase-messaging-database",N0=1,_n="firebase-messaging-store";let Io=null;function mc(){return Io||(Io=ci(k0,N0,{upgrade:(n,e)=>{e===0&&n.createObjectStore(_n)}})),Io}async function Pp(n){const e=_c(n),r=await(await mc()).transaction(_n).objectStore(_n).get(e);if(r)return r;{const s=await P0(n.appConfig.senderId);if(s)return await gc(n,s),s}}async function gc(n,e){const t=_c(n),s=(await mc()).transaction(_n,"readwrite");return await s.objectStore(_n).put(e,t),await s.done,e}async function D0(n){const e=_c(n),r=(await mc()).transaction(_n,"readwrite");await r.objectStore(_n).delete(e),await r.done}function _c({appConfig:n}){return n.appId}const V0={"missing-app-config-values":'Missing App configuration value: "{$valueName}"',"only-available-in-window":"This method is available in a Window context.","only-available-in-sw":"This method is available in a service worker context.","permission-default":"The notification permission was not granted and dismissed instead.","permission-blocked":"The notification permission was not granted and blocked instead.","unsupported-browser":"This browser doesn't support the API's required to use the Firebase SDK.","indexed-db-unsupported":"This browser doesn't support indexedDb.open() (ex. Safari iFrame, Firefox Private Browsing, etc)","failed-service-worker-registration":"We are unable to register the default service worker. {$browserErrorMessage}","token-subscribe-failed":"A problem occurred while subscribing the user to FCM: {$errorInfo}","token-subscribe-no-token":"FCM returned no token when subscribing the user to push.","token-unsubscribe-failed":"A problem occurred while unsubscribing the user from FCM: {$errorInfo}","token-update-failed":"A problem occurred while updating the user from FCM: {$errorInfo}","token-update-no-token":"FCM returned no token when updating the user to push.","use-sw-after-get-token":"The useServiceWorker() method may only be called once and must be called before calling getToken() to ensure your service worker is used.","invalid-sw-registration":"The input to useServiceWorker() must be a ServiceWorkerRegistration.","invalid-bg-handler":"The input to setBackgroundMessageHandler() must be a function.","invalid-vapid-key":"The public VAPID key must be a string.","use-vapid-key-after-get-token":"The usePublicVapidKey() method may only be called once and must be called before calling getToken() to ensure your VAPID key is used."},be=new Kt("messaging","Messaging",V0);async function O0(n,e){const t=await Tc(n),r=kp(e),s={method:"POST",headers:t,body:JSON.stringify(r)};let i;try{i=await(await fetch(yc(n.appConfig),s)).json()}catch(a){throw be.create("token-subscribe-failed",{errorInfo:a?.toString()})}if(i.error){const a=i.error.message;throw be.create("token-subscribe-failed",{errorInfo:a})}if(!i.token)throw be.create("token-subscribe-no-token");return i.token}async function L0(n,e){const t=await Tc(n),r=kp(e.subscriptionOptions),s={method:"PATCH",headers:t,body:JSON.stringify(r)};let i;try{i=await(await fetch(`${yc(n.appConfig)}/${e.token}`,s)).json()}catch(a){throw be.create("token-update-failed",{errorInfo:a?.toString()})}if(i.error){const a=i.error.message;throw be.create("token-update-failed",{errorInfo:a})}if(!i.token)throw be.create("token-update-no-token");return i.token}async function Cp(n,e){const r={method:"DELETE",headers:await Tc(n)};try{const i=await(await fetch(`${yc(n.appConfig)}/${e}`,r)).json();if(i.error){const a=i.error.message;throw be.create("token-unsubscribe-failed",{errorInfo:a})}}catch(s){throw be.create("token-unsubscribe-failed",{errorInfo:s?.toString()})}}function yc({projectId:n}){return`${v0}/projects/${n}/registrations`}async function Tc({appConfig:n,installations:e}){const t=await e.getToken();return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":n.apiKey,"x-goog-firebase-installations-auth":`FIS ${t}`})}function kp({p256dh:n,auth:e,endpoint:t,vapidKey:r}){const s={web:{endpoint:t,auth:e,p256dh:n}};return r!==Sp&&(s.web.applicationPubKey=r),s}const M0=10080*60*1e3;async function x0(n){const e=await B0(n.swRegistration,n.vapidKey),t={vapidKey:n.vapidKey,swScope:n.swRegistration.scope,endpoint:e.endpoint,auth:dt(e.getKey("auth")),p256dh:dt(e.getKey("p256dh"))},r=await Pp(n.firebaseDependencies);if(r){if(q0(r.subscriptionOptions,t))return Date.now()>=r.createTime+M0?U0(n,{token:r.token,createTime:Date.now(),subscriptionOptions:t}):r.token;try{await Cp(n.firebaseDependencies,r.token)}catch(s){console.warn(s)}return gh(n.firebaseDependencies,t)}else return gh(n.firebaseDependencies,t)}async function F0(n){const e=await Pp(n.firebaseDependencies);e&&(await Cp(n.firebaseDependencies,e.token),await D0(n.firebaseDependencies));const t=await n.swRegistration.pushManager.getSubscription();return t?t.unsubscribe():!0}async function U0(n,e){try{const t=await L0(n.firebaseDependencies,e),r={...e,token:t,createTime:Date.now()};return await gc(n.firebaseDependencies,r),t}catch(t){throw t}}async function gh(n,e){const r={token:await O0(n,e),createTime:Date.now(),subscriptionOptions:e};return await gc(n,r),r.token}async function B0(n,e){const t=await n.pushManager.getSubscription();return t||n.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:S0(e)})}function q0(n,e){const t=e.vapidKey===n.vapidKey,r=e.endpoint===n.endpoint,s=e.auth===n.auth,i=e.p256dh===n.p256dh;return t&&r&&s&&i}function _h(n){const e={from:n.from,collapseKey:n.collapse_key,messageId:n.fcmMessageId};return $0(e,n),j0(e,n),z0(e,n),e}function $0(n,e){if(!e.notification)return;n.notification={};const t=e.notification.title;t&&(n.notification.title=t);const r=e.notification.body;r&&(n.notification.body=r);const s=e.notification.image;s&&(n.notification.image=s);const i=e.notification.icon;i&&(n.notification.icon=i)}function j0(n,e){e.data&&(n.data=e.data)}function z0(n,e){if(!e.fcmOptions&&!e.notification?.click_action)return;n.fcmOptions={};const t=e.fcmOptions?.link??e.notification?.click_action;t&&(n.fcmOptions.link=t);const r=e.fcmOptions?.analytics_label;r&&(n.fcmOptions.analyticsLabel=r)}function H0(n){return typeof n=="object"&&!!n&&Rp in n}function G0(n){if(!n||!n.options)throw Ao("App Configuration Object");if(!n.name)throw Ao("App Name");const e=["projectId","apiKey","appId","messagingSenderId"],{options:t}=n;for(const r of e)if(!t[r])throw Ao(r);return{appName:n.name,projectId:t.projectId,apiKey:t.apiKey,appId:t.appId,senderId:t.messagingSenderId}}function Ao(n){return be.create("missing-app-config-values",{valueName:n})}class K0{constructor(e,t,r){this.deliveryMetricsExportedToBigQueryEnabled=!1,this.onBackgroundMessageHandler=null,this.onMessageHandler=null,this.logEvents=[],this.isLogServiceStarted=!1;const s=G0(e);this.firebaseDependencies={app:e,appConfig:s,installations:t,analyticsProvider:r}}_delete(){return Promise.resolve()}}async function Np(n){try{n.swRegistration=await navigator.serviceWorker.register(w0,{scope:E0}),n.swRegistration.update().catch(()=>{}),await W0(n.swRegistration)}catch(e){throw be.create("failed-service-worker-registration",{browserErrorMessage:e?.message})}}async function W0(n){return new Promise((e,t)=>{const r=setTimeout(()=>t(new Error(`Service worker not registered after ${fh} ms`)),fh),s=n.installing||n.waiting;n.active?(clearTimeout(r),e()):s?s.onstatechange=i=>{i.target?.state==="activated"&&(s.onstatechange=null,clearTimeout(r),e())}:(clearTimeout(r),t(new Error("No incoming service worker found.")))})}async function Q0(n,e){if(!e&&!n.swRegistration&&await Np(n),!(!e&&n.swRegistration)){if(!(e instanceof ServiceWorkerRegistration))throw be.create("invalid-sw-registration");n.swRegistration=e}}async function J0(n,e){e?n.vapidKey=e:n.vapidKey||(n.vapidKey=Sp)}async function Dp(n,e){if(!navigator)throw be.create("only-available-in-window");if(Notification.permission==="default"&&await Notification.requestPermission(),Notification.permission!=="granted")throw be.create("permission-blocked");return await J0(n,e?.vapidKey),await Q0(n,e?.serviceWorkerRegistration),x0(n)}async function Y0(n,e,t){const r=X0(e);(await n.firebaseDependencies.analyticsProvider.get()).logEvent(r,{message_id:t[Rp],message_name:t[I0],message_time:t[A0],message_device_time:Math.floor(Date.now()/1e3)})}function X0(n){switch(n){case Lr.NOTIFICATION_CLICKED:return"notification_open";case Lr.PUSH_RECEIVED:return"notification_foreground";default:throw new Error}}async function Z0(n,e){const t=e.data;if(!t.isFirebaseMessaging)return;n.onMessageHandler&&t.messageType===Lr.PUSH_RECEIVED&&(typeof n.onMessageHandler=="function"?n.onMessageHandler(_h(t)):n.onMessageHandler.next(_h(t)));const r=t.data;H0(r)&&r[b0]==="1"&&await Y0(n,t.messageType,r)}const yh="@firebase/messaging",Th="0.12.23";const eb=n=>{const e=new K0(n.getProvider("app").getImmediate(),n.getProvider("installations-internal").getImmediate(),n.getProvider("analytics-internal"));return navigator.serviceWorker.addEventListener("message",t=>Z0(e,t)),e},tb=n=>{const e=n.getProvider("messaging").getImmediate();return{getToken:r=>Dp(e,r)}};function nb(){Me(new Ne("messaging",eb,"PUBLIC")),Me(new Ne("messaging-internal",tb,"PRIVATE")),me(yh,Th),me(yh,Th,"esm2020")}async function rb(){try{await ha()}catch{return!1}return typeof window<"u"&&ua()&&Mh()&&"serviceWorker"in navigator&&"PushManager"in window&&"Notification"in window&&"fetch"in window&&ServiceWorkerRegistration.prototype.hasOwnProperty("showNotification")&&PushSubscription.prototype.hasOwnProperty("getKey")}async function sb(n){if(!navigator)throw be.create("only-available-in-window");return n.swRegistration||await Np(n),F0(n)}function ib(n=$n()){return rb().then(e=>{if(!e)throw be.create("unsupported-browser")},e=>{throw be.create("indexed-db-unsupported")}),ut(ee(n),"messaging").getImmediate()}async function ob(n,e){return n=ee(n),Dp(n,e)}function ab(n){return n=ee(n),sb(n)}nb();let He=null;exports.auth=void 0;exports.provider=void 0;exports.analytics=void 0;exports.db=void 0;exports.storage=void 0;exports.functions=void 0;exports.messaging=void 0;function cb(n){if(He)return He;const{functionsRegion:e,...t}=n;return He=Uh(t),exports.auth=Zw(He),exports.provider=new ft,exports.analytics=Xy(He),exports.db=aA(He),exports.storage=JA(He),exports.functions=y0(He,e),exports.messaging=ib(He),je.isDev&&(op(exports.db,"localhost",8080),bd(exports.auth,"http://localhost:9099"),bp(exports.functions,"localhost",5001),Ep(exports.storage,"localhost",9199)),He}function ra(){if(!He)throw new Error("[cic-kit] Firebase non inizializzato. Chiama setupFirebase(firebaseConfig) nel main.")}const Zs="Sei offline: cancello in locale, sincronizzo quando torni online.";function Vp(){return typeof navigator<"u"?!!navigator.onLine:!0}function wc(){return!Vp()}function Ar(n){if(n instanceof z)return n;try{return new z(n.seconds,n.nanoseconds)}catch{return U.logError({title:"reviveTimestamp errore:",message:`seconds:${n.seconds}; nanoseconds:${n.nanoseconds};`}),z.now()}}function sa(n){try{if(n==null||n instanceof z)return n;if(typeof n=="object"&&n.type==="firestore/timestamp/1.0"&&typeof n.seconds=="number"&&typeof n.nanoseconds=="number")return Ar(n);if(Array.isArray(n))return n.map(e=>sa(e));if(typeof n=="object"){const e={};for(const[t,r]of Object.entries(n))e[t]=sa(r);return e}return n}catch(e){return U.logError({title:"reviveTimestampsDeep error",message:e?.message??"Errore sconosciuto"}),n}}const ei=n=>{if(n==null)return n;if(n instanceof z)return n.toJSON();if(n&&typeof n=="object"&&n._methodName==="serverTimestamp")return U.logError("non puoi salvare un serverTimestamp devi usare Timestamp.now()"),z.now().toJSON();if(Array.isArray(n))return n.map(e=>ei(e));if(typeof n=="object"){const e={};for(const[t,r]of Object.entries(n))e[t]=ei(r);return e}return n},ia={unknown:"Errore sconosciuto.",undefined:"Non trovato.",cancelled:"Operazione annullata.","invalid-argument":"Argomento non valido.","deadline-exceeded":"Timeout dell’operazione.","not-found":"Risorsa non trovata.","already-exists":"La risorsa esiste già.","permission-denied":"Non hai i permessi necessari.","resource-exhausted":"Limite superato, riprova più tardi.","failed-precondition":"Stato non valido per questa operazione.",aborted:"Conflitto, operazione annullata.",unavailable:"Servizio momentaneamente non disponibile.","auth/email-already-in-use":"Questa email è già registrata.","auth/wrong-password":"Password errata.","auth/user-not-found":"Utente non trovato.","auth/invalid-email":"Indirizzo email non valido.","auth/too-many-requests":"Troppi tentativi, riprova più tardi.","auth/requires-recent-login":"Per favore effettua di nuovo il login.","storage/object-not-found":"File non trovato.","storage/unauthenticated":"Devi effettuare il login.","storage/unauthorized":"Non hai accesso a questo file.","storage/quota-exceeded":"Quota di archiviazione superata."};function lb(n){return n in ia}function nt(n,e){if(e===!1)return;const t=typeof n?.code=="string"?n?.code:"",r=lb(t)?ia[t]:!1;if(r)U.error(r);else{U.error(ia.unknown),console.log(`%cTodo gestire error.code "%c${n?.code}%c"`,"color:#fb9005; font-weight:bold;","color:#0dfb05; font-weight:bold;","color:#fb9005; font-weight:bold;");try{U.logError(String(n))}catch{U.logError("on try to parse error")}finally{console.log("[ERROR from middlewareCatchCall]:",n)}}}function ti(n,e,t,...r){!je.debugFirestore||!(i=>{if(!i)return;if(typeof je.debugFirestore=="boolean")return je.debugFirestore;const a=typeof je.debugFirestore=="string"?[je.debugFirestore]:je.debugFirestore;return a.length>0?a.includes(i):!1})(n)||console.log(`${e}[${t}] [${n??"no collectionName"}]`,...r)}function bo(n){if(wc()){if(n!==!0)throw Zs;U.warning(Zs)}}const ge={offlineAllow:!1,touchUpdate:!0,localSet:!0};class Ge{id;createdAt;updatedAt;deleteAt;constructor(e){this.id=e.id,Object.assign(this,e);const t=z.now();this.createdAt=e.createdAt?Ar(e.createdAt):t,this.updatedAt=e.updatedAt?Ar(e.updatedAt):t,this.deleteAt=e.deleteAt&&e.deleteAt!==null?Ar(e.deleteAt):null}static collectionName;debugLog(e,...t){ti(this?.collectionName??"no-collectionName","🔥📡🏪",e,t)}get ref(){const e=this.constructor,r=this.getCollectionPath?.()??e.collectionName;if(!r)throw new Error(`${e.name}: nessuna collectionName statica e nessuna getCollectionPath() definita.`);return Ir(exports.db,r,this.id)}static async get(e,t){try{ti(this?.collectionName??"no-collectionName","🔥📡🏪","get");const r=t?.collectionPath??this.collectionName;if(!r)throw new Error(`${this.name}.get: serve opts.collectionPath per collezioni dinamiche, oppure definisci static collectionName.`);const s=Ir(exports.db,r,e),i=await ta(s);if(!i.exists())return;const a=new this({id:e,...i.data()}),c=await a.onGetBeforeStoreSet(a);return c.canLocalSave(t?.localSet)&&c.localSet(),c}catch(r){throw nt(r),r}}static cleanDataAAA(e){return Object.fromEntries(Object.entries(e).map(([t,r])=>{if(r==null)return[t,Zo()];if(typeof r=="object"&&r!==null&&!(r instanceof z)&&!(r instanceof Date))try{return[t,structuredClone(r)]}catch{return[t,JSON.parse(JSON.stringify(r))]}return[t,r]}))}static isPlainObject(e){return!!e&&typeof e=="object"}static stripUndefinedDeep(e){if(e!==void 0){if(e===null)return null;if(e instanceof z||e instanceof Date||e instanceof Or)return e;if(Array.isArray(e))return e.map(t=>Ge.stripUndefinedDeep(t)).filter(t=>t!==void 0);if(Ge.isPlainObject(e)){const t={};for(const[r,s]of Object.entries(e)){const i=Ge.stripUndefinedDeep(s);i!==void 0&&(t[r]=i)}return t}return e}}static cleanData(e){const t=Ge.stripUndefinedDeep(e);return Object.fromEntries(Object.entries(t??{}).map(([s,i])=>{if(i==null)return[s,Zo()];if((Ge.isPlainObject(i)||Array.isArray(i))&&!(i instanceof z)&&!(i instanceof Date)&&!(i instanceof Or))try{return[s,structuredClone(i)]}catch{return[s,JSON.parse(JSON.stringify(i))]}return[s,i]}))}async onGetBeforeStoreSet(e){return e}async save({offlineAllow:e=ge.offlineAllow,touchUpdate:t=ge.touchUpdate,localSet:r=ge.localSet}=ge){this.debugLog("save");try{bo(e);const s=this.toData(),i=Ge.cleanData(s);t&&!i.updatedAt&&(i.updatedAt=this.touchUpdated()),await gp(this.ref,{...i},{merge:!0}),this.canLocalSave(r)&&this.localSet()}catch(s){throw nt(s),s}}async update(e,{offlineAllow:t=ge.offlineAllow,touchUpdate:r=ge.touchUpdate,localSet:s=ge.localSet}=ge){this.debugLog("update");try{bo(t);const i=Ge.cleanData(e);r&&!i.updatedAt&&(i.updatedAt=this.touchUpdated()),await vA(this.ref,i),Object.assign(this,e),this.canLocalSave(s)&&this.localSet()}catch(i){throw nt(i),i}}async delete(e,t=ge){return this.debugLog("deleteUsingStore",`[id=${this.id}]`),await e.delete(this.id,t)}async deleteJustOnline_NotLocalStore({offlineAllow:e=ge.offlineAllow,localSet:t=ge.localSet}=ge){this.debugLog("delete");try{bo(e),await IA(this.ref),this.canLocalSave(t)&&this.localSet(!0)}catch(r){throw nt(r),r}}get isDeleted(){return this.deleteAt!==null}timestampbleProps(){return{createdAt:this.createdAt,updatedAt:this.updatedAt,deleteAt:this.deleteAt}}touchUpdated(){const e=z.now();return this.updatedAt=e,e}async softDelete(e){if(this.debugLog("softDelete"),this.deleteAt!==null){U.warning("Elemento già nel cestino.");return}const t=z.now();this.deleteAt=t,await this.update({deleteAt:t},e)}async restore(e){if(this.debugLog("restore"),this.deleteAt===null){U.warning("Elemento non è nel cestino.");return}this.deleteAt=null,await this.update({deleteAt:null},e)}canLocalSave(e){if(e===!1)return!1;try{return!!this?.localStorageKey?.()}catch{return!1}}localSet(e){this.debugLog("localSet");const t=this?.localStorageKey?.();if(!t)return;const r=this?.toData?.()??{id:this.id},s=ei(r),i=Ce.getParsed(t);if(i&&typeof i=="object"&&!Array.isArray(i)){if(e){i[this.id]&&(delete i[this.id],Ce.set(t,i));return}Ce.set(t,{...i,[this.id]:s})}else Ce.set(t,{[this.id]:s})}}function ub(n){if(wc()){if(n!==!0)throw Zs;U.warning(Zs)}}class hb{ModelInstnce;makeModel(e,t){return new this.ModelInstnce({id:e,...t})}_collectionPath;debugLog(e,...t){ti(this.collectionPath,"🔥📡📦",e,t)}items={};snapshotFnStop=null;isFirstRun=!0;prevStartQuery="";get live(){return!!this.snapshotFnStop}get ref(){return oA(exports.db,this.collectionPath)}constructor(e,t){this.ModelInstnce=e,this._collectionPath=t?.collectionPath}get collectionPath(){const e=this._collectionPath??this.ModelInstnce.collectionName;if(!e)throw new Error("collectionPath non definita");return e}get name(){return this.collectionPath}get itemsActive(){return Object.fromEntries(Object.entries(this.items).filter(([,e])=>!e.isDeleted))}get itemsDeleted(){return Object.fromEntries(Object.entries(this.items).filter(([,e])=>e.isDeleted))}get itemsArray(){return Object.values(this.items)}get itemsActiveArray(){return Object.values(this.items).filter(e=>!e.isDeleted)}get itemsDeletedArray(){return Object.values(this.items).filter(e=>e.isDeleted)}get isEmpty(){return Object.keys(this.items).length===0}get isActiveEmpty(){return this.itemsActiveArray.length===0}get isDeletedEmpty(){return this.itemsDeletedArray.length===0}get localStorageKey(){const e=this.ModelInstnce?.prototype?.localStorageKey?.();if(!e){U.logError("Impossibile svuotare LocalStorage: localStorageKey() non definita nel Model.");return}return e}itemsArrayOrderedBy(e,t){return[...t===void 0?this.itemsArray:t?this.itemsDeletedArray:this.itemsActiveArray].sort((s,i)=>{const a=s[e]?.toMillis?.()??0;return(i[e]?.toMillis?.()??0)-a})}findItemsById(e){if(!(!e||e===""))return this.items?.[e]}async get(e={}){this.debugLog("get");try{const t=oa(e),r=t?nh(this.ref,...t):this.ref,s=await EA(r);e.forceLocalSet&&(this.items={},this.localClear());for(const i of s.docs){const a=this.makeModel(i.id,i.data()),c=await a.onGetBeforeStoreSet(a);this.items[i.id]=c,(c.canLocalSave(e.localSet)||e.forceLocalSet&&c.canLocalSave())&&c.localSet()}return this.items}catch(t){throw nt(t),t}}async getIds(e){this.debugLog("getIds");const t=Array.from(new Set((e??[]).map(u=>(u??"").trim()).filter(Boolean)));if(t.length===0)return{foundIds:!1,notFoundIds:!1};const r=(u,h)=>{const f=[];for(let m=0;m<u.length;m+=h)f.push(u.slice(m,m+h));return f},s=new Set,i=r(t,10);for(const u of i){const h=await this.get({query:ea(Xo(),"in",u)});for(const f of Object.keys(h))s.add(f)}const a=Array.from(s),c=t.filter(u=>!s.has(u));return{foundIds:a.length>0?a:!1,notFoundIds:c.length>0?c:!1}}localGet(){const e=this.localStorageKey;try{if(!e){U.logError({title:"localGet "+e,message:"LocalStorageKey not found"});return}const t=Ce.getParsed(e);for(const r in t)this.items[r]=this.makeModel(r,t[r])}catch{U.logError({title:"localGet "+e,message:"errore try parse o makeModel"})}}async start(e={}){if(this.debugLog("👂 start"),!Ec(e))return;const t=JSON.stringify([e.ids,e.query,e.limit,e.orderBy].map(i=>i?.toString?.()??String(i)));if(this.live&&this.prevStartQuery===t)return;this.stop(),this.prevStartQuery=t;const r=oa(e,!0),s=r?nh(this.ref,...r):this.ref;this.snapshotFnStop=AA(s,async i=>{const a=i.docChanges();this.isFirstRun&&(this.debugLog("👂 firstRun"),this.isFirstRun=!1,this.onStartFirstRun(a,e.forceLocalSet),e.forceLocalSet&&(this.items={},this.localClear()));for(const c of a){const u=c.doc.id;if(c.type==="removed"){this.items[u]?.localSet(!0),delete this.items[u];continue}const h=c.doc.data(),f=this.makeModel(u,h),m=await f.onGetBeforeStoreSet(f);this.items[u]=m,m.canLocalSave(e.localSet)&&m.localSet()}},i=>{this.stop(),nt(i)})}onStartFirstRun(e,t){}stop(){this.snapshotFnStop&&(this.debugLog("🛑 stop"),this.prevStartQuery=null,this.snapshotFnStop(),this.snapshotFnStop=null,this.isFirstRun=!0)}async add(e,{offlineAllow:t=ge.offlineAllow,localSet:r=ge.localSet}=ge){try{this.debugLog("add"),ub(t);const{id:s,...i}=e,a=Ge.stripUndefinedDeep(i);let c=s??"";if(s){const h=Ir(exports.db,this.collectionPath,s);if((await ta(h)).exists())throw new Error("Documento già esistente")}else c=Ir(this.ref).id;const u=this.makeModel(c,a);return await u.save({offlineAllow:t,touchUpdate:!0,localSet:r}),this.items[c]=u,u}catch(s){throw nt(s),s}}async delete(e,t=ge){try{if(this.items[e]){const r=this.items[e].deleteJustOnline_NotLocalStore(t);return delete this.items[e],await r}}catch(r){throw nt(r),r}}findByUid(e){if(!(!this.itemsArray||!this.itemsArray.length))return this.itemsArray.find(t=>t.uid===e)}async getOne(e,t){this.debugLog("getOne");try{const r=Ir(exports.db,this.collectionPath,e),s=await ta(r);if(!s.exists())throw this.items[e]&&delete this.items[e],new Error("[404] non trovato");const i=s.data(),a=this.makeModel(e,i),c=await a.onGetBeforeStoreSet(a);return this.items[e]=c,c.canLocalSave(t?.localSet)&&c.localSet(),c}catch(r){throw nt(r),r}}async ensureOne(e){const t=this.items[e];return t||this.getOne(e)}localClear(){const e=this.localStorageKey;Ce.has(e)?(Ce.remove(e),U.log(`LocalStorage "${e}" svuotato con successo.`)):U.log(`Nessun dato trovato per LocalStorage "${e}".`)}}function Ec(n){if(n.ids&&n.ids.length>0){if(n.ids.length>10)return U.logError("Non puoi lanciare start con più di 10 id"),!1;if(n.query)return U.logError('Non è supportato usare "query" insieme a "ids" in start()'),!1}if(n.lastByCreate||n.lastByUpdate){if(n.lastByCreate&&n.lastByUpdate)return U.logError("Non puoi usare lastByCreate e lastByUpdate insieme"),!1;if(n.limit||n.orderBy)return U.logError("Non puoi usare limit o orderBy insieme a lastByCreate / lastByUpdate"),!1}return!0}function oa(n,e=!1){if(!e&&!Ec(n))return!1;const t=[];if(n.ids&&n.ids.length>0){const r=Array.from(new Set(n.ids.map(s=>(s??"").trim()).filter(Boolean)));r.length===1?t.push(ea(Xo(),"==",r[0])):r.length>1&&t.push(ea(Xo(),"in",r))}else n.query&&t.push(...Array.isArray(n.query)?n.query:[n.query]);return n.lastByCreate?(t.push(To("createdAt","desc")),t.push(wo(n.lastByCreate)),t):n.lastByUpdate?(t.push(To("updatedAt","desc")),t.push(wo(n.lastByUpdate)),t):(n.orderBy&&t.push(To(n.orderBy.fieldPath,n.orderBy.directionStr??"asc")),n.limit&&t.push(wo(n.limit)),t)}function db(n){let e=null;_.onBeforeUnmount(()=>{e?.(),e=null;for(const t of n)t.store.stop()})}const Op={SUPERADMIN:"SUPERADMIN",ADMIN:"ADMIN",MODAL_DEV_ON:"MODAL_DEV_ON",MANAGE_USERS:"MANAGE_USERS",OFFLINE_ALLOW:"OFFLINE_ALLOW",BETA_FEATURES:"BETA_FEATURES"};class fb extends Ge{static collectionName="users";localStorageKey(){return Ce.defaultKey.currentUser}userPublicId;name;surname;email;birthDate;phoneNumber;photoURL;description;permissions;gender;birthHideYear;fcmTokens;constructor(e){super(e),this.userPublicId=e.userPublicId,this.name=e.name,this.surname=e.surname,this.email=e.email,this.birthDate=e.birthDate,this.phoneNumber=e.phoneNumber,this.photoURL=e.photoURL,this.description=e.description,this.permissions=e.permissions??[],this.gender=e.gender,this.birthHideYear=e.birthHideYear,this.fcmTokens=e.fcmTokens}toData(){return{id:this.id,userPublicId:this.userPublicId,name:this.name,surname:this.surname,email:this.email,birthDate:this.birthDate,phoneNumber:this.phoneNumber,photoURL:this.photoURL,description:this.description,permissions:this.permissions,gender:this.gender,birthHideYear:this.birthHideYear,fcmTokens:this.fcmTokens}}async create(){try{const e=this.toData(),t=Object.fromEntries(Object.entries(e).map(([r,s])=>s==null?[r,Zo()]:[r,s]));t.permissions!==void 0&&delete t.permissions,await gp(this.ref,t,{merge:!0})}catch(e){throw U.error(String(e)),e}}get fullName(){let e=`${this.name} ${this.surname}`.trim();return e===""&&(e="-"),e}get fullNameInitials(){const e=this.fullName,t=e.split(" ").filter(Boolean);return((t[0]?.[0]||"")+(t[1]?.[0]||"")||e?.[0]||"?").toUpperCase()}async updateName(e,t){await this.update({name:e,surname:t})}async updateBirthDate(e){await this.update({birthDate:e})}hasPermission(e){return Array.isArray(this.permissions)&&this.permissions.includes(e)}hasAnyPermissions(){return Array.isArray(this.permissions)&&this.permissions.length>0}hasAnyPermissionsExclud(e){return!Array.isArray(this.permissions)||this.permissions.length===0?!1:this.permissions.some(t=>!e.includes(t))}get offlineAllow(){return this.hasPermission(Op.OFFLINE_ALLOW)}async addPermissions(e){const r=(Array.isArray(e)?e:[e]).filter(s=>!this.permissions.includes(s));return r.length===0?!1:(this.permissions.push(...r),this.update({permissions:this.permissions}).then(()=>!0))}async deletePermissions(e){const t=Array.isArray(e)?e:[e],r=this.permissions.length;return this.permissions=this.permissions.filter(s=>!t.includes(s)),this.permissions.length===r?!1:this.update({permissions:this.permissions}).then(()=>!0)}hasFcmToken(e){return e?(this.fcmTokens??[]).includes(e):!1}async addFcmToken(e){return Array.isArray(this.fcmTokens)||(this.fcmTokens=[]),this.hasFcmToken(e)?!1:(this.fcmTokens.push(e),this.update({fcmTokens:this.fcmTokens}).then(()=>!0))}async removeFcmToken(e){if(!Array.isArray(this.fcmTokens)||this.fcmTokens.length===0)return!1;const t=this.fcmTokens.length;return this.fcmTokens=this.fcmTokens.filter(r=>r!==e),this.fcmTokens.length===t?!1:this.update({fcmTokens:this.fcmTokens}).then(()=>!0)}}function wh(n){const e=typeof n=="string"?{title:n}:n,{title:t,...r}=e;return r.icon||(r.icon="/img/logo/pwa.png"),r.tag||(r.tag=`default-${new Date().toISOString().slice(0,10)}`),r.data||(r.data={url:"/"}),r?.data?.url||(r.data.url="/"),{title:t,options:r}}const aa=_.reactive({reg:void 0,VAPID_PUBLIC_KEY:void 0,isNotificationSupported:typeof Notification<"u",get permission(){return this.isNotificationSupported?Notification.permission:"denied"},get needToAskPermission(){return this.isNotificationSupported?Notification.permission==="default":!1},async askPermission(n){if(!aa.isNotificationSupported)return U.error("Le notifiche non sono supportate su questo dispositivo"),"denied";aa.permission==="denied"&&U.warning("Notifiche disabilitate. Per abilitarle cercare nelle impostazioni del browser.");const e=await Notification.requestPermission();return e!=="granted"?U.warning("Hai disabilitato le notifiche. Per abilitarle cercare nelle impostazioni del browser."):this.registerFcmToken(n),e},async send(n,e){if(!this.isNotificationSupported){U.error("Le notifiche non sono supportate su questo dispositivo");return}if(this.permission!=="granted"&&await this.askPermission(n)!=="granted")return;const{title:t,options:r}=wh(e);this.reg?await this.reg.showNotification(t,r):new Notification(t,r)},async sendTo(n,e){let t=!1;try{const r=T0(exports.functions,"sendUserPush"),{title:s,options:i}=wh(e);console.log({title:s,options:i}),await r({toUid:n,title:s,options:i}),t=!0}catch(r){console.error(r),U.error("Errore invio notifica")}return t},async getCurrentFcmToken(){return ra(),this.isNotificationSupported?this.reg?this.VAPID_PUBLIC_KEY?await ob(exports.messaging,{vapidKey:this.VAPID_PUBLIC_KEY,serviceWorkerRegistration:this.reg}).catch(()=>null)||null:(U.error("VAPID_PUBLIC_KEY mancante"),null):(U.error("ServiceWorker non registrato"),null):null},async registerFcmToken(n){if(ra(),!this.isNotificationSupported)return null;this.needToAskPermission&&await this.askPermission(n);const e=await this.getCurrentFcmToken();return e?(await n.addFcmToken(e)?U.success("Abilitato"):U.warning("Token non aggiunto possibilmente già presente."),e):null},async removeThisDeviceToken(n){const e=await this.getCurrentFcmToken();let t=!1;try{t=await ab(exports.messaging)}catch(s){console.warn("deleteToken() failed (continuo con cleanup lato currentUser):",s)}let r=!1;if(e)try{r=await n.removeFcmToken(e)}catch(s){console.warn("removeFcmToken() user failed:",s)}return t||r?(U.success("Notifiche disattivate per questo dispositivo."),!0):(U.warning("Nessun token da rimuovere per questo dispositivo."),!1)}});function bs(n){const e=globalThis.structuredClone;if(typeof e=="function")try{return e(n)}catch{return Nt(n)}return Nt(n)}function Nt(n,e=new WeakMap){if(n===null||typeof n!="object")return n;if(e.has(n))return e.get(n);if(n instanceof Date)return new Date(n.getTime());if(n instanceof Map){const r=new Map;return e.set(n,r),n.forEach((s,i)=>r.set(Nt(i,e),Nt(s,e))),r}if(n instanceof Set){const r=new Set;return e.set(n,r),n.forEach(s=>r.add(Nt(s,e))),r}if(Array.isArray(n)){const r=new Array(n.length);e.set(n,r);for(let s=0;s<n.length;s++)r[s]=Nt(n[s],e);return r}const t={};e.set(n,t);for(const r of Object.keys(n))t[r]=Nt(n[r],e);for(const r of Object.getOwnPropertySymbols(n))t[r]=Nt(n[r],e);return t}const pb=(n,e="")=>{const t=n.trim();if(t.startsWith("+")){const r=t.match(/^\+(\d{1,3})\s*(.+)$/);if(r)return[`+${r[1]}`,(r[2]??"").replace(/\s+/g,"")]}return[e,t.replace(/\s+/g,"")]};class mb{id;values;errors;touched;_initial;schema;_onSubmit;_onInvalid;_validateOnChangeMap;_touchOnChangeMap;_stopWatch;_fieldCache={};_allFields;_submitOnChange;_suspendAutoSubmit=!1;_debouncedSubmit;_syncPreference;_effects;_onAnyChange;_makeDebouncedSubmit(e){let t;return()=>{t&&clearTimeout(t),t=window.setTimeout(()=>{this._suspendAutoSubmit||this.submit()},e)}}constructor(e,t){this.id=e.id??"";const r=S=>"initialValues"in S;this._syncPreference=r(e)&&e.syncPreference?e.syncPreference:"db";const s=r(e)?e.initialValues:e,i=Object.keys(s),a=(S,k)=>{const V={};for(const N of i)V[N]=k;if(typeof S=="boolean")for(const N of i)V[N]=S;else S&&typeof S=="object"&&Object.assign(V,S);return V},c=(r(e)?e.validator:t)??{},u=r(e)?e.onSubmit:void 0,h=r(e)?e.onInvalid:void 0,f=r(e)?e.validateOnChange:void 0,m=r(e)?e.touchOnChange:void 0;this._validateOnChangeMap=a(f,!0),this._touchOnChangeMap=a(m,!0);const y=r(e)?e.syncWith:void 0;this._initial=bs(s),this.values=_.reactive(bs(s)),this.errors=_.reactive(Object.keys(s).reduce((S,k)=>(S[k]=null,S),{})),this.touched=_.reactive(Object.keys(s).reduce((S,k)=>(S[k]=!1,S),{})),this.schema=c,this._onSubmit=u,this._onInvalid=h,this._submitOnChange=r(e)?e.submitOnChange:void 0,this._effects=r(e)?e.effects:void 0,this._onAnyChange=r(e)?e.onAnyChange:void 0,typeof this._submitOnChange=="number"&&this._submitOnChange>=0&&(this._debouncedSubmit=this._makeDebouncedSubmit(this._submitOnChange)),y&&(_.isRef(y)?this._stopWatch=_.watch(y,S=>{S&&this.fill(S)},{immediate:!0}):typeof y=="function"&&(this._stopWatch=_.watch(y,S=>{S&&this.fill(S)},{immediate:!0})))}touch(e){this.touched[e]=!0}touchAll(){for(const e of Object.keys(this.touched))this.touched[e]=!0}field(e){const t=this._fieldCache[e];if(t)return t;const r=_.computed({get:()=>this.values[e],set:s=>this.set(e,s)});return this._fieldCache[e]=r,r}fields(){if(!this._allFields){const e={};for(const t of Object.keys(this.values))e[t]=this.field(t);this._allFields=e}return this._allFields}set(e,t,r){this.values[e]=t,!this.touched[e]&&(this._touchOnChangeMap[e]??!1)&&(this.touched[e]=!0),(r??!!this._validateOnChangeMap[e])&&this.validateField(e),this._effects?.[e]?.(t,this),this._onAnyChange?.(e,t,this),!this._suspendAutoSubmit&&this._submitOnChange&&(this._submitOnChange===!0?this.submit():typeof this._submitOnChange=="number"&&this._debouncedSubmit?.())}validateField(e){const t=this.schema[e]??[];for(const r of t){const s=r(this.values[e]);if(this.errors[e]=s,s)return!1}return this.errors[e]=null,!0}validateAll(){let e=!0;for(const t of Object.keys(this.values))this.validateField(t)||(this.touch(t),e=!1);return e}fill(e,t){let{validate:r}=t??{};r===void 0&&(r=!1),this._suspendAutoSubmit=!0;try{for(const s in e){if(!(s in this.values))continue;const i=s;this._syncPreference==="local"&&this.touched[i]||(this.values[i]=e[i])}r&&this.validateAll()}finally{this._suspendAutoSubmit=!1}}reset({keepTouched:e=!1}={}){for(const t of Object.keys(this._initial))this.values[t]=this._initial[t];for(const t of Object.keys(this.errors))this.errors[t]=null;if(!e)for(const t of Object.keys(this.touched))this.touched[t]=!1}resetWithInitialValues(e){this._initial=bs(e),this.reset()}bindField(e,t){return _.computed({get:()=>this.values[e],set:r=>this.set(e,r,t??this._validateOnChangeMap[e]??!1)})}showError(e){return this.touched[e]?this.errors[e]:null}hasError(e){return!!this.showError(e)}getFieldId(e){return`${this.id!==""?this.id+"_":""}field_${String(e)}`}getFieldIdError(e){return`${this.getFieldId(e)}-error`}getFieldProps(e){return{id:this.getFieldId(e),"aria-invalid":this.hasError(e),"aria-describedby":this.getFieldIdError(e),class:{"is-invalid":!!this.showError(e)}}}get isValid(){return Object.values(this.errors).every(e=>e==null)}get isDirty(){return JSON.stringify(this.values)!==JSON.stringify(this._initial)}get touchedValues(){const e={};for(const t of Object.keys(this.values))this.touched[t]&&(e[t]=this.values[t]);return e}dispose(){this._stopWatch?.()}submit=async()=>{if(!this.validateAll()){this._onInvalid?.(this.errors);return}await this._onSubmit?.(this.values,this.touchedValues,this.touched)};setSyncPreference(e){this._syncPreference=e}}const gb=(n="Obbligatorio")=>e=>e==null||typeof e=="string"&&e.trim().length===0||Array.isArray(e)&&e.length===0?n:null,_b=(n="Email non valida")=>e=>e?/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)?null:n:null,yb=(n="Formato richiesto: AAAA-MM-GG")=>e=>e?/^\d{4}-\d{2}-\d{2}$/.test(e)?null:n:null,Tb=(n="URL non valido")=>e=>{if(!e)return null;try{return new URL(e),null}catch{return n}},wb=(n,e="Seleziona un’opzione")=>t=>t?n.includes(t)?null:e:null,Eb=(n="Devi accettare")=>e=>e?null:n,vb=(n="Deve essere un numero")=>e=>e==null||e===""?null:isNaN(Number(e))?n:null,Ib=(n,e)=>t=>{if(t==null||t==="")return null;const r=Number(t);return isNaN(r)?e??"Deve essere un numero":r<n?e??`Il numero deve essere ≥ ${n}`:null},Ab=(n,e)=>t=>{if(t==null||t==="")return null;const r=Number(t);return isNaN(r)?e??"Deve essere un numero":r>n?e??`Il numero deve essere ≤ ${n}`:null},bb=(n,e)=>t=>t&&t.length<n?e??`Minimo ${n} caratteri`:null,Sb=(n,e)=>t=>t&&t.length>n?e??`Massimo ${n} caratteri`:null,Lp=/^(?=.*[A-Z])(?=.*\d)(?!.*\s).+$/,Rb=(n="La password deve contenere almeno una maiuscola, un numero e nessuno spazio")=>e=>e?Lp.test(e)?null:n:null,Pb=(n,e)=>t=>t?t.length<n?e??`La password deve avere almeno ${n} caratteri`:Lp.test(t)?null:e??"La password deve contenere almeno una maiuscola, un numero e nessuno spazio":null,Cb=(n,e="Le password non coincidono")=>t=>{if(!t)return null;const r=n()??"";return t===r?null:e};function un(n){if(!n)return null;if(n instanceof Date)return isNaN(n.getTime())?null:n;if(/^\d{4}-\d{2}-\d{2}$/.test(n)){const e=new Date(n+"T00:00:00");return isNaN(e.getTime())?null:e}return null}const kb=(n,e="La data deve essere successiva")=>t=>{if(!t)return null;const r=un(t),s=un(n());return!r||!s||r>=s?null:e},Nb=(n,e="La data deve essere precedente")=>t=>{if(!t)return null;const r=un(t),s=un(n());return!r||!s||r<=s?null:e},Db=(n,e,t="La data deve essere compresa nell’intervallo")=>r=>{if(!r)return null;const s=un(r),i=un(n()),a=un(e());return!s||!i||!a||s>=i&&s<=a?null:t},ni=n=>String(n).padStart(2,"0");function ri(n){return n instanceof Date&&!isNaN(n.getTime())}function Ni(n){if(!n)return null;if(n instanceof Date)return ri(n)?n:null;if(n instanceof z)return n.toDate();if(typeof n=="string"||typeof n=="number"){const e=new Date(n);return ri(e)?e:null}return null}function Mp(n){const e=Ni(n);return e?`${e.getFullYear()}-${ni(e.getMonth()+1)}-${ni(e.getDate())}`:""}function xp(n){const e=Ni(n);return e?`${ni(e.getHours())}:${ni(e.getMinutes())}`:""}function Vb(n){const e=Ni(n);return e?`${Mp(e)}T${xp(e)}`:""}function Ob(n){if(!n)return null;const e=new Date(`${n}T00:00:00`);return ri(e)?e:null}function Lb(n,e){if(!n)return null;console.log(e);const t=e&&e!==""?e:"00:00";console.log(`${n}T${t}:00`);const r=new Date(`${n}T${t}:00`);return ri(r)?z.fromDate(r):null}function Mb(n,e=""){return n==null?e:String(n)}function xb(n){if(n==null||n==="")return"";const e=Number(n);return isNaN(e)?"":e}function Fb(n){return!!n}function Ub(n){return Array.isArray(n)?n.map(e=>String(e)).filter(Boolean):[]}function Bb(n,e){if(!n)return"";const t=String(n);return e&&!e.includes(t)?"":t}function qb(n,e=void 0){const t=Ni(n);return t?t.toLocaleString(e):""}function $b(n){if(n==null)return"-";const e=String(n).trim();return e===""?"-":e}const jb={install(n){n.component("AccordionCmp",Eh),n.component("Btn",gr),n.component("ToastCmp",Ah),n.component("FieldGender",bh),n.component("FieldPhoneNumber",Sh),n.component("InputField",Rh)}};exports.AccordionCmp=Eh;exports.Btn=gr;exports.CicKit=jb;exports.FieldGender=bh;exports.FieldPhoneNumber=Sh;exports.FirestoreModel=Ge;exports.FirestoreStore=hb;exports.FormValidator=mb;exports.InputField=Rh;exports.LS=Ce;exports.Toast=vh;exports.ToastCmp=Ah;exports.User=fb;exports.buildConstraintsFromGetProps=oa;exports.cicKitStore=je;exports.clone=bs;exports.dateAfter=kb;exports.dateBefore=Nb;exports.dateBetween=Db;exports.dateISO=yb;exports.defaultUserPermission=Op;exports.email=_b;exports.emptyToDash=$b;exports.ensureFirebase=ra;exports.fireDebugLog=ti;exports.inputDateTimeToTimestamp=Lb;exports.inputDateToDate=Ob;exports.isBrowserOffline=wc;exports.isBrowserOnline=Vp;exports.isNumber=vb;exports.maxLength=Sb;exports.maxNumber=Ab;exports.middlewareCatchCall=nt;exports.minLength=bb;exports.minNumber=Ib;exports.oneOf=wb;exports.optionFireModelDefault=ge;exports.password=Rb;exports.passwordRetype=Cb;exports.passwordWithMin=Pb;exports.phoneNumberFromString=pb;exports.pushMsg=aa;exports.required=gb;exports.requiredTrue=Eb;exports.reviveTimestamp=Ar;exports.reviveTimestampsDeep=sa;exports.serializeTimestamp=ei;exports.setupFirebase=cb;exports.shareLink=Ih;exports.signInWithPopup=cw;exports.timestampInputDate=Mp;exports.timestampInputDateTimeLocal=Vb;exports.timestampInputTime=xp;exports.timestampToLocale=qb;exports.toast=U;exports.url=Tb;exports.useStoreWatch=db;exports.validateQueryGetOpts=Ec;exports.valueToInputBoolean=Fb;exports.valueToInputNumber=xb;exports.valueToInputString=Mb;exports.valueToSelect=Bb;exports.valueToStringArray=Ub;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import type { App } from "vue";
|
|
2
|
-
import AccordionCmp from "./cmp/Accordion/
|
|
3
|
-
import
|
|
2
|
+
import AccordionCmp from "./cmp/Accordion/Accordion.vue";
|
|
3
|
+
import Btn from "./cmp/Btn/Btn.vue";
|
|
4
4
|
import ToastCmp from "./cmp/toast/ToastCmp.vue";
|
|
5
5
|
import FieldGender from "./cmp/input/Gender/FieldGender.vue";
|
|
6
6
|
import FieldPhoneNumber from "./cmp/input/PhoneNumber/FieldPhoneNumber.vue";
|
|
7
7
|
import InputField from "./cmp/input/Text/InputField.vue";
|
|
8
|
-
export { AccordionCmp,
|
|
9
|
-
declare const
|
|
8
|
+
export { AccordionCmp, Btn, ToastCmp, FieldGender, FieldPhoneNumber, InputField };
|
|
9
|
+
export declare const CicKit: {
|
|
10
10
|
install(app: App): void;
|
|
11
11
|
};
|
|
12
|
-
export default _default;
|
|
13
12
|
export { cicKitStore } from "./cmp/cicKitStore";
|
|
14
13
|
export { type FirebaseConfig, setupFirebase, ensureFirebase, auth, provider, analytics, db, storage, functions, messaging, signInWithPopup } from "./cmp/firebase/firebase";
|
|
15
14
|
export { FirestoreModel, type Timestampble, type OptionFireModel, optionFireModelDefault, fireDebugLog } from "./cmp/firebase/FirestoreModel";
|
package/dist/index.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import { defineComponent as Zn, useSlots as Hh, useAttrs as Gh, computed as Z, o
|
|
|
2
2
|
import { useRouter as Bm } from "vue-router";
|
|
3
3
|
const qm = ["id"], $m = { class: "accordion-item" }, jm = { class: "accordion-header" }, zm = ["data-bs-target", "aria-controls", "disabled"], Hm = ["id", "data-bs-parent"], Gm = { class: "accordion-body" }, Km = { key: 0 }, Wm = /* @__PURE__ */ Zn({
|
|
4
4
|
inheritAttrs: !1,
|
|
5
|
-
__name: "
|
|
5
|
+
__name: "Accordion",
|
|
6
6
|
props: {
|
|
7
7
|
id: {},
|
|
8
8
|
title: {},
|
|
@@ -141,7 +141,9 @@ const Me = {
|
|
|
141
141
|
defaultKey: {
|
|
142
142
|
isDev: "isDev",
|
|
143
143
|
debugMod: "debugMod",
|
|
144
|
-
currentUser: "currentUser"
|
|
144
|
+
currentUser: "currentUser",
|
|
145
|
+
appConfig: "appConfig",
|
|
146
|
+
lastLoginCurrentUser: "lastLoginCurrentUser"
|
|
145
147
|
},
|
|
146
148
|
/** Lettura con gestione errori, valore */
|
|
147
149
|
getStr(n) {
|
|
@@ -336,7 +338,7 @@ const Zm = ["type", "disabled", "aria-busy"], eg = {
|
|
|
336
338
|
"aria-hidden": "true"
|
|
337
339
|
}, tg = /* @__PURE__ */ Zn({
|
|
338
340
|
inheritAttrs: !1,
|
|
339
|
-
__name: "
|
|
341
|
+
__name: "Btn",
|
|
340
342
|
props: {
|
|
341
343
|
variant: {},
|
|
342
344
|
color: {},
|
|
@@ -407,7 +409,7 @@ const Zm = ["type", "disabled", "aria-busy"], eg = {
|
|
|
407
409
|
for (const [r, s] of e)
|
|
408
410
|
t[r] = s;
|
|
409
411
|
return t;
|
|
410
|
-
}, Rs = /* @__PURE__ */ ba(tg, [["__scopeId", "data-v-
|
|
412
|
+
}, Rs = /* @__PURE__ */ ba(tg, [["__scopeId", "data-v-1caf3817"]]), ng = ["onMouseenter"], rg = ["innerHTML"], sg = { class: "message-text-container text-dark" }, ig = { class: "message-text mb-0" }, og = { class: "sub-content" }, ag = {
|
|
411
413
|
key: 0,
|
|
412
414
|
class: "sub-text mb-0"
|
|
413
415
|
}, cg = {
|
|
@@ -517,7 +519,7 @@ const Zm = ["type", "disabled", "aria-busy"], eg = {
|
|
|
517
519
|
_: 1
|
|
518
520
|
}));
|
|
519
521
|
}
|
|
520
|
-
}), hg = /* @__PURE__ */ ba(ug, [["__scopeId", "data-v-
|
|
522
|
+
}), hg = /* @__PURE__ */ ba(ug, [["__scopeId", "data-v-2cc28e46"]]), dg = ["for"], fg = {
|
|
521
523
|
key: 0,
|
|
522
524
|
class: "text-danger"
|
|
523
525
|
}, pg = ["disabled", "readonly"], mg = { value: "" }, gg = ["id"], _g = /* @__PURE__ */ Zn({
|
|
@@ -19310,7 +19312,9 @@ function xb(n) {
|
|
|
19310
19312
|
Db();
|
|
19311
19313
|
let Qe = null, Fh, Fb, Ub, Tn, Uh, Ta, wa;
|
|
19312
19314
|
function Yb(n) {
|
|
19313
|
-
|
|
19315
|
+
if (Qe) return Qe;
|
|
19316
|
+
const { functionsRegion: e, ...t } = n;
|
|
19317
|
+
return Qe = sd(t), Fh = CE(Qe), Fb = new yt(), Ub = CT(Qe), Tn = xA(Qe), Uh = S0(Qe), Ta = W0(Qe, e), wa = Lb(Qe), Je.isDev && (bp(Tn, "localhost", 8080), zd(Fh, "http://localhost:9099"), zp(Ta, "localhost", 5001), Bp(Uh, "localhost", 9199)), Qe;
|
|
19314
19318
|
}
|
|
19315
19319
|
function Bh() {
|
|
19316
19320
|
if (!Qe)
|
|
@@ -20438,12 +20442,13 @@ function CS(n) {
|
|
|
20438
20442
|
}
|
|
20439
20443
|
const kS = {
|
|
20440
20444
|
install(n) {
|
|
20441
|
-
n.component("AccordionCmp", Wm), n.component("
|
|
20445
|
+
n.component("AccordionCmp", Wm), n.component("Btn", Rs), n.component("ToastCmp", hg), n.component("FieldGender", _g), n.component("FieldPhoneNumber", Ag), n.component("InputField", Cg);
|
|
20442
20446
|
}
|
|
20443
20447
|
};
|
|
20444
20448
|
export {
|
|
20445
20449
|
Wm as AccordionCmp,
|
|
20446
|
-
Rs as
|
|
20450
|
+
Rs as Btn,
|
|
20451
|
+
kS as CicKit,
|
|
20447
20452
|
_g as FieldGender,
|
|
20448
20453
|
Ag as FieldPhoneNumber,
|
|
20449
20454
|
ot as FirestoreModel,
|
|
@@ -20464,7 +20469,6 @@ export {
|
|
|
20464
20469
|
TS as dateBetween,
|
|
20465
20470
|
iS as dateISO,
|
|
20466
20471
|
Tn as db,
|
|
20467
|
-
kS as default,
|
|
20468
20472
|
jb as defaultUserPermission,
|
|
20469
20473
|
sS as email,
|
|
20470
20474
|
CS as emptyToDash,
|
package/docs/Btn.md
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
#### Btn
|
|
2
|
+
|
|
3
|
+
Button Bootstrap con varianti, icona, loading e navigazione router.
|
|
4
|
+
|
|
5
|
+
| prop | default | type | utilizzo |
|
|
6
|
+
| ---------- | -------- | ----------------------------------------------------------------------------------------------- | --------------------------- |
|
|
7
|
+
| `variant` | `solid` | `"solid" \| "outline" \| "ghost" \| "link"` | stile del bottone |
|
|
8
|
+
| `color` | `dark` | `"primary" \| "secondary" \| "success" \| "danger" \| "warning" \| "info" \| "light" \| "dark"` | cambia colore Bootstrap |
|
|
9
|
+
| `size` | — | `"sm" \| "lg"` | dimensione Bootstrap |
|
|
10
|
+
| `block` | `false` | `boolean` | full width (`w-100`) |
|
|
11
|
+
| `disabled` | `false` | `boolean` | disabilita click |
|
|
12
|
+
| `type` | `button` | `"button" \| "submit" \| "reset"` | tipo HTML button |
|
|
13
|
+
| `to` | — | `RouteLocationRaw` | naviga con `router.push` |
|
|
14
|
+
| `loading` | `false` | `boolean` | mostra spinner e disabilita |
|
|
15
|
+
| `icon` | — | `string` | icona Material Symbols |
|
|
16
|
+
| `share` | — | `ShareLink` | condivide link al click |
|
|
17
|
+
|
|
18
|
+
```vue
|
|
19
|
+
<script setup lang="ts">
|
|
20
|
+
import { Btn } from "cic-kit";
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<template>
|
|
24
|
+
<Btn color="primary">Salva</Btn>
|
|
25
|
+
</template>
|
|
26
|
+
```
|
package/docs/LS.md
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#### LS
|
|
2
|
+
|
|
3
|
+
Wrapper tipizzato e robusto per localStorage con gestione errori e toast.
|
|
4
|
+
|
|
5
|
+
| prop | default | type | utilizzo |
|
|
6
|
+
| ----------- | ------- | ---------------------------------------------------- | ------------------ |
|
|
7
|
+
| `getStr` | — | `(key: LocalStorageKeyType) => string \| undefined` | legge valore raw |
|
|
8
|
+
| `getParsed` | — | `(key: LocalStorageKeyType) => any` | parse JSON sicuro |
|
|
9
|
+
| `set` | — | `(key: LocalStorageKeyType, value: any) => any` | salva serializzato |
|
|
10
|
+
| `update` | — | `(key: LocalStorageKeyType, data: any) => any` | merge o push |
|
|
11
|
+
| `push` | — | `(key: LocalStorageKeyType, ...items: any[]) => any` | aggiunge ad array |
|
|
12
|
+
| `remove` | — | `(key: LocalStorageKeyType) => void` | rimuove chiave |
|
|
13
|
+
| `delete` | — | `(key: LocalStorageKeyType) => void` | alias remove |
|
|
14
|
+
| `has` | — | `(key: LocalStorageKeyType) => boolean` | verifica esistenza |
|
|
15
|
+
| `keys` | — | `() => LocalStorageKeyType[]` | chiavi enum |
|
|
16
|
+
| `clearAll` | — | `() => void` | pulizia storage |
|
|
17
|
+
| `migrate` | — | `(oldKey, newKey) => void` | migrazione valore |
|
|
18
|
+
|
|
19
|
+
```vue
|
|
20
|
+
<script setup lang="ts">
|
|
21
|
+
import { LS } from "@/shared/utils/LS";
|
|
22
|
+
import { LocalStorageKey } from "@shared/enums/LocalStorageKey";
|
|
23
|
+
|
|
24
|
+
LS.set(LocalStorageKey.User, { name: "Mario" });
|
|
25
|
+
const user = LS.getParsed(LocalStorageKey.User);
|
|
26
|
+
</script>
|
|
27
|
+
```
|
package/docs/Modal.md
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
#### Modal
|
|
2
|
+
|
|
3
|
+
Modal Bootstrap 5 controllata via `v-model`, con header/footer opzionali e bottoni default.
|
|
4
|
+
|
|
5
|
+
| prop | default | type | utilizzo |
|
|
6
|
+
| ----------------- | --------- | ----------------------------------------------- | ------------------------------ |
|
|
7
|
+
| `modelValue` | — | `boolean \| string \| number` | v-model apertura/chiusura |
|
|
8
|
+
| `title` | — | `string` | titolo header di default |
|
|
9
|
+
| `size` | — | `"sm" \| "lg" \| "xl"` | dimensione dialog |
|
|
10
|
+
| `fullscreen` | — | `true \| "sm" \| "md" \| "lg" \| "xl" \| "xxl"` | fullscreen responsive |
|
|
11
|
+
| `centered` | — | `boolean` | centra verticalmente |
|
|
12
|
+
| `scrollable` | — | `boolean` | body scrollabile |
|
|
13
|
+
| `backdrop` | `true` | `boolean \| "static"` | backdrop e comportamento |
|
|
14
|
+
| `keyboard` | `true` | `boolean` | chiusura con ESC |
|
|
15
|
+
| `teleportTo` | `"body"` | `string` | destinazione teleport |
|
|
16
|
+
| `okText` | — | `string` | se undefined, OK nascosto |
|
|
17
|
+
| `cancelText` | — | `string` | se undefined, Annulla nascosto |
|
|
18
|
+
| `okClass` | — | `string` | classi extra bottone OK |
|
|
19
|
+
| `cancelClass` | — | `string` | classi extra bottone Annulla |
|
|
20
|
+
| `okColor` | — | `BtnColor` | colore Btn OK |
|
|
21
|
+
| `cancelColor` | — | `BtnColor` | colore Btn Annulla |
|
|
22
|
+
| `okVariant` | — | `BtnVariant` | variante Btn OK |
|
|
23
|
+
| `cancelVariant` | `"ghost"` | `BtnVariant` | variante Btn Annulla |
|
|
24
|
+
| `closeOnOk` | `true` | `boolean` | chiude dopo OK |
|
|
25
|
+
| `hideHeaderClose` | — | `boolean` | nasconde la X |
|
|
26
|
+
| `id` | — | `string` | id del root modal |
|
|
27
|
+
| `onOk` | — | `() => void \| Promise<void>` | azione su OK |
|
|
28
|
+
|
|
29
|
+
```vue
|
|
30
|
+
<script setup lang="ts">
|
|
31
|
+
import { ref } from "vue";
|
|
32
|
+
|
|
33
|
+
const open = ref(false);
|
|
34
|
+
</script>
|
|
35
|
+
|
|
36
|
+
<template>
|
|
37
|
+
<button class="btn btn-primary" @click="open = true">Apri</button>
|
|
38
|
+
|
|
39
|
+
<ModalCmp v-model="open" title="Titolo" cancelText="Annulla" okText="OK">
|
|
40
|
+
Contenuto della modal
|
|
41
|
+
</ModalCmp>
|
|
42
|
+
</template>
|
|
43
|
+
```
|
package/docs/_.md
ADDED
|
File without changes
|
package/docs/toast.md
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
#### ToastStore
|
|
2
|
+
|
|
3
|
+
Store reattivo per creare, gestire e rimuovere toast (queue + timer).
|
|
4
|
+
|
|
5
|
+
| prop | default | type | utilizzo |
|
|
6
|
+
| ----------------- | ------- | ------------------------------ | -------------------------- |
|
|
7
|
+
| `queue` | `[]` | `Toast[]` | lista toast attivi |
|
|
8
|
+
| `info` | — | `(content, duration?) => void` | toast informativo |
|
|
9
|
+
| `success` | — | `(content, duration?) => void` | toast successo |
|
|
10
|
+
| `warning` | — | `(content, duration?) => void` | toast warning |
|
|
11
|
+
| `error` | — | `(content, duration?) => void` | toast errore (+log in DEV) |
|
|
12
|
+
| `danger` | — | `(content, duration?) => void` | alias di `error` |
|
|
13
|
+
| `primary` | — | `(content, duration?) => void` | variante primary |
|
|
14
|
+
| `secondary` | — | `(content, duration?) => void` | variante secondary |
|
|
15
|
+
| `log` | — | `(content, duration?) => void` | solo DEV, default 5000ms |
|
|
16
|
+
| `logError` | — | `(content, duration?) => void` | solo DEV, default 5000ms |
|
|
17
|
+
| `start` | — | `(toast: Toast) => void` | avvia timer rimozione |
|
|
18
|
+
| `stop` | — | `(toast: Toast) => void` | pausa timer e ricalcolo |
|
|
19
|
+
| `removeToastById` | — | `(id: string) => void` | rimuove per id |
|
|
20
|
+
|
|
21
|
+
```vue
|
|
22
|
+
<script setup lang="ts">
|
|
23
|
+
import { toast } from "@/stores/toast";
|
|
24
|
+
</script>
|
|
25
|
+
|
|
26
|
+
<template>
|
|
27
|
+
<button type="button" @click="toast.success("Operazione completata")">Mostra toast</button>
|
|
28
|
+
</template>
|
|
29
|
+
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cic-kit",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.12",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -21,32 +21,51 @@
|
|
|
21
21
|
"src/styles",
|
|
22
22
|
"src/vue-shim.d.ts",
|
|
23
23
|
"README.md",
|
|
24
|
+
"docs",
|
|
24
25
|
"package.json"
|
|
25
26
|
],
|
|
26
27
|
"sideEffects": [
|
|
27
28
|
"./dist/cic-kit.css"
|
|
28
29
|
],
|
|
29
30
|
"scripts": {
|
|
31
|
+
"install:firebase-secrets-cli:online": "npm uninstall firebase-secrets-cli && npm i -D firebase-secrets-cli@latest",
|
|
32
|
+
"i:f-cli:o": "npm run install:firebase-secrets-cli:online",
|
|
30
33
|
"build:types": "tsc -p tsconfig.build.json",
|
|
31
34
|
"build": "vue-tsc --noEmit && vite build && npm run build:types",
|
|
32
|
-
"
|
|
33
|
-
"
|
|
35
|
+
"pack": "npm run build && npm pack",
|
|
36
|
+
"pack-bump": "npm run build && npx cic-bump && npm pack",
|
|
37
|
+
"deploy": "npm run build && npx cic-bump && npm pack && npx cic-push",
|
|
38
|
+
"only-deploy": "npm publish --access public",
|
|
39
|
+
"start": "npm run build && npm pack",
|
|
40
|
+
"cic": "npx cic-index"
|
|
34
41
|
},
|
|
35
42
|
"peerDependencies": {
|
|
36
|
-
"
|
|
43
|
+
"bootstrap": "^5.3.7",
|
|
37
44
|
"firebase": "^12.0.0",
|
|
45
|
+
"vue": "^3.3.0",
|
|
38
46
|
"vue-router": "^4.0.0"
|
|
39
47
|
},
|
|
40
48
|
"devDependencies": {
|
|
49
|
+
"@tiptap/core": "^3.18.0",
|
|
50
|
+
"@tiptap/extension-code-block": "^3.18.0",
|
|
51
|
+
"@tiptap/extension-heading": "^3.18.0",
|
|
52
|
+
"@tiptap/extension-link": "^3.18.0",
|
|
53
|
+
"@tiptap/extension-placeholder": "^3.18.0",
|
|
54
|
+
"@tiptap/starter-kit": "^3.18.0",
|
|
55
|
+
"@tiptap/vue-3": "^3.18.0",
|
|
56
|
+
"@types/bootstrap": "^5.2.10",
|
|
41
57
|
"@types/node": "^24.10.1",
|
|
42
58
|
"@vitejs/plugin-vue": "^6.0.1",
|
|
43
59
|
"@vue/tsconfig": "^0.8.1",
|
|
60
|
+
"firebase-secrets-cli": "^1.0.2",
|
|
44
61
|
"sass": "^1.77.0",
|
|
45
62
|
"typescript": "~5.9.3",
|
|
46
63
|
"vite": "^7.2.4",
|
|
47
64
|
"vue": "^3.5.24",
|
|
48
65
|
"vue-router": "^4.5.0",
|
|
49
|
-
"vue-tsc": "^3.1.4"
|
|
66
|
+
"vue-tsc": "^3.1.4",
|
|
67
|
+
"vee-validate": "^4.15.1",
|
|
68
|
+
"yup": "^1.7.1"
|
|
50
69
|
},
|
|
51
70
|
"publishConfig": {
|
|
52
71
|
"access": "public"
|