mypgs 1.1.2 → 1.3.2

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.
Files changed (40) hide show
  1. package/README.md +124 -11
  2. package/assets/javascript/_imports.js +25 -0
  3. package/assets/javascript/_pgs.js +37 -1
  4. package/assets/javascript/components/_accordion.js +105 -66
  5. package/assets/javascript/components/_dropdown.js +51 -5
  6. package/assets/javascript/components/_menu.js +71 -6
  7. package/assets/javascript/components/_modals.js +45 -3
  8. package/assets/javascript/components/_notifications.js +163 -0
  9. package/assets/javascript/components/_slides.js +12 -1
  10. package/assets/javascript/components/_stepTabs.js +18 -5
  11. package/assets/javascript/components/_steps.js +33 -6
  12. package/assets/javascript/functions/_formValidate.js +4 -5
  13. package/assets/javascript/index.js +8 -4
  14. package/assets/javascript/patterns/_header.js +1 -1
  15. package/assets/javascript/pgs.d.ts +51 -16
  16. package/assets/scss/components/_dropdown.scss +19 -26
  17. package/assets/scss/components/_logo.scss +1 -1
  18. package/assets/scss/components/_tooltip.scss +9 -1
  19. package/assets/scss/layout/_pageShell.scss +15 -20
  20. package/assets/scss/mixin/_mx-button.scss +12 -12
  21. package/dist/css/index.css +94 -96
  22. package/dist/css/index.css.map +1 -1
  23. package/dist/css/index.min.css +1 -1
  24. package/dist/index.d.ts +50 -16
  25. package/dist/javascript/index.js +840 -271
  26. package/dist/javascript/index.js.map +1 -1
  27. package/dist/javascript/index.min.js +1 -1
  28. package/package.json +7 -2
  29. package/pgs-html-suggestions.vsix +0 -0
  30. package/templates/components/md-button.html +13 -7
  31. package/templates/components/md-card.html +11 -9
  32. package/templates/components/md-dropdown.html +1 -1
  33. package/templates/components/md-modal.html +4 -4
  34. package/templates/components/md-stepTabs.html +3 -3
  35. package/templates/components/md-tooltip.html +1 -0
  36. package/templates/demo.css +4 -0
  37. package/templates/demo.js +2 -2
  38. package/assets/javascript/components/_exeNotifications.js +0 -85
  39. package/assets/javascript/functions/_notifications.js +0 -74
  40. package/assets/javascript/functions/_sendForm.js +0 -100
@@ -1 +1 @@
1
- (()=>{var e={795(){function e(e="svg"){const t=getComputedStyle(document.documentElement),n=[];for(let o=0;o<20;o++){const r=t.getPropertyValue("--"+e+"-color-"+o).toLocaleLowerCase().split("&");if(""==!r[0]&&""==!r[1]){let e=[r[0],r[1]];n.push(e)}}return n}const t=[e("svg"),e("lottie")];let n=pgs(document).querySelectorAll("toggleDarkmode");function o(e,n){e.forEach(e=>{const t=e.querySelector("i");t&&(t.classList.toggle("fa-moon",!n),t.classList.toggle("fa-sun",n))}),function(){function e(e,n="svg"){let o="true"!==document.documentElement.getAttribute("data-darkmode");e.querySelectorAll("[fill], [stroke]").forEach(e=>{for(const n of t)for(const t of n){let n=(t[0]||"").replace(/\s/g,""),r=(t[1]||"").replace(/\s/g,"");["fill","stroke"].forEach(t=>{const i=e.getAttribute(t);e.style.transition="fill 0.5s ease, stroke 0.5s ease",o?i==r&&e.setAttribute(t,n):i==n&&e.setAttribute(t,r)})}})}document.querySelectorAll('object[type="image/svg+xml"]').forEach(t=>{if(t.addEventListener("load",()=>{const n=t.contentDocument;n&&e(n,"svg")}),t.contentDocument){const e=new Event("load");t.dispatchEvent(e)}}),document.querySelectorAll("lottie-player").forEach(t=>{if(t.addEventListener("load",()=>{const n=t.shadowRoot.querySelector("svg");n&&e(n,"lottie")}),t.shadowRoot){const e=new Event("load");t.dispatchEvent(e)}})}()}"true"===localStorage.getItem("screenIsDarkMode")&&(document.body.classList.add("darkmode"),document.querySelector(":root").setAttribute("data-darkmode","true"),document.body.setAttribute("data-darkmode","true")),n.forEach(e=>{let t="true"===document.documentElement.getAttribute("data-darkmode");o(n,t),e.addEventListener("click",()=>{let e="true"!==document.documentElement.getAttribute("data-darkmode");localStorage.setItem("screenIsDarkMode",e),document.body.classList.toggle("darkmode",e),document.body.setAttribute("data-darkmode",e),document.querySelector(":root").setAttribute("data-darkmode",e),o(n,e)})})},359(){document.addEventListener("DOMContentLoaded",()=>{document.querySelectorAll('object[type="image/svg+xml"]').forEach(e=>{function t(t){if(!t)return;const n=t.querySelector("svg");if(!n)return;const o=window.getComputedStyle(e);n.setAttribute("preserveAspectRatio","cover"===o.objectFit?"xMidYMid slice":"xMidYMid meet")}function n(){const n=e.contentDocument;if(!n)return;if(!n.querySelector("svg"))return;if(t(n),e.__objectResizeObserver)return;let o=0;const r=new ResizeObserver(()=>{o||(o=requestAnimationFrame(()=>{o=0,t(n)}))});r.observe(e),e.__objectResizeObserver=r}e.contentDocument&&e.contentDocument.querySelector("svg")?n():e.addEventListener("load",n,{once:!0})}),document.body.classList.add("object-loaded")})},527(){const e=pgs(document).querySelectorAll("accordion");e.forEach((t,n)=>{const o=pgs(t).querySelector("accordion-button"),r=pgs(t).querySelector("accordion-content"),i=n+1,s=`acc-btn-${i}`,a=`acc-panel-${i}`,c=pgs(t).state.contains("open");function l(e,t,n){const o=(t?.textContent||"").trim().replace(/\s+/g," ");t.setAttribute("aria-label",`${e?"Chiudi":"Apri"} ${o||"sezione"}`),t.setAttribute("aria-expanded",String(e)),n.hidden=!e}function d(){const n=!pgs(t).state.contains("open");pgs(t).state.toggle("open",n),l(n,o,r),function(){for(const n of e){if(n===t)continue;const e=pgs(n).querySelector("accordion-button"),o=pgs(n).querySelector("accordion-content");e&&o&&(pgs(n).state().remove("open"),l(!1,e,o))}}(),n&&setTimeout(()=>t.scrollIntoView({block:"nearest",inline:"nearest"}),100)}o.setAttribute("role","button"),o.setAttribute("tabindex","0"),o.setAttribute("id",s),o.setAttribute("aria-controls",a),r.setAttribute("id",a),r.setAttribute("role","region"),r.setAttribute("aria-labelledby",s),l(c,o,r),o.addEventListener("click",d),o.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),d())})})},48(){const e="pgs_cookie_preferences_v1";function t(){window.dataLayer=window.dataLayer||[],window.gtag=window.gtag||function(){window.dataLayer.push(arguments)}}function n(e,t,n){if(!(e instanceof HTMLElement&&t))return;const o=(e.getAttribute("pgs")||"").split(/\s+/).filter(Boolean),r=n?[...new Set([...o,t])]:o.filter(e=>e!==t);r.length>0?e.setAttribute("pgs",r.join(" ")):e.removeAttribute("pgs")}document.addEventListener("DOMContentLoaded",function(){const o=pgs(document).querySelector("cookieConsent");if(!o)return;const r=o.querySelector('[pgs~="cookieConsent-toggleAnalytics"]'),i=o.querySelector('[pgs~="cookieConsent-actionAccept"]'),s=o.querySelector('[pgs~="cookieConsent-actionReject"]'),a=document.querySelectorAll('[pgs~="cookieConsent-actionOpen"]'),c=(o.dataset.gaId||"").trim(),l=c.length>0;let d=null;function u(e){o.hidden=!e,o.setAttribute("aria-hidden",String(!e)),document.body.classList.toggle("cookieConsent-open",e),e?(d=document.activeElement,setTimeout(()=>{o.focus()},0)):d instanceof HTMLElement&&d.focus({preventScroll:!0})}function p(){u(!1)}function g(r){!function(t){try{localStorage.setItem(e,JSON.stringify({...t,updatedAt:(new Date).toISOString()}))}catch(e){console.warn("PGS cookie consent: impossibile salvare le preferenze",e)}}({analytics:r}),n(o,"cookieConsent-accepted",!!r),n(o,"cookieConsent-declined",!r),function({allowAnalytics:e,measurementId:n}){t(),e?(window.gtag("consent","update",{analytics_storage:"granted"}),function(e){if(!e||window.__PGS_gaLoaded)return;window.__PGS_gaLoaded=!0;const t=document.createElement("script");t.async=!0,t.src=`https://www.googletagmanager.com/gtag/js?id=${e}`,document.head.appendChild(t),window.gtag("js",new Date),window.gtag("config",e,{anonymize_ip:!0,allow_google_signals:!1})}(n)):window.gtag("consent","update",{analytics_storage:"denied"})}({allowAnalytics:!!r,measurementId:c})}!function({root:e,analyticsToggle:t,acceptAllButton:n,rejectButton:o,openButtons:r}){e.dataset.cookieComponent="consent",t?.setAttribute("data-cookie-toggle","analytics"),n?.setAttribute("data-cookie-action","accept"),o?.setAttribute("data-cookie-action","reject"),e.querySelector('[pgs~="cookieConsent-featureEssential"]')?.setAttribute("data-cookie-feature","essential"),e.querySelector('[pgs~="cookieConsent-featureAnalytics"]')?.setAttribute("data-cookie-feature","analytics"),r.forEach(e=>{e.setAttribute("data-cookie-action","open")})}({root:o,analyticsToggle:r,acceptAllButton:i,rejectButton:s,openButtons:a}),r&&(r.disabled=!l,l?n(o,"cookieConsent-gaUnavailable",!1):(r.checked=!1,n(o,"cookieConsent-gaUnavailable",!0))),t(),window.gtag("consent","default",{analytics_storage:"denied"}),i?.addEventListener("click",()=>{r&&l&&(r.checked=!0),g(!!l),p()}),s?.addEventListener("click",()=>{const e=!!r&&r.checked&&l;!e&&r&&(r.checked=!1),g(e),p()}),r?.addEventListener("change",e=>{!l&&e.target instanceof HTMLInputElement&&(e.target.checked=!1)}),o.addEventListener("keydown",e=>{if("Escape"===e.key)e.preventDefault(),p();else if("Tab"===e.key){const t=o.querySelectorAll('a[href], button:not([disabled]), input:not([disabled]), [tabindex]:not([tabindex="-1"])');if(0===t.length)return;const n=t[0],r=t[t.length-1];e.shiftKey||document.activeElement!==r||(e.preventDefault(),n.focus()),e.shiftKey&&document.activeElement===n&&(e.preventDefault(),r.focus())}}),a.forEach(e=>{e.addEventListener("click",e=>{e.preventDefault(),u(!0)})});const f=function(){try{return function(e){try{return e?JSON.parse(e):null}catch(e){return console.warn("PGS cookie consent: impossibile leggere le preferenze",e),null}}(localStorage.getItem(e))}catch(e){return null}}();f&&"boolean"==typeof f.analytics?(r&&(r.checked=!!f.analytics&&l),g(f.analytics&&l),p()):u(!0)})}},t={};function n(o){var r=t[o];if(void 0!==r)return r.exports;var i=t[o]={exports:{}};return e[o](i,i.exports,n),i.exports}(()=>{"use strict";function e(){pgs(document).querySelectorAll("dropdown").forEach((e,t)=>{const n=pgs(e).querySelector("dropdown-button"),o=pgs(e).querySelector("dropdown-content");if(!n||!o)return;if("true"===e.getAttribute("data-initialize"))return;e.setAttribute("data-initialize","true");const r=`--dropdown-anchor-${t}`;e.style.setProperty("--dropdown-anchor",r),n.id||(n.id=`dropdown-btn-${t}`),o.id||(o.id=`dropdown-panel-${t}`),n.setAttribute("type","button"),n.setAttribute("aria-haspopup","true"),n.setAttribute("aria-controls",o.id),n.setAttribute("aria-expanded","false"),o.setAttribute("aria-labelledby",n.id),o.hasAttribute("popover")||o.setAttribute("popover","auto"),n.setAttribute("popovertarget",o.id),n.setAttribute("popovertargetaction","toggle");const i=CSS.supports("anchor-name: --dropdown-anchor")&&CSS.supports("position-anchor: --dropdown-anchor")&&CSS.supports("position-area: bottom")&&CSS.supports("top: anchor(bottom)"),s=()=>{if(i)return;const t=n.getBoundingClientRect(),r=getComputedStyle(e),s=parseFloat(r.getPropertyValue("--dropdown-offset"))||10,a=parseFloat(r.getPropertyValue("--dropdown-padding"))||0,c=parseFloat(r.getPropertyValue("--dropdown-arrow-size"))||12,l=window.innerWidth,d=l-16,u=getComputedStyle(o),p=parseFloat(u.maxWidth),g=Number.isFinite(p)?Math.min(p,d):d,f=Math.min(Math.max(o.scrollWidth+2*a,t.width),g),m=t.bottom+s,b=t.left+t.width/2-f/2,h=Math.min(Math.max(b,8),l-f-8),y=t.left+t.width/2,v=Math.min(Math.max(y-h,a+c),f-a-c);e.style.setProperty("--dropdown-fallback-top",`${m}px`),e.style.setProperty("--dropdown-fallback-left",`${h}px`),e.style.setProperty("--dropdown-arrow-left",`${v}px`)};n.addEventListener("click",e=>{i||(e.preventDefault(),o.matches(":popover-open")?o.hidePopover():(s(),o.showPopover()))}),o.addEventListener("toggle",t=>{const r=o.matches(":popover-open");n.setAttribute("aria-expanded",r?"true":"false"),pgs(e).state.toggle("open",r),r&&(s(),o.querySelector('a, button, input, select, textarea, [tabindex]:not([tabindex="-1"])')?.focus())}),window.addEventListener("resize",()=>{o.matches(":popover-open")&&s()}),window.addEventListener("scroll",()=>{o.matches(":popover-open")&&s()},!0)})}function t(e,t,n,o,r,i="replace",s=null){let a=pgs(document).querySelector(t);if(!a){const e=document.createElement("div");pgs(e).add(t),e.setAttribute("aria-live","polite"),e.setAttribute("aria-relevant","additions"),document.body.appendChild(e),a=e}const c=document.createElement(s?"a":"div");function l(){"stack"==i?c.style.translate="120%":c.style.opacity="0",setTimeout(()=>c.remove(),300)}"replace"==i&&(a.innerHTML=""),s&&(c.href=s),r>0&&c.style.setProperty("--notification-timeout",r+"ms"),pgs(c).state.add(e),pgs(c).add("notification-element"),c.setAttribute("role","error"==e?"alert":"status"),c.innerHTML=`${n} <p>${o}</p>`,a.appendChild(c),r>0&&setTimeout(()=>{l()},r);const d=document.createElement("button");d.type="button",d.ariaLabel="Rimuovi notifica",d.innerHTML='<i class="fa-solid fa-xmark"></i>',d.setAttribute("pgs","buttonClose"),c.insertAdjacentElement("afterbegin",d),d.addEventListener("click",function(e){e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),l()})}function o(e){let t=pgs(document).querySelector(e);t&&(t.innerHTML="")}globalThis.pgs??=function(e){const t="pgs";if(!e)throw new TypeError("pgs(root): root richiesto");const n="function"==typeof e.getAttribute&&"function"==typeof e.setAttribute;if("function"!=typeof e.querySelector||"function"!=typeof e.querySelectorAll)throw new TypeError("pgs(root): root deve supportare querySelector/querySelectorAll");function o(t){throw new TypeError(`pgs(${e.nodeName||"root"}).${t}(): disponibile solo su Element (non su Document)`)}function r(e){return Array.isArray(e)&&(e=e.join(",")),String(e).split(",").map(e=>e.trim()).filter(Boolean).map(e=>`[${t}~="${e}"]`).join(",")}function i(e,n=" "){return(e.getAttribute(t)||"").split(n).filter(Boolean)}function s(e,n,o=" "){e.setAttribute(t,n.join(o))}function a(t){if(n)return o.contains=function(n){const o=e.getAttribute(t)||"",r=String(n).replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(`(?:^|\\s)${r}(?:\\[[^\\]]*\\])?(?=\\s|$)`).test(o)},o.getValueBrackets=function(n){const o=e.getAttribute(t)||"",r=String(n).replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),i=o.match(new RegExp(`(?:^|\\s)${r}\\[([^\\]]*)\\]`));return i?i[1]:void 0},Object.defineProperty(o,"value",{get:()=>e.getAttribute(t),set(n){e.setAttribute(t,n)}}),o;function o(){return o}}const c=function(){function a(){return a}return a.querySelector=function(t){return e.querySelector(r(t))},a.querySelectorAll=function(t){return e.querySelectorAll(r(t))},a.add=function(...t){if(!n)return o("add");const r=i(e);for(const e of t)r.includes(e)||r.push(e);return s(e,r),a},a.remove=function(...t){return n?(s(e,i(e).filter(e=>!t.includes(e))),a):o("remove")},a.toggle=function(t,r){if(!n)return o("toggle");const s=i(e).includes(t);return void 0!==r?(r&&!s&&a.add(t),!r&&s&&a.remove(t),!!r):s?(a.remove(t),!1):(a.add(t),!0)},a.contains=function(t){return n?i(e).includes(t):o("contains")},Object.defineProperty(a,"value",{get(){if(n)return e.getAttribute(t)},set(r){if(!n)return o("value");e.setAttribute(t,r)}}),a}();return c.state=function(t){if(!n)return;const o=(n=" ")=>(e.getAttribute(t)||"").split(n).filter(Boolean),r=(n,o=" ")=>e.setAttribute(t,n.join(o));function i(...e){return i.add(...e),i}return i.add=function(...e){const t=e.flat().map(e=>String(e).trim()).filter(Boolean),n=o();for(const e of t)n.includes(e)||n.push(e);return r(n),i},i.remove=function(...e){const t=e.flat().map(e=>String(e).trim()).filter(Boolean),n=o().filter(e=>!t.includes(e));return r(n),i},i.toggle=function(e,t){const n=String(e).trim();if(!n)return!1;const i=o(),s=i.includes(n);return void 0!==t?(t&&!s&&(i.push(n),r(i)),!t&&s&&r(i.filter(e=>e!==n)),!!t):s?(r(i.filter(e=>e!==n)),!1):(i.push(n),r(i),!0)},i.contains=function(e){const t=String(e).trim();return!!t&&o().includes(t)},Object.defineProperty(i,"value",{get:()=>e.getAttribute(t),set(n){e.setAttribute(t,n)}}),i}("pgs-state"),c.option=a("pgs-option"),c.modules=a("pgs-modules"),c},n(795),n(359),n(527),e();let r={error:(e="Errore",n=null,o=0,r='<i class="fa-solid fa-octagon-xmark"></i>')=>t("error","notification",r,e,o,"stack",n),success:(e="Aggiornato",n=null,o=0,r='<i class="fa-solid fa-check"></i>')=>t("success","notification",r,e,o,"stack",n),info:(e="Aggiornamento",n=null,o=0,r='<i class="fa-solid fa-circle-info"></i>')=>t("info","notification",r,e,o,"stack",n),warning:(e="Attenzione",n=null,o=0,r='<i class="fa-solid fa-triangle-exclamation"></i>')=>t("warning","notification",r,e,o,"stack",n),deleteAllNotification:()=>o("notification")},i={error:(e="Errore",n=4e3,o='<i class="fa-solid fa-octagon-xmark"></i>')=>t("error","toast",o,e,n),success:(e="Aggiornato",n=4e3,o='<i class="fa-solid fa-check"></i>')=>t("success","toast",o,e,n),info:(e="Aggiornamento",n=0,o='<i class="fa-solid fa-circle-info"></i>')=>t("info","toast",o,e,n),warning:(e="Attenzione",n=4e3,o='<i class="fa-solid fa-triangle-exclamation"></i>')=>t("warning","toast",o,e,n),deleteTost:()=>o("toast")};function s(e){return String(e??"")}function a(e){if(!e||"true"===e.dataset.initialize)return;e.dataset.initialize="true";const t=function(e){try{return JSON.parse(e.dataset.notification||"{}")}catch(e){return console.warn("PGS notification: dati non validi",e),{}}}(e),n=String(t.title||"").trim(),o=String(t.message||"").trim();if(!n&&!o)return void e.remove();const a=t.link||null,c=t.icon||void 0,l=function(e){const t=e.duration,n=Number.parseInt(t,10);return Number.isNaN(n)?5e3:n}(t),d=function(e){return"toast"===String(e.element||"notification").trim()?i:r}(t),u=function(e,t){const n=String(e.type||"info").trim();return"function"==typeof t[n]?n:"info"}(t,d),p=function(e,t){const n=s(t),o=s(e);return o?n?`\n <span pgs="notification-element-title">${o}</span>\n <br>\n <span pgs="notification-element-content">${n}</span>\n `:`<span pgs="notification-element-title">${o}</span>`:n}(n,o);d===i?d[u](p,l,c):d[u](p,a,l,c),e.remove()}function c(){pgs(document).querySelectorAll("notificationTrigger").forEach(a)}"loading"===document.readyState?document.addEventListener("DOMContentLoaded",c):c(),pgs(document).querySelectorAll("menu-horizontal").forEach(e=>{e.querySelectorAll("nav > ul > li.menu-item-has-children").forEach(e=>{if(e.querySelector("ul")){const t=e.querySelector("ul"),n=document.createElement("button");n.className="icon-down",n.type="button",n.innerHTML="<span>&#9207;</span>",e.querySelector("a").insertAdjacentElement("afterend",n),pgs(e).add("dropdown"),pgs(n).add("dropdown-button"),pgs(n).add("buttonNohover"),pgs(t).add("dropdown-content"),pgs(t).add("menu-vertical")}})}),pgs(document).querySelectorAll("menu-vertical").forEach(e=>{e.querySelectorAll(".menu-item-has-children").forEach((e,t)=>{const n=e.querySelector("ul");if(!n)return;const o=document.createElement("button");o.className="icon-down buttonIcon",o.type="button";const r=`vertical-submenu-${t}`;function i(){const e=pgs(n).state.toggle("open");o.setAttribute("aria-expanded",e),o.setAttribute("aria-label",e?"Chiudi sottomenu":"Apri sottomenu")}n.id=r,pgs(o).add("buttonIcon"),o.setAttribute("aria-expanded","false"),o.setAttribute("aria-controls",r),o.setAttribute("aria-label","Apri sottomenu"),o.innerHTML="<span aria-hidden='true'>&#9207;</span>",e.querySelector("a").insertAdjacentElement("afterend",o),o.addEventListener("click",i),o.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),i())})})}),e(),function(e="modal"){pgs(document).querySelectorAll(e).forEach(e=>{const t=pgs(e).querySelector("modal-button"),n=e.querySelector("dialog");if(!t||!n)return;const o='<button pgs="buttonClose modal-close" type="button" tabindex="0" aria-label="Chiudi"><i class="fa-solid fa-close"></i></button>',r=pgs(e)?.querySelector("modal-dialog-content-header"),i=pgs(e).option.contains("disableBackdropClose"),s=pgs(e).option.contains("history"),a=pgs(e).option.getValueBrackets("containerID"),c=pgs(e).option.getValueBrackets("containerPGS"),l=pgs(n).option.contains("topLevel");pgs(e).querySelector("modal-close")||(r?r.insertAdjacentHTML("beforeend",o):n.insertAdjacentHTML("beforeend",o));const d=pgs(e).querySelector("modal-close");function u(e=!0){t?.setAttribute("aria-expanded",e),n?.setAttribute("aria-expanded",e)}function p(t){t?.stopImmediatePropagation(),n.open||document.querySelectorAll("dialog[open]").forEach(e=>e.close()),u(!0),n.open?g(t):l?n.showModal():n.show(),e.dispatchEvent(new CustomEvent("modal:open")),n.dispatchEvent(new CustomEvent("modal:open"))}function g(t){t?.stopImmediatePropagation(),u(!1),n.close(),e.dispatchEvent(new CustomEvent("modal:close")),n.dispatchEvent(new CustomEvent("modal:close"))}pgs(n).add("dialog modal-dialog"),t.setAttribute("role","button"),t.setAttribute("aria-label","apri modale"),l||(a?document.querySelector("#"+a)?.append(n):c?pgs(document).querySelector(c)?.append(n):document.body.append(n)),t.addEventListener("click",e=>p(e)),t.addEventListener("keypress",e=>!n.open&&("Enter"===e.key||" "===e.key)&&p(e)),n.addEventListener("close",()=>u(!1)),n.addEventListener("click",e=>{e.target!=n||i||g(e)}),d?.addEventListener("click",e=>g(e)),s&&t.id&&(setTimeout(function(){new URLSearchParams(window.location.search).get("modal")===t.id&&(document.getElementById(t.id)?.scrollIntoView({behavior:"smooth"}),p())},1),new MutationObserver(()=>{let e=n.hasAttribute("open");try{const n=new URL(window.location.href),o=new URLSearchParams(n.search);e?o.set("modal",t.id):o.delete("modal"),n.search=o.toString()?`?${o.toString()}`:"",window.history.pushState({modal:t.id,open:e},"",n)}catch(e){}}).observe(n,{attributes:!0,attributeFilter:["open"]}),window.addEventListener("popstate",()=>{try{const e=new URLSearchParams(window.location.search).get("modal")===t.id;e&&!n.open&&n.showModal(),!e&&n.open&&g()}catch(e){}}))})}();const l=new WeakMap;class d{constructor({selector:e,viewRatio:t=.97,optionIntersectionObserver:n={},scrollOptions:o={}}={}){this.selector=e,this.viewRatio=t,this.optionIntersectionObserver={threshold:Array.from({length:101},(e,t)=>t/100),rootMargin:"0px",...n},this.scrollOptions={behavior:"smooth",inline:"center",block:"nearest",container:"nearest",...o},this.container=this.selector?pgs(this.selector).querySelector("slides-container"):null}#e(){const e=this.selector;pgs(e).querySelector("slides-prec")||pgs(e).querySelector("slides-next")||(e.insertAdjacentHTML("afterbegin",'<button pgs="slides-prec buttonIcon" type="button" class="precButton" aria-label="slide precedente"> <span> <i class="fa-solid fa-arrow-left"></i></span></button>'),e.insertAdjacentHTML("beforeend",'<button pgs="slides-next buttonIcon" type="button" class="nextButton" aria-label="prossima slide"> <span> <i class="fa-solid fa-arrow-right"></i></span></button>')),pgs(e).querySelector("slides-dots")||(e.insertAdjacentHTML("beforeend",'<div pgs="slides-dots" class="slides-dots"></div>'),Array.from(this.container.children).forEach(()=>{pgs(e).querySelector("slides-dots").insertAdjacentHTML("beforeend",'<button type="button" class="slide-dot" aria-label="vai alla prossima slide"></button>')}))}#t(){const e=this.container.querySelectorAll(".view");let t;t=pgs(this.selector).option.contains("singleScroll")?e[e.length-1]:e[0];const n=t?.previousElementSibling;n?.scrollIntoView(this.scrollOptions),n?.focus({preventScroll:!0})}#n(){const e=this.container.querySelectorAll(".view");let t;t=pgs(this.selector).option.contains("singleScroll")?e[0]:e[e.length-1];const n=t?.nextElementSibling;console.log(t,n),n?.scrollIntoView(this.scrollOptions),n?.focus({preventScroll:!0})}#o(e){this.container.children[e].scrollIntoView(this.scrollOptions)}#r(e,t,n,o,r){e.forEach(e=>{const i=.9+.1*e.intersectionRatio,s=i>=.98;!pgs(e.target).option.contains("notScrollAnimation")&&e.target.firstElementChild&&e.target.firstElementChild.style.setProperty("--visible-percent",`${i}`),e.target.classList.toggle("view",s),e.target.classList.toggle("notView",!s);const a=e.target.parentNode.children,c=a[0].classList.contains("view"),l=a[a.length-1].classList.contains("view");o.disabled=l,n.disabled=c,o.setAttribute("aria-disabled",String(l)),n.setAttribute("aria-disabled",String(c));const d=Array.from(t.children).filter(e=>e.classList.contains("view"));r.forEach((e,n)=>{const o=d.some(e=>Array.from(t.children).indexOf(e)===n);e.classList.toggle("active",o),e.setAttribute("aria-current",o?"true":"false")})})}execute(){const e=this.selector;if(!this.container)return;this.#e();const t=pgs(e).querySelector("slides-prec"),n=pgs(e).querySelector("slides-next"),o=Array.from(pgs(e).querySelector("slides-dots").children);pgs(e).option.contains("notScrollWithMouse")||function(e){const t=(()=>{let e=0,t=0,n=0,o=!1;return{update:function(r){const i=performance.now(),s=i-e;let a=Math.abs(r.deltaY);return 1===r.deltaMode?a*=16:2===r.deltaMode&&(a*=r.currentTarget?.clientHeight||800),a<30&&s<35&&t++,n++,n>=6&&(o=t>=3,t=0,n=0),e=i,o},get value(){return o}}})();let n=e;n.addEventListener("wheel",e=>{if(t.update(e))return;if(e.ctrlKey)return;if(Math.abs(e.deltaX)>Math.abs(e.deltaY))return;let o=e.deltaY;1===e.deltaMode?o*=16:2===e.deltaMode&&(o*=n.clientHeight);const r=n.scrollLeft<=0,i=n.scrollLeft+n.clientWidth>=n.scrollWidth-1;(o>0&&!i||o<0&&!r)&&(e.preventDefault(),n.scrollLeft+=5*o)},{passive:!1})}(this.container),o.forEach((e,t)=>e.addEventListener("click",e=>this.#o(t))),t.addEventListener("click",e=>this.#t(),{passive:!0}),n.addEventListener("click",e=>this.#n(),{passive:!0});const r=new IntersectionObserver(e=>this.#r(e,this.container,t,n,o),{root:this.container,...this.optionIntersectionObserver});Array.from(this.container.children).forEach(e=>r.observe(e)),l.set(this.selector,{element:this.selector,container:this.container,previous:()=>this.#t(),next:()=>this.#n(),goTo:e=>this.#o(e),getCurrentIndexes:()=>Array.from(this.container.children).map((e,t)=>e.classList.contains("view")?t:-1).filter(e=>-1!==e),getCurrentElements:()=>Array.from(this.container.children).filter(e=>e.classList.contains("view")),getTotal:()=>this.container.children.length,isAtStart:()=>this.container.children[0]?.classList.contains("view")||!1,isAtEnd:()=>{const e=this.container.children,t=e[e.length-1];return t?.classList.contains("view")||!1}})}}!function(e=document){pgs(e).querySelectorAll("slides").forEach(e=>{l.has(e)||new d({selector:e}).execute()})}(),pgs(document).querySelectorAll("steps").forEach(e=>{pgs(e).querySelectorAll("steps-step").forEach((e,t)=>{let n;pgs(e).querySelector("steps-step-circle")?n=pgs(e).querySelector("steps-step-circle"):(n=document.createElement("span"),pgs(n).add("steps-step-circle"),n.textContent=t+1,e.insertAdjacentElement("afterbegin",n));const o=document.createElement("span");pgs(o).add("steps-step-line"),e.insertAdjacentElement("afterbegin",o)})});const u=new WeakMap;pgs(document).querySelectorAll("stepTabs").forEach(e=>{if("true"===e.dataset.stepTabsInitialized)return;e.dataset.stepTabsInitialized="true";const t=pgs(e).querySelector("stepTabs-prev"),n=pgs(e).querySelector("stepTabs-next"),o=pgs(e).querySelector("stepTabs-restart"),r=pgs(e).querySelector("stepTabs-dots"),i=pgs(e).querySelector("stepTabs-container"),s=pgs(i).querySelectorAll("tab"),a=s.length,c=Array.from(s).filter(e=>pgs(e).state.contains("is-locked"));let l=0;t&&(t.disabled=!0);let d=!1;if(!i||0===a)return;const p=[];function g(e,t,n){e&&n!==pgs(e).state.contains(t)&&pgs(e).state.toggle(t,n)}function f(){const e=s[l];t&&(t.disabled=0===l),n&&(n.disabled=l===a-1||pgs(e).state.contains("is-locked"))}function m(t,n=!0){l=Math.min(Math.max(t,0),a-1);const o=s[l];d=!0,s.forEach((e,t)=>g(e,"is-active",t===l)),f(),p.forEach((e,t)=>{g(e,"is-active",t===l),g(e,"is-completed",t<l)}),d=!1,n&&!e.closest("dialog")&&(o?.focus(),e?.scrollIntoView({behavior:"smooth",block:"start"})),e.dispatchEvent(new CustomEvent("stepTabs:change",{detail:{current:l,total:a}}))}function b(){m(0),c.forEach(e=>pgs(e).state.add("is-locked"))}r&&(r.innerHTML="",s.forEach((e,t)=>{const n=e.getAttribute("data-tab-icon")||"fa-circle",o=document.createElement("button");o.type="button",pgs(o).add("stepTabs-dots-dot"),o.setAttribute("data-step",t),o.innerHTML=`<i class="fa-solid ${n}"></i>`,o.addEventListener("click",()=>{pgs(o).state.contains("is-completed")&&m(t,!0)}),r.appendChild(o),p.push(o)})),m(0,!1);const h=new MutationObserver(()=>{d||f()});s?.forEach(e=>h.observe(e,{attributes:!0,attributeFilter:["pgs-state"]})),t?.addEventListener("click",e=>m(l-1)),n?.addEventListener("click",e=>{f(),n.disabled||m(l+1)}),o?.addEventListener("click",e=>b(),{capture:!0}),u.set(e,{restart:b,goTo:m,next:()=>m(l+1),prev:()=>m(l-1),toggleLock:(e,t=!0)=>"number"==typeof e&&s[e]&&(pgs(s[e]).state.toggle("is-locked",t),m(l)),getCurrent:()=>l,getState:()=>({current:l,total:a})})});const p=pgs(document).querySelector("header");pgs(p).querySelectorAll("header-element").forEach(e=>function(e){if("true"==e.getAttribute("data-initialize"))return;e.setAttribute("data-initialize","true");let t,n=!1;let o=0;const r=()=>{o||(o=requestAnimationFrame(()=>{o=0,function(o){let r,i=window.getComputedStyle(o),s=parseFloat(i.paddingLeft)+parseFloat(i.paddingRight),a=parseFloat(i.gap),c=parseInt(o.offsetWidth-s);if(n)r=t;else{let e=[];Array.from(o.children).filter(e=>!pgs(e).contains("header-element-onlyMobile")).forEach(t=>{pgs(t).contains("header-element-hamburger")||e.push(...t.children)}),a=Math.round(a*(e.length-1)),r=e.reduce((e,t)=>e+t.offsetWidth,0)-2+a}window.innerWidth<600?(p.setAttribute("data-header-mobileActive","true"),e.setAttribute("data-header-mobileActive","true")):c<r?(p.setAttribute("data-header-mobileActive","true"),o.setAttribute("data-header-mobileActive","true"),n=!0,t=r):(p.setAttribute("data-header-mobileActive","false"),o.setAttribute("data-header-mobileActive","false"))}(e)}))};new ResizeObserver(r).observe(e),r()}(e));const g=document.querySelector("body");function f(){const e=document.querySelectorAll("header > [data-initialize=true]"),t=window.getComputedStyle(document.documentElement).marginTop??0,n=Array.from(e).map(e=>e.offsetHeight).reduce((e,t)=>e+t)+parseInt(t);g.style.setProperty("--heightOfHeader",`${n}px`);const o="true"===document.querySelector("header").getAttribute("data-header-scroll")?0:n;g.style.setProperty("--heightOfHeaderScroll",`${o}px`)}f(),window.addEventListener("resize",f),window.addEventListener("scroll",f);let m=window.scrollY;window.addEventListener("scroll",()=>{let e=window.scrollY;window.innerHeight<=900&&(e>=80?e>m?(p.style.transform="translateY(-100%)",p.setAttribute("data-header-scroll",!0)):(p.style.transform="translateY(0px)",p.setAttribute("data-header-scroll",!1)):(p.style.transform="translateY(0)",p.setAttribute("data-header-scroll",!1))),m=e}),window.addEventListener("resize",()=>{window.innerWidth>768&&(p.style.transform="translateY(0)")}),window.innerWidth<600&&(document.querySelector("header").setAttribute("data-header-mobileActive","true"),document.querySelector("[pgs~=header-element]").setAttribute("data-header-mobileActive","true")),n(48)})()})();
1
+ (()=>{var e={795(){function e(e="svg"){const t=getComputedStyle(document.documentElement),o=[];for(let n=0;n<20;n++){const r=t.getPropertyValue("--"+e+"-color-"+n).toLocaleLowerCase().split("&");if(""==!r[0]&&""==!r[1]){let e=[r[0],r[1]];o.push(e)}}return o}const t=[e("svg"),e("lottie")];let o=pgs(document).querySelectorAll("toggleDarkmode");function n(e,o){e.forEach(e=>{const t=e.querySelector("i");t&&(t.classList.toggle("fa-moon",!o),t.classList.toggle("fa-sun",o))}),function(){function e(e,o="svg"){let n="true"!==document.documentElement.getAttribute("data-darkmode");e.querySelectorAll("[fill], [stroke]").forEach(e=>{for(const o of t)for(const t of o){let o=(t[0]||"").replace(/\s/g,""),r=(t[1]||"").replace(/\s/g,"");["fill","stroke"].forEach(t=>{const i=e.getAttribute(t);e.style.transition="fill 0.5s ease, stroke 0.5s ease",n?i==r&&e.setAttribute(t,o):i==o&&e.setAttribute(t,r)})}})}document.querySelectorAll('object[type="image/svg+xml"]').forEach(t=>{if(t.addEventListener("load",()=>{const o=t.contentDocument;o&&e(o,"svg")}),t.contentDocument){const e=new Event("load");t.dispatchEvent(e)}}),document.querySelectorAll("lottie-player").forEach(t=>{if(t.addEventListener("load",()=>{const o=t.shadowRoot.querySelector("svg");o&&e(o,"lottie")}),t.shadowRoot){const e=new Event("load");t.dispatchEvent(e)}})}()}"true"===localStorage.getItem("screenIsDarkMode")&&(document.body.classList.add("darkmode"),document.querySelector(":root").setAttribute("data-darkmode","true"),document.body.setAttribute("data-darkmode","true")),o.forEach(e=>{let t="true"===document.documentElement.getAttribute("data-darkmode");n(o,t),e.addEventListener("click",()=>{let e="true"!==document.documentElement.getAttribute("data-darkmode");localStorage.setItem("screenIsDarkMode",e),document.body.classList.toggle("darkmode",e),document.body.setAttribute("data-darkmode",e),document.querySelector(":root").setAttribute("data-darkmode",e),n(o,e)})})},359(){document.addEventListener("DOMContentLoaded",()=>{document.querySelectorAll('object[type="image/svg+xml"]').forEach(e=>{function t(t){if(!t)return;const o=t.querySelector("svg");if(!o)return;const n=window.getComputedStyle(e);o.setAttribute("preserveAspectRatio","cover"===n.objectFit?"xMidYMid slice":"xMidYMid meet")}function o(){const o=e.contentDocument;if(!o)return;if(!o.querySelector("svg"))return;if(t(o),e.__objectResizeObserver)return;let n=0;const r=new ResizeObserver(()=>{n||(n=requestAnimationFrame(()=>{n=0,t(o)}))});r.observe(e),e.__objectResizeObserver=r}e.contentDocument&&e.contentDocument.querySelector("svg")?o():e.addEventListener("load",o,{once:!0})}),document.body.classList.add("object-loaded")})},48(){const e="pgs_cookie_preferences_v1";function t(){window.dataLayer=window.dataLayer||[],window.gtag=window.gtag||function(){window.dataLayer.push(arguments)}}function o(e,t,o){if(!(e instanceof HTMLElement&&t))return;const n=(e.getAttribute("pgs")||"").split(/\s+/).filter(Boolean),r=o?[...new Set([...n,t])]:n.filter(e=>e!==t);r.length>0?e.setAttribute("pgs",r.join(" ")):e.removeAttribute("pgs")}document.addEventListener("DOMContentLoaded",function(){const n=pgs(document).querySelector("cookieConsent");if(!n)return;const r=n.querySelector('[pgs~="cookieConsent-toggleAnalytics"]'),i=n.querySelector('[pgs~="cookieConsent-actionAccept"]'),s=n.querySelector('[pgs~="cookieConsent-actionReject"]'),a=document.querySelectorAll('[pgs~="cookieConsent-actionOpen"]'),c=(n.dataset.gaId||"").trim(),l=c.length>0;let d=null;function u(e){n.hidden=!e,n.setAttribute("aria-hidden",String(!e)),document.body.classList.toggle("cookieConsent-open",e),e?(d=document.activeElement,setTimeout(()=>{n.focus()},0)):d instanceof HTMLElement&&d.focus({preventScroll:!0})}function p(){u(!1)}function g(r){!function(t){try{localStorage.setItem(e,JSON.stringify({...t,updatedAt:(new Date).toISOString()}))}catch(e){console.warn("PGS cookie consent: impossibile salvare le preferenze",e)}}({analytics:r}),o(n,"cookieConsent-accepted",!!r),o(n,"cookieConsent-declined",!r),function({allowAnalytics:e,measurementId:o}){t(),e?(window.gtag("consent","update",{analytics_storage:"granted"}),function(e){if(!e||window.__PGS_gaLoaded)return;window.__PGS_gaLoaded=!0;const t=document.createElement("script");t.async=!0,t.src=`https://www.googletagmanager.com/gtag/js?id=${e}`,document.head.appendChild(t),window.gtag("js",new Date),window.gtag("config",e,{anonymize_ip:!0,allow_google_signals:!1})}(o)):window.gtag("consent","update",{analytics_storage:"denied"})}({allowAnalytics:!!r,measurementId:c})}!function({root:e,analyticsToggle:t,acceptAllButton:o,rejectButton:n,openButtons:r}){e.dataset.cookieComponent="consent",t?.setAttribute("data-cookie-toggle","analytics"),o?.setAttribute("data-cookie-action","accept"),n?.setAttribute("data-cookie-action","reject"),e.querySelector('[pgs~="cookieConsent-featureEssential"]')?.setAttribute("data-cookie-feature","essential"),e.querySelector('[pgs~="cookieConsent-featureAnalytics"]')?.setAttribute("data-cookie-feature","analytics"),r.forEach(e=>{e.setAttribute("data-cookie-action","open")})}({root:n,analyticsToggle:r,acceptAllButton:i,rejectButton:s,openButtons:a}),r&&(r.disabled=!l,l?o(n,"cookieConsent-gaUnavailable",!1):(r.checked=!1,o(n,"cookieConsent-gaUnavailable",!0))),t(),window.gtag("consent","default",{analytics_storage:"denied"}),i?.addEventListener("click",()=>{r&&l&&(r.checked=!0),g(!!l),p()}),s?.addEventListener("click",()=>{const e=!!r&&r.checked&&l;!e&&r&&(r.checked=!1),g(e),p()}),r?.addEventListener("change",e=>{!l&&e.target instanceof HTMLInputElement&&(e.target.checked=!1)}),n.addEventListener("keydown",e=>{if("Escape"===e.key)e.preventDefault(),p();else if("Tab"===e.key){const t=n.querySelectorAll('a[href], button:not([disabled]), input:not([disabled]), [tabindex]:not([tabindex="-1"])');if(0===t.length)return;const o=t[0],r=t[t.length-1];e.shiftKey||document.activeElement!==r||(e.preventDefault(),o.focus()),e.shiftKey&&document.activeElement===o&&(e.preventDefault(),r.focus())}}),a.forEach(e=>{e.addEventListener("click",e=>{e.preventDefault(),u(!0)})});const f=function(){try{return function(e){try{return e?JSON.parse(e):null}catch(e){return console.warn("PGS cookie consent: impossibile leggere le preferenze",e),null}}(localStorage.getItem(e))}catch(e){return null}}();f&&"boolean"==typeof f.analytics?(r&&(r.checked=!!f.analytics&&l),g(f.analytics&&l),p()):u(!0)})},107(){const e=pgs(document).querySelector("header");pgs(e).querySelectorAll("header-element").forEach(t=>function(t){if("true"==t.getAttribute("data-initialize"))return;t.setAttribute("data-initialize","true");let o,n=!1;let r=0;const i=()=>{r||(r=requestAnimationFrame(()=>{r=0,function(r){let i,s=window.getComputedStyle(r),a=parseFloat(s.paddingLeft)+parseFloat(s.paddingRight),c=parseFloat(s.gap),l=parseInt(r.offsetWidth-a);if(n)i=o;else{let e=[];Array.from(r.children).filter(e=>!pgs(e).contains("header-element-onlyMobile")).forEach(t=>{pgs(t).contains("header-element-hamburger")||e.push(...t.children)}),c=Math.round(c*(e.length-1)),i=e.reduce((e,t)=>e+t.offsetWidth,0)-2+c}window.innerWidth<600?(e.setAttribute("data-header-mobileActive","true"),t.setAttribute("data-header-mobileActive","true")):l<i?(e.setAttribute("data-header-mobileActive","true"),r.setAttribute("data-header-mobileActive","true"),n=!0,o=i):(e.setAttribute("data-header-mobileActive","false"),r.setAttribute("data-header-mobileActive","false"))}(t)}))};new ResizeObserver(i).observe(t),i()}(t));const t=document.querySelector("body");function o(){const e=document.querySelectorAll("header > [data-initialize=true]"),o=window.getComputedStyle(document.documentElement).marginTop??0,n=Array.from(e).map(e=>e.offsetHeight).reduce((e,t)=>e+t)+parseInt(o);t.style.setProperty("--heightOfHeader",`${n}px`);const r="true"===document.querySelector("header").getAttribute("data-header-scroll")?0:n;t.style.setProperty("--heightOfHeaderScroll",`${r}px`)}o(),window.addEventListener("resize",o),window.addEventListener("scroll",o);let n=window.scrollY;window.addEventListener("scroll",()=>{let t=window.scrollY;window.innerHeight<=900&&(t>=80?t>n?(e.style.transform="translateY(-100%)",e.setAttribute("data-header-scroll",!0)):(e.style.transform="translateY(0px)",e.setAttribute("data-header-scroll",!1)):(e.style.transform="translateY(0)",e.setAttribute("data-header-scroll",!1))),n=t}),window.addEventListener("resize",()=>{window.innerWidth>768&&(e.style.transform="translateY(0)")}),window.innerWidth<600&&(document.querySelector("header").setAttribute("data-header-mobileActive","true"),document.querySelector("[pgs~=header-element]").setAttribute("data-header-mobileActive","true"))}},t={};function o(n){var r=t[n];if(void 0!==r)return r.exports;var i=t[n]={exports:{}};return e[n](i,i.exports,o),i.exports}(()=>{"use strict";function e(e){const t="pgs";if(!e)throw new TypeError("pgs(root): root richiesto");const o="function"==typeof e.getAttribute&&"function"==typeof e.setAttribute;if("function"!=typeof e.querySelector||"function"!=typeof e.querySelectorAll)throw new TypeError("pgs(root): root deve supportare querySelector/querySelectorAll");function n(t){throw new TypeError(`pgs(${e.nodeName||"root"}).${t}(): disponibile solo su Element (non su Document)`)}function r(e){return Array.isArray(e)&&(e=e.join(",")),String(e).split(",").map(e=>e.trim()).filter(Boolean).map(e=>`[${t}~="${e}"]`).join(",")}function i(e,o=" "){return(e.getAttribute(t)||"").split(o).filter(Boolean)}function s(e,o,n=" "){e.setAttribute(t,o.join(n))}function a(t){if(o)return n.contains=function(o){const n=e.getAttribute(t)||"",r=String(o).replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(`(?:^|\\s)${r}(?:\\[[^\\]]*\\])?(?=\\s|$)`).test(n)},n.getValueBrackets=function(o){const n=e.getAttribute(t)||"",r=String(o).replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),i=n.match(new RegExp(`(?:^|\\s)${r}\\[([^\\]]*)\\]`));return i?i[1]:void 0},Object.defineProperty(n,"value",{get:()=>e.getAttribute(t),set(o){e.setAttribute(t,o)}}),n;function n(){return n}}const c=function(){function a(){return a}return a.querySelector=function(t){return e.querySelector(r(t))},a.querySelectorAll=function(t){return e.querySelectorAll(r(t))},a.add=function(...t){if(!o)return n("add");const r=i(e);for(const e of t)r.includes(e)||r.push(e);return s(e,r),a},a.remove=function(...t){return o?(s(e,i(e).filter(e=>!t.includes(e))),a):n("remove")},a.toggle=function(t,r){if(!o)return n("toggle");const s=i(e).includes(t);return void 0!==r?(r&&!s&&a.add(t),!r&&s&&a.remove(t),!!r):s?(a.remove(t),!1):(a.add(t),!0)},a.contains=function(t){return o?i(e).includes(t):n("contains")},Object.defineProperty(a,"value",{get(){if(o)return e.getAttribute(t)},set(r){if(!o)return n("value");e.setAttribute(t,r)}}),a}();return c.state=function(t){if(!o)return;const n=(o=" ")=>(e.getAttribute(t)||"").split(o).filter(Boolean),r=(o,n=" ")=>e.setAttribute(t,o.join(n));function i(...e){return i.add(...e),i}return i.add=function(...e){const t=e.flat().map(e=>String(e).trim()).filter(Boolean),o=n();for(const e of t)o.includes(e)||o.push(e);return r(o),i},i.remove=function(...e){const t=e.flat().map(e=>String(e).trim()).filter(Boolean),o=n().filter(e=>!t.includes(e));return r(o),i},i.toggle=function(e,t){const o=String(e).trim();if(!o)return!1;const i=n(),s=i.includes(o);return void 0!==t?(t&&!s&&(i.push(o),r(i)),!t&&s&&r(i.filter(e=>e!==o)),!!t):s?(r(i.filter(e=>e!==o)),!1):(i.push(o),r(i),!0)},i.contains=function(e){const t=String(e).trim();return!!t&&n().includes(t)},Object.defineProperty(i,"value",{get:()=>e.getAttribute(t),set(o){e.setAttribute(t,o)}}),i}("pgs-state"),c.option=a("pgs-option"),c.modules=a("pgs-modules"),c}const t={};function n(e,o){const n=String(e||"").trim().replace(/^pgs[_-\s]*/i,"").toLowerCase();if(!n)throw new TypeError("pgs.registerImport(...modules): ogni modulo deve avere name o PGS_name");t[n]={name:e,module:o}}e.registerImport=function(...t){return t.flat().forEach(e=>{!e||"object"!=typeof e||e.PGS_name||e.name?n(e?.PGS_name||e?.name,e):Object.entries(e).forEach(([e,t])=>n(e,t))}),e},e.import=function(...e){return e.flat().reduce((e,o)=>{const n=String(o||"").trim().replace(/^pgs[_-\s]*/i,"").toLowerCase(),r=t[n];if(!r)throw new Error(`pgs.import(): modulo "${o}" non registrato`);return e[r.name]=r.module,e},{})},globalThis.pgs??=e,o(795),o(359);const r=new WeakMap;function i(e=document){pgs(e).querySelectorAll("accordion").forEach((e,t)=>{if(r.has(e))return;const o=pgs(e).querySelector("accordion-button"),n=pgs(e).querySelector("accordion-content");if(!o||!n)return;const s=t+1,a=`acc-btn-${s}`,c=`acc-panel-${s}`,l=pgs(e).state.contains("open");function d(e,t,o){const n=(t?.textContent||"").trim().replace(/\s+/g," ");t.setAttribute("aria-label",`${e?"Chiudi":"Apri"} ${n||"sezione"}`),t.setAttribute("aria-expanded",String(e)),o.hidden=!e}function u(){const t=!pgs(e).state.contains("open");pgs(e).state.toggle("open",t),d(t,o,n),function(){for(const t of pgs(document).querySelectorAll("accordion")){if(t===e)continue;const o=pgs(t).querySelector("accordion-button"),n=pgs(t).querySelector("accordion-content");o&&n&&(pgs(t).state().remove("open"),d(!1,o,n))}}(),t&&setTimeout(()=>e.scrollIntoView({block:"nearest",inline:"nearest"}),100)}o.setAttribute("role","button"),o.setAttribute("tabindex","0"),o.setAttribute("id",a),o.setAttribute("aria-controls",c),n.setAttribute("id",c),n.setAttribute("role","region"),n.setAttribute("aria-labelledby",a),d(l,o,n),o.addEventListener("click",u),o.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),u())}),r.set(e,{element:e,button:o,content:n,open:function(){pgs(e).state.contains("open")||u()},close:function(){pgs(e).state.contains("open")&&u()},toggle:u,refresh:()=>(i(e.parentNode||document),r.get(e)),isOpen:()=>pgs(e).state.contains("open")})})}i();const s={PGS_name:"PGS_accordion",init:i,api:function(e){return r.get(e)}},a=new WeakMap;function c(e=document){pgs(e).querySelectorAll("dropdown").forEach((e,t)=>{if(a.has(e))return;const o=pgs(e).querySelector("dropdown-button"),n=pgs(e).querySelector("dropdown-content");if(!o||!n)return;if("true"===e.getAttribute("data-initialize"))return;e.setAttribute("data-initialize","true");const r=`--dropdown-anchor-${t}`;e.style.setProperty("--dropdown-anchor",r),o.id||(o.id=`dropdown-btn-${t}`),n.id||(n.id=`dropdown-panel-${t}`),o.setAttribute("type","button"),o.setAttribute("aria-haspopup","true"),o.setAttribute("aria-controls",n.id),o.setAttribute("aria-expanded","false"),n.setAttribute("aria-labelledby",o.id),n.hasAttribute("popover")||n.setAttribute("popover","auto"),o.setAttribute("popovertarget",n.id),o.setAttribute("popovertargetaction","toggle");const i=CSS.supports("anchor-name: --dropdown-anchor")&&CSS.supports("position-anchor: --dropdown-anchor")&&CSS.supports("position-area: bottom")&&CSS.supports("top: anchor(bottom)"),s=pgs(e).contains("tooltip")||!i,l=()=>{if(!s)return;const t=o.getBoundingClientRect(),r=getComputedStyle(e),i=parseFloat(r.getPropertyValue("--dropdown-offset"))||10,a=parseFloat(r.getPropertyValue("--dropdown-padding"))||0,c=parseFloat(r.getPropertyValue("--dropdown-arrow-size"))||12,l=window.innerWidth,d=l-16,u=getComputedStyle(n),p=parseFloat(u.maxWidth),g=Number.isFinite(p)?Math.min(p,d):d,f=Math.min(Math.max(n.scrollWidth+2*a,t.width),g),m=t.bottom+i,h=t.left+t.width/2-f/2,b=Math.min(Math.max(h,8),l-f-8),y=t.left+t.width/2,S=Math.min(Math.max(y-b,a+c),f-a-c);e.style.setProperty("--dropdown-fallback-top",`${m}px`),e.style.setProperty("--dropdown-fallback-left",`${b}px`),e.style.setProperty("--dropdown-arrow-left",`${S}px`)};function d(){n.matches(":popover-open")||(l(),n.showPopover())}function u(){n.matches(":popover-open")&&n.hidePopover()}o.addEventListener("click",e=>{s&&(e.preventDefault(),n.matches(":popover-open")?n.hidePopover():(l(),n.showPopover()))}),n.addEventListener("toggle",t=>{const r=n.matches(":popover-open");o.setAttribute("aria-expanded",r?"true":"false"),pgs(e).state.toggle("open",r),r&&(l(),n.querySelector('a, button, input, select, textarea, [tabindex]:not([tabindex="-1"])')?.focus())}),window.addEventListener("resize",()=>{n.matches(":popover-open")&&l()}),window.addEventListener("scroll",()=>{n.matches(":popover-open")&&l()},!0),a.set(e,{element:e,button:o,content:n,open:d,close:u,toggle:function(){n.matches(":popover-open")?u():d()},updatePosition:l,refresh:()=>(c(e.parentNode||document),a.get(e)),isOpen:()=>n.matches(":popover-open")})})}function l(e){return a.get(e)}c();const d={PGS_name:"PGS_dropdown",init:c,api:l},u=new WeakMap;function p(e=document){pgs(e).querySelectorAll("menu-horizontal").forEach(e=>{u.has(e)||(e.querySelectorAll("nav > ul > li.menu-item-has-children").forEach(e=>{if(e.querySelector("ul")){const t=e.querySelector("ul");if(pgs(e).querySelector("dropdown-button"))return;const o=document.createElement("button");o.className="icon-down",o.type="button",o.innerHTML="<span>&#9207;</span>",e.querySelector("a").insertAdjacentElement("afterend",o),pgs(e).add("dropdown"),pgs(o).add("dropdown-button"),pgs(o).add("buttonNohover"),pgs(t).add("dropdown-content"),pgs(t).add("menu-vertical")}}),u.set(e,{element:e,type:"horizontal",items:()=>Array.from(e.querySelectorAll("nav > ul > li")),submenus:()=>Array.from(e.querySelectorAll(".menu-item-has-children > ul")),dropdowns:()=>Array.from(e.querySelectorAll(".menu-item-has-children")).map(l).filter(Boolean),refresh:()=>(p(e.parentNode||document),u.get(e))}))}),pgs(e).querySelectorAll("menu-vertical").forEach(e=>{function t(t){return e.querySelectorAll(".menu-item-has-children > ul")[t]}function o(e,o){const n=t(e),r=n?.parentElement?.querySelector(":scope > button");n&&r&&(pgs(n).state.toggle("open",o),r.setAttribute("aria-expanded",String(o)),r.setAttribute("aria-label",o?"Chiudi sottomenu":"Apri sottomenu"))}u.has(e)||(e.querySelectorAll(".menu-item-has-children").forEach((e,t)=>{const o=e.querySelector("ul");if(!o)return;if(e.querySelector(":scope > button"))return;const n=document.createElement("button");n.className="icon-down buttonIcon",n.type="button";const r=`vertical-submenu-${t}`;function i(){const e=pgs(o).state.toggle("open");n.setAttribute("aria-expanded",e),n.setAttribute("aria-label",e?"Chiudi sottomenu":"Apri sottomenu")}o.id=r,pgs(n).add("buttonIcon"),n.setAttribute("aria-expanded","false"),n.setAttribute("aria-controls",r),n.setAttribute("aria-label","Apri sottomenu"),n.innerHTML="<span aria-hidden='true'>&#9207;</span>",e.querySelector("a").insertAdjacentElement("afterend",n),n.addEventListener("click",i),n.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),i())})}),u.set(e,{element:e,type:"vertical",items:()=>Array.from(e.querySelectorAll(":scope > li")),submenus:()=>Array.from(e.querySelectorAll(".menu-item-has-children > ul")),openSubmenu:e=>o(e,!0),closeSubmenu:e=>o(e,!1),toggleSubmenu:e=>{const n=t(e);n&&o(e,!pgs(n).state.contains("open"))},isSubmenuOpen:e=>{const o=t(e);return!!o&&pgs(o).state.contains("open")},refresh:()=>(p(e.parentNode||document),u.get(e))}))}),c()}p();const g={PGS_name:"PGS_menu",init:p,api:function(e){return u.get(e)}},f=new WeakMap;function m(e="modal"){pgs(document).querySelectorAll(e).forEach(t=>{if(f.has(t))return;const o=pgs(t).querySelector("modal-button"),n=t.querySelector("dialog");if(!o||!n)return;const r='<button pgs="buttonClose modal-close" type="button" tabindex="0" aria-label="Chiudi"><i class="fa-solid fa-close"></i></button>',i=pgs(t)?.querySelector("modal-dialog-content-header"),s=pgs(t).option.contains("disableBackdropClose"),a=pgs(t).option.contains("history"),c=pgs(t).option.getValueBrackets("containerID"),l=pgs(t).option.getValueBrackets("containerPGS"),d=pgs(n).option.contains("topLevel");pgs(t).querySelector("modal-close")||(i?i.insertAdjacentHTML("beforeend",r):n.insertAdjacentHTML("beforeend",r));const u=pgs(t).querySelector("modal-close");function p(e=!0){o?.setAttribute("aria-expanded",e),n?.setAttribute("aria-expanded",e)}function g(e){e?.stopImmediatePropagation(),n.open?h(e):(n.open||document.querySelectorAll("dialog[open]").forEach(e=>e.close()),p(!0),d?n.showModal():n.show(),t.dispatchEvent(new CustomEvent("modal:open")),n.dispatchEvent(new CustomEvent("modal:open")))}function h(e){e?.stopImmediatePropagation(),p(!1),n.close(),t.dispatchEvent(new CustomEvent("modal:close")),n.dispatchEvent(new CustomEvent("modal:close"))}pgs(n).add("dialog modal-dialog"),o.setAttribute("role","button"),o.setAttribute("aria-label","apri modale"),d||(c?document.querySelector("#"+c)?.append(n):l?pgs(document).querySelector(l)?.append(n):document.body.append(n)),o.addEventListener("click",e=>g(e)),o.addEventListener("keypress",e=>!n.open&&("Enter"===e.key||" "===e.key)&&g(e)),n.addEventListener("close",()=>p(!1)),n.addEventListener("click",e=>{e.target!=n||s||h(e)}),u?.addEventListener("click",e=>h(e)),a&&o.id&&(setTimeout(function(){new URLSearchParams(window.location.search).get("modal")===o.id&&(document.getElementById(o.id)?.scrollIntoView({behavior:"smooth"}),g())},1),new MutationObserver(()=>{let e=n.hasAttribute("open");try{const t=new URL(window.location.href),n=new URLSearchParams(t.search);e?n.set("modal",o.id):n.delete("modal"),t.search=n.toString()?`?${n.toString()}`:"",window.history.pushState({modal:o.id,open:e},"",t)}catch(e){}}).observe(n,{attributes:!0,attributeFilter:["open"]}),window.addEventListener("popstate",()=>{try{const e=new URLSearchParams(window.location.search).get("modal")===o.id;e&&!n.open&&n.showModal(),!e&&n.open&&h()}catch(e){}})),f.set(t,{element:t,button:o,dialog:n,closeButton:u,open:function(e){n.open||g(e)},close:function(e){n.open&&h(e)},toggle:g,refresh:()=>(m(e),f.get(t)),isOpen:()=>n.open})})}m();const h={PGS_name:"PGS_modal",init:m,api:function(e){return f.get(e)}};function b(e,t){const o=(()=>{let e=0,t=0,o=0,n=!1;return{update:function(r){const i=performance.now(),s=i-e;let a=Math.abs(r.deltaY);return 1===r.deltaMode?a*=16:2===r.deltaMode&&(a*=r.currentTarget?.clientHeight||800),a<30&&s<35&&t++,o++,o>=6&&(n=t>=3,t=0,o=0),e=i,n},get value(){return n}}})();let n=e;n.addEventListener("wheel",e=>{const r=t;if(o.update(e))return;if(e.ctrlKey)return;if(Math.abs(e.deltaX)>Math.abs(e.deltaY))return;let i=e.deltaY;1===e.deltaMode?i*=16:2===e.deltaMode&&(i*=n.clientHeight);const s=n.scrollLeft<=0,a=n.scrollLeft+n.clientWidth>=n.scrollWidth-1;(i>0&&!a||i<0&&!s)&&(e.preventDefault(),n.scrollLeft+=i*r)},{passive:!1})}const y=new WeakMap;class S{constructor({selector:e,viewRatio:t=.97,optionIntersectionObserver:o={},scrollOptions:n={}}={}){this.selector=e,this.viewRatio=t,this.optionIntersectionObserver={threshold:Array.from({length:101},(e,t)=>t/100),rootMargin:"0px",...o},this.scrollOptions={behavior:"smooth",inline:"center",block:"nearest",container:"nearest",...n},this.container=this.selector?pgs(this.selector).querySelector("slides-container"):null}#e(){const e=this.selector;pgs(e).querySelector("slides-prec")||pgs(e).querySelector("slides-next")||(e.insertAdjacentHTML("afterbegin",'<button pgs="slides-prec buttonIcon" type="button" class="precButton" aria-label="slide precedente"> <span> <i class="fa-solid fa-arrow-left"></i></span></button>'),e.insertAdjacentHTML("beforeend",'<button pgs="slides-next buttonIcon" type="button" class="nextButton" aria-label="prossima slide"> <span> <i class="fa-solid fa-arrow-right"></i></span></button>')),pgs(e).querySelector("slides-dots")||(e.insertAdjacentHTML("beforeend",'<div pgs="slides-dots" class="slides-dots"></div>'),Array.from(this.container.children).forEach(()=>{pgs(e).querySelector("slides-dots").insertAdjacentHTML("beforeend",'<button type="button" class="slide-dot" aria-label="vai alla prossima slide"></button>')}))}#t(){const e=this.container.querySelectorAll(".view");let t;t=pgs(this.selector).option.contains("singleScroll")?e[e.length-1]:e[0];const o=t?.previousElementSibling;o?.scrollIntoView(this.scrollOptions),o?.focus({preventScroll:!0})}#o(){const e=this.container.querySelectorAll(".view");let t;t=pgs(this.selector).option.contains("singleScroll")?e[0]:e[e.length-1];const o=t?.nextElementSibling;console.log(t,o),o?.scrollIntoView(this.scrollOptions),o?.focus({preventScroll:!0})}#n(e){this.container.children[e].scrollIntoView(this.scrollOptions)}#r(e,t,o,n,r){e.forEach(e=>{const i=.9+.1*e.intersectionRatio,s=i>=.98;!pgs(e.target).option.contains("notScrollAnimation")&&e.target.firstElementChild&&e.target.firstElementChild.style.setProperty("--visible-percent",`${i}`),e.target.classList.toggle("view",s),e.target.classList.toggle("notView",!s);const a=e.target.parentNode.children,c=a[0].classList.contains("view"),l=a[a.length-1].classList.contains("view");n.disabled=l,o.disabled=c,n.setAttribute("aria-disabled",String(l)),o.setAttribute("aria-disabled",String(c));const d=Array.from(t.children).filter(e=>e.classList.contains("view"));r.forEach((e,o)=>{const n=d.some(e=>Array.from(t.children).indexOf(e)===o);e.classList.toggle("active",n),e.setAttribute("aria-current",n?"true":"false")})})}execute(){const e=this.selector;if(!this.container)return;this.#e();const t=pgs(e).querySelector("slides-prec"),o=pgs(e).querySelector("slides-next"),n=Array.from(pgs(e).querySelector("slides-dots").children);pgs(e).option.contains("notScrollWithMouse")||b(this.container,5),n.forEach((e,t)=>e.addEventListener("click",e=>this.#n(t))),t.addEventListener("click",e=>this.#t(),{passive:!0}),o.addEventListener("click",e=>this.#o(),{passive:!0});const r=new IntersectionObserver(e=>this.#r(e,this.container,t,o,n),{root:this.container,...this.optionIntersectionObserver});Array.from(this.container.children).forEach(e=>r.observe(e)),y.set(this.selector,{element:this.selector,container:this.container,previous:()=>this.#t(),next:()=>this.#o(),goTo:e=>this.#n(e),getCurrentIndexes:()=>Array.from(this.container.children).map((e,t)=>e.classList.contains("view")?t:-1).filter(e=>-1!==e),getCurrentElements:()=>Array.from(this.container.children).filter(e=>e.classList.contains("view")),getTotal:()=>this.container.children.length,isAtStart:()=>this.container.children[0]?.classList.contains("view")||!1,isAtEnd:()=>{const e=this.container.children,t=e[e.length-1];return t?.classList.contains("view")||!1},refresh:()=>(A(this.selector.parentNode||document),y.get(this.selector))})}}function A(e=document){pgs(e).querySelectorAll("slides").forEach(e=>{y.has(e)||new S({selector:e}).execute()})}A();const v={PGS_name:"PGS_slides",init:A,api:function(e){return y.get(e)}},w=new WeakMap;function E(e=document){pgs(e).querySelectorAll("steps").forEach(e=>{w.has(e)||(pgs(e).querySelectorAll("steps-step").forEach((e,t)=>{let o;if(pgs(e).querySelector("steps-step-circle")?o=pgs(e).querySelector("steps-step-circle"):(o=document.createElement("span"),pgs(o).add("steps-step-circle"),o.textContent=t+1,e.insertAdjacentElement("afterbegin",o)),!pgs(e).querySelector("steps-step-line")){const t=document.createElement("span");pgs(t).add("steps-step-line"),e.insertAdjacentElement("afterbegin",t)}}),w.set(e,{element:e,steps:()=>Array.from(pgs(e).querySelectorAll("steps-step")),getStep:t=>pgs(e).querySelectorAll("steps-step")[t],getTotal:()=>pgs(e).querySelectorAll("steps-step").length,refresh:()=>(w.delete(e),E(e.parentNode||document),w.get(e))}))})}E();const q={PGS_name:"PGS_steps",init:E,api:function(e){return w.get(e)}},k=new WeakMap;function L(e=document){pgs(e).querySelectorAll("stepTabs").forEach(e=>{if("true"===e.dataset.stepTabsInitialized)return;e.dataset.stepTabsInitialized="true";const t=pgs(e).querySelector("stepTabs-prev"),o=pgs(e).querySelector("stepTabs-next"),n=pgs(e).querySelector("stepTabs-restart"),r=pgs(e).querySelector("stepTabs-dots"),i=pgs(e).querySelector("stepTabs-container"),s=pgs(i).querySelectorAll("tab"),a=s.length,c=Array.from(s).filter(e=>pgs(e).state.contains("is-locked"));let l=0;t&&(t.disabled=!0);let d=!1;if(!i||0===a)return;const u=[];function p(e,t,o){e&&o!==pgs(e).state.contains(t)&&pgs(e).state.toggle(t,o)}function g(){const e=s[l];t&&(t.disabled=0===l),o&&(o.disabled=l===a-1||pgs(e).state.contains("is-locked"))}function f(t,o=!0){l=Math.min(Math.max(t,0),a-1);const n=s[l];d=!0,s.forEach((e,t)=>p(e,"is-active",t===l)),g(),u.forEach((e,t)=>{p(e,"is-active",t===l),p(e,"is-completed",t<l)}),d=!1,o&&!e.closest("dialog")&&(n?.focus(),e?.scrollIntoView({behavior:"smooth",block:"start"})),e.dispatchEvent(new CustomEvent("stepTabs:change",{detail:{current:l,total:a}}))}function m(){f(0),c.forEach(e=>pgs(e).state.add("is-locked"))}r&&(r.innerHTML="",s.forEach((e,t)=>{const o=pgs(e).option.getValueBrackets("tabIcon")||"fa-circle",n=document.createElement("button");n.type="button",pgs(n).add("stepTabs-dots-dot"),n.setAttribute("data-step",t),n.innerHTML=`<i class="fa-solid ${o}"></i>`,n.addEventListener("click",()=>{pgs(n).state.contains("is-completed")&&f(t,!0)}),r.appendChild(n),u.push(n)})),f(0,!1);const h=new MutationObserver(()=>{d||g()});s?.forEach(e=>h.observe(e,{attributes:!0,attributeFilter:["pgs-state"]})),t?.addEventListener("click",e=>f(l-1)),o?.addEventListener("click",e=>{g(),o.disabled||f(l+1)}),n?.addEventListener("click",e=>m(),{capture:!0}),k.set(e,{element:e,container:i,restart:m,goTo:f,next:()=>f(l+1),prev:()=>f(l-1),toggleLock:(e,t=!0)=>"number"==typeof e&&s[e]&&(pgs(s[e]).state.toggle("is-locked",t),f(l)),refresh:()=>(L(e.parentNode||document),k.get(e)),getCurrent:()=>l,getState:()=>({current:l,total:a})})})}L();const x={PGS_name:"PGS_stepTabs",init:L,api:function(e){return k.get(e)}},_={_escapeHtml:e=>String(e??""),_getDuration(e){const t=e.duration,o=Number.parseInt(t,10);return Number.isNaN(o)?5e3:o},_getApi:e=>"toast"===String(e.element||"notification").trim()?M.toast:M.alert,_getType(e,t){const o=String(e.type||"info").trim();return"function"==typeof t[o]?o:"info"},_getData(e){try{return JSON.parse(e.dataset.notification||"{}")}catch(e){return console.warn("PGS notification: dati non validi",e),{}}},_getContent(e,t){const o=this._escapeHtml(t),n=this._escapeHtml(e);return n?o?`\n <span pgs="notification-element-title">${n}</span>\n <br>\n <span pgs="notification-element-content">${o}</span>\n `:`<span pgs="notification-element-title">${n}</span>`:o},initNotification(e,t,o,n,r,i="replace",s=null){let a=pgs(document).querySelector(t);if(!a){const e=document.createElement("div");pgs(e).add(t),e.setAttribute("aria-live","polite"),e.setAttribute("aria-relevant","additions"),document.body.appendChild(e),a=e}const c=document.createElement(s?"a":"div");function l(){"stack"==i?c.style.translate="120%":c.style.opacity="0",setTimeout(()=>c.remove(),300)}"replace"==i&&(a.innerHTML=""),s&&(c.href=s),r>0&&c.style.setProperty("--notification-timeout",r+"ms"),pgs(c).state.add(e),pgs(c).add("notification-element"),c.setAttribute("role","error"==e?"alert":"status"),c.innerHTML=`${o} <p>${n}</p>`,a.appendChild(c),r>0&&setTimeout(()=>{l()},r);const d=document.createElement("button");d.type="button",d.ariaLabel="Rimuovi notifica",d.innerHTML='<i class="fa-solid fa-xmark"></i>',d.setAttribute("pgs","buttonClose"),c.insertAdjacentElement("afterbegin",d),d.addEventListener("click",function(e){e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),l()})},deleteAll(e){let t=pgs(document).querySelector(e);t&&(t.innerHTML="")},trigger(e=document){pgs(e).querySelectorAll("notificationTrigger").forEach(e=>{if(!e||"true"===e.dataset.initialize)return;e.dataset.initialize="true";const t=this._getData(e),o=String(t.title||"").trim(),n=String(t.message||"").trim();if(!o&&!n)return void e.remove();const r=t.link||null,i=t.icon||void 0,s=this._getDuration(t),a=this._getApi(t),c=this._getType(t,a),l=this._getContent(o,n);a===M.toast?a[c](l,s,i):a[c](l,r,s,i),e.remove()})}};function P(e=document){return _.trigger(e)}const M={PGS_name:"PGS_notification",trigger:P,alert:{error:(e="Errore",t=null,o=0,n='<i class="fa-solid fa-octagon-xmark"></i>')=>_.initNotification("error","notification",n,e,o,"stack",t),success:(e="Aggiornato",t=null,o=0,n='<i class="fa-solid fa-check"></i>')=>_.initNotification("success","notification",n,e,o,"stack",t),info:(e="Aggiornamento",t=null,o=0,n='<i class="fa-solid fa-circle-info"></i>')=>_.initNotification("info","notification",n,e,o,"stack",t),warning:(e="Attenzione",t=null,o=0,n='<i class="fa-solid fa-triangle-exclamation"></i>')=>_.initNotification("warning","notification",n,e,o,"stack",t),deleteAll:()=>_.deleteAll("notification")},toast:{error:(e="Errore",t=4e3,o='<i class="fa-solid fa-octagon-xmark"></i>')=>_.initNotification("error","toast",o,e,t),success:(e="Aggiornato",t=4e3,o='<i class="fa-solid fa-check"></i>')=>_.initNotification("success","toast",o,e,t),info:(e="Aggiornamento",t=0,o='<i class="fa-solid fa-circle-info"></i>')=>_.initNotification("info","toast",o,e,t),warning:(e="Attenzione",t=4e3,o='<i class="fa-solid fa-triangle-exclamation"></i>')=>_.initNotification("warning","toast",o,e,t),deleteAll:()=>_.deleteAll("toast")}};"loading"===document.readyState?document.addEventListener("DOMContentLoaded",()=>P()):P(),e.registerImport({PGS_accordion:s,PGS_dropdown:d,PGS_menu:g,PGS_modal:h,PGS_notification:M,PGS_slides:v,PGS_stepTabs:x,PGS_steps:q,PGS_formValidate:class{constructor({form:e}={}){this.container=e,this._rules=[]}addError(e,t){e.setAttribute("data-form-field-status","error"),0==t&&e.scrollIntoView();let o=e.getAttribute("data-form-field-message");0==t&&o?M.toast.error(o):0==t&&M.toast.error("Compila tutti i campi!")}removeError(e){e.setAttribute("data-form-field-status","")}#i(e){e.forEach(e=>{e.addEventListener("click",t=>this.removeError(e))})}help={isRequired:e=>!!e&&((!0===e.required||"true"===e?.dataset?.required||"true"==e?.getAttribute("aria-required"))&&!e.hidden),isEmptyTextLike:e=>!String(e?.value??"").trim(),isEmptySelect:e=>!String(e?.value??"").trim(),getGroupName:e=>e?.name||e?.getAttribute?.("name")||""};#s(e){const t=[];for(const o of this._rules){const n=o(e);n&&(Array.isArray(n)?t.push(...n):t.push(n))}const o=Array.from(e.querySelectorAll("input")).filter(e=>!e.disabled&&"hidden"!==e.type&&"checkbox"!==e.type&&"radio"!==e.type&&"file"!==e.type&&!!this.help.isRequired(e)&&this.help.isEmptyTextLike(e)),n=Array.from(e.querySelectorAll("textarea")).filter(e=>!e.disabled&&!!this.help.isRequired(e)&&this.help.isEmptyTextLike(e)),r=Array.from(e.querySelectorAll("select")).filter(e=>!e.disabled&&!!this.help.isRequired(e)&&this.help.isEmptySelect(e)),i=Array.from(e.querySelectorAll('input[type="radio"]')).filter(e=>!e.disabled),s=new Map;for(const e of i){if(!this.help.isRequired(e))continue;const t=this.help.getGroupName(e);t&&(s.has(t)||s.set(t,[]),s.get(t).push(e))}const a=[];for(const[e,t]of s.entries())t.some(e=>e.checked)||a.push(t[0]);const c=Array.from(e.querySelectorAll('input[type="checkbox"]')).filter(e=>!e.disabled),l=[],d=new Map;for(const e of c){if(!this.help.isRequired(e))continue;const t=this.help.getGroupName(e);t?(d.has(t)||d.set(t,[]),d.get(t).push(e)):e.checked||l.push(e)}const u=[];for(const[e,t]of d.entries())t.some(e=>e.checked)||u.push(t[0]);return[o,n,r,a,l,u,Array.from(e.querySelectorAll('input[type="file"]')).filter(e=>!(e.disabled||!this.help.isRequired(e)||e.files&&e.files.length>0)),t].flat()}validate(){const e=this.#s(this.container),t=this.container.querySelectorAll("input, textarea, select");Array.from(t).filter(e=>!e.disabled);for(const o of t)e.includes(o)||this.removeError(o);return e.forEach((e,t)=>this.addError(e,t)),this.#i(t),e.length?(this.container.setAttribute("data-form-status","error"),!1):(this.container.setAttribute("data-form-status","success"),!0)}ifSuccess(e="Inviato con successo"){1==this.validate()&&M.toast.success(e)}addNewRule(e){if("function"!=typeof e)throw new Error("Rule must be a function");return this._rules.push(e),this}},PGS_scrollHorizontal:b}),o(107),o(48)})()})();
package/package.json CHANGED
@@ -1,11 +1,16 @@
1
1
  {
2
2
  "name": "mypgs",
3
- "version": "1.1.2",
3
+ "version": "1.3.2",
4
4
  "description": "MyPGS frontend theme and UI behaviors, with bundled JavaScript and CSS assets.",
5
5
  "main": "./dist/javascript/index.js",
6
+ "module": "./assets/javascript/index.js",
6
7
  "types": "./dist/index.d.ts",
7
8
  "exports": {
8
- ".": "./dist/javascript/index.js",
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./assets/javascript/index.js",
12
+ "default": "./dist/javascript/index.js"
13
+ },
9
14
  "./style.css": "./dist/css/index.css",
10
15
  "./style.min.css": "./dist/css/index.min.css"
11
16
  },
Binary file
@@ -1,23 +1,29 @@
1
1
  <div pgs="flexRow">
2
2
  <a pgs="button" href="#">
3
- <i class="fa-solid fa-arrow-right" aria-hidden="true"></i>
4
- Bottone
3
+ <i class="fa-duotone fa-solid fa-store"></i>
4
+ About
5
5
  </a>
6
6
 
7
+ <button pgs="button" type="button" pgs-option="buttonReverse">
8
+ Avanti
9
+ <i class="fa-solid fa-arrow-right" aria-hidden="true"></i>
10
+ </button>
11
+
7
12
  <button pgs="buttonStrong" type="button">
8
13
  <i class="fa-solid fa-check" aria-hidden="true"></i>
9
- Azione primaria
14
+ Submit
10
15
  </button>
11
16
 
12
17
  <button pgs="buttonIcon" type="button" aria-label="Impostazioni">
13
18
  <i class="fa-solid fa-gear" aria-hidden="true"></i>
14
19
  </button>
15
20
 
16
- <button pgs="buttonMini" type="button">
17
- Mini
21
+ <button pgs="buttonMini" type="button" aria-label="Informazioni">
22
+ <i class="fa-solid fa-info" aria-hidden="true"></i>
18
23
  </button>
19
24
 
20
- <button pgs="buttonBig" type="button">
25
+ <button pgs="buttonBig" type="button" aria-label="Bottone grande">
26
+ <i class="fa-solid fa-rocket" aria-hidden="true"></i>
21
27
  Bottone grande
22
28
  </button>
23
- </div>
29
+ </div>
@@ -2,7 +2,7 @@
2
2
 
3
3
  <article pgs="card flexColumn">
4
4
  <img pgs="card-img imgCover" src="https://placehold.co/800x500" alt="Immagine segnaposto">
5
-
5
+
6
6
  <div pgs="flexColumnTexts">
7
7
  <h3>Card riutilizzabile</h3>
8
8
  <p>Contenuto descrittivo della card, adatto a liste, anteprime e griglie.</p>
@@ -10,12 +10,14 @@
10
10
  </div>
11
11
  </article>
12
12
 
13
- <a pgs="card flexColumn" href="">
14
- <img pgs="card-img imgCover" src="https://placehold.co/800x500" alt="Immagine segnaposto">
15
-
16
- <div pgs="flexColumnTexts">
17
- <h3>Card riutilizzabile</h3>
18
- <p>Contenuto descrittivo della card, adatto a liste, anteprime e griglie.</p>
19
- </div>
20
- </a>
13
+ <article pgs="card">
14
+ <a pgs="flexColumn" href="">
15
+ <img pgs="card-img imgCover" src="https://placehold.co/800x500" alt="Immagine segnaposto">
16
+
17
+ <div pgs="flexColumnTexts">
18
+ <h3>Card riutilizzabile</h3>
19
+ <p>Contenuto descrittivo della card, adatto a liste, anteprime e griglie.</p>
20
+ </div>
21
+ </a>
22
+ </article>
21
23
  </div>
@@ -1,5 +1,5 @@
1
1
  <span pgs="dropdown">
2
- <button pgs="dropdown-button button" type="button">
2
+ <button pgs="dropdown-button button" pgs-option="buttonReverse" type="button">
3
3
  Apri menu
4
4
  <i class="fa-solid fa-chevron-down" aria-hidden="true"></i>
5
5
  </button>
@@ -1,12 +1,12 @@
1
1
  <div pgs="modal" pgs-option="containerID[modal-container]">
2
- <button pgs="modal-button button" type="button" id="modal-esempio">
3
- Apri modale
2
+ <button pgs="modal-button button" type="button">
3
+ <i class="fa-solid fa-window-maximize"></i> Apri modale
4
4
  </button>
5
5
 
6
6
  <dialog>
7
7
  <div pgs="modal-dialog-content">
8
8
  <div pgs="modal-dialog-content-header">
9
- <h2>Modale di esempio</h2>
9
+ <h3>Modale di esempio</h3>
10
10
  </div>
11
11
 
12
12
  <div pgs="modal-dialog-content-scroll">
@@ -16,4 +16,4 @@
16
16
  </dialog>
17
17
  </div>
18
18
 
19
- <div id="modal-container"></div>
19
+ <div id="modal-container"></div>
@@ -2,17 +2,17 @@
2
2
  <div pgs="stepTabs-dots" aria-label="Avanzamento"></div>
3
3
 
4
4
  <div pgs="stepTabs-container">
5
- <section pgs="tab flexColumnTexts" tabindex="-1" data-tab-icon="fa-user">
5
+ <section pgs="tab flexColumnTexts" tabindex="-1" pgs-option="tabIcon[fa-user]">
6
6
  <h3>Dati personali</h3>
7
7
  <p>Contenuto del primo tab.</p>
8
8
  </section>
9
9
 
10
- <section pgs="tab flexColumnTexts" tabindex="-1" data-tab-icon="fa-list-check">
10
+ <section pgs="tab flexColumnTexts" tabindex="-1" pgs-option="tabIcon[fa-list-check]">
11
11
  <h3>Preferenze</h3>
12
12
  <p>Contenuto del secondo tab.</p>
13
13
  </section>
14
14
 
15
- <section pgs="tab flexColumnTexts" tabindex="-1" data-tab-icon="fa-check">
15
+ <section pgs="tab flexColumnTexts" tabindex="-1" pgs-option="tabIcon[fa-check]">
16
16
  <h3>Conferma</h3>
17
17
  <p>Contenuto del terzo tab.</p>
18
18
  </section>
@@ -1,5 +1,6 @@
1
1
  <span pgs="dropdown tooltip">
2
2
  <button pgs="dropdown-button buttonMini tooltip-button" title="open-tooltip" type="button"><i class="fa-solid fa-info"></i></button>
3
3
  <div pgs="dropdown-content tooltip-content">
4
+ Lorem ipsum dolor sit amet consectetur adipisicing elit. Iusto hic, id consectetur facilis et, iste animi minima quidem praesentium omnis quod. Quidem provident ad cum aut reprehenderit laboriosam eum placeat.
4
5
  </div>
5
6
  </span>
@@ -44,4 +44,8 @@ pre {
44
44
  background-color: var(--color-tertiary-soft);
45
45
  display: block;
46
46
  }
47
+ }
48
+
49
+ [pgs~=buttonBig]{
50
+ max-width: 300px;
47
51
  }
package/templates/demo.js CHANGED
@@ -7,6 +7,8 @@ if (localStorage.getItem("screenIsDarkMode") === "true") {
7
7
 
8
8
 
9
9
  const templateFiles = [
10
+ "components/md-tooltip.html",
11
+ "components/md-modal.html",
10
12
  "components/md-stepTabs.html",
11
13
  "layout/md-header.html",
12
14
  "components/md-accordion.html",
@@ -17,12 +19,10 @@ const templateFiles = [
17
19
  "components/md-form.html",
18
20
  "components/md-logo.html",
19
21
  "components/md-menu.html",
20
- "components/md-modal.html",
21
22
  "components/md-searchbar.html",
22
23
  "components/md-slides.html",
23
24
  "components/md-steps.html",
24
25
  "components/md-table.html",
25
- "components/md-tooltip.html",
26
26
  "layout/md-body.html",
27
27
  "layout/md-cookieConsent.html",
28
28
  "layout/md-section.html",
@@ -1,85 +0,0 @@
1
- import { PGS_notification, PGS_toast } from "../functions/_notifications.js";
2
-
3
- function escapeHtml(value) {
4
- return String(value ?? "");
5
- }
6
-
7
- function getDuration(notification) {
8
- const rawDuration = notification.duration;
9
- const duration = Number.parseInt(rawDuration, 10);
10
-
11
- return Number.isNaN(duration) ? 5000 : duration;
12
- }
13
-
14
- function getNotificationApi(notification) {
15
- const element = String(notification.element || "notification").trim();
16
-
17
- return element === "toast" ? PGS_toast : PGS_notification;
18
- }
19
-
20
- function getNotificationType(notification, api) {
21
- const type = String(notification.type || "info").trim();
22
-
23
- return typeof api[type] === "function" ? type : "info";
24
- }
25
-
26
- function getNotificationData(root) {
27
- try {
28
- return JSON.parse(root.dataset.notification || "{}");
29
- } catch (error) {
30
- console.warn("PGS notification: dati non validi", error);
31
- return {};
32
- }
33
- }
34
-
35
- function getNotificationContent(title, content) {
36
- const safeContent = escapeHtml(content);
37
- const safeTitle = escapeHtml(title);
38
-
39
- if (!safeTitle) return safeContent;
40
- if (!safeContent) return `<span pgs="notification-element-title">${safeTitle}</span>`;
41
-
42
- return `
43
- <span pgs="notification-element-title">${safeTitle}</span>
44
- <br>
45
- <span pgs="notification-element-content">${safeContent}</span>
46
- `;
47
- }
48
-
49
- export function PGS_md_notification(root) {
50
- if (!root || root.dataset.initialize === "true") return;
51
- root.dataset.initialize = "true";
52
-
53
- const notification = getNotificationData(root);
54
- const title = String(notification.title || "").trim();
55
- const content = String(notification.message || "").trim();
56
- if (!title && !content) {
57
- root.remove();
58
- return;
59
- }
60
-
61
- const link = notification.link || null;
62
- const icon = notification.icon || undefined;
63
- const duration = getDuration(notification);
64
- const api = getNotificationApi(notification);
65
- const type = getNotificationType(notification, api);
66
- const formattedContent = getNotificationContent(title, content);
67
-
68
- if (api === PGS_toast) {
69
- api[type](formattedContent, duration, icon);
70
- } else {
71
- api[type](formattedContent, link, duration, icon);
72
- }
73
-
74
- root.remove();
75
- }
76
-
77
- function initMdNotifications() {
78
- pgs(document).querySelectorAll("notificationTrigger").forEach(PGS_md_notification);
79
- }
80
-
81
- if (document.readyState === "loading") {
82
- document.addEventListener("DOMContentLoaded", initMdNotifications);
83
- } else {
84
- initMdNotifications();
85
- }
@@ -1,74 +0,0 @@
1
- //# PGS_notification
2
- function initNotification(type, containerToken, icon, text, timeout, methodDelete = "replace", link = null) {
3
- let containerNotification = pgs(document).querySelector(containerToken);
4
-
5
- //== Create Container
6
- if (!containerNotification) {
7
- const newContainer = document.createElement("div");
8
- pgs(newContainer).add(containerToken);
9
- newContainer.setAttribute("aria-live", "polite");
10
- newContainer.setAttribute("aria-relevant", "additions");
11
- document.body.appendChild(newContainer);
12
- containerNotification = newContainer;
13
- }
14
-
15
- //== Create Notification
16
- const notification = document.createElement(link ? "a" : "div");
17
- if (methodDelete == "replace") containerNotification.innerHTML = "";
18
- if (link) notification.href = link;
19
- if (timeout > 0) notification.style.setProperty("--notification-timeout", timeout + "ms");
20
- pgs(notification).state.add(type);
21
- pgs(notification).add("notification-element");
22
- notification.setAttribute("role", type == "error" ? "alert" : "status")
23
- notification.innerHTML = `${icon} <p>${text}</p>`;
24
- containerNotification.appendChild(notification);
25
-
26
-
27
- //+ Animation delete
28
- function deleteNotification() {
29
- methodDelete == "stack" ? notification.style.translate = "120%" : notification.style.opacity = "0";
30
- setTimeout(() => notification.remove(), 300);
31
- }
32
-
33
- //== Timeout delete
34
- if (timeout > 0) setTimeout(() => { deleteNotification() }, timeout);
35
-
36
- //== button delete
37
- const btnDelete = document.createElement("button");
38
- btnDelete.type = "button";
39
- btnDelete.ariaLabel = "Rimuovi notifica";
40
- btnDelete.innerHTML = '<i class="fa-solid fa-xmark"></i>';
41
- btnDelete.setAttribute("pgs", "buttonClose");
42
- notification.insertAdjacentElement("afterbegin", btnDelete);
43
-
44
- //== event
45
- btnDelete.addEventListener("click", function (e) {
46
- e.preventDefault();
47
- e.stopPropagation();
48
- e.stopImmediatePropagation()
49
- deleteNotification(e); // Esegue la tua funzione
50
- });
51
- }
52
-
53
- function deleteALl(containerToken) {
54
- let containerNotification = pgs(document).querySelector(containerToken);
55
- if (containerNotification) containerNotification.innerHTML = "";
56
- }
57
-
58
-
59
-
60
- export let PGS_notification = {
61
- error: (text = "Errore", link = null, timeout = 0, icon = '<i class="fa-solid fa-octagon-xmark"></i>') => initNotification("error", "notification", icon, text, timeout, "stack", link),
62
- success: (text = "Aggiornato", link = null, timeout = 0, icon = '<i class="fa-solid fa-check"></i>') => initNotification("success", "notification", icon, text, timeout, "stack", link),
63
- info: (text = "Aggiornamento", link = null, timeout = 0, icon = '<i class="fa-solid fa-circle-info"></i>',) => initNotification("info", "notification", icon, text, timeout, "stack", link),
64
- warning: (text = "Attenzione", link = null, timeout = 0, icon = '<i class="fa-solid fa-triangle-exclamation"></i>') => initNotification("warning", "notification", icon, text, timeout, "stack", link),
65
- deleteAllNotification: () => deleteALl("notification")
66
- }
67
-
68
- export let PGS_toast = {
69
- error: (text = "Errore", timeout = 4000, icon = '<i class="fa-solid fa-octagon-xmark"></i>',) => initNotification("error", "toast", icon, text, timeout),
70
- success: (text = "Aggiornato", timeout = 4000, icon = '<i class="fa-solid fa-check"></i>',) => initNotification("success", "toast", icon, text, timeout),
71
- info: (text = "Aggiornamento", timeout = 0, icon = '<i class="fa-solid fa-circle-info"></i>',) => initNotification("info", "toast", icon, text, timeout),
72
- warning: (text = "Attenzione", timeout = 4000, icon = '<i class="fa-solid fa-triangle-exclamation"></i>',) => initNotification("warning", "toast", icon, text, timeout),
73
- deleteTost: () => deleteALl("toast")
74
- }
@@ -1,100 +0,0 @@
1
- import { PGS_toast } from "../functions/_notifications.js";
2
- export async function PGS_sendForm(
3
- append = {
4
- formAppend: [
5
- { name: "", value: "" }
6
- ],
7
- wpnonce: {
8
- name: "",
9
- value: ""
10
- },
11
- action: ""
12
- },
13
- tost = {
14
- succesText: "Inviato con succeso",
15
- errorGenericText: "Si è verificato un errore",
16
- infoText: "Invio in corso..."
17
- }, log = true) {
18
-
19
- PGS_toast.info(tost.infoText, -1)
20
-
21
- //== FORM DATA
22
- const formData = new FormData();
23
-
24
- //=== Mandatory data
25
- formData.append(append.wpnonce.name, append.wpnonce.value);
26
- formData.append('action', append.action);
27
-
28
- //=== append esempio
29
- append.formAppend.forEach(item => formData.append(item.name, item.value));
30
-
31
- let status
32
-
33
- try {
34
- const response = await fetch('/wp-admin/admin-ajax.php', {
35
- method: 'POST',
36
- body: formData
37
- });
38
-
39
- if (!response.ok) {
40
- PGS_toast.error(`Errore: ${response.status}`)
41
- status = { success: false, data: [], response: response };
42
- throw new Error(`HTTP error! status: ${response.status}`);
43
- }
44
-
45
- const result = await response.json();
46
-
47
- if (result.success) {
48
- status = result;
49
- PGS_toast.success(tost.succesText)
50
-
51
- } else {
52
- status = result;
53
- PGS_toast.error(result.data ? result.data.message : 'Errore sconosciuto')
54
- console.error(result);
55
- }
56
-
57
- } catch (error) {
58
- status = status ? status : { success: false, data: []};
59
- PGS_toast.error(`Si è verificato un errore nella richiesta.`)
60
- console.error('Errore:', error);
61
- }
62
-
63
- if (log) console.log("Status:", status);
64
- if (log) console.log("formData:", Array.from(formData.entries()));
65
- return status;
66
- }
67
-
68
- /*
69
- let documentForm = document.querySelector("#formExample");
70
- if (documentForm) {
71
- documentForm.addEventListener("submit", function (e) {
72
- e.preventDefault();
73
-
74
- let appendMandatory = {
75
- formAppend: [
76
- {
77
- name: "",
78
- value: ""
79
- },
80
- {
81
- name: "",
82
- value: ""
83
- },
84
- ],
85
- wpnonce: {
86
- name: "testName",
87
- value: "testValue"
88
- },
89
- action: "test_submit_form"
90
- };
91
- let tost = {
92
- succesText: "inviato ottimo",
93
- errorGenericText: "errore invio",
94
- infoText: "Invio in corso...",
95
-
96
- }
97
-
98
- sendBooking(appendMandatory, tost)
99
- })
100
- } */