domma-cms 1.49.1 → 1.50.0
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/CHANGELOG.md +11 -0
- package/admin/js/lib/chats-arrange.js +2 -2
- package/admin/js/lib/launchers-arrange.js +5 -2
- package/admin/js/lib/sidebar-renderer.js +1 -1
- package/admin/js/lib/site-settings-arrange.js +2 -2
- package/admin/js/templates/chats.html +26 -2
- package/admin/js/templates/docs/usage-chat.html +51 -5
- package/admin/js/templates/launchers.html +4 -0
- package/admin/js/templates/settings.html +18 -0
- package/admin/js/views/chats.js +5 -5
- package/admin/js/views/launchers.js +105 -33
- package/admin/js/views/layouts.js +1 -1
- package/admin/js/views/menu-editor.js +1 -1
- package/docs/DommaFeatures.md +4 -0
- package/package.json +1 -1
- package/public/css/launcher-chat.css +1 -1
- package/public/css/launchers.css +1 -1
- package/public/js/launcher-chat.mjs +16 -10
- package/public/js/launcher-settings.mjs +6 -2
- package/public/js/launchers.mjs +3 -3
- package/public/js/menu-cards.mjs +1 -1
- package/public/js/menu-decor.mjs +1 -1
- package/public/js/site.js +1 -1
- package/server/routes/api/chat.js +4 -2
- package/server/routes/api/chats.js +37 -0
- package/server/routes/api/settings.js +11 -1
- package/server/services/assistant.js +67 -0
- package/server/services/chat/ai.js +109 -0
- package/server/services/chat/conversation.js +37 -2
- package/server/services/chat/saved.js +117 -0
- package/server/services/chat/settings.js +30 -4
- package/server/services/chat/store.js +1 -1
- package/server/services/collectionAccess.js +2 -1
- package/server/services/launchers.js +1 -1
- package/server/services/menuRender.js +6 -5
- package/server/services/presetCollections.js +24 -2
- package/server/services/siteGitignore.js +1 -1
- package/server/templates/page.html +1 -1
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
const
|
|
1
|
+
import{fillGreeting as ye,launcherChatAccentCss as ke}from"/public/js/launcher-settings.mjs?v=20261110-chat-times-settings";const we={waiting:3e3,open:3e3,bot:9e3,message:2e4},Me=6e3,Te="/public/css/launcher-chat.css?v=20261110-chat-greeting",Z=()=>document.documentElement.classList.contains("dm-reduced-motion")||!!window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;function xe(){if(document.querySelector("link[data-dm-chat-css]"))return;const t=document.createElement("link");t.rel="stylesheet",t.href=Te,t.dataset.dmChatCss="",document.head.appendChild(t)}const ee={get:t=>{try{return globalThis.S?.get?.(t)??null}catch{return null}},set:(t,c)=>{try{globalThis.S?.set?.(t,c)}catch{}},remove:t=>{try{globalThis.S?.remove?globalThis.S.remove(t):globalThis.S?.set?.(t,null)}catch{}}};async function I(t,c,o,n){const p=n?{"X-Chat-Token":n}:{};let r;try{r=t==="GET"?await H.get(c,{headers:p}):await H.post(c,o,{headers:p})}catch(l){const w=l?.data||l?.response?.data;throw new Error(w?.error||"The chat could not be reached. Check your connection and try again.")}if(r&&r.error)throw new Error(r.error);return r}const pe=(t,c="time")=>{if(c==="none")return"";const o=t?new Date(t):null;if(!o||Number.isNaN(o.getTime()))return"";const n=o.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"});return c!=="datetime"?n:`${new Date().toDateString()===o.toDateString()?"Today":o.toLocaleDateString([],{day:"numeric",month:"short"})}, ${n}`},te=t=>(String(t||"").trim().match(/[\p{L}\p{N}]/u)?.[0]||"?").toUpperCase();function Ee(t,c=!1,o="",n="time"){const p=Array.isArray(t.suggestions)&&t.suggestions.length?[...t.suggestions.map(l=>({key:`${t.n}-${l.i}`,n:t.n,i:l.i,label:l.label})),{key:`${t.n}-none`,n:t.n,i:-1,label:"None of these"}]:[],r=t.from==="visitor"?"You":t.name||(t.from==="system"?"":"The team");return{key:`m${t.n}`,n:t.n,from:t.from,fresh:c,cls:M.observable(`dm-chat-msg dm-chat-msg--${t.from}`),name:r,initial:te(r),avatar:t.from==="bot"?o:"",text:typeof t.text=="string"?t.text:"",html:typeof t.html=="string"?t.html:"",links:(Array.isArray(t.links)?t.links:[]).map(l=>{const w=/^https?:/i.test(l.url);return{url:l.url,label:l.label,target:w?"_blank":"_self",rel:w?"noopener noreferrer":""}}),choices:p,starters:[],time:pe(t.at,n)}}function Se(t){const c=o=>o?`${o.from}|${o.name}`:"";return t.forEach((o,n)=>{const p=l=>l&&l.from!=="system"&&c(l)===c(o),r=[`dm-chat-msg dm-chat-msg--${o.from}`];o.from!=="system"&&p(t[n-1])&&r.push("is-cont"),o.from!=="system"&&p(t[n+1])&&r.push("has-next"),o.fresh&&r.push("is-new"),o.cls.value=r.join(" ")}),t}const Le=`
|
|
2
2
|
<div class="dm-chat" data-bind-class="rootClass.value">
|
|
3
|
-
<p class="dm-chat-status" data-bind-text="statusText.value"></p>
|
|
3
|
+
<p class="dm-chat-status" data-bind-text="statusText.value" data-bind-hidden="inPanel"></p>
|
|
4
4
|
<div class="dm-chat-log" role="log" aria-live="polite" aria-relevant="additions" tabindex="0">
|
|
5
5
|
<div class="dm-chat-items" data-each="items.value key=key"></div>
|
|
6
6
|
<div class="dm-chat-msg dm-chat-msg--bot dm-chat-typing" data-bind-hidden="!typing.value" aria-hidden="true">
|
|
7
|
+
<span class="dm-chat-avatar"><img class="dm-chat-avatar-img" alt="" data-bind-src="botAvatar.value"><span class="dm-chat-avatar-letter" data-bind-text="botInitial.value"></span></span>
|
|
7
8
|
<div class="dm-chat-bubble"><span class="dm-chat-dot"></span><span class="dm-chat-dot"></span><span class="dm-chat-dot"></span></div>
|
|
8
9
|
</div>
|
|
9
10
|
</div>
|
|
@@ -26,22 +27,27 @@ const ae={waiting:3e3,open:3e3,bot:9e3,message:2e4},se=6e3,ne="/public/css/launc
|
|
|
26
27
|
</div>
|
|
27
28
|
|
|
28
29
|
<div class="dm-chat-actions" data-bind-hidden="ended.value">
|
|
29
|
-
<button type="button" class="dm-chat-action" data-bind-hidden="!
|
|
30
|
-
data-bind-disabled="busy.value" data-bind-text="personLabel.value"></button>
|
|
30
|
+
<button type="button" class="dm-chat-action" data-bind-hidden="!personBelow.value" data-on-click="askPerson"
|
|
31
|
+
data-bind-disabled="busy.value"><span class="dm-chat-action-icon"><span data-icon="user" data-icon-size="14" aria-hidden="true"></span></span><span data-bind-text="personLabel.value"></span></button>
|
|
31
32
|
<button type="button" class="dm-chat-action dm-chat-action--end" data-bind-hidden="!hasChat.value" data-on-click="end"
|
|
32
33
|
data-bind-disabled="busy.value">End chat</button>
|
|
33
34
|
</div>
|
|
34
35
|
|
|
35
36
|
<form class="dm-chat-compose" data-bind-hidden="ended.value" data-on-submit="send">
|
|
36
37
|
<input type="text" name="website" class="dm-chat-hp" tabindex="-1" autocomplete="off" aria-hidden="true" data-model="hp.value">
|
|
37
|
-
<
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
<div class="dm-chat-field-wrap">
|
|
39
|
+
<textarea class="form-input dm-chat-input" rows="1" maxlength="1000" placeholder="Type your message\u2026"
|
|
40
|
+
aria-label="Your message" data-model="draft.value" data-bind-disabled="ended.value"></textarea>
|
|
41
|
+
<button type="submit" class="btn btn-primary dm-chat-send" aria-label="Send" title="Send"
|
|
42
|
+
data-bind-disabled="!canSend.value"><span data-icon="send" data-icon-size="16" aria-hidden="true"></span></button>
|
|
43
|
+
</div>
|
|
41
44
|
</form>
|
|
42
|
-
|
|
45
|
+
<p class="dm-chat-foot" data-bind-hidden="ended.value" data-bind-text="footText.value"></p>
|
|
46
|
+
</div>`,Ae=`<div data-bind-class="cls.value" data-n="{{n}}">
|
|
47
|
+
<span class="dm-chat-avatar" aria-hidden="true"><img class="dm-chat-avatar-img" alt="" src="{{avatar}}"><span class="dm-chat-avatar-letter">{{initial}}</span></span>
|
|
43
48
|
<div class="dm-chat-who"><span>{{name}}</span> <time>{{time}}</time></div>
|
|
44
49
|
<div class="dm-chat-bubble"><span class="dm-chat-text">{{text}}</span><div class="dm-chat-html">{{{html}}}</div></div>
|
|
45
50
|
<div class="dm-chat-links">{{#each links key=url}}<a class="dm-chat-link" href="{{url}}" target="{{target}}" rel="{{rel}}">{{label}}</a>{{/each}}</div>
|
|
46
51
|
<div class="dm-chat-choices">{{#each choices key=key}}<button type="button" class="dm-chat-choice" data-n="{{n}}" data-i="{{i}}">{{label}}</button>{{/each}}</div>
|
|
47
|
-
|
|
52
|
+
<div class="dm-chat-choices dm-chat-starters">{{#each starters key=key}}<button type="button" class="dm-chat-choice dm-chat-starter" data-text="{{text}}">{{text}}</button>{{/each}}</div>
|
|
53
|
+
</div>`;export function mountChat(t,{launcherId:c,title:o="Chat",chat:n={}}={}){if(!t||!c||!globalThis.M)return{destroy(){}};xe();const p=`chat:${c}`,r=Date.now(),l="/api/chat",w=`launcher=${encodeURIComponent(c)}`,i=M.observable({greeting:n.greeting||"Hi! How can we help?",botName:n.botName||"Assistant",bot:n.bot!==!1,staff:n.staff!==!1,askDetails:n.askDetails||"offline",staffOnline:!1,ai:!1,accent:n.accent||"",accentText:n.accentText||"",avatar:n.avatar||"",starters:Array.isArray(n.starters)?n.starters:[],personButton:n.personButton==="header"?"header":"below",times:["time","datetime","none"].includes(n.times)?n.times:"time"}),C=M.observable([]),v=M.observable(null),L=M.observable(""),$=M.observable(""),R=M.observable(!1),T=M.observable(!1),N=M.observable(""),A=M.observable(!1),ae=M.observable(""),se=M.observable(""),z=M.observable("");let f=ee.get(p),x=0,d=!0,E=0,G=0,Y=!1;const b=()=>v.value?.status||"none",K=()=>({key:"greet",n:0,from:"bot",fresh:!1,cls:M.observable("dm-chat-msg dm-chat-msg--bot"),name:i.value.botName,initial:te(i.value.botName),avatar:i.value.avatar||"",text:ye(i.value.greeting,{botName:i.value.botName,site:globalThis.__CMS_SITE__?.title||""}),html:"",links:[],choices:[],time:pe(new Date(r).toISOString(),i.value.times),starters:v.peek()?[]:(i.value.starters||[]).map((e,a)=>({key:`s${a}`,text:e}))}),B=e=>{C.value=Se(e)},h=t.closest?.(".dm-launcher-chat")?.querySelector(".dm-launcher-chat-head")||null,W=()=>{const e=i.value,a=b();return v.value?.askDetails||!(a==="none"||a==="bot")?!1:e.staff||e.askDetails!=="never"},fe=M.computed(W),D={items:C,draft:L,hp:$,typing:R,busy:T,error:N,detailsName:ae,detailsEmail:se,detailsMessage:z,ended:M.computed(()=>A.value||b()==="closed"),hasChat:M.computed(()=>!!v.value&&b()!=="closed"),showDetails:M.computed(()=>!!v.value?.askDetails&&b()!=="closed"),detailsWantsMessage:M.computed(()=>b()==="bot"),detailsIntro:M.computed(()=>b()==="waiting"?"So we can reach you if we get cut off:":"Leave your details and we will get back to you."),canAskPerson:fe,personLabel:M.computed(()=>i.value.staff?"Talk to a person":"Leave a message"),personBelow:M.computed(()=>W()&&!(h&&i.value.personButton==="header")),personInHead:M.computed(()=>W()&&!!h&&i.value.personButton==="header"),canSend:M.computed(()=>!T.value&&L.value.trim().length>0&&!(A.value||b()==="closed")),rootClass:M.computed(()=>[Z()?"is-still":"",v.value?"has-chat":""].filter(Boolean).join(" ")),inPanel:!!h,botInitial:M.computed(()=>te(i.value.botName)),botAvatar:M.computed(()=>i.value.avatar||""),footText:M.computed(()=>{const e=i.value;return!e.bot||!(b()==="none"||b()==="bot")?"":e.ai?`${e.botName} is an AI assistant and can get things wrong.`:`${e.botName} is an automated assistant.`}),online:M.computed(()=>{const e=i.value,a=b();return a==="open"?!0:a==="closed"||a==="message"?!1:e.bot||e.staff&&e.staffOnline}),statusText:M.computed(()=>{const e=i.value;switch(b()){case"waiting":return"Waiting for a person - they will reply here.";case"open":return"You are chatting with our team.";case"message":return"Message left - we will get back to you by email.";case"closed":return"Chat ended.";default:return e.bot?`${e.botName} answers straight away${e.staff&&e.staffOnline?" - a person is available too.":"."}`:e.staff?e.staffOnline?"Someone is available to chat.":"Nobody is available right now - leave a message.":""}})};t.innerHTML=Le;const g=t.firstElementChild;g.setAttribute("aria-label",o),g.querySelector(".dm-chat-items").innerHTML=Ae;const m=g.querySelector(".dm-chat-log"),y=g.querySelector(".dm-chat-input");function ne(e){N.value=e,clearTimeout(G),G=setTimeout(()=>{d&&(N.value="")},Me)}let O=!0;const ie=()=>m.scrollHeight-m.scrollTop-m.clientHeight<80;function oe(e=!1){!e&&!O&&!ie()||(O=!0,requestAnimationFrame(()=>{m.scrollTop=m.scrollHeight}))}function j(e){if(!d||!e)return;e.token&&(f=e.token,ee.set(p,f)),e.state&&(v.value=e.state),typeof e.state?.staffOnline=="boolean"&&(i.value={...i.peek(),staffOnline:e.state.staffOnline});const a=(Array.isArray(e.messages)?e.messages:[]).filter(s=>s.n>x);a.length&&(x=Math.max(x,...a.map(s=>s.n)),B([...C.peek(),...a.map(s=>Ee(s,Y,i.peek().avatar,i.peek().times))]),oe(a.some(s=>s.from==="visitor"))),re()}function re(){if(clearTimeout(E),!d||!f)return;const e=we[b()];e&&(E=setTimeout(F,e))}async function F(){if(!(!d||!f)){if(document.hidden||!g.isConnected){re();return}try{const e=await I("GET",`${l}/state?${w}&after=${x}`,null,f);if(!d)return;if(!e.state){U();return}j(e)}catch{clearTimeout(E),d&&(E=setTimeout(F,15e3))}}}function U(){f=null,ee.remove(p),v.value=null,x=0,B([K()])}async function S(e,a,{thinking:s=!1}={}){if(T.peek())return!1;T.value=!0,N.value="",s&&!Z()&&(R.value=!0);const k=Date.now();try{const u=await I("POST",`${l}/${e}`,{launcher:c,after:x,...a},f);if(s&&!Z()){const q=450-(Date.now()-k);q>0&&await new Promise(Q=>setTimeout(Q,q))}return j(u),!0}catch(u){return d&&ne(u.message),!1}finally{d&&(T.value=!1,R.value=!1)}}async function V(){const e=L.peek().trim();if(!e||T.peek()||A.peek())return!1;if(!f){const s=1700-(Date.now()-r);if(s>0&&await new Promise(k=>setTimeout(k,s)),!d)return!1}return await S("send",{text:e,page:location.pathname,_hp:$.peek(),_t:r},{thinking:!0})&&(L.value="",y.focus()),!1}const _=h?h.closest(".dm-launcher-chat"):g,X=M.effect(()=>{const e=ke(i.value);for(const[a,s]of[["--chat-accent",e.accent],["--chat-accent-text",e.accentText]])s?_.style.setProperty(a,s):_.style.removeProperty(a)}),be=M.applyBindings(D,g,{methods:{send:()=>(V(),!1),sendDetails:()=>(S("details",{name:ae.peek(),email:se.peek(),message:z.peek()}).then(e=>{e&&(z.value="")}),!1),askPerson:()=>S("person",{page:location.pathname,_hp:$.peek(),_t:r},{thinking:!0}),end:async()=>{f&&await S("end",{})&&(A.value=!0,clearTimeout(E))},restart:()=>{A.value=!1,U(),y.focus()}}});window.Domma?.icons?.scan?.(g);let P=null,le=[];if(h){const e=h.querySelector(".dm-launcher-chat-title"),a=document.createElement("span");a.className="dm-launcher-chat-avatar",a.setAttribute("aria-hidden","true"),a.innerHTML='<img class="dm-chat-avatar-img" alt="" data-bind-src="botAvatar.value"><span class="dm-chat-avatar-letter" data-bind-text="botInitial.value"></span>',a.setAttribute("data-bind-class","online.value ? 'is-online' : ''");const s=document.createElement("span");s.className="dm-launcher-chat-heading";const k=document.createElement("span");k.className="dm-launcher-chat-sub",k.setAttribute("data-bind-text","statusText.value"),h.insertBefore(a,h.firstChild),e?(h.insertBefore(s,e),s.appendChild(e)):h.insertBefore(s,a.nextSibling),s.appendChild(k);const u=document.createElement("button");u.type="button",u.className="dm-launcher-chat-person",u.setAttribute("data-bind-hidden","!personInHead.value"),u.setAttribute("data-bind-title","personLabel.value"),u.setAttribute("data-bind-aria-label","personLabel.value"),u.setAttribute("data-bind-disabled","busy.value"),u.innerHTML='<span data-icon="headphones" data-icon-size="18" aria-hidden="true"></span>',h.insertBefore(u,h.querySelector(".dm-launcher-chat-close")),u.addEventListener("click",()=>S("person",{page:location.pathname,_hp:$.peek(),_t:r},{thinking:!0})),window.Domma?.icons?.scan?.(u),le=[a,k,u],P=M.applyBindings(D,a)||null;const q=M.applyBindings(D,k),Q=M.applyBindings(D,u),ve=[P,q,Q];P={dispose:()=>ve.forEach(ge=>ge?.dispose?.())}}const ce=e=>{e.key==="Enter"&&!e.shiftKey&&!e.isComposing&&(e.preventDefault(),V())};y.addEventListener("keydown",ce);const de=()=>{y.style.height="auto",y.style.height=Math.min(y.scrollHeight,120)+"px"};y.addEventListener("input",de);const ue=e=>{const a=e.target.closest(".dm-chat-starter");if(a&&m.contains(a)){L.value=a.dataset.text||"",V();return}const s=e.target.closest(".dm-chat-choice");!s||!m.contains(s)||S("pick",{n:Number(s.dataset.n),i:Number(s.dataset.i)},{thinking:!0})};m.addEventListener("click",ue);const me=()=>{O=ie()};m.addEventListener("scroll",me,{passive:!0});const J=typeof ResizeObserver=="function"?new ResizeObserver(()=>{O&&(m.scrollTop=m.scrollHeight)}):null;J?.observe(m),J?.observe(g.querySelector(".dm-chat-items"));const he=()=>{!document.hidden&&d&&f&&F()};return document.addEventListener("visibilitychange",he),B([K()]),(async()=>{try{const e=await I("GET",`${l}/config?${w}`);if(!d)return;i.value={...i.peek(),...e},v.peek()||B([K(),...C.peek().filter(a=>a.key!=="greet")])}catch(e){d&&ne(e.message)}if(!f||!d){Y=!0;return}try{const e=await I("GET",`${l}/state?${w}&after=0`,null,f);if(!d)return;if(!e.state){U();return}j(e),oe(!0)}catch{}Y=!0})(),{destroy(){d&&(d=!1,clearTimeout(E),clearTimeout(G),y.removeEventListener("keydown",ce),y.removeEventListener("input",de),m.removeEventListener("click",ue),m.removeEventListener("scroll",me),J?.disconnect(),document.removeEventListener("visibilitychange",he),be?.dispose?.(),P?.dispose?.(),X?.dispose?.(),typeof X=="function"&&X(),_.style.removeProperty("--chat-accent"),_.style.removeProperty("--chat-accent-text"),le.forEach(e=>e.remove()),t.innerHTML="")}}}
|
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
import{cssClasses as
|
|
2
|
-
`).replace(/[\u0000-\u0009\u000b-\u001f\u007f]/g," ").trim().slice(0,LAUNCHER_LIMITS.greetingMax):
|
|
1
|
+
import{cssClasses as M}from"./css-classes.mjs";export const LAUNCHER_POSITIONS=["TL","TC","TR","ML","MR","BL","BC","BR"],LAUNCHER_POSITION_LABEL={TL:"Top left",TC:"Top centre",TR:"Top right",ML:"Middle left",MR:"Middle right",BL:"Bottom left",BC:"Bottom centre",BR:"Bottom right"},LAUNCHER_TRIGGER_STYLES=["icon","icon-text"],LAUNCHER_TOOLTIP_MODES=["label","custom","off"],LAUNCHER_DEVICES=["all","desktop","phone"],LAUNCHER_AUDIENCES=["everyone","signed-in","signed-out"],LAUNCHER_PAGE_MODES=["all","only","except"],LAUNCHER_ACTIONS=["modal","slideover","chat"],LAUNCHER_MODAL_KINDS=["page","form","block"],LAUNCHER_SLIDEOVER_KINDS=["page","form","block"],LAUNCHER_MODAL_SIZES=["xs","sm","md","lg","xl","xxl","full","screen","custom"],LAUNCHER_MODAL_HEIGHTS=["auto","sm","md","lg","full","custom"],LAUNCHER_WIDTH_UNITS=["px","%"],LAUNCHER_HEIGHT_UNITS=["px","vh"],LAUNCHER_MODAL_WIDTH_CSS=Object.freeze({xs:"320px",sm:"400px",md:"600px",lg:"800px",xl:"1140px",xxl:"1400px",full:"90vw"}),LAUNCHER_MODAL_HEIGHT_CSS=Object.freeze({sm:"40vh",md:"60vh",lg:"80vh",full:"90vh"}),LAUNCHER_SLIDEOVER_WIDTHS=["sm","md","lg","xl"],LAUNCHER_SIDES=["left","right"],LAUNCHER_ASK_DETAILS=["offline","always","never"],LAUNCHER_TOKENS=["primary","secondary","success","danger","warning","info","surface","text","background"],LAUNCHER_LIMITS=Object.freeze({nameMax:60,labelMax:40,tooltipMax:120,titleMax:80,iconMax:40,idMax:40,sizeMin:32,sizeMax:96,offsetMax:500,pathsMax:50,pathMax:200,greetingMax:300,botNameMax:40,aiContextMax:4e3,aiRulesMax:2e3,avatarMax:300,chatWidth:[300,720],chatHeight:[380,900],startersMax:4,starterMax:80,aiMaxPerChat:[0,100],keepDays:[0,730],widthPx:[240,2400],widthPct:[20,100],heightPx:[160,2e3],heightVh:[20,100]}),LAUNCHER_DEFAULTS=Object.freeze({enabled:!0,showDisc:!0,name:"New launcher",label:"Open",tooltipMode:"label",tooltip:"",icon:"message-circle",triggerStyle:"icon",position:"BR",offsetX:32,offsetY:32,size:52,radius:26,devices:"all",phone:Object.freeze({override:!1,position:"BR",offsetX:16,offsetY:16,size:48}),colours:Object.freeze({background:"",text:""}),class:"",pages:Object.freeze({mode:"all",paths:Object.freeze([])}),audience:"everyone",action:Object.freeze({type:"modal",kind:"page",ref:"",title:"",size:"lg",side:"right",width:"md",customWidth:900,widthUnit:"px",height:"auto",customHeight:70,heightUnit:"vh"}),chat:Object.freeze({greeting:"Hi! How can we help?",botName:"Della",bot:!0,staff:!0,askDetails:"offline",ai:!0,aiUseSite:!0,aiContext:"",aiRules:"",accent:"",accentText:"",avatar:"",size:"md",width:400,height:600,resizable:!0,starters:Object.freeze([]),aiMaxPerChat:20,personButton:"below",keepDays:0,times:"time"})});const c=(e,t,i)=>t.includes(e)?e:i;function f(e,t,i,o){const r=typeof e=="number"?e:typeof e=="string"&&e.trim()?Number(e):NaN;return Number.isFinite(r)?Math.min(o,Math.max(i,Math.round(r))):Math.min(o,Math.max(i,t))}function l(e,t,i=""){return typeof e!="string"?i:e.replace(/[\u0000-\u001f\u007f]/g," ").trim().replace(/\s+/g," ").slice(0,t)||i}const d=e=>e&&typeof e=="object"&&!Array.isArray(e)?e:{};export const LAUNCHER_ID_RE=/^[a-z0-9][a-z0-9-]{0,39}$/;const b=/^[a-z0-9][a-z0-9-]{0,39}$/,A=/^\/[A-Za-z0-9._~\-/]*$/,y=/^[a-z0-9][a-z0-9_-]{0,99}$/i;export function launcherColour(e){if(typeof e!="string")return"";const t=e.trim().toLowerCase();return LAUNCHER_TOKENS.includes(t)||/^#(?:[0-9a-f]{3}|[0-9a-f]{4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(t)?t:""}export function launcherColourCss(e){const t=launcherColour(e);return t?LAUNCHER_TOKENS.includes(t)?`var(--dm-${t})`:t:""}export function normaliseLauncherPath(e){if(typeof e!="string")return"";let t=e.trim().split(/[?#]/)[0].replace(/\s+/g,"");return!t||(t.startsWith("/")||(t="/"+t),t=t.replace(/\/{2,}/g,"/"),t.length>1&&(t=t.replace(/\/+$/,"")),t.length>LAUNCHER_LIMITS.pathMax||!/^\/[A-Za-z0-9._~\-/*]*$/.test(t))?"":t}export function launcherPathMatches(e,t){const i=normaliseLauncherPath(e||"/")||"/",o=normaliseLauncherPath(t);return o?o.endsWith("/*")&&i===(o.slice(0,-2)||"/")?!0:new RegExp("^"+o.split("*").map(n=>n.replace(/[.+?^${}()|[\]\\]/g,"\\$&")).join(".*")+"$","i").test(i):!1}export function launcherShowsOn(e,t,i){if(!e||e.enabled===!1||e.audience==="signed-in"&&!i||e.audience==="signed-out"&&i)return!1;const o=e.pages.paths.some(r=>launcherPathMatches(t,r));return e.pages.mode==="only"?o:e.pages.mode==="except"?!o:!0}function C(e,t){const i=d(e);return{override:i.override===!0,position:c(i.position,LAUNCHER_POSITIONS,LAUNCHER_DEFAULTS.phone.position),offsetX:f(i.offsetX,LAUNCHER_DEFAULTS.phone.offsetX,0,LAUNCHER_LIMITS.offsetMax),offsetY:f(i.offsetY,LAUNCHER_DEFAULTS.phone.offsetY,0,LAUNCHER_LIMITS.offsetMax),size:f(i.size,Math.min(t,LAUNCHER_DEFAULTS.phone.size),LAUNCHER_LIMITS.sizeMin,LAUNCHER_LIMITS.sizeMax)}}function E(e){const t=d(e),i=c(t.type,LAUNCHER_ACTIONS,LAUNCHER_DEFAULTS.action.type),o=i==="modal"?LAUNCHER_MODAL_KINDS:LAUNCHER_SLIDEOVER_KINDS,r=i==="chat"?"page":c(t.kind,o,"page");let n=typeof t.ref=="string"?t.ref.trim():"";r==="page"?(n=n?normaliseLauncherPath(n):"",n.includes("*")&&(n="")):y.test(n)||(n=""),i==="chat"&&(n="");const s=LAUNCHER_DEFAULTS.action,h=c(t.widthUnit,LAUNCHER_WIDTH_UNITS,s.widthUnit),a=c(t.heightUnit,LAUNCHER_HEIGHT_UNITS,s.heightUnit);return{type:i,kind:r,ref:n,title:l(t.title,LAUNCHER_LIMITS.titleMax),size:c(t.size,LAUNCHER_MODAL_SIZES,s.size),side:c(t.side,LAUNCHER_SIDES,s.side),width:c(t.width,LAUNCHER_SLIDEOVER_WIDTHS,s.width),customWidth:f(t.customWidth,h==="%"?90:s.customWidth,...h==="%"?LAUNCHER_LIMITS.widthPct:LAUNCHER_LIMITS.widthPx),widthUnit:h,height:c(t.height,LAUNCHER_MODAL_HEIGHTS,s.height),customHeight:f(t.customHeight,a==="px"?600:s.customHeight,...a==="px"?LAUNCHER_LIMITS.heightPx:LAUNCHER_LIMITS.heightVh),heightUnit:a}}export function launcherModalBox(e){const t=e||LAUNCHER_DEFAULTS.action;if(t.size==="screen")return{width:"100vw",height:"100vh",screen:!0};const i=t.size==="custom"?t.widthUnit==="%"?`${t.customWidth}vw`:`${t.customWidth}px`:LAUNCHER_MODAL_WIDTH_CSS[t.size]||LAUNCHER_MODAL_WIDTH_CSS.lg,o=t.height==="custom"?`${t.customHeight}${t.heightUnit==="px"?"px":"vh"}`:LAUNCHER_MODAL_HEIGHT_CSS[t.height]||"";return{width:i,height:o,screen:!1}}export function normaliseLauncherChat(e){const t=d(e),i=LAUNCHER_DEFAULTS.chat;return{greeting:typeof t.greeting=="string"?t.greeting.replace(/\r\n?/g,`
|
|
2
|
+
`).replace(/[\u0000-\u0009\u000b-\u001f\u007f]/g," ").trim().slice(0,LAUNCHER_LIMITS.greetingMax):i.greeting,botName:l(t.botName,LAUNCHER_LIMITS.botNameMax,i.botName),bot:t.bot!==!1,staff:t.staff!==!1,askDetails:c(t.askDetails,LAUNCHER_ASK_DETAILS,i.askDetails),ai:t.ai!==!1,aiUseSite:t.aiUseSite!==!1,aiContext:m(t.aiContext,LAUNCHER_LIMITS.aiContextMax),aiRules:m(t.aiRules,LAUNCHER_LIMITS.aiRulesMax),accent:launcherColour(t.accent),accentText:launcherColour(t.accentText),avatar:launcherAvatar(t.avatar),size:c(t.size,LAUNCHER_CHAT_SIZES,i.size),width:f(t.width,i.width,...LAUNCHER_LIMITS.chatWidth),height:f(t.height,i.height,...LAUNCHER_LIMITS.chatHeight),resizable:t.resizable!==!1,starters:(Array.isArray(t.starters)?t.starters:typeof t.starters=="string"?t.starters.split(`
|
|
3
|
+
`):[]).map(r=>l(r,LAUNCHER_LIMITS.starterMax)).filter(Boolean).slice(0,LAUNCHER_LIMITS.startersMax),aiMaxPerChat:f(t.aiMaxPerChat,i.aiMaxPerChat,...LAUNCHER_LIMITS.aiMaxPerChat),personButton:c(t.personButton,LAUNCHER_PERSON_BUTTON,i.personButton),keepDays:f(t.keepDays,i.keepDays,...LAUNCHER_LIMITS.keepDays),times:c(t.times,LAUNCHER_CHAT_TIMES,i.times)}}export const LAUNCHER_PERSON_BUTTON=["below","header"],LAUNCHER_CHAT_TIMES=["time","datetime","none"],GREETING_PLACEHOLDERS=["greeting","timeofday","day","date","time","botname","site"];export function fillGreeting(e,{now:t=new Date,botName:i="",site:o=""}={}){const r=t.getHours(),n=r<12?"morning":r<18?"afternoon":"evening",s={greeting:`Good ${n}`,timeofday:n,day:t.toLocaleDateString("en-GB",{weekday:"long"}),date:t.toLocaleDateString("en-GB",{day:"numeric",month:"long"}),time:t.toLocaleTimeString("en-GB",{hour:"2-digit",minute:"2-digit"}),botname:i,site:o};return String(e??"").replace(/\{\s*([a-z]+)\s*\}/gi,(h,a)=>{const u=s[a.toLowerCase()];return u===void 0?h:u})}export const LAUNCHER_CHAT_SIZES=["sm","md","lg","custom"];const x={sm:[340,500],md:[400,600],lg:[480,720]};export function launcherChatBox(e={}){if(e.size==="custom")return{width:f(e.width,400,...LAUNCHER_LIMITS.chatWidth),height:f(e.height,600,...LAUNCHER_LIMITS.chatHeight)};const[t,i]=x[e.size]||x.md;return{width:t,height:i}}export function launcherAvatar(e){if(typeof e!="string")return"";const t=e.trim();return!t||t.length>LAUNCHER_LIMITS.avatarMax||t.startsWith("//")?"":/^\/[A-Za-z0-9._~\-/%]+$/.test(t)?t:""}export function launcherChatAccentCss(e={}){const t=launcherColourCss(e.accent);if(!t)return{accent:"",accentText:""};let i=launcherColourCss(e.accentText);if(!i){const o=launcherColour(e.accent);if(o.startsWith("#")){const r=o.length<=5?o.slice(1,4).split("").map(a=>a+a).join(""):o.slice(1,7),[n,s,h]=[0,2,4].map(a=>parseInt(r.slice(a,a+2),16)/255).map(a=>a<=.03928?a/12.92:((a+.055)/1.055)**2.4);i=.2126*n+.7152*s+.0722*h>.179?"#111111":"#ffffff"}else i=o==="primary"?"var(--dm-primary-text, #fff)":`var(--dm-${o}-text, #fff)`}return{accent:t,accentText:i}}function m(e,t){return typeof e=="string"?e.replace(/\r\n?/g,`
|
|
4
|
+
`).replace(/[\u0000-\u0009\u000b-\u001f\u007f]/g," ").replace(/\n{3,}/g,`
|
|
5
|
+
|
|
6
|
+
`).trim().slice(0,t):""}export function normaliseLauncher(e){const t=d(e),i=LAUNCHER_DEFAULTS,o=f(t.size,i.size,LAUNCHER_LIMITS.sizeMin,LAUNCHER_LIMITS.sizeMax),r=Math.floor(o/2),n=d(t.pages),s=(Array.isArray(n.paths)?n.paths:typeof n.paths=="string"?n.paths.split(/[\n,]+/):[]).map(normaliseLauncherPath).filter(Boolean).filter((a,u,p)=>p.indexOf(a)===u).slice(0,LAUNCHER_LIMITS.pathsMax),h=d(t.colours);return{id:typeof t.id=="string"&&LAUNCHER_ID_RE.test(t.id)?t.id:"",enabled:t.enabled!==!1,showDisc:t.showDisc!==!1,name:l(t.name,LAUNCHER_LIMITS.nameMax,i.name),label:l(t.label,LAUNCHER_LIMITS.labelMax,i.label),tooltipMode:c(t.tooltipMode,LAUNCHER_TOOLTIP_MODES,i.tooltipMode),tooltip:l(t.tooltip,LAUNCHER_LIMITS.tooltipMax,""),icon:typeof t.icon=="string"&&b.test(t.icon.trim())?t.icon.trim():i.icon,triggerStyle:c(t.triggerStyle,LAUNCHER_TRIGGER_STYLES,i.triggerStyle),position:c(t.position,LAUNCHER_POSITIONS,i.position),offsetX:f(t.offsetX,i.offsetX,0,LAUNCHER_LIMITS.offsetMax),offsetY:f(t.offsetY,i.offsetY,0,LAUNCHER_LIMITS.offsetMax),size:o,radius:Math.min(r,f(t.radius,i.radius,0,r)),devices:c(t.devices,LAUNCHER_DEVICES,i.devices),phone:C(t.phone,o),colours:{background:launcherColour(h.background),text:launcherColour(h.text)},class:M(typeof t.class=="string"?t.class:"").join(" "),pages:{mode:c(n.mode,LAUNCHER_PAGE_MODES,i.pages.mode),paths:s},audience:c(t.audience,LAUNCHER_AUDIENCES,i.audience),action:E(t.action),chat:normaliseLauncherChat(t.chat)}}export function launcherTooltip(e){return!e||e.tooltipMode==="off"?"":e.tooltipMode==="custom"?e.tooltip||e.label:e.triggerStyle==="icon-text"?"":e.label}export function launcherHref(e){return`#launcher-${e}`}export function newLauncherId(e=new Set,t=Math.random){for(let i=0;i<1e3;i++){const o="l-"+Math.floor(t()*2176782336).toString(36).padStart(6,"0");if(!e.has(o))return o}return"l-"+Date.now().toString(36)}export function normaliseLaunchers(e,t=Math.random){const i=Array.isArray(e)?e:Array.isArray(e?.launchers)?e.launchers:[],o=new Set;return i.filter(r=>r&&typeof r=="object"&&!Array.isArray(r)).map(r=>{const n=normaliseLauncher(r);return(!n.id||o.has(n.id))&&(n.id=newLauncherId(o,t)),o.add(n.id),n})}export function launcherReady(e){return e?e.action.type==="chat"?!0:!!e.action.ref:!1}export function publicLauncher(e){const t={id:e.id,disc:e.showDisc,label:e.label,tooltip:launcherTooltip(e),icon:e.icon,triggerStyle:e.triggerStyle,position:e.position,offsetX:e.offsetX,offsetY:e.offsetY,size:e.size,radius:e.radius,devices:e.devices,phone:e.phone,colours:{background:launcherColourCss(e.colours.background),text:launcherColourCss(e.colours.text)},class:e.class,action:{type:e.action.type,title:e.action.title||e.label,size:e.action.size,side:e.action.side,width:e.action.width,customWidth:e.action.customWidth,widthUnit:e.action.widthUnit,height:e.action.height,customHeight:e.action.customHeight,heightUnit:e.action.heightUnit}};if(e.action.type==="chat"){const{aiContext:i,aiRules:o,aiUseSite:r,aiMaxPerChat:n,keepDays:s,...h}=e.chat;t.chat=h}return t}export function launcherSpot(e,{w:t,h:i,vw:o,vh:r,offsetX:n,offsetY:s}){const h=e[1]==="L"?"L":e[1]==="R"?"R":"C",a=e[0],u=h==="L"?n:h==="R"?o-t-n:Math.round((o-t)/2+n),p=a==="T"?s:a==="B"?r-i-s:Math.round((r-i)/2+s);return{left:u,top:p}}const g=12,L=(e,t)=>e.left<t.right+g&&t.left<e.right+g&&e.top<t.bottom+g&&t.top<e.bottom+g;export function launcherStack(e,t,{w:i,h:o},r){const n=e[0]==="B";let s=t.top;for(let h=0;h<=r.length;h++){const a={left:t.left,top:s,right:t.left+i,bottom:s+o},u=r.find(p=>p&&p.right>p.left&&p.bottom>p.top&&L(a,p));if(!u)break;s=Math.round(n?u.top-g-o:u.bottom+g)}return{left:t.left,top:s}}
|
package/public/js/launchers.mjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import{launcherModalBox as
|
|
1
|
+
import{LAUNCHER_LIMITS as C,launcherChatBox as ut,launcherModalBox as mt,launcherSpot as pt,launcherStack as ft}from"/public/js/launcher-settings.mjs?v=20261110-chat-times-settings";const V=i=>`launcher-chat-size:${i}`,vt=i=>{try{const c=globalThis.S?.get?.(V(i));return c&&Number(c.width)&&Number(c.height)?c:null}catch{return null}},Z=(i,c)=>{try{globalThis.S?.set?.(V(i),c)}catch{}},J="(max-width: 640px)",Q=[".site-search-floating-trigger","#back-to-top-btn","#go-to-bottom-btn",".dm-theme-switcher:not(.dm-ts-inline)","nav.dm-breadcrumbs",".dm-motion-fab"].join(","),tt={sm:"360px",md:"480px",lg:"640px",xl:"860px"},gt=i=>String(i??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,"""),et=()=>document.documentElement.classList.contains("dm-reduced-motion")||matchMedia("(prefers-reduced-motion: reduce)").matches,bt=`
|
|
2
2
|
<button type="button" class="dm-launcher" data-id="{{id}}" data-bind-class="cls" data-bind-style="style.value"
|
|
3
3
|
data-bind-aria-expanded="expanded.value" data-bind-hidden="hidden.value" aria-haspopup="dialog" aria-label="{{label}}">
|
|
4
4
|
<span class="dm-launcher-icon" data-icon="{{icon}}" aria-hidden="true"></span>
|
|
5
5
|
<span class="dm-launcher-label" data-bind-hidden="!pill">{{label}}</span>
|
|
6
|
-
</button>`,
|
|
6
|
+
</button>`,yt=`
|
|
7
7
|
<div class="dm-launcher-chat-head">
|
|
8
8
|
<strong class="dm-launcher-chat-title" data-bind-text="title"></strong>
|
|
9
9
|
<button type="button" class="dm-launcher-chat-close" data-on-click="close" aria-label="Close"><span data-icon="x" aria-hidden="true"></span></button>
|
|
10
10
|
</div>
|
|
11
11
|
<div class="dm-launcher-chat-body"></div>
|
|
12
|
-
<p class="dm-launcher-note" data-bind-hidden="!note.value" data-bind-text="note.value"></p>`;function he(i){const s=i.getBoundingClientRect();return getComputedStyle(i).opacity!=="0"||i.offsetParent!==null?s:{top:Math.min(s.top,i.offsetTop),left:Math.min(s.left,i.offsetLeft),right:Math.max(s.right,i.offsetLeft+i.offsetWidth),bottom:Math.max(s.bottom,i.offsetTop+i.offsetHeight)}}function Q(i){window.Domma?.icons?.scan&&window.Domma.icons.scan(i)}function Z(i,{fill:s}){const c=document.createElement("iframe");if(c.className="dm-launcher-frame"+(s?" is-fill":""),c.title=i.action.title,c.src=`/_launcher/${encodeURIComponent(i.id)}`,c.setAttribute("loading","eager"),!s){let d=null;c.addEventListener("load",()=>{const L=c.contentDocument;if(!L?.body)return;const y=L.querySelector(".site-content")||L.body,T=()=>{c.style.height=`${Math.ceil(y.getBoundingClientRect().height)}px`};T(),d?.disconnect(),d=new ResizeObserver(T),d.observe(y)})}return c}export function mountLaunchers(i){if(!Array.isArray(i)||!i.length||document.querySelector(".dm-launchers"))return null;const s=M.observable(matchMedia(Y).matches),c=document.createElement("div");c.className="dm-launchers";const d=i.map(e=>{const n=a=>a&&e.phone?.override?{...e,...e.phone}:e,t=e.triggerStyle==="icon-text",o=a=>{const u=n(a),f={"--launcher-size":`${u.size}px`,"--launcher-radius":`${t?999:Math.min(e.radius,Math.floor(u.size/2))}px`,"--launcher-glyph":`${Math.round(u.size*20/52)}px`};return e.colours.background&&(f["--launcher-bg"]=e.colours.background),e.colours.text&&(f["--launcher-fg"]=e.colours.text),f},l=M.observable(-9999),r=M.observable(-9999);return{id:e.id,label:e.label,icon:e.icon,pill:t,launcher:e,look:n,left:l,top:r,cls:["dm-launcher--"+e.action.type,t?"dm-launcher--pill":"",e.class].filter(Boolean).join(" "),style:M.computed(()=>({...o(s.value),left:`${l.value}px`,top:`${r.value}px`})),expanded:M.observable("false"),hidden:M.computed(()=>e.disc===!1||e.devices==="desktop"&&s.value||e.devices==="phone"&&!s.value)}});c.innerHTML='<div class="dm-launchers-list" data-each="rows.value key=id"></div>',c.firstElementChild.innerHTML=de;const L=M.applyBindings({rows:M.observable(d)},c);document.body.appendChild(c),Q(c);const y=e=>c.querySelector(`.dm-launcher[data-id="${CSS.escape(e)}"]`),T={TL:"right",ML:"right",BL:"right",TR:"left",MR:"left",BR:"left",TC:"bottom",BC:"top"},A=new Map;for(const e of d){const n=e.launcher.tooltip,t=y(e.id);if(!(!n||!t||typeof E.tooltip!="function"))try{A.set(e.id,E.tooltip(t,{content:n,position:T[e.launcher.position]||"top",trigger:"hover focus",className:"dm-launcher-tip"}))}catch{}}function z(){const e=document.documentElement.clientWidth,n=window.innerHeight,t=[...document.querySelectorAll(G)].filter(o=>!c.contains(o)&&getComputedStyle(o).position==="fixed"&&getComputedStyle(o).display!=="none").map(he);for(const o of d){const l=y(o.id);if(!l||l.hidden)continue;const r=o.look(s.peek()),a=l.offsetWidth,u=l.offsetHeight,f=se(r.position,{w:a,h:u,vw:e,vh:n,offsetX:r.offsetX,offsetY:r.offsetY}),v=le(r.position,f,{w:a,h:u},t),b=Math.max(0,Math.min(e-a,v.left)),C=Math.max(0,Math.min(n-u,v.top));o.left.value=b,o.top.value=C,t.push({left:b,top:C,right:b+a,bottom:C+u})}}let R=0;const g=()=>{cancelAnimationFrame(R),R=requestAnimationFrame(z)},P=new MutationObserver(e=>{e.some(n=>[...n.addedNodes].some(t=>t.nodeType===1&&t.matches?.(G)))&&g()});P.observe(document.body,{childList:!0});const H=matchMedia(Y),q=()=>{s.value=H.matches,g()};H.addEventListener?.("change",q),window.addEventListener("resize",g),window.addEventListener("load",g,{once:!0}),z();let m=null;const ee=M.effect(()=>{const e=d.some(n=>n.expanded.value==="true"&&(n.launcher.action.type!=="chat"||s.value));document.documentElement.classList.toggle("dm-launcher-covering",e)});function K(){const e=m;m=null,e&&(e.row.expanded.value="false",e.close())}function te(e){const n=e.launcher,t=ie(n.action),o=E.modal({title:n.action.title,size:t.width,content:Z(n,{fill:!!t.height}),className:"dm-launcher-modal",bodyClass:"dm-launcher-modal-body",buttons:[],animation:J()?!1:"fade",onClosed:()=>{m?.row===e&&(m=null,e.expanded.value="false"),setTimeout(()=>{try{o.destroy()}catch{}},0)}});return o.element?.classList.add("dm-launcher-modal",`dm-launcher-modal--${n.action.size}`),o.element?.style.setProperty("--launcher-modal-w",t.width),t.height&&(o.element?.classList.add("dm-launcher-modal--fixed"),o.element?.style.setProperty("--launcher-modal-h",t.height)),o.open(),()=>{try{o.close()}catch{}}}function ne(e){const n=e.launcher,t=E.slideover({title:re(n.action.title),position:n.action.side,size:s.peek()?"full":V[n.action.width]||V.md,content:Z(n,{fill:!0}),bodyClass:"dm-launcher-so-body",animation:!J(),onClosed:()=>{m?.row===e&&(m=null,e.expanded.value="false"),setTimeout(()=>{try{t.destroy?.()}catch{}t.element?.remove()},0)}});return t.element?.classList.add("dm-launcher-so"),t.open(),()=>{try{t.close()}catch{}}}function oe(e,n){const t=e.launcher,o=y(e.id),l=o&&!o.hidden?o:null,r=l||(n?.isConnected?n:null),a=document.createElement("div");a.className="dm-launcher-chat",a.setAttribute("role","dialog"),a.setAttribute("aria-label",t.action.title),a.innerHTML=ue;const u=M.observable("");let f=null,v=!1;const b=()=>{if(!v){v=!0;try{f?.destroy?.()}catch{}C.dispose?.(),a.remove(),document.removeEventListener("keydown",U),window.removeEventListener("resize",N),m?.row===e&&(m=null,e.expanded.value="false"),(r?.isConnected?r:null)?.focus()}},C=M.applyBindings({title:t.action.title,note:u,close:b},a),U=h=>{h.key!=="Escape"||h.defaultPrevented||!a.contains(document.activeElement)||(h.preventDefault(),b())},N=()=>{if(s.peek()){a.classList.add("is-full"),a.removeAttribute("style");return}a.classList.remove("is-full");const h=document.documentElement.clientWidth,D=window.innerHeight,w=Math.min(380,h-24),x=Math.min(560,D-24),I=O=>Math.max(12,Math.min(h-w-12,O)),_=O=>Math.max(12,Math.min(D-x-12,O));let S,k;if(!l){S=I(t.position[1]==="L"?24:h-w-24),k=_(D-x-24),Object.assign(a.style,{left:`${S}px`,top:`${k}px`,width:`${w}px`,height:`${x}px`});return}const p=l.getBoundingClientRect(),X=p.left+p.width/2>h/2;t.position[0]==="M"?(S=I(X?p.left-w-12:p.right+12),k=_(p.top+p.height/2-x/2)):(S=I(X?p.right-w:p.left),k=t.position[0]==="T"?_(p.bottom+12):_(p.top-x-12)),Object.assign(a.style,{left:`${S}px`,top:`${k}px`,width:`${w}px`,height:`${x}px`})};document.body.appendChild(a),N(),Q(a),document.addEventListener("keydown",U),window.addEventListener("resize",N);const ce=a.querySelector(".dm-launcher-chat-body");return import("/public/js/launcher-chat.mjs").then(h=>{if(!v){if(typeof h.mountChat!="function")throw new Error("no mountChat");f=h.mountChat(ce,{launcherId:t.id,title:t.action.title,chat:t.chat||{}})}}).catch(()=>{v||(u.value="Chat is unavailable right now. Please try again later.")}),a.querySelector(".dm-launcher-chat-close")?.focus(),b}function $(e,n=null){const t=d.find(a=>a.id===e);if(!t)return;const o=m?.row===t;if(K(),o)return;t.expanded.value="true";try{A.get(t.id)?.close()}catch{}const l=t.launcher.action.type,r=l==="chat"?oe(t,n):l==="slideover"?ne(t):te(t);m={row:t,close:r}}const F=e=>{const n=e.target.closest(".dm-launcher");n&&$(n.dataset.id)};c.addEventListener("click",F);const W=/^#launcher-([a-z0-9][a-z0-9-]{0,39})$/,ae=e=>{const n=e.closest("[data-launcher]");if(n)return{el:n,id:n.dataset.launcher};const t=e.closest("a[href]"),o=t&&W.exec(t.getAttribute("href")||"");return o?{el:t,id:o[1]}:null},j=e=>{if(e.button>0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||c.contains(e.target))return;const n=e.target instanceof Element?ae(e.target):null;!n||!d.some(t=>t.id===n.id)||(e.preventDefault(),$(n.id,n.el))};document.addEventListener("click",j);const B=W.exec(location.hash);return B&&d.some(e=>e.id===B[1])&&(history.replaceState(history.state,"",location.pathname+location.search),setTimeout(()=>$(B[1]),0)),{place:z,launch:$,destroy(){K(),ee?.(),document.documentElement.classList.remove("dm-launcher-covering");for(const e of A.values())try{e.destroy()}catch{}A.clear(),cancelAnimationFrame(R),P.disconnect(),H.removeEventListener?.("change",q),window.removeEventListener("resize",g),window.removeEventListener("load",g),c.removeEventListener("click",F),document.removeEventListener("click",j),L?.dispose?.(),c.remove()}}}typeof window<"u"&&Array.isArray(window.__CMS_LAUNCHERS__)&&window.M&&window.E&&(window.DommaLaunchers=mountLaunchers(window.__CMS_LAUNCHERS__));
|
|
12
|
+
<p class="dm-launcher-note" data-bind-hidden="!note.value" data-bind-text="note.value"></p>`;function wt(i){const c=i.getBoundingClientRect();return getComputedStyle(i).opacity!=="0"||i.offsetParent!==null?c:{top:Math.min(c.top,i.offsetTop),left:Math.min(c.left,i.offsetLeft),right:Math.max(c.right,i.offsetLeft+i.offsetWidth),bottom:Math.max(c.bottom,i.offsetTop+i.offsetHeight)}}function nt(i){window.Domma?.icons?.scan&&window.Domma.icons.scan(i)}function ot(i,{fill:c}){const l=document.createElement("iframe");if(l.className="dm-launcher-frame"+(c?" is-fill":""),l.title=i.action.title,l.src=`/_launcher/${encodeURIComponent(i.id)}`,l.setAttribute("loading","eager"),!c){let f=null;l.addEventListener("load",()=>{const H=l.contentDocument;if(!H?.body)return;const $=H.querySelector(".site-content")||H.body,N=()=>{l.style.height=`${Math.ceil($.getBoundingClientRect().height)}px`};N(),f?.disconnect(),f=new ResizeObserver(N),f.observe($)})}return l}export function mountLaunchers(i){if(!Array.isArray(i)||!i.length||document.querySelector(".dm-launchers"))return null;const c=M.observable(matchMedia(J).matches),l=document.createElement("div");l.className="dm-launchers";const f=i.map(t=>{const n=o=>o&&t.phone?.override?{...t,...t.phone}:t,e=t.triggerStyle==="icon-text",a=o=>{const v=n(o),x={"--launcher-size":`${v.size}px`,"--launcher-radius":`${e?999:Math.min(t.radius,Math.floor(v.size/2))}px`,"--launcher-glyph":`${Math.round(v.size*20/52)}px`};return t.colours.background&&(x["--launcher-bg"]=t.colours.background),t.colours.text&&(x["--launcher-fg"]=t.colours.text),x},h=M.observable(-9999),u=M.observable(-9999);return{id:t.id,label:t.label,icon:t.icon,pill:e,launcher:t,look:n,left:h,top:u,cls:["dm-launcher--"+t.action.type,e?"dm-launcher--pill":"",t.class].filter(Boolean).join(" "),style:M.computed(()=>({...a(c.value),left:`${h.value}px`,top:`${u.value}px`})),expanded:M.observable("false"),hidden:M.computed(()=>t.disc===!1||t.devices==="desktop"&&c.value||t.devices==="phone"&&!c.value)}});l.innerHTML='<div class="dm-launchers-list" data-each="rows.value key=id"></div>',l.firstElementChild.innerHTML=bt;const H=M.applyBindings({rows:M.observable(f)},l);document.body.appendChild(l),nt(l);const $=t=>l.querySelector(`.dm-launcher[data-id="${CSS.escape(t)}"]`),N={TL:"right",ML:"right",BL:"right",TR:"left",MR:"left",BR:"left",TC:"bottom",BC:"top"},B=new Map;for(const t of f){const n=t.launcher.tooltip,e=$(t.id);if(!(!n||!e||typeof E.tooltip!="function"))try{B.set(t.id,E.tooltip(e,{content:n,position:N[t.launcher.position]||"top",trigger:"hover focus",className:"dm-launcher-tip"}))}catch{}}function O(){const t=document.documentElement.clientWidth,n=window.innerHeight,e=[...document.querySelectorAll(Q)].filter(a=>!l.contains(a)&&getComputedStyle(a).position==="fixed"&&getComputedStyle(a).display!=="none").map(wt);for(const a of f){const h=$(a.id);if(!h||h.hidden)continue;const u=a.look(c.peek()),o=h.offsetWidth,v=h.offsetHeight,x=pt(u.position,{w:o,h:v,vw:t,vh:n,offsetX:u.offsetX,offsetY:u.offsetY}),S=ft(u.position,x,{w:o,h:v},e),T=Math.max(0,Math.min(t-o,S.left)),R=Math.max(0,Math.min(n-v,S.top));a.left.value=T,a.top.value=R,e.push({left:T,top:R,right:T+o,bottom:R+v})}}let P=0;const A=()=>{cancelAnimationFrame(P),P=requestAnimationFrame(O)},K=new MutationObserver(t=>{t.some(n=>[...n.addedNodes].some(e=>e.nodeType===1&&e.matches?.(Q)))&&A()});K.observe(document.body,{childList:!0});const W=matchMedia(J),U=()=>{c.value=W.matches,A()};W.addEventListener?.("change",U),window.addEventListener("resize",A),window.addEventListener("load",A,{once:!0}),O();let b=null;const at=M.effect(()=>{const t=f.some(n=>n.expanded.value==="true"&&(n.launcher.action.type!=="chat"||c.value));document.documentElement.classList.toggle("dm-launcher-covering",t)});function Y(){const t=b;b=null,t&&(t.row.expanded.value="false",t.close())}function it(t){const n=t.launcher,e=mt(n.action),a=E.modal({title:n.action.title,size:e.width,content:ot(n,{fill:!!e.height}),className:"dm-launcher-modal",bodyClass:"dm-launcher-modal-body",buttons:[],animation:et()?!1:"fade",onClosed:()=>{b?.row===t&&(b=null,t.expanded.value="false"),setTimeout(()=>{try{a.destroy()}catch{}},0)}});return a.element?.classList.add("dm-launcher-modal",`dm-launcher-modal--${n.action.size}`),a.element?.style.setProperty("--launcher-modal-w",e.width),e.height&&(a.element?.classList.add("dm-launcher-modal--fixed"),a.element?.style.setProperty("--launcher-modal-h",e.height)),a.open(),()=>{try{a.close()}catch{}}}function ct(t){const n=t.launcher,e=E.slideover({title:gt(n.action.title),position:n.action.side,size:c.peek()?"full":tt[n.action.width]||tt.md,content:ot(n,{fill:!0}),bodyClass:"dm-launcher-so-body",animation:!et(),onClosed:()=>{b?.row===t&&(b=null,t.expanded.value="false"),setTimeout(()=>{try{e.destroy?.()}catch{}e.element?.remove()},0)}});return e.element?.classList.add("dm-launcher-so"),e.open(),()=>{try{e.close()}catch{}}}function st(t,n){const e=t.launcher,a=$(t.id),h=a&&!a.hidden?a:null,u=h||(n?.isConnected?n:null),o=document.createElement("div");o.className="dm-launcher-chat",o.setAttribute("role","dialog"),o.setAttribute("aria-label",e.action.title),o.innerHTML=yt;const v=M.observable("");let x=null,S=!1;const T=()=>{if(!S){S=!0;try{x?.destroy?.()}catch{}R.dispose?.(),o.remove(),document.removeEventListener("keydown",G),window.removeEventListener("resize",D),b?.row===t&&(b=null,t.expanded.value="false"),(u?.isConnected?u:null)?.focus()}},R=M.applyBindings({title:e.action.title,note:v,close:T},o),G=r=>{r.key!=="Escape"||r.defaultPrevented||!o.contains(document.activeElement)||(r.preventDefault(),T())},D=()=>{if(c.peek()){o.classList.add("is-full"),o.removeAttribute("style");return}o.classList.remove("is-full");const r=document.documentElement.clientWidth,s=window.innerHeight,_=e.chat?.resizable!==!1&&vt(e.id)||ut(e.chat||{}),y=Math.min(Math.max(C.chatWidth[0],Number(_.width)),C.chatWidth[1],r-24),w=Math.min(Math.max(C.chatHeight[0],Number(_.height)),C.chatHeight[1],s-24),m=L=>Math.max(12,Math.min(r-y-12,L)),d=L=>Math.max(12,Math.min(s-w-12,L));let g,z;if(!h){g=m(e.position[1]==="L"?24:r-y-24),z=d(s-w-24),Object.assign(o.style,{left:`${g}px`,top:`${z}px`,width:`${y}px`,height:`${w}px`});return}const p=h.getBoundingClientRect(),k=p.left+p.width/2>r/2;e.position[0]==="M"?(g=m(k?p.left-y-12:p.right+12),z=d(p.top+p.height/2-w/2)):(g=m(k?p.right-y:p.left),z=e.position[0]==="T"?d(p.bottom+12):d(p.top-w-12)),Object.assign(o.style,{left:`${g}px`,top:`${z}px`,width:`${y}px`,height:`${w}px`})};if(document.body.appendChild(o),D(),e.chat?.resizable!==!1){const r=document.createElement("div");r.className="dm-launcher-chat-grip",r.setAttribute("role","separator"),r.setAttribute("aria-label","Resize the chat"),r.title="Drag to resize",o.appendChild(r);let s=null;const _=m=>{if(!s)return;const d=document.documentElement.clientWidth,g=window.innerHeight,z=(m.clientX-s.x)*(s.fromLeft?-1:1),p=(m.clientY-s.y)*(s.fromTop?-1:1),k=Math.round(Math.min(Math.max(C.chatWidth[0],s.w+z),C.chatWidth[1],d-24)),L=Math.round(Math.min(Math.max(C.chatHeight[0],s.h+p),C.chatHeight[1],g-24)),dt=s.fromLeft?s.right-k:s.left,ht=s.fromTop?s.bottom-L:s.top;Object.assign(o.style,{width:`${k}px`,height:`${L}px`,left:`${Math.max(12,Math.min(d-k-12,dt))}px`,top:`${Math.max(12,Math.min(g-L-12,ht))}px`}),s.size={width:k,height:L}},y=()=>{s&&(s.size&&Z(e.id,s.size),s=null,o.classList.remove("is-resizing"),window.removeEventListener("pointermove",_),window.removeEventListener("pointerup",y))},w=()=>{const[m,d]=String(e.position||"BR");r.dataset.corner=`${m==="T"?"b":"t"}${d==="L"?"r":"l"}`};w(),r.addEventListener("pointerdown",m=>{if(c.peek())return;m.preventDefault();const d=o.getBoundingClientRect(),g=r.dataset.corner;s={x:m.clientX,y:m.clientY,w:d.width,h:d.height,left:d.left,top:d.top,right:d.right,bottom:d.bottom,fromLeft:g[1]==="l",fromTop:g[0]==="t"},o.classList.add("is-resizing"),window.addEventListener("pointermove",_),window.addEventListener("pointerup",y)}),r.addEventListener("dblclick",()=>{Z(e.id,null),D(),w()})}nt(o),document.addEventListener("keydown",G),window.addEventListener("resize",D);const rt=o.querySelector(".dm-launcher-chat-body");return import("/public/js/launcher-chat.mjs").then(r=>{if(!S){if(typeof r.mountChat!="function")throw new Error("no mountChat");x=r.mountChat(rt,{launcherId:e.id,title:e.action.title,chat:e.chat||{}})}}).catch(()=>{S||(v.value="Chat is unavailable right now. Please try again later.")}),o.querySelector(".dm-launcher-chat-close")?.focus(),T}function I(t,n=null){const e=f.find(o=>o.id===t);if(!e)return;const a=b?.row===e;if(Y(),a)return;e.expanded.value="true";try{B.get(e.id)?.close()}catch{}const h=e.launcher.action.type,u=h==="chat"?st(e,n):h==="slideover"?ct(e):it(e);b={row:e,close:u}}const j=t=>{const n=t.target.closest(".dm-launcher");n&&I(n.dataset.id)};l.addEventListener("click",j);const F=/^#launcher-([a-z0-9][a-z0-9-]{0,39})$/,lt=t=>{const n=t.closest("[data-launcher]");if(n)return{el:n,id:n.dataset.launcher};const e=t.closest("a[href]"),a=e&&F.exec(e.getAttribute("href")||"");return a?{el:e,id:a[1]}:null},X=t=>{if(t.button>0||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||l.contains(t.target))return;const n=t.target instanceof Element?lt(t.target):null;!n||!f.some(e=>e.id===n.id)||(t.preventDefault(),I(n.id,n.el))};document.addEventListener("click",X);const q=F.exec(location.hash);return q&&f.some(t=>t.id===q[1])&&(history.replaceState(history.state,"",location.pathname+location.search),setTimeout(()=>I(q[1]),0)),{place:O,launch:I,destroy(){Y(),at?.(),document.documentElement.classList.remove("dm-launcher-covering");for(const t of B.values())try{t.destroy()}catch{}B.clear(),cancelAnimationFrame(P),K.disconnect(),W.removeEventListener?.("change",U),window.removeEventListener("resize",A),window.removeEventListener("load",A),l.removeEventListener("click",j),document.removeEventListener("click",X),H?.dispose?.(),l.remove()}}}typeof window<"u"&&Array.isArray(window.__CMS_LAUNCHERS__)&&window.M&&window.E&&(window.DommaLaunchers=mountLaunchers(window.__CMS_LAUNCHERS__));
|
package/public/js/menu-cards.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{colourToCss as w}from"/public/js/menu-decor.mjs?v=
|
|
1
|
+
import{colourToCss as w}from"/public/js/menu-decor.mjs?v=20261109-current-query";import{normaliseLook as B,normalisePanel as E,cardColumns as $,floatsWithoutStrip as O,TRAY_BARS as _,TILE_RAINBOW as y,LOOK_ICONS as N}from"/public/js/menu-look.mjs?v=20261029-footer-bars";const v="(min-width: 993px)",z=`
|
|
2
2
|
<span class="dm-nc-eyebrow" data-bind-text="heading.value"></span>
|
|
3
3
|
<a class="dm-nc-more" data-bind-href="linkUrl.value" data-bind-hidden="!linkUrl.value"><span data-bind-text="linkText.value"></span><span class="dm-nc-arrow" data-icon="arrow-right" data-size="14" aria-hidden="true"></span></a>`,I=`
|
|
4
4
|
<div class="dm-nc-feature-box">
|
package/public/js/menu-decor.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const PRESET_COLOUR_VARS={primary:"--dm-primary",success:"--dm-success",danger:"--dm-danger",warning:"--dm-warning",info:"--dm-info",neutral:"--dm-text-muted"},PRESET_COLOUR_FALLBACKS={primary:"#0d6efd",success:"#198754",danger:"#dc3545",warning:"#ffc107",info:"#0dcaf0",neutral:"#6c757d"};const
|
|
1
|
+
export const PRESET_COLOUR_VARS={primary:"--dm-primary",success:"--dm-success",danger:"--dm-danger",warning:"--dm-warning",info:"--dm-info",neutral:"--dm-text-muted"},PRESET_COLOUR_FALLBACKS={primary:"#0d6efd",success:"#198754",danger:"#dc3545",warning:"#ffc107",info:"#0dcaf0",neutral:"#6c757d"};const g=/^#[0-9a-fA-F]{6}$/;export function colourToCss(t){return typeof t!="string"?"":PRESET_COLOUR_VARS[t]?`var(${PRESET_COLOUR_VARS[t]}, ${PRESET_COLOUR_FALLBACKS[t]})`:g.test(t)?t:""}export const FLOAT_ANCHORS=["TL","TR","BL","BR","L","R"],FLOAT_DEFAULTS={anchor:"TL",offsetX:16,offsetY:16,zIndex:150},FLOAT_SHADOWS={none:"none",sm:"var(--dm-shadow-sm)",md:"var(--dm-shadow-md)",lg:"var(--dm-shadow-lg)",xl:"var(--dm-shadow-xl)"};function c(t,e,n,r){const o=Number(t);return Number.isFinite(o)?Math.min(r,Math.max(n,Math.round(o))):e}function m(t){const e=[];if(t.radius!=null&&t.radius!==""&&e.push(`border-radius:${c(t.radius,8,0,48)}px`),t.shadow!=null&&t.shadow!==""&&Object.prototype.hasOwnProperty.call(FLOAT_SHADOWS,t.shadow)&&e.push(`box-shadow:${FLOAT_SHADOWS[t.shadow]}`),t.accent&&colourToCss(t.accent)){const n=colourToCss(t.accent);e.push(`--dm-menu-accent:${n}`,`border-color:${n}`)}return t.opacity!=null&&t.opacity!==""&&e.push(`--dm-menu-panel-opacity:${c(t.opacity,100,20,100)/100}`),e}export function floatToCss(t){if(!t||t.position!=="floating")return"";const e=t.float&&typeof t.float=="object"&&!Array.isArray(t.float)?t.float:{},n=FLOAT_ANCHORS.includes(e.anchor)?e.anchor:FLOAT_DEFAULTS.anchor,r=c(e.offsetX,FLOAT_DEFAULTS.offsetX,0,4e3),o=c(e.offsetY,FLOAT_DEFAULTS.offsetY,0,4e3),i=["position:fixed",`z-index:${c(e.zIndex,FLOAT_DEFAULTS.zIndex,0,2147483647)}`];return n==="L"||n==="R"?(i.push("top:50%","transform:translateY(-50%)"),i.push(n==="L"?`left:${r}px`:`right:${r}px`)):(i.push(n[0]==="T"?`top:${o}px`:`bottom:${o}px`),i.push(n[1]==="L"?`left:${r}px`:`right:${r}px`)),e.width!=null&&e.width!==""&&i.push(`width:${c(e.width,260,120,600)}px`),i.push(`max-height:calc(100vh - ${n==="L"||n==="R"?32:o*2}px)`),i.push(...m(e)),i.join(";")}export const FLOAT_FLAGS=["collapsible","collapsed","movable","resizable"];export function floatBehaviour(t){const e={collapsible:!1,collapsed:!1,movable:!1,resizable:!1,chrome:!1,title:""};if(!t||t.position!=="floating")return e;const n=t.float&&typeof t.float=="object"&&!Array.isArray(t.float)?t.float:{},r={collapsible:!!n.collapsible,collapsed:!!n.collapsible&&!!n.collapsed,movable:!!n.movable,resizable:!!n.resizable},o=r.collapsible||r.movable,l=typeof n.title=="string"&&n.title!==""?n.title:t.name||"";return{...r,chrome:o,title:o?l:""}}export function applyFloat(t,e){const n=floatToCss(e);if(!t||!n)return!1;t.style.cssText+=";"+n,t.classList.add("dm-menu-floating"),e.slug&&!t.hasAttribute("data-menu")&&t.setAttribute("data-menu",e.slug),e.float?.anchor&&t.setAttribute("data-float-anchor",e.float.anchor);const r=floatBehaviour(e);for(const o of FLOAT_FLAGS)o!=="collapsed"&&r[o]&&t.setAttribute(`data-float-${o}`,"1");return r.collapsed&&t.setAttribute("data-float-collapsed","1"),r.title&&t.setAttribute("data-float-title",r.title),!0}export function makeBadgeEl(t){if(!t||t.text==null||t.text==="")return null;const e=document.createElement("span");e.className="dm-menu-badge",e.textContent=String(t.text);const n=t.variant?colourToCss(t.variant):"";return n&&(e.style.background=n,e.style.color="var(--dm-text-inverse, #fff)"),e}export function applyColour(t,e){const n=colourToCss(e);n&&(t.style.color=n)}export function applyPill(t,e){if(!e)return;t.classList.add("dm-nav-pill");const n=e.variant?colourToCss(e.variant):"";e.style==="outline"?(t.classList.add("dm-nav-pill--outline"),n&&(t.style.borderColor=n,t.style.color=n)):n&&(t.style.background=n,t.style.color="#fff")}export const MENU_ALIGN=["left","centre","right","spread"];export function menuAlign(t){const e=t&&t.align;return MENU_ALIGN.includes(e)?e:""}export const HIGHLIGHT_HOVER=["none","colour","underline","overline","background","darken","uppercase","grow","breathe","glow"],HIGHLIGHT_ACTIVE=["none","bold","underline","overline","background","darken","pill"],HIGHLIGHT_HOVER_LABELS={none:"None - no change on hover",colour:"Colour change",underline:"Underline",overline:"Overline",background:"Background tint",darken:"Darkened",uppercase:"Uppercase",grow:"Grow",breathe:"Breathe",glow:"Glow"},HIGHLIGHT_ACTIVE_LABELS={none:"None - not marked at all",bold:"Bold",underline:"Underline",overline:"Overline",background:"Background tint",darken:"Darkened",pill:"Filled pill"},LEGACY_STYLE_HOVER={none:"none",underline:"underline",overline:"overline",transform:"uppercase","text-transform":"uppercase",breathe:"breathe"},LEGACY_STYLE_ACTIVE={none:"none",darken:"darken",background:"background","background-color":"background",underline:"underline",overline:"overline"};export function legacyStyleHighlight(t){const e=t&&typeof t=="object"&&!Array.isArray(t)?t:{};return{hover:LEGACY_STYLE_HOVER[e.hover]||"",active:LEGACY_STYLE_ACTIVE[e.active]||""}}export function highlightAttrs(t){const e=t&&t.highlight&&typeof t.highlight=="object"&&!Array.isArray(t.highlight)?t.highlight:{},n=legacyStyleHighlight(t&&t.style);return{hover:HIGHLIGHT_HOVER.includes(e.hover)?e.hover:n.hover,active:HIGHLIGHT_ACTIVE.includes(e.active)?e.active:n.active,accent:e.accent?colourToCss(e.accent):""}}export function applyHighlight(t,e){if(!t)return!1;const{hover:n,active:r,accent:o}=highlightAttrs(e);return n&&t.setAttribute("data-menu-hover",n),r&&t.setAttribute("data-menu-active",r),o&&t.style.setProperty("--dm-menu-highlight",o),!!(n||r||o)}export function itemHighlightAttrs(t){const e=t&&t.highlight&&typeof t.highlight=="object"&&!Array.isArray(t.highlight)?t.highlight:{};return{hover:HIGHLIGHT_HOVER.includes(e.hover)?e.hover:"",active:HIGHLIGHT_ACTIVE.includes(e.active)?e.active:"",accent:e.accent?colourToCss(e.accent):""}}export function applyItemHighlight(t,e){if(!t)return!1;const{hover:n,active:r,accent:o}=itemHighlightAttrs(e);return n&&t.setAttribute("data-menu-item-hover",n),r&&t.setAttribute("data-menu-item-active",r),o&&t.style.setProperty("--dm-menu-highlight",o),!!(n||r||o)}function d(t){if(typeof t!="string"||!t)return"";const e=t.split("#")[0].split("?")[0];return e.startsWith("/")?e.length>1&&e.endsWith("/")?e.slice(0,-1):e:""}export function isCurrentItem(t,e){const n=d(t),r=d(e);return!!n&&!!r&&n===r}function f(t){const e=String(t||"").split("#")[0].split("?")[1];return new URLSearchParams(e||"")}export function currentItems(t,e){const n=d(e);if(!n)return new Set;const r=f(e),o=[];if((function a(u){for(const s of Array.isArray(u)?u:[])!s||typeof s!="object"||(typeof s.url=="string"&&d(s.url)===n&&o.push(s),Array.isArray(s.items)&&a(s.items))})(t),!o.length)return new Set;const i=o.map(a=>{const u=[...f(a.url)];return{it:a,n:u.length,fits:u.every(([s,h])=>r.getAll(s).includes(h))}}).filter(a=>a.fits);if(!i.length)return new Set(o);const p=Math.max(...i.map(a=>a.n));return new Set(i.filter(a=>a.n===p).map(a=>a.it))}export const ENTRANCE_ANIMATIONS=["fade","slide-up","slide-down","slide-left","slide-right","zoom","pop","flip","blur"],ENTRANCE_ANIMATION_LABELS={fade:"Fade in","slide-up":"Slide up","slide-down":"Slide down","slide-left":"Slide in from the right","slide-right":"Slide in from the left",zoom:"Zoom in",pop:"Pop (zoom with a bounce)",flip:"Flip down",blur:"Blur into focus"},ENTRANCE_DEFAULTS={animation:"fade",stagger:60,duration:400},ENTRANCE_LIMITS={stagger:[0,1e3],duration:[50,3e3]};export function entranceAttrs(t){const e=t&&t.entrance;if(!e||typeof e!="object"||Array.isArray(e)||e.enabled!==!0)return null;const n=r=>{const o=Number(e[r]),[l,i]=ENTRANCE_LIMITS[r];return e[r]!==""&&e[r]!=null&&Number.isFinite(o)&&o>=l&&o<=i?Math.round(o):ENTRANCE_DEFAULTS[r]};return{animation:ENTRANCE_ANIMATIONS.includes(e.animation)?e.animation:ENTRANCE_DEFAULTS.animation,stagger:n("stagger"),duration:n("duration")}}export function entranceStyle(t){return t?`--dm-menu-entrance-step:${t.stagger}ms;--dm-menu-entrance-duration:${t.duration}ms`:""}export function applyEntrance(t,e){if(!t)return!1;const n=entranceAttrs(e);return n?(t.style.setProperty("--dm-menu-entrance-step",`${n.stagger}ms`),t.style.setProperty("--dm-menu-entrance-duration",`${n.duration}ms`),t.setAttribute("data-menu-entrance",n.animation),!0):!1}export{CSS_CLASS_RE,CSS_CLASS_MAX,CSS_CLASS_MAX_LEN,cssClasses,cssClassProblems,normaliseCssClasses,applyClasses}from"./css-classes.mjs";
|
package/public/js/site.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{applyMobileMenu as ae,initCarouselPopup as ie}from"/public/js/mobile-ui.mjs?v=20261016-mobile-options";import{installSmoothCarets as re}from"/public/js/smooth-caret.js";import{decodeBase64Json as V}from"/public/js/utf8-base64.mjs";import{makeBadgeEl as U,applyColour as G,applyPill as ce,applyFloat as le,applyHighlight as Y,applyItemHighlight as de,itemHighlightAttrs as me,isCurrentItem as K,menuAlign as ue,applyClasses as P,cssClasses as X,applyEntrance as J}from"/public/js/menu-decor.mjs?v=20261014-menu-entrance";import{applyMenuLook as pe,applyFooterLook as fe}from"/public/js/menu-cards.mjs?v=20261029-footer-bars";import{initPageMotion as he}from"/public/js/page-motion.mjs?v=20261029-page-motion";import{applyFooterShowcase as ge}from"/public/js/footer-showcase.mjs?v=20261029-footer-showcase";import{initFloatingMenus as ye}from"/public/js/menu-float.js?v=20260829-float-panel";import{enhancePickerFields as Q,markInvalidFields as Z,showValidationPopup as ee}from"/public/js/forms.js?v=20261109-form-embed";import{buildWizardSteps as ve}from"/public/js/form-steps.mjs";import{mountMotionControl as be}from"/public/js/motion-control.mjs?v=20261031-launchers";import{applyFormClasses as te,applyFormEntrance as oe,applySubmitButtons as we,applyWizardButtons as Ce}from"/public/js/form-submit.mjs";import{captureFileFields as ne,destroyDropzones as Se,fileBlueprint as xe,restoreFileFields as ke,setFileLimits as Le,splitFiles as $e,submitBody as Ee,totalTooLarge as Ae,wireFileFields as Te}from"/public/js/form-files.mjs";document.addEventListener("click",l=>{const i=l.target?.closest?.(".dm-banner__dismiss");i&&(l.preventDefault(),i.closest(".dm-banner")?.remove())}),$(()=>{re(document);const l=window.__CMS_NAV__||{},i=window.__CMS_SITE__||{},D=i.brandingEnabled!==!1&&l.brand?.enabled!==!1;if(i.autoTheme?.enabled){let o=function(r){const m=(r||"07:00").split(":");return+m[0]*60+(+m[1]||0)},e=function(){const r=new Date,m=r.getHours()*60+r.getMinutes();return m>=o(a.dayStart)&&m<o(a.nightStart)?a.dayTheme:a.nightTheme},t=function(r){const m=a.apply&&a.apply[r]||{theme:r,custom:""};Domma.theme.set(m.theme);for(const n of[...document.body.classList])n.startsWith("dm-custom-")&&document.body.classList.remove(n);m.custom&&document.body.classList.add(m.custom)};const a=i.autoTheme;t(e()),setInterval(()=>t(e()),6e4)}const L=$("#site-navbar");if(L.length&&l.brand){let e=function(u,f=0){return Array.isArray(u)?u.filter(h=>!(h&&(h.type==="spacer"||h.type==="theme-switcher"))).filter(h=>!(h&&h.type==="separator"&&f===0)).map(h=>h&&h.type==="separator"?{divider:!0}:Array.isArray(h?.items)?{...h,items:e(h.items,f+1)}:h):u};const a={...l.brand},o=a.size&&a.size!=="md"?` navbar-brand-${a.size}`:"";if(a.logo||a.icon||a.tagline){let u="";a.logo?u+=`<img src="${a.logo}" class="navbar-brand-logo" alt="${a.text||""}">`:a.icon&&(u+=`<span data-icon="${a.icon}" style="width:1.1em;height:1.1em;margin-right:.35em;vertical-align:middle;"></span>`),a.text&&(u+=`<span class="navbar-brand-text${o}">${a.text}</span>`),a.tagline&&(u+=`<small class="navbar-brand-tagline">${a.tagline}</small>`),a.html=u}else o&&a.text&&(a.html=`<span class="navbar-brand-text${o}">${a.text}</span>`);const t=e(l.items||[]),r=l.position==="floating",m=l.orientation==="vertical";L.get(0).querySelector(":scope > .cms-nojs-links")?.remove(),Domma.elements.navbar("#site-navbar",{brand:D?a:null,items:t,variant:l.variant||"dark",position:r?"static":l.position||"sticky",collapsible:!0,appearOnHover:!!l.appearOnHover}),Domma.icons.scan("#site-navbar");const n=L.get(0);ae(n,l.mobile);const y=()=>{if(!m)return;const f=n.querySelector('a[aria-current="page"]')?.closest(".navbar-dropdown");f&&!f.classList.contains("open")&&f.querySelector(":scope > .navbar-dropdown-toggle")?.click()};n.classList.add(`dm-nav-align-${ue(l)||"centre"}`),m&&L.get(0).classList.add("dm-nav-vertical",l.side==="right"?"dm-nav-vertical-right":"dm-nav-vertical-left");const g=l.dock||{};m&&!r&&qe(n,l.side==="right"),!m&&g.hideOnScroll&&Me(n),Y(n,l),J(n,l),P(n,l.class),r&&(le(L.get(0),l),ye(L.get(0).parentNode||document));const d=n.querySelector(".navbar-toggle"),b=n.querySelector(".navbar-collapse");if(d&&b){let u=null;const f=()=>{b.classList.contains("show")&&d.click()},h=()=>{u&&(u.remove(),u=null),document.body.classList.remove("dm-drawer-open")},p=()=>{u||(u=document.createElement("div"),u.className="dm-navbar-backdrop",u.addEventListener("click",f),document.body.appendChild(u),document.body.classList.add("dm-drawer-open"))};d.addEventListener("click",()=>{requestAnimationFrame(()=>{b.classList.contains("show")?(y(),p()):h()})}),b.addEventListener("click",x=>{x.target.closest("a")&&requestAnimationFrame(h)}),document.addEventListener("keydown",x=>{x.key==="Escape"&&b.classList.contains("show")&&f()})}const w=n.querySelector(".navbar-nav");if(w){const u=Array.from(w.children);let f=0;for(const h of l.items||[])if(!(h&&h.type==="separator")){if(h&&h.type==="spacer"){const p=document.createElement("li"),x=["xs","sm","md","lg","xl","flex"].includes(h.size)?h.size:"md";p.className=`dm-menu-spacer dm-menu-spacer--${x}`,p.setAttribute("aria-hidden","true"),w.insertBefore(p,u[f]||null);continue}if(h&&h.type==="theme-switcher"){const p=document.createElement("li");p.className="dm-menu-theme-switcher";const x=document.createElement("span");x.dataset.themeSwitcher="menu",x.dataset.position="inline",p.appendChild(x),w.insertBefore(p,u[f]||null);continue}f++}window.CMSThemeSwitcher?.scan(w)}n.querySelectorAll("[data-path]").forEach(u=>{const f=u.dataset.path.split(".").map(Number),h=f.length>1,p=f.reduce((M,I)=>M?.items?.[I],{items:t});if(!p)return;p.colour&&G(u,p.colour),p.pill&&!h&&ce(u,p.pill),de(u,p),P(u.closest("li"),p.class);const x=U(p.badge);x&&u.appendChild(x),K(p.url,location.pathname)&&(u.classList.add("active"),u.setAttribute("aria-current","page"))}),pe(n,l,t),y()}let z=null;const C=$("#site-footer");if(C.length){let r=function(c){return String(c??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")},m=function(c){return r(c).replace(/'/g,"'")},n=function(c){if(c&&c.type==="separator")return'<li class="footer-sep"><hr></li>';if(c&&c.type==="spacer")return`<li class="dm-menu-spacer dm-menu-spacer--${["xs","sm","md","lg","xl","flex"].includes(c.size)?c.size:"md"}" aria-hidden="true"></li>`;if(c&&c.type==="theme-switcher")return'<li class="dm-menu-theme-switcher"><span data-theme-switcher="menu" data-position="inline"></span></li>';const v=m(c.url||"#"),k=r(c.text||""),q=Array.isArray(c.items)&&c.items.length?`<ul>${c.items.map(n).join("")}</ul>`:"",N=me(c),j=[N.hover&&` data-menu-item-hover="${m(N.hover)}"`,N.active&&` data-menu-item-active="${m(N.active)}"`].filter(Boolean).join(""),W=N.accent?` style="--dm-menu-highlight:${m(N.accent)}"`:"",B=X(c.class).join(" ");return`<li${B?` class="${m(B)}"`:""}><a href="${v}"${j}${W}>${k}</a>${q}</li>`},g=function(){if(!i.footer)return"";const c=Object.keys(o).filter(k=>a[k]);if(!c.length)return"";const v=X(i.footer.socialClass).join(" ");return`<div class="footer-social">${c.map(k=>{const{label:q,svg:N}=o[k];return`<a href="${a[k]}" target="_blank" rel="noopener noreferrer" aria-label="${q}" class="footer-social-link${v?` ${m(v)}`:""}">${N}</a>`}).join("")}</div>`},u=function(c){if(!c||c.type==="separator"||c.type==="spacer")return"";if(c.type==="theme-switcher")return`<li class="cms-footer-col">${n(c).replace(/^<li[^>]*>|<\/li>$/g,"")}</li>`;const v=Array.isArray(c.items)&&c.items.length?`<ul>${c.items.map(n).join("")}</ul>`:"",k=w(c)?`<span class="cms-footer-col-title">${r(c.text||"")}</span>`:`<a class="cms-footer-col-title" href="${m(c.url||"#")}">${r(c.text||"")}</a>`,q=["cms-footer-col",...X(c.class)].join(" ");return`<li class="${m(q)}">${k}${v}</li>`},p=function(c,v,k=!1){return(c||[]).forEach(q=>{q&&(q.type==="separator"||q.type==="spacer"||q.type==="theme-switcher")||(k&&w(q)||v.push(q),Array.isArray(q.items)&&q.items.length&&p(q.items,v))}),v};const a=i.social||{},o={twitter:{label:"X / Twitter",svg:'<svg viewBox="0 0 24 24" fill="currentColor"><path d="M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-4.714-6.231-5.401 6.231H2.742l7.73-8.835L1.254 2.25H8.08l4.259 5.629L18.244 2.25zm-1.161 17.52h1.833L7.084 4.126H5.117z"/></svg>'},facebook:{label:"Facebook",svg:'<svg viewBox="0 0 24 24" fill="currentColor"><path d="M24 12.073c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.99 4.388 10.954 10.125 11.854v-8.385H7.078v-3.47h3.047V9.43c0-3.007 1.792-4.669 4.533-4.669 1.312 0 2.686.235 2.686.235v2.953H15.83c-1.491 0-1.956.925-1.956 1.874v2.25h3.328l-.532 3.47h-2.796v8.385C19.612 23.027 24 18.062 24 12.073z"/></svg>'},instagram:{label:"Instagram",svg:'<svg viewBox="0 0 24 24" fill="currentColor"><path d="M12 2.163c3.204 0 3.584.012 4.85.07 3.252.148 4.771 1.691 4.919 4.919.058 1.265.069 1.645.069 4.849 0 3.205-.012 3.584-.069 4.849-.149 3.225-1.664 4.771-4.919 4.919-1.266.058-1.644.07-4.85.07-3.204 0-3.584-.012-4.849-.07-3.26-.149-4.771-1.699-4.919-4.92-.058-1.265-.07-1.644-.07-4.849 0-3.204.013-3.583.07-4.849.149-3.227 1.664-4.771 4.919-4.919 1.266-.057 1.645-.069 4.849-.069zM12 0C8.741 0 8.333.014 7.053.072 2.695.272.273 2.69.073 7.052.014 8.333 0 8.741 0 12c0 3.259.014 3.668.072 4.948.2 4.358 2.618 6.78 6.98 6.98C8.333 23.986 8.741 24 12 24c3.259 0 3.668-.014 4.948-.072 4.354-.2 6.782-2.618 6.979-6.98.059-1.28.073-1.689.073-4.948 0-3.259-.014-3.667-.072-4.947-.196-4.354-2.617-6.78-6.979-6.98C15.668.014 15.259 0 12 0zm0 5.838a6.162 6.162 0 100 12.324 6.162 6.162 0 000-12.324zM12 16a4 4 0 110-8 4 4 0 010 8zm6.406-11.845a1.44 1.44 0 100 2.881 1.44 1.44 0 000-2.881z"/></svg>'},linkedin:{label:"LinkedIn",svg:'<svg viewBox="0 0 24 24" fill="currentColor"><path d="M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433a2.062 2.062 0 01-2.063-2.065 2.064 2.064 0 112.063 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z"/></svg>'},github:{label:"GitHub",svg:'<svg viewBox="0 0 24 24" fill="currentColor"><path d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"/></svg>'},youtube:{label:"YouTube",svg:'<svg viewBox="0 0 24 24" fill="currentColor"><path d="M23.495 6.205a3.007 3.007 0 00-2.088-2.088c-1.87-.501-9.396-.501-9.396-.501s-7.507-.01-9.396.501A3.007 3.007 0 00.527 6.205a31.247 31.247 0 00-.522 5.805 31.247 31.247 0 00.522 5.783 3.007 3.007 0 002.088 2.088c1.868.502 9.396.502 9.396.502s7.506 0 9.396-.502a3.007 3.007 0 002.088-2.088 31.247 31.247 0 00.5-5.783 31.247 31.247 0 00-.5-5.805zM9.609 15.601V8.408l6.264 3.602z"/></svg>'}};let e='<div class="footer-inner container">';const t=window.__CMS_FOOTER__||{primary:[],legal:[],copyright:""},y=(()=>{const c=i.cookieConsent;if(!c||c.showSettingsLink===!1)return"";const v=k=>(k||[]).some(q=>q&&(q.url==="#cookie-settings"||v(q.items)));return v(t.primary)||v(t.legal)?"":`<li class="cms-cookie-settings"><a href="#cookie-settings">${r(c.settingsLinkText||"Cookie settings")}</a></li>`})(),d=["columns","row"].includes(i.footer?.layout)?i.footer.layout:"auto",b=i.footer?.look==="showcase"||d==="columns"||d==="auto"&&t.primary.some(c=>Array.isArray(c?.items)&&c.items.length),w=c=>b&&!c.url&&Array.isArray(c.items)&&c.items.length>0;if(b){const c=l.brand||{},v=D&&(c.text||i.title)||"",k=D?c.logo?`<img src="${m(c.logo)}" class="cms-footer-brand-logo" alt="">`:c.icon?'<span class="cms-footer-brand-icon"></span>':"":"",q=String(i.footer?.blurb||"").trim();e='<div class="footer-inner footer-inner--columns container"><div class="cms-footer-top">',e+=`<div class="cms-footer-brand">${v||k?`<a class="cms-footer-brand-name" href="${m(c.url||"/")}">${k}<span>${r(v)}</span></a>`:""}${q?`<p class="cms-footer-blurb">${r(q)}</p>`:""}${g()}</div>`,t.primary.length&&(e+=`<nav class="footer-nav footer-nav--primary footer-nav--columns" aria-label="Footer"><ul>${t.primary.map(u).join("")}</ul></nav>`),e+='</div><div class="cms-footer-bottom">',t.copyright&&(e+=`<p class="cms-footer-copyright">${r(t.copyright)}</p>`),(t.legal.length||y)&&(e+=`<nav class="footer-nav footer-nav--legal" aria-label="Legal"><ul>${t.legal.map(n).join("")}${y}</ul></nav>`),e+="</div>"}else t.copyright&&(e+=`<p>${r(t.copyright)}</p>`),t.primary.length&&(e+=`<nav class="footer-nav footer-nav--primary"><ul>${t.primary.map(n).join("")}</ul></nav>`),(t.legal.length||y)&&(e+=`<nav class="footer-nav footer-nav--legal"><ul>${t.legal.map(n).join("")}${y}</ul></nav>`),e+=g();e+="</div>",C.get(0).querySelector(":scope > .cms-nojs-links")?.remove();const f=C.get(0).querySelector(":scope > .cms-footer-blocks");f?.remove(),C.html(e),f&&C.get(0).prepend(f),window.CMSThemeSwitcher?.scan(C.get(0));const h=C.get(0).querySelector(".cms-footer-brand-icon");h&&l.brand?.icon&&h.setAttribute("data-icon",l.brand.icon),P(C.get(0),i.footer?.class),b&&ge(C.get(0),i);const x=[...p(t.primary,[],!0),...p(t.legal,[])],M=C.get(0).querySelectorAll(".footer-nav a"),I=[];M.forEach((c,v)=>{const k=x[v];if(!k)return;if(I.push({a:c,item:k}),k.icon){const N=document.createElement("span");N.className="cms-footer-ic",N.setAttribute("data-icon",String(k.icon)),N.setAttribute("data-icon-size","15"),N.setAttribute("aria-hidden","true"),c.prepend(N)}k.colour&&G(c,k.colour);const q=U(k.badge);q&&c.appendChild(q),K(k.url,location.pathname)&&(c.classList.add("is-active"),c.setAttribute("aria-current","page"))}),Y(C.get(0).querySelector(".footer-nav--primary"),{highlight:t.primaryHighlight}),Y(C.get(0).querySelector(".footer-nav--legal"),{highlight:t.legalHighlight}),J(C.get(0).querySelector(".footer-nav--primary"),{entrance:t.primaryEntrance}),J(C.get(0).querySelector(".footer-nav--legal"),{entrance:t.legalEntrance}),P(C.get(0).querySelector(".footer-nav--primary"),t.primaryClass),P(C.get(0).querySelector(".footer-nav--legal"),t.legalClass),fe(C.get(0),t,I),z=C.get(0).querySelector(".cms-footer-bottom")||C.get(0).querySelector(".footer-inner")}be(i.motion||{enabled:i.footer?.showMotionToggle!==!1,default:i.footer?.motionDefault,placement:"footer",control:i.footer?.motionControl,label:"Reduce motion"},{footer:z,navbar:document.querySelector("#site-navbar .navbar-container")?.closest("#site-navbar")||null});const A=document.getElementById("site-sidebar");A&&De(A),Domma.icons.scan(),Domma.syntax?.scan&&Domma.syntax.scan();const s=$(".page-body");if(s.length){s.find(".accordion").each(function(){Domma.elements.accordion(this,{allowMultiple:this.dataset.multi==="true"})}),s.find(".tabs").each(function(){Domma.elements.tabs(this)}),s.find(".carousel").each(function(){const o={primary:"--dm-primary",secondary:"--dm-secondary",accent:"--dm-primary",text:"--dm-text",surface:"--dm-surface",background:"--dm-background",success:"--dm-success",warning:"--dm-warning",danger:"--dm-danger",info:"--dm-info"},e=g=>{const d=String(g||"").trim();return d?o[d.toLowerCase()]?`var(${o[d.toLowerCase()]})`:CSS.supports("color",d)?d:"":""},t=e(this.dataset.background),r=e(this.dataset.arrowBackground),m=e(this.dataset.arrowColor);t&&(this.style.setProperty("--dm-carousel-background",t),this.classList.add("dm-carousel-custom-background")),r&&this.style.setProperty("--dm-carousel-arrow-background",r),m&&this.style.setProperty("--dm-carousel-arrow-color",m);const n=["top","middle","bottom"].includes(this.dataset.arrowPosition)?this.dataset.arrowPosition:"middle";this.classList.add(`dm-carousel-arrows-${n}`);const y={autoplay:this.dataset.autoplay==="true",interval:parseInt(this.dataset.interval,10)||5e3,loop:this.dataset.loop!=="false",animation:this.dataset.animation||"slide",heightMode:this.dataset.heightMode==="average"?"average":"crop"};if(this.dataset.height){const g=Number(this.dataset.height);Number.isFinite(g)&&g>0&&(y.height=g)}if(this.dataset.animationDuration){const g=parseInt(this.dataset.animationDuration,10);Number.isFinite(g)&&(y.animationDuration=g)}this.dataset.animationEasing&&(y.animationEasing=this.dataset.animationEasing),this.dataset.ctx&&(this._dmCtxSlides=Array.from(this.querySelectorAll(".carousel-slide")).map(g=>g.cloneNode(!0)),this._dmCarouselOpts=y),this._dmCarousel=Domma.elements.carousel(this,y),ie(this)}),s.find(".dm-countdown").each(function(){const o={autoStart:!0},e=String(this.dataset.format||"").trim(),t=String(this.dataset.to||"").trim(),r=/^(\d{4})-(\d{2})-(\d{2})$/.exec(t),m=r?new Date(+r[1],+r[2]-1,+r[3]).getTime():t?new Date(t).getTime():NaN;Number.isFinite(m)?o.duration=Math.max(0,m-Date.now()):this.dataset.duration&&(o.duration=(parseInt(this.dataset.duration,10)||0)*1e3);const n=/^dd:/i.test(e);o.format=n?"hh:mm:ss":e||(o.duration>=36e5?"hh:mm:ss":"mm:ss");const y=this,g=b=>String(b).padStart(2,"0"),d=b=>{const w=Math.max(0,Math.floor(b/1e3)),u=y.querySelector(".dm-timer-time");u&&(u.textContent=`${g(Math.floor(w/86400))}:${g(Math.floor(w%86400/3600))}:${g(Math.floor(w%3600/60))}:${g(w%60)}`)};n&&(o.onTick=d),Domma.elements.timer(this,o),n&&d(o.duration||0)}),s.find("[data-tooltip]:not(.dm-range-slider)").each(function(){Domma.elements.tooltip(this,{content:$(this).data("tooltip"),position:$(this).data("tooltip-position")||"top"})}),s.find(".dm-progression").each(function(){const o=Array.from(this.querySelectorAll(".dm-progression-item")).map(r=>{const m={title:r.querySelector(".dm-progression-item-title")?.textContent?.trim()||"",description:r.querySelector(".dm-progression-item-body")?.innerHTML?.trim()||""};return r.dataset.date&&(m.date=r.dataset.date),r.dataset.status&&(m.status=r.dataset.status),r.dataset.eventIcon&&(m.icon=r.dataset.eventIcon),r.dataset.entryId&&(m._entryId=r.dataset.entryId),m}),e=this.dataset.layout==="centred"?"centered":this.dataset.layout||"vertical",t=Domma.elements.progression(this,{layout:e,theme:this.dataset.theme||"minimal",mode:this.dataset.mode||"timeline",statusIcons:!0,allowHtml:!0,...o.length?{items:o}:{}});if((this.dataset.mode||"timeline")==="timeline"){const r={completed:{label:"Completed",icon:"check-circle",tone:"success"},planned:{label:"Planned",icon:"circle",tone:"secondary"},"in-progress":{label:"In progress",icon:"clock",tone:"primary"},blocked:{label:"Blocked",icon:"alert-circle",tone:"danger"}};this.querySelectorAll(".dm-progression-item").forEach((m,n)=>{const y=o[n];if(!y)return;const g=m.querySelector(".dm-progression-title");if(y.icon&&g){const b=document.createElement("span");b.dataset.icon=y.icon,b.style.cssText="display:inline-flex;vertical-align:middle;margin-right:.4em",b.setAttribute("aria-hidden","true"),g.prepend(b)}const d=r[y.status];if(d&&g){const b=document.createElement("span");b.className=`badge badge-${d.tone} cms-timeline-status`,b.style.cssText="display:inline-flex;align-items:center;gap:.35em;margin:.4rem 0";const w=document.createElement("span");w.dataset.icon=d.icon,w.dataset.iconSize="14",w.setAttribute("aria-hidden","true"),b.append(w,document.createTextNode(d.label)),g.after(b)}})}Domma.icons.scan(this),o.length&&(this._dmCtx={instance:t,items:o})});try{Domma.effects.reveal(".page-body .hero",{animation:"slide-up",duration:480,threshold:.06,stagger:60,once:!1})}catch{}const a=matchMedia("(prefers-reduced-motion: reduce)").matches||document.documentElement.classList.contains("dm-reduced-motion");document.querySelectorAll(".page-body .row[data-reveal]").forEach(o=>{const e=o.dataset.revealMode||"stagger",t=o.dataset.revealAnimation||"slide-up",r=parseInt(o.dataset.revealDuration,10)||(t.startsWith("swoosh")?700:400),m=parseInt(o.dataset.revealStagger,10)||(t.startsWith("swoosh")?90:60),n=parseInt(o.dataset.revealDelay,10)||0,y=o.dataset.revealDirection==="rtl",g=o.dataset.revealReplay==="true",d=Array.from(o.children);if(a&&t.startsWith("swoosh"))return;const b={"slide-up":"translateY(30px)","slide-down":"translateY(-30px)","slide-left":"translateX(30px)","slide-right":"translateX(-30px)",zoom:"scale(0.85)",flip:"perspective(600px) rotateX(15deg)",swoosh:"translateY(36px) scale(0.96)"},w=p=>t!=="swoosh-sides"?b[t]||"":d.length>1&&p===0?"translateX(-64px) rotate(-1.5deg)":d.length>1&&p===d.length-1?"translateX(64px) rotate(1.5deg)":"translateY(40px) scale(0.94)",u=t.startsWith("swoosh"),f=u?"cubic-bezier(.2,.8,.2,1)":"ease",h=(p,x)=>{p.style.opacity="0",p.style.transform=w(x),u&&(p.style.filter="blur(10px)")};d.forEach((p,x)=>{p.style.transition="none",h(p,x)}),o.offsetWidth,d.forEach((p,x)=>{p.style.transition=`opacity ${r}ms ${f}, transform ${r}ms ${f}`+(u?`, filter ${r}ms ${f}`:"");const M=y?d.length-1-x:x;p.style.transitionDelay=e==="stagger"?`${n+M*m}ms`:`${n}ms`}),requestAnimationFrame(()=>requestAnimationFrame(()=>{const p=new IntersectionObserver(x=>{x.forEach(M=>{if(M.isIntersecting){if(M.target.offsetWidth,M.target.style.opacity="1",M.target.style.transform="",u&&(M.target.style.filter=""),!g){p.unobserve(M.target);const I=M.target;I.addEventListener("transitionend",function c(v){v.target!==I||v.propertyName!=="opacity"||(I.removeEventListener("transitionend",c),I.style.transition="",I.style.transitionDelay="")})}}else g&&M.boundingClientRect.top>0&&h(M.target,d.indexOf(M.target))})},{threshold:.1,rootMargin:"100000px 0px 0px 0px"});d.forEach(x=>p.observe(x))}))}),he(document.querySelector(".page-body")||document),s.find(".card[data-collapsible]").each(function(){const o=this.querySelector(".card-header");o&&o.addEventListener("click",()=>this.classList.toggle("is-collapsed"))}),s.find(".dm-so-trigger").each(function(){this.addEventListener("click",()=>{const o=this.dataset.soTarget,e=document.getElementById(o);if(!e)return;const t=E.slideover({title:e.dataset.soTitle||"",size:e.dataset.soSize||"md",position:e.dataset.soPosition||"right"});e.style.display="",t.setContent(e),t.open()})})}if(typeof $.setup=="function"){const a=Object.assign({},window.__CMS_DCONFIG__||{});if(document.querySelectorAll(".dm-page-config[data-config]").forEach(o=>{try{const e=V(o.dataset.config);Object.assign(a,e)}catch{}}),Object.keys(a).length>0){const o={};for(const[e,t]of Object.entries(a)){const r=t?.events?.click,{confirm:m,toast:n,alert:y,prompt:g,...d}=r||{};if(m||n||y||g){$(e).on("click",async function(W){if(W.preventDefault(),m&&!await E.confirm(m))return;let B=null;if(!(g&&(B=await E.prompt(g,{inputPlaceholder:d.promptPlaceholder||"",inputValue:d.promptDefault||""}),B===null))){{const O=$(d.target||this);d.toggleClass&&O.toggleClass(d.toggleClass),d.addClass&&O.addClass(d.addClass),d.removeClass&&O.removeClass(d.removeClass),B!==null&&(d.setText&&O.text(B),d.setVal&&O.val(B),d.setAttr&&O.attr(d.setAttr,B))}d.href&&se(d.href),n&&E.toast(n,{type:d.toastType||"success"}),y&&E.alert(y)}});const{target:w,toggleClass:u,addClass:f,removeClass:h,setText:p,setVal:x,setAttr:M,href:I,toastType:c,promptPlaceholder:v,promptDefault:k,...q}=d,N={...t.events};Object.keys(q).length?N.click=w?{target:w,...q}:q:delete N.click;const j={...t,events:N};Object.keys(N).length||delete j.events,Object.keys(j).length&&(o[e]=j)}else o[e]=t}$.setup(o)}}s.length&&R(s.get(0))}),window.wireCTAButtons=R;function se(l){if(!_e(l)){console.warn("[site] refused to go to",String(l).slice(0,60));return}const i=document.body?.classList.contains("dm-launcher-embed")&&window.top!==window;(i?window.top:window).location.href=l}function _e(l){const i=String(l??"").replace(/[\u0000-\u0020\u007f-\u00a0\u200b-\u200f\ufeff]/g,"").toLowerCase();return!i||i.includes("\\")||i.startsWith("//")?!1:/^(\/|#|\?|\.\.?\/)/.test(i)||/^(https?:\/\/|mailto:|tel:)/.test(i)?!0:!/^[a-z][a-z0-9+.-]*:/.test(i)}function R(l){l.querySelectorAll(".dm-cta-trigger").forEach(i=>{i.__ctaWired||(i.__ctaWired=!0,i.addEventListener("click",async()=>{const D=i.dataset.action,L=i.dataset.entry,z=i.dataset.confirm;let C=S.get("auth_token");if(!C){E.toast("Please log in to perform this action.",{type:"warning"});return}if(z&&!await E.confirm(z))return;const A=Array.from(i.childNodes).map(a=>a.cloneNode(!0));i.disabled=!0,i.textContent="Running\u2026";const s=a=>fetch(`/api/actions/${D}/public`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${a}`},body:JSON.stringify(i.dataset.scope?{entryId:L,scope:i.dataset.scope}:{entryId:L})});try{let a=await s(C);if(a.status===401){const e=S.get("auth_refresh_token");if(e){const t=await fetch("/api/auth/refresh",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:e})});if(t.ok){const{token:r}=await t.json();S.set("auth_token",r),C=r,a=await s(C)}}}const o=await a.json().catch(()=>({}));if(!a.ok||o.success===!1)throw new Error(o.error||o.message||`Error ${a.status}`);E.toast(o.message||"Action completed.",{type:"success"})}catch(a){E.toast(a.message||"Action failed.",{type:"error"})}finally{i.disabled=!1,i.textContent="",A.forEach(a=>i.appendChild(a)),Domma.icons.scan(i)}}))})}(function(){const i=document.querySelectorAll('.dm-collection-hydrate[data-collection-scope="mine"]');if(!i.length)return;const D=S.get("auth_token");function L(C,A){const s=document.createElement("div");s.className="dm-collection-display dm-collection-empty";const a=document.createElement("p");if(A){a.appendChild(document.createTextNode("Please "));const o=document.createElement("a");o.href="/login",o.textContent="sign in",a.appendChild(o),a.appendChild(document.createTextNode(" to view your entries."))}else a.textContent=C;return s.appendChild(a),s}function z(C,A){const s=document.createElement("template");s.innerHTML=A||"",C.replaceWith(s.content)}i.forEach(async C=>{const A=C.dataset.collectionAttrs;if(!A)return;if(!D){C.replaceChildren(L("",!0));return}const s=a=>fetch("/api/collections/render-scope",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${a}`},body:JSON.stringify({attrs:A})});try{let a=D,o=await s(a);if(o.status===401){const t=S.get("auth_refresh_token");if(t){const r=await fetch("/api/auth/refresh",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:t})});if(r.ok){const{token:m}=await r.json();S.set("auth_token",m),a=m,o=await s(a)}}}if(!o.ok){const{error:t}=await o.json().catch(()=>({}));C.replaceChildren(L(t||"Unable to load entries.",!1));return}const{html:e}=await o.json();z(C,e),window.DommaCollectionBrowser?.hydrate&&window.DommaCollectionBrowser.hydrate(document)}catch{C.replaceChildren(L("Unable to load entries.",!1))}}),setTimeout(()=>{typeof Domma<"u"&&Domma.icons?.scan&&Domma.icons.scan(),typeof Domma<"u"&&Domma.syntax?.scan&&Domma.syntax.scan(),R(document.body)},100)})(),(function(){const i=document.querySelectorAll("[data-collection-table]");!i.length||typeof T>"u"||!T.create||i.forEach(D=>{let L;try{L=V(D.dataset.payload)}catch{return}const{columns:z,rows:C,search:A,sortable:s,exportable:a,pageSize:o,empty:e,ctaConfig:t,slug:r,exportCfg:m}=L;if(!z?.length)return;if(t){const g=z.findIndex(d=>d.key==="_cta");g!==-1&&(z[g]={key:"_cta",title:"",render:(d,b)=>{const w=document.createElement("button");if(w.className=`btn btn-${t.style||"primary"} dm-cta-trigger`,w.dataset.action=t.action||"",t.scope&&(w.dataset.scope=t.scope),w.dataset.entry=b._entryId||"",t.confirm&&(w.dataset.confirm=t.confirm),t.icon){const u=document.createElement("span");u.dataset.icon=t.icon,w.appendChild(u),w.appendChild(document.createTextNode(" "))}return w.appendChild(document.createTextNode(t.label||"Run")),w}})}const n="col-table-"+Math.random().toString(36).slice(2,7),y=document.createElement("div");y.id=n,D.replaceChildren(y),T.create("#"+n,{data:C,columns:z,search:A,sortable:s,exportable:a,pageSize:o,emptyMessage:e}),t&&R(y),D._dmTable={columns:z,rows:C,slug:r,exportCfg:m,render(g){T.create("#"+n,{data:g,columns:z,search:A,sortable:s,exportable:a,pageSize:o,emptyMessage:e}),t&&R(y)}}})})(),(function(){const i=document.querySelectorAll("[data-form-inline]");if(!i.length||typeof F>"u")return;function D(s){const a=s&&s.logic;return!!(a&&(a.visibility||a.requirement))}function L(s,a){const o={};return(s||[]).forEach(e=>{if(e.type==="page-break"||e.type==="spacer"||!e.name)return;const t=e.type==="chooser"||!!(e.variant&&["select","radio","checkbox-group"].includes(e.type)),r=e.type==="checkbox"?"boolean":e.type==="date"||e.type==="icon"||e.type==="image"?"string":t?"chooser":e.type,m={...e.formConfig||{}};m.span==="full"&&a&&(m.span=a);const n={type:r,required:D(e)?!1:e.required,label:e.label,options:e.options,formConfig:{...e.placeholder&&{placeholder:e.placeholder},...e.helper&&{hint:e.helper},...e.tooltip&&{tooltip:e.tooltip},...m}};e.minLength!==void 0&&(n.minLength=e.minLength),e.maxLength!==void 0&&(n.maxLength=e.maxLength),e.min!==void 0&&(n.min=e.min),e.max!==void 0&&(n.max=e.max),t&&(e.variant&&(n.variant=e.variant),(e.multiple||e.type==="checkbox-group")&&(n.multiple=!0),e.density&&(n.density=e.density),e.columns&&(n.columns=e.columns),e.accent&&(n.accent=e.accent),e.accentStyle&&(n.accentStyle=e.accentStyle),e.glow&&(n.glow=!0),e.glowColour&&(n.glowColour=e.glowColour),e.shadow&&(n.shadow=e.shadow),e.shadowColour&&(n.shadowColour=e.shadowColour)),o[e.name]=e.type==="file"?xe(e,n):n}),o}function z(s){const a={};return(s||[]).forEach(o=>{if(!(!o.name||o.type==="page-break"||o.type==="spacer")&&(o.type==="select"||o.type==="multiselect")&&o.required){const e=(o.options||[])[0];e&&(a[o.name]=typeof e=="object"?e.value:e)}}),a}function C(s,a){(a||[]).forEach(o=>{if(o.type!=="date"||!o.name)return;const e=s.querySelector(`[name="${o.name}"]`);e&&e.type!=="date"&&(e.type="date")})}function A(s,a,o){let e=s.querySelector(".cms-form-message");e||(e=document.createElement("p"),e.className="cms-form-message",s.appendChild(e)),e.textContent=a,e.style.cssText=o?"color:var(--dm-danger);margin-top:.75rem;":"color:var(--dm-success);margin-top:.75rem;"}i.forEach(s=>{let a;try{a=V(s.dataset.formInline)}catch{return}s.querySelector(":scope > .cms-form-embed-summary")?.remove();const o=a.fields||[],e=a.settings||{},t=Number(e.columns)===3?3:2,r=e.layout||"grid",m=o.some(u=>u.type==="page-break"),n=new Map;Le(s,a.fileLimits,n),Te(s,o);const y=async u=>{if(s.dataset.triggerBlocked==="true"){const f=s._formLogicRuntime,h=f&&f.submitBlock?f.submitBlock().reasons:[];A(s,h.join(" ")||"This form cannot be submitted yet.",!0);const p=new Error("Blocked by a form trigger");throw p.formSubmitFailed=!0,p}try{const f=s.querySelector(".fb-form-honeypot"),h=f?.querySelector('input[type="text"]')||null,p=f?.querySelector('[name="_t"]')||null,x=Object.assign({},u);delete x._t,f?.dataset.hpName&&delete x[f.dataset.hpName],h!==null&&(x._hp=h.value),p!==null&&(x._t=p.value);const M=new Map(n);ne(s,M);const I=$e(x,o,M),c=Ae(s,I.files);if(c){A(s,c,!0);const k=new Error(c);throw k.formSubmitFailed=!0,k}const v=await H.post(`/api/forms/submit/${a.slug}`,I.files.size?Ee(I.values,I.files).body:I.values);if(v&&v.error){A(s,v.error,!0);const k=new Error(v.error);throw k.formSubmitFailed=!0,k}if(v?.redirect){se(v.redirect);return}for(Se(s);s.firstChild;)s.removeChild(s.firstChild);A(s,v?.message||e.successMessage||"Thank you for your submission.",!1)}catch(f){throw f.formSubmitFailed||A(s,f.message||"Submission failed. Please try again.",!0),f}},g=Date.now();function d(u){const f=u.querySelector("form");if(!f||f.querySelector(".fb-form-honeypot"))return;const h=document.createElement("div");h.className="fb-form-honeypot",h.setAttribute("aria-hidden","true");const p=document.createElement("input");p.name=f.querySelector('[name="website"]')?"_website":"website",h.dataset.hpName=p.name,p.type="text",p.tabIndex=-1,p.autocomplete="url",p.placeholder="https://",h.appendChild(p);const x=document.createElement("input");x.name="_t",x.type="hidden",x.value=g,h.appendChild(x),f.appendChild(h)}function b(u){if(!window.FormLogicEngine||!o.some(h=>h.logic||Array.isArray(h.triggers)&&h.triggers.length))return null;const f=new window.FormLogicEngine.FormLogicRuntime(a,s,u?{baseValues:u}:void 0);if(f.init(),s._formLogicRuntime=f,s._formLogicObserved)return f;if(s._formLogicObserved=!0,s.parentNode&&typeof MutationObserver<"u"){const h=new MutationObserver(function(p){for(const x of p)for(const M of x.removedNodes)if(M===s||M.nodeType===1&&M.contains&&M.contains(s)){s._formLogicRuntime&&s._formLogicRuntime.destroy(),h.disconnect();return}});h.observe(s.parentNode,{childList:!0,subtree:!1}),s._formLogicObserver=h}return f}let w=!1;if(s.addEventListener("dm-form-end",u=>{const f=u.detail?.validation;if(f&&!f.valid){Z(s,f.missing),ee(f);return}w||(w=!0,y(u.detail?.values||{}).catch(()=>{}).finally(()=>{w=!1}))}),m&&F.wizard){const u=ve(o,a.title),f=u.map(v=>({title:v.title,description:v.description,fields:L(v.fields,t)})),h=u.map(v=>v.fields);let p=0,x=null,M=null;const I=v=>{const k=window.FormLogicEngine;if(!k||!k.validateFields)return;const q=k.validateFields(s,h[p]||[]);q.valid||(v.preventDefault(),v.stopImmediatePropagation(),Z(s,q.missing),ee(q))},c=()=>{const v=h[p]||o;Ce(s,e),te(s,e,v),oe(s,e),C(s,v),Q(s,v),ke(s,n),e.honeypot!==!1&&d(s),x&&x.destroy(),x=b(M?.getStepData?M.getStepData():void 0),s.querySelectorAll(".wizard-next, .wizard-submit").forEach(k=>k.addEventListener("click",I,!0))};M=F.wizard(s,{schema:{steps:f},layout:r,columns:t,finishText:e.submitText||"Finish",onSubmit:y,onStepChange:v=>{ne(s,n),p=v,setTimeout(c,0)}}),s.addEventListener("dm-form-trigger",v=>{if(v.detail?.type!=="goto-step"||!M?.goToStep)return;const k=Number(v.detail.action.step);!Number.isFinite(k)||k<0||k>=f.length||k!==p&&M.goToStep(k)}),Promise.resolve(M).then(c)}else if(F.render){const u=F.render(s,L(o,t),z(o),{submitText:e.submitText||"Submit",layout:r,columns:t,onSubmit:y});Promise.resolve(u).then(function(){we(s,e,r),te(s,e,o),oe(s,e),C(s,o),Q(s,o),e.honeypot!==!1&&d(s),b()})}})})();function qe(l,i){const D=document.body,L=D.classList,z=new Set((D.dataset.railSite||"").split(" ").filter(Boolean)),C=()=>window.matchMedia("(min-width: 993px)").matches;l.querySelectorAll(".navbar-link, .navbar-dropdown-toggle").forEach(t=>{const r=t.textContent.trim();r&&(t.setAttribute("title",r),t.querySelector("svg, [data-icon]")||(t.dataset.initial=r.charAt(0).toUpperCase()))});const A=document.createElement("button");A.type="button",A.className="dm-nav-collapse-toggle";const s=()=>{const t=L.contains("dm-vnav-collapsed");A.setAttribute("aria-pressed",String(t)),A.setAttribute("aria-label",t?"Expand menu":"Collapse menu"),A.title=A.getAttribute("aria-label");const r=i?"chevrons-left":"chevrons-right",m=i?"chevrons-right":"chevrons-left";A.innerHTML=`<span data-icon="${t?r:m}"></span>`,window.Domma&&Domma.icons&&Domma.icons.scan(A)},a=t=>{L.toggle("dm-vnav-collapsed",t),S.set("nav_collapsed",t),s()};A.addEventListener("click",()=>a(!L.contains("dm-vnav-collapsed"))),s();const o=l.querySelector(".navbar-container")||l;o.insertBefore(A,o.firstChild?.nextSibling||null);const e=t=>{L.toggle("dm-vnav-autohide",t),L.toggle("dm-vnav-collapsible",!t&&z.has("collapsible")),t?L.remove("dm-vnav-collapsed"):z.has("collapsible")&&S.get("nav_collapsed")===!0&&L.add("dm-vnav-collapsed"),l.classList.remove("dm-nav-revealed"),s()};l.addEventListener("pointerdown",t=>{L.contains("dm-vnav-autohide")&&t.pointerType!=="mouse"&&!l.classList.contains("dm-nav-revealed")&&(l.classList.add("dm-nav-revealed"),t.preventDefault())}),document.addEventListener("pointerdown",t=>{l.contains(t.target)||l.classList.remove("dm-nav-revealed")}),window.E&&typeof E.contextMenu=="function"&&E.contextMenu(l,{items:()=>{const t=L.contains("dm-vnav-autohide"),r=L.contains("dm-vnav-collapsed"),m=S.has("nav_autohide")||S.has("nav_collapsed");return[{header:"Menu"},{label:r?"Expand menu":"Collapse to icons",icon:r?"maximize":"minimize",disabled:!C()||t||!z.has("collapsible"),action:()=>a(!r)},{label:t?"Keep on screen":"Hide when not in use",icon:t?"eye":"eye-off",disabled:!C(),action:()=>{S.set("nav_autohide",!t),e(!t)}},{type:"divider"},{label:"Reset to the site's setting",icon:"refresh",disabled:!m,action:()=>{S.remove("nav_autohide"),S.remove("nav_collapsed"),e(z.has("autohide")),L.toggle("dm-vnav-collapsed",!z.has("autohide")&&z.has("start-collapsed")),s()}}]}})}function Me(l){l.classList.add("dm-nav-scroll-hide");let i=window.scrollY,D=!1;window.addEventListener("scroll",()=>{D||(D=!0,requestAnimationFrame(()=>{D=!1;const L=window.scrollY,z=l.matches(":focus-within")||l.querySelector(".navbar-dropdown.open, .navbar-collapse.show");L>i&&L>l.offsetHeight&&!z?l.classList.add("dm-nav-scrolled-away"):L<i&&l.classList.remove("dm-nav-scrolled-away"),i=L}))},{passive:!0})}function De(l){let i={};try{i=JSON.parse(l.dataset.contents||"{}")}catch{}const D=l.closest(".site-main"),L=document.querySelector(".site-content"),z=new Set(String(i.exclude||"").split(",").map(n=>n.trim().toLowerCase()).filter(Boolean)),C=n=>!n.closest(".hero, .card, .accordion, .tabs, figure, #site-sidebar"),A=n=>(L?[...L.querySelectorAll(n)]:[]).filter(C).filter(y=>!z.has(y.textContent.trim().toLowerCase())),s=i.headings==="h2"?A("h2"):i.headings==="h3"?A("h3"):i.headings==="h2h3"?A("h2, h3"):A("h2").length?A("h2"):A("h3");if(!s.length){D?.classList.add("no-sidebar-items");return}const a=new Set([...document.querySelectorAll("[id]")].map(n=>n.id)),o=document.createElement("nav");o.className="dm-contents",o.setAttribute("aria-label",i.title||"Page contents"),i.hover&&(o.dataset.menuHover=i.hover),i.selected&&(o.dataset.menuActive=i.selected),i.accent&&o.style.setProperty("--dm-menu-highlight",i.accent.startsWith("#")?i.accent:`var(--dm-${i.accent})`),i.font&&(o.style.fontFamily=i.font),i.fontSize&&(o.style.fontSize=i.fontSize),i.fontWeight&&(o.style.fontWeight=i.fontWeight);const e=document.createElement("div");e.className="dm-contents-head";const t=document.createElement("p");t.className="dm-contents-title",t.textContent=i.title||"",e.appendChild(t),o.appendChild(e);const r=document.createElement("ol");r.className="dm-contents-list"+(i.numbered?" is-numbered":"");const m=[];for(const n of s){if(!n.id){const d=(n.textContent||"").toLowerCase().trim().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"section";let b=d;for(let w=2;a.has(b);w++)b=`${d}-${w}`;a.add(b),n.id=b}const y=document.createElement("li");y.className=`dm-contents-item dm-contents-${n.tagName.toLowerCase()}`;const g=document.createElement("a");g.href=`#${n.id}`,g.textContent=n.textContent.trim(),y.appendChild(g),r.appendChild(y),m.push([n,g])}if(o.appendChild(r),l.replaceChildren(o),i.scrollSpy!==!1&&"IntersectionObserver"in window){const n=new Map,y=()=>{const d=m.find(([b])=>n.get(b))||null;m.forEach(([,b])=>{const w=d&&b===d[1];b.classList.toggle("is-active",!!w),w?b.setAttribute("aria-current","location"):b.removeAttribute("aria-current")})},g=new IntersectionObserver(d=>{d.forEach(b=>n.set(b.target,b.isIntersecting)),y()},{rootMargin:"-80px 0px -60% 0px"});m.forEach(([d])=>g.observe(d))}if(D?.classList.contains("contents-collapsible")){const n=document.createElement("button");n.type="button",n.className="dm-contents-toggle";const y=()=>{const g=D.classList.contains("contents-collapsed");n.setAttribute("aria-expanded",String(!g)),n.setAttribute("aria-label",g?"Show the contents":"Hide the contents"),n.title=n.getAttribute("aria-label"),n.innerHTML=`<span data-icon="${g?"list":"x"}"></span>`,window.Domma?.icons&&Domma.icons.scan(n)};n.addEventListener("click",()=>{S.set("contents_collapsed",D.classList.toggle("contents-collapsed")),y()}),y(),e.insertBefore(n,e.firstChild)}if(D?.classList.contains("contents-floating")&&i.movable){o.classList.add("is-movable");const n=S.get("contents_position");n&&Number.isFinite(n.x)&&Object.assign(l.style,{left:`${n.x}px`,top:`${n.y}px`,right:"auto",bottom:"auto"}),e.addEventListener("pointerdown",y=>{if(y.target.closest("button"))return;const g=l.getBoundingClientRect(),d=y.clientX-g.left,b=y.clientY-g.top,w=f=>{const h=Math.max(0,Math.min(window.innerWidth-g.width,f.clientX-d)),p=Math.max(0,Math.min(window.innerHeight-40,f.clientY-b));Object.assign(l.style,{left:`${h}px`,top:`${p}px`,right:"auto",bottom:"auto"})},u=()=>{document.removeEventListener("pointermove",w),S.set("contents_position",{x:parseInt(l.style.left,10),y:parseInt(l.style.top,10)})};document.addEventListener("pointermove",w),document.addEventListener("pointerup",u,{once:!0})})}window.E&&typeof E.contextMenu=="function"&&E.contextMenu(l,{items:()=>{const n=D?.classList.contains("contents-collapsible"),y=D?.classList.contains("contents-collapsed"),g=m.find(([,d])=>d.classList.contains("is-active"));return[{header:"Contents"},...n?[{label:y?"Show the contents":"Collapse to a button",icon:y?"list":"minimize",action:()=>l.querySelector(".dm-contents-toggle")?.click()}]:[],{label:"Copy a link to this section",icon:"link",disabled:!g,action:async()=>{const d=`${location.origin}${location.pathname}#${g[0].id}`;try{await _.copyToClipboard(d),E.toast("Link copied.",{type:"success"})}catch{E.toast("Could not copy the link.",{type:"error"})}}},{label:"Back to the top",icon:"arrow-up",action:()=>window.scrollTo({top:0,behavior:"smooth"})}]}}),D?.classList.contains("contents-autohide")&&(l.addEventListener("pointerdown",n=>{n.pointerType!=="mouse"&&!l.classList.contains("is-revealed")&&(l.classList.add("is-revealed"),n.preventDefault())}),document.addEventListener("pointerdown",n=>{l.contains(n.target)||l.classList.remove("is-revealed")}))}
|
|
1
|
+
import{applyMobileMenu as ae,initCarouselPopup as ie}from"/public/js/mobile-ui.mjs?v=20261016-mobile-options";import{installSmoothCarets as re}from"/public/js/smooth-caret.js";import{decodeBase64Json as V}from"/public/js/utf8-base64.mjs";import{makeBadgeEl as U,applyColour as G,applyPill as ce,applyFloat as le,applyHighlight as Y,applyItemHighlight as de,itemHighlightAttrs as me,currentItems as K,menuAlign as ue,applyClasses as P,cssClasses as X,applyEntrance as J}from"/public/js/menu-decor.mjs?v=20261109-current-query";import{applyMenuLook as pe,applyFooterLook as fe}from"/public/js/menu-cards.mjs?v=20261109-current-query";import{initPageMotion as he}from"/public/js/page-motion.mjs?v=20261029-page-motion";import{applyFooterShowcase as ge}from"/public/js/footer-showcase.mjs?v=20261029-footer-showcase";import{initFloatingMenus as ye}from"/public/js/menu-float.js?v=20260829-float-panel";import{enhancePickerFields as Q,markInvalidFields as Z,showValidationPopup as ee}from"/public/js/forms.js?v=20261109-form-embed";import{buildWizardSteps as ve}from"/public/js/form-steps.mjs";import{mountMotionControl as be}from"/public/js/motion-control.mjs?v=20261031-launchers";import{applyFormClasses as te,applyFormEntrance as oe,applySubmitButtons as we,applyWizardButtons as Ce}from"/public/js/form-submit.mjs";import{captureFileFields as ne,destroyDropzones as Se,fileBlueprint as xe,restoreFileFields as ke,setFileLimits as Le,splitFiles as $e,submitBody as Ee,totalTooLarge as Ae,wireFileFields as Te}from"/public/js/form-files.mjs";document.addEventListener("click",d=>{const r=d.target?.closest?.(".dm-banner__dismiss");r&&(d.preventDefault(),r.closest(".dm-banner")?.remove())}),$(()=>{re(document);const d=window.__CMS_NAV__||{},r=window.__CMS_SITE__||{},M=r.brandingEnabled!==!1&&d.brand?.enabled!==!1;if(r.autoTheme?.enabled){let o=function(c){const p=(c||"07:00").split(":");return+p[0]*60+(+p[1]||0)},e=function(){const c=new Date,p=c.getHours()*60+c.getMinutes();return p>=o(a.dayStart)&&p<o(a.nightStart)?a.dayTheme:a.nightTheme},t=function(c){const p=a.apply&&a.apply[c]||{theme:c,custom:""};Domma.theme.set(p.theme);for(const n of[...document.body.classList])n.startsWith("dm-custom-")&&document.body.classList.remove(n);p.custom&&document.body.classList.add(p.custom)};const a=r.autoTheme;t(e()),setInterval(()=>t(e()),6e4)}const x=$("#site-navbar");if(x.length&&d.brand){let e=function(l,v=0){return Array.isArray(l)?l.filter(m=>!(m&&(m.type==="spacer"||m.type==="theme-switcher"))).filter(m=>!(m&&m.type==="separator"&&v===0)).map(m=>m&&m.type==="separator"?{divider:!0}:Array.isArray(m?.items)?{...m,items:e(m.items,v+1)}:m):l};const a={...d.brand},o=a.size&&a.size!=="md"?` navbar-brand-${a.size}`:"";if(a.logo||a.icon||a.tagline){let l="";a.logo?l+=`<img src="${a.logo}" class="navbar-brand-logo" alt="${a.text||""}">`:a.icon&&(l+=`<span data-icon="${a.icon}" style="width:1.1em;height:1.1em;margin-right:.35em;vertical-align:middle;"></span>`),a.text&&(l+=`<span class="navbar-brand-text${o}">${a.text}</span>`),a.tagline&&(l+=`<small class="navbar-brand-tagline">${a.tagline}</small>`),a.html=l}else o&&a.text&&(a.html=`<span class="navbar-brand-text${o}">${a.text}</span>`);const t=e(d.items||[]),c=d.position==="floating",p=d.orientation==="vertical";x.get(0).querySelector(":scope > .cms-nojs-links")?.remove(),Domma.elements.navbar("#site-navbar",{brand:M?a:null,items:t,variant:d.variant||"dark",position:c?"static":d.position||"sticky",collapsible:!0,appearOnHover:!!d.appearOnHover}),Domma.icons.scan("#site-navbar");const n=x.get(0);ae(n,d.mobile);const h=()=>{if(!p)return;const v=n.querySelector('a[aria-current="page"]')?.closest(".navbar-dropdown");v&&!v.classList.contains("open")&&v.querySelector(":scope > .navbar-dropdown-toggle")?.click()};n.classList.add(`dm-nav-align-${ue(d)||"centre"}`),p&&x.get(0).classList.add("dm-nav-vertical",d.side==="right"?"dm-nav-vertical-right":"dm-nav-vertical-left");const f=d.dock||{};p&&!c&&qe(n,d.side==="right"),!p&&f.hideOnScroll&&Me(n),Y(n,d),J(n,d),P(n,d.class),c&&(le(x.get(0),d),ye(x.get(0).parentNode||document));const u=n.querySelector(".navbar-toggle"),y=n.querySelector(".navbar-collapse");if(u&&y){let l=null;const v=()=>{y.classList.contains("show")&&u.click()},m=()=>{l&&(l.remove(),l=null),document.body.classList.remove("dm-drawer-open")},g=()=>{l||(l=document.createElement("div"),l.className="dm-navbar-backdrop",l.addEventListener("click",v),document.body.appendChild(l),document.body.classList.add("dm-drawer-open"))};u.addEventListener("click",()=>{requestAnimationFrame(()=>{y.classList.contains("show")?(h(),g()):m()})}),y.addEventListener("click",C=>{C.target.closest("a")&&requestAnimationFrame(m)}),document.addEventListener("keydown",C=>{C.key==="Escape"&&y.classList.contains("show")&&v()})}const b=n.querySelector(".navbar-nav");if(b){const l=Array.from(b.children);let v=0;for(const m of d.items||[])if(!(m&&m.type==="separator")){if(m&&m.type==="spacer"){const g=document.createElement("li"),C=["xs","sm","md","lg","xl","flex"].includes(m.size)?m.size:"md";g.className=`dm-menu-spacer dm-menu-spacer--${C}`,g.setAttribute("aria-hidden","true"),b.insertBefore(g,l[v]||null);continue}if(m&&m.type==="theme-switcher"){const g=document.createElement("li");g.className="dm-menu-theme-switcher";const C=document.createElement("span");C.dataset.themeSwitcher="menu",C.dataset.position="inline",g.appendChild(C),b.insertBefore(g,l[v]||null);continue}v++}window.CMSThemeSwitcher?.scan(b)}const A=K(t,location.pathname+location.search);n.querySelectorAll("[data-path]").forEach(l=>{const v=l.dataset.path.split(".").map(Number),m=v.length>1,g=v.reduce((I,B)=>I?.items?.[B],{items:t});if(!g)return;g.colour&&G(l,g.colour),g.pill&&!m&&ce(l,g.pill),de(l,g),P(l.closest("li"),g.class);const C=U(g.badge);C&&l.appendChild(C),A.has(g)&&(l.classList.add("active"),l.setAttribute("aria-current","page"))}),pe(n,d,t),h()}let z=null;const w=$("#site-footer");if(w.length){let c=function(i){return String(i??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")},p=function(i){return c(i).replace(/'/g,"'")},n=function(i){if(i&&i.type==="separator")return'<li class="footer-sep"><hr></li>';if(i&&i.type==="spacer")return`<li class="dm-menu-spacer dm-menu-spacer--${["xs","sm","md","lg","xl","flex"].includes(i.size)?i.size:"md"}" aria-hidden="true"></li>`;if(i&&i.type==="theme-switcher")return'<li class="dm-menu-theme-switcher"><span data-theme-switcher="menu" data-position="inline"></span></li>';const L=p(i.url||"#"),q=c(i.text||""),D=Array.isArray(i.items)&&i.items.length?`<ul>${i.items.map(n).join("")}</ul>`:"",N=me(i),W=[N.hover&&` data-menu-item-hover="${p(N.hover)}"`,N.active&&` data-menu-item-active="${p(N.active)}"`].filter(Boolean).join(""),j=N.accent?` style="--dm-menu-highlight:${p(N.accent)}"`:"",O=X(i.class).join(" ");return`<li${O?` class="${p(O)}"`:""}><a href="${L}"${W}${j}>${q}</a>${D}</li>`},f=function(){if(!r.footer)return"";const i=Object.keys(o).filter(q=>a[q]);if(!i.length)return"";const L=X(r.footer.socialClass).join(" ");return`<div class="footer-social">${i.map(q=>{const{label:D,svg:N}=o[q];return`<a href="${a[q]}" target="_blank" rel="noopener noreferrer" aria-label="${D}" class="footer-social-link${L?` ${p(L)}`:""}">${N}</a>`}).join("")}</div>`},A=function(i){if(!i||i.type==="separator"||i.type==="spacer")return"";if(i.type==="theme-switcher")return`<li class="cms-footer-col">${n(i).replace(/^<li[^>]*>|<\/li>$/g,"")}</li>`;const L=Array.isArray(i.items)&&i.items.length?`<ul>${i.items.map(n).join("")}</ul>`:"",q=b(i)?`<span class="cms-footer-col-title">${c(i.text||"")}</span>`:`<a class="cms-footer-col-title" href="${p(i.url||"#")}">${c(i.text||"")}</a>`,D=["cms-footer-col",...X(i.class)].join(" ");return`<li class="${p(D)}">${q}${L}</li>`},m=function(i,L,q=!1){return(i||[]).forEach(D=>{D&&(D.type==="separator"||D.type==="spacer"||D.type==="theme-switcher")||(q&&b(D)||L.push(D),Array.isArray(D.items)&&D.items.length&&m(D.items,L))}),L};const a=r.social||{},o={twitter:{label:"X / Twitter",svg:'<svg viewBox="0 0 24 24" fill="currentColor"><path d="M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-4.714-6.231-5.401 6.231H2.742l7.73-8.835L1.254 2.25H8.08l4.259 5.629L18.244 2.25zm-1.161 17.52h1.833L7.084 4.126H5.117z"/></svg>'},facebook:{label:"Facebook",svg:'<svg viewBox="0 0 24 24" fill="currentColor"><path d="M24 12.073c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.99 4.388 10.954 10.125 11.854v-8.385H7.078v-3.47h3.047V9.43c0-3.007 1.792-4.669 4.533-4.669 1.312 0 2.686.235 2.686.235v2.953H15.83c-1.491 0-1.956.925-1.956 1.874v2.25h3.328l-.532 3.47h-2.796v8.385C19.612 23.027 24 18.062 24 12.073z"/></svg>'},instagram:{label:"Instagram",svg:'<svg viewBox="0 0 24 24" fill="currentColor"><path d="M12 2.163c3.204 0 3.584.012 4.85.07 3.252.148 4.771 1.691 4.919 4.919.058 1.265.069 1.645.069 4.849 0 3.205-.012 3.584-.069 4.849-.149 3.225-1.664 4.771-4.919 4.919-1.266.058-1.644.07-4.85.07-3.204 0-3.584-.012-4.849-.07-3.26-.149-4.771-1.699-4.919-4.92-.058-1.265-.07-1.644-.07-4.849 0-3.204.013-3.583.07-4.849.149-3.227 1.664-4.771 4.919-4.919 1.266-.057 1.645-.069 4.849-.069zM12 0C8.741 0 8.333.014 7.053.072 2.695.272.273 2.69.073 7.052.014 8.333 0 8.741 0 12c0 3.259.014 3.668.072 4.948.2 4.358 2.618 6.78 6.98 6.98C8.333 23.986 8.741 24 12 24c3.259 0 3.668-.014 4.948-.072 4.354-.2 6.782-2.618 6.979-6.98.059-1.28.073-1.689.073-4.948 0-3.259-.014-3.667-.072-4.947-.196-4.354-2.617-6.78-6.979-6.98C15.668.014 15.259 0 12 0zm0 5.838a6.162 6.162 0 100 12.324 6.162 6.162 0 000-12.324zM12 16a4 4 0 110-8 4 4 0 010 8zm6.406-11.845a1.44 1.44 0 100 2.881 1.44 1.44 0 000-2.881z"/></svg>'},linkedin:{label:"LinkedIn",svg:'<svg viewBox="0 0 24 24" fill="currentColor"><path d="M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433a2.062 2.062 0 01-2.063-2.065 2.064 2.064 0 112.063 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z"/></svg>'},github:{label:"GitHub",svg:'<svg viewBox="0 0 24 24" fill="currentColor"><path d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"/></svg>'},youtube:{label:"YouTube",svg:'<svg viewBox="0 0 24 24" fill="currentColor"><path d="M23.495 6.205a3.007 3.007 0 00-2.088-2.088c-1.87-.501-9.396-.501-9.396-.501s-7.507-.01-9.396.501A3.007 3.007 0 00.527 6.205a31.247 31.247 0 00-.522 5.805 31.247 31.247 0 00.522 5.783 3.007 3.007 0 002.088 2.088c1.868.502 9.396.502 9.396.502s7.506 0 9.396-.502a3.007 3.007 0 002.088-2.088 31.247 31.247 0 00.5-5.783 31.247 31.247 0 00-.5-5.805zM9.609 15.601V8.408l6.264 3.602z"/></svg>'}};let e='<div class="footer-inner container">';const t=window.__CMS_FOOTER__||{primary:[],legal:[],copyright:""},h=(()=>{const i=r.cookieConsent;if(!i||i.showSettingsLink===!1)return"";const L=q=>(q||[]).some(D=>D&&(D.url==="#cookie-settings"||L(D.items)));return L(t.primary)||L(t.legal)?"":`<li class="cms-cookie-settings"><a href="#cookie-settings">${c(i.settingsLinkText||"Cookie settings")}</a></li>`})(),u=["columns","row"].includes(r.footer?.layout)?r.footer.layout:"auto",y=r.footer?.look==="showcase"||u==="columns"||u==="auto"&&t.primary.some(i=>Array.isArray(i?.items)&&i.items.length),b=i=>y&&!i.url&&Array.isArray(i.items)&&i.items.length>0;if(y){const i=d.brand||{},L=M&&(i.text||r.title)||"",q=M?i.logo?`<img src="${p(i.logo)}" class="cms-footer-brand-logo" alt="">`:i.icon?'<span class="cms-footer-brand-icon"></span>':"":"",D=String(r.footer?.blurb||"").trim();e='<div class="footer-inner footer-inner--columns container"><div class="cms-footer-top">',e+=`<div class="cms-footer-brand">${L||q?`<a class="cms-footer-brand-name" href="${p(i.url||"/")}">${q}<span>${c(L)}</span></a>`:""}${D?`<p class="cms-footer-blurb">${c(D)}</p>`:""}${f()}</div>`,t.primary.length&&(e+=`<nav class="footer-nav footer-nav--primary footer-nav--columns" aria-label="Footer"><ul>${t.primary.map(A).join("")}</ul></nav>`),e+='</div><div class="cms-footer-bottom">',t.copyright&&(e+=`<p class="cms-footer-copyright">${c(t.copyright)}</p>`),(t.legal.length||h)&&(e+=`<nav class="footer-nav footer-nav--legal" aria-label="Legal"><ul>${t.legal.map(n).join("")}${h}</ul></nav>`),e+="</div>"}else t.copyright&&(e+=`<p>${c(t.copyright)}</p>`),t.primary.length&&(e+=`<nav class="footer-nav footer-nav--primary"><ul>${t.primary.map(n).join("")}</ul></nav>`),(t.legal.length||h)&&(e+=`<nav class="footer-nav footer-nav--legal"><ul>${t.legal.map(n).join("")}${h}</ul></nav>`),e+=f();e+="</div>",w.get(0).querySelector(":scope > .cms-nojs-links")?.remove();const l=w.get(0).querySelector(":scope > .cms-footer-blocks");l?.remove(),w.html(e),l&&w.get(0).prepend(l),window.CMSThemeSwitcher?.scan(w.get(0));const v=w.get(0).querySelector(".cms-footer-brand-icon");v&&d.brand?.icon&&v.setAttribute("data-icon",d.brand.icon),P(w.get(0),r.footer?.class),y&&ge(w.get(0),r);const g=[...m(t.primary,[],!0),...m(t.legal,[])],C=K([...t.primary||[],...t.legal||[]],location.pathname+location.search),I=w.get(0).querySelectorAll(".footer-nav a"),B=[];I.forEach((i,L)=>{const q=g[L];if(!q)return;if(B.push({a:i,item:q}),q.icon){const N=document.createElement("span");N.className="cms-footer-ic",N.setAttribute("data-icon",String(q.icon)),N.setAttribute("data-icon-size","15"),N.setAttribute("aria-hidden","true"),i.prepend(N)}q.colour&&G(i,q.colour);const D=U(q.badge);D&&i.appendChild(D),C.has(q)&&(i.classList.add("is-active"),i.setAttribute("aria-current","page"))}),Y(w.get(0).querySelector(".footer-nav--primary"),{highlight:t.primaryHighlight}),Y(w.get(0).querySelector(".footer-nav--legal"),{highlight:t.legalHighlight}),J(w.get(0).querySelector(".footer-nav--primary"),{entrance:t.primaryEntrance}),J(w.get(0).querySelector(".footer-nav--legal"),{entrance:t.legalEntrance}),P(w.get(0).querySelector(".footer-nav--primary"),t.primaryClass),P(w.get(0).querySelector(".footer-nav--legal"),t.legalClass),fe(w.get(0),t,B),z=w.get(0).querySelector(".cms-footer-bottom")||w.get(0).querySelector(".footer-inner")}be(r.motion||{enabled:r.footer?.showMotionToggle!==!1,default:r.footer?.motionDefault,placement:"footer",control:r.footer?.motionControl,label:"Reduce motion"},{footer:z,navbar:document.querySelector("#site-navbar .navbar-container")?.closest("#site-navbar")||null});const k=document.getElementById("site-sidebar");k&&De(k),Domma.icons.scan(),Domma.syntax?.scan&&Domma.syntax.scan();const s=$(".page-body");if(s.length){s.find(".accordion").each(function(){Domma.elements.accordion(this,{allowMultiple:this.dataset.multi==="true"})}),s.find(".tabs").each(function(){Domma.elements.tabs(this)}),s.find(".carousel").each(function(){const o={primary:"--dm-primary",secondary:"--dm-secondary",accent:"--dm-primary",text:"--dm-text",surface:"--dm-surface",background:"--dm-background",success:"--dm-success",warning:"--dm-warning",danger:"--dm-danger",info:"--dm-info"},e=f=>{const u=String(f||"").trim();return u?o[u.toLowerCase()]?`var(${o[u.toLowerCase()]})`:CSS.supports("color",u)?u:"":""},t=e(this.dataset.background),c=e(this.dataset.arrowBackground),p=e(this.dataset.arrowColor);t&&(this.style.setProperty("--dm-carousel-background",t),this.classList.add("dm-carousel-custom-background")),c&&this.style.setProperty("--dm-carousel-arrow-background",c),p&&this.style.setProperty("--dm-carousel-arrow-color",p);const n=["top","middle","bottom"].includes(this.dataset.arrowPosition)?this.dataset.arrowPosition:"middle";this.classList.add(`dm-carousel-arrows-${n}`);const h={autoplay:this.dataset.autoplay==="true",interval:parseInt(this.dataset.interval,10)||5e3,loop:this.dataset.loop!=="false",animation:this.dataset.animation||"slide",heightMode:this.dataset.heightMode==="average"?"average":"crop"};if(this.dataset.height){const f=Number(this.dataset.height);Number.isFinite(f)&&f>0&&(h.height=f)}if(this.dataset.animationDuration){const f=parseInt(this.dataset.animationDuration,10);Number.isFinite(f)&&(h.animationDuration=f)}this.dataset.animationEasing&&(h.animationEasing=this.dataset.animationEasing),this.dataset.ctx&&(this._dmCtxSlides=Array.from(this.querySelectorAll(".carousel-slide")).map(f=>f.cloneNode(!0)),this._dmCarouselOpts=h),this._dmCarousel=Domma.elements.carousel(this,h),ie(this)}),s.find(".dm-countdown").each(function(){const o={autoStart:!0},e=String(this.dataset.format||"").trim(),t=String(this.dataset.to||"").trim(),c=/^(\d{4})-(\d{2})-(\d{2})$/.exec(t),p=c?new Date(+c[1],+c[2]-1,+c[3]).getTime():t?new Date(t).getTime():NaN;Number.isFinite(p)?o.duration=Math.max(0,p-Date.now()):this.dataset.duration&&(o.duration=(parseInt(this.dataset.duration,10)||0)*1e3);const n=/^dd:/i.test(e);o.format=n?"hh:mm:ss":e||(o.duration>=36e5?"hh:mm:ss":"mm:ss");const h=this,f=y=>String(y).padStart(2,"0"),u=y=>{const b=Math.max(0,Math.floor(y/1e3)),A=h.querySelector(".dm-timer-time");A&&(A.textContent=`${f(Math.floor(b/86400))}:${f(Math.floor(b%86400/3600))}:${f(Math.floor(b%3600/60))}:${f(b%60)}`)};n&&(o.onTick=u),Domma.elements.timer(this,o),n&&u(o.duration||0)}),s.find("[data-tooltip]:not(.dm-range-slider)").each(function(){Domma.elements.tooltip(this,{content:$(this).data("tooltip"),position:$(this).data("tooltip-position")||"top"})}),s.find(".dm-progression").each(function(){const o=Array.from(this.querySelectorAll(".dm-progression-item")).map(c=>{const p={title:c.querySelector(".dm-progression-item-title")?.textContent?.trim()||"",description:c.querySelector(".dm-progression-item-body")?.innerHTML?.trim()||""};return c.dataset.date&&(p.date=c.dataset.date),c.dataset.status&&(p.status=c.dataset.status),c.dataset.eventIcon&&(p.icon=c.dataset.eventIcon),c.dataset.entryId&&(p._entryId=c.dataset.entryId),p}),e=this.dataset.layout==="centred"?"centered":this.dataset.layout||"vertical",t=Domma.elements.progression(this,{layout:e,theme:this.dataset.theme||"minimal",mode:this.dataset.mode||"timeline",statusIcons:!0,allowHtml:!0,...o.length?{items:o}:{}});if((this.dataset.mode||"timeline")==="timeline"){const c={completed:{label:"Completed",icon:"check-circle",tone:"success"},planned:{label:"Planned",icon:"circle",tone:"secondary"},"in-progress":{label:"In progress",icon:"clock",tone:"primary"},blocked:{label:"Blocked",icon:"alert-circle",tone:"danger"}};this.querySelectorAll(".dm-progression-item").forEach((p,n)=>{const h=o[n];if(!h)return;const f=p.querySelector(".dm-progression-title");if(h.icon&&f){const y=document.createElement("span");y.dataset.icon=h.icon,y.style.cssText="display:inline-flex;vertical-align:middle;margin-right:.4em",y.setAttribute("aria-hidden","true"),f.prepend(y)}const u=c[h.status];if(u&&f){const y=document.createElement("span");y.className=`badge badge-${u.tone} cms-timeline-status`,y.style.cssText="display:inline-flex;align-items:center;gap:.35em;margin:.4rem 0";const b=document.createElement("span");b.dataset.icon=u.icon,b.dataset.iconSize="14",b.setAttribute("aria-hidden","true"),y.append(b,document.createTextNode(u.label)),f.after(y)}})}Domma.icons.scan(this),o.length&&(this._dmCtx={instance:t,items:o})});try{Domma.effects.reveal(".page-body .hero",{animation:"slide-up",duration:480,threshold:.06,stagger:60,once:!1})}catch{}const a=matchMedia("(prefers-reduced-motion: reduce)").matches||document.documentElement.classList.contains("dm-reduced-motion");document.querySelectorAll(".page-body .row[data-reveal]").forEach(o=>{const e=o.dataset.revealMode||"stagger",t=o.dataset.revealAnimation||"slide-up",c=parseInt(o.dataset.revealDuration,10)||(t.startsWith("swoosh")?700:400),p=parseInt(o.dataset.revealStagger,10)||(t.startsWith("swoosh")?90:60),n=parseInt(o.dataset.revealDelay,10)||0,h=o.dataset.revealDirection==="rtl",f=o.dataset.revealReplay==="true",u=Array.from(o.children);if(a&&t.startsWith("swoosh"))return;const y={"slide-up":"translateY(30px)","slide-down":"translateY(-30px)","slide-left":"translateX(30px)","slide-right":"translateX(-30px)",zoom:"scale(0.85)",flip:"perspective(600px) rotateX(15deg)",swoosh:"translateY(36px) scale(0.96)"},b=m=>t!=="swoosh-sides"?y[t]||"":u.length>1&&m===0?"translateX(-64px) rotate(-1.5deg)":u.length>1&&m===u.length-1?"translateX(64px) rotate(1.5deg)":"translateY(40px) scale(0.94)",A=t.startsWith("swoosh"),l=A?"cubic-bezier(.2,.8,.2,1)":"ease",v=(m,g)=>{m.style.opacity="0",m.style.transform=b(g),A&&(m.style.filter="blur(10px)")};u.forEach((m,g)=>{m.style.transition="none",v(m,g)}),o.offsetWidth,u.forEach((m,g)=>{m.style.transition=`opacity ${c}ms ${l}, transform ${c}ms ${l}`+(A?`, filter ${c}ms ${l}`:"");const C=h?u.length-1-g:g;m.style.transitionDelay=e==="stagger"?`${n+C*p}ms`:`${n}ms`}),requestAnimationFrame(()=>requestAnimationFrame(()=>{const m=new IntersectionObserver(g=>{g.forEach(C=>{if(C.isIntersecting){if(C.target.offsetWidth,C.target.style.opacity="1",C.target.style.transform="",A&&(C.target.style.filter=""),!f){m.unobserve(C.target);const I=C.target;I.addEventListener("transitionend",function B(i){i.target!==I||i.propertyName!=="opacity"||(I.removeEventListener("transitionend",B),I.style.transition="",I.style.transitionDelay="")})}}else f&&C.boundingClientRect.top>0&&v(C.target,u.indexOf(C.target))})},{threshold:.1,rootMargin:"100000px 0px 0px 0px"});u.forEach(g=>m.observe(g))}))}),he(document.querySelector(".page-body")||document),s.find(".card[data-collapsible]").each(function(){const o=this.querySelector(".card-header");o&&o.addEventListener("click",()=>this.classList.toggle("is-collapsed"))}),s.find(".dm-so-trigger").each(function(){this.addEventListener("click",()=>{const o=this.dataset.soTarget,e=document.getElementById(o);if(!e)return;const t=E.slideover({title:e.dataset.soTitle||"",size:e.dataset.soSize||"md",position:e.dataset.soPosition||"right"});e.style.display="",t.setContent(e),t.open()})})}if(typeof $.setup=="function"){const a=Object.assign({},window.__CMS_DCONFIG__||{});if(document.querySelectorAll(".dm-page-config[data-config]").forEach(o=>{try{const e=V(o.dataset.config);Object.assign(a,e)}catch{}}),Object.keys(a).length>0){const o={};for(const[e,t]of Object.entries(a)){const c=t?.events?.click,{confirm:p,toast:n,alert:h,prompt:f,...u}=c||{};if(p||n||h||f){$(e).on("click",async function(W){if(W.preventDefault(),p&&!await E.confirm(p))return;let j=null;if(!(f&&(j=await E.prompt(f,{inputPlaceholder:u.promptPlaceholder||"",inputValue:u.promptDefault||""}),j===null))){{const O=$(u.target||this);u.toggleClass&&O.toggleClass(u.toggleClass),u.addClass&&O.addClass(u.addClass),u.removeClass&&O.removeClass(u.removeClass),j!==null&&(u.setText&&O.text(j),u.setVal&&O.val(j),u.setAttr&&O.attr(u.setAttr,j))}u.href&&se(u.href),n&&E.toast(n,{type:u.toastType||"success"}),h&&E.alert(h)}});const{target:b,toggleClass:A,addClass:l,removeClass:v,setText:m,setVal:g,setAttr:C,href:I,toastType:B,promptPlaceholder:i,promptDefault:L,...q}=u,D={...t.events};Object.keys(q).length?D.click=b?{target:b,...q}:q:delete D.click;const N={...t,events:D};Object.keys(D).length||delete N.events,Object.keys(N).length&&(o[e]=N)}else o[e]=t}$.setup(o)}}s.length&&R(s.get(0))}),window.wireCTAButtons=R;function se(d){if(!_e(d)){console.warn("[site] refused to go to",String(d).slice(0,60));return}const r=document.body?.classList.contains("dm-launcher-embed")&&window.top!==window;(r?window.top:window).location.href=d}function _e(d){const r=String(d??"").replace(/[\u0000-\u0020\u007f-\u00a0\u200b-\u200f\ufeff]/g,"").toLowerCase();return!r||r.includes("\\")||r.startsWith("//")?!1:/^(\/|#|\?|\.\.?\/)/.test(r)||/^(https?:\/\/|mailto:|tel:)/.test(r)?!0:!/^[a-z][a-z0-9+.-]*:/.test(r)}function R(d){d.querySelectorAll(".dm-cta-trigger").forEach(r=>{r.__ctaWired||(r.__ctaWired=!0,r.addEventListener("click",async()=>{const M=r.dataset.action,x=r.dataset.entry,z=r.dataset.confirm;let w=S.get("auth_token");if(!w){E.toast("Please log in to perform this action.",{type:"warning"});return}if(z&&!await E.confirm(z))return;const k=Array.from(r.childNodes).map(a=>a.cloneNode(!0));r.disabled=!0,r.textContent="Running\u2026";const s=a=>fetch(`/api/actions/${M}/public`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${a}`},body:JSON.stringify(r.dataset.scope?{entryId:x,scope:r.dataset.scope}:{entryId:x})});try{let a=await s(w);if(a.status===401){const e=S.get("auth_refresh_token");if(e){const t=await fetch("/api/auth/refresh",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:e})});if(t.ok){const{token:c}=await t.json();S.set("auth_token",c),w=c,a=await s(w)}}}const o=await a.json().catch(()=>({}));if(!a.ok||o.success===!1)throw new Error(o.error||o.message||`Error ${a.status}`);E.toast(o.message||"Action completed.",{type:"success"})}catch(a){E.toast(a.message||"Action failed.",{type:"error"})}finally{r.disabled=!1,r.textContent="",k.forEach(a=>r.appendChild(a)),Domma.icons.scan(r)}}))})}(function(){const r=document.querySelectorAll('.dm-collection-hydrate[data-collection-scope="mine"]');if(!r.length)return;const M=S.get("auth_token");function x(w,k){const s=document.createElement("div");s.className="dm-collection-display dm-collection-empty";const a=document.createElement("p");if(k){a.appendChild(document.createTextNode("Please "));const o=document.createElement("a");o.href="/login",o.textContent="sign in",a.appendChild(o),a.appendChild(document.createTextNode(" to view your entries."))}else a.textContent=w;return s.appendChild(a),s}function z(w,k){const s=document.createElement("template");s.innerHTML=k||"",w.replaceWith(s.content)}r.forEach(async w=>{const k=w.dataset.collectionAttrs;if(!k)return;if(!M){w.replaceChildren(x("",!0));return}const s=a=>fetch("/api/collections/render-scope",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${a}`},body:JSON.stringify({attrs:k})});try{let a=M,o=await s(a);if(o.status===401){const t=S.get("auth_refresh_token");if(t){const c=await fetch("/api/auth/refresh",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:t})});if(c.ok){const{token:p}=await c.json();S.set("auth_token",p),a=p,o=await s(a)}}}if(!o.ok){const{error:t}=await o.json().catch(()=>({}));w.replaceChildren(x(t||"Unable to load entries.",!1));return}const{html:e}=await o.json();z(w,e),window.DommaCollectionBrowser?.hydrate&&window.DommaCollectionBrowser.hydrate(document)}catch{w.replaceChildren(x("Unable to load entries.",!1))}}),setTimeout(()=>{typeof Domma<"u"&&Domma.icons?.scan&&Domma.icons.scan(),typeof Domma<"u"&&Domma.syntax?.scan&&Domma.syntax.scan(),R(document.body)},100)})(),(function(){const r=document.querySelectorAll("[data-collection-table]");!r.length||typeof T>"u"||!T.create||r.forEach(M=>{let x;try{x=V(M.dataset.payload)}catch{return}const{columns:z,rows:w,search:k,sortable:s,exportable:a,pageSize:o,empty:e,ctaConfig:t,slug:c,exportCfg:p}=x;if(!z?.length)return;if(t){const f=z.findIndex(u=>u.key==="_cta");f!==-1&&(z[f]={key:"_cta",title:"",render:(u,y)=>{const b=document.createElement("button");if(b.className=`btn btn-${t.style||"primary"} dm-cta-trigger`,b.dataset.action=t.action||"",t.scope&&(b.dataset.scope=t.scope),b.dataset.entry=y._entryId||"",t.confirm&&(b.dataset.confirm=t.confirm),t.icon){const A=document.createElement("span");A.dataset.icon=t.icon,b.appendChild(A),b.appendChild(document.createTextNode(" "))}return b.appendChild(document.createTextNode(t.label||"Run")),b}})}const n="col-table-"+Math.random().toString(36).slice(2,7),h=document.createElement("div");h.id=n,M.replaceChildren(h),T.create("#"+n,{data:w,columns:z,search:k,sortable:s,exportable:a,pageSize:o,emptyMessage:e}),t&&R(h),M._dmTable={columns:z,rows:w,slug:c,exportCfg:p,render(f){T.create("#"+n,{data:f,columns:z,search:k,sortable:s,exportable:a,pageSize:o,emptyMessage:e}),t&&R(h)}}})})(),(function(){const r=document.querySelectorAll("[data-form-inline]");if(!r.length||typeof F>"u")return;function M(s){const a=s&&s.logic;return!!(a&&(a.visibility||a.requirement))}function x(s,a){const o={};return(s||[]).forEach(e=>{if(e.type==="page-break"||e.type==="spacer"||!e.name)return;const t=e.type==="chooser"||!!(e.variant&&["select","radio","checkbox-group"].includes(e.type)),c=e.type==="checkbox"?"boolean":e.type==="date"||e.type==="icon"||e.type==="image"?"string":t?"chooser":e.type,p={...e.formConfig||{}};p.span==="full"&&a&&(p.span=a);const n={type:c,required:M(e)?!1:e.required,label:e.label,options:e.options,formConfig:{...e.placeholder&&{placeholder:e.placeholder},...e.helper&&{hint:e.helper},...e.tooltip&&{tooltip:e.tooltip},...p}};e.minLength!==void 0&&(n.minLength=e.minLength),e.maxLength!==void 0&&(n.maxLength=e.maxLength),e.min!==void 0&&(n.min=e.min),e.max!==void 0&&(n.max=e.max),t&&(e.variant&&(n.variant=e.variant),(e.multiple||e.type==="checkbox-group")&&(n.multiple=!0),e.density&&(n.density=e.density),e.columns&&(n.columns=e.columns),e.accent&&(n.accent=e.accent),e.accentStyle&&(n.accentStyle=e.accentStyle),e.glow&&(n.glow=!0),e.glowColour&&(n.glowColour=e.glowColour),e.shadow&&(n.shadow=e.shadow),e.shadowColour&&(n.shadowColour=e.shadowColour)),o[e.name]=e.type==="file"?xe(e,n):n}),o}function z(s){const a={};return(s||[]).forEach(o=>{if(!(!o.name||o.type==="page-break"||o.type==="spacer")&&(o.type==="select"||o.type==="multiselect")&&o.required){const e=(o.options||[])[0];e&&(a[o.name]=typeof e=="object"?e.value:e)}}),a}function w(s,a){(a||[]).forEach(o=>{if(o.type!=="date"||!o.name)return;const e=s.querySelector(`[name="${o.name}"]`);e&&e.type!=="date"&&(e.type="date")})}function k(s,a,o){let e=s.querySelector(".cms-form-message");e||(e=document.createElement("p"),e.className="cms-form-message",s.appendChild(e)),e.textContent=a,e.style.cssText=o?"color:var(--dm-danger);margin-top:.75rem;":"color:var(--dm-success);margin-top:.75rem;"}r.forEach(s=>{let a;try{a=V(s.dataset.formInline)}catch{return}s.querySelector(":scope > .cms-form-embed-summary")?.remove();const o=a.fields||[],e=a.settings||{},t=Number(e.columns)===3?3:2,c=e.layout||"grid",p=o.some(A=>A.type==="page-break"),n=new Map;Le(s,a.fileLimits,n),Te(s,o);const h=async A=>{if(s.dataset.triggerBlocked==="true"){const l=s._formLogicRuntime,v=l&&l.submitBlock?l.submitBlock().reasons:[];k(s,v.join(" ")||"This form cannot be submitted yet.",!0);const m=new Error("Blocked by a form trigger");throw m.formSubmitFailed=!0,m}try{const l=s.querySelector(".fb-form-honeypot"),v=l?.querySelector('input[type="text"]')||null,m=l?.querySelector('[name="_t"]')||null,g=Object.assign({},A);delete g._t,l?.dataset.hpName&&delete g[l.dataset.hpName],v!==null&&(g._hp=v.value),m!==null&&(g._t=m.value);const C=new Map(n);ne(s,C);const I=$e(g,o,C),B=Ae(s,I.files);if(B){k(s,B,!0);const L=new Error(B);throw L.formSubmitFailed=!0,L}const i=await H.post(`/api/forms/submit/${a.slug}`,I.files.size?Ee(I.values,I.files).body:I.values);if(i&&i.error){k(s,i.error,!0);const L=new Error(i.error);throw L.formSubmitFailed=!0,L}if(i?.redirect){se(i.redirect);return}for(Se(s);s.firstChild;)s.removeChild(s.firstChild);k(s,i?.message||e.successMessage||"Thank you for your submission.",!1)}catch(l){throw l.formSubmitFailed||k(s,l.message||"Submission failed. Please try again.",!0),l}},f=Date.now();function u(A){const l=A.querySelector("form");if(!l||l.querySelector(".fb-form-honeypot"))return;const v=document.createElement("div");v.className="fb-form-honeypot",v.setAttribute("aria-hidden","true");const m=document.createElement("input");m.name=l.querySelector('[name="website"]')?"_website":"website",v.dataset.hpName=m.name,m.type="text",m.tabIndex=-1,m.autocomplete="url",m.placeholder="https://",v.appendChild(m);const g=document.createElement("input");g.name="_t",g.type="hidden",g.value=f,v.appendChild(g),l.appendChild(v)}function y(A){if(!window.FormLogicEngine||!o.some(v=>v.logic||Array.isArray(v.triggers)&&v.triggers.length))return null;const l=new window.FormLogicEngine.FormLogicRuntime(a,s,A?{baseValues:A}:void 0);if(l.init(),s._formLogicRuntime=l,s._formLogicObserved)return l;if(s._formLogicObserved=!0,s.parentNode&&typeof MutationObserver<"u"){const v=new MutationObserver(function(m){for(const g of m)for(const C of g.removedNodes)if(C===s||C.nodeType===1&&C.contains&&C.contains(s)){s._formLogicRuntime&&s._formLogicRuntime.destroy(),v.disconnect();return}});v.observe(s.parentNode,{childList:!0,subtree:!1}),s._formLogicObserver=v}return l}let b=!1;if(s.addEventListener("dm-form-end",A=>{const l=A.detail?.validation;if(l&&!l.valid){Z(s,l.missing),ee(l);return}b||(b=!0,h(A.detail?.values||{}).catch(()=>{}).finally(()=>{b=!1}))}),p&&F.wizard){const A=ve(o,a.title),l=A.map(i=>({title:i.title,description:i.description,fields:x(i.fields,t)})),v=A.map(i=>i.fields);let m=0,g=null,C=null;const I=i=>{const L=window.FormLogicEngine;if(!L||!L.validateFields)return;const q=L.validateFields(s,v[m]||[]);q.valid||(i.preventDefault(),i.stopImmediatePropagation(),Z(s,q.missing),ee(q))},B=()=>{const i=v[m]||o;Ce(s,e),te(s,e,i),oe(s,e),w(s,i),Q(s,i),ke(s,n),e.honeypot!==!1&&u(s),g&&g.destroy(),g=y(C?.getStepData?C.getStepData():void 0),s.querySelectorAll(".wizard-next, .wizard-submit").forEach(L=>L.addEventListener("click",I,!0))};C=F.wizard(s,{schema:{steps:l},layout:c,columns:t,finishText:e.submitText||"Finish",onSubmit:h,onStepChange:i=>{ne(s,n),m=i,setTimeout(B,0)}}),s.addEventListener("dm-form-trigger",i=>{if(i.detail?.type!=="goto-step"||!C?.goToStep)return;const L=Number(i.detail.action.step);!Number.isFinite(L)||L<0||L>=l.length||L!==m&&C.goToStep(L)}),Promise.resolve(C).then(B)}else if(F.render){const A=F.render(s,x(o,t),z(o),{submitText:e.submitText||"Submit",layout:c,columns:t,onSubmit:h});Promise.resolve(A).then(function(){we(s,e,c),te(s,e,o),oe(s,e),w(s,o),Q(s,o),e.honeypot!==!1&&u(s),y()})}})})();function qe(d,r){const M=document.body,x=M.classList,z=new Set((M.dataset.railSite||"").split(" ").filter(Boolean)),w=()=>window.matchMedia("(min-width: 993px)").matches;d.querySelectorAll(".navbar-link, .navbar-dropdown-toggle").forEach(t=>{const c=t.textContent.trim();c&&(t.setAttribute("title",c),t.querySelector("svg, [data-icon]")||(t.dataset.initial=c.charAt(0).toUpperCase()))});const k=document.createElement("button");k.type="button",k.className="dm-nav-collapse-toggle";const s=()=>{const t=x.contains("dm-vnav-collapsed");k.setAttribute("aria-pressed",String(t)),k.setAttribute("aria-label",t?"Expand menu":"Collapse menu"),k.title=k.getAttribute("aria-label");const c=r?"chevrons-left":"chevrons-right",p=r?"chevrons-right":"chevrons-left";k.innerHTML=`<span data-icon="${t?c:p}"></span>`,window.Domma&&Domma.icons&&Domma.icons.scan(k)},a=t=>{x.toggle("dm-vnav-collapsed",t),S.set("nav_collapsed",t),s()};k.addEventListener("click",()=>a(!x.contains("dm-vnav-collapsed"))),s();const o=d.querySelector(".navbar-container")||d;o.insertBefore(k,o.firstChild?.nextSibling||null);const e=t=>{x.toggle("dm-vnav-autohide",t),x.toggle("dm-vnav-collapsible",!t&&z.has("collapsible")),t?x.remove("dm-vnav-collapsed"):z.has("collapsible")&&S.get("nav_collapsed")===!0&&x.add("dm-vnav-collapsed"),d.classList.remove("dm-nav-revealed"),s()};d.addEventListener("pointerdown",t=>{x.contains("dm-vnav-autohide")&&t.pointerType!=="mouse"&&!d.classList.contains("dm-nav-revealed")&&(d.classList.add("dm-nav-revealed"),t.preventDefault())}),document.addEventListener("pointerdown",t=>{d.contains(t.target)||d.classList.remove("dm-nav-revealed")}),window.E&&typeof E.contextMenu=="function"&&E.contextMenu(d,{items:()=>{const t=x.contains("dm-vnav-autohide"),c=x.contains("dm-vnav-collapsed"),p=S.has("nav_autohide")||S.has("nav_collapsed");return[{header:"Menu"},{label:c?"Expand menu":"Collapse to icons",icon:c?"maximize":"minimize",disabled:!w()||t||!z.has("collapsible"),action:()=>a(!c)},{label:t?"Keep on screen":"Hide when not in use",icon:t?"eye":"eye-off",disabled:!w(),action:()=>{S.set("nav_autohide",!t),e(!t)}},{type:"divider"},{label:"Reset to the site's setting",icon:"refresh",disabled:!p,action:()=>{S.remove("nav_autohide"),S.remove("nav_collapsed"),e(z.has("autohide")),x.toggle("dm-vnav-collapsed",!z.has("autohide")&&z.has("start-collapsed")),s()}}]}})}function Me(d){d.classList.add("dm-nav-scroll-hide");let r=window.scrollY,M=!1;window.addEventListener("scroll",()=>{M||(M=!0,requestAnimationFrame(()=>{M=!1;const x=window.scrollY,z=d.matches(":focus-within")||d.querySelector(".navbar-dropdown.open, .navbar-collapse.show");x>r&&x>d.offsetHeight&&!z?d.classList.add("dm-nav-scrolled-away"):x<r&&d.classList.remove("dm-nav-scrolled-away"),r=x}))},{passive:!0})}function De(d){let r={};try{r=JSON.parse(d.dataset.contents||"{}")}catch{}const M=d.closest(".site-main"),x=document.querySelector(".site-content"),z=new Set(String(r.exclude||"").split(",").map(n=>n.trim().toLowerCase()).filter(Boolean)),w=n=>!n.closest(".hero, .card, .accordion, .tabs, figure, #site-sidebar"),k=n=>(x?[...x.querySelectorAll(n)]:[]).filter(w).filter(h=>!z.has(h.textContent.trim().toLowerCase())),s=r.headings==="h2"?k("h2"):r.headings==="h3"?k("h3"):r.headings==="h2h3"?k("h2, h3"):k("h2").length?k("h2"):k("h3");if(!s.length){M?.classList.add("no-sidebar-items");return}const a=new Set([...document.querySelectorAll("[id]")].map(n=>n.id)),o=document.createElement("nav");o.className="dm-contents",o.setAttribute("aria-label",r.title||"Page contents"),r.hover&&(o.dataset.menuHover=r.hover),r.selected&&(o.dataset.menuActive=r.selected),r.accent&&o.style.setProperty("--dm-menu-highlight",r.accent.startsWith("#")?r.accent:`var(--dm-${r.accent})`),r.font&&(o.style.fontFamily=r.font),r.fontSize&&(o.style.fontSize=r.fontSize),r.fontWeight&&(o.style.fontWeight=r.fontWeight);const e=document.createElement("div");e.className="dm-contents-head";const t=document.createElement("p");t.className="dm-contents-title",t.textContent=r.title||"",e.appendChild(t),o.appendChild(e);const c=document.createElement("ol");c.className="dm-contents-list"+(r.numbered?" is-numbered":"");const p=[];for(const n of s){if(!n.id){const u=(n.textContent||"").toLowerCase().trim().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"section";let y=u;for(let b=2;a.has(y);b++)y=`${u}-${b}`;a.add(y),n.id=y}const h=document.createElement("li");h.className=`dm-contents-item dm-contents-${n.tagName.toLowerCase()}`;const f=document.createElement("a");f.href=`#${n.id}`,f.textContent=n.textContent.trim(),h.appendChild(f),c.appendChild(h),p.push([n,f])}if(o.appendChild(c),d.replaceChildren(o),r.scrollSpy!==!1&&"IntersectionObserver"in window){const n=new Map,h=()=>{const u=p.find(([y])=>n.get(y))||null;p.forEach(([,y])=>{const b=u&&y===u[1];y.classList.toggle("is-active",!!b),b?y.setAttribute("aria-current","location"):y.removeAttribute("aria-current")})},f=new IntersectionObserver(u=>{u.forEach(y=>n.set(y.target,y.isIntersecting)),h()},{rootMargin:"-80px 0px -60% 0px"});p.forEach(([u])=>f.observe(u))}if(M?.classList.contains("contents-collapsible")){const n=document.createElement("button");n.type="button",n.className="dm-contents-toggle";const h=()=>{const f=M.classList.contains("contents-collapsed");n.setAttribute("aria-expanded",String(!f)),n.setAttribute("aria-label",f?"Show the contents":"Hide the contents"),n.title=n.getAttribute("aria-label"),n.innerHTML=`<span data-icon="${f?"list":"x"}"></span>`,window.Domma?.icons&&Domma.icons.scan(n)};n.addEventListener("click",()=>{S.set("contents_collapsed",M.classList.toggle("contents-collapsed")),h()}),h(),e.insertBefore(n,e.firstChild)}if(M?.classList.contains("contents-floating")&&r.movable){o.classList.add("is-movable");const n=S.get("contents_position");n&&Number.isFinite(n.x)&&Object.assign(d.style,{left:`${n.x}px`,top:`${n.y}px`,right:"auto",bottom:"auto"}),e.addEventListener("pointerdown",h=>{if(h.target.closest("button"))return;const f=d.getBoundingClientRect(),u=h.clientX-f.left,y=h.clientY-f.top,b=l=>{const v=Math.max(0,Math.min(window.innerWidth-f.width,l.clientX-u)),m=Math.max(0,Math.min(window.innerHeight-40,l.clientY-y));Object.assign(d.style,{left:`${v}px`,top:`${m}px`,right:"auto",bottom:"auto"})},A=()=>{document.removeEventListener("pointermove",b),S.set("contents_position",{x:parseInt(d.style.left,10),y:parseInt(d.style.top,10)})};document.addEventListener("pointermove",b),document.addEventListener("pointerup",A,{once:!0})})}window.E&&typeof E.contextMenu=="function"&&E.contextMenu(d,{items:()=>{const n=M?.classList.contains("contents-collapsible"),h=M?.classList.contains("contents-collapsed"),f=p.find(([,u])=>u.classList.contains("is-active"));return[{header:"Contents"},...n?[{label:h?"Show the contents":"Collapse to a button",icon:h?"list":"minimize",action:()=>d.querySelector(".dm-contents-toggle")?.click()}]:[],{label:"Copy a link to this section",icon:"link",disabled:!f,action:async()=>{const u=`${location.origin}${location.pathname}#${f[0].id}`;try{await _.copyToClipboard(u),E.toast("Link copied.",{type:"success"})}catch{E.toast("Could not copy the link.",{type:"error"})}}},{label:"Back to the top",icon:"arrow-up",action:()=>window.scrollTo({top:0,behavior:"smooth"})}]}}),M?.classList.contains("contents-autohide")&&(d.addEventListener("pointerdown",n=>{n.pointerType!=="mouse"&&!d.classList.contains("is-revealed")&&(d.classList.add("is-revealed"),n.preventDefault())}),document.addEventListener("pointerdown",n=>{d.contains(n.target)||d.classList.remove("is-revealed")}))}
|