(()=>{var e={9087:e=>{function t(){throw new Error("kintsugi: attempted to use node.js functionality on a browser")}const n={isNode:!1,require:e=>t()};Object.defineProperty(n,"crypto",{get:t,enumerable:!0}),e.exports=n},360:(e,t,n)=>{"use strict";const i=n(3567);class r{constructor(e){e=e||{},this.__Animation={duration:e.duration||"default",durationMilliseconds:null,easing:e.easing||"swing",easingFunction:null,update:e.update||null,complete:e.complete||null,promise:null,resolve:null,reject:null,queueTag:void 0===e.queueTag?null:e.queueTag,startAt:null,lastProgress:0,isQueued:!1}}get isRunning(){return!!this.__Animation.resolve}get isQueued(){return this.__Animation.isQueued}get duration(){return this.__Animation.duration}set duration(e){this._throwIfRunning();const t=this.__Animation;t.duration=e,t.durationMilliseconds=null}get easing(){return this.__Animation.easing}set duration(e){this._throwIfRunning();const t=this.__Animation;t.easing=e,t.easingFunction=null}get queueTag(){return this.__Animation.queueTag}start(e){e=e||{};const t=this.__Animation;let n=t.promise;return n||(t.promise=n=new Promise(((n,i)=>{try{t.resolve=n,t.reject=i;const o="string"==typeof t.duration?r.durations[t.duration]:t.duration;if("number"!=typeof o||!isFinite(o)||o<0)throw new Error('Animation: invalid duration "'+t.duration+'"');t.durationMilliseconds=o;const a="function"==typeof t.easing?t.easing:r.easings[t.easing];if("function"!=typeof a)throw new Error('Animation: invalid easing "'+t.easing+'"');t.easingFunction=a();const l=t.queueTag,c=s.runningAnimations;null!==l&&!1!==e.queue&&c.findIndex((e=>e.__Animation.queueTag===l))>=0?(t.isQueued=!0,s.queuedAnimations.push(this)):(c.push(this),r.__startAnimationQueue()),this._onStart()}catch(e){throw this.__doStop(),e}}))),n}complete(){const e=this.__Animation,t=e.resolve;if(t){const n=e.reject;let i;try{this.__updateProgressIfNeeded(1),this._onComplete()}catch(e){i=e}try{this.__doStop()}catch(e){i=i||e}return i?n(i):t(!0),!0}return!1}cancel(){const e=this.__Animation,t=e.resolve;if(t){const n=e.reject;let i;try{this._onCancel()}catch(e){i=e}try{this.__doStop()}catch(e){i=i||e}return i?n(i):t(!1),!0}return!1}static cubicBezierEasing(e,t,n,i){let r=1,s=0,o=0;return function(a){let l=a<=0?0:a>=1?1:s+r*(a-o),c=3*Math.pow(1-l,2)*l*e+3*(1-l)*Math.pow(l,2)*n+Math.pow(l,3),u=c-a;if(u<0||u>.01){let t,i,r;for(u<0?(t=l,i=1):(t=0,i=l),r=0;r<8&&(l=t+(i-t)/2,c=3*Math.pow(1-l,2)*l*e+3*(1-l)*Math.pow(l,2)*n+Math.pow(l,3),u=c-a,!(u>=0&&u<=.01));++r)u<0?t=l:i=l}let d=3*Math.pow(1-l,2)*l*t+3*(1-l)*Math.pow(l,2)*i+Math.pow(l,3);return r=a>o?(l-s)/(a-o):1,s=l,o=a,d}}static forEachRunning(e){let t=0;const n=s.runningAnimations;for(;t<n.length;){const i=n[t];if(!1===e(i))return;i===n[t]&&++t}let i=0;const r=s.queuedAnimations;for(;i<r.length;){const t=r[i];if(!1===e(t))return;t===r[i]&&++i}}static completeAll(e){const t=null==e;r.forEachRunning((function(n){(t||n.queueTag===e)&&n.complete()}))}static cancelAll(e){const t=null==e;r.forEachRunning((function(n){(t||n.queueTag===e)&&n.cancel()}))}static registerAnimationFrameHook(e){s.animationFrameHooks.push(e)}static unregisterAnimationFrameHook(e){const t=s.animationFrameHooks,n=t.indexOf(e);n>=0&&(t[n]=t[t.length-1],t.splice(t.length-1,1))}_throwIfRunning(){if(this.resolve)throw new Error("Animation is running")}_onUpdate(e){const t=this.__Animation.update;t&&t(e)}_onComplete(){const e=this.__Animation.complete;e&&e()}_onCancel(){}_onStart(){}_onStop(){}__doStop(){const e=this.__Animation,t=s.runningAnimations,n=t.indexOf(this);if(n>=0)t[n]=t[t.length-1],t.splice(t.length-1,1);else{const e=s.queuedAnimations,t=e.indexOf(this);t>=0&&e.splice(t,1)}if(!e.isQueued){const n=e.queueTag;if(null!==n&&t.findIndex((e=>e.__Animation.queueTag===n))<0){const e=s.queuedAnimations,t=e.findIndex((e=>e.__Animation.queueTag===n));if(t>=0){const n=e[t];n.__Animation.isQueued=!1,s.runningAnimations.push(n),e.splice(t,1)}}}e.startAt=e.queueTag=e.promise=e.resolve=e.reject=e.durationMilliseconds=e.easingFunction=null,e.lastProgress=0,e.isQueued=!1,this._onStop()}__handleAnimationFrame(e){const t=this.__Animation;try{let n=t.startAt;null===n&&(t.startAt=n=e);const i=e-n,r=t.durationMilliseconds;if(i>=r)return this.complete(),!0;{const e=i/r,n=t.easingFunction(e),s=Math.floor(1e3*n)/1e3;return this.__updateProgressIfNeeded(s)}}catch(e){return!!t.reject&&(t.reject(e),!0)}}__updateProgressIfNeeded(e){const t=this.__Animation;return!(!t.resolve||t.lastProgress===e||(t.lastProgress=e,this._onUpdate(e),0))}static __startAnimationQueue(){if(!s.isQueueRunning){let e=!1;s.forceTimeoutQueue||"function"==typeof requestAnimationFrame&&(s.requestAnimationFrameID=requestAnimationFrame(r.__handleRequestAnimationFrameTick),e=!0),e||(s.queueTimeoutID=setTimeout(r.__handleQueueTimeoutTick,s.queueTickMilliseconds)),s.isQueueRunning=!0}}static __handleRequestAnimationFrameTick(e){s.requestAnimationFrameID=0,r.__handleGenericAnimationFrame(e)&&(s.requestAnimationFrameID=requestAnimationFrame(r.__handleRequestAnimationFrameTick))}static __handleQueueTimeoutTick(){const e="object"==typeof performance?performance.now():(new Date).getTime();s.queueTimeoutID=0,r.__handleGenericAnimationFrame(e)&&(s.queueTimeoutID=setTimeout(r.__handleQueueTimeoutTick,s.queueTickMilliseconds))}static __handleGenericAnimationFrame(e){if(!s.isQueueRunning)return!1;const t=s.runningAnimations;let n=0,i=!1;for(;n<t.length;){const r=t[n];i|=r.__handleAnimationFrame(e),t[n]===r&&++n}if(i){const e=s.animationFrameHooks;let t=0;for(;t<e.length;){const n=e[t];n(),e[t]===n&&++t}}return s.isQueueRunning=t.length>0}static __linearEasing(e){return e}static __swingEasing(e){return.5-Math.cos(e*Math.PI)/2}}r.durations={default:400,fast:200,slow:600},r.easings={linear:function(){return r.__linearEasing},"ease-in":function(){return r.cubicBezierEasing(.42,0,1,1)},"ease-out":function(){return r.cubicBezierEasing(0,0,.58,1)},"ease-in-out":function(){return r.cubicBezierEasing(.42,0,.58,1)},ease:function(){return r.cubicBezierEasing(.25,.1,.25,1)},swing:function(){return r.__swingEasing}};const s=r.__Animation={runningAnimations:[],queuedAnimations:[],isQueueRunning:!1,forceTimeoutQueue:!1,queueTickMilliseconds:Math.ceil(1e3/24),requestAnimationFrameID:0,queueTimeoutID:0,animationFrameHooks:[]};class o extends r{constructor(e){super({queueTag:e.target,duration:e.duration,easing:e.easing,update:e.update,complete:e.complete})}get target(){return this.queueTag}}class a extends o{constructor(e){super({target:e.target,duration:e.duration,easing:e.easing,update:e.update,complete:e.complete}),this.__CssAnimation={styles:Object.assign({},e.styles||{}),styleHandlers:null}}_onUpdate(e){const t=this.__CssAnimation,n=t.styleHandlers||this.__initializeStyleHandlers();let i;if(1!==e){i={};for(let t in n)i[t]=n[t](e)}else i=t.styles;const r=this.target;Object.assign(r.style,i),super._onUpdate(e)}__initializeStyleHandlers(){const e=this.__CssAnimation;let t=e.styleHandlers;if(!t){t={};const n=this.target,i=e.styles,r=getComputedStyle(n);for(let e in i){const s=r[e],o=i[e],l=a.styleHandlerFactories[e],c={target:n,property:e,initial:s,target:o};let u;if(l)try{u=l(c)}catch(e){console.warn(e)}u||(u=a.__createThresholdStyleHandler(c)),t[e]=u}e.styleHandlers=t}return t}static __createThresholdStyleHandler(e){const t=e.initial,n=e.target;return e=>e<.5?t:n}static __createSingleDimensionStyleHandler(e){if(/^\s*(\d+|\d*\.\d+)\s*px\s*$/i.test(e.initial)){const t=parseFloat(e.initial),n=e.target.match(/^\s*(\d+|\d*\.\d+)\s*([a-z]+|%)?\s*$/i);if(n){let i;const r=n[2].toUpperCase();if(""===r||"PX"===r)i=parseFloat(n[1]);else{const t=e.target,n=e.property,r=t.style[n];try{t.style[n]=e.target;const r=getComputedStyle(t);i=parseFloat(r[e.property])}finally{t.style[n]=r}}const s=i-t;return e=>Math.floor(100*(t+s*e))/100+"px"}}return null}static __createScalarFloatStyleHandler(e){const t=parseFloat(e.initial),n=parseFloat(e.target)-t;return e=>Math.floor(100*(t+n*e))/100}}const l={};for(let e of["width","height","padding-top","padding-left","padding-right","padding-bottom","margin-top","margin-left","margin-right","margin-bottom"])l[e]=a.__createSingleDimensionStyleHandler;for(let e of["opacity"])l[e]=a.__createScalarFloatStyleHandler;a.styleHandlerFactories=l;const c={Animation:r,DomAnimation:o,CssAnimation:a,SlideDownAnimation:class extends o{constructor(e){super({target:e.target,duration:e.duration,easing:e.easing,update:e.update,complete:e.complete}),this.__SlideDownAnimation={initialValues:null,targetValues:null}}_onStart(){const e=this.target;if("none"===getComputedStyle(e).display){const t=["height","margin-top","margin-bottom","padding-top","padding-bottom"];e.style.setProperty("display","block"),e.style.setProperty("overflow-y","hidden");for(let n of t)e.style.setProperty(n,0)}super._onStart()}_onStop(){const e=this.__SlideDownAnimation;e.initialValues=e.targetValues=null,super._onStop()}_onUpdate(e){const t=this.__SlideDownAnimation,n=this.target,i=n.style,r=["height","margin-top","margin-bottom","padding-top","padding-bottom"];let s=t.initialValues,o=t.targetValues;if(!o){const e=getComputedStyle(n);t.initialValues=s={};for(let t of r)s[t]=parseFloat(e[t]);i.removeProperty("overflow-y");for(let e of r)i.removeProperty(e);const a=getComputedStyle(n);o={};for(let e of r)o[e]=parseFloat(a[e]);t.targetValues=o,i.setProperty("overflow-y","hidden")}if(1!==e)for(let t of r){const n=s[t],r=o[t],a=Math.max(0,n+Math.floor((r-n)*e*1e3)/1e3);i.setProperty(t,a+"px")}else{for(let e of r)i.removeProperty(e);i.removeProperty("overflow-y")}super._onUpdate(e)}},SlideUpAnimation:class extends o{constructor(e){super({target:e.target,duration:e.duration,easing:e.easing,update:e.update,complete:e.complete}),this.__SlideDownAnimation={initialValues:null}}_onStop(){this.__SlideDownAnimation.initialValues=null,super._onStop()}_onUpdate(e){const t=this.__SlideDownAnimation,n=this.target,i=n.style,r=["height","margin-top","margin-bottom","padding-top","padding-bottom"];let s=t.initialValues;if(!s){const e=getComputedStyle(n);s={wasHidden:"none"===e.display};for(let t of r)s[t]=parseFloat(e[t]);t.initialValues=s,i.setProperty("display","block"),i.setProperty("overflow-y","hidden")}if(1!==e){if(!s.wasHidden)for(let t of r){const n=s[t],r=Math.max(0,Math.floor(n*(1-e)*1e3/1e3));i[t]=r+"px"}}else{for(let e of r)i.removeProperty(e);i.removeProperty("overflow-y"),i.display="none"}super._onUpdate(e)}},FadeInAnimation:class extends o{constructor(e){super({target:e.target,duration:e.duration,easing:e.easing,update:e.update,complete:e.complete})}_onStart(){const e=this.target;"none"===getComputedStyle(e).display&&(e.style.setProperty("display","block"),e.style.setProperty("opacity","0")),super._onStart()}_onUpdate(e){const t=this.target;1!==e?t.style.setProperty("opacity",Math.max(0,Math.min(1,e))):t.style.removeProperty("opacity"),super._onUpdate(e)}},FadeOutAnimation:class extends o{constructor(e){super({target:e.target,duration:e.duration,easing:e.easing,update:e.update,complete:e.complete})}_onUpdate(e){const t=this.target;1===e?(t.style.setProperty("display","none"),t.style.removeProperty("opacity")):t.style.setProperty("opacity",1-Math.max(0,Math.min(1,e))),super._onUpdate(e)}},scrollIntoView:function(e,t){if(!e)return;const n=(t=t||{}).container,s=t.horizontal||"nearest",a=t.vertical||"nearest",l=!1!==t.animate,c=[],u=(e,t,n)=>{let i=e;switch(a){case"nearest":e<=0?i=0:e+t.height>n.height&&(i=n.height-t.height);break;case"centre":i=(n.height-t.height)/2;break;case"top":i=0;break;case"bottom":i=n.height-t.height}return i},d=(e,t,n)=>{let i=e;switch(s){case"nearest":e<=0?i=0:e+t.width>n.width&&(i=n.width-t.width);break;case"centre":i=(n.width-t.width)/2;break;case"left":i=0;break;case"right":i=n.width-t.width}return i};let h=e,m=h.getBoundingClientRect();for(;h instanceof HTMLElement;){const e=i.scrollParent(h);if(!e||n&&!n.contains(e))break;const r=e.getBoundingClientRect(),p=getComputedStyle(e);let f=null,g=null;if("none"!==a&&("auto"===p.overflowY||"scroll"===p.overflowY)){const t=m.top-r.top,n=u(t,m,r);f=e.scrollTop,g=Math.max(0,Math.min(e.scrollHeight-r.height,f+(t-n)))}let y=null,_=null;if("none"!==s&&("auto"===p.overflowX||"scroll"===p.overflowX)){const t=m.left-r.left,n=d(t,m,r);y=e.scrollLeft,_=Math.max(0,Math.min(e.scrollWidth-r.width,y+(t-n)))}if(g!==f||_!==y)if(l){const n=new o({target:e,duration:t.duration,easing:t.easing,update:function(t){1!==t?(null!==g&&(e.scrollTop=Math.max(0,f+(g-f)*t)),null!==_&&(e.scrollLeft=Math.max(0,y+(_-y)*t))):(null!==g&&(e.scrollTop=g),null!==_&&(e.scrollLeft=_))}});c.push(n.start())}else null!==g&&(e.scrollTop=g),null!==_&&(e.scrollLeft=_);h=e,m=r}if(!n){const n=e.ownerDocument&&e.ownerDocument.defaultView;if(n){const e=document.documentElement,i=n.pageYOffset,o=n.pageXOffset,h={top:0,left:0,width:e.clientWidth,height:e.clientHeight};let p=i,f=p;if("none"!==a){const t=m.top,n=u(t,m,h);f=Math.max(0,Math.min(e.offsetHeight-h.height,p+(t-n)))}let g=o,y=g;if("none"!==s){const t=m.left,n=d(t,m,h);y=Math.max(0,Math.min(e.offsetWidth-h.width,g+(t-n)))}if(f!==p||y!==g)if(l){const e=new r({queueTag:n,duration:t.duration,easing:t.easing,update:function(e){1!==e?n.scroll(Math.max(0,g+(y-g)*e),Math.max(0,p+(f-p)*e)):n.scroll(y,f)}});c.push(e.start())}else n.scroll(y,f)}}return Promise.all(c).then((e=>{for(let t of e)if(!t)return!1;return!0}))}};e.exports=c},7689:(e,t,n)=>{"use strict";const i=n(3567),r=n(4672);class s{updateAsync(e){return Promise.resolve()}}class o extends s{constructor(){super(),this.__StandardBusyUIHandler={updateInfoMap:new Map}}updateAsync(e){const t=e.element,n=this.__StandardBusyUIHandler.updateInfoMap;let i=n.get(t);if(!i){let e,r;i={promise:new Promise(((i,s)=>{e=()=>{n.delete(t),i()},r=()=>{n.delete(t),s()}})),resolve:e,reject:r},n.set(t,i)}const s=r(e.element);let o=s.find(".ks-standardbusyui-overlay").filter(((t,n)=>n.parentElement===e.element));const l=i.resolve,c=e.animate;return"displayed"===e.to?(0===o.length&&(o=r(document.createElement("div")).addClass("ks-standardbusyui-overlay").attr({"aria-label":"Busy / Loading",tabindex:"-1"}).css("display","none").html('<div class="ks-standardbusyui-overlay-spinner"><div class="ks-busy-spinner"></div></div>').appendTo(s),"static"===getComputedStyle(s[0]).position&&s.css("position","relative"),s.on("focusin",a.handleElementFocusin),a.stealFocusIfNeeded(t)),o.stop(!0),c?o.fadeIn({complete:l}):(o.show(),l())):(o.length>0&&(o.stop(!0),c?o.fadeOut({complete:()=>{o.remove(),l()}}):(o.remove(),l())),s.off("focusin",a.handleElementFocusin),a.restoreFocusIfNeeded(t)),i.promise}}const a=o.__StandardBusyUIHandler={handleElementFocusin(e){const t=e.currentTarget;a.stealFocusIfNeeded(t)},stealFocusIfNeeded(e){const t=document.activeElement;if(t&&e.contains(t)){const n=r(e).find(".ks-standardbusyui-overlay");n[0]!==t&&n.attr("data-restore-focus-to",i.ensureID(t).id).focus()}},restoreFocusIfNeeded(e){document.activeElement;const t=r(e).find(".ks-standardbusyui-overlay");if(t[0]===document.activeElement){const e=document.getElementById(t.attr("data-restore-focus-to"));e&&e.focus()}}};s.default=new o;class l{constructor(){this.__BusyHandler={busyMap:new Map,uiHandler:null,quiescePromise:null,quiesceResolve:null,queueTimeoutID:0,activeUpdateCount:0,gcIntervalID:0}}startBusy(e){e=i.isPlainObject(e)?e:{element:e};const t=this.__BusyHandler.busyMap,n=this.resolveElements(e.element),r=!1!==e.animate;let s=!1;for(const e of n){let n=t.get(e);if(n)++n.count,n.garbage=!1;else{if(!document.body.contains(e))throw new Error("kintsugi: cannot call startBusy() on elements which are not part of the document");n={element:e,count:1,state:"hidden",uiGeneration:0,garbage:!1,animate:r},t.set(e,n),s=!0}}return s&&(r?c.queueUpdate(this):c.updateNow(this)),this}stopBusy(e){e=i.isPlainObject(e)?e:{element:e};const t=this.__BusyHandler.busyMap,n=this.resolveElements(e.element);let r=!1;for(const i of n){const n=t.get(i);if(!(n&&n.count>0))throw new Error("kintsugi: stopBusy() called on an element which was not busy");n.garbage=!1,0==--n.count&&(n.animate=!1!==e.animate,r=!0)}return r&&c.queueUpdate(this),this}busyWhile(e,t){let n;if(i.isPlainObject(e)?(n=e,e=n.element,t=n.action):n={},"function"==typeof t)try{t=t()}catch(e){return Promise.reject(e)}if(!(t instanceof Promise)){if(!t.then)return Promise.resolve(t);t=new Promise(((e,n)=>t.then(e,n)))}const r=this.resolveElements(e),s=!1!==n.animate;let o=n.animateStart;null==o&&(o=s);let a=n.animateStop;return null==a&&(a=s),this.startBusy({element:r,animate:o}),t.finally((()=>{this.stopBusy({element:r,animate:a})}))}quiesceAsync(){const e=this.__BusyHandler;let t=e.quiescePromise;return t||(e.queueTimeoutID||e.activeUpdateCount?(t=e.quiescePromise=new Promise(((t,n)=>{e.quiesceResolve=t})),t):Promise.resolve())}isDirectlyBusy(e){const t=this.__BusyHandler.busyMap,n="string"==typeof e?document.querySelectorAll(n):Array.isArray(e)?e:[e];for(const e of n){const n=t.get(e);if(n&&n.count>0)return!0}return!1}hasBusyAncestor(e){const t=this.__BusyHandler.busyMap,n="string"==typeof e?document.querySelectorAll(n):Array.isArray(e)?e:[e];for(const e of n){let n=e.parentElement;for(;n;){const e=t.get(n);if(e&&e.count>0)return!0;n=n.parentElement}}return!1}resolveElements(e){return"string"==typeof e?document.querySelectorAll(e):i.isDomElement(e)?[e]:e}}l.default=new l;const c=l.__BusyHandler={disableGC(e){const t=e.__BusyHandler,n=t.gcIntervalID;n>0&&clearInterval(n),t.gcIntervalID=-1},queueUpdate(e,t){const n=e.__BusyHandler;n.queueTimeoutID||(n.queueTimeoutID=setTimeout((()=>{n.queueTimeoutID=0,c.updateNow(e)})))},updateNow(e){const t=e.__BusyHandler,n=t.busyMap,i=t.uiHandler||s.default,r=t.queueTimeoutID;r&&(clearTimeout(r),t.queueTimeoutID=0);const o=[];++t.activeUpdateCount;try{for(const[r,s]of n){const a=s.state,l=0===s.count||e.hasBusyAncestor(r),c=l?"hidden":"displayed";if(c===a||"displayed"===c&&"displaying"===a||"hidden"===c&&"hiding"===a)0===s.count&&"hidden"===s.state&&n.delete(r);else{s.state=l?"hiding":"displaying";const e=++s.uiGeneration;++t.activeUpdateCount;const u=i.updateAsync({element:r,from:a,to:c,animate:s.animate}).then((()=>{e===s.uiGeneration&&(s.state=c,0===s.count&&"hidden"===c&&n.delete(r))})).catch((e=>{console.error(e)})).finally((()=>{--t.activeUpdateCount}));o.push(u)}}}finally{--t.activeUpdateCount,Promise.all(o).finally((()=>{c.checkQuiesce(e)}))}},checkQuiesce(e){const t=e.__BusyHandler;if(!t.activeUpdateCount&&!t.queueTimeoutID){const n=t.busyMap.size>0,i=t.gcIntervalID;n?i||(t.gcIntervalID=setInterval((()=>c.collectGarbage(e)),3e4)):i&&(clearInterval(i),t.gcIntervalID=0);const r=t.quiesceResolve;r&&(t.quiesceResolve=t.quiescePromise=null,r())}},collectGarbage(e){const t=e.__BusyHandler;let n=!1;for(const[e,i]of t.busyMap)i.count>0&&!document.body.contains(e)&&(i.garbage?(i.count=0,n=!0):i.garbage=!0)}},u={BusyUIHandler:s,BusyHandler:l,startBusy:function(e){l.default.startBusy(e)},stopBusy:function(e){l.default.stopBusy(e)},busyWhile:function(e,t){return l.default.busyWhile(e,t)},isDirectlyBusy:function(e){return l.default.isDirectlyBusy(e)}};e.exports=u},3567:(e,t,n)=>{"use strict";var i,r;const s=n(4074),o=n(9087);let a,l=(new Date).getTime()%100,c=0;const u={lt:"<",gt:">",nbsp:" ",amp:"&",quot:'"',apos:"'"};let d=null,h="undefined"==typeof document?null:null!==(i=null===(r=document)||void 0===r||null===(r=r.currentScript)||void 0===r?void 0:r.nonce)&&void 0!==i?i:null,m=h;class p{static get default(){return f.defaultInstance}getCurrentMilliseconds(){throw new Error("kintsugi: method not implemented")}setTimeout(e){throw new Error("kintsugi: method not implemented")}clearTimeout(e){throw new Error("kintsugi: method not implemented")}timeoutAsync(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(t&&t.canBeCancelled){try{t.throwIfCancellationRequested()}catch(e){return Promise.reject(e)}return new Promise(((n,i)=>{let r=0;const s=()=>{this.clearTimeout(r);try{t.throwIfCancellationRequested()}catch(e){i(e)}};t.register(s),r=this.setTimeout((()=>{try{t.unregister(s),t.throwIfCancellationRequested(),n()}catch(e){i(e)}}),Math.max(0,e))}))}return e>0?new Promise(((t,n)=>{this.setTimeout(t,e)})):Promise.resolve()}}const f=p.__TimeoutProvider={defaultInstance:new class extends p{getCurrentMilliseconds(){return performance.now()}setTimeout(e){return setTimeout(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0)}clearTimeout(e){clearTimeout(e)}}};function g(e){throw"string"==typeof e?new Error(e):e}function y(e){if(!e||"[object Object]"!==Object.prototype.toString.call(e))return!1;const t=Object.getPrototypeOf(e);return!t||t===Object.getPrototypeOf({})}function _(e,t,n){if("object"!=typeof e){if("function"==typeof e)throw new Error("kintsugi: cannot copy a function");return e}if(null===e)return e;{const i=t.get(e);if(i)return i;if(e.constructor===Array){const i=[];return t.set(e,i),e.forEach((function(e,r){i[r]=_(e,t,n)})),n&&Object.freeze(i),i}if(e.constructor===Date){const i=new Date(e.getTime());if(t.set(e,i),n)throw Object.freeze(i),new Error("kintsugi: freezing a Date object does not stop methods like setDate() from working.");return i}if(y(e)){const i={};t.set(e,i);for(const r in e)i[r]=_(e[r],t,n);return n&&Object.freeze(i),i}throw new Error("kintsugi: cannot copy a complex object")}}const v=Array.prototype.flat?function(e,t){return Array.prototype.flat.call(e,t)}:function(){function e(t,n,i){if(0===n)for(const e in t)i.push(t[e]);else for(const r in t){const s=t[r];Array.isArray(s)?e(s,n-1,i):i.push(s)}}return function(t,n){if(void 0===n)n=1;else if((n<0||!Number.isFinite(n))&&n!==1/0)throw new Error("kintsugi: depth of flatten must be a non-negative integer, or Infinity");const i=[];return e(t,n,i),i}}();let w;function b(e){return o.isNode?o.crypto.getRandomValues(e):crypto.getRandomValues(e)}function x(e){const t=new Uint8Array(16);if(b(t),t[8]=128|63&t[8],t[6]=64|15&t[6],e&&"string"!==e){if("binary"===e)return t;throw new Error("kintsugi: invalid format for generateUuid()")}{const e=[],n=(n,i)=>{for(let r=n;r<i;++r){const n=t[r].toString(16);1===n.length&&e.push("0"),e.push(n)}};return n(0,4),e.push("-"),n(4,6),e.push("-"),n(6,8),e.push("-"),n(8,10),e.push("-"),n(10,16),e.join("")}}function I(e){return e||""!==e&&null!=e?e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"):""}function C(e){const t=e.length;let n=new Uint8Array(e.length),i=0;const r=function(e){if(n.length<e){const e=new Uint8Array(2*n.length);e.set(n),n=e}};for(let s=0;s<t;++s){const t=e.charCodeAt(s);if(t<128)r(i+1),n[i++]=t;else if(t<2048)r(i+2),n[i++]=192|t>>6,n[i++]=128|63&t;else if(t<55296|t>57343)r(i+3),n[i++]=224|t>>12,n[i++]=128|t>>6&63,n[i++]=128|63&t;else{if(!(t<56320))throw new Error("kintsugi: invalid UTF-8 (low surrogate without high surrogate)");{const o=e.charCodeAt(++s);if(!(o>55551&&o<57344))throw new Error("kintsugi: invalid UTF-8 (high surrogate without low surrogate)");{const e=65536+(t-55296<<10)+(o-56320);r(i+4),n[i++]=240|e>>18,n[i++]=128|e>>12&63,n[i++]=128|e>>6&63,n[i++]=128|63&e}}}}return i!=n.length&&(n=n.subarray(0,i)),n}function k(e){const t=[];let n=0;for(let i=0,r=e.length;i<r;){const r=e[i++];if(r<128)t[n++]=String.fromCharCode(r);else if(192==(224&r)){const s=e[i++];if(128!=(192&s))throw new Error("kintsugi: invalid UTF-8 (invalid sequence)");{const e=(31&r)<<6|63&s;if(!(e>127))throw new Error("kintsugi: invalid UTF-8 (overlong sequence)");t[n++]=String.fromCharCode(e)}}else if(224==(240&r)){const s=e[i++],o=e[i++];if(128!=(192&s)||128!=(192&o))throw new Error("kintsugi: invalid UTF-8 (invalid sequence)");{const e=(15&r)<<12|(63&s)<<6|63&o;if(e>56063&&e<57344)throw new Error("kintsugi: invalid UTF-8 (UTF-16 surrogate)");if(!(e>2047))throw new Error("kintsugi: invalid UTF-8 (overlong sequence)");t[n++]=String.fromCharCode(e)}}else{if(240!=(248&r))throw new Error("kintsugi: invalid UTF-8 (unexpected continuation byte)");{const s=e[i++],o=e[i++],a=e[i++];if(128!=(192&s)||128!=(192&o)||128!=(192&a))throw new Error("kintsugi: invalid UTF-8 (invalid sequence)");{const e=(7&r)<<18|(63&s)<<12|(63&o)<<6|63&a;if(e<65536)throw new Error("kintsugi: invalid UTF-8 (overlong sequence)");if(!(e<1114112))throw new Error("kintsugi: invalid UTF-8 (character outside of Unicode)");{const i=e-65536;t[n++]=String.fromCharCode(55296+(i>>>10)),t[n++]=String.fromCharCode(56320+(1023&i))}}}}}return t.join("")}const S="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";let A;const T=/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+$/u;function D(e){const t=e.length;if(t<2)return!1;let n=0,i=2-t%2;for(let r=0;r<t;++r){const t=e.charCodeAt(r)-48;if(t<0||t>10)return!1;let s=t*i;s>9&&(s-=9),n+=s,i=3-i}return n%10==0}const P=[31,28,31,30,31,30,31,31,30,31,30,31];function M(e,t){return 2!==t?P[t-1]:e%4!=0||e%400!=0&&e%100==0?28:29}function E(e,t,n){if(1===arguments.length){const i=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e);if(!i)return!1;e=parseInt(i[1]),t=parseInt(i[2]),n=parseInt(i[3])}return e>=1&&e<=9999&&t>=1&&t<=12&&n>=1&&n<=M(e,t)}function F(e){let t=0,n=0,i=0,r=!1,s=!1,o=!e;if(!o){const o=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e);o&&(t=parseInt(o[1]),n=parseInt(o[2]),i=parseInt(o[3]),r=!!(t&&n&&i),s=r&&E(t,n,i))}return{value:e,year:t,month:n,day:i,complete:r,valid:s,empty:o}}function V(e){let t=0,n=0,i=0,r=0,s=0,o=0,a=0,l=0,c=!1,u=!1,d=!e;if(!d){let d=!0,h=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:[.,](\d{1,3})\d*)?(Z|[-+]\d{2}(?::\d{2})?)$/.exec(e);if(h||(h=/^(\d{4})(\d{2})(\d{2})T(\d{2})(\d{2})(\d{2})(?:[.,](\d{1,3})\d*)?(Z|[-+]\d{2}(?:\d{2})?)$/.exec(e),d=!h),h){if(t=parseInt(h[1]),n=parseInt(h[2]),i=parseInt(h[3]),r=parseInt(h[4]),s=parseInt(h[5]),o=parseInt(h[6]),c=!!(t&&n&&i),h[7]){const e=h[7];a=parseInt(e)*10**(3-e.length)}const e=h[8];let m=!0;if("Z"!==e){const t="-"===e[0]?-1:1,n=parseInt(e.substring(1,3)),i=6===e.length,r=i?parseInt(e.substring(4,6)):0;l=t*(60*n+r),m=i&&r<60&&Math.abs(l)<1440}u=c&&d&&E(t,n,i)&&m&&r<24&&s<60&&o<60}}return{value:e,year:t,month:n,day:i,hour:r,minute:s,second:o,millisecond:a,offsetMinutes:l,complete:c,valid:u,empty:d}}function N(){return"ks-gen-"+ ++l}const R="undefined"==typeof Element||Element.prototype.matches?(e,t)=>!!(e&&e.matches&&e.matches(t)):(e,t)=>!!(e&&e.msMatchesSelector&&e.msMatchesSelector(t)),O="undefined"==typeof Element||Element.prototype.closest?(e,t)=>e&&e.closest?e.closest(t):null:(e,t)=>{let n=e;for(;n&&!R(n,t);)n=n.parentElement;return n};function L(e){const t=[];if(e){const n=(e,i)=>{if(Array.isArray(i)){const t=e+"[]";for(let e=0,r=i.length;e<r;++e)n(t,i[e])}else if(y(i))for(const t in i)n(e+"["+t+"]",i[t]);else if("string"==typeof i||"number"==typeof i)t.push(encodeURIComponent(e)+"="+encodeURIComponent(i));else if("boolean"==typeof i)t.push(encodeURIComponent(e)+"="+(i?"1":"0"));else if(null!=i)throw new Error("kintsugi: invalid value to build URL query: "+i.toString())};for(const t in e)e.hasOwnProperty(t)&&n(t,e[t])}return t.join("&")}function z(e){try{"string"==typeof e&&(e={url:e,data:arguments[1]});const t=z.__testFactory,n=t?t():new XMLHttpRequest;let i,r=e.url;if(!r)throw new Error("kintsugi: url was not provided");const s=(e.method||"GET").toUpperCase(),o="GET"===s||"HEAD"===s,a=e.format||(o?"query":"json");if(o&&"query"!==a)throw new Error('kintsugi: only the "query" format can be used with a GET or HEAD request');let l=e.data;if(void 0===l)l=null;else if(null!==l)switch(a){case"json":l=JSON.stringify(l);break;case"query":const e=L(l);l=null,e&&(r=r+(r.indexOf("?")<0?"?":"&")+e);break;case"raw":break;default:throw new Error("kintsugi: unrecognized data format: "+JSON.stringify(a))}let c=e.contentType;c=void 0!==c?c||null:"json"===a?"application/json; charset=utf-8":null;const u=e.responseType||"json";let d=e.accept;d=void 0!==d?d||null:"json"===u?"application/json":"*/*";const h=e.headers;let m,p,f=e.validate;switch(void 0!==f&&!0!==f||(f=e=>{const t=e.status;return t<200||t>=300?"status code "+t.toString():null!==e.response||"no response or response could not be parsed"}),u){case"json":p=e=>JSON.parse(e.response);break;case"text":case"blob":case"arraybuffer":m=u,p=e=>e.response;break;case"request":p=e=>e;break;default:throw new Error("kintsugi: unrecognized return type: "+JSON.stringify(u))}const g=e.configure,y=e.timeout||0,_=e.executor||J.ajax,v=e.cancellationToken,w="allowAbort"in e?!!e.allowAbort:"GET"===s||"HEAD"===s||"OPTIONS"===s,b=e.priority;e=void 0;try{throw new Error("kintsugi: ks.ajaxAsync() call stack")}catch(e){i=e}return _.queueAsync((()=>new Promise(((e,t)=>{let o=!1,a=null;v&&(v.throwIfCancellationRequested(),a=()=>{o&&w&&n.abort()},v.register(a)),n.open(s,r,!0),void 0!==m&&(n.responseType=m),n.timeout=y;const u=new Map;if(h)for(const e in h)u.set(e.toUpperCase(),!0),n.setRequestHeader(e,h[e]);c&&!u.get("CONTENT-TYPE")&&n.setRequestHeader("Content-Type",c),d&&!u.get("ACCEPT")&&n.setRequestHeader("Accept",d),g&&g(n),n.send(l),o=!0,n.onload=()=>{try{if(v&&v.unregister(a),f){const e=f(n);if(!0!==e)throw"string"==typeof e?U(s,r,n.status,e,{cause:i}):e instanceof Error?e:!1===e?U(s,r,n.status,"response validation failed",{cause:i}):new Error("kintsugi: invalid return value from validate function: "+typeof e,{cause:i})}const t=p(n);e(t)}catch(e){t(e)}},n.onerror=()=>{try{throw v&&v.unregister(a),U(s,r,n.status,"could not communicate with server",{cause:i})}catch(e){t(e)}},n.ontimeout=()=>{try{throw v&&v.unregister(a),U(s,r,n.status,"request timed out",{cause:i})}catch(e){t(e)}},n.onabort=()=>{try{throw v&&(v.unregister(a),v.throwIfCancellationRequested()),U(s,r,n.status,"request aborted",{cause:i})}catch(e){t(e)}}}),{priority:b,cancellationToken:v})))}catch(e){return Promise.reject(e)}}const B=z;function U(e,t,n,i,r){const s=t.length<180?t:t.substring(0,177).trimEnd()+"...",o=["kintsugi: ",e.toUpperCase()," request for ",JSON.stringify(s)," failed"];i&&i.length>0&&(o.push(": "),o.push(i));const a=o.join("");return new H(a,n,r)}class H extends Error{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;super(e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}),this.name=this.constructor.name;const n={code:t};Object.defineProperty(this,"__HttpRequestError",{value:n})}get code(){return this.__HttpRequestError.code}}class q extends Error{constructor(e){super(e||"The action was cancelled"),this.name=this.constructor.name,this.__CancelledError={cancellationToken:null}}get cancellationToken(){return this.__CancelledError.cancellationToken}set cancellationToken(e){this.__CancelledError.cancellationToken=e}}class W{constructor(e){this.__CancellationToken={source:e}}static get none(){let e=j.noneInstance;if(!e){const t=new G;j.noneInstance=e=t.token,t.dispose()}return e}get canBeCancelled(){return this!==j.noneInstance}get isCancellationRequested(){return this.__CancellationToken.source.isCancellationRequested}throwIfCancellationRequested(){if(this.isCancellationRequested){const e=new q;throw e.cancellationToken=this,e}}register(e){K.register(this.__CancellationToken.source,e)}unregister(e){K.unregister(this.__CancellationToken.source,e)}}const j=W.__CancellationToken={noneInstance:null};class G{constructor(){this.__CancellationTokenSource={token:new W(this),isCancelled:!1,callbacks:null,timeoutID:0}}get token(){return this.__CancellationTokenSource.token}get isCancellationRequested(){return this.__CancellationTokenSource.isCancelled}cancel(){this.throwIfDisposed();const e=this.__CancellationTokenSource;if(!e.isCancelled){e.isCancelled=!0;const t=e.timeoutID;t&&(clearTimeout(t),e.timeoutID=0),e.callbacks&&e.callbacks.length>0&&(e.timeoutID=setTimeout((()=>K.runCallbacks(this)),0))}}cancelAfter(e){this.throwIfDisposed();const t=this.__CancellationTokenSource;if(!t.isCancelled){const n=t.timeoutID;if(n&&(clearTimeout(n),t.timeoutID=0),null!=e){if(!Number.isSafeInteger(e)||e<0)throw new Error("kintsugi: milliseconds must be a non-negative integer");t.timeoutID=setTimeout((()=>this.cancel()),e)}}}dispose(){const e=this.__CancellationTokenSource;if(e.token&&(e.token=null,!e.isCancelled)){const t=e.timeoutID;t&&(clearTimeout(t),e.timeoutID=0),e.callbacks=null}}throwIfDisposed(){if(!this.__CancellationTokenSource.token)throw new Error("kintsugi: cancellation token source has been disposed")}}const K=G.__CancellationTokenSource={register(e,t){const n=e.__CancellationTokenSource,i=n.isCancelled;if(!i&&null==n.token)return;let r=n.callbacks;r||(r=n.callbacks=[]),r.push(t),i&&!n.timeoutID&&(n.timeoutID=setTimeout((()=>K.runCallbacks(e)),0))},unregister(e,t){const n=e.__CancellationTokenSource.callbacks;if(null!=n){const e=n.indexOf(t);e>=0&&n.splice(e,1)}},runCallbacks(e){const t=e.__CancellationTokenSource,n=t.callbacks;for(;n.length>0;){const e=n[0];n.splice(0,1);try{e()}catch(e){console.error(e)}}t.timeoutID=0}};class J{static get default(){let e=Q.defaultInstance;return e||(Q.defaultInstance=e=new J({concurrency:8})),e}static get ajax(){let e=Q.ajaxInstance;return e||(Q.ajaxInstance=e=new J({concurrency:8})),e}constructor(e){e=e||{},this.__Executor={concurrency:"unlimited"===e.concurrency?Number.MAX_SAFE_INTEGER:e.concurrency||8,maximumRetryCount:e.maximumRetryCount||Q.defaultMaximumRetryCount,waitList:[],runList:[],needSort:!1,dispatchTimeoutID:0,lastActionIdentifier:0}}queueAsync(e){let t,n;"function"==typeof e&&(e={action:e,cancellationToken:arguments[1]});const i=new Promise(((e,i)=>{t=e,n=i}));let r=e.priority||0;if("number"!=typeof r)switch(r){case"high":r=100;break;case"normal":r=0;break;case"low":r=-100;break;default:throw new Error("kintsugi: invalid priority: "+JSON.stringify(r))}const s=this.__Executor,o={id:++s.lastActionIdentifier,state:"wait",promise:i,resolve:t,reject:n,action:e.action,priority:r,cancellationToken:null,cancellationTokenCallback:null,shouldRetry:e.shouldRetry||null,failureCount:0,lastAttemptAtMilliseconds:null},a=e.cancellationToken;if(a){const e=()=>Q.cancelFromWaitList(this,o);a.register(e),o.cancellationToken=a,o.cancellationTokenCallback=e}const l=s.waitList;return l.push(o),l.length>1&&r>l[l.length-2].priority&&(s.needSort=!0),s.runList.length<s.concurrency&&Q.queueDispatch(this),i}}const Q=J.__Executor={defaultInstance:null,ajaxInstance:null,defaultMaximumRetryCount:15,queueDispatch(e){const t=e.__Executor;t.dispatchTimeoutID||(t.dispatchTimeoutID=setTimeout((()=>{t.dispatchTimeoutID=0,Q.dispatch(e)}),0))},dispatch(e){const t=e.__Executor,n=t.dispatchTimeoutID;n&&(clearTimeout(n),t.dispatchTimeoutID=0);const i=t.runList,r=t.waitList;for(;i.length<t.concurrency&&r.length>0;){t.needSort&&(r.sort(((e,t)=>{let n=e.priority-t.priority;return n||(n=t.id-e.id),n})),t.needSort=!1);const n=r.pop(),s=n.cancellationToken;if(s&&(s.isCancellationRequested?Q.cancelFromWaitList(e,n):(s.unregister(n.cancellationTokenCallback),n.cancellationTokenCallback=null)),"wait"===n.state){let s;n.state="run",i.push(n),n.lastAttemptAtMilliseconds=Date.now();try{s=n.action(),s instanceof Promise||(s=Promise.resolve(s))}catch(e){s=Promise.reject(e)}if(n.shouldRetry){let e=null;e=i=>{const r=Date.now(),s=++n.failureCount;if(s>t.maximumRetryCount)throw i;const o=n.shouldRetry(i,s);if(!0===o){const t=Q.calculateRetryDelayInMilliseconds(s,r-n.lastAttemptAtMilliseconds);return new Promise((e=>setTimeout(e,t))).then((()=>{let t;n.lastAttemptAtMilliseconds=Date.now();try{return t=n.action(),t instanceof Promise||(t=Promise.resolve(t)),t.catch(e)}catch(t){return Promise.reject(t).catch(e)}}))}throw!1===o?i:new Error("kintsugi: executor retry check must return a Boolean")},s=s.catch(e)}const o=(s,o)=>{if("run"===n.state){const e=i.indexOf(n);i[e]=i[i.length-1],i.splice(i.length-1,1),o?(n.state=o instanceof q&&o.cancellationToken===n.cancellationToken?"cancel":"error",n.reject(o)):(n.state="complete",n.resolve(s))}i.length<t.concurrency&&r.length>0&&Q.queueDispatch(e)};s.then((e=>o(e,null)),(e=>o(null,e)))}}},calculateRetryDelayInMilliseconds(e,t){const n=e<=3?10:Math.floor(50*Math.pow(2,e-3-1)),i=Math.floor(t/3);return Math.min(1e4,Math.max(i,n))},cancelFromWaitList(e,t){const n=e.__Executor.waitList,i=n.indexOf(t);n.splice(i,1),t.state="cancel";try{t.cancellationToken.throwIfCancellationRequested()}catch(e){t.reject(e)}}},$={TimeoutProvider:p,timeoutAsync:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return p.default.timeoutAsync(e,t)},throwError:g,isPlainObject:y,isEmptyObject:function(e){if(e&&"object"==typeof e){for(const t in e)return!1;return y(e)}return!1},deepEquals:function e(t,n){if(t===n)return!0;if(y(t)){if(y(n)){const i=Object.keys(t);if(Object.keys(n).length!==i.length)return!1;for(const i in t)if(!e(t[i],n[i]))return!1;return!0}return!1}if(!Array.isArray(t))return!1;if(Array.isArray(n)){const i=t.length;if(i!==n.length)return!1;for(let r=0;r<i;++r)if(!e(t[r],n[r]))return!1;return!0}},deepCopy:function(e){const t=!!(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).freeze;return _(e,new Map,t)},binarySearch:function(e,t,n){let i=0,r=e.length;for(n||(n=(e,t)=>e<t?-1:e>t?1:0);i<r;){const s=i+(r-i>>>2),o=n(e[s],t);if(o<0)i=s+1;else{if(!(o>0))return s;r=s}}return~i},flatten:v,addWeakEventListener:function(e,t,n,i){let r;const s="function"==typeof WeakRef,o=s?n instanceof WeakRef:"function"==typeof n.deref&&1===Object.keys(n).length;return r=o||s?function(e,t,n,i){let r;return r=function(s){const o=n.deref();o?i(o,s):e.removeEventListener(t,r)},r}(e,t,o?n:new WeakRef(n),i):function(e){i(n,e)},e.addEventListener(t,r),r},isLittleEndian:function(){if(void 0===w){const e=new Uint8Array([255,254]),t=new Uint16Array(e.buffer);w=65279===t[0]}return w},compareFloats:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;const r=Number.EPSILON;if("number"!=typeof e||"number"!=typeof t)throw new Error("kintsugi: the values to be compared must be numbers");const s=null==n?1e-9:"number"==typeof n&&n>=0&&n<1?n:g("kintsugi: the absolute epsilon must be a non-negative number less than 1"),o=null==i?r:"number"==typeof i&&i>=0&&i<1?i:g("kintsugi: the relative epsilon must be a non-negative number less than 1"),a=e-t,l=Math.abs(a);return l<s||l<Math.max(e,t)*o?0:a<0?-1:a>0?1:e===t?0:Number.NaN},getRandomValues:b,generateUuid:x,generateGuid:x,sprintf:function(e){let t=e.indexOf("%");if(t<0)return e;e.length;const n=[],i=/%(?:(\d+)\$)?((?:[-+ 0]|'\S)*)(\d+)?(?:\.(\d+))?([a-zA-Z])/g;let r,s=0,o=0;do{if("%"===e[t+1])n.push(e.substring(s,t+1)),s=t+=2;else if(i.lastIndex<=t&&(i.lastIndex=t,r=i.exec(e)),r&&r.index===t){let a,l;n.push(e.substring(s,t)),s=t=i.lastIndex,a=void 0!==r[1]?parseInt(r[1]):++o,a<1||a>arguments.length?console.warn("kintsugi: format specifier out of range in sprintf()"):l=arguments[a];const c=r[2]||"";let u,d,h=" ";for(let e=0,t=c.length;e<t;++e){const n=c[e];switch(n){case"-":u=!0;break;case"+":d=!0;break;case" ":case"0":h=n;break;case"'":if(e+1<t){h=c[++e];break}default:console.warn("kintsugi: invalid flag in sprintf()")}}const m=r[3]?parseInt(r[3]):0,p=r[4]?parseInt(r[4]):void 0;let f;const g=r[5];switch(g){case"s":f=null==l?"":l.toString();break;case"d":case"u":if(l=parseInt(l),Number.isFinite(l))if(l<0&&"u"===g)console.warn("kintsugi: formatted a negative value using %u"),f="NaN",h=" ";else if("0"===h&&m){const e=l<0?"-":d?"+":"";f=e+Math.abs(l).toString().padStart(m-e.length,"0")}else f=l.toString(),l>=0&&d&&(f="+"+f);else console.warn("kintsugi: formatted a non-number using %d or %u"),f="NaN",h=" ";break;case"x":l=parseInt(l),Number.isFinite(l)&&l>=0?f=l.toString(16):(console.warn("kintsugi: formatted a non-number or a negative number using %x"),f="NaN",h=" ");break;case"X":l=parseInt(l),Number.isFinite(l)&&l>=0?f=l.toString(16).toUpperCase():(console.warn("kintsugi: formatted a non-number or a negative number using %x"),f="NaN",h=" ");break;case"e":case"E":"0"===h&&(h=" "),l=parseFloat(l),Number.isFinite(l)?(f=l.toExponential(void 0===p?6:p),"E"===g&&(f=f.toUpperCase()),l>=0&&d&&(f="+"+f)):f=Number.isNaN(l)?"NaN":l>0?d?"+INF":"INF":"-INF";break;case"f":case"F":"0"===h&&(h=" "),l=parseFloat(l),Number.isFinite(l)?(f=l.toFixed(void 0===p?6:p),l>=0&&d&&(f="+"+f)):f=Number.isNaN(l)?"NaN":l>0?d?"+INF":"INF":"-INF";break;default:console.warn("kintsugi: invalid format character in sprintf()"),f=null==l?"":l.toString()}f.length<m&&(f=u?f.padEnd(m,h):f.padStart(m,h)),n.push(f)}else console.warn("kintsugi: invalid format specifier in sprintf()"),t+=1;t=e.indexOf("%",t)}while(t>=0);return n.push(e.substring(s)),n.join("")},regexEscape:I,htmlEscape:function(e){return e||""!==e&&null!=e?e.toString().replace(/[&<>'"\u0080-\uffff]/g,(function(e){return"&"===e?"&amp;":"<"===e?"&lt;":">"===e?"&gt;":"'"===e?"&#39;":'"'===e?"&quot;":"&#x"+e.charCodeAt(0).toString(16)+";"})):""},cssStringEscape:function(e){return e||""!==e&&null!=e?e.toString().replace(/['"\\]|[^\u0020-\u007E]/g,(function(e){return"\\"+e.charCodeAt(0).toString(16).padStart(6,"0")+" "})):""},htmlToText:function(e,t){let n;t=t||{};let i,r=e.indexOf("<");if(r<0)n=e;else{const t=[];let i=0;do{let n;if(t.push(e.substring(i,r)),e.startsWith("<script",r)?n="script":e.startsWith("<style",r)&&(n="style"),n){const t="</"+n+">",s=e.indexOf(t,r);i=s>=0?s+t.length:e.length}else{const t=e.indexOf(">",i);i=t>=0?t+1:e.length}r=e.indexOf("<",i)}while(r>=0);t.push(e.substring(i)),n=t.join("")}if(n.indexOf("&")<0)i=n;else{const e=void 0===t.unknown?"�":t.unknown.toString();i=n.replace(/\&(#x?)?([^;]*)(?:;|$)/g,(function(t,n,i){if(n){const t="#"===n&&/^[0-9]+$/.test(i)?parseInt(i):"#x"===n&&/^[a-fA-F0-9]+$/.test(i)?parseInt(i,16):-1;return t>=32&&t<=1114111?String.fromCodePoint(t):e}return("_"!==i[0]?u[i]:null)||e}))}return i},utf8Encode:C,utf8Decode:k,base64Encode:function(e){"string"==typeof e?e=C(e):e instanceof ArrayBuffer?e=new Uint8Array(e):Array.isArray(e)||e instanceof Uint8Array||(e=new Uint8Array(e.buffer,e.byteOffset,e.byteLength));const t=e.length,n=S,i=[];let r=0,s=0;for(const o=t-2;s<o;){let t=e[s++];t=t<<8|e[s++],t=t<<8|e[s++];const o=t>>>18,a=t>>>12&63,l=t>>>6&63,c=63&t;i[r++]=n[o],i[r++]=n[a],i[r++]=n[l],i[r++]=n[c]}switch(t-s){case 2:{const t=e[s]<<16|e[s+1]<<8,o=t>>>18,a=t>>>12&63,l=t>>>6&63;i[r++]=n[o],i[r++]=n[a],i[r++]=n[l],i[r++]="="}break;case 1:{const t=e[s],o=t>>>2,a=t<<4&63;i[r++]=n[o],i[r++]=n[a],i[r++]="=="}}return i.join("")},base64Decode:function(e,t){const n=e.length;if(3&n)throw new Error("kintsuig: invalid base-64 sequence");let i=new Uint8Array(n/4*3);if(n){let t=A;if(!t){const e=S;t=A={};for(let n=0,i=e.length;n<i;++n)t[e[n]]=n}let r=0,s=0;for(const o="="===e[n-1]?n-4:n;r<o;){const n=t[e[r++]],o=t[e[r++]],a=t[e[r++]],l=t[e[r++]];if(!n&&0!==n||!o&&0!==o||!a&&0!==a||!l&&0!==l)throw new Error("kintsugi: invalid base-64 sequence");const c=n<<18|o<<12|a<<6|l;i[s++]=c>>>16,i[s++]=c>>>8,i[s++]=c}if(r<n)if("="===e[r+2]){const n=t[e[r]],o=t[e[r+1]];if(!n&&0!==n||!o&&0!==o)throw new Error("kintsugi: invalid base-64 sequence");const a=n<<6|o;i[s++]=a>>>4}else{const n=t[e[r]],o=t[e[r+1]],a=t[e[r+2]];if(!n&&0!==n||!o&&0!==o||!a&&0!==a)throw new Error("kintsugi: invalid base-64 sequence");const l=(n<<12)+(o<<6)+a;i[s++]=l>>>10,i[s++]=l>>>2}i.length!==s&&(i=i.subarray(0,s))}switch(t||"binary"){case"binary":break;case"utf8":i=k(i);break;default:throw new Error("kintsugi: unrecognized format for base64Decode(): "+JSON.stringify(t))}return i},hexEncode:function(e){"string"==typeof e?e=C(e):e instanceof ArrayBuffer?e=new Uint8Array(e):Array.isArray(e)||e instanceof Uint8Array||(e=new Uint8Array(e.buffer,e.byteOffset,e.byteLength));const t="0123456789abcdef",n=[];let i=0;const r=e.length;for(let s=0;s<r;++s){const r=e[s];n[i++]=t[r>>>4],n[i++]=t[15&r]}return n.join("")},hexDecode:function(e,t){const n=e.length;if(1&n)throw new Error("kintsuig: invalid hexadecimal sequence");let i=new Uint8Array(n/2),r=0,s=0;for(;s<n;){let t,n,o=e.charCodeAt(s++),a=e.charCodeAt(s++);if(t=o>=48&&o<=57?o-48:o>=97&&o<=102?o-97+10:o>=65&&o<=70?o-65+10:-1,n=a>=48&&a<=57?a-48:a>=97&&a<=102?a-97+10:a>=65&&a<=70?a-65+10:-1,!(t>=0&&n>=0))throw new Error("kintsugi: invalid hexadecimal sequence");i[r++]=t<<4|n}switch(t||"binary"){case"binary":break;case"utf8":i=k(i);break;default:throw new Error("kintsugi: unrecognized format for hexEncode(): "+JSON.stringify(t))}return i},isValidHttpUrl:function(e,t){if(!e)return!1;let n;t||(t={});try{n=new URL(e)}catch(e){return!1}const i=!1!==t.allowHttp,r=n.protocol.toUpperCase();return"HTTPS:"===r||i&&"HTTP:"===r},tryParseUrl:function(e,t){if("string"!=typeof e)throw new Error("kintsugi: Cannot parse url from "+JSON.stringify(e));if(null!=t&&"string"!=typeof t&&!(t instanceof URL))throw new Error("kintsugi: Cannot parse URL with base "+JSON.stringify(t));try{return new URL(e,t)}catch(e){if(e instanceof TypeError)return null;throw e}},isValidEmail:function(e){return T.test(e)},isValidNorthAmericanPhoneNumber:function(e){if(10!==e.length||!/^[0-9]{10}$/.test(e))return!1;const t=parseInt(e.substring(0,3));if(t<200||(t/10|0)%10==9||t%100==11)return!1;const n=parseInt(e.substring(3,6));return!(n<200||n%100==11)},isValidCanadianPostalCode:function(e){return/^[A-CE-HJ-NPR-TVXY][0-9](?:[A-CE-HJ-NPR-TV-Z][0-9]){2}$/.test(e)},isValidCanadianSin:function(e){return 9===e.length&&"0"!==e[0]&&"8"!==e[0]&&D(e)},isValidUsingLuhn:D,isValidStandardVin:function(e){if(null==e)return!1;if("string"!=typeof e)throw new Error("kintsugi: VIN was not a string, null or undefined");if(17!==e.length)return!1;let t=0;for(let n=0;n<17;++n){const i=e.charCodeAt(n);let r,s;if(i>90)return!1;if(i>=83)r=i-81;else if(i>=74){if(r=i-73,6===r||8===r)return!1}else if(i>=65){if(r=i-64,9===r)return!1}else{if(i>=59)return!1;if(!(i>=48))return!1;r=i-48}s=n<7?8-n:7===n?10:8===n?0:18-n,t+=r*s}const n=t%11,i=10===n?"X":String.fromCharCode(48+n);return e[8]===i},daysInMonth:M,isValidDate:E,tryParseIsoDate:F,tryParseIsoDatetime:V,tryParseIsoTime:function(e){let t=0,n=0,i=0,r=0,s=!1,o=!1,a=!e;if(!a){const a=/^(\d{2}):(\d{2})(?::(\d{2}))?(?:[.,](\d{1,3})\d*)?$/.exec(e);if(a){if(t=parseInt(a[1]),n=parseInt(a[2]),a[3]&&(i=parseInt(a[3])),a[4]){const e=a[4];r=parseInt(e)*10**(3-e.length)}s=null!=t&&null!=n,o=s&&t<24&&n<60&&i<60}}return{value:e,hour:t,minute:n,second:i,millisecond:r,complete:s,valid:o,empty:a}},tryGuessFourDigitYear:function(e){const t="string"==typeof e;let n,i;if(t){const t=/(\d+)/.exec(e);if(!t)return!1;i=t[1].length,n=parseInt(t[1])}else{if(!Number.isFinite(e))return!1;n=Math.abs(e),i=Math.floor(Math.log10(n))+1}if(4!==i){const e=(new Date).getFullYear();i<=2?(n=100*Math.floor(e/100)+n,n>e&&(n-=100)):i<=3?(n=1e3*Math.floor(e/1e3)+n,n>e&&(n-=1e3)):n=Math.floor(n/Math.pow(10,i-4))}return t?n.toString().padStart(4,"0"):n},formatInvariantDate:function(){const e=arguments;let t,n;if(e.length<=2?(t=e[0],t instanceof Date&&(t=t.getFullYear().toString().padStart(4,"0")+"-"+(t.getMonth()+1).toString().padStart(2,"0")+"-"+t.getDate().toString().padStart(2,"0")),n=e[1]):(t=e[0].toString().padStart(4,"0")+"-"+e[1].toString().padStart(2,"0")+"-"+e[2].toString().padStart(2,"0"),n=e[3]),!t)return"";const i=F(t);if(!i.complete)return t;const r=i.year,s=i.month,o=i.day;switch(n||"iso"){case"dd/mm/yyyy":return o.toString().padStart(2,"0")+"/"+s.toString().padStart(2,"0")+"/"+r.toString().padStart(4,"0");case"mm/dd/yyyy":return s.toString().padStart(2,"0")+"/"+o.toString().padStart(2,"0")+"/"+r.toString().padStart(4,"0");case"iso":case"yyyy-mm-dd":return i.value;default:throw new Error("kintsugi: invalid date format "+JSON.stringify(n))}},formatInvariantDatetime:function(e,t){let n,i,r,s,o,a,l,c;if(""===e||null==e)return"";if(arguments.length>=8)n=arguments[0],i=arguments[1],r=arguments[2],s=arguments[3],o=arguments[4],a=arguments[5],l=arguments[6],c=arguments[7],9===arguments.length&&(t=arguments[8]);else if(e instanceof Date)n=e.getFullYear(),i=e.getMonth()+1,r=e.getDate(),s=e.getHours(),o=e.getMinutes(),a=e.getSeconds(),l=e.getMilliseconds(),c=-1*e.getTimezoneOffset();else if("string"==typeof e){const t=V(e);if(!t.complete)throw new Error("kintsugi: invalid datetime value: "+JSON.stringify(e));n=t.year,i=t.month,r=t.day,s=t.hour,o=t.minute,a=t.second,l=t.millisecond,c=t.offsetMinutes}else n=e.year,i=e.month,r=e.day,s=e.hour,o=e.minute,a=e.second,l=e.millisecond||0,c=e.offsetMinutes||0;if("iso"===(t||"iso")){let e="Z";return 0!==c&&(e=c>0?"+":"-",e+=Math.floor(Math.abs(c)/60).toString().padStart(2,"0"),e+=":"+(Math.abs(c)%60).toString().padStart(2,"0")),n.toString().padStart(4,"0")+"-"+i.toString().padStart(2,"0")+"-"+r.toString().padStart(2,"0")+"T"+s.toString().padStart(2,"0")+":"+o.toString().padStart(2,"0")+":"+a.toString().padStart(2,"0")+"."+l.toString().padStart(3,"0")+e}throw new Error("kintsugi: invalid datetime value "+JSON.stringify(t))},calculateDaysBetween:function(e,t){if(!e||!t)throw new Error("kintsugi: invalid dates provided");let n,i,r,s;if(e instanceof Date)n=new Date(e);else{const t=F(e);if(!t.valid)throw new Error("kintsugi: invalid ISO-8601 date string");n=new Date(t.year,t.month-1,t.day)}if(t instanceof Date)i=new Date(t);else{const e=F(t);if(!e.valid)throw new Error("kintsugi: invalid ISO-8601 date string");i=new Date(e.year,e.month-1,e.day)}let o=n.getTime()<=i.getTime();o?(r=n,s=i):(r=i,s=n);const a=s.getFullYear(),l=s.getMonth(),c=s.getDate();let u=0;for(;r.getDate()!==c||r.getMonth()!==l||r.getFullYear()!==a;)r.setDate(r.getDate()+1),++u;return o?u:-u},focusableSelector:"a[href],button:not(:disabled),input:not(:disabled),textarea:not(:disabled),select:not(:disabled),details,iframe,[tabindex]",isDomElement:function(e){return!(!e||!e.tagName)},generateUniqueID:N,ensureID:function(e){return e&&!e.id&&(e.id=N()),e},matchesSelector:R,closestElement:O,scrollParent:function(e){let t=null;if(e)for(t=e.parentElement;t;){const e=getComputedStyle(t),n=e.overflowY;if("auto"===n||"scroll"===n)break;const i=e.overflowX;if("auto"===i||"scroll"===i)break;t=t.parentElement}return t},preventBodyScroll:function(){if(1==++c){a=window.pageYOffset;const e=document.body.style;e.overflow="hidden",s.isIos()&&(e.position="fixed",e.top=-a+"px",e.width="100%")}},allowBodyScroll:function(){if(c){if(0==--c){const e=document.body.style;e.overflow="",s.isIos()&&(e.position="",e.top="",e.width="",window.scrollTo(0,a))}}else console.warn("kintsugi: unbalanced call; needs to exactly match calls to preventBodyScroll()")},isVisible:function(e){return!(!e||!(e.offsetWidth||e.offsetHeight||e.getClientRects().length>0))},getClipboardTextFromPasteEvent:function(e){return e.clipboardData?e.clipboardData.getData("text/plain"):window.clipboardData?window.clipboardData.getData("Text"):void 0},isShowingEllipsis:function(e){return e.offsetWidth<e.scrollWidth},tryGetCookie:function(e,t){const n="(?:^|;\\s*)"+I(e)+"=([^;]*)",i=new RegExp(n).exec(document.cookie);if(i)try{return decodeURIComponent(i[1])}catch(t){console.warn('kintsugi: cookie for "'+e+'" was not properly encoded; ignored')}return t},setCookie:function(e,t,n){if("string"!=typeof t)throw new Error("kintsugi: cookie value must be a string");let i=";path=/";if("undefined"!=typeof location){const e=location.protocol.toUpperCase();"HTTP:"!==e&&"FILE:"!==e&&(i+=";secure")}if(null!=n&&"session"!==n){const e=/^(\d+)(s|m|h|d)$/.exec(n);if(!e)throw new Error("kintsugi: invalid value for cookie expiration: "+JSON.stringify(n));let t=parseInt(e[1]);switch(e[2]){case"m":t*=60;break;case"h":t*=3600;break;case"d":t*=86400}i+=";max-age="+t}const r=e+"="+encodeURIComponent(t)+i;document.cookie=r},deleteCookie:function(e){document.cookie=e+"=;path=/;expires=Thu, 01 Jan 1970 00:00:00 GMT"},buildUrlQuery:L,ajaxAsync:z,getAsync:B,postAsync:function(e){return"string"==typeof e?e={method:"POST",url:e,data:arguments[1]}:e.method||(e=Object.assign({method:"POST"},e)),z(e)},loadScriptAsync:function(e){let t=d;t||(t=d=new Map);let n=t.get(e);return n||(n=new Promise(((t,n)=>{let i=document.querySelector('script[src="'+e+'"]');if(i)throw new Error("kintsugi: script was already added to document");i=document.createElement("script"),i.onload=()=>t(),i.onerror=()=>{try{throw new Error("kintsugi: an error occurred while loading the script "+JSON.stringify(e))}catch(e){n(e)}},i.async=!0,i.nonce=h,i.src=e,document.head.appendChild(i)})),t.set(e,n)),n},tryGetContentSecurityPolicyNonceForScripts:function(){return h},tryGetContentSecurityPolicyNonceForStyles:function(){return m},__resetLoadedScripts:function(){d=null},CancelledError:q,CancellationToken:W,CancellationTokenSource:G,HttpRequestError:H,Executor:J};e.exports=$},4074:e=>{"use strict";const t={tablet:1366,phone:812};function n(){const e=document.documentElement,t=e.classList;t.remove("ks-nav-pointer"),t.add("ks-nav-kbd"),e.removeEventListener("keydown",s,!0),e.addEventListener("pointerdown",o,!0),e.addEventListener("touchstart",o,!0)}function i(e){const t=d=e.matches,n=document.documentElement.classList;t?(n.add("ks-pointer-touch"),n.remove("ks-pointer-mouse")):(n.add("ks-pointer-mouse"),n.remove("ks-pointer-touch"))}function r(){const e="landscape"===((screen.orientation||{}).type||"")?window.innerHeight:window.innerWidth;let n;n=e>t.tablet?"desktop":e>t.phone?"tablet":"phone";const i=m;if(i!==n){m=n;const e=document.documentElement.classList;e.remove("ks-size-"+i),e.add("ks-size-"+n);const t=p,r={mediaSize:n,oldMediaSize:i};for(let e=0;e<t.length;++e){const n=t[e];n.listener.call(n.listenerThis,r)}}}function s(e){e.defaultPrevented||"Tab"!==e.key||n()}function o(e){const t=document.documentElement,n=t.classList;n.add("ks-nav-pointer"),n.remove("ks-nav-kbd"),t.addEventListener("keydown",s,!0),t.removeEventListener("pointerdown",o,!0),t.removeEventListener("touchstart",o,!0)}const a="undefined"==typeof navigator||navigator.userAgent.startsWith("Node.js/")||/\bjsdom\b/.test(navigator.userAgent),l=!(a||!(/\b(iPad|iPhone|iPod)\b/.test(navigator.userAgent)||"MacIntel"===navigator.platform&&navigator.maxTouchPoints>1)),c=!a&&(l||-1!==navigator.userAgent.indexOf(" AppleWebKit/")),u=!(a||c||!document.documentMode||!/\b(?:Trident|MSIE)/.test(navigator.userAgent));let d,h,m;const p=[];if("undefined"!=typeof window){const e=document.documentElement,n=document.documentElement.classList,o=matchMedia("(hover: none)");if(i(o),o.addEventListener&&o.addEventListener("change",i),d){const e=matchMedia("(max-device-width: "+t.phone+"px)");h=e.matches}else h=!1;u&&n.add("ks-is-ie"),n.add("ks-nav-pointer"),e.addEventListener("keydown",s,!0),r(),window.addEventListener("resize",r,!0)}else m="desktop",d=h=!1;const f={isIos:function(){return l},isSafari:function(){return c},isNodeJS:function(){return a},isIE:function(){return u},isJsDom:function(){return a},mediaBreakpoints:t,isTouch:function(){return d},isPhone:function(){return h},mediaSize:function(){return m},addMediaSizeListener:function(e,t){p.push({listener:e,listenerThis:t})},removeMediaSizeListener:function(e,t){const n=p,i=n.findIndex((n=>n.listener===e&&n.listenerThis===t));if(i>=0){const e=n.length;n[i]=n[e-1],n.splice(e-1,1)}},switchToKeyboardNav:n};e.exports=f},9729:(e,t,n)=>{"use strict";const i=n(4074);function r(e,t){return a.createEvent(e,t)}class s{constructor(e){e=e||{},this.__EventCreator={definitions:new Map},e.definitions&&this.defineEvent(e.definitions)}defineEvent(e,t){let n;n="string"==typeof e?{[e]:t}:e;const i=this.__EventCreator.definitions;for(const e in n){if("string"!=typeof e)throw new Error("the event type was not specified");if(i.has(e))throw new Error(`the event ${e} has already been defined`);const t=n[e]||{};t.className||(t.className="CustomEvent"),i.set(e,t)}}createEvent(e,t){t=t||{};const n=this.__EventCreator.definitions.get(e)||{};let r=t.className||n.className||"CustomEvent",s=window[r];s&&(s===Event||s.prototype instanceof Event)||(console.warn("kintsugi: event class "+r+" was not found; using Event"),r="Event",s=Event);const o={bubbles:!!(void 0===t.bubbles?!1!==n.bubbles:t.bubbles),cancelable:!!(void 0===t.cancelable?n.cancelable:t.cancelable),detail:s===CustomEvent||s.prototype instanceof CustomEvent?t.detail:void 0};let a;return i.isIE()?(a=document.createEvent(r),a instanceof CustomEvent?a.initCustomEvent(e,o.bubbles,o.cancelable,o.detail):a.initEvent(e,o.bubbles,o.cancelable)):a=new s(e,o),a}}const o={className:"FocusEvent",bubbles:!1},a=new s({definitions:{blur:o,click:{className:"MouseEvent",cancelable:!0},focus:o,input:{className:"InputEvent",cancelable:!1,bubbles:!0},change:{className:"Event",cancelable:!1,bubbles:!0},submit:{className:"SubmitEvent",cancelable:!0,bubbles:!0}}});e.exports={EventCreator:s,defaultEventCreator:a,defineEvent:function(e,t){a.defineEvent(e,t)},createEvent:r,dispatchEvent:function(e,t,n){let i=t;return"string"==typeof i&&(i=r(i,n)),e.dispatchEvent(i)},isSpecialKeyEvent:function(e){if(e.ctrlKey||e.metaKey||e.altKey)return!0;const t=e.key;if(!t)return!0;if(t.length>1){const e=t[0];if(e>="A"&&e<="Z"){const e=t[1];if(e>="a"&&e<="z"||e>="0"&&e<="9")return!0}}else if(t<=""||t>=""&&t<="")return!0;return!1}}},62:(e,t,n)=>{"use strict";const i=n(3567);class r{constructor(){this.__Calculator={numericReturnType:"float",vehiclePriceInCents:null,residualAmountInCents:null,cashDownInCents:0,cashDownMethod:"direct",termInMonths:null,interestRate:null,paymentFrequency:null,gstHstRate:null,pstRate:null,ppsaFeeTaxable:{gstHst:!1,pst:!1},rebates:{},items:{},tradeIns:{},securityDepositRule:c.none},this.ppsaFee(null).processingFee(null).registrationFee(null).adminFee(null)}clone(){return(new this.constructor).configureFrom(this)}configureFrom(e){const t=e.__Calculator;return this.__Calculator=Object.assign(i.deepCopy(Object.assign({},t,{securityDepositRule:null})),{securityDepositRule:t.securityDepositRule}),this}numericReturnType(e){return s.getset(this,"numericReturnType","identity",arguments)}vehiclePrice(){return s.getset(this,"vehiclePriceInCents","cents",arguments)}cashDown(){return s.getset(this,"cashDownInCents","cents",arguments)}cashDownMethod(e){const t=this.__Calculator;if(arguments.length>0){if(!["due","direct"].includes(e))throw new Error("kintsugi: invalid cash-down method: "+JSON.stringify(e));return t.cashDownMethod=e,this}return t.cashDownMethod}termInMonths(){return s.getset(this,"termInMonths","integer",arguments)}interestRate(){return s.getset(this,"interestRate","numeric",arguments)}paymentFrequency(){return s.getset(this,"paymentFrequency","identity",arguments)}gstHstRate(){return s.getset(this,"gstHstRate","numeric",arguments)}pstRate(){return s.getset(this,"pstRate","numeric",arguments)}rebate(e,t){const n=this.__Calculator.rebates;if("string"==typeof e){if(arguments.length>1){const i=n[e];if(!i)throw new Error("kintsugi: rebate "+JSON.stringify(e)+" does not exist");return i.amountInCents=m("cents",t),this}{const t=n[e];if(t){const e=t.amountInCents;return null==e?null:s.returnNumeric(this,e,100)}return null}}{const t=e.id,i=!1!==e.gstHst,r=!1!==e.pst,s={id:t,amountInCents:m("cents",e.amount),name:e.name||t,gstHst:i,pst:r};return n[t]=s,this}}rebateDetails(e){if("string"==typeof e){const t=this.__Calculator.rebates[e];return t?{id:t.id,amount:t.amountInCents?s.returnNumeric(this,t.amountInCents,100):null,name:t.name,gstHst:t.gstHst,pst:t.pst}:null}return this.rebate(e)}item(e,t){const n=this.__Calculator.items;if("string"==typeof e){if(arguments.length>1){const i=n[e];if(!i)throw new Error("kintsugi: item "+JSON.stringify(e)+" does not exist");return i.amountInCents=m("cents",t),this}{const t=n[e];if(t){const e=t.amountInCents;return null==e?null:s.returnNumeric(this,e,100)}return null}}{const t=e.id,i=!1!==e.gstHst,r=!1!==e.pst,s={id:t,amountInCents:m("cents",e.amount),name:e.name||t,gstHst:i,pst:r,canFinance:!1!==e.canFinance,canLease:!1!==e.canLease};return n[t]=s,this}}itemDetails(e){if("string"==typeof e){const t=this.__Calculator.items[e];return t?{id:t.id,amount:t.amountInCents?s.returnNumeric(this,t.amountInCents,100):null,name:t.name,gstHst:t.gstHst,pst:t.pst,canFinance:t.canFinance,canLease:t.canLease}:null}return this.item(e)}itemIDs(){return Object.keys(this.__Calculator.items)}zeroMissingItems(e){e||(e={});const t=this.__Calculator.items,n=e.exceptFor||[];for(const e in t){const i=t[e];null==i.amountInCents&&n.indexOf(e)<0&&(i.amountInCents=0)}return this}removeItem(e){return delete this.__Calculator.items[e],this}removeAllItems(){return this.__Calculator.items={},this}ppsaFee(){const e=this.__Calculator;return s.getsetForItem(this,"fee-ppsa",{name:"PPSA Fee",gstHst:e.ppsaFeeTaxable.gstHst,pst:e.ppsaFeeTaxable.pst,canLease:!1},arguments)}ppsaFeeTaxable(){const e=this.__Calculator,t=e.ppsaFeeTaxable;if(arguments.length>0){const t=arguments[0],n=e.ppsaFeeTaxable={gstHst:!!t.gstHst,pst:!!t.pst},i=e.items["fee-ppsa"];return i&&(i.gstHst=n.gstHst,i.pst=n.pst),this}return t}processingFee(){return s.getsetForItem(this,"fee-processing",{name:"Processing Fee"},arguments)}registrationFee(){return s.getsetForItem(this,"fee-registration",{name:"Registration Fee",gstHst:!1,pst:!1,canLease:!1},arguments)}adminFee(){return s.getsetForItem(this,"fee-admin",{name:"Admin Fee"},arguments)}tradeInDetails(e){const t=this.__Calculator.tradeIns;if("string"==typeof e){const n=t[e];return n?{id:n.id,name:n.name,type:n.type,amount:null==n.amountInCents?null:s.returnNumeric(this,n.amountInCents,100),owingAmount:null==n.owingAmountInCents?null:s.returnNumeric(this,n.owingAmountInCents,100)}:null}return t[e.id]={id:e.id,name:e.name||e.id,type:e.type||null,amountInCents:m("cents",e.amount),owingAmountInCents:m("cents",e.owingAmount)},this}securityDepositRule(e){const t=this.__Calculator;return arguments.length>0?(t.securityDepositRule=c.create({type:e.type,ruleSettings:e.ruleSettings}),this):t.securityDepositRule.toObject({numericReturnType:t.numericReturnType})}calculate(){const e=this.tryCalculate();if(!e.ok)throw e.error||new Error("kintsugi: calculation failed for an unspecified reason");return e}tryCalculate(){const e=this.__Calculator,t=e.termInMonths,n=e.paymentFrequency,i=this._requireResidualAmount(),r=e.cashDownMethod,o={ok:!1,error:null,termInMonths:t,paymentFrequency:this.paymentFrequency(),paymentsPerYear:null,totalPaymentCount:null,vehiclePrice:this.vehiclePrice(),residualAmount:this._residualAmount(),nominalCashDown:this.cashDown(),cashDownMethod:r,cashDown:null,interestRate:this.interestRate(),gstHstRate:this.gstHstRate(),pstRate:this.pstRate(),totalFinancedAmount:null,paymentAmount:null,basePaymentAmount:null,securityDepositAmount:null};try{if(!Number.isSafeInteger(t)||t<=0)throw new Error("kintsugi: term in months is invalid or missing: "+JSON.stringify(t));const a=e.vehiclePriceInCents;if(!Number.isSafeInteger(a)||a<0)throw new Error("kintsugi: vehicle price is invalid or missing: "+JSON.stringify(a));const l=e.cashDownInCents;if(!Number.isSafeInteger(l)||l<0)throw new Error("kintsugi: cash down is invalid or missing: "+JSON.stringify(l));const c=e.interestRate;if(!c||!Number.isSafeInteger(c.value)||c.value<0)throw new Error("kintsugi: interest rate is invalid or missing: "+JSON.stringify(c));const u=n?s.paymentFrequencyToPaymentsPerYear[n]:null;if(!u)throw new Error("kintsugi: payment frequency is invalid or missing: "+JSON.stringify(n));o.paymentsPerYear=u;const d=o.totalPaymentCount=Math.ceil(t*u/12),h=e.gstHstRate;if(!h||!Number.isSafeInteger(h.value)|h.value<0)throw new Error("kintsugi: GST/HST rate is invalid or missing: "+JSON.stringify(h));const m=e.pstRate;if(!m||!Number.isSafeInteger(m.value)|m.value<0)throw new Error("kintsugi: PST rate is invalid or missing: "+JSON.stringify(m));const p=e.rebates;for(const e in p){const t=p[e];if(null==t.amountInCents||!Number.isSafeInteger(t.amountInCents))throw new Error("kintsugi: "+t.name+(t.name!==t.id?" ("+t.id+")":"")+" is invalid or missing: "+JSON.stringify(t.amountInCents))}const f=e.items;for(const e in f){const t=f[e];if(null==t.amountInCents||!Number.isSafeInteger(t.amountInCents))throw new Error("kintsugi: "+t.name+(t.name!==t.id?" ("+t.id+")":"")+" is invalid or missing: "+JSON.stringify(t.amountInCents))}const g=e.tradeIns;for(const e in g){const t=g[e];if("tradein"!==t.type&&"lease"!==t.type)throw new Error("kintsugi: "+t.name+(t.name!==t.id?" ("+t.id+")":"")+" trade-in type (trade-in vs lease) is invalid or missing: "+JSON.stringify(t.type));if(null==t.amountInCents||!Number.isSafeInteger(t.amountInCents))throw new Error("kintsugi: "+t.name+(t.name!==t.id?" ("+t.id+")":"")+" amount is invalid or missing: "+JSON.stringify(t.amountInCents));if(null==t.owingAmountInCents||!Number.isSafeInteger(t.owingAmountInCents))throw new Error("kintsugi: "+t.name+(t.name!==t.id?" ("+t.id+")":"")+" lien amount is invalid or missing: "+JSON.stringify(t.owingAmountInCents))}const y=e.residualAmountInCents;if(i&&!Number.isSafeInteger(y)||y<0)throw new Error("kintsugi: residual amount is invalid or missing: "+JSON.stringify(y));const _={termInMonths:t,totalPaymentCount:d,vehiclePriceInCents:a,residualAmountInCents:y,cashDownInCents:l,cashDownMethod:r,interestRate:c,paymentFrequency:n,paymentsPerYear:u,gstHstRate:h,pstRate:m,rebates:p,items:f,tradeIns:g,securityDepositRule:e.securityDepositRule},v=s.tryPerformCalculation(this,{values:_});if(o.ok=!!v.ok,o.cashDown=null==v.cashDownInCents?null:s.returnNumeric(this,v.cashDownInCents,100),o.basePaymentAmount=null==v.basePaymentAmountInCents?null:s.returnNumeric(this,v.basePaymentAmountInCents,100),o.paymentAmount=null==v.paymentAmountInCents?null:s.returnNumeric(this,v.paymentAmountInCents,100),o.totalFinancedAmount=null==v.totalFinancedAmountInCents?null:s.returnNumeric(this,v.totalFinancedAmountInCents,100),o.gstHstOnPaymentAmount=null==v.gstHstOnPaymentAmountInCents?null:s.returnNumeric(this,v.gstHstOnPaymentAmountInCents,100),o.pstOnPaymentAmount=null==v.pstOnPaymentAmountInCents?null:s.returnNumeric(this,v.pstOnPaymentAmountInCents,100),o.gstHstFinancedAmount=null==v.gstHstFinancedAmountInCents?null:s.returnNumeric(this,v.gstHstFinancedAmountInCents,100),o.pstFinancedAmount=null==v.pstFinancedAmountInCents?null:s.returnNumeric(this,v.pstFinancedAmountInCents,100),o.costOfBorrowingAmount=null==v.costOfBorrowingAmountInCents?null:s.returnNumeric(this,v.costOfBorrowingAmountInCents,100),o.baseDueOnDeliveryAmount=null==v.baseDueOnDeliveryAmountInCents?null:s.returnNumeric(this,v.baseDueOnDeliveryAmountInCents,100),o.dueOnDeliveryAmount=null==v.dueOnDeliveryAmountInCents?null:s.returnNumeric(this,v.dueOnDeliveryAmountInCents,100),o.gstHstDueOnDeliveryAmount=null==v.gstHstDueOnDeliveryAmountInCents?null:s.returnNumeric(this,v.gstHstDueOnDeliveryAmountInCents,100),o.pstDueOnDeliveryAmount=null==v.pstDueOnDeliveryAmountInCents?null:s.returnNumeric(this,v.pstDueOnDeliveryAmountInCents,100),o.securityDepositAmount=null==v.securityDepositAmountInCents?null:s.returnNumeric(this,v.securityDepositAmountInCents,100),o.debug=v.debug,o.ok){if(null==o.cashDown)throw new Error("kintsugi: calculation did not return a cash-down amount");if(null==o.basePaymentAmount)throw new Error("kintsugi: calculation did not return a base payment amount");if(null==o.paymentAmount)throw new Error("kintsugi: calculation did not return a payment amount");if(null==o.totalFinancedAmount)throw new Error("kintsugi: calculation did not return a total amount financed");if(null==o.gstHstOnPaymentAmount)throw new Error("kintsugi: calculation did not return a per-payment GST/HST amount");if(null==o.pstOnPaymentAmount)throw new Error("kintsugi: calculation did not return a per-payment PST amount");if(null==o.gstHstFinancedAmount)throw new Error("kintsugi: calculation did not return a total GST/HST amount");if(null==o.pstFinancedAmount)throw new Error("kintsugi: calculation did not return a total PST amount");if(null==o.costOfBorrowingAmount)throw new Error("kintsugi: calculation did not return a total cost of borrowing");if(null==o.baseDueOnDeliveryAmount)throw new Error("kintsugi: calculation did not return a base due-on-delivery amount");if(null==o.dueOnDeliveryAmount)throw new Error("kintsugi: calculation did not return a due-on-delivery amount");if(null==o.gstHstDueOnDeliveryAmount)throw new Error("kintsugi: calculation did not return a due-on-delivery GST/HST amount");if(null==o.pstDueOnDeliveryAmount)throw new Error("kintsugi: calculation did not return a due-on-delivery PST amount");if(null==o.securityDepositAmount)throw new Error("kintsugi: calculation did not return a security deposit amount")}}catch(e){o.ok=!1,o.error=e}return o}_requireResidualAmount(){return!1}_residualAmount(){return s.getset(this,"residualAmountInCents","cents",arguments)}_tryPerformBasicCalculation(e){throw new Error("kintsugi: _tryPerformBasicCalculation() not implemented")}}const s=r.__Calculator={paymentFrequencyToPaymentsPerYear:{weekly:52,biweekly:26,monthly:12,semimonthly:24},getset(e,t,n,i){const r=e.__Calculator;if(i.length>0){const s=m(n,i[0]);return r[t]=s,e}{let i=r[t];switch(n){case"identity":case"integer":break;case"cents":i=null==i?null:s.returnNumeric(e,i,100);break;case"numeric":i=null==i?null:s.returnNumeric(e,i.value,i.divisor);break;default:throw new Error("kintsugi: property adapter not implemented: "+JSON.stringify(n))}return i}},returnNumeric:(e,t,n)=>p(e.__Calculator.numericReturnType,t,n),getsetForItem:(e,t,n,i)=>i.length>0?(i[0],e.item(Object.assign({},n,{id:t,amount:i[0]}))):e.item(t),tryPerformCalculation(e,t){const n=t.values,i=n.cashDownInCents,r=n.cashDownMethod;if(0===i||"direct"===r)return e._tryPerformBasicCalculation(t);let s,o=0,a=i+1;const l=Object.assign({},n,{cashDownMethod:"direct"}),c=Object.assign({},t,{values:l});for(;o<a;){const t=o+(a-o>>>1);l.cashDownInCents=t,s=e._tryPerformBasicCalculation(c);const n=s.dueOnDeliveryAmountInCents;n<i?o=t+1:n>i?a=t:o=a=t}return s}};class o extends r{_tryPerformBasicCalculation(e){const t=e.values,n=t.gstHstRate,r=t.pstRate;let s=0;const o=[],a=(e,t,n)=>{n&&(s+=n,o.push({id:e,name:t,amountInCents:n}))};let l=0;const c=[],u=(e,t,n)=>{n&&(l+=n,c.push({id:e,name:t,amountInCents:n}))},d=[],h=[],m=[],p=[],f=(e,t,n,r,s)=>{if(n&&r.value){let o=s.find((e=>i.deepEquals(e.rate,r)));o||(o={rate:r,taxableAmountInCents:0,taxAmountInCents:null,items:[]},s.push(o)),o.items.push({id:e,name:t,taxableAmountInCents:n}),o.taxableAmountInCents+=n}},g=t.vehiclePriceInCents;a("vehicle-price","Vehicle Price",g),f("vehicle-price","Vehicle Price",g,n,d),f("vehicle-price","Vehicle Price",g,r,h);const y=t.tradeIns;for(const e in y){const t=y[e],i=t.name,s=t.amountInCents,o=t.owingAmountInCents;switch(t.type){case"tradein":a(e,i,-s),f(e,i,-s,n,d),f(e,i,-s,r,h),a(e,i+" (Lien)",o);break;case"lease":{const t=o-s;a(e,i,t),f(e,i,t,n,d),f(e,i,t,r,h)}break;default:throw new Error("kintsugi: trade-in type invalid or not implemented: "+JSON.stringify(t.type))}}const _=t.rebates;for(const e in _){const t=_[e],i=t.amountInCents;if(i){const s=t.name;a(e,s,-i),t.gstHst&&f(e,s,-i,n,d),t.pst&&f(e,s,-i,r,h)}}const v=t.items;for(const e in v){const t=v[e],i=t.amountInCents;if(i){const s=t.name;t.canFinance?(a(e,s,i),t.gstHst&&f(e,s,i,n,d),t.pst&&f(e,s,i,r,h)):(u(e,s,i),t.gstHst&&f(e,s,i,n,m),t.pst&&f(e,s,i,r,p))}}if(s<0){const e=-s;a("refund","Refund",e),f("refund","Refund",e,n,d),f("refund","Refund",e,r,h),u("refund","Refund",-e)}const w=function(e){let t=0;for(const n of e){const e=n.rate;t+=n.taxAmountInCents=Math.round(n.taxableAmountInCents*e.value/e.divisor)}return Math.max(t,0)};let b=w(d),x=w(h);const I=t.cashDownInCents;let C=I;if(C>0){const e=Math.min(s,C);if(u("cash-down","Cash Down",e),a("cash-down","Cash Down",-e),C-=e,C>0&&(b>0||x>0)){const e=Math.min(b,Math.round(C*b/(b+x))),t=Math.min(x,C-e);f("cash-down-gst","Cash Down Applied To GST/HST",e,{value:1,divisor:1},m),b-=e,C-=e,f("cash-down-pst","Cash Down Applied To PST",t,{value:1,divisor:1},p),x-=t,C-=t}}const k=s+b+x,S=t.interestRate,A=S.value/S.divisor/t.paymentsPerYear,T=t.totalPaymentCount;let D;if(Math.abs(A)>=1e-4){const e=k/100*A*Math.pow(1+A,T)/(Math.pow(1+A,T)-1);D=Math.round(100*e)}else D=Math.round(k/T);const P=t.securityDepositRule.tryCalculateInCents({calculator:this,cashDownInCents:I-C});if(null==P)throw new Error("kintsugi: could not calculate security deposit amount");u("security","Security Deposit",P);const M=D*T-k,E=w(m),F=w(p),V=e=>e.map((e=>e.items.map((e=>e.name)).join(" + ")+" = "+(e.taxableAmountInCents/100).toFixed(2)+" @ "+(100*e.rate.value/e.rate.divisor).toFixed(2)+"% = "+(e.taxAmountInCents/100).toFixed(2))).join("; ");return{ok:!0,totalFinancedAmountInCents:k,basePaymentAmountInCents:D,paymentAmountInCents:D,gstHstOnPaymentAmountInCents:0,pstOnPaymentAmountInCents:0,gstHstFinancedAmountInCents:b,pstFinancedAmountInCents:x,costOfBorrowingAmountInCents:M,baseDueOnDeliveryAmountInCents:l,dueOnDeliveryAmountInCents:l+E+F,gstHstDueOnDeliveryAmountInCents:E,pstDueOnDeliveryAmountInCents:F,securityDepositAmountInCents:P,cashDownInCents:I-C,debug:{subTotalAmount:(s/100).toFixed(2),subTotalList:o.map((e=>e.name+": "+(e.amountInCents/100).toFixed(2))).join("; "),gstHstTaxList:V(d),pstTaxList:V(h),dueOnDeliveryList:c.map((e=>e.name+": "+(e.amountInCents/100).toFixed(2))).join("; "),dueOnDeliveryGstHstTaxList:V(m),dueOnDeliveryPstTaxList:V(p)}}}}class a extends r{constructor(){super(),this.__LeaseCalculator={calculationMethod:"annuity"}}configureFrom(e){return super.configureFrom(e),e instanceof a&&(this.__LeaseCalculator=i.deepCopy(e.__LeaseCalculator)),this}calculationMethod(e){const t=this.__LeaseCalculator;return arguments.length>0?(t.calculationMethod=arguments[0],this):t.calculationMethod}residualAmount(){return super._residualAmount.apply(this,arguments)}_requireResidualAmount(){return!0}_tryPerformBasicCalculation(e){const t=this.__LeaseCalculator,n=e.values,r=n.gstHstRate,s=n.pstRate,o=r.divisor,a=n.residualAmountInCents;let c=0,u=[];const d=(e,t,n)=>{n&&(c+=n,u.push({id:e,name:t,amountInCents:n}))};let h=0,m=[];const p=(e,t,n)=>{n&&(h+=n,m.push({id:e,name:t,amountInCents:n}),d(e,t,n))};let f=0,g=[];const y=(e,t,n)=>{n&&(f+=n,g.push({id:e,name:t,amountInCents:n}))};let _=[],v=[];const w=(e,t,n,r,s)=>{if(n&&r.value){let o=s.find((e=>i.deepEquals(e.rate,r)));o||(o={rate:r,taxableAmountInCents:0,taxAmountInCents:null,items:[]},s.push(o)),o.items.push({id:e,name:t,taxableAmountInCents:n}),o.taxableAmountInCents+=n}};p("vehicle-price","Vehicle Price",n.vehiclePriceInCents);const b=n.tradeIns;for(const e in b){const t=b[e],n=t.name,i=t.amountInCents,r=t.owingAmountInCents;switch(t.type){case"tradein":p(e,n,-i),d(e,n+" (Lien)",r);break;case"lease":p(e,n,r-i);break;default:throw new Error("kintsugi: trade-in type invalid or not implemented: "+JSON.stringify(t.type))}}const x=n.items;for(const e in x){const t=x[e],n=t.amountInCents,i=t.name;n&&t.canLease?p(e,i,n):(y(e,i,n),t.gstHst&&w(e,i,n,r,_),t.pst&&w(e,i,n,s,v))}const I=n.cashDownInCents;p("cash-down","Cash Down",-I),y("cash-down","Cash Down",I),w("cash-down","Cash Down",I,r,_),w("cash-down","Cash Down",I,s,v);const C=n.rebates;for(const e in C){const t=C[e],n=t.name,i=t.amountInCents,a={value:o+(t.gstHst?0:r.value)+(t.pst?0:s.value),divisor:o};p(e,n,-Math.round(i*a.divisor/a.value))}if(h<0){const e=-h;w("refund","Refund",-e,r,_),w("refund","Refund",-e,s,v),y("refund","Refund",-e),p("refund","Adjustment for Refund",e)}if(c<0){const e=-c;y("refundNoTax","Refund (No Tax)",-e),d("refundNoTax","Adjustment for Refund (No Tax)",e)}const k=n.interestRate,S=n.totalPaymentCount,A=n.paymentsPerYear,T=t.calculationMethod,D=l.calculateBasePaymentAmountInCents(T,c,a,k,S,A,1),P=l.calculateBasePaymentAmountInCents(T,h,a,k,S,A,1),M=Math.round(P*r.value/r.divisor),E=Math.round(P*s.value/s.divisor),F=D+M+E;y("advance","Advanced Payment(s)",1*D),w("advance","Advanced Payment(s)",1*M,{value:1,divisor:1},_),w("advance","Advanced Payment(s)",1*E,{value:1,divisor:1},v);const V=n.securityDepositRule.tryCalculateInCents({calculator:this,cashDownInCents:I});if(null==V)throw new Error("kintsugi: failed to calculate security deposit");y("security","Security Deposit",V);const N=D*S,R=Math.max(N-Math.max(c-a,0),0),O=function(e){let t=0;for(const n of e){const e=n.rate;t+=n.taxAmountInCents=Math.round(n.taxableAmountInCents*e.value/e.divisor)}return Math.max(t,0)},L=f,z=O(_),B=O(v);y("gst","GST/HST",z),y("pst","PST",B);const U=e=>e.map((e=>e.items.map((e=>e.name)).join(" + ")+" = "+(e.taxableAmountInCents/100).toFixed(2)+" @ "+(100*e.rate.value/e.rate.divisor).toFixed(2)+"% = "+(e.taxAmountInCents/100).toFixed(2))).join("; ");return{ok:!0,totalFinancedAmountInCents:c,basePaymentAmountInCents:D,paymentAmountInCents:F,gstHstOnPaymentAmountInCents:M,pstOnPaymentAmountInCents:E,gstHstFinancedAmountInCents:0,pstFinancedAmountInCents:0,costOfBorrowingAmountInCents:R,baseDueOnDeliveryAmountInCents:L,dueOnDeliveryAmountInCents:f,gstHstDueOnDeliveryAmountInCents:z,pstDueOnDeliveryAmountInCents:B,securityDepositAmountInCents:V,cashDownInCents:I,debug:{advancePaymentCount:1,subTotalAmount:(c/100).toFixed(2),subTotalList:u.map((e=>e.name+": "+(e.amountInCents/100).toFixed(2))).join("; "),taxablePaymentAmount:(P/100).toFixed(2),taxableSubTotalAmount:(h/100).toFixed(2),taxableSubTotalList:m.map((e=>e.name+": "+(e.amountInCents/100).toFixed(2))).join("; "),dueOnDeliveryAmount:(f/100).toFixed(2),dueOnDeliveryList:g.map((e=>e.name+": "+(e.amountInCents/100).toFixed(2))).join("; "),dueOnDeliveryGstHstTaxList:U(_),dueOnDeliveryPstTaxList:U(v)}}}}const l=a.__LeaseCalculator={calculateBasePaymentAmountInCents(e,t,n,i,r,s,o){let a;switch(e){case"annuity":{const e=i.value/i.divisor/s;if(Math.abs(e)>=1e-6){const i=(t/100-n/100/Math.pow(1+e,r))/((1-1/Math.pow(1+e,r-o))/e+o);a=Math.round(100*i)}else a=Math.round(Math.max(t-n,0)/r)}break;case"moneyfactor":{const e={value:i.value,divisor:24*i.divisor},s=Math.round(1e5*e.value/e.divisor)/1e5,o=Math.round(s*((t+n)*r));a=Math.round((t-n)/r)+Math.round(o/r)}break;default:throw new Error("kintsugi: invalid lease calculation method: "+JSON.stringify(e))}return Math.max(a,0)}};class c{static create(e){const t=e.type;switch(t){case"none":return u.instance;case"payment":return new h({ruleSettings:e.ruleSettings});default:throw new Error("kintsugi: invalid security deposit rule type: "+JSON.stringify(t))}}static get none(){return u.instance}tryCalculateInCents(e){throw new Error("kintsugi: tryCalculate() was not implemented")}toObject(e){throw new Error("kintsugi: toObject() was not implemented")}}class u extends c{static get instance(){return d.instance}tryCalculateInCents(e){return 0}toObject(e){return{type:"none"}}constructor(){if(super(),null!==d.instance)throw new Error("kintsugi: use NoneSecurityDepositRule.instance instead of constructing a new instance")}}const d=u.__NoneSecurityDepositRule={instance:null};d.instance=new u;class h extends c{constructor(e){super();const t=e.ruleSettings,n=m("cents",t.roundUpAmount||1);if(!Number.isSafeInteger(n)||n<100)throw new Error("kintsugi: the round-up amount must be at least one dollar");const i=m("cents",t.minimumAmount||0);if(!Number.isSafeInteger(i)||i<0)throw new Error("kintsugi: the minimum amount must be positive");this.__PaymentSecurityDepositRule={roundUpAmountInCents:n,minimumAmountInCents:i}}tryCalculateInCents(e){const t=e.calculator.clone().securityDepositRule({type:"none"}).paymentFrequency("monthly").numericReturnType("divisor").cashDownMethod("direct").cashDown({value:e.cashDownInCents,divisor:100}).tryCalculate();if(!t.ok)return null;const n=t.paymentAmount,i=Math.round(100*n.value/n.divisor),r=this.__PaymentSecurityDepositRule,s=r.roundUpAmountInCents;return Math.max(r.minimumAmountInCents,Math.ceil(i/s)*s)}toObject(e){const t=this.__PaymentSecurityDepositRule,n=e.numericReturnType;return{type:"payment",ruleSettings:{roundUpAmount:p(n,t.roundUpAmountInCents,100),minimumAmount:p(n,t.minimumAmountInCents,100)}}}}function m(e,t){let n=t;switch(e){case"identity":break;case"integer":n=null==n?null:parseInt(n);break;case"cents":if(null==n)n=null;else{const e=n.divisor;e?(n=n.value,"cents"!==e&&100!==e&&(n=(n>=0?1:-1)*Math.round(100*Math.abs(n)/e))):(n=parseFloat(n),n=(n>=0?1:-1)*Math.round(100*Math.abs(n)))}break;case"numeric":if(null!=n){let e=n.divisor;e?(n=n.value,"cents"===e&&(e=100)):(e=1e6,n=parseFloat(n),n=(n>=0?1:-1)*Math.round(Math.abs(n)*e)),n={value:n,divisor:e}}break;default:throw new Error("kintsugi: property adapter not implemented: "+JSON.stringify(e))}return n}function p(e,t,n){switch(e){case"float":return t/n;case"divisor":return{value:t,divisor:n};default:throw new Error("kintsugi: numeric return type invalid: "+JSON.stringify(e))}}const f={Calculator:r,LoanCalculator:o,LeaseCalculator:a,SecurityDepositRule:c,NoneSecurityDepositRule:u,PaymentSecurityDepositRule:h,calculateLuxuryTax:function(e){if(!e.purchasePrice)throw new Error("kintsugi: purchasePrice is missing");if(isNaN(e.purchasePrice))throw new Error("kintsugi: purchasePrice is invalid");if(!e.calculatedAt)throw new Error("kintsugi: calculatedAt is missing");if(!i.tryParseIsoDatetime(e.calculatedAt).valid)throw new Error("kintsugi: calculatedAt is invalid");const t=1e7,n=100*e.purchasePrice;return n<=t?0:Math.ceil(Math.min(.1*n,.2*(n-t)))/100},tryCalculateTradeInTaxBenefit:function(e){if(!e.tradeInAmount)throw new Error("kintsugi: tradeInAmount is missing");return"finance"===e.financeType?function(e){const t=e.interestRate||0,n=e.paymentFrequencyID||"monthly",i=e.termInMonths||60,r=(new o).numericReturnType("divisor").vehiclePrice(e.basePrice).termInMonths(i).paymentFrequency(n).interestRate(t).gstHstRate(e.gstHstRate).pstRate(e.pstRate).rebate({id:"rebate1",amount:e.preTaxRebateAmount,gstHst:!0,pst:!0}).tradeInDetails({id:"trade1",type:"tradein",amount:e.tradeInAmount,owingAmount:0}).item({id:"discount",amount:-e.discountAmount}).zeroMissingItems(),s=(new o).numericReturnType("divisor").vehiclePrice(e.basePrice).termInMonths(i).paymentFrequency(n).interestRate(t).gstHstRate(e.gstHstRate).pstRate(e.pstRate).rebate({id:"rebate1",amount:e.preTaxRebateAmount,gstHst:!0,pst:!0}).item({id:"discount",amount:-e.discountAmount}).zeroMissingItems(),a=r.tryCalculate(),l=s.tryCalculate();if(!a.ok||!l.ok)return null;const c=a.gstHstFinancedAmount.value/a.gstHstFinancedAmount.divisor+a.pstFinancedAmount.value/a.pstFinancedAmount.divisor;return(l.gstHstFinancedAmount.value/l.gstHstFinancedAmount.divisor+l.pstFinancedAmount.value/l.pstFinancedAmount.divisor-c).toFixed(2)}({basePrice:e.basePrice,discountAmount:e.discountAmount,preTaxRebateAmount:e.preTaxRebateAmount,gstHstRate:e.gstHstRate,pstRate:e.pstRate,tradeInAmount:e.tradeInAmount,interestRate:e.interestRate,paymentFrequencyID:e.paymentFrequencyID,termInMonths:e.termInMonths}):"lease"===e.financeType?function(e){const t=(new a).numericReturnType("divisor").vehiclePrice(e.basePrice).termInMonths(e.termInMonths).residualAmount(e.residualAmount).cashDown(e.cashDown||0).cashDownMethod("due").paymentFrequency(e.paymentFrequencyID).interestRate(e.interestRate).gstHstRate(e.gstHstRate).pstRate(e.pstRate).rebate({id:"rebate1",amount:e.preTaxRebateAmount,gstHst:!0,pst:!0}).item({id:"discount",amount:-e.discountAmount}).tradeInDetails({id:"trade1",type:"tradein",amount:e.tradeInAmount,owingAmount:0}).zeroMissingItems(),n=(new a).numericReturnType("divisor").vehiclePrice(e.basePrice).termInMonths(e.termInMonths).residualAmount(e.residualAmount).cashDown(e.cashDown||0).cashDownMethod("due").paymentFrequency(e.paymentFrequencyID).interestRate(e.interestRate).gstHstRate(e.gstHstRate).pstRate(e.pstRate).item({id:"discount",amount:-e.discountAmount}).rebate({id:"rebate1",amount:e.preTaxRebateAmount,gstHst:!0,pst:!0}).zeroMissingItems(),i=t.tryCalculate(),r=n.tryCalculate();if(!i.ok||!r.ok)return null;const s=i.gstHstOnPaymentAmount.value/i.gstHstOnPaymentAmount.divisor+i.pstOnPaymentAmount.value/i.pstOnPaymentAmount.divisor,o=r.gstHstOnPaymentAmount.value/r.gstHstOnPaymentAmount.divisor+r.pstOnPaymentAmount.value/r.pstOnPaymentAmount.divisor;let l=null;switch(e.paymentFrequencyID){case"monthly":l=12;break;case"biweekly":l=26;break;case"semimonthly":l=24;break;case"weekly":l=52;break;default:throw Error("Unknown payment frequency ID")}return(e.termInMonths/12*(o-s)*l).toFixed(2)}({basePrice:e.basePrice,discountAmount:e.discountAmount,preTaxRebateAmount:e.preTaxRebateAmount,gstHstRate:e.gstHstRate,pstRate:e.pstRate,tradeInAmount:e.tradeInAmount,interestRate:e.interestRate,paymentFrequencyID:e.paymentFrequencyID,termInMonths:e.termInMonths,cashDown:e.cashDown,residualAmount:e.residualAmount}):function(e){const t=e.basePrice-e.discountAmount-e.preTaxRebateAmount,n=t,i=Math.max(0,t-e.tradeInAmount),r=Math.floor(100*e.gstHstRate+100*e.pstRate)/100;return(Math.round(n*r*100)/100-Math.round(i*r*100)/100).toFixed(2)}({basePrice:e.basePrice,discountAmount:e.discountAmount,preTaxRebateAmount:e.preTaxRebateAmount,gstHstRate:e.gstHstRate,pstRate:e.pstRate,tradeInAmount:e.tradeInAmount})},tryCalculatePotentialTradeInTaxBenefit:function(e){const t=Math.floor(100*e.gstHstRate+100*e.pstRate)/100;return(e.tradeInAmount*t).toFixed(2)}};e.exports=f},3784:(e,t,n)=>{"use strict";const i=n(3567),r={en:{numberFormats:{number:{decimalPoint:".",groupingPoint:",",groupLengths:[3],positiveFormatMap:{"":"#"},negativeFormatMap:{"":"-#","-":"-#","()":"(#)"},positiveFormat:"",negativeFormat:"",decimalPlaces:[0,6],symbol:"",symbolPlaceholder:null,premultiplier:1},currency:{decimalPoint:".",groupingPoint:",",groupLengths:[3],positiveFormatMap:{"":"$ #"},negativeFormatMap:{"":"-$ #","-":"-$ #","()":"($ #)"},positiveFormat:"",negativeFormat:"",decimalPlaces:2,symbol:"$",symbolPlaceholder:"$",premultiplier:1},percent:{decimalPoint:".",groupingPoint:",",groupLengths:[3],positiveFormatMap:{"":"# %"},negativeFormatMap:{"":"-# %","-":"-# %"},positiveFormat:"",negativeFormat:"",decimalPlaces:[0,2],symbol:"%",symbolPlaceholder:"%",premultiplier:100}},daysOfWeek:{full:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],short:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]},months:{full:["January","February","March","April","May","June","July","August","September","October","November","December"],short:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]}}};let s="en-CA";function o(e){s=e,u&&("setlocale"in u?u.setlocale(e):"setLocale"in u&&u.setLocale(e))}function a(e,t){if(t&&0!==t.length){let n,i;Array.isArray(t)?(n=a(e,t.slice(0,-1)),i=t[t.length-1]):(n=a(e),i=t);let r=n[i];if(r)return r;const s=e.lastIndexOf("-"),o=s>=0?e.substring(0,s):"en";return n[i]=r=a(o,t),r}{let t=r[e];if(t)return t;const n=e.lastIndexOf("-"),i=n>=0?e.substring(0,n):"en";return r[e]=t=a(i),t}}let l="messages";const c={setlocale(){},textdomain(e){const t=l;return null!=e&&(l=e),t},setMessages(){throw new Error("kintsugi: uou must use an actual gettext provider and call setGettextProvider in order to use setMessages()")},dcnpgettext:(e,t,n,i,r)=>null==r||1===r?n:i};let u=c,d=null;function h(){let e=u;if(!e){if(!d)throw new Error("kintsugi: gettext support not initialized; you must call setGettextProvider()");if(e="textdomain"in d?d:d(),"strfmt"in e){const t=e;e={setlocale:e.setLocale,textdomain:e.textdomain,setMessages:function(){return p.apply(t,arguments)},dcnpgettext:function(){return m.apply(t,arguments)}}}e.setlocale(s),u=e,d=null}return e}function m(e,t,n,i,r){const s=n?n.replace(/%/g,"%%"):n,o=i?i.replace(/%/g,"%%"):i;return this.dcnpgettext(e,t,s,o,r)}function p(e,t,n,i){const r={};for(const e in n)if(n.hasOwnProperty(e)){const t=n[e],i=e.replace(/%/g,"%%"),s=Array.isArray(t)?t.map((e=>e.replace(/%/g,"%%"))):t.replace(/%/g,"%%");r[i]=s}return this.setMessages(e,t,r,i)}function f(e,t,n,i,r){return h().dcnpgettext(e,t,n,i,r)}function g(e){e&&"object"==typeof e||(e={value:e});const t=e.value;if(!t&&0!==t)return"";let n=e.format||"number";"default"===n&&(n="number");const i=a(s,"numberFormats");let r=i[n];r||(console.warn("kintsugi: invalid number format "+JSON.stringify(n)),r=i.default);const o=r.decimalPoint,l=r.groupingPoint,c=r.groupLengths,u=r.positiveFormatMap,d=r.negativeFormatMap,h=r.positiveFormat,m=null==e.negativeFormat?r.negativeFormat:e.negativeFormat,p=null==e.decimalPlaces?r.decimalPlaces:e.decimalPlaces,f=(void 0===e.symbol?r.symbol:e.symbol)||"",g=r.symbolPlaceholder,y=r.premultiplier;let _,v;Array.isArray(p)?[_,v]=p:_=v=p;let w,b,x=e.divisor;if("cents"===x&&(x=100),null==x){let e=Math.abs(t*y);const n=Math.pow(10,v),i=(Math.round(e*n)/n).toFixed(v),r=i.indexOf(".");r>=0?(w=i.substring(0,r),b=i.substring(r+1)):(w=i,b="")}else{let e=Math.floor(Math.abs(t))*y,n=Math.floor(e/x),i=e%x,r=Math.log10(x);if(r>v){e+=5*Math.pow(10,r-v-1),e=Math.floor(e/Math.pow(10,r-v));const t=Math.pow(10,v);n=Math.floor(e/t),i=e%t,r=v}w=n.toString(),b=v>0?i.toString().padStart(r,"0").padEnd(_,"0"):""}let I=b.length;if(I>_&&"0"===b[I-1]){do{--I}while(I>_&&"0"===b[I-1]);b=b.substring(0,I)}if(l){const e=[];for(let t=0,n=w.length;n>0;++t){const i=c[Math.min(t,c.length-1)];e.push(w.substring(Math.max(0,n-i),n)),n-=i}e.reverse(),w=e.join(l)}const C=b?w+o+b:w;let k=t>=0?u[h]:d[m];return g&&f!==g&&(k=k.replace(g,f),f||(k=k.replace(/\u202f/g,""))),k=k.replace("#",C),k}function y(){const e=arguments;let t,n;if(e.length<=2)t=e[0],n=e[1];else{const i=new Date("2000-01-01");i.setUTCFullYear(e[0],e[1]-1,e[2]),t=i.getUTCDay(),n=e[3]}return t||0===t?a(s,"daysOfWeek")[n||"full"][t]:""}function _(e,t){return e?a(s,"months")[t||"full"][e-1]:""}function v(){const e=arguments;let t,n;if(e.length<=2?(t=e[0],t instanceof Date&&(t=t.getFullYear().toString().padStart(4,"0")+"-"+(t.getMonth()+1).toString().padStart(2,"0")+"-"+t.getDate().toString().padStart(2,"0")),n=e[1]):(t=e[0].toString().padStart(4,"0")+"-"+e[1].toString().padStart(2,"0")+"-"+e[2].toString().padStart(2,"0"),n=e[3]),!t)return"";const r=i.tryParseIsoDate(t);if(!r.complete)return t;const s=r.year,o=r.month,a=r.day;switch(n||"short-text"){case"iso":return r.value;case"short-text":return _(o,"short")+" "+a.toString().padStart(2,"0")+" "+s.toString().padStart(4,"0");case"short-dow":return y(s,o,a,"short")+" "+_(o,"short")+" "+a.toString().padStart(2,"0")+" "+s.toString().padStart(4,"0");case"short-text-nozero":return _(o,"short")+" "+a+" "+s;case"short-dow-nozero":return y(s,o,a,"short")+" "+_(o,"short")+" "+a+" "+s;case"long-text":return _(o,"full")+" "+a+", "+s;case"long-dow":return y(s,o,a,"full")+", "+_(o,"full")+" "+a+", "+s;default:return t}}function w(e,t){if(!e)return"";let n,r,s,o;if(e instanceof Date)n=e.getHours(),r=e.getMinutes(),s=e.getSeconds(),o=e.getMilliseconds();else{const t=i.tryParseIsoTime(e);if(!t.valid)return e;n=t.hour,r=t.minute,s=t.second,o=t.millisecond}const a=n>=12?"PM":"AM";let l;switch(l=0===n?12:n<=12?n:n-12,t||"short-text"){case"short-text":{const e=r.toString().padStart(2,"0");return l.toString().padStart(2,"0")+":"+e+" "+a}case"short-text-nozero":return l+":"+r.toString().padStart(2,"0")+" "+a;case"short-text-withseconds":return l+":"+r.toString().padStart(2,"0")+":"+s.toString().padStart(2,"0")+" "+a;case"short-text-withmilliseconds":return l+":"+r.toString().padStart(2,"0")+":"+s.toString().padStart(2,"0")+"."+o.toString().padStart(3,"0")+" "+a;default:throw new Error("kintsugi: invalid time format "+JSON.stringify(t))}}let b="undefined"!=typeof document?document.documentElement.getAttribute("lang"):null;b&&"en"!==b||(b="en-CA"),o(b);const x={setGettextProvider:function(e){const t=u||d;return e?(u=null,d=e):(u=c,d=null),t===c?null:t},setMessages:function(e,t,n,i){h().setMessages(e,t,n,i)},textdomain:function(e){const t=h().textdomain,n=t();return e&&t(e),n},setlocale:o,gettext:function(e){return f(void 0,void 0,e,void 0,void 0)},dgettext:function(e,t){return f(e,void 0,t,void 0,void 0)},pgettext:function(e,t){return f(void 0,e,t,void 0,void 0)},dpgettext:function(e,t,n){return f(e,t,n,void 0,void 0)},ngettext:function(e,t,n){return f(void 0,void 0,e,t,n)},npgettext:function(e,t,n,i){return f(void 0,e,t,n,i)},dngettext:function(e,t,n,i){return f(e,void 0,t,n,i)},dnpgettext:function(e,t,n,i,r){return f(e,t,n,i,r)},formatNumber:g,formatCurrency:function(e){return e&&"object"==typeof e?null==e.format&&(e=Object.assign({format:"currency"},e)):e={value:e,format:"currency"},g(e)},formatPercent:function(e){return e&&"object"==typeof e?null==e.format&&(e=Object.assign({format:"percent"},e)):e={value:e,format:"percent"},g(e)},formatDayOfWeek:y,formatMonth:_,formatDate:v,formatTime:w,formatDatetime:function(e,t){if(!e)return"";let n,r,s,o,a,l,c,u,d;if(e instanceof Date)n=e.getFullYear(),r=e.getMonth()+1,s=e.getDate(),o=e.getHours(),a=e.getMinutes(),l=e.getSeconds(),c=e.getMilliseconds();else{const t=i.tryParseIsoDatetime(e);if(!t.valid)return e;n=t.year,r=t.month,s=t.day,o=t.hour,a=t.minute,l=t.second,c=t.millisecond}switch(t||"short-text"){case"short-text":u="short-text",d="short-text";break;case"short-dow":u="short-dow",d="short-text";break;case"short-text-nozero":u="short-text-nozero",d="short-text-nozero";break;case"short-dow-nozero":u="short-dow-nozero",d="short-text-nozero";break;case"long-text":u="long-text",d="short-text-nozero";break;case"long-dow":u="long-dow",d="short-text-nozero";break;default:throw new Error("kintsugi: invalid date format "+JSON.stringify(t))}const h=o.toString().padStart(2,"0")+":"+a.toString().padStart(2,"0")+":"+l.toString().padStart(2,"0")+"."+c.toString().padStart(3,"0");return v(n,r,s,u)+" "+w(h,d)}};e.exports=x},2250:(e,t,n)=>{"use strict";const i={};Object.assign(i,n(3567)),Object.assign(i,{device:n(4074),select:n(4672),animation:n(360),events:n(9729)}),e.exports=i},7240:e=>{"use strict";class t{constructor(e){Object.defineProperty(this,"_base",{value:e})}toArray(){return Array.from(this)}toSortedArray(e){return Array.from(this).sort(e)}map(e,t){return new n(this,e,t)}filter(e,t){return new i(this,e,t)}slice(e,t){return e>=0&&(t>=0||void 0===t)?new r(this,e,t):void 0!==e||void 0!==t?new s(this,e,t):this}distinct(){const e=this;return new t(function*(){const t=[];for(const n of e)t.includes(n)||(yield n,t.push(n))}())}concat(){const e=arguments;if(0===e.length)return this;const n=this;return new t(function*(){yield*n;for(const t of e)t&&t[Symbol.iterator]?yield*t:yield t}())}some(e,t){let n=0;for(const i of this)if(e.call(t,i,n++))return!0;return!1}every(e,t){let n=0;for(const i of this)if(!e.call(t,i,n++))return!1;return!0}find(e,t){let n=0;for(const i of this)if(e.call(t,i,n++))return i}findIndex(e,t){let n=0;for(const i of this){if(e.call(t,i,n))return n;++n}return-1}forEach(e,t){let n=0;for(const i of this)e.call(t,i,n++)}indexOf(e,t){if(void 0===t&&(t=0),!(t>=0)){let n=-1,i=0;for(const t of this)e===t&&(n=i),++i;return n>=i+t?n:-1}{const n=this[Symbol.iterator]();let i=0;for(;i<t;){if(n.next().done)return-1;++i}for(;;){const t=n.next();if(t.done)return-1;if(e===t.value)return i;++i}}}includes(e,t){return this.indexOf(e,t)>=0}lastIndexOf(e,t){if(void 0!==t&&-1!==t||(t=Number.MAX_SAFE_INTEGER),t>=0){let n=-1,i=0;for(const r of this){if(!(i<=t))break;r===e&&(n=i),++i}return n}return this.slice(0,t+1).lastIndexOf(e)}count(e){const t=this._base;if(null==e){if(Array.isArray(t))return t.length;{let e=0;for(const n of t)++e;return e}}{let n=0,i=0;for(const r of t)e(r,n++)&&++i;return i}}reduce(e,t){const n=this[Symbol.iterator]();let i,r=0;if(arguments.length>1)i=t;else{const e=n.next();if(e.done)throw new TypeError("Cannot reduce an empty iterator");i=e.value,++r}for(;;){const t=n.next();if(t.done)break;i=e(i,t.value,r++)}return i}nth(e){if(e>=0){const t=this[Symbol.iterator]();let n=e;for(;;){const e=t.next();if(e.done)return;if(--n<0)return e.value}}}first(){const e=this[Symbol.iterator]().next();return e.done?void 0:e.value}join(e){return Array.from(this).join(e)}[Symbol.iterator](){return this._base[Symbol.iterator]()}}class n extends t{constructor(e,t,n){super(e),this.__callback=t,this.__thisArg=n}*[Symbol.iterator](){const e=this.__callback,t=this.__thisArg;let n=0;for(const i of this._base)yield e.call(t,i,n++)}}class i extends t{constructor(e,t,n){super(e),this._callback=t,this._thisArg=n}*[Symbol.iterator](){const e=this._callback,t=this._thisArg;let n=0;for(const i of this._base)e.call(t,i,n++)&&(yield i)}}class r extends t{constructor(e,t,n){super(e),this.__start=t,this.__end=void 0===n?1/0:n}*[Symbol.iterator](){const e=this._base[Symbol.iterator](),t=this.__start;let n=0;for(;n<t;){if(e.next().done)return;++n}const i=this.__end;for(;n<i;){const t=e.next();if(t.done)return;yield t.value,++n}}}class s extends t{constructor(e,t,n){super(e),this.__start=t,this.__end=void 0===n?1/0:n}*[Symbol.iterator](){let e=this.__start,t=this.__end;const n=e<0?-e:-t,i=new Array(n),r=this._base[Symbol.iterator]();let s=0;for(;s<n;){const e=r.next();if(e.done)break;i[s++]=e.value}if(s<n)return i.length=s,void(yield*i.slice(e,t));let o=0;for(s=0;;){const a=r.next();if(a.done)break;if(t>=0&&o>=t)return;e>=0&&o>=e&&(yield i[s]),i[s]=a.value,s=(s+1)%n,++o}e<0&&(e=o+n+e),t<0&&(t=o+n+t);const a=s;do{if(o>=t)break;o>=e&&(yield i[s]),++o,s=(s+1)%n}while(s!==a)}}function o(e){return new t(e)}Object.assign(o,{range:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;if(!Number.isSafeInteger(e)||!Number.isSafeInteger(t)||!Number.isSafeInteger(n))throw new Error("kintsugi: range values must be integers");if(n>0){if(e<=t)return o(function*(){let i=e;for(;i<t;)yield i,i+=n}());throw new Error("kintsugi: range stop cannot be less than the start")}if(n<0){if(e>=t)return o(function*(){let i=e;for(;i>t;)yield i,i+=n}());throw new Error("kintsugi: range stop cannot be greater than the start when the step is negative")}throw new Error("kintsugi: range step cannot be zero")},Iterable:t}),e.exports=o},8182:(e,t,n)=>{const i=n(3567),r=n(360);class s{renderNewAsync(e){throw new Error("kintsugi: method not implemented")}refreshAsync(e){return Promise.resolve()}changeAsync(e){return this.removeAsync({element:e.element}).then((()=>this.renderNewAsync(e)))}removeAsync(e){throw new Error("kintsugi: method not implemented")}}class o extends s{async renderNewAsync(e){const t=e.element,n=document.createElement("div");n.classList.add("ks-notification-popup"),n.classList.add("ks-notification-type-"+e.messageType),n.setAttribute("role","alert"),n.style.opacity="0";const i=document.createElement("div");i.classList.add("ks-notification-icon"),i.setAttribute("aria-hidden","true");const s=document.createElement("div");s.classList.add("ks-notification-text"),s.innerHTML=e.messageHtml;const o=t.getBoundingClientRect(),a=o.width>100&&o.width<600&&o.height>40&&o.height<60;if("static"===t.style.position&&(t.style.position="absolute"),a?(n.style.top=o.height-8+"px",n.style.left="24px",n.style.marginRight="-8px"):(n.style.top="50%",n.style.left="50%",n.style.marginRight="-50%",n.style.transform="translate(-50%, -50%)"),n.appendChild(i),n.appendChild(s),t.appendChild(n),document.body.contains(t)){const e=new r.FadeInAnimation({target:n});await e.start()}}async removeAsync(e){const t=e.element,n=t.querySelector(".ks-notification-popup");if(n){if(document.body.contains(t)){const e=new r.FadeOutAnimation({target:n});await e.start()}n.remove()}}}class a{static get default(){let e=l.defaultInstance;return e||(l.defaultInstance=e=new a({renderer:new o})),e}constructor(e){var t;const n={renderer:e.renderer,timeoutProvider:null!==(t=e.timeoutProvider)&&void 0!==t?t:i.TimeoutProvider.default,queue:[]};Object.defineProperty(this,"__NotificationManager",{value:n})}get defaultDurationMilliseconds(){return 2e3}show(e){var t,n;const r=this.__NotificationManager,s=r.queue,o=e.for,a=e.message,c=null!==(t=e.messageType)&&void 0!==t?t:"info",u=null!==(n=e.format)&&void 0!==n?n:"text";let d;switch(u){case"text":d=i.htmlEscape(a);break;case"html":d=a;break;default:throw new Error("kintsugi: invalid notification format: "+JSON.stringify(u))}if(o.ownerDocument!==document)throw new Error("kintsugi: notification element is not on the document");let h,m,p=o;for(;null!=p&&!["DIV","FORM","BODY","SECTION"].includes(p.tagName);)p=p.parentElement;for(const e of s)if(e.element===p&&"removed"!==e.state&&(h||(h=e),!m&&e.messageType===c&&e.messageHtml===d&&["pending","rendering","rendered","refreshing"].includes(e.state))){m=e;break}if(m)m===h&&l.refreshNotificationIfAppropriate(this,h);else{const e={element:p,messageType:c,messageHtml:d,state:"pending",displayedAtMilliseconds:null,initialDurationMilliseconds:this.defaultDurationMilliseconds,removeAtMilliseconds:null};h||(e.state="rendering",r.renderer.renderNewAsync({element:p,messageType:c,messageHtml:d}).then((()=>l.afterNotificationRenderedAsync(this,e))).finally((()=>{l.cleanUpNotification(this,e)})).catch((e=>{console.error(e)}))),s.push(e)}}}const l=a.__NotificationManager={defaultInstance:null,async afterNotificationRenderedAsync(e,t){const n=e.__NotificationManager,i=t.element,r=n.renderer,s=n.timeoutProvider,o=n.queue,a=s.getCurrentMilliseconds();t.state="rendered",t.displayedAtMilliseconds=a,t.removeAtMilliseconds=a+t.initialDurationMilliseconds;let c=a;for(;await s.timeoutAsync(Math.max(0,t.removeAtMilliseconds-c)),c=s.getCurrentMilliseconds(),!(c>=t.removeAtMilliseconds););t.state="removing";const u=n.queue.find((e=>e.element===i&&"pending"===e.state));if(u?(u.state="rendering",await r.changeAsync({element:i,messageType:u.messageType,messageHtml:u.messageHtml})):await r.removeAsync({element:i}),t.state="removed",u)l.afterNotificationRenderedAsync(e,u).finally((()=>{l.cleanUpNotification(e,u)})).catch((e=>{console.error(e)}));else{const t=o.find((e=>e.element===i&&"pending"===e.state));t&&(t.state="rendering",r.renderNewAsync({element:i,messageType:t.messageType,messageHtml:t.messageHtml}).then((()=>l.afterNotificationRenderedAsync(e,t))).finally((()=>{l.cleanUpNotification(e,t)})).catch((e=>{console.error(e)})))}},cleanUpNotification(e,t){const n=e.__NotificationManager,i=n.queue.indexOf(t);i>=0&&n.queue.splice(i,1)},refreshNotificationIfAppropriate(e,t){if("rendered"===t.state){const n=e.__NotificationManager,i=n.timeoutProvider.getCurrentMilliseconds();t.removeAtMilliseconds-i<500&&(t.state="refreshing",n.renderer.refreshAsync({element:t.element,messageType:t.messageType,messageHtml:t.messageHtml}).finally((function(){t.state="rendered",t.removeAtMilliseconds=n.timeoutProvider.getCurrentMilliseconds()+e.defaultDurationMilliseconds})))}}},c={NotificationRenderer:s,NotificationManager:a,show:function(e){return a.default.show(e)}};e.exports=c},4672:(e,t,n)=>{"use strict";const i=n(3567),r=n(4074),s=n(9729),o=n(360);class a{constructor(e,t){let n=0;if(e){const i=t?a.__resolveCriteria(t):null,r=a.__resolveCriteria(e,i);n=r.length;for(let e=0;e<n;++e)this[e]=r[e]}this.__Selection={length:n}}get length(){return this.__Selection.length}[Symbol.iterator](){return Array.prototype[Symbol.iterator].call(this)}is(e){const t=this.__Selection;if(t.length>0)if(new a,"string"==typeof e)for(let n=0,r=t.length;n<r;++n){const t=this[n];if(i.matchesSelector(t,e))return!0}else if("function"==typeof e)for(let n=0,i=t.length;n<i;++n){const t=this[n];if(e.call(t,n,t))return!0}else if(i.isDomElement(e))return Array.prototype.indexOf.call(this,e)>=0;return!1}filter(e){const t=this.__Selection,n=new a;if("string"==typeof e)for(let r=0,s=t.length;r<s;++r){const t=this[r];i.matchesSelector(t,e)&&n.__append(t)}else if("function"==typeof e)for(let i=0,r=t.length;i<r;++i){const t=this[i];e.call(t,i,t)&&n.__append(t)}else e instanceof Element&&Array.prototype.indexOf.call(this,e)>=0&&n.__append(e);return n}find(e){return new a(e,this)}closest(e){const t=[];for(let n of this){const r=i.closestElement(n,e);r&&t.push(r)}return new a(t)}each(e){for(let t=0,n=this.__Selection.length;t<n;++t){const n=this[t];if(!1===e.call(n,t,n))break}return this}attr(){const e=arguments[0];if(1===arguments.length&&"string"==typeof e){const t=this[0];return t?t.getAttribute(e):void 0}if("object"==typeof e)return this.each(((t,n)=>{for(let t in e){const i=e[t];null===i?n.removeAttribute(t):n.setAttribute(t,i)}}));{const t=arguments[1];return null!==t?this.each(((n,i)=>{i.setAttribute(e,t)})):this.each(((t,n)=>{n.removeAttribute(e)}))}}removeAttr(e){const t=e.split(" ");return this.each(((e,n)=>{for(let e of t)n.removeAttribute(e)}))}css(){const e=arguments[0];if(1===arguments.length&&"string"==typeof e){const t=this[0];return t?t.style[e]:void 0}if("object"==typeof e)return this.each(((t,n)=>{for(let t in e){const i=e[t];""===i?n.style.removeProperty(t):n.style.setProperty(t,i)}}));{const t=arguments[1];return""===t?this.each(((t,n)=>{n.style.removeProperty(e)})):this.each(((n,i)=>{i.style.setProperty(e,t)}))}}addClass(e){if(e&&e.length>0&&this[0]){const t="string"==typeof e?e.split(" "):e;return this.each(((e,n)=>{const i=n.classList;for(let e of t)i.add(e)}))}return this}removeClass(e){if(e&&e.length>0&&this[0]){const t="string"==typeof e?e.split(" "):e;return this.each(((e,n)=>{const i=n.classList;for(let e of t)i.remove(e)}))}return this}toggleClass(e,t){return t?this.addClass(e):this.removeClass(e)}hasClass(e){let t=!1;return this[0]&&this.each(((n,i)=>(t=i.classList.contains(e),!t))),t}uniqueId(){return this.each(((e,t)=>{i.ensureID(t)}))}html(e){if(arguments.length>0)return this.each(((t,n)=>{n.innerHTML=e}));{const e=this[0];return e?e.innerHTML:void 0}}text(e){if(arguments.length>0)return this.each(((t,n)=>{n.textContent=e}));{const e=this[0];return e?e.textContent:void 0}}empty(){return this.each(((e,t)=>{t.innerHTML=""}))}trigger(e){return this.each(((t,n)=>{s.dispatchEvent(n,e)}))}on(e,t){const n=e.split(" ");return this.each(((e,i)=>{for(let e of n)i.addEventListener(e,t)}))}one(e,t){const n=e.split(" ");if(r.isIE()){const n=e=>{e.currentTarget.removeEventListener(e.type,n),t.call(this,e)};return this.on(e,n)}return this.each(((e,i)=>{for(let e of n)i.addEventListener(e,t,{once:!0})}))}off(e,t){const n=e.split(" ");return this.each(((e,i)=>{for(let e of n)i.removeEventListener(e,t)}))}val(e){if(0===arguments.length){const e=this[0];return e?e.value:void 0}return this.each(((t,n)=>{n.value=e}))}focus(){const e=this[0];return e&&e.focus(),this}blur(){const e=document.activeElement;return e&&this.is(e)&&e.blur(),this}show(){return this.each(((e,t)=>{if(!i.isVisible(t)){const e=a.__elementData(t);t.style.display=e.lastHiddenDisplay||"block"}}))}hide(){return this.__hide((e=>{e.style.display="none"}))}stop(e,t){return o.Animation.forEachRunning((n=>{if(n.queueTag&&Array.prototype.indexOf.call(this,n.queueTag)>=0){const i=n.isQueued;t&&!i?n.complete():!e&&i||n.cancel()}})),this}slideDown(e){const t={target:null,duration:(e=e||{}).duration,easing:e.easing,queue:!1!==e.queue,complete:e.complete};return this.each(((e,n)=>{t.target=n,new o.SlideDownAnimation(t).start()})),this}slideUp(e){const t={target:null,duration:(e=e||{}).duration,easing:e.easing,queue:!1!==e.queue,complete:e.complete};return this.__hide((e=>{t.target=e,new o.SlideUpAnimation(t).start()}))}fadeIn(e){const t={target:null,duration:(e=e||{}).duration,easing:e.easing,queue:!1!==e.queue,complete:e.complete};return this.each(((e,n)=>{t.target=n,new o.FadeInAnimation(t).start()})),this}fadeOut(e){const t={target:null,duration:(e=e||{}).duration,easing:e.easing,queue:!1!==e.queue,complete:e.complete};return this.each(((e,n)=>{t.target=n,new o.FadeOutAnimation(t).start()})),this}appendTo(e){if("string"==typeof e&&(e=document.querySelectorAll(e)),e&&!i.isDomElement(e)){if(e.length>1)throw new Error("kintsugi: cannot append to multiple targets");e=e[0]}return e?this.each(((t,n)=>{e.appendChild(n)})):this}remove(){return this.each(((e,t)=>{const n=t.parentElement;n&&n.removeChild(t)}))}click(){return this.each(((e,t)=>{t.click()}))}static __resolveCriteria(e,t){if(!e||0===e.length&&Array.isArray(e)||t&&0===t.length)return[];if("string"==typeof e||i.isDomElement(e))e=[e];else if(!e[Symbol.iterator])throw new Error("kintsugi: invalid criteria for selection: "+Object.prototype.toString.call(e));const n=[];for(let r of e)if("string"==typeof r)if(t)for(let e of t)n.push.apply(n,e.querySelectorAll(r));else n.push.apply(n,document.querySelectorAll(r));else if(i.isDomElement(r))if(t){for(let e of t)if(e.contains){if(e.contains(r)){n.push(r);break}}else if(r.ownerDocument===e){n.push(r);break}}else n.push(r);else{if(!(r instanceof a))throw new Error("kintsugi: invalid criteria for selection: "+ +Object.prototype.toString.call(r));if(t)for(let e of r)for(let i of t)i.contains?i.contains(e)&&n.push(e):e.ownerDocument===i&&n.push(e);else n.push.apply(n,r)}for(let e=n.length-1;e>0;--e){const t=n[e];n.indexOf(t)<e&&n.splice(e,1)}return n}__append(e){return this[this.__Selection.length++]=e,this}__hide(e){return this.each(((t,n)=>{const i=getComputedStyle(n).display;"none"!==i&&(a.__elementData(n).lastHiddenDisplay=i,e(n))}))}static __elementData(e){const t=l.elementDataMap;let n=t.get(e);return n||t.set(e,n={}),n}}const l=a.__Selection={elementDataMap:new WeakMap};function c(e,t){return new a(e,t)}Object.assign(c,{Selection:a}),e.exports=c},9331:e=>{"use strict";class t{constructor(e){"string"==typeof e&&(e={pattern:e});const t=e.pattern||"",i=n.parsePattern(t);this.__TextMask={pattern:t,components:i}}get pattern(){return this.__TextMask.pattern}get isNumeric(){const e=this.__TextMask;let t=e.isNumeric;if(void 0===t){t=!0;for(let n of e.components)if("match"===n.type&&!n.isNumeric){t=!1;break}e.isNumeric=t}return t}evaluate(e){e&&"string"!=typeof e||(e={value:e});const t=this.__TextMask,n=(e.value||"").toString(),i=n.length,r=t.components,s=r.length;let o=0,a=0;const l=[],c=[];let u,d=0,h=0;for(;o<s&&a<i;){const e=r[o];switch(e.type){case"literal":{++o;const t=e.value;c.push(t),d+=t.length}break;case"match":{u=e.match(n,a);const t=u.text;h=t.length,++o,l.push(t),c.push(t),d+=u.text.length,a+=u.consume}break;default:throw new Error("kintsugi: component type not handled: "+e.type)}}const m=r[o-1],p=m&&"match"===m.type?Math.max(0,m.minLength-h):0;if(!p&&o<s){const e=r[o];if("literal"===e.type){++o;const t=e.value;c.push(t),d+=t.length}}const f=c.join(""),g=l.join(""),y=o===s&&0===p,_=[f],v=e.placeholder||"_";for(p>0&&_.push(v.repeat(p));o<s;++o){const e=r[o];switch(e.type){case"literal":_.push(e.value);break;case"match":_.push(v.repeat(e.minLength));break;default:throw new Error("kintsugi: component type not handled: "+e.type)}}return{complete:y,value:n,data:g,formatted:f,display:_.join("")}}}const n=t.__TextMask={parsePattern(e){const t=[];let i=0;const r=e.length;for(;i<r;){let s=e[i];switch(s){case"9":case"A":case"*":{const o=i++;for(;i<r&&e[i]===s;)++i;const a=i-o,l=a;let c,u=!1;switch(s){case"A":c=(e,t)=>n.matchChars(e,t,(e=>e>="A"&&e<="Z"||e>="a"&&e<="z"),l);break;case"9":c=(e,t)=>n.matchChars(e,t,(e=>e>="0"&&e<="9"),l),u=!0;break;case"*":c=(e,t)=>n.matchChars(e,t,(e=>e>="A"&&e<="Z"||e>="a"&&e<="z"||e>="0"&&e<="9"),l);break;default:throw new Error("kintsugi: match character not handled: "+s)}const d={type:"match",match:c,minLength:a,maxLength:l,isNumeric:u};t.push(d)}break;case'"':case"'":{const n=++i;for(;i<r&&e[i]!==s;)++i;let o;o=i<r?e.substring(n,i++):e.substring(n,i),t.push({type:"literal",value:o})}break;case"\\":++i<r&&t.push({type:"literal",value:e[i++]});break;default:{const n=i;for(;(s<"0"||s>"9")&&(s<"a"||s>"z")&&(s<"A"||s>"Z")&&"*"!==s&&"{"!==s&&"}"!==s&&"["!==s&&"]"!==s&&"\\"!==s&&"'"!==s&&'"'!==s&&++i<r;)s=e[i];if(i===n)throw new Error("kintsugi: text mask contains reserved character: "+s);t.push({type:"literal",value:e.substring(n,i)})}}}for(i=t.length;i>1;){const e=t[--i];if("literal"===e.type){const n=t[i-1];"literal"===n.type&&(n.value+=e.value,t.splice(i,1))}}return t},matchChars(e,t,n,i){let r=t;const s=e.length;let o="";for(;r<s;){const t=e[r++];if(n(t)&&(o+=t,o.length>=i))break}return{text:o,consume:r-t}}},i={TextMask:t};e.exports=i},233:(e,t,n)=>{const i=n(3567);class r{static create(e){const t=e.video;let n,r;if("string"==typeof t)n="{"===t[0]?JSON.parse(t):s.getConfigurationFromUrlOrSchemeString(t);else if(t instanceof URL)n=s.getConfigurationFromUrl(t);else{if(!i.isPlainObject(t))throw new Error("kintsugi: video configuration must be an object, a URL or a JSON string");n=t}const o=n.type;switch(o){case"youtube":r=a;break;case"bunnycdn":r=c;break;default:throw null==o?new Error('kintsugi: video configuration must have a "type" property'):new Error("kintsugi: video type invalid or not implemented: "+JSON.stringify(o))}return new r({configuration:n,autoplay:!!e.autoplay})}get configuration(){return this.__VideoPlayer.configuration}get parentElement(){return this.__VideoPlayer.parentElement}get isAttached(){const e=this.__VideoPlayer;return!!e.parentElement&&!e.attachPromise}tryGetDetailsAsync(){const e=this.__VideoPlayer;let t=e.detailsPromise;return t||(e.detailsPromise=t=this._fetchDetailsAsync()),t}attachAsync(e){try{const t=this.__VideoPlayer;if(t.parentElement)throw new Error("kintsugi: VideoPlayer is already attached");let n,r;try{const s=e.parent;if("string"==typeof s){const e=document.querySelectorAll(s);if(0===e.length)throw new Error("kintsugi: DOM element not found: "+JSON.stringify(s));if(e.length>1)throw new Error("kintsugi: DOM element was not unique: "+JSON.stringify(s));n=e[0]}else{if(!i.isDomElement(s))throw new Error("kintsugi: parent must be a DOM element or a CSS selector");if(n=s,!document.body.contains(n))throw new Error("kintsugi: parent element must be part of the DOM")}return n.innerHTML="",t.parentElement=n,t.attachCancellationSource=r=new i.CancellationTokenSource,t.attachPromise=this._performAttachAsync({cancellationToken:r.token}).catch((function(e){throw n.innerHTML="",t.parentElement=null,e})).finally((function(){t.attachCancellationSource=null,t.attachPromise=null,r.dispose()}))}catch(e){throw t.parentElement=null,t.attachCancellationSource=null,t.attachPromise=null,r&&r.dispose(),e}}catch(e){return Promise.reject(e)}}async detachAsync(){const e=this.__VideoPlayer;if(e.parentElement){const t=e.attachPromise;if(t){e.attachCancellationSource.cancel();try{await t}catch(e){}}const n=e.parentElement;if(n)try{await this._performDetachAsync()}finally{n.innerHTML="",e.parentElement=null}}}throwIfNotAttached(){if(!this.isAttached)throw this.__VideoPlayer.attachPromise?new Error("kintsugi: video player is still in the process of attaching to the document"):new Error("kintsugi: video player is not attached to the document")}constructor(e){const t={configuration:e.configuration,parentElement:null,attachPromise:null,attachCancellationSource:null,detailsPromise:null};Object.defineProperty(this,"__VideoPlayer",{value:t})}async _performAttachAsync(e){throw new Error("kintsugi: _performAttachAsync() was not implemented")}async _performDetachAsync(e){}async _fetchDetailsAsync(){return{thumbnailUrl:null,titleImageUrl:null}}}const s=r.__VideoPlayer={getConfigurationFromUrl(e){const t="string"==typeof e?e:e.toString(),n=l.tryGetConfigurationFromUrl(t);if(n)return n;const i=u.tryGetConfigurationFromUrl(t);if(i)return i;throw new Error("kintsugi: video URL not recognized: "+JSON.stringify(t))},getConfigurationFromUrlOrSchemeString(e){const t=e.indexOf(":");if(-1===t)throw new Error("kintsugi: invalid video configuration string (missing colon)");const n=e.substring(0,t),i=n.toUpperCase(),r=e.substring(t+1);if("HTTPS"===i||"HTTP"===i||"FILE"===i)return s.getConfigurationFromUrl(e);if("{"===r[0]){const e=JSON.parse(r);if("type"in e){if(e.type!==n)throw new Error("kintsugi: invalid video configuration string (scheme and type don't match)")}else e.type=n;return e}switch(n){case"youtube":return{type:"youtube",videoID:r};case"bunnycdn":return u.parseNonJsonConfigurationString(r);default:throw new Error("kintsugi: video scheme not recognized: "+JSON.stringify(n))}}};class o extends r{constructor(e){super({configuration:e.configuration});const t=e.iframeUrl,n={iframeUrl:t instanceof URL?t.toString():t||null,iframeElement:null};Object.defineProperty(this,"__IframeVideoPlayer",{value:n})}get _iframeElement(){return this.__IframeVideoPlayer.iframeElement}async _performAttachAsync(e){const t=this.__IframeVideoPlayer;try{const e=t.iframeElement=this._createIframeElement();return this.parentElement.appendChild(e),new Promise(((t,n)=>{let i;i=function(r){if("load"===r.type)t();else try{throw new Error("kintsugi: video iframe failed to load")}catch(e){n(e)}e.removeEventListener("load",i),e.removeEventListener("error",i)},e.addEventListener("load",i),e.addEventListener("error",i)}))}catch(e){throw t.iframeElement=null,e}}_createIframeElement(){const e=this._assembleIframeUrl(),t=document.createElement("iframe");return t.src=e,t.frameborder="0",t.allow="autoplay; picture-in-picture; fullscreen",t.classList.add("ks-video-iframe"),t}_assembleIframeUrl(){const e=this.__IframeVideoPlayer.iframeUrl;if(e)return e;throw new Error("kintsugi: iframe URL was not provided to the constructor")}}class a extends o{constructor(e){const t=e.configuration,n=!!e.autoplay,r={origin:"undefined"!=typeof location?location.origin:null,enablejsapi:1,rel:0,autoplay:n?1:0};super({configuration:t,iframeUrl:"https://www.youtube-nocookie.com/embed/"+encodeURIComponent(t.videoID)+"?"+i.buildUrlQuery(r)});const s={autoplay:n,ytPlayer:null};Object.defineProperty(this,"__YouTubeVideoPlayer",{value:s})}async _performAttachAsync(e){const t=this.__YouTubeVideoPlayer,n=e.cancellationToken;try{const r=l.initializeYouTubeApiAsync();await super._performAttachAsync(e),n.throwIfCancellationRequested(),await r,await new Promise(((e,n)=>{try{let r=!0;t.ytPlayer=new YT.Player(i.ensureID(this._iframeElement).id,{events:{onReady:t=>{r=!1,e()},onError:e=>{const t=e.data;if(r){r=!1;try{throw new Error("kintsugi: YouTube embed failed with error code "+t)}catch(e){n(e)}}else try{throw new Error("kintsugi: YouTube embed had an error; code: "+t)}catch(e){console.error(e)}}}}),"file:"===location.protocol&&e()}catch(e){n(e)}}))}catch(e){const n=t.ytPlayer;throw n&&(n.destroy(),t.ytPlayer=null),e}}async _performDetachAsync(){const e=this.__YouTubeVideoPlayer,t=e.ytPlayer;t&&(t.destroy(),e.ytPlayer=null),await super._performDetachAsync()}_fetchDetailsAsync(){try{const e=this.configuration;return Promise.resolve({thumbnailUrl:"https://img.youtube.com/vi/"+encodeURIComponent(e.videoID)+"/default.jpg",titleImageUrl:"https://img.youtube.com/vi/"+encodeURIComponent(e.videoID)+"/0.jpg"})}catch(e){return Promise.reject(e)}}}const l=a.__YouTubeVideoPlayer={youTubeApiPromise:null,tryGetConfigurationFromUrl(e){const t=l.tryExtractVideoIDFromUrl(e);return t?{type:"youtube",videoID:t}:null},tryExtractVideoIDFromUrl(e){var t,n,r,s;const o=i.tryParseUrl(e);if(null==o)return null;let a;if(/^https?:$/.test(o.protocol)){const e=o.pathname.split("/"),i=/^[-%0-9a-zA-Z_]+$/;switch(o.host){case"youtu.be":a=i.exec(null!==(t=e[1])&&void 0!==t?t:"");break;case"www.youtube.com":switch(e[1]){case"embed":a=i.exec(null!==(n=e[2])&&void 0!==n?n:"");break;case"watch":a=i.exec(null!==(r=o.searchParams.get("v"))&&void 0!==r?r:"");break;default:a=null}break;default:a=null}}else a=null;if(null==a)return null;const l=null!==(s=a[0])&&void 0!==s?s:null;if(!l)return null;const c=decodeURIComponent(l);return/^[-0-9a-zA-Z_]+$/.test(c)?c:null},initializeYouTubeApiAsync(){let e;if(e=l.youTubeApiPromise,!e){const t=window.YT;e=t&&t.loaded?Promise.resolve():new Promise((function(e,n){const r=window.onYouTubeIframeAPIReady;try{window.onYouTubeIframeAPIReady=function(){if(void 0!==r){window.onYouTubeIframeAPIReady=r;try{r()}catch(e){console.error(e)}}else delete window.onYouTubeIframeAPIReady;e()},t||i.loadScriptAsync("https://www.youtube.com/iframe_api").catch((e=>n(e)))}catch(e){void 0!==r?window.onYouTubeIframeAPIReady=r:delete window.onYouTubeIframeAPIReady,n(e)}})),l.youTubeApiPromise=e}return e}};class c extends o{constructor(e){const t=e.configuration,n={autoplay:e.autoplay?"true":"false"};super({configuration:t,iframeUrl:"https://iframe.mediadelivery.net/embed/"+encodeURIComponent(t.videoLibraryID)+"/"+encodeURIComponent(t.videoID)+"?"+i.buildUrlQuery(n)})}}const u=c.__BunnyCdnVideoPlayer={tryGetConfigurationFromUrl(e){const t=u.tryExtractVideoIDsFromUrl(e);return t?{type:"bunnycdn",videoLibraryID:t.videoLibraryID,videoID:t.videoID}:null},tryExtractVideoIDsFromUrl(e){const t=/^https?:\/\/iframe.mediadelivery.net\/embed\/([a-zA-Z0-9]+)\/([-a-zA-Z0-9]+)\/?$/.exec(e);return t?{videoLibraryID:t[1],videoID:t[2]}:null},parseNonJsonConfigurationString(e){const t=/^([a-zA-Z0-9]+),([-a-zA-Z0-9]+)$/.exec(e);if(!t)throw new Error("kintsugi: configuration does not seem to be a valid Bunny CDN configuration");return{type:"bunnycdn",videoLibraryID:t[1],videoID:t[2]}}},d={VideoPlayer:r,YouTubeVideoPlayer:a,BunnyCdnVideoPlayer:c};e.exports=d},8434:(e,t,n)=>{"use strict";const i=n(2250),r=n(7240),s=n(3463),o=n(5729),a=i.select,l=s.Widget;let c;class u extends l{constructor(e){if(!e.items||0===e.items.length)throw new Error("kintsugi: cannot call the carousel widget without any items to display");if(!e.title)throw new Error("kintsugi: failed to initialize the carousel widget due to missing carousel title");super({element:e.element,rootClass:e.rootClass,focusClass:e.focusClass}),this.__CarouselWidget={items:e.items.map((function(e){return{type:e.type,label:e.label,url:e.url||null,altText:e.altText||null,thumbnailUrl:e.thumbnailUrl||null,video:e.video||null}})),style:e.style||"dots",title:e.title,canActivate:!!e.canActivate,allowPinchZoom:!1!==e.allowPinchZoom,borderStyle:e.borderStyle||"curved",isActivating:!1,activeItemIndex:void 0,slideContents:null,slideNavigation:null,slidePickers:null,touchState:"notouch",touchStartObjects:null,dragStartTick:null,mainSlideDragScrollLeft:null}}get activeItemIndex(){const e=this.__CarouselWidget;return void 0===e.activeItemIndex&&this.initialize(),e.activeItemIndex}_onInitialize(){super._onInitialize();const e=this.element,t=a(e),r=this.__CarouselWidget,s=r.style,l=r.borderStyle,c="basic"!==s;let u="";switch(l){case"curved":u="has-border curved-border";break;case"straight":u="has-border straight-border";break;case"none":u="";break;default:throw new Error("kintsugi: carouse border style not implemented: "+JSON.stringify(l))}const h=[];t.addClass("ks-carousel").addClass("ks-carousel-style-"+s).attr({role:"group","aria-roledescription":"carousel"});const m=r.title;e.setAttribute("aria-label",m);const p=document.createElement("div");a(p).addClass("ks-carousel-main-container");const f=document.createElement("div");a(f).addClass("ks-carousel-slide-container");const g=document.createElement("div");a(g).addClass("ks-carousel-slide-focus-outline").attr({"aria-hidden":"true"});const y=document.createElement("ul"),_=a(y);_.addClass("ks-carousel-slide-list").attr({"aria-atomic":"false","aria-live":"polite"});const v=document.createElement("div");a(v).addClass("ks-carousel-slide-navigation-container");const w=document.createElement("div");a(w).addClass("ks-carousel-slide-pickers-container").attr({tabindex:0});const b=document.createElement("ul");a(b).addClass("ks-carousel-slide-pickers").attr({role:"tablist","aria-label":"Slides"}),u&&(_.addClass(u),a(v).addClass(u));const x=r.canActivate;r.items.forEach(((e,t)=>{var l;const u=e.type,m=e.label;if(!m)throw new Error("kintsugi: failed to initialize the carousel widget due to missing item label");const p=document.createElement("li"),f=a(p);f.uniqueId().addClass("ks-carousel-slide-listitem").attr({role:c?"tabpanel":"group","aria-label":m,"aria-roledescription":"slide"}).css({display:"none"});const g=document.createElement(x?"button":"div"),_=a(g);if(_.addClass("ks-carousel-slide-item"),p.append(g),x?_.on("click",d.handleMainSlideClick).on("focus",d.handleMainSlideFocus).on("blur",d.handleMainSlideBlur):f.on("focus",d.handleMainSlideFocus).on("blur",d.handleMainSlideBlur),"image"===u){const t=document.createElement("img");a(t).addClass("ks-carousel-slide-item-image").attr({src:e.url,alt:e.altText||e.label}),g.appendChild(t)}else{if("video"!==u)throw new Error("kintsugi: failed to initialize the carousel widget due to unsupported item type: "+u);{o||(o=n(5729));const t=document.createElement("div");t.classList.add("ks-carousel-slide-item-video-container");const i=document.createElement("div");i.classList.add("ks-carousel-slide-item-video-overlay"),i.classList.add("ks-is-left"),i.ariaHidden="true";const r=document.createElement("div");r.classList.add("ks-carousel-slide-item-video-overlay"),r.classList.add("ks-is-right"),r.ariaHidden="true";const s=document.createElement("div");t.appendChild(i),t.appendChild(r),t.appendChild(s),g.appendChild(t),h.push((function(){const t=new o.VideoPlayerWidget({element:s,video:e.video,aspectRatio:"4:3"});i.addEventListener("click",(e=>d.handleVideoPlayerOverlayClick(this,e,{videoWidget:t}))),r.addEventListener("click",(e=>d.handleVideoPlayerOverlayClick(this,e,{videoWidget:t})))}))}}p.querySelector(i.focusableSelector)||p.setAttribute("tabindex","0"),y.appendChild(p);const v=document.createElement("li");0===t&&(p.dataset.active="true",p.style.display="block",v.dataset.active="true",r.activeItemIndex=t);const w=document.createElement("button");switch(a(w).uniqueId().attr({type:"button",tabindex:"-1",role:"tab","aria-label":"Select "+m,"aria-selected":null!==(l=v.dataset.active)&&void 0!==l?l:"false","aria-controls":p.getAttribute("id")}),s){case"dots":a(w).addClass("ks-carousel-button-dot-style");const t=document.createElement("span");a(t).addClass("ks-carousel-dot-icon").attr({"aria-hidden":"true"}),w.appendChild(t);break;case"thumbnails":a(v).addClass("ks-carousel-thumbnail-picker-item-style"),a(w).addClass("ks-carousel-button-thumbnail-style");const n=d.createItemThumbnailElement(e);if(w.appendChild(n),"video"===u){const e=document.createElement("span");a(e).addClass("play-button-overlay").attr({"aria-hidden":"true"}),w.appendChild(e)}"true"===n.ariaHidden&&(w.ariaLabel=e.label)}a(w).on("click",d.handlePickerButtonClick),v.appendChild(w),b.appendChild(v)}));const I=document.createElement("button");a(I).addClass("ks-carousel-button-previous").attr({type:"button","aria-label":"Show Previous"});const C=document.createElement("span");a(C).addClass("ks-carousel-button-previous-icon").attr({"aria-hidden":"true"}),I.appendChild(C);const k=document.createElement("button");a(k).addClass("ks-carousel-button-next").attr({type:"button","aria-label":"Show Next"});const S=document.createElement("span");a(S).addClass("ks-carousel-button-next-icon").attr({"aria-hidden":"true"}),k.appendChild(S);const A=document.createElement("div");if(a(A).addClass("ks-carousel-active-slide-label"),A.textContent=y.querySelector("[data-active=true]").getAttribute("aria-label"),a(I).on("click",d.handlePreviousButtonClick),a(k).on("click",d.handleNextButtonClick),v.append(I,A,k),r.slideNavigation=v,r.slideContents=y,f.append(g,y),p.append(f,v),"thumbnails"===s||"dots"===s){const t=document.createElement("button");a(t).addClass("ks-carousel-scroll-left-button").attr({"aria-label":"Scroll Left",type:"button"});const n=document.createElement("span");a(n).addClass("ks-carousel-scroll-left-button-icon").attr({"aria-hidden":"true"}),t.appendChild(n);const i=document.createElement("button");a(i).addClass("ks-carousel-scroll-right-button").attr({"aria-label":"Scroll Right",type:"button"});const s=document.createElement("span");a(s).addClass("ks-carousel-scroll-right-button-icon").attr({"aria-hidden":"true"}),i.appendChild(s),a(t).on("click",d.handlePickerScrollLeftClick),a(i).on("click",d.handlePickerScrollRightClick),r.slidePickers=b,w.appendChild(b),p.appendChild(w),e.appendChild(p),b.scrollWidth>b.clientWidth&&w.append(t,i)}e.appendChild(p);for(const e of h)e();t.on("keydown",d.handleCarouselKeydown),"Touch"in window&&(navigator.maxTouchPoints||0)>0&&_.on("touchstart",d.handleSlideContentsTouchStart).on("touchmove",d.handleSlideContentsTouchMove).on("touchend",d.handleSlideContentsTouchEnd).on("touchcancel",d.handleSlideContentsTouchCancel),d.resetMainSlideVisualState(this)}}u.defaults={rootClass:"ks-carousel"},Object.setPrototypeOf(u.defaults,l.defaults),l.registerForAutoCreate(u),l.extendSelect(u,{name:"kintsugi.carousel",allowList:["super","items","style","title","canActivate","activeItemIndex"]});const d=u.__CarouselWidget={touchMinimumMoveDistancePixels:8,flickDragTimeMilliseconds:100,touchMinimumRegularDragCompleteRatio:.3,touchMinimumFlickDragCompleteRatio:.15,maximumPinchZoomScale:4,createItemThumbnailElement(e){let t=e.thumbnailUrl;t||"image"!==e.type||(t=e.url);const i=document.createElement("img");return i.src=t||"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAACCAYAAABytg0kAAAAAXNSR0IArs4c6QAAAAlwSFlzAAAWJQAAFiUBSVIk8AAAABNJREFUCB1jZGBg+A/EDEwgAgQADigBA//q6GsAAAAASUVORK5CYII%3D",i.alt=e.altText||e.label,t||(i.style.objectFit="cover"),t||("video"===e.type?async function(){const t=(r={video:e.video},c||(c=n(233)),c.VideoPlayer.create(r));var r;const s=await t.tryGetDetailsAsync();s.thumbnailUrl?(i.src=s.thumbnailUrl,i.style.objectFit=""):console.warn("kintsugi: carousel video has no default thumbnail")}().catch((e=>console.error(e))):console.warn("kintsugi: carousel item has no thumbnail ("+JSON.stringify(e.type)+" not handled)")),i},startTryActivateItem(e,t){d.tryActivateItemAsync(e,t).catch((e=>console.error(e)))},async tryActivateItemAsync(e,t){const n=t.item,r=t.animation,s=e.__CarouselWidget,o=s.slideContents,a=s.slidePickers,l=s.slideNavigation,c=o.children,u=o.querySelector("[data-active=true]"),h=Array.prototype.indexOf.call(c,u);if(s.isActivating)return!1;d.cancelCurrentTouchIfAny(e),s.isActivating=!0;try{let t,o;if(i.isDomElement(n))o=n,t=Array.prototype.indexOf.call(c,n);else{if("string"!=typeof n)throw new Error("kintsugi: invalid activation item: "+JSON.stringify(n));switch(n){case"next":t=(h+1)%c.length;break;case"previous":t=(h+c.length-1)%c.length;break;case"first":t=0;break;case"last":t=c.length-1;break;default:throw new Error("kintsugi: invalid activation item: "+JSON.stringify(n))}o=c[t]}if(t===h)return!0;s.activeItemIndex=t,o.dataset.active="true",delete u.dataset.active,l.querySelector(".ks-carousel-active-slide-label").textContent=o.getAttribute("aria-label"),o.style.display="block",u.contains(document.activeElement)&&(o.querySelector(i.focusableSelector)||o).focus();const m=d.animateMainSlidesAsync(e,{animation:r,initialIndex:h,targetIndex:t});let p;if(a){const e=a.children[t],n=a.querySelector("[data-active=true]");delete n.dataset.active,n.querySelector('[role="tab"]').setAttribute("aria-selected","false"),e.dataset.active="true",e.querySelector('[role="tab"]').setAttribute("aria-selected","true"),p=i.animation.scrollIntoView(e,{container:a,vertical:"none",duration:100,animate:!0})}else p=Promise.resolve();await Promise.all([m,p])}finally{s.isActivating=!1}return!0},async animateMainSlidesAsync(e,t){const n=t.animation,r=t.initialIndex,s=t.targetIndex,o=e.__CarouselWidget,a=o.slideContents,l=a.children;if("none"!==n&&s!==r){var c;let e,t,u,d;switch(e="shortest"===n?(s-r+l.length)%l.length<=(r-s+l.length)%l.length?"right":"left":n,e){case"left":t=s,u=0,d=(r-t+l.length)%l.length+1;break;case"right":t=r,u=0,d=(s-t+l.length)%l.length+1;break;default:throw new Error("kintsugi: animation style invalid or not implemented: "+JSON.stringify(e))}for(let e=0;e<l.length;++e){const n=l[e],i=(e-t+l.length)%l.length;n.style.order=i,n.style.display=i>=u&&i<d?"block":"none"}const h=null!==(c=o.mainSlideDragScrollLeft)&&void 0!==c?c:l[r].offsetLeft;a.scrollLeft=h;const m=l[s].offsetLeft,p=new i.animation.DomAnimation({target:a,duration:200,update:function(e){e<1&&(a.scrollLeft=h+(m-h)*e)}});await p.start()}d.resetMainSlideVisualState(e)},resetMainSlideVisualState(e){const t=e.__CarouselWidget,n=t.slideContents,i=n.children,r=t.activeItemIndex,s=(r-1+i.length)%i.length;for(let e=0;e<i.length;++e){const t=i[e],n=(e-s+i.length)%i.length;t.style.display=e===r?"block":"none",t.style.order=n}n.scrollLeft=0},scrollPickersIntoView(e,t){const n=e.scrollWidth-e.clientWidth,i=Math.ceil(.25*n),r=i>=100?i:100;switch(t){case"left":Math.ceil(e.scrollLeft)<=0?e.scrollLeft=n:e.scrollLeft-=r;break;case"right":Math.ceil(e.scrollLeft)>=n?e.scrollLeft=0:e.scrollLeft+=r}},cancelCurrentTouchIfAny(e){const t=e.__CarouselWidget;if("notouch"!==t.touchState){if("pinchzoom"===t.touchState){const e=t.touchStartObjects[0].target;e.style.transform="",e.style.zIndex=""}t.touchState="notouch",t.touchStartObjects=t.dragStartTick=null,d.resetMainSlideVisualState(e)}},updateMainSlideDrag(e,t){const n=e.__CarouselWidget,i=n.slideContents,r=i.clientWidth,s=i.children,o=n.activeItemIndex,a=n.touchStartObjects[0],l=t.screenX-a.screenX;if(1!==s.length){if(2===s.length){const e=1-o;l>0?(s[e].style.order="0",s[o].style.order="1"):l<0&&(s[e].style.order="1",s[o].style.order="0"),s[e].style.display="block"}else l>0?s[(o-1+s.length)%s.length].style.display="block":l<0&&(s[(o+1)%s.length].style.display="block");i.scrollLeft=Math.max(-r,Math.min(s[o].offsetLeft-l,r)),n.mainSlideDragScrollLeft=i.scrollLeft}},completeMainSlideDrag(e,t,n){const i=e.__CarouselWidget,r=i.slideContents,s=r.clientWidth,o=r.children,a=i.activeItemIndex,l=i.touchStartObjects[0],c=t.screenX-l.screenX,u=n<d.flickDragTimeMilliseconds?d.touchMinimumFlickDragCompleteRatio:d.touchMinimumRegularDragCompleteRatio;if(Math.abs(c)<s*u)d.cancelCurrentTouchIfAny(e);else{const t=c<0?(a+1)%o.length:(a-1+o.length)%o.length;d.startTryActivateItem(e,{item:o[t],animation:"shortest"})}i.mainSlideDragScrollLeft=null},updatePinchZoom(e,t){const n=e.__CarouselWidget.touchStartObjects,i=d.calculatePinchZoomDistance(n[0],n[1]),r=d.calculatePinchZoomMidpoint(n[0],n[1]),s=d.calculatePinchZoomMidpoint(t[0],t[1]),o=2*(s.x-r.x),a=2*(s.y-r.y),l=d.calculatePinchZoomDistance(t[0],t[1])/i,c=Math.min(Math.max(1,l),d.maximumPinchZoomScale),u=t[0].target,h="translate("+o+"px, "+a+"px) scale("+c+")";u.style.transform=h,u.style.zIndex="9999"},calculatePinchZoomDistance:(e,t)=>Math.hypot(e.screenX-t.screenX,e.screenY-t.screenY),calculatePinchZoomMidpoint:(e,t)=>({x:(e.screenX+t.screenX)/2,y:(e.screenY+t.screenY)/2}),getMatchingTouchObjects(e,t){const n=e.__CarouselWidget.touchStartObjects||[];return r(t).filter((e=>n.some((t=>e.identifier===t.identifier)))).toArray()},isPinchZoomSupportedOnActiveSlide(e){const t=e.__CarouselWidget,n=t.activeItemIndex,i=void 0!==n?t.items[n]:null;return i&&"image"===i.type},handleSlideContentsTouchStart(e){const t=l.closest(e.currentTarget,u),n=t.__CarouselWidget,i=e.touches.length;e.defaultPrevented||e.altKey||e.metaKey||e.ctrlKey||e.shiftKey||"notouch"!==n.touchState||1!==i?e.defaultPrevented||e.altKey||e.metaKey||e.ctrlKey||e.shiftKey||!n.allowPinchZoom||"onepending"!==n.touchState||2!==i?"notouch"!==n.touchState&&0===i&&d.cancelCurrentTouchIfAny(t):(e.preventDefault(),n.touchState="twopending",n.touchStartObjects=[e.touches[0],e.touches[1]]):(n.touchState="onepending",n.touchStartObjects=[e.touches[0]])},handleSlideContentsTouchMove(e){const t=l.closest(e.currentTarget,u),n=t.__CarouselWidget,i=n.touchStartObjects,r=d.getMatchingTouchObjects(t,e.touches);if(0!==r.length)switch(n.touchState){case"notouch":break;case"onepending":e.defaultPrevented?d.cancelCurrentTouchIfAny(t):Math.abs(i[0].screenX-r[0].screenX)>=d.touchMinimumMoveDistancePixels?(n.touchState="drag",n.dragStartTick=performance.now()):Math.abs(i[0].screenY-r[0].screenY)>=d.touchMinimumMoveDistancePixels&&d.cancelCurrentTouchIfAny(t);break;case"drag":d.updateMainSlideDrag(t,r[0]);break;case"twopending":const s=d.calculatePinchZoomDistance(i[0],i[1]),o=d.calculatePinchZoomDistance(r[0],r[1]);e.defaultPrevented?d.cancelCurrentTouchIfAny(t):o>=s+d.touchMinimumMoveDistancePixels&&(d.isPinchZoomSupportedOnActiveSlide(t)?n.touchState="pinchzoom":d.cancelCurrentTouchIfAny(t));break;case"pinchzoom":d.updatePinchZoom(t,r);break;default:throw new Error("kintsugi: touch state invalid or not implemented: "+JSON.stringify(n.touchState))}},handleSlideContentsTouchEnd(e){const t=l.closest(e.currentTarget,u),n=t.__CarouselWidget,i=d.getMatchingTouchObjects(t,e.changedTouches);if(0!==i.length)switch(n.touchState){case"notouch":break;case"onepending":case"pinchzoom":d.cancelCurrentTouchIfAny(t);break;case"twopending":1===i.length?n.touchState="onepending":d.cancelCurrentTouchIfAny(t);break;case"drag":const e=performance.now()-n.dragStartTick;d.completeMainSlideDrag(t,i[0],e);break;default:throw new Error("kintsugi: touch state invalid or not implemented: "+JSON.stringify(n.touchState))}},handleSlideContentsTouchCancel(e){const t=l.closest(e.currentTarget,u);d.cancelCurrentTouchIfAny(t)},handlePickerButtonClick(e){if(!e.defaultPrevented){e.preventDefault();const t=l.closest(e.currentTarget,u),n=e.currentTarget.getAttribute("aria-controls"),i=document.getElementById(n);d.startTryActivateItem(t,{item:i,animation:"shortest"})}},handlePickerScrollLeftClick(e){if(!e.defaultPrevented){e.preventDefault();const t=l.closest(e.currentTarget,u).__CarouselWidget.slidePickers;d.scrollPickersIntoView(t,"left")}},handlePickerScrollRightClick(e){if(!e.defaultPrevented){e.preventDefault();const t=l.closest(e.currentTarget,u).__CarouselWidget.slidePickers;d.scrollPickersIntoView(t,"right")}},handleNextButtonClick(e){if(!e.defaultPrevented){e.preventDefault();const t=l.closest(e.currentTarget,u);d.startTryActivateItem(t,{item:"next",animation:"right"})}},handlePreviousButtonClick(e){if(!e.defaultPrevented){e.preventDefault();const t=l.closest(e.currentTarget,u);d.startTryActivateItem(t,{item:"previous",animation:"left"})}},handleCarouselKeydown(e){if(!e.defaultPrevented){if(e.ctrlKey||e.shiftKey||e.altKey||e.metaKey)return;const t=l.closest(e.currentTarget,u);switch(e.key){case"ArrowRight":e.preventDefault(),d.startTryActivateItem(t,{item:"next",animation:"right"});break;case"ArrowLeft":e.preventDefault(),d.startTryActivateItem(t,{item:"previous",animation:"left"});break;case"Home":e.preventDefault(),d.startTryActivateItem(t,{item:"first",animation:"left"});break;case"End":e.preventDefault(),d.startTryActivateItem(t,{item:"last",animation:"right"})}}},handleMainSlideFocus(e){l.closest(e.currentTarget).element.classList.add("ks-carousel-slide-focused")},handleMainSlideBlur(e){l.closest(e.currentTarget).element.classList.remove("ks-carousel-slide-focused")},handleMainSlideClick(e){e.defaultPrevented||(e.preventDefault(),l.closest(e.currentTarget,u).dispatchEvent("itemactivated"))},handleMainSlideKeydown(e){if(!e.defaultPrevented){const t=l.closest(e.currentTarget,u);switch(e.key){case"Enter":case" ":e.ctrlKey||e.shiftKey||e.altKey||e.metaKey||(e.preventDefault(),t.dispatchEvent("itemActivate"))}}},handleVideoPlayerOverlayClick(e,t,n){t.defaultPrevented||(t.preventDefault(),a(e.element).find(".ks-carousel-slide-item-video-overlay").css({visibility:"hidden"}),setTimeout((function(){a(e.element).find(".ks-carousel-slide-item-video-overlay").css({visibility:""})}),1500))}},h={CarouselWidget:u};e.exports=h},4505:(e,t,n)=>{"use strict";const i=n(2250),r=n(3463),s=n(3846),o=i.select,a=r.Widget,l=s.FieldWidget;class c extends l{constructor(e){super({element:e.element,readonly:e.readonly,disabled:e.disabled,messageType:e.messageType,messageHtml:e.messageHtml,message:e.message,validate:e.validate,rootClass:e.rootClass,focusClass:e.focusClass,disabledClass:e.disabledClass,readonlyClass:e.readonlyClass,errorClass:e.errorClass,warningClass:e.warningClass,infoClass:e.infoClass,successClass:e.successClass,messageClass:e.messageClass,messageIconClass:e.messageIconClass}),this.__CheckBoxFieldWidget={input:null,value:void 0}}get value(){const e=this.__CheckBoxFieldWidget;let t=e.value;return void 0===t&&(this.initialize(),t=e.value),t}set value(e){this.initialized||this.initialize();const t=this.__CheckBoxFieldWidget,n=t.input,i=n.hasAttribute("value"),r=n.value;let s;if(!1===e||null===e||""===e)s=!!i&&"";else{if(!0!==e&&e!==r)throw new Error("kintsugi: invalid value for checkbox: "+JSON.stringify(e));s=!i||r}t.value!==s&&(t.value=s,u.updateUI(this))}_onInitialize(){super._onInitialize();const e=this.__CheckBoxFieldWidget,t=this.element;let n=t.querySelector("input");n||(n=document.createElement("input"),n.type="checkbox",t.append(n)),e.input=n;const r=t.querySelector("label");if(r&&(i.ensureID(n),r.setAttribute("for",n.id)),void 0===e.value){const t=n.hasAttribute("value"),i=n.checked;e.value=t?i?n.value:"":i}u.updateUI(this),o(n).on("click",u.handleInputClick)}_onDisabledChanged(e){u.updateUI(this),super._onDisabledChanged(e)}}c.defaults={rootClass:"ks-checkboxfield"},Object.setPrototypeOf(c.defaults,l.defaults),a.registerForAutoCreate(c),a.extendSelect(c,{name:"kintsugi.checkboxfield",allowList:["super"]});const u=c.__CheckBoxFieldWidget={updateUI(e){const t=e.__CheckBoxFieldWidget,n=t.input,i=t.value;n.checked=!1!==i&&""!==i,n.disabled=e.disabled},handleInputClick(e){if(!e.defaultPrevented){const t=e.currentTarget,n=a.tryClosest(t);if(n)if(n.readonly||n.disabled)e.preventDefault();else{const e=n.__CheckBoxFieldWidget,r=t.checked,s=t.hasAttribute("value")?r?t.value:"":r;if(e.value!==s){e.value=s;const t=n.element;i.events.dispatchEvent(t,"input"),i.events.dispatchEvent(t,"change")}}}}},d={CheckBoxFieldWidget:c};e.exports=d},3463:(e,t,n)=>{"use strict";const i=n(2250),r=i.select;class s{constructor(e){const t=e.element;if(!(t instanceof HTMLElement))throw new Error("kintsugi: widget element must be a DOM element");if(!document.body.contains(t))throw new Error("kintsugi: widget element must be part of the document");const n=this.constructor.defaults;this.__Widget={element:t,rootClass:void 0===e.rootClass?n.rootClass:e.rootClass,focusClass:void 0===e.focusClass?n.focusClass:e.focusClass,initialized:!1,focused:void 0,mutationObserver:null},o.domToWidgetMap.set(t,this),o.idleInitList.push(this),o.idleInitID||(o.idleInitID="undefined"==typeof requestIdleCallback?setTimeout(o.idleInit,0):requestIdleCallback(o.idleInit))}get element(){return this.__Widget.element}get widget(){return this}get focused(){const e=this.__Widget;let t=e.focused;return void 0===t&&(this.initialize(),t=e.focused),t}get initialized(){return this.__Widget.initialized}initialize(){const e=this.__Widget;return e.initialized||(e.initialized=!0,this._onInitialize()),this}dispatchEvent(e,t){return i.events.dispatchEvent(this.initialize().__Widget.element,e,t)}focus(){if(!this.initialize().__Widget.focused){const e=this.initialize()._findFocusTarget();e&&e.focus()}return this}static tryGet(e,t){if("string"==typeof e&&(e=document.querySelector(e)),e instanceof HTMLElement){const n=o.domToWidgetMap.get(e);if(n&&(!t||n instanceof t))return n}return null}static get(e,t){const n=this.tryGet(e,t);if(!n)throw new Error("kintsugi: DOM element does not have an attached widget");return n}static tryClosest(e,t){let n=e;for(;n;){const e=s.tryGet(n,t);if(e)return e;n=n.parentElement}return null}static closest(e,t){const n=this.tryClosest(e,t);if(!n)throw new Error("kintsugi: DOM element does not belong to a widget");return n}static find(e){("object"!=typeof e||e instanceof HTMLElement||e instanceof Document)&&(e={root:e});let t,n,r,a=e.create,l=e.includeRoot;if(a&&(t=o.autoCreateList,a=t.length>0),a){n=[];for(const e of t){const t=e.selector;n.push("string"==typeof t?t:t())}r=n.join(", ")}let c=e.root;c?"string"==typeof c?c=document.querySelectorAll(c):c instanceof Document?(l=!0,c=[c.body]):c=[c]:(l=!0,c=[document.body]);const u=[];if(l)Array.prototype.push.apply(u,c),u.reverse();else for(const e of c)Array.prototype.push.apply(u,e.children),u.reverse();const d=[];for(;;){const e=u.length;if(!e)break;const o=u.splice(e-1)[0];let l=s.tryGet(o);if(!l&&a&&i.matchesSelector(o,r))for(let e=n.length-1;e>=0;--e)if(i.matchesSelector(o,n[e])){const n=t[e].widgetClassOrFactory;l=n.prototype instanceof s?new n({element:o}):n(o);break}l?d.push(l):o.children.length>0&&Array.prototype.push.apply(u,Array.prototype.slice.call(o.children).reverse())}return d}static registerForAutoCreate(){let e,t;1===arguments.length?(t=arguments[0],e=()=>"."+t.defaults.rootClass):(e=arguments[0],t=arguments[1]),o.autoCreateList.push({selector:e,widgetClassOrFactory:t})}static autoCreate(e){("object"!=typeof e||e instanceof Document||e instanceof HTMLElement)&&(e={root:e}),s.find({root:e.root,create:!0,includeRoot:!1!==e.includeRoot})}static extendSelect(e,t){let n;if("string"==typeof t?(n=t||null,t={}):n=t.name||null,n&&!/^[a-zA-Z][a-zA-Z0-9_]*(?:\.[a-zA-Z][a-zA-Z0-9_]*)?$/.test(n))throw new Error("kintsugi: invalid name");if(!(e.prototype instanceof s)&&e!==s)throw new Error("kintsugi: widget class must derive from Widget");const r=o.extendSelectMap;if(r.get(e))throw new Error("kintsugi: widget has already been used to extend the selection");const a=i.select.Selection.prototype;if(n&&n in a)throw new Error("kintsugi: "+n+" already defined on selection");const l={widgetClass:e,allowCreate:!1!==t.allowCreate,allowList:t.allowList||null,denyList:t.denyList||null};if(r.set(e,l),n){const e=n.lastIndexOf(".");let t;e>=0&&(t=n.substring(e+1));const i=function(){return o.handleSelectionCall(this,l,arguments)};a[n]=i,t&&!(t in a)&&(a[t]=i)}}_onInitialize(){const e=this.__Widget,t=e.element,n=r(t);n.addClass(e.rootClass);const i=document.activeElement,a=e.focused=!(!i||!t.contains(i));if(n.toggleClass(e.focusClass,a),n.on("focusin",o.handleFocusin).on("focusout",o.handleFocusout),this._onRemovedFromDom!==s.prototype._onRemovedFromDom){let t;t=e.mutationObserver=new MutationObserver((()=>{document.body.contains(this.element)||(t.disconnect(),e.mutationObserver=null,this._onRemovedFromDom())})),t.observe(document.body,{childList:!0,subtree:!0})}}_findFocusTarget(){const e=this.__Widget.element;if(!i.isVisible(e))return null;const t=e.querySelectorAll(i.focusableSelector);let n,r=null;for(let e of t)if(i.isVisible(e)){const t=parseInt(e.getAttribute("tabindex")||"0");let i=!1;r?t>0?i=n<=0||t<n:0===t&&(i=n<0):i=!0,i&&(r=e,n=t)}return r}_onFocus(){const e=this.__Widget,t=e.focusClass;t&&r(e.element).addClass(t)}_onBlur(){const e=this.__Widget,t=e.focusClass;t&&r(e.element).removeClass(t)}_onRemovedFromDom(){}}s.defaults={rootClass:"",focusClass:"ks-is-focus"};const o=s.__Widget={domToWidgetMap:new Map,idleInitList:[],idleInitID:0,autoCreateList:[],extendSelectMap:new Map,cancelAllIdleInit(){const e=o.idleInitID;e&&((window.unregisterIdleCallback?unregisterIdleCallback:clearTimeout).call(window,e),o.idleInitID=0),o.idleInitList=[]},idleInit(){const e=o.idleInitList;for(let t of e)if(document.body.contains(t.element))try{t.initialize()}catch(e){console.error(e)}o.idleInitList=[],o.idleInitID=0},handleSelectionCall(e,t,n){const i=t.widgetClass;let r,a,l=!1;if(0===n.length?(l=!0,a=null):1===n.length&&"object"==typeof n[0]?(l=!0,a=n[0]):(r=n[0],a=Array.prototype.slice.call(n,1)),l){if(t.allowCreate){const t=Object.assign({element:null},a);return e.each(((e,n)=>{s.tryGet(n)||(t.element=n,new i(t))}))}throw new Error("kintsugi: cannot create widgets using this method")}if("string"==typeof r&&r&&"_"!==r[0]&&"super"!==r){let n,l,c,u=i,d=t;do{const e=d.denyList;if(e&&e.indexOf(r)>=0)break;const t=Object.getOwnPropertyDescriptor(u.prototype,r),i=d.allowList;if(i&&i.indexOf(r)<0&&(t||i.indexOf("super")<0))break;t?n=t:(u=Object.getPrototypeOf(u),d=o.extendSelectMap.get(u)||{})}while(!n&&u!==Object);if(n&&(n.get||n.set?l=0===a.length?"get":"set":"function"==typeof n.value&&(l="call-init")),!l)throw new Error('kintsugi: widget does not have a "'+r+'" method');return"get"!==l&&(c=e),e.each(((e,t)=>{const n=s.tryGet(t);if(n instanceof i)switch(l){case"get":return c=n[r],!1;case"set":n[r]=a[0];break;case"call-init":{const e=n[r].apply(n,a);if(e!==n)return c=e,!1;l="call-set"}break;case"call-set":n[r].apply(n,a);break;default:throw new Error("kintsugi: invalid method type: "+l)}})),c}},handleFocusin(e){const t=s.tryGet(e.currentTarget);if(t){const e=t.__Widget;e.focused||(e.focused=!0,t._onFocus())}},handleFocusout(e){const t=e.currentTarget,n=s.tryGet(t);if(n){const i=n.__Widget;if(i.focused){const r=e.relatedTarget;r&&t.contains(r)||(i.focused=!1,n._onBlur())}}}};s.extendSelect(s,{name:"kintsugi.widget",allowCreate:!1,allowList:["element","value","widget","focused","initialize","focus"]});const a={Widget:s,autoCreate:s.autoCreate};e.exports=a},3125:(e,t,n)=>{"use strict";const i=n(2250),r=n(3463),s=n(3846),o=i.select,a=r.Widget,l=s.FieldWidget;class c extends l{constructor(e){super({element:e.element,readonly:e.readonly,disabled:e.disabled,messageType:e.messageType,messageHtml:e.messageHtml,message:e.message,validate:e.validate,readonly:e.readonly,disabled:e.disabled,required:e.required,rootClass:e.rootClass,focusClass:e.focusClass,disabledClass:e.disabledClass,readonlyClass:e.readonlyClass,errorClass:e.errorClass,warningClass:e.warningClass,infoClass:e.infoClass,successClass:e.successClass,messageClass:e.messageClass,messageIconClass:e.messageIconClass});const t=this.constructor.defaults;let n=null,r=e.placeholderHtml;void 0===r&&void 0!==e.placeholder&&(n=e.placeholder||"",r=i.htmlEscape(n)),this.__DropdownWidget={button:null,list:null,select:null,messageIcon:null,messageElem:null,placeholder:n,placeholderHtml:r,dropDirection:e.dropDirection||"auto",phoneMode:void 0,value:void 0,items:void 0,itemsNeedFixups:!0,state:"collapsed",stateChangeTick:0,buttonClass:e.buttonClass||t.buttonClass,buttonPlaceholderClass:e.buttonPlaceholderClass||t.buttonPlaceholderClass,searchPopup:null,searchTimeout:e.searchTimeout||t.searchTimeout,searchTimeoutID:0,searchText:"",searchPopupClass:void 0===e.searchPopupClass?t.searchPopupClass:e.searchPopupClass,scrollToListItem:null}}get value(){const e=this.__DropdownWidget;let t=e.value;return void 0===t&&(this.initialize(),t=e.value),e.value}set value(e){const t=this.__DropdownWidget;if((e=e||0===e?e.toString():"")!==t.value){t.items||this.initialize();let n=null;if(""!==e&&(n=t.items.find((t=>t.value===e)),!n))return void console.error("kintsugi: dropdown does not have an option with value "+JSON.stringify(e));const i=""===t.value;if(t.value=e,this.initialized){u.resetButtonState(this,{selectedItem:n});const r=t.select;r&&((i||""===e)&&u.updateSelectOptions(this),r.value=e)}}}get placeholder(){const e=this.__DropdownWidget;let t=e.placeholder;return null===t&&(t=e.placeholder=i.htmlToText(this.placeholderHtml)),t}set placeholder(e){const t=this.__DropdownWidget;e=(e||"").toString(),t.placeholder=e,t.placeholderHtml=i.htmlEscape(e),""===t.value&&this.initialized&&u.resetButtonState(this,{selectedItem:null})}get placeholderHtml(){const e=this.__DropdownWidget;let t=e.placeholderHtml;return void 0===t&&(this.initialize(),t=e.placeholderHtml),t}set placeholderHtml(e){const t=this.__DropdownWidget;t.placeholder=null,t.placeholderHtml=(e||"").toString(),""===t.value&&this.initialized&&u.resetButtonState(this,{selectedItem:null})}get items(){return this.__DropdownWidget.items}set items(e){const t=this.__DropdownWidget,n=u.fixupItemsInPlace(e.map((e=>({value:e.value,html:e.html,text:e.text}))));if(!i.deepEquals(t.items,n)){t.items=n;let e=t.value;void 0===e||n.find((t=>t.value===e))||(t.value=e=""),this.initialized&&(t.phoneMode?u.updateSelectOptions(this):u.collapseList(this,{focus:!1,resetButtonState:!0}),u.resetButtonState(this))}}get dropDirection(){return this.__DropdownWidget.dropDirection}set dropDirection(e){this.__DropdownWidget.dropDirection=e}_onInitialize(){super._onInitialize();const e=this.__DropdownWidget,t=e.phoneMode=i.device.isPhone(),n=this.element;let r=e.button=e.button||n.querySelector("button"),s=e.list=e.list||n.querySelector("ul"),a=e.select=e.select||n.querySelector("select");t?(r&&r.remove(),e.button=r=document.createElement("span"),n.appendChild(r),a||(e.select=a=document.createElement("select"),n.appendChild(a))):(r||(e.button=r=document.createElement("button"),n.appendChild(r)),s||(e.list=s=document.createElement("ul"),n.appendChild(s)));const l=o(r),c=o(s);let d=e.value;if(void 0===d){const t=c.find('[aria-selected="true"]');e.value=d=t.attr("data-field-value")||""}let h=e.items;h||(h=[],c.find("li").each(((e,t)=>{h.push({value:t.getAttribute("data-field-value")||"",html:t.innerHTML})})),e.items=u.fixupItemsInPlace(h));let m=null;if(""!==d&&(m=h.find((e=>e.value===d)),m||(console.error("kintsugi: dropdown does not have an option with value "+JSON.stringify(d)),e.value=d="")),void 0===e.placeholderHtml){let t=n.getAttribute("data-field-placeholder-html");if(null===t){const r=e.placeholder=n.getAttribute("data-field-placeholder")||"";t=i.htmlEscape(r)}e.placeholderHtml=t}if(l.addClass(e.buttonClass),t)s&&(s.remove(),e.list=null),l.attr("aria-hidden","true"),u.updateSelectOptions(this);else{a&&(a.remove(),e.select=null);const t=!!r.id;t||l.uniqueId(),l.attr({type:"button","aria-haspopup":"listbox"});const n=(l.attr("aria-labelledby")||"").trim();t&&n||l.attr("aria-labelledby",(n+" "+l.attr("id")).trim()),c.attr({tabindex:"-1",role:"listbox"}).css("display","none").empty()}u.resetButtonState(this,{selectedItem:m}),t?o(a).on("input",u.handleSelectInput):(l.on("click",u.handleButtonClick).on("keydown",u.handleButtonKeydown),c.on("blur",u.handleListBlur).on("keydown",u.handleListKeydown).on("mousemove",u.handleListMousemove).on("click",u.handleListClick))}_onReadonlyChanged(e){super._onReadonlyChanged(e),this.__DropdownWidget.phoneMode||e&&(u.collapseList(this),u.closeSearchPopup(this)),u.resetButtonState(this)}_onDisabledChanged(e){super._onDisabledChanged(e),this.__DropdownWidget.phoneMode||e&&(u.collapseList(this),u.closeSearchPopup(this)),u.resetButtonState(this)}_updateMessageUI(e,t){super._updateMessageUI(e,t);const n=this.__DropdownWidget,r=o(n.button);if(t){const t=this._messageElem;r.attr({"aria-invalid":"error"===e?"true":null,"aria-describedby":i.ensureID(t).id})}else r.removeAttr("aria-invalid aria-describedby")}}c.defaults={rootClass:"ks-dropdown",buttonClass:"ks-dropdown-button",buttonPlaceholderClass:"ks-is-placeholder",searchTimeout:1e3,searchPopupClass:"ks-dropdown-searchpopup"},Object.setPrototypeOf(c.defaults,l.defaults),a.registerForAutoCreate(c),a.extendSelect(c,{name:"kintsugi.dropdown",allowList:["super","placeholder","placeholderHtml"]});const u=c.__DropdownWidget={fixupItemsInPlace(e){for(const t of e){let e=t.text,n=t.html;null==n?(null==e&&(e=t.value.toString()),n=i.htmlEscape(e)):null==e&&(e=i.htmlToText(n)),t.text=e,t.html=n}return e},resetButtonState(e,t){t=t||{};const n=e.__DropdownWidget;let i=t.selectedItem;if(void 0===i){const e=n.value;i=""===n.value?null:n.items.find((t=>t.value===e))}const r=n.button,s=o(r),a=e.disabled,l=e.readonly;i&&!a?s.removeClass(n.buttonPlaceholderClass).html(i.html||"&nbsp;"):l||a?s.removeClass(n.buttonPlaceholderClass).html("&nbsp"):s.html(n.placeholderHtml||"&nbsp;").addClass(n.buttonPlaceholderClass),"BUTTON"===r.tagName&&(r.disabled=a);const c=n.select;c&&(c.disabled=a||l)},expandList(e){const t=e.__DropdownWidget;if("expanded"!==t.state&&"expanding"!==t.state){if("collapsed"===t.state){const e=t.value,n=t.list;n.scrollTop=0,t.items.forEach(((t,i)=>{const r=o(document.createElement("li")).attr({role:"option","data-index":i,"aria-selected":t.value===e?"true":null}).html(t.html);n.appendChild(r[0])}))}const e=o(t.list);if("collapsed"===t.state){e.css({"max-height":"",bottom:"",top:"",transform:""}).show();const n=8,r=e[0].getBoundingClientRect();if(r.bottom+n>window.innerHeight){const i=t.button.getBoundingClientRect();if("auto"===t.dropDirection&&r.height<=i.top)e.css({bottom:"auto",top:"0",transform:"translateY(-100%)"});else{const t=window.innerHeight-r.top-n;e.css("max-height",t+"px")}}i.animation.scrollIntoView(t.list),e.hide()}e.stop().slideDown({complete:()=>{t.state="expanded"}}).focus(),t.button.setAttribute("aria-expanded","true"),t.state="expanding",t.stateChangeTick=(new Date).getTime()}},collapseList(e,t){t=t||{};const n=e.__DropdownWidget;"collapsed"!==n.state&&"collapsing"!==n.state&&(o(n.list).stop().slideUp({complete:()=>{n.button.removeAttribute("aria-expanded"),n.state="collapsed",n.list.innerHTML=""}}),n.state="collapsing",n.stateChangeTick=(new Date).getTime(),!1!==t.focus&&document.activeElement===n.list&&n.button.focus(),!1!==t.resetButtonState&&u.resetButtonState(e)),u.closeSearchPopup(e)},toggleList(e){const t=e.__DropdownWidget;return"expanding"===t.state||"expanded"===t.state?u.collapseList(e):u.expandList(e)},tryGetSelectedListItemAndIndex(e,t){const n=e.__DropdownWidget;let i=-1,r=null;return""!==n.value&&((t=t||{}).listItems||o(n.list).find('[role="option"]')).each(((e,t)=>{if(t.getAttribute("data-field-value")===n.value)return i=e,r=t,!1})),{index:i,element:r}},tryGetActiveListItemAndIndex(e,t){t=t||{};const n=e.__DropdownWidget,i=t.listItems||o(n.list).find('[role="option"]');let r=-1,s=null;return i.each(((e,t)=>{if("true"===t.getAttribute("aria-selected"))return r=e,s=t,!1})),{index:r,element:s}},scrollActiveItemIntoView(e,t){const n=e.__DropdownWidget,r="expanding"===n.state;if(r||"expanded"===n.state){const s=u.tryGetActiveListItemAndIndex(e).element;if(s&&n.scrollToListItem!==s){t=t||{};const e=n.list,a=o(e);let l;r&&(l=a.css("height"),a.css({height:"","overflow-y":""})),r||i.animation.Animation.cancelAll(e),n.scrollToListItem=s,i.animation.scrollIntoView(s,{container:n.list,vertical:t.vertical||"nearest",horizontal:"none",animate:!r}).finally((()=>{n.scrollToListItem=null})),r&&a.css({height:l,"overflow-y":"hidden"})}}},activateItem(e,t){const n=e.__DropdownWidget,i=n.items;let r;if("selected"===t){const e=n.value;r=""===e?-1:i.findIndex((t=>t.value===e))}else r="number"==typeof t?t<0?i.length+t:t:i.indexOf(t);t=r>=0?i[r]:null;const s=o(n.list),a=s.find('[aria-selected="true"]');if((a.length>0?a.attr("data-index"):-1)!==r){const e=o(n.button);if(a.removeAttr("aria-selected"),t){const i=s.find('[role="option"]:nth-child('+(r+1)+")").attr("aria-selected","true").uniqueId();s.attr("aria-activedescendant",i.attr("id")),e.removeClass(n.buttonPlaceholderClass).html(t.html||"&nbsp;").find("[id]").removeAttr("id")}else s.removeAttr("aria-activedescendant"),e.addClass(n.buttonPlaceholderClass).html(n.placeholderHtml||"&nbsp;")}},activateNextItem(e){const t=e.__DropdownWidget,n=o(t.list).find('[role="option"]');if(n.length>0){let t=u.tryGetActiveListItemAndIndex(e,{$listItems:n}).index;u.activateItem(e,(t+1)%n.length)}},activatePreviousItem(e){const t=e.__DropdownWidget,n=o(t.list).find('[role="option"]');if(n.length>0){let t=u.tryGetActiveListItemAndIndex(e,{$listItems:n}).index;u.activateItem(e,t>0?t-1:n.length-1)}},selectActiveItem(e){const t=e.__DropdownWidget,n=u.tryGetActiveListItemAndIndex(e).element;let i=null,r=null;n&&(i=t.items[n.getAttribute("data-index")],r=i.value),u.resetButtonState(e,{selectedItem:i}),t.value!==r&&(t.value=r,e.dispatchEvent("input"),e.dispatchEvent("change"))},tryHandleSearchKeydown(e,t){const n=e.__DropdownWidget;if(t.ctrlKey||t.altKey||t.metaKey)return!1;let r=t.key,s=!1;switch(r){case"Spacebar":r=" ";break;case"Backspace":if(!n.searchTimeoutID)return void t.preventDefault();s=!0;break;default:if(i.events.isSpecialKeyEvent(t))return!1}if(!e.readonly&&!e.disabled){const t=n.searchTimeoutID;t&&clearTimeout(t),n.searchTimeoutID=setTimeout((()=>{n.searchTimeoutID=0,u.closeSearchPopup(e)}),n.searchTimeout);const a=!t,l=n.searchText=s?n.searchText.substring(0,Math.max(n.searchText.length-1,0)):a?r:n.searchText+r;if(l){u.expandList(e);const t=new RegExp("^"+i.regexEscape(l),"i"),n=e.items.find((e=>{let n=e.text;return void 0===n&&(n=e.text=i.htmlToText(e.html)),t.test(n)}));n&&(u.activateItem(e,n),u.scrollActiveItemIntoView(e,{vertical:"centre"}))}const c=n.searchPopupClass;if(c){let t=o(n.searchPopup);0===t.length&&l&&(t=o(document.createElement("div")).attr({"aria-hidden":"true"}).addClass(c).hide().appendTo(e.element).fadeIn(),n.searchPopup=t[0]),t.text(l||" ")}}return t.preventDefault(),!0},closeSearchPopup(e){const t=e.__DropdownWidget,n=t.searchTimeoutID;n&&(clearTimeout(n),t.searchTimeoutID=0);const i=t.searchPopup;t.searchPopup=null;const r=o(i);r.fadeOut({complete:()=>{r.remove()}})},copyToClipboard(e){const t=e.__DropdownWidget;let n;if("expanded"===t.state)n=u.tryGetActiveListItemAndIndex(e).element.innerHTML;else if(""!==t.value){const i=e.items.find((e=>e.value===t.value));i&&(n=i.html)}n&&i.copyHtmlToClipboard(n)},updateSelectOptions(e){const t=e.__DropdownWidget,n=t.select;if(n){n.innerHTML="";const i=t.items,r=t.value;let s=!1;if(""===r&&(0===i.length||""!==i[0].value)){const t=document.createElement("option");t.value="",t.innerHTML=e.placeholderHtml,t.selected=!0,n.appendChild(t),s=!0}for(const e of t.items){const t=document.createElement("option"),i=e.value;t.value=i,t.innerHTML=e.html,s||i!==r||(s=!0,t.selected=!0),n.appendChild(t)}}},handleButtonClick(e){if(!e.defaultPrevented){const t=a.tryClosest(e.currentTarget,c);if(t){e.preventDefault();const n=t.__DropdownWidget;t.readonly||t.disabled||(new Date).getTime()-n.stateChangeTick>=200&&(u.toggleList(t),u.scrollActiveItemIntoView(t))}}},handleButtonKeydown(e){if(!e.defaultPrevented){const t=a.tryClosest(e.currentTarget,c);if(t&&!u.tryHandleSearchKeydown(t,e)){t.__DropdownWidget;const n=t.readonly,i=t.disabled;switch(e.key){case"Down":case"ArrowDown":e.ctrlKey||e.shiftKey||e.altKey||e.metaKey||(e.preventDefault(),n||i||(u.expandList(t),u.activateItem(t,0),u.scrollActiveItemIntoView(t),u.closeSearchPopup(t)));break;case"Up":case"ArrowUp":e.ctrlKey||e.shiftKey||e.altKey||e.metaKey||(e.preventDefault(),n||i||(u.expandList(t),u.activateItem(t,-1),u.scrollActiveItemIntoView(t),u.closeSearchPopup(t)))}}}},handleListBlur(e){const t=a.tryClosest(e.currentTarget,c);t&&(t.__DropdownWidget,u.collapseList(t,{focus:!1}))},handleListKeydown(e){if(!e.defaultPrevented){const t=a.tryClosest(e.currentTarget,c);if(t&&!u.tryHandleSearchKeydown(t,e)){t.__DropdownWidget;const n=t.readonly,i=t.disabled;switch(e.key){case"Down":case"ArrowDown":e.ctrlKey||e.shiftKey||e.altKey||e.metaKey||(e.preventDefault(),n||i||(u.activateNextItem(t),u.scrollActiveItemIntoView(t),u.closeSearchPopup(t)));break;case"Up":case"ArrowUp":e.ctrlKey||e.shiftKey||e.altKey||e.metaKey||(e.preventDefault(),n||i||(u.activatePreviousItem(t),u.scrollActiveItemIntoView(t),u.closeSearchPopup(t)));break;case"Home":e.ctrlKey||e.shiftKey||e.altKey||e.metaKey||(e.preventDefault(),n||i||(u.activateItem(t,0),u.scrollActiveItemIntoView(t),u.closeSearchPopup(t)));break;case"End":e.ctrlKey||e.shiftKey||e.altKey||e.metaKey||(e.preventDefault(),n||i||(u.activateItem(t,-1),u.scrollActiveItemIntoView(t),u.closeSearchPopup(t)));break;case"Enter":e.ctrlKey||e.shiftKey||e.altKey||e.metaKey||(e.preventDefault(),n||i||(u.selectActiveItem(t),u.collapseList(t,{resetButtonState:!1})));break;case"Esc":case"Escape":e.ctrlKey||e.shiftKey||e.altKey||e.metaKey||(e.preventDefault(),u.collapseList(t))}}}},handleListMousemove(e){const t=o(e.target).closest("li")[0];if(t&&"option"===t.getAttribute("role")){const e=a.tryClosest(t,c);e&&("collapsing"===e.__DropdownWidget.state||e.readonly||e.disabled||u.activateItem(e,parseInt(t.getAttribute("data-index"))))}},handleListClick(e){const t=o(e.target).closest("li")[0];if(t&&"option"===t.getAttribute("role")){const n=a.tryClosest(t,c);if(n){const i=n.__DropdownWidget;e.preventDefault(),"collapsing"===i.state||n.readonly||n.disabled||(u.activateItem(n,parseInt(t.getAttribute("data-index"))),u.selectActiveItem(n),u.collapseList(n,{resetButtonState:!1}))}}},handleSelectInput(e){const t=e.currentTarget,n=a.tryClosest(t,c);!n||n.readonly||n.disabled||(n.__DropdownWidget.value=t.value,u.resetButtonState(n))}},d={DropdownWidget:c};e.exports=d},8456:(e,t,n)=>{"use strict";const i=n(2250),r=n(3463),s=n(3846),o=n(9175),a=(i.select,r.Widget),l=o.TextFieldWidgetBase,c=s.FieldValidationResult;class u extends l{constructor(e){super({element:e.element,readonly:e.readonly,disabled:e.disabled,messageType:e.messageType,messageHtml:e.messageHtml,message:e.message,validate:e.validate,placeholderHtml:e.placeholderHtml,placeholder:e.placeholder,readonly:e.readonly,disabled:e.disabled,required:e.required,rootClass:e.rootClass,focusClass:e.focusClass,disabledClass:e.disabledClass,readonlyClass:e.readonlyClass,errorClass:e.errorClass,warningClass:e.warningClass,infoClass:e.infoClass,successClass:e.successClass,messageClass:e.messageClass,messageIconClass:e.messageIconClass,readOnlyNotification:e.readOnlyNotification,normalize:d.normalize,mask:null,validationRegex:null})}_resetInputState(){super._resetInputState(),this._input.setAttribute("inputmode","email")}_onValidateAsync(){const e=this.value;if(e&&!i.isValidEmail(e)){let t="The email address is invalid";return e.indexOf("@")<0&&(t='The email address is missing an "@"'),c.error(this,t)}return super._onValidateAsync()}}u.defaults={rootClass:"ks-emailfield"},Object.setPrototypeOf(u.defaults,l.defaults),a.registerForAutoCreate(u),a.extendSelect(u,{name:"kintsugi.emailfield",allowList:["super"]});const d=u.__EmailFieldWidget={normalize(e){let t=e.trim();return t.length>0&&("<"===t[0]?t=">"===t[t.length-1]?t.substring(1,t.length-1):t.substring(1):">"===t[t.length-1]&&(t=t.substring(0,t.length-1))),t}},h={EmailFieldWidget:u};e.exports=h},3846:(e,t,n)=>{"use strict";const i=n(2250),r=n(7689),s=n(3463),o=n(8182),a=i.select,l=s.Widget;class c extends l{constructor(e){super({element:e.element,rootClass:e.rootClass,focusClass:e.focusClass});let t=null,n=e.messageHtml;void 0===n&&void 0!==e.message&&(t=e.message||"",n=i.htmlEscape(t));const r=""===n?"none":e.message,s=this.constructor.defaults;this.__FieldWidget={messageElem:null,messageIcon:null,required:void 0===e.required?void 0:!!e.required,readonly:void 0===e.readonly?void 0:!!e.readonly,disabled:void 0===e.disabled?void 0:!!e.disabled,messageType:r,messageHtml:n,message:t,validate:e.validate||null,disabledClass:e.disabledClass||s.disabledClass,readonlyClass:e.readonlyClass||s.readonlyClass,errorClass:e.errorClass||s.errorClass,warningClass:e.warningClass||s.warningClass,infoClass:e.infoClass||s.infoClass,successClass:e.successClass||s.successClass,messageClass:e.messageClass||s.messageClass,messageIconClass:e.messageIconClass||s.messageIconClass,readOnlyNotification:null};const o=e.readOnlyNotification;o&&this.setReadOnlyNotification(o)}get value(){return null}set value(e){if(null!==e&&e!==this.value)throw new Error("kintsugi: field value cannot be changed")}getValueCopy(){const e=this.value;return e&&"string"!=typeof e&&"number"!=typeof e?JSON.parse(JSON.stringify(e)):e}get readonly(){const e=this.__FieldWidget;let t=e.readonly;return void 0===t&&(this.initialize(),t=e.readonly),t}set readonly(e){const t=this.__FieldWidget;(e=!!e)!==t.readonly&&(t.readonly=e,this.initialized&&this._onReadonlyChanged(e))}get disabled(){const e=this.__FieldWidget;let t=e.disabled;return void 0===t&&(this.initialize(),t=e.disabled),t}set disabled(e){const t=this.__FieldWidget;(e=!!e)!==t.disabled&&(t.disabled=e,this.initialized&&this._onDisabledChanged(e))}get required(){const e=this.__FieldWidget;let t=e.required;return void 0===t&&(this.initialize(),t=e.required),t}set required(e){const t=this.__FieldWidget;e=!!e,t.required!==e&&(t.required=e,this.initialized&&this._onRequiredChanged(e))}get messageType(){const e=this.__FieldWidget;let t=e.messageType;return t||(this.initialize(),t=e.messageType),t}get message(){const e=this.__FieldWidget;let t=e.message;return null===t&&(e.message=t=i.htmlToText(this.messageHtml)),t}get messageHtml(){const e=this.__FieldWidget;let t=e.messageHtml;return void 0===t&&(this.initialize(),t=e.messageHtml),t}setMessage(e,t){const n=(t||"").toString().trim(),r=i.htmlEscape(n);return u.setMessage(this,e,n,r),this}setMessageHtml(e,t){const n=(t||"").trim();return u.setMessage(this,e,null,n),this}clearMessage(){return u.setMessage(this,"none","",""),this}get readOnlyNotification(){const e=this.__FieldWidget.readOnlyNotification;return null==e?this._defaultReadOnlyNotification:(Object.isSealed(e)||(null==e.message?e.message=i.htmlToText(e.messageHtml):null==e.messageHtml&&(e.messageHtml=i.htmlEscape(e.message)),Object.seal(e)),e)}setReadOnlyNotification(e){var t,n,i,r;let{messageType:s,message:o,messageHtml:a}=e;if("none"===s||""===(null!==(t=o)&&void 0!==t?t:"")&&""===(null!==(n=a)&&void 0!==n?n:""))s="none",o=a="";else if(""===o||""===a)throw new Error("kintsugi: the plain-text and HTML versions of the read-only notification don't match (one is empty and the other is not)");let l=Object.isSealed(e)&&e.messageType===s&&null!=o&&null!=a&&e.message===o&&e.messageHtml===a&&3===Object.keys(e).length;this.__FieldWidget.readOnlyNotification=l?e:{messageType:s,message:null!==(i=o)&&void 0!==i?i:null,messageHtml:null!==(r=a)&&void 0!==r?r:null}}resetReadOnlyNotification(){this.__FieldWidget.readOnlyNotification=null}validateAsync(e){if(e=e||{},this.readonly||this.disabled)return m.successPromise;let t=d.fromAsync(this.initialize()._onValidateAsync());const n=this.__FieldWidget.validate;return n&&(t=t.then((e=>e.ok?d.fromAsync(n()):e))),!1!==e.display&&t.then((e=>(this.displayValidationResult(e),e))),t}displayValidationResult(e){return e.ok?this.clearMessage():this.setMessage(e.messageType,e.message),this}get _messageElem(){const e=this.__FieldWidget;let t=e.messageElem;return t||this.initialized||(this.initialize(),t=e.messageElem),t}get _defaultReadOnlyNotification(){return u.defaultReadOnlyNotification}_onInitialize(){super._onInitialize();const e=this.__FieldWidget,t=this.element,n=a(t),i=e.messageElem=t.querySelector(e.messageClass)||null,r=e.messageIcon=t.querySelector(e.messageIconClass)||null;let s=e.required;if(void 0===s){const t=n.attr("data-field-required");s=null!==t?"true"===t:n.find("input[required],select[required],textarea[required]").length>0,e.required=s}let o=e.disabled;void 0===o&&(e.disabled=o=n.hasClass(e.disabledClass));let l=e.readonly;void 0===l&&(e.readonly=l=n.hasClass(e.readonlyClass));let c=e.messageType,d=e.messageHtml;if(void 0===d){if(c="none",d="",i&&"hidden"!==getComputedStyle(i).display&&(d=i.innerHTML.trim()),d)for(let t in["error","warning","info","success"])if(n.hasClass(e[t+"Class"])){c=t;break}"none"!==c&&d?(e.messageType=c,e.messageHtml=d,e.message=null):(e.messageType=c="none",e.messageHtml=d="",e.message="")}n.addClass(e.rootClass),n.toggleClass(e.readonlyClass,l),n.toggleClass(e.disabledClass,o),r&&r.setAttribute("role","presentation"),this._updateMessageUI(c,d),n.on("keydown",u.handleFieldKeydown).on("paste",u.handleFieldPaste)}_onReadonlyChanged(e){a(this.element).toggleClass(this.__FieldWidget.readonlyClass,e)}_onDisabledChanged(e){a(this.element).toggleClass(this.__FieldWidget.disabledClass,e)}_onRequiredChanged(e){}_onValidateAsync(){const e=this.__FieldWidget,t=this.value;if(e.required&&(null==t||""===t))return d.error(this,"This field is required")}_updateMessageUI(e,t){const n=this.__FieldWidget,r=a(this.element);let s=n.messageElem,o=n.messageIcon;if(r.removeClass([n.errorClass,n.warningClass,n.infoClass,n.successClass]),t){let l=a(s);0===l.length&&(l=a(n.messageElem=s=document.createElement("div")),l.addClass(n.messageClass),this.element.insertBefore(s,n.list)),l.html(t).attr("title",null).show();let c=a(o);0===c.length&&(c=a(n.messageIcon=o=document.createElement("span")),c.addClass(n.messageIconClass).attr("role","presentation"),this.element.insertBefore(o,s)),c.show(),r.addClass(n[e+"Class"]),window.requestAnimationFrame?requestAnimationFrame((()=>{i.isShowingEllipsis(s)&&s.setAttribute("title",s.innerText)})):i.isShowingEllipsis(s)&&s.setAttribute("title",s.innerText)}else s&&a(s).hide(),o&&a(o).hide();return this}_showReadOnlyNotificationIfConfigured(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{messageType:t,messageHtml:n}=this.readOnlyNotification;var i;""!==n&&o.show({for:null!==(i=e.element)&&void 0!==i?i:this.element,messageType:t,message:n,format:"html"})}}c.defaults={disabledClass:"ks-is-disabled",readonlyClass:"ks-is-readonly",errorClass:"ks-is-error",warningClass:"ks-is-warning",infoClass:"ks-is-info",successClass:"ks-is-success",messageClass:"ks-field-message",messageIconClass:"ks-field-messageicon"},Object.setPrototypeOf(c.defaults,l.defaults),l.extendSelect(c,{name:"kintsugi.field",allowCreate:!1,allowList:["super","value","readonly","disabled","required","setMessage","clearMessage"]});const u=c.__FieldWidget={defaultReadOnlyNotification:Object.seal({messageType:"info",message:"This field is read-only",messageHtml:"This field is read-only"}),setMessage(e,t,n,i){const r=e.__FieldWidget;i&&"none"!==t||(t="none",n=i=""),r.messageType===t&&r.messageHtml===i||(r.messageType=t,r.message=n,r.messageHtml=i,e.initialized&&e._updateMessageUI(t,i))},handleFieldKeydown(e){if(!e.defaultPrevented){const t=e.target;if(!0===t.readOnly&&["TEXTAREA","INPUT"].includes(t.tagName)&&(1===e.key.length||"Backspace"===e.key||"Delete"===e.key)&&!e.altKey&&!e.metaKey&&!e.ctrlKey){const n=l.tryGet(e.currentTarget);n&&n.readonly&&!n.disabled&&(e.preventDefault(),n._showReadOnlyNotificationIfConfigured({element:t}))}}},handleFieldPaste(e){if(!e.defaultPrevented){const t=e.target;if(!0===t.readOnly&&["TEXTAREA","INPUT"].includes(t.tagName)){const n=l.tryGet(e.currentTarget);n&&n.readonly&&!n.disabled&&(e.preventDefault(),n._showReadOnlyNotificationIfConfigured({element:t}))}}}};class d{constructor(e){const t=((e=e||{}).message||"").toString().trim(),n=""===t?"none":e.messageType||"error";let i=e.innerResults||[];Array.isArray(i)||(i=[i]),this.__FieldValidationResult={ok:"error"!==n,field:e.field||null,messageType:n,message:t,innerResults:i}}static fromAsync(e){return e?e instanceof d?Promise.resolve(e):e.then((e=>e||m.success)):m.successPromise}static get success(){return m.success}static get successPromise(){return m.successPromise}static error(e,t,n){return new d({field:e,message:t||"An unknown error occurred",innerResults:n})}get ok(){return this.__FieldValidationResult.ok}get field(){return this.__FieldValidationResult.field}get messageType(){return this.__FieldValidationResult.messageType}get message(){return this.__FieldValidationResult.message}get innerResults(){return this.__FieldValidationResult.innerResults}}const h=new d,m=d.__FieldValidationResult={success:h,successPromise:Promise.resolve(h)};class p extends c{constructor(e){super({element:e.element,readonly:e.readonly,disabled:e.disabled,messageType:e.messageType,messageHtml:e.messageHtml,message:e.message,validate:e.validate,validator:e.validator,rootClass:e.rootClass,focusClass:e.focusClass,disabledClass:e.disabledClass,readonlyClass:e.readonlyClass,errorClass:e.errorClass,warningClass:e.warningClass,infoClass:e.infoClass,successClass:e.successClass,messageClass:e.messageClass,messageIconClass:e.messageIconClass}),this.__FieldGroupWidget={value:void 0,fields:void 0,publicFields:void 0,extra:e.extra,validator:e.validator||null,isForm:void 0,saveValue:null,saveHandler:e.saveHandler||null}}get validator(){return this.__FieldGroupWidget.validator}set validator(e){this.__FieldGroupWidget.validator=e||null}get saveHandler(){return this.__FieldGroupWidget.saveHandler}set saveHandler(e){this.__FieldGroupWidget.saveHandler=e||null}get value(){const e=this.__FieldGroupWidget;let t=e.value;return void 0===t&&(this.initialize(),t=e.value),t}set value(e){e=e||{};const t=this.initialize().__FieldGroupWidget,n=t.fields,i=t.extra;for(const t in e)if("_"===t[0]||!n[t]&&!i.hasOwnProperty(t))throw new Error("kintsugi: child field not found: "+JSON.stringify(t));for(const t in n){const i=n[t];if("_"!==t[0]){const n=e.hasOwnProperty(t)?e[t]:null;i.value=n}}for(const t in i)if("_"!==t[0]){let n=e.hasOwnProperty(t)?e[t]:null;n&&"string"!=typeof n&&"number"!=typeof n&&(n=JSON.parse(JSON.stringify(n))),i[t]=n}}getValueCopy(){const e=this.initialize().__FieldGroupWidget,t=e.fields,n=e.extra,i=e.value,r={};for(const e in i){const i=t[e];let s;i?s=i.getValueCopy():(s=n[e],s&&"string"!=typeof s&&"number"!=typeof s&&(s=JSON.parse(JSON.stringify(s)))),r[e]=s}return r}get fields(){const e=this.__FieldGroupWidget;let t=e.publicFields;if(!t){this.initialize(),t={};const n=e.fields;for(const e in n)"_"!==e[0]&&(t[e]=n[e]);e.publicFields=Object.freeze(t)}return e.publicFields}get readonly(){const e=this.initialize().__FieldGroupWidget.fields;for(const t in e)if(!e[t].readonly)return!1;return!0}set readonly(e){e=!!e;const t=this.initialize().__FieldGroupWidget.fields;for(const n in t)t[n].readonly=e}get disabled(){const e=this.initialize().__FieldGroupWidget.fields;for(const t in e)if(!e[t].disabled)return!1;return!0}set disabled(e){e=!!e;const t=this.initialize().__FieldGroupWidget.fields;for(const n in t)t[n].disabled=e}get messageType(){const e=f.tryGetMessageChildField(this.initialize());return e?e.messageType:"none"}get message(){const e=f.tryGetMessageChildField(this.initialize());return e?e.message:""}get messageHtml(){const e=f.tryGetMessageChildField(this.initialize());return e?e.messageHtml:""}setMessage(e,t){return this.setMessageHtml(e,i.htmlEscape(t))}setMessageHtml(e,t){return e&&t||(e="none",t=""),this._updateMessageUI(e,t),this}clearMessage(){return this._updateMessageUI("none",""),this}displayValidationResult(e){let t=!1;if(!e.ok&&e.field===this){const n=e.innerResults;if(n.length>0){const e=this.initialize().__FieldGroupWidget.fields;for(const i in e){const r=e[i],s=n.find((e=>e.field===r));s?(r.displayValidationResult(s),t=!0):r.clearMessage()}}}return t?this:super.displayValidationResult(e)}startBusy(){return r.startBusy({element:this.element}),this}stopBusy(){return r.stopBusy({element:this.element}),this}saveAsync(e){e=e||{};const t=this.__FieldGroupWidget;if(t.saveValue)throw new Error("kintsugi: field group already saving");this.startBusy();let n,i=Promise.resolve();const r=t.saveValue=this.getValueCopy(),s=!1!==e.showValidation,o=!1!==e.showError;return!1!==e.validate&&(i=i.then((()=>this.validateAsync({display:s}))).then((e=>{if(n=e,!n.ok)throw new Error("Field validation failed")}))),i=i.then((()=>{const e={fieldGroup:this,value:r};return this._onSaveAsync(e)})),i=i.finally((()=>{this.stopBusy(),t.saveValue=null})),o&&(i=i.catch((e=>{throw n&&!n.ok||(console.error(e),"function"==typeof alert&&alert("An error occurred while saving; please try again")),e instanceof Error?e:new Error("An unknown error occurred")})),i.catch((()=>{}))),i}_onInitialize(){const e=this.element,t=this.__FieldGroupWidget,n=t.isForm="FORM"===e.tagName,i=t.fields=this._initializeFields(),r=t.extra=this._initializeExtra(t.extra),s={};for(const e in i){const t=i[e];t.initialize(),"_"!==e[0]&&Object.defineProperty(s,e,{get:()=>t.disabled?void 0:t.value,set:e=>{t.value=e},enumerable:!0})}for(const e in r)if("_"!==e[0]){if(i[e])throw new Error("kintsugi: extra key "+JSON.stringify(e)+" conflicts with field");Object.defineProperty(s,e,{get:()=>r[e],set:t=>r[e]=t,enumerable:!0})}t.value=Object.seal(s),super._onInitialize(),n&&a(e).on("submit",f.handleFormSubmit).on("reset",f.handleFormReset).on("formdata",f.handleFormFormdata)}_initializeFields(){const e={};let t=0;for(const n of l.find({root:this.element,create:!0})){if(!(n instanceof c))continue;let i=n.element.getAttribute("data-fieldgroup-field");if(i||(i="__anonymous"+t++),e[i])throw new Error("kintsugi: field name already used: "+JSON.stringify(i));e[i]=n}return e}_initializeExtra(e){if(e)return JSON.parse(JSON.stringify(e));{let e=this.element.getAttribute("data-fieldgroup-extra");return e?("{"!==e[0]&&(e=i.base64Decode(e,"utf8")),JSON.parse(e)):{}}}_findFocusTarget(){for(const e in l.find(this.element)){const t=e._findFocusTarget();if(t)return t}return super._findFocusTarget()}_updateMessageUI(e,t){const n=this.__FieldGroupWidget.fields;if(t){let r,s=-9999;const o=Object.values(n);for(const e of l.find(this.element)){const t=(i.isVisible(e.element)?0:-1e3)+(o.indexOf(e)>=0?0:-100)+(e.disabled?-10:0)+(e.readonly?-1:0);t>s&&(r=e,s=t)}for(const i in n){const s=n[i];s===r?s.setMessageHtml(e,t):s.clearMessage()}}else for(const e in n)n[e].clearMessage()}_onValidateAsync(){const e=this.__FieldGroupWidget,t=e.validator;if(t)return t.validateAsync({root:this.element,display:!1}).then((e=>{if(e.ok)return super._onValidateAsync();{const t=[],n=new Map;for(const i of e.errors){const e=i.fieldValidationResult;for(const r of i.reportOn)n.has(r)||(n.set(r),t.push(e&&e.field===r?e:d.error(r,i.message)))}return d.error(this,t.length>0?t[0].message:"An unknown error occurred",t)}}));{const t=[],n=[],i=e.fields;for(const e in i){const r=i[e];t.push(r.validateAsync({display:!1}).then((e=>{e.ok||n.push(e)})))}return Promise.all(t).then((()=>0===n.length?super._onValidateAsync():d.error(this,n[0].message,n)))}}_onSaveAsync(e){const t=this.__FieldGroupWidget.saveHandler;if(t){const n=t(e);if(!(n instanceof Promise))throw new Error("kintsugi: save handler did not return a Promise");return n}throw new Error("kintsugi: field group does not have a save handler attached")}}p.defaults={rootClass:"ks-fieldgroup"},Object.setPrototypeOf(p.defaults,c.defaults),l.registerForAutoCreate(p),l.extendSelect(p,{name:"fieldgroup",allowList:["super"]});const f=p.__FieldGroupWidget={tryGetMessageChildField(e){const t=e.__FieldGroupWidget.fields;let n=null,i=0;for(const e in t){const r=t[e];let s;switch(r.messageType){case"error":s=4;break;case"warning":s=3;break;case"info":s=2;break;case"success":s=1}if(s>=4)return r;s>i&&(n=r,i=s)}return n},handleFormSubmit(e){if(!e.defaultPrevented){const t=e.target;if(t===e.currentTarget){const n=l.tryGet(t,p);n&&(e.preventDefault(),n.__FieldGroupWidget,n.disabled||n.readonly||n.saveAsync())}}},handleFormReset(e){if(!e.defaultPrevented){const t=e.target;if(t===e.currentTarget){const n=l.tryGet(t,p);!n||n.readonly||n.disabled||(e.preventDefault(),n.value=null,n.clearMessage().dispatchEvent("input"))}}},handleFormFormdata(e){const t=e.target;if(t===e.currentTarget){const n=l.tryGet(t,p);if(n){const t=n.__FieldGroupWidget,i=e.formData,r=[{prefix:"",value:t.value}];for(let e=0;e<r.length;++e){const t=r[e],n=t.value,s=t.prefix;for(const e in n){const t=s?s+"."+e:e,o=n[e];"object"!=typeof o||Array.isArray(o)?"string"==typeof o?i.append(t,o):void 0!==o&&i.append(t,JSON.stringify(o)):r.push({prefix:t,value:o})}}}}}},g={FieldWidget:c,FieldValidationResult:d,FieldGroupWidget:p};e.exports=g},3938:(e,t,n)=>{"use strict";const i=n(3463);e.exports=i},8617:(e,t,n)=>{"use strict";const i=n(2250),r=n(3784),s=n(3463),o=n(3846),a=n(9175),l=i.select,c=s.Widget,u=a.TextFieldWidgetBase,d=o.FieldValidationResult;class h extends u{constructor(e){super({element:e.element,readonly:e.readonly,disabled:e.disabled,required:e.required,messageType:e.messageType,messageHtml:e.messageHtml,message:e.message,validate:e.validate,placeholderHtml:e.placeholderHtml,placeholder:e.placeholder,rootClass:e.rootClass,focusClass:e.focusClass,disabledClass:e.disabledClass,readonlyClass:e.readonlyClass,errorClass:e.errorClass,warningClass:e.warningClass,infoClass:e.infoClass,successClass:e.successClass,messageClass:e.messageClass,messageIconClass:e.messageIconClass,readOnlyNotification:e.readOnlyNotification,mask:null,validationRegex:null});const t=this.constructor.defaults;this.__NumberFieldWidget={stepUpElement:void 0,stepDownElement:void 0,stepUpButtonClass:e.stepUpButtonClass||t.stepUpButtonClass,stepDownButtonClass:e.stepDownButtonClass||t.stepDownButtonClass,format:"default"===e.format?"number":e.format,minValue:e.minValue,maxValue:e.maxValue,decimalPlaces:e.decimalPlaces,stepIntervalID:0}}get value(){return super.value}set value(e){super.value=e,this.initialized&&null!==this.__NumberFieldWidget.step&&this._input.setAttribute("aria-valuenow",this.value)}_onInitialize(){const e=this.__NumberFieldWidget,t=this.element;let n=e.format;void 0===n&&(n=t.getAttribute("data-field-format")||"number","default"===n&&(n="number"),e.format=n);let i=e.minValue;if(void 0===i){const n=parseFloat(t.getAttribute("data-field-min"));e.minValue=i=Number.isFinite(n)?n:null}let r=e.maxValue;if(void 0===r){const n=parseFloat(t.getAttribute("data-field-max"));e.maxValue=r=Number.isFinite(n)?n:null}let s=e.decimalPlaces;if(void 0===s){const n=parseInt(t.getAttribute("data-field-decimal-places"));e.decimalPlaces=s=Number.isFinite(n)?n:null}let o=e.step;if(void 0===o){const n=parseFloat(t.getAttribute("data-field-step"));e.step=o=Number.isFinite(n)&&0!==n?n:null}super._onInitialize();const a=e.stepUpButtonClass,c=e.stepDownButtonClass;let u=t.querySelector("."+a),d=t.querySelector("."+c);o?(u||(u=document.createElement("div"),u.classList.add(a),t.appendChild(u)),d||(d=document.createElement("div"),d.classList.add(c),t.appendChild(d)),l([u,d]).attr("aria-hidden","true").on("pointerdown touchstart",m.handleStepPointerDownOrTouchStart)):(u&&u.remove(),d&&d.remove(),u=d=null),e.stepUpElement=u,e.stepDownElement=d,l(this._input).on("keydown",m.handleInputKeydown).on("input",m.handleInputInput)}_resetInputState(){const e=this.__NumberFieldWidget,t=e.step,n=e.minValue,i=e.maxValue,r=this._input;super._resetInputState(),r.setAttribute("inputmode",0===e.decimalPlaces?"decimal":"numeric"),null!==t&&(r.setAttribute("role","spinbutton"),r.setAttribute("aria-valuenow",this.value)),null!==n&&r.setAttribute("aria-valuemin",n),null!==i&&r.setAttribute("aria-valuemax",i)}_onValidateAsync(){const e=this.__NumberFieldWidget,t=this.value;if(""!==t){const n=parseFloat(t),i=e.minValue;if(null!==i&&n<i)return d.error(this,"Value must be at least "+r.formatNumber(i));const s=e.maxValue;if(null!==s&&n>s)return d.error(this,"Value cannot exceed "+r.formatNumber(s))}return super._onValidateAsync()}_formatValue(e,t){const n=this.__NumberFieldWidget;if(!e)return e;const i=n.format,s=n.decimalPlaces;let o;switch(i){case"percent":o=r.formatNumber({value:parseFloat(e)/100,decimalPlaces:s,format:n.format});break;case"km":o=r.formatNumber({value:e,decimalPlaces:s})+" km";break;default:o=r.formatNumber({value:e,decimalPlaces:s,format:n.format})}return o}_normalizeValue(e){const t=this.__NumberFieldWidget.decimalPlaces,n="([-+]?)s*((?:\\d|"+i.regexEscape(",")+"|"+i.regexEscape(".")+")+)";e=super._normalizeValue(e);const r=new RegExp(n).exec(e);let s,o,a;if(r){s="-"===r[1]?"-":"";const e=r[2],t=e.indexOf(".");t<0?(o=e,a=""):(o=e.substring(0,t),a=e.substring(t+1));const n=new RegExp(i.regexEscape(","),"g");o=o.replace(n,""),a=a.replace(n,"")}return o||a?(null!=t&&(a=a.length>=t?a.substring(0,t):a.padEnd(t,"0")),s+o+(a.length>0?"."+a:"")):""}}h.defaults={rootClass:"ks-numberfield",stepUpButtonClass:"ks-numberfield-step-up",stepDownButtonClass:"ks-numberfield-step-down"},Object.setPrototypeOf(h.defaults,u.defaults),c.registerForAutoCreate(h),c.extendSelect(h,{name:"kintsugi.numberfield",allowList:["super"]});const m=h.__NumberFieldWidget={stepValue(e,t,n){const i=e.__NumberFieldWidget,r=i.step;if(null!==r){const s=e.value,o=i.maxValue,a=i.minValue,l=n?10*r:r;let c=parseFloat(s||"0")+l*t;null!==a&&(c=Math.max(c,a)),null!==o&&(c=Math.min(c,o)),e.value!==c&&(e.value=c,e.dispatchEvent("input"))}},startStepping(e,t,n){const i=e.__NumberFieldWidget;if(i.stepIntervalID)return!1;{const r=(new Date).getTime();let s=300;const o=()=>{m.stepValue(e,t,n);const a=(new Date).getTime()-r;let l;l=a>=1500?50:a>=1e3?100:a>=500?200:s,l!==s&&(s=l,clearInterval(i.stepIntervalID),i.stepIntervalID=setInterval(o,s))};return i.stepIntervalID=setInterval(o,300),o(),!0}},stopStepping(e){const t=e.__NumberFieldWidget,n=t.stepIntervalID;n&&(clearInterval(n),t.stepIntervalID=0,t.stepStartAt=0)},handleInputKeydown(e){if(!e.defaultPrevented){const t=c.closest(e.currentTarget,h);if(t&&!(t.readonly||e.ctrlKey||e.altKey||e.shiftKey||e.metaKey)){const n=t.__NumberFieldWidget,r=n.format,s=n.step,o=n.minValue,a=n.maxValue;switch(e.key){case"ArrowUp":case"Up":s&&(e.preventDefault(),m.stepValue(t,1));break;case"ArrowDown":case"Down":s&&(e.preventDefault(),m.stepValue(t,-1));break;case"PageUp":s&&(e.preventDefault(),m.stepValue(t,1,!0));break;case"PageDown":s&&(e.preventDefault(),m.stepValue(t,-1,!0));break;case"Home":s&&(e.preventDefault(),null!==a&&t.value!==a&&(t.value=a,t.dispatchEvent("input")));break;case"End":s&&(e.preventDefault(),null!==o&&t.value!==o&&(t.value=o,t.dispatchEvent("input")));break;case",":case".":break;case"-":null!==o&&o>=0&&e.preventDefault();break;case"$":"currency"!==r&&e.preventDefault();break;case"%":"percent"!==r&&e.preventDefault();break;default:!i.events.isSpecialKeyEvent(e)&&(e.key<"0"||e.key>"9")&&e.preventDefault()}}}},handleInputInput(e){const t=c.tryClosest(e.currentTarget,h);t&&t.__NumberFieldWidget.step&&t._input.setAttribute("aria-valuenow",t.value)},handleStepPointerDownOrTouchStart(e){if(!e.defaultPrevented){const t=c.tryClosest(e.currentTarget,h);if(t&&(e.preventDefault(),!(t.disabled||t.readonly||e.ctrlKey||e.altKey||e.metaKey))){const n=t.__NumberFieldWidget,i=e.currentTarget===n.stepUpElement?1:-1;if(t.focus(),m.startStepping(t,i,e.shiftKey)){const e=()=>{m.stopStepping(t),window.removeEventListener("pointerup",e),window.removeEventListener("touchend",e)};window.addEventListener("pointerup",e),window.addEventListener("touchend",e)}}}}},p={NumberFieldWidget:h};e.exports=p},9175:(e,t,n)=>{const i=n(2250),r=n(9331),s=n(3463),o=n(3846),a=i.select,l=s.Widget,c=o.FieldWidget,u=o.FieldValidationResult;class d extends c{constructor(e){super({element:e.element,readonly:e.readonly,disabled:e.disabled,required:e.required,messageType:e.messageType,messageHtml:e.messageHtml,message:e.message,validate:e.validate,rootClass:e.rootClass,focusClass:e.focusClass,disabledClass:e.disabledClass,readonlyClass:e.readonlyClass,errorClass:e.errorClass,warningClass:e.warningClass,infoClass:e.infoClass,successClass:e.successClass,messageClass:e.messageClass,messageIconClass:e.messageIconClass,readOnlyNotification:e.readOnlyNotification});let t=null,n=e.placeholderHtml;void 0===n?(t=e.placeholder,void 0!==t&&(n=null,t=e.placeholder||"")):t=i.htmlToText(n);let s=e.mask;"string"==typeof s&&(s=new r.TextMask(s));let o=e.validationRegex;"string"==typeof o&&(o=new RegExp(o,"u")),this.__TextFieldWidgetBase={input:null,value:void 0,placeholder:t,placeholderHtml:n,normalize:e.normalize||null,format:e.format||null,spellcheck:e.spellcheck,validationRegex:o,mask:s,maskValue:e.maskValue,originalInputType:void 0,originalInputMode:void 0}}get value(){const e=this.__TextFieldWidgetBase;let t=e.value;return void 0===t&&(this.initialize(),t=e.value),t}set value(e){const t=this.__TextFieldWidgetBase;e=this.initialize()._normalizeValue(e),t.value!==e&&(t.value=e,this.initialized&&h.updateInputValue(this))}get placeholder(){const e=this.__TextFieldWidgetBase;let t=e.placeholder;return void 0===t&&(this.initialize(),t=e.placeholder),t}set placeholder(e){const t=this.__TextFieldWidgetBase;e=(e||"").toString(),t.placeholder=e,t.placeholderHtml=null,this.initialized&&(t.input.placeholder=e)}get placeholderHtml(){const e=this.__TextFieldWidgetBase;let t=e.placeholderHtml;return void 0===t&&(this.initialize(),t=e.placeholderHtml),null===t&&(t=e.placeholderHtml=i.htmlEscape(this.placeholder)),t}set placeholderHtml(e){const t=this.__TextFieldWidgetBase;e=(e||"").toString(),t.placeholderHtml=e;const n=t.placeholder=i.htmlToText(e);this.initialized&&(t.input.placeholder=n)}get _input(){const e=this.__TextFieldWidgetBase;let t=e.input;return t||(this.initialize(),t=e.input),t}get _normalize(){return this.__TextFieldWidgetBase.normalize}set _normalize(e){const t=this.__TextFieldWidgetBase;if(t.normalize=e||null,e&&(this.initialized||void 0!==t.value)){let n=this.value;t.value=n=e(n),this.initialized&&h.updateInputValue(this)}}get _format(){return this.__TextFieldWidgetBase.format}set _format(e){this.__TextFieldWidgetBase.format=e,this.initialized&&h.updateInputValue(this)}get _mask(){const e=this.__TextFieldWidgetBase;let t=e.mask;return void 0===t&&(this.initialize(),t=e.mask),t}set _mask(e){const t=this.__TextFieldWidgetBase;"string"==typeof(e=e||null)&&(e=new r.TextMask(e)),t.mask=e,this.initialized&&(this._resetInputState(),h.updateValueFromInput(this))}get _maskValue(){const e=this.__TextFieldWidgetBase;let t=e.maskValue;return void 0===t&&(this.initialize(),t=e.maskValue),t}set _maskValue(e){const t=this.__TextFieldWidgetBase;if((e=(e||"formatted").toString())!==t.maskValue&&(t.maskValue=e,t.mask)){let e=t.value;void 0!==e&&(t.value=e=this._normalizeValue(e))}}get _validationRegex(){const e=this.__TextFieldWidgetBase;let t=e.validationRegex;return void 0===t&&(this.initialize(),t=e.validationRegex),t}set _validationRegex(e){const t=this.__TextFieldWidgetBase;e="string"==typeof e?new RegExp(e,"u"):e||null,t.validationRegex=e}get _spellcheck(){const e=this.__TextFieldWidgetBase;let t=e.spellcheck;return void 0===t&&(this.initialized(),t=e.spellcheck),t}set _spellcheck(e){const t=this.__TextFieldWidgetBase;e=!!e,t.spellcheck!==e&&(t.spellcheck=e,this.initalized&&this.input.setAttribute("spellcheck",e?"true":"false"))}_onInitialize(){super._onInitialize();const e=this.__TextFieldWidgetBase,t=this.element;let n=e.input=t.querySelector("input");n||(e.input=n=document.createElement("input"),t.appendChild(n));const s=a(t),o=a(n);e.originalInputType=n.type,e.originalInputMode=n.getAttribute("inputmode");let l=e.placeholder;if(void 0===l){let t=s.attr("data-field-placeholder-html");null!==t?l=i.htmlToText(t):(l=s.attr("data-field-placeholder"),null===l&&(l=n.placeholder||"")),e.placeholderHtml=t,e.placeholder=l}let c=e.validationRegex;void 0===c&&(c=o.attr("pattern"),c=c?new RegExp("^"+c+"$","u"):null,e.validationRegex=c);let u=e.mask;if(void 0===u){const t=this._detectMask();t&&(u=new r.TextMask(t)),e.mask=u||null}let d=e.maskValue;if(void 0===d){const t=this._detectMaskValue();e.maskValue=d="data"===t?"data":"formatted"}let m=e.spellcheck;void 0===m&&(e.spellcheck=m="true"===n.getAttribute("spellcheck"));let p=e.value;void 0===p&&(e.value=p=this._normalizeValue(n.value)),this._resetInputState(),o.on("paste",h.handleInputPaste).on("input change",h.handleInputInputOrChange).on("keydown",h.handleInputKeydown)}_detectMask(){return null}_detectMaskValue(){return"formatted"}_onFocus(){super._onFocus(),this.value?h.updateInputValue(this,{resetSelect:!0}):setTimeout((()=>{this.focused&&h.updateInputValue(this,{resetSelect:!0})}),100)}_onBlur(){h.updateInputValue(this,{resetSelect:!1}),super._onBlur()}_updateMessageUI(e,t){super._updateMessageUI(e,t);const n=this.__TextFieldWidgetBase,r=a(n.input);if(t){const t=this._messageElem;r.attr({"aria-invalid":"error"===e?"true":null,"aria-describedby":i.ensureID(t).id})}else r.removeAttr("aria-invalid aria-describedby")}_onReadonlyChanged(e){super._onReadonlyChanged(e),this.__TextFieldWidgetBase.input.readOnly=e}_onDisabledChanged(e){super._onDisabledChanged(e),this.__TextFieldWidgetBase.input.disabled=e}_onValidateAsync(){const e=this.__TextFieldWidgetBase,t=e.value;if(t){const n=e.mask;if(n&&!n.evaluate(t).complete)return u.error(this,"The value is incomplete");const i=e.validationRegex;if(i&&!i.test(t))return u.error(this,"The value is invalid")}return super._onValidateAsync()}_resetInputState(){const e=this.__TextFieldWidgetBase,t=e.input,n=e.mask;t.placeholder=e.placeholder,t.readOnly=this.readonly,t.disabled=this.disabled,t.type="text",t.required=!1,t.removeAttribute("pattern"),t.setAttribute("spellcheck",e.spellcheck?"true":"false"),n&&n.isNumeric?t.setAttribute("inputmode","tel"):e.originalInputMode?t.setAttribute("inputmode",e.originalInputMode):t.removeAttribute("inputmode"),h.updateInputValue(this)}_normalizeValue(e){const t=this.__TextFieldWidgetBase;e=null==e?"":e.toString().trim();let n=t.mask;if(void 0===n&&(this.initialize(),n=t.mask),n){const i=n.evaluate(e);if(i.data){let n=t.maskValue;void 0===n&&(this.initialize(),n=t.maskValue),e=i[t.maskValue]}else e=""}const i=t.normalize;return i&&(e=i(e)),e}_formatValue(e,t){const n=this.__TextFieldWidgetBase;e=null==e?"":e.toString().trim();const i=n.format;return i&&(e=i(e,t)),e}}d.defaults={},Object.setPrototypeOf(d.defaults,c.defaults),l.extendSelect(d,{allowList:["super","placeholder","placeholderHtml"]});const h=d.__TextFieldWidgetBase={updateValueFromInput(e){const t=e.__TextFieldWidgetBase,n=t.input;let i=n.value.trim();const r=t.mask;if(r&&(document.activeElement===n||i)){const e=n.selectionStart,s=n.selectionEnd,o=r.evaluate(i.substring(0,e)),a=s<=e?o:r.evaluate(i.substring(0,s)),l=s>=i.length?a:r.evaluate(i);i=l.data?l[t.maskValue]:"",n.value=l.display,n.setSelectionRange(o.formatted.length,a.formatted.length)}if(this._normalizeValue!==d.prototype._normalizeValue)i=e._normalizeValue(i);else{const e=t.normalize;e&&(i=e(i))}t.value=i},updateInputValue(e,t){t=t||{};const n=e.__TextFieldWidgetBase,i=n.value;let r=i;const s=e.focused&&!e.readonly&&!e.disabled;r=e._formatValue(r,s?"focus":"default");const o=n.mask;let a;o&&(s||i)&&(a=o.evaluate(i),r=a.display);const l=n.input,c=r!==l.value;c&&(l.value=r);let u=t.resetSelect;if(void 0===u&&(u=c&&s),u){let e,t;a&&!a.data?e=t=a.formatted.length:(e=0,t=r.length),l.setSelectionRange(e,t)}},tryHandleMaskedBackspace(e){const t=e.__TextFieldWidgetBase,n=t.input;let r=n.selectionStart;if(!r||r!==n.selectionEnd)return!1;const s=t.mask,o=n.value,a=s.evaluate(o);if(!a.data)return!0;const l=o.substring(0,r),c=o.substring(r);for(let t=l.length;t>=0;--t){const r=l.substring(0,t),o=r+c;if(s.evaluate(o).data!==a.data)return n.value=o,n.setSelectionRange(r.length,r.length),h.updateValueFromInput(e),setTimeout((()=>{i.events.dispatchEvent(n,"input")}),0),!0}return!1},handleInputInputOrChange(e){const t=l.tryClosest(e.currentTarget,d);t&&h.updateValueFromInput(t)},handleInputKeydown(e){if(!e.defaultPrevented){const t=l.tryClosest(e.currentTarget,d);if(t)switch(e.key){case"Backspace":t.readonly||e.altKey||e.metaKey||e.ctrlKey||t.__TextFieldWidgetBase.mask&&h.tryHandleMaskedBackspace(t)&&e.preventDefault();break;case"ArrowRight":case"Right":case"End":{const e=t.__TextFieldWidgetBase,n=e.mask;n&&setTimeout((()=>{const t=e.input,i=n.evaluate(t.value).formatted.length,r=Math.min(t.selectionStart,i),s=Math.min(t.selectionEnd,i);t.setSelectionRange(r,s)}),0)}}}}};class m extends d{constructor(e){super({element:e.element,readonly:e.readonly,disabled:e.disabled,required:e.required,messageType:e.messageType,messageHtml:e.messageHtml,message:e.message,validate:e.validate,validationRegex:e.validationRegex,placeholderHtml:e.placeholderHtml,placeholder:e.placeholder,readonly:e.readonly,disabled:e.disabled,spellcheck:e.spellcheck,rootClass:e.rootClass,focusClass:e.focusClass,disabledClass:e.disabledClass,spellcheck:e.spellcheck,readonlyClass:e.readonlyClass,errorClass:e.errorClass,warningClass:e.warningClass,infoClass:e.infoClass,successClass:e.successClass,messageClass:e.messageClass,messageIconClass:e.messageIconClass,readOnlyNotification:e.readOnlyNotification,normalize:e.normalize,format:e.format,mask:e.mask,maskValue:e.maskValue})}get normalize(){return this._normalize}set normalize(e){this._normalize=e}get format(){return this._format}set format(e){this._format=e}get validationRegex(){return this._validationRegex}set validationRegex(e){this._validationRegex=e}get mask(){return this._mask}set mask(e){this._mask=e}get maskValue(){return this._maskValue}set maskValue(e){this._maskValue=e}_detectMask(){return this.element.getAttribute("data-field-mask")}_detectMaskValue(){return this.element.getAttribute("data-field-mask-value")||"formatted"}}m.defaults={rootClass:"ks-textfield"},Object.setPrototypeOf(m.defaults,d.defaults),l.registerForAutoCreate(m),l.extendSelect(m,{name:"kintsugi.textfield",allowList:["super","normalize","format","mask","maskValue","validationRegex"]});const p={TextFieldWidgetBase:d,TextFieldWidget:m};e.exports=p},859:(e,t,n)=>{"use strict";const i=n(2250),r=n(3463),s=n(3846),o=i.select,a=r.Widget,l=s.FieldWidget,c=s.FieldValidationResult;class u{constructor(){this.__Validator={rules:[]}}static get nullInstance(){return d.nullInstance}static define(){return new h}validateAsync(e){("object"!=typeof e||e instanceof HTMLElement||e instanceof Document)&&(e={root:e});const t=this.__Validator,n=e.root;if(!n)throw new Error("kintsugi: no root specified for validation");const i=new m({root:n}),r=[],s=[];for(const e of t.rules){const t=e.setup(i),n=t.fields;r.push({fields:n,data:t.data,validate:e.validate});for(const e of n)s.indexOf(e)<0&&s.push(e)}return r.reverse(),new Promise(((t,n)=>{const o=new Map;let a=0;const l=()=>{for(let e=r.length-1;e>=0;--e){const t=r[e],n=t.fields;let s=!0,c=!1;for(const e of n){if(i.hasErrorFor(e)){c=!0;break}if(o.get(e)){s=!1;break}}if(c)r.splice(e,1);else if(s){r.splice(e,1);const s=new m({parent:i,currentFields:n});let c=t.validate(s,t.data);if(c&&"function"==typeof c.then){++a;for(const e of n)o.set(e,!0);c.then(null,(e=>{e&&console.error(e),s.error("An unexpected error occurred")})).then((()=>{--a;for(const e of n)o.set(e,!1);l()}))}}}if(0===a){const n=new p({fields:s,errors:i.errors});!1!==e.display&&n.display(),t(n)}};l()}))}}const d=u.__Validator={nullInstance:new u,implicitFieldRule:{setup:e=>{const t=a.find(e.root);return{fields:t,data:t}},validate:(e,t)=>{const n=[];for(const i of t)n.push(i.validateAsync({display:!1}).then((t=>{t.ok||e.error(t)})));return Promise.all(n)}}};class h{constructor(){this.__ValidatorBuilder={implicit:!0,rules:[d.implicitFieldRule]}}create(){const e=this.__ValidatorBuilder,t=new u;return t.__Validator.rules=e.rules.slice(),t}disableImplicit(){const e=this.__ValidatorBuilder;return e.implicit&&(e.implicit=!1,e.rules.splice(0,1)),this}rule(e,t){return e=Array.isArray(e)?e:[e],this.raw({setup:t=>{const n=[null],i=[];let r=!1;for(const s of e){const e=t.selectFields(s);if(e.length>0){n.push(1===e.length?e[0]:e);for(const t of e)i.indexOf(t)<0&&i.push(t)}else r=!0}return{fields:i,data:{skip:r,validateArgs:n}}},validate:(e,n)=>{if(!n.skip){const i=n.validateArgs;return i[0]=e,t.apply(t,i)}}})}atLeastOneOf(e,t){return this.raw({setup:t=>{const n=t.selectFields(e);return{fields:n,data:n}},validate:(e,n)=>{for(const e of n)if(""!==e.value)return;let r=t;if(!r){const e=[];for(const t of n){const n=t.element,r=o(n).find(i.focusableSelector);let s;if(1===r.length&&(s=r.closest("label"),0===s.length&&r.attr("id")&&(s=o('label[for="'+r.attr("id")+'"]'))),!s||0===s.length){const e=n.previousSibling;e&&"label"===e.tagName&&(s=o(e))}if(s&&s.length>0){const t=s[0],n=i.device.isNodeJS()?t.textContent:t.innerText,r=/^\s*(.+?)\s*[:-]\s*$/.exec(n);e.push(r?r[1]:n)}}r=e.length<=1?"This field is required":2===e.length?"Provide either "+e[0]+" or "+e[1]:"Provide at least one of: "+e.slice(0,-1).join(", ")+" or "+e[e.length-1]}e.error(r)}})}raw(e){return this.__ValidatorBuilder.rules.push(e),this}}class m{constructor(e){const t=(e=e||{}).parent||null;let n=void 0===e.root?t?t.root:document:e.root;if("string"==typeof n){const e=document.querySelectorAll(n);if(1===e.length)n=e[0];else{if(rootElement.length>1)throw new Error("kintsugi: validation root matched more than one element");n=null}}this.__ValidationContext={parent:t,root:n,currentFields:void 0===e.currentFields?t?t.currentFields:[]:e.currentFields,errors:t?t.errors:[]}}get root(){return this.__ValidationContext.root}get currentFields(){return this.__ValidationContext.currentFields}get errors(){return this.__ValidationContext.errors}error(e){"string"==typeof(e=e||{})?e={message:e}:e instanceof c&&(e={message:e.message,reportOn:e.field,fieldValidationResult:e});const t=this.__ValidationContext,n=(e.reportOn?this.selectFields(e.reportOn):this.currentFields)||[];return t.errors.push({message:e.message,reportOn:n,fieldValidationResult:e.fieldValidationResult||null}),this}selectFields(e){const t=[],n=this.__ValidationContext.root;if(n){const i=Array.isArray(e)?e:[e];for(const e of i)if(e instanceof l)t.indexOf(e)<0&&n.contains(e.element)&&t.push(e);else if(e instanceof HTMLElement){const i=a.tryGet(e,l);i&&t.indexOf(i)<0&&n.contains(e)&&t.push(i)}else for(const i of n.querySelectorAll(e)){const e=a.tryGet(i,l);e&&t.indexOf(e)<0&&t.push(e)}}return t}hasErrorFor(e){for(const t of this.__ValidationContext.errors)if(t.reportOn.indexOf(e)>=0)return!0;return!1}}class p{constructor(e){e||(e=[]),this.__ValidationResult={fields:e.fields||[],errors:e.errors||[]}}get ok(){return 0===this.__ValidationResult.errors.length}get fields(){return this.__ValidationResult.fields}get errors(){return this.__ValidationResult.errors}display(){const e=this.__ValidationResult,t=e.errors,n=new Map;for(const e of t){const t=e.fieldValidationResult;for(const i of e.reportOn)n.get(i)||(n.set(i,!0),t&&t.field===i?i.displayValidationResult(t):i.setMessage("error",e.message))}for(const t of e.fields)n.get(t)||t.clearMessage();return this}}const f={Validator:u,ValidatorBuilder:h,ValidationContext:m,ValidationResult:p};e.exports=f},5729:(e,t,n)=>{const i=n(2250),r=n(3463),s=i.select,o=r.Widget;let a;function l(e){return a||(a=n(233)),a.VideoPlayer.create(e)}class c extends o{constructor(e){super({element:e.element,rootClass:e.rootClass,focusClass:e.focusClass});let t=e.titlePage||null;!0===t&&(t={});const n={video:e.video,aspectRatio:e.aspectRatio||"auto",videoPlayer:l({video:e.video}),autoplay:!!e.autoplay,titlePage:t};Object.defineProperty(this,"__VideoPlayerWidget",{value:n})}get video(){return this.__VideoPlayerWidget.video}get videoPlayer(){return this.__VideoPlayerWidget.videoPlayer}_onInitialize(){const e=this.__VideoPlayerWidget,t=this.element,n=e.aspectRatio,i=e.autoplay,r=e.titlePage;super._onInitialize(),t.innerHTML="";let s=n;if("auto"!==s||r||(console.warn("kintsugi: video widget does not have an aspect ratio or a title page; assuming 4:3 aspect ratio"),s="4:3"),"auto"!==s&&(t.classList.add("ks-has-explicit-aspect-ratio"),t.style.paddingTop=u.getPaddingTopForAspectRatio(s)),r){const n=r.text||"Play Video";t.classList.add("ks-has-titlepage");const s=document.createElement("button");s.classList.add("ks-videoplayer-titlepage-button"),s.type="button";const o=document.createElement("div");o.classList.add("ks-videoplayer-titlepage-overlay"),s.appendChild(o);const a=document.createElement("img");a.classList.add("ks-videoplayer-titlepage-image"),a.src=r.url||"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAACCAYAAABytg0kAAAAAXNSR0IArs4c6QAAAAlwSFlzAAAWJQAAFiUBSVIk8AAAABNJREFUCB1jZGBg+A/EDEwgAgQADigBA//q6GsAAAAASUVORK5CYII%3D",a.alt=n,s.appendChild(a),r.url||(a.style.objectFit="cover",e.videoPlayer.tryGetDetailsAsync().then((n=>{n.titleImageUrl?(a.src=n.titleImageUrl,a.style.objectFit=""):"auto"===e.aspectRatio&&(console.warn("kintsugi: video widget does not have an aspect ratio or a title page; assuming 4:3 aspect ratio"),t.classList.add("ks-has-explicit-aspect-ratio"),t.style.paddingTop=u.getPaddingTopForAspectRatio("4:3"))}))),s.addEventListener("click",(e=>u.handleTitlePageButtonClick(this,e))),t.appendChild(s),i&&u.startSwitchToInlineVideoPlayer(this)}else u.renderInlineVideoPlayerAsync(this,{autoplay:i,hidden:!1}).catch((e=>console.error(e)))}_onRemovedFromDom(){this.__VideoPlayerWidget.videoPlayer.detachAsync().catch((e=>console.error(e)))}}c.defaults={rootClass:"ks-videoplayer"},Object.setPrototypeOf(c.defaults,o.defaults),o.extendSelect(c,{name:"kintsugi.videoPlayer",allowList:["super","video"]});const u=c.__VideoPlayerWidget={getPaddingTopForAspectRatio(e){if("string"==typeof e){const t=e.indexOf(":");if(t<0){const t=Number.parseFloat(e);return i.sprintf("%.6f%%",100/t)}{const n=Number.parseFloat(e.substring(0,t)),r=Number.parseFloat(e.substring(t+1));return i.sprintf("%.6f%%",100*r/n)}}return i.sprintf("%.6f%%",100/e)},startSwitchToInlineVideoPlayer(e){const t=s(e.element),n=t.find(".ks-videoplayer-titlepage-overlay");n.is(".ks-is-launching")||(n.addClass("ks-is-launching"),u.renderInlineVideoPlayerAsync(e,{autoplay:!0,hidden:!0}).then((()=>{const n=e.__VideoPlayerWidget,r=t.find(".ks-videoplayer-titlepage-button"),s=t.find(".ks-videoplayer-video-container");s.css({visibility:""}),r.is(":focus")&&s.find(i.focusableSelector).focus(),"auto"===n.aspectRatio?r.css({visibility:"hidden"}):r.remove()})).catch((e=>{console.error(e)})).finally((function(){n.removeClass("ks-is-launching")})))},async renderInlineVideoPlayerAsync(e,t){const n=e.__VideoPlayerWidget,i=e.element,r=document.createElement("div");r.classList.add("ks-videoplayer-video-container"),t.hidden&&(r.style.visibility="hidden"),i.appendChild(r);try{await n.videoPlayer.attachAsync({parent:r})}catch(e){throw r.remove(),e}},handleTitlePageButtonClick(e,t){t.defaultPrevented||(t.preventDefault(),u.startSwitchToInlineVideoPlayer(e))}},d={VideoPlayerWidget:c};e.exports=d},4229:()=>{!function(e){"use strict";var t={},n=function(){e("#wp-admin-bar-phoenix4-base-adminbar-nginx-cache-clear a[href]").on("click",i),e("body").addClass("has-wp-admin-bar")},i=function(e){e.isDefaultPrevented()||(e.preventDefault(),r())},r=function(){if(t.clearNginxCachePromise)return t.clearNginxCachePromise;var n=e("#wp-admin-bar-phoenix4-base-adminbar-nginx-cache-clear a[href]"),i=e("<span>").text(" ...working...");return n.append(i),t.clearNginxCachePromise=new Promise((function(n,r){e.ajax({url:phoenix4.wordPressAjaxUrl(),method:"POST",dataType:"json",data:{action:"phoenix4_base_nginx_cache_clear",version:1},success:function(e){i.remove(),t.clearNginxCachePromise=null,setTimeout(e&&e.success?n:r,0)},error:function(){i.remove(),t.clearNginxCachePromise=null,setTimeout(r,0)}})})).catch((function(){alert("phoenix4: failed to clear the Nginx cache")})),t.clearNginxCachePromise};e((function(){phoenix4.requestIdleCallback(n)}))}(jQuery)},1577:()=>{!function(e){"use strict";phoenix4.AnalyticsProvider=function(){},e.extend(phoenix4.AnalyticsProvider.prototype,{raise:function(e,t){throw new Error("phoenix4: not implemented")}}),phoenix4.AnalyticsProvider.combine=function(e){const t=Array.from(e),n=t.length;return 1===n?t[0]:n>1?new phoenix4.MultipleAnalyticsProvider({providers:t}):new phoenix4.NullAnalyticsProvider},phoenix4.NullAnalyticsProvider=function(){},phoenix4.NullAnalyticsProvider.prototype.__proto__=phoenix4.AnalyticsProvider.prototype,e.extend(phoenix4.NullAnalyticsProvider.prototype,{raise:function(e,t){}}),phoenix4.MultipleAnalyticsProvider=function(e){const t={providers:Array.from(e.providers)};Object.defineProperty(this,"__MultipleAnalyticsProvider",{value:t})},phoenix4.MultipleAnalyticsProvider.prototype.__proto__=phoenix4.AnalyticsProvider.prototype,e.extend(phoenix4.MultipleAnalyticsProvider.prototype,{raise:function(e,t){const n=this.__MultipleAnalyticsProvider.providers;for(const i of n)i.raise(e,t)}}),phoenix4.GoogleDataLayerAnalyticsProvider=function(e){const t={eventMap:e.eventMap,debug:!!e.debug};Object.defineProperty(this,"__GoogleDataLayerAnalyticsProvider",{value:t})},phoenix4.GoogleDataLayerAnalyticsProvider.prototype.__proto__=phoenix4.AnalyticsProvider.prototype,e.extend(phoenix4.GoogleDataLayerAnalyticsProvider.prototype,{raise:function(e,t){try{var n;const i=this.__GoogleDataLayerAnalyticsProvider,r=i.eventMap,s=i.debug,o=null===(n=r[e])||void 0===n?void 0:n[t];if(o){const e={event:o.event};s&&console.log("phoenix4: dataLayer.push("+JSON.stringify(e)+")"),e.event&&e.event.length>40&&console.warn("phoenix4: GTM dataLayer event name is too long: "+JSON.stringify(e.event)+" ("+JSON.stringify(e.event.substring(0,40))+")");const t=window.dataLayer;Array.isArray(t)&&t.push(e)}else s&&console.warn("phoenix4: GTM data layer analytics event not configured: "+JSON.stringify({source:e,action:t}))}catch(e){console.error(e)}}}),phoenix4.GoogleAnalyticsProvider=function(e){this.__GoogleAnalyticsProvider={category:e.category||null,eventMap:e.eventMap||{},debug:!!e.debug}},phoenix4.GoogleAnalyticsProvider.prototype.__proto__=phoenix4.AnalyticsProvider.prototype,e.extend(phoenix4.GoogleAnalyticsProvider.prototype,{raise:function(e,t){var n=this.__GoogleAnalyticsProvider,i=n.eventMap,r=n.debug,s=i[e];if(s){var o=s[t];if(o){var a=o.category||n.category,l=o.action,c=o.label,u=o.value;if(a&&l){for(var d=["send","event",a,l,c,u],h=d.length;h>0&&void 0===d[h-1];)--h;d.splice(h,d.length-h),r&&console.log("phoenix4: ga("+d.map(JSON.stringify).join(", ")+")");var m=window.ga;if("function"==typeof m)try{window.google_tag_manager&&(d[0]=m.getAll()[0].get("name")+"."+d[0]),m.apply(window,d)}catch(e){console.error(e)}}else console.error("phoenix4: ga() event configuration incomplete: "+JSON.stringify(t)+" on "+JSON.stringify(e))}else r&&console.warn("phoenix4: ga() not configured for event action: "+JSON.stringify(t)+" on "+JSON.stringify(e))}else r&&console.warn("phoenix4: ga() not configured for event source: "+JSON.stringify(e))}});const t=phoenix4.isLocalOrStaging(),n=new phoenix4.GoogleDataLayerAnalyticsProvider({eventMap:{"ui-sticky-header-startpurchase":{click:{event:"phoenix4.vdpStickyHeader.purchase.click"}},"ui-vdp-header-startpurchase":{click:{event:"phoenix4.vdpHeader.purchase.click"}}},debug:t}),i=new phoenix4.GoogleAnalyticsProvider({eventMap:{"ui-sticky-header-startpurchase":{click:{action:"Sticky Header Start Purchase"}},"ui-vdp-header-startpurchase":{click:{action:"VDP Header Start Purchase"}}},category:"Birchwood Phoenix-4",debug:t}),r=phoenix4.AnalyticsProvider.combine([n,i]);phoenix4.raiseAnalytics=function(e,t){r.raise(e,t)}}(jQuery)},3740:()=>{!function(e){"use strict";var t={instance:null};phoenix4.BackToTop=function(e){this.__evaluateScrollMilliseconds=100,this.__minimumWindowWidth=phoenix4.mediaBreakpoints.phone+1,this.__minimumScrollOffset=null,this.__scrollDelta=8,this.__autoHideMilliseconds=3e3,this.__isEnabled=!1,this.__isVisible=!1,this.__$ui=null,this.__windowHeight=null,this.__autoHideTimeoutID=null},e.extend(phoenix4.BackToTop.prototype,{isEnabled:function(){return this.__isEnabled},enable:function(){if(!this.__isEnabled){var t=e(window);this.__windowScrollHandler=this.__handleWindowScroll.bind(this),this.__windowResizeHandler=this.__handleWindowResize.bind(this),this.__windowMouseMoveHandler=this.__handleWindowMouseMove.bind(this),t.on("scroll",this.__windowScrollHandler),t.on("resize",this.__windowResizeHandler),this.__lastScrollOffset=t.scrollTop(),this.__isEnabled=!0,this.__windowHeight=e(window).height()}},disable:function(){this.__isEnabled&&(this.__isEnabled=!1,this.hide(),e(window).off("scroll",this.__windowScrollHandler),e(window).off("resize",this.__windowResizeHandler))},show:function(){!this.__isVisible&&this.__isEnabled&&(this.__$ui||this.__createUI(),this.__$ui.stop().show().animate({right:"0%"}),this.__isVisible=!0,e(window).on("mousemove",this.__windowMouseMoveHandler),this.__resetAutoHideTimer())},hide:function(){if(this.__isVisible){var t=this;this.__$ui.stop().animate({right:"-100%"},{complete:function(){t.__$ui.hide()}}),this.__isVisible=!1,e(window).on("mousemove",this.__windowMouseMoveHandler),this.__resetAutoHideTimer()}},__createUI:function(){var t=e('<div class="phoenix4-backtotop">').attr({"aria-hidden":"true"}),n=e('<div class="backtotop-button"><span class="backtotop-caption">Back to Top</span></div>');t.append(n),n.on("click",this.__handleBackToTopClick.bind(this)),e("body").append(t),this.__$ui=t},__evaluateScroll:function(){if(this.__isEnabled){var t=e(window),n=t.scrollTop(),i=n-this.__lastScrollOffset,r=null,s=this.__minimumScrollOffset;null===s&&(s=.6*e(window).height()),t.width()<this.__minimumWindowWidth||n<s?r=!1:i<-this.__scrollDelta?r=!0:i>this.__scrollDelta&&(r=!1),null!==r?(this.__lastScrollOffset=n,r!==this.__isVisible?r?this.show():this.hide():r&&this.__resetAutoHideTimer()):this.__resetAutoHideTimer()}},__resetAutoHideTimer:function(){if(null!==this.__autoHideTimeoutID&&(clearTimeout(this.__autoHideTimeoutID),this.__autoHideTimeoutID=null),this.__isVisible&&null!==this.__autoHideMilliseconds){if(!this.__autoHideTimeoutHandler){var e=this;this.__autoHideTimeoutHandler=function(){e.__autoHideTimeoutHandler=null,e.__isVisible&&!e.__$ui.is(":hover")&&e.hide()}}this.__autoHideTimeoutID=setTimeout(this.__autoHideTimeoutHandler,this.__autoHideMilliseconds)}},__handleWindowScroll:function(e){this.__evaluateScroll()},__handleWindowResize:function(e){this.__isVisible&&this.hide()},__handleWindowMouseMove:function(e){this.__resetAutoHideTimer()},__handleBackToTopClick:function(e){e.isDefaultPrevented()||(e.preventDefault(),phoenix4.scrollTo(window,{top:0,behaviour:"smooth"}))}}),phoenix4.BackToTop.instance=function(){return t.instance||(t.instance=new phoenix4.BackToTop),t.instance}}(jQuery)},6983:()=>{!function(e){"use strict";e.widget("phoenix4.phoenix4Carousel",{options:{items:[],itemWidth:"8em",itemHeight:"8em",preload:!1,responsive:null,startIndex:0},queueRefresh:function(){if(void 0===this.__refreshTimeoutID){var e=this;this.__refreshTimeoutID=setTimeout((function(){delete e.__refreshTimeoutID,e.refresh()}),1)}},refresh:function(){if(void 0!==this.__refreshTimeoutID&&(clearTimeout(this.__refreshTimeoutID),delete this.__refreshTimeoutID),this.__$slick)if(this.options.responsive){var e=this.__$slick.slick("slickCurrentSlide");this.__$slick.slick("unslick"),this.__initializeSlick({startIndex:e})}else this.__$slick.slick("setPosition")},_create:function(){var t=this;null===this.options.responsive&&("function"==typeof this.options.itemWidth||"function"==typeof this.options.itemHeight?this.options.responsive=!0:this.options.responsive=/\b(?:vw|vh|vmin|vmax)\b/.test(this.options.itemWidth+this.options.itemHeight));var n=this.options.items;this.element.empty().addClass("phoenix4-carousel").attr({role:"group","aria-roledescription":"carousel","aria-atomic":"false","aria-live":"polite",tabindex:"-1"}).on("keydown",this.__handleKeyDown.bind(this));var i=e("<div>");this.element.append(i);for(var r=[],s=0;s<n.length;++s){var o=(this.options.startIndex+(s%2*2-1)*Math.ceil(s/2)+n.length)%n.length,a=e('<div class="carousel-item">').uniqueId().attr({role:"tabpanel"});r[o]=a;var l=this.__createItemContentAsync(n[o],{allowSynchronous:!0,widgetInitializing:!0,allowSlickLazy:!this.options.preload&&o>0&&o!==this.options.startIndex});n[o]=l,l instanceof Promise?(a.addClass("loading empty"),l.then((function(e){return t.__updateItemContentAsync(a,e)}))):a.append(l),r[o-1]?a.insertAfter(r[o-1]):r[o+1]?a.insertBefore(r[o+1]):0===o?i.prepend(a):i.append(a)}this.__$slick=i,this.__initializeSlick({startIndex:this.options.startIndex}),this.options.responsive&&(this.__windowResizeHandler=this.__handleWindowResize.bind(this),e(window).on("resize",this.__windowResizeHandler))},_destroy:function(){this.__$slick.slick("unslick"),delete this.__$slick,this.element.empty().removeClass("phoenix4-carousel").removeAttr("role").removeAttr("aria-description").removeAttr("aria-atomic").removeAttr("aria-live").removeAttr("tabindex"),void 0!==this.__refreshTimeoutID&&(clearTimeout(this.__refreshTimeoutID),delete this.__refreshTimeoutID),this.__windowResizeHandler&&e(window).off("resize",this.__windowResizeHandler)},__initializeSlick:function(t){t||(t={});var n=this,i=this.__$slick,r="function"==typeof this.options.itemWidth?this.options.itemWidth(this.element):this.options.itemWidth,s="function"==typeof this.options.itemHeight?this.options.itemHeight(this.element):this.options.itemHeight;i.css("width",r),i.find(".carousel-item").css("height",s),i.on("beforeChange",this.__handleSlickBeforeChange.bind(this)),i.slick({accessibility:!1,dots:!0,infinite:!0,initialSlide:t.startIndex||0,zIndex:0,prevArrow:'<span class="carousel-move carousel-move-left"><button type="button" class="carousel-move-handle carousel-move-left-handle"></button></span>',nextArrow:'<span class="carousel-move carousel-move-right"><button type="button" class="carousel-move-handle carousel-move-right-handle"></button></span>',customPaging:function(t,i){var r=n.element.find(".carousel-item:nth-child("+(i+1)+")"),s=e('<span class="carousel-dot" role="tab">').uniqueId().attr({title:i+1+" of "+n.options.items.length,"aria-label":"Slide "+(i+1)+" of "+n.options.items.length,"aria-controls":r.attr("id")});return r.attr("aria-labelledby",s.attr("id")),s}}),i.find(".slick-dots").attr({role:"tablist",tabindex:0}),this.__updateActiveItemClass()},__createItemContentAsync:function(t,n){var i,r=this,s=(n.allowSynchronous,n.widgetInitializing,!1!==n.allowSlickLazy);return"function"==typeof t?new Promise((function(e,n){phoenix4.requestIdleCallback((function(){if(r.__$slick)try{var i=t();e(r.__createItemContentAsync(i))}catch(e){n(e)}else e("")}))})):t instanceof Promise?t.then((function(e){return r.__$slick?r.__createItemContentAsync(e):""})):(i="string"==typeof t?t:"image"===t.type?e('<img class="carousel-image">').attr({src:s?null:t.url,"data-lazy":s?t.url:null,alt:t.altText}):t,n.allowSynchronous?i:Promise.resolve(i))},__updateItemContentAsync:function(e,t){var n=this,i=this.__createItemContentAsync(t,{allowSynchronous:!0});return i instanceof Promise&&($listItem.addClass("loading"),i.then((function(){if(n.__$slick&&n.__$slick.find(e))return n.__updateItemContentAsync(e,t)}))),e.removeClass("loading empty").empty().append(i),i||e.addClass("empty"),this.queueRefresh(),Promise.resolve()},__updateActiveItemClass:function(e){var t,n=this.element.find(".slick-dots"),i=n.find(".carousel-dot.carousel-active");(t=void 0===e?n.find(".slick-active .carousel-dot"):n.find(":nth-child("+(e+1)+") .carousel-dot")).addClass("carousel-active"),i.not(t).removeClass("carousel-active")},__handleSlickBeforeChange:function(e,t,n,i){this.__updateActiveItemClass(i)},__handleKeyDown:function(e){e.isDefaultPrevented()||(37===e.which?(e.preventDefault(),this.__$slick.slick("slickPrev")):39===e.which&&(e.preventDefault(),this.__$slick.slick("slickNext")))},__handleWindowResize:function(){this.queueRefresh()}})}(jQuery)},5045:e=>{"use strict";class t{constructor(){this.__DynamicTitleSelector={defaultTitle:"",calculatedFields:[],rules:[],maps:[]}}setDefaultValue(e){this.__DynamicTitleSelector.defaultTitle=e}addCalculatedField(e,t){this.__DynamicTitleSelector.calculatedFields[e]=t}addRule(e){this.__DynamicTitleSelector.rules.push(e)}addMap(e,t){this.__DynamicTitleSelector.maps[e]=t}getBestTitle(e){return n.tryGetBestTitle(this,e)||this.__DynamicTitleSelector.defaultTitle}}const n=t.__DynamicTitleSelector={tryGetBestTitle(e,t){const i=n.expandWithCalculatedFields(e,t),r=n.tryFindBestMatchFor(e,i);return r?n.applyPattern({pattern:r.pattern,values:i,maps:e.__DynamicTitleSelector.maps}):null},tryFindBestMatchFor(e,t){for(let i=0;i<e.__DynamicTitleSelector.rules.length;i++){const r=e.__DynamicTitleSelector.rules[i];if(r.criteria.every((e=>n.checkCriterion(e,t))))return r}return null},checkCriterion(e,t){let i;switch(e.type){case"=":let r=e.value;if(i=t[e.field]||[],Array.isArray(r)||(r=""===r?[]:[r]),Array.isArray(i)||(i=""===i?[]:[i]),r.length!==i.length)return!1;for(let e=0;e<r.length;++e){let t=!1;for(let n=0;n<i.length;++n)if(r[e].toLowerCase()===i[n].toLowerCase()){t=!0;break}if(!t)return!1}return!0;case"OR":return e.children.some((e=>n.checkCriterion(e,t)));case"AND":return!!e.children.every((e=>n.checkCriterion(e,t)))&&e.children.length>0;case"COUNT":let s;return i=t[e.field]||[],s=""===i?0:Array.isArray(i)?i.length:1,s>=(e.min||0)&&s<=(e.max||Number.MAX_SAFE_INTEGER);default:return!1}},applyPattern(e){const t=e.pattern,i=[];let r=0;for(;;){const s=t.indexOf("{",r);if(-1===s)break;const o=t.indexOf("}",s);if(-1===o)break;i.push(t.slice(r,s)),r=o+1;const a=t.slice(s+1,o),l=a.indexOf(":");let c,u;-1===l?(c=a.trim(),u=""):(c=a.slice(0,l).trim(),u=a.slice(l+1)),""!==c&&i.push(n.formatField({values:e.values,fieldName:c,format:u,maps:e.maps||[]}))}i.push(t.slice(r));let s=i.join("");return s=s.trim().replace(/#\s+#/g," "),s},expandWithCalculatedFields(e,t){const n={...t};return Object.keys(e.__DynamicTitleSelector.calculatedFields).forEach((i=>{const r=e.__DynamicTitleSelector.calculatedFields[i];i in t||(n[i]=r(t))})),n},formatField(e){const t=e.fieldName;let n=e.values[t]||[];Array.isArray(n)||(n=""===n?[]:[n]);const i=e.maps[t]||null;let r=[];if(r=null===i?n:i instanceof Function?n.map((e=>i(e)||e)):n.map((e=>i[e]||e)),0===r.length)return"";if(1===r.length)return r[0];{const e=r.pop();return r.join(", ")+" and "+e}}};e.exports={DynamicTitleSelector:t}},8294:()=>{!function(e){"use strict";window.phoenix4||(window.phoenix4={}),phoenix4.IndexedDB=function(e){this.__indexedDB={raw:e.raw}},phoenix4.IndexedDB.openAsync=function(e){return new Promise((function(t,n){if(!window.indexedDB)throw new Error("phoenix4: IndexedDB not supported");if(!(Number.isSafeInteger(e.version)?e.version>0:null===e.version||void 0===e.version))throw new Error("IndexedDB version must be a positive integer");var i,r=e.version?window.indexedDB.open(e.name,e.version):window.indexedDB.open(e.name);r.onupgradeneeded=function(t){try{var i=t.oldVersion,s=t.newVersion;if(!e.version)throw new Error('Could not open "'+e.name+'": database does not exist');if(!e.upgrade)throw new Error('Could not open "'+e.name+'": database needs to be upgraded; expected version '+s+", but current version is "+i);var o=new phoenix4.IndexedDB({raw:r.result}),a=new phoenix4.IndexedDBTransaction({db:o,rawTransaction:r.transaction}),l=e.upgrade({db:o,transaction:a,oldVersion:i,newVersion:s});l instanceof Promise&&l.catch((function(e){r.transaction.abort(),n(e)}))}catch(t){r.transaction.abort(),n(t)}},r.onsuccess=function(e){var n=r.result,i=new phoenix4.IndexedDB({raw:n});t(i)},r.onerror=function(){if(!(i=i||r.error||null))try{throw new Error('Could not open "'+e.name+'": an unknown error occurred')}catch(e){i=e}n(i)}}))},e.extend(phoenix4.IndexedDB.prototype,{getRaw:function(){return this.__indexedDB.raw},getVersion:function(){return this.__indexedDB.raw.version},getAsync:function(e,t,n){return this.runTransactionAsync(e,"readonly",(function(n){return n.store(e).getAsync(t)}))},tryGetAsync:function(e,t,n){return this.runTransactionAsync(e,"readonly",(function(i){return i.store(e).tryGetAsync(t,n)}))},deleteAsync:function(e,t){return this.runTransactionAsync(e,"readwrite",(function(t){return t.store(e).deleteAsync(keys)}))},runTransactionAsync:function(){var e,t,n=arguments[0];3===arguments.length?(n=arguments[0],e=arguments[1],t=arguments[2]):t=arguments[1];var i=this;return new Promise((function(r,s){var o,a=i.__indexedDB.raw.transaction(n,e||"readonly");a.oncomplete=function(){r(o)},a.onerror=function(){s(a.error)};var l=new phoenix4.IndexedDBTransaction({db:this,rawTransaction:a}),c=t(l);c instanceof Promise?c.then((function(e){o=e}),(function(e){a.abort(),s(e)})):(o=c,a.commit())}))},close:function(){this.__indexedDB.raw.close()}}),phoenix4.IndexedDBTransaction=function(e){this.__indexedDB={db:e.db,rawTransaction:e.rawTransaction,stores:{}}},e.extend(phoenix4.IndexedDBTransaction.prototype,{store:function(e){return this.__indexedDB.stores[e]||this.__createStoreWrapper(e)},createObjectStore:function(e,t){var n=this.__indexedDB.db.getRaw().createObjectStore(e,{keyPath:t.keyPath,autoIncrement:!!t.autoIncrement}),i=new phoenix4.IndexedDBObjectStore({rawStore:n});return this.__indexedDB.stores[e]=i,i},__createStoreWrapper:function(e){var t=this.__indexedDB.stores[e];if(!t){var n=this.__indexedDB.rawTransaction.objectStore(e);t=new phoenix4.IndexedDBObjectStore({rawStore:n}),this.__indexedDB.stores[e]=t}return t}}),phoenix4.IndexedDBObjectStore=function(e){this.__indexedDB={rawStore:e.rawStore,keyIndex:null,namedIndices:{}}},e.extend(phoenix4.IndexedDBObjectStore.prototype,{addAsync:function(e,t){var n=this;return new Promise((function(i,r){var s=n.__indexedDB.rawStore.add(e,t);s.onsuccess=function(){i(e)},s.onerror=function(){r(s.error)}}))},putAsync:function(e,t){var n=this;return new Promise((function(i,r){var s=void 0!==t?n.__indexedDB.rawStore.put(e,t):n.__indexedDB.rawStore.put(e);s.onsuccess=function(){i(e)},s.onerror=function(){r(s.error)}}))},whereAny:function(){return this.__indexedDB.whereAnyQuery||(this.__indexedDB.whereAnyQuery=new phoenix4.IndexedDBQuery({store:this})),this.__indexedDB.whereAnyQuery},whereKey:function(){var e=this.__indexedDB.keyIndex;return e||(e=new phoenix4.IndexedDBValueQueryBuilder({store:this,rawSource:this.__indexedDB.rawStore}),this.__indexedDB.keyIndex=e),e},whereIndexedValue:function(e){var t=this.__indexedDB.namedIndices[e];return t||(t=new phoenix4.IndexedDBValueQueryBuilder({store:this,rawSource:this.__indexedDB.rawStore.index(e)}),this.__indexedDB.namedIndices[e]=t),t},tryGetAsync:function(e,t){return this.whereKey().is(e).firstOrDefaultAsync(t)},getAsync:function(e){return this.whereKey().is(e).firstAsync()},allAsync:function(){return this.whereAny().allAsync()},countAsync:function(){return this.whereAny().countAsync()},deleteAsync:function(t){if(e.isArray(t)){if(1===t.length)return this.whereKey().is(t[0]).deleteAsync();for(var n=[],i=0;i<t.length;++i)n.push(this.whereKey().is(t[i]).deleteAsync());return Promise.all(n).then((function(){}))}return this.whereKey().is(t).deleteAsync()},createIndex:function(e,t,n){n||(n={}),this.__indexedDB.rawStore.createIndex(e,t,{unique:n.unique||!1})}}),phoenix4.IndexedDBValueQueryBuilder=function(e){this.__indexedDB={source:e.source,rawSource:e.rawSource||e.source.__indexedDB.rawStore}},e.extend(phoenix4.IndexedDBValueQueryBuilder.prototype,{isAny:function(e){return this.__createQueryFromKeyRange(null)},is:function(e){return this.__createQueryFromKeyRange(IDBKeyRange.only(e))},between:function(e,t){return this.__createQueryFromKeyRange(IDBKeyRange.bound(e,t))},lessThanOrEqualTo:function(e){return this.__createQueryFromKeyRange(IDBKeyRange.upperBound(e))},greaterThan:function(e){return this.__createQueryFromKeyRange(IDBKeyRange.lowerBound(e,!0))},__createQueryFromKeyRange:function(e){return new phoenix4.IndexedDBQuery({source:this.__indexedDB.source,rawSource:this.__indexedDB.rawSource,rawKeyRange:e})}}),phoenix4.IndexedDBQuery=function(e){this.__indexedDB={store:e.store,rawSource:e.rawSource||e.store.__indexedDB.rawStore,rawKeyRange:e.rawKeyRange||null,filter:e.filter||null}},e.extend(phoenix4.IndexedDBQuery.prototype,{filter:function(e){if(e){var t=this.__indexedDB.filter,n=this.__indexedDB.filter?function(n){return t(n)&&e(n)}:e;return new phoenix4.IndexedDBQuery({store:this.__indexedDB.store,rawSource:this.__indexedDB.rawSource,rawKeyRange:this.__indexedDB.rawKeyRange,filter:n})}return this},countAsync:function(){if(this.__indexedDB.filter){var e=0;return this.forEachAsync((function(t){++e})).then((function(){return e}))}var t=this;return new Promise((function(e,n){var i=t.__indexedDB.rawSource.count(t.__indexedDB.rawKeyRange);i.onsuccess=function(){e(i.result)},i.onerror=function(){n(i.error)}}))},firstAsync:function(){var e,t=!1;return this.forEachAsync((function(n){return t=!0,e=n,!1})).then((function(){if(t)return e;throw new Error("The query returned no items")}))},firstOrDefaultAsync:function(e){var t=e;return this.forEachAsync((function(e){return t=e,!1})).then((function(){return t}))},singleAsync:function(){var e,t=!1;return this.forEachAsync((function(n){if(t)throw new Error("More than one item matched the query");t=!0,e=n})).then((function(){if(t)return e;throw new Error("The query returned no items")}))},singleOrDefaultAsync:function(e){var t=e;return this.forEachAsync((function(e){t=e})).then((function(){return t}))},allAsync:function(){if("getAll"in this.__indexedDB.rawSource&&!this.__indexedDB.filter){var e=this;return new Promise((function(t,n){var i=e.__indexedDB.rawKeyRange?e.__indexedDB.rawSource.getAll(e.__indexedDB.rawKeyRange):e.__indexedDB.rawSource.getAll();i.onsuccess=function(){t(i.result)},i.onerror=function(){n(i.error)}}))}var t=[];return this.forEachAsync((function(e){t.push(e)})).then((function(){return t}))},firstNAsync:function(e){if(!Number.isSafeInteger(e)||e<1||e>2147483647)throw new Error("Limit must be an integer between 1 and 0x7fffffff");if("getAll"in this.__indexedDB.rawSource&&!this.__indexedDB.filter){var t=this;return new Promise((function(n,i){var r=t.__indexedDB.rawKeyRange?t.__indexedDB.rawSource.getAll(t.__indexedDB.rawKeyRange,e):t.__indexedDB.rawSource.getAll(e);r.onsuccess=function(){n(r.result)},r.onerror=function(){i(r.error)}}))}var n=[];return this.forEachAsync((function(t){return n.push(t),!e||n.length<e})).then((function(){return n}))},forEachAsync:function(e){var t="function"==typeof e?{callback:e}:e;return this.__rawIterateCursorAsync({callback:function(e){return t.callback(e.item,e.index)},cursorDirection:"desc"===t.direction?"prev":"next"})},deleteAsync:function(){if(!this.__indexedDB.filter&&this.__indexedDB.rawSource instanceof IDBObjectStore){var e=this;return new Promise((function(t,n){var i=e.__indexedDB.rawKeyRange?e.__indexedDB.rawSource.delete(e.__indexedDB.rawKeyRange):e.__indexedDB.rawSource.clear();i.onsuccess=function(){t()},i.onerror=function(){n(i.error)}}))}return this.countAndDeleteAsync().then((function(){}))},countAndDeleteAsync:function(){var e=0;return this.__rawIterateCursorAsync({callback:function(t){return new Promise((function(n,i){var r=t.rawCursor.delete();r.onsuccess=function(){++e,n()},r.onerror=function(){i(r.error)}}))}}).then((function(){return e}))},deleteFirstNAsync:function(e){if(Number.isSafeInteger(e)){if(e>0){var t=0;return this.__rawIterateCursorAsync({callback:function(n){return t<e&&(++t,new Promise((function(e,i){var r=n.rawCursor.delete();r.onsuccess=function(){++t,e()},r.onerror=function(){i(r.error)}})))}})}if(0===e)return Promise.resolve()}throw new Error("Count must be a positive integer")},__rawIterateCursorAsync:function(e){var t=this,n=-1;return new Promise((function(i,r){var s=t.__indexedDB.rawSource.openCursor(t.__indexedDB.rawKeyRange,e.cursorDirection||"next");s.onsuccess=function(s){var o=s.target.result;if(o)try{var a;(!t.__indexedDB.filter||t.__indexedDB.filter(o.value))&&(a=e.callback({item:o.value,index:++n,rawCursor:o})),!1===a?i():a instanceof Promise?a.then((function(e){!1===e?i():o.continue()}),(function(e){r(e)})):o.continue()}catch(s){r(s)}else i()},s.onerror=function(){r(s.error)}}))}})}(jQuery)},7531:()=>{!function(e){"use strict";phoenix4.NewModelDetailsManager=function(){if(this.__newModelDetailsManager={modelDetails:phoenix4.getServerData("base.newModelDetailsManager.modelDetails"),selectedTrim:null,trimListeners:[]},this.__newModelDetailsManager.modelDetails.success){var e=phoenix4.getServerData("base.newModelDetailsManager.selectedTrimName");this.trySelectTrim(e)}},e.extend(phoenix4.NewModelDetailsManager.prototype,{getModelDetails:function(){return this.__newModelDetailsManager.modelDetails},getSelectedTrim:function(){return this.__newModelDetailsManager.selectedTrim},trySelectTrim:function(e){var t=e.trim().toUpperCase(),n=this.__newModelDetailsManager.modelDetails.success&&this.__newModelDetailsManager.modelDetails.trims.find((function(e){return e.name.trim().toUpperCase()===t}));if(n){if(n!==this.__newModelDetailsManager.selectedTrim){if(this.__newModelDetailsManager.selectedTrim=n,window.history&&window.history.replaceState){var i="?trim="+encodeURIComponent(n.name);i=phoenix4.addUrlTrackingParametersFromCurrentUrl(i),window.history.replaceState(null,"",i)}for(var r=this.__newModelDetailsManager.trimListeners.slice(),s=0;s<r.length;++s)try{r[s]()}catch(e){console.error(e)}}return!0}return!1},selectTrim:function(e){if(!this.trySelectTrim(e))throw'phoenix4.NewModelDetailsManager: could not find trim "'+e+'"'},addTrimListener:function(e){this.__newModelDetailsManager.trimListeners.push(e)}}),phoenix4.NewModelDetailsManager.instance=function(){return phoenix4.NewModelDetailsManager.__instance||(phoenix4.NewModelDetailsManager.__instance=new phoenix4.NewModelDetailsManager),phoenix4.NewModelDetailsManager.__instance}}(jQuery)},2767:()=>{!function(e){"use strict";phoenix4.QueryMatcher=function(){this.__queryMatcher={fields:{},patterns:[],unknownPatternFieldPolicy:"error",unknownValueFieldPolicy:"error"}},e.extend(phoenix4.QueryMatcher.prototype,{registerField:function(e){this.__queryMatcher.fields[e.fieldName]={fieldName:e.fieldName,rule:e.rule,anyAllPattern:e.anyAllPattern||null,isItemMatch:e.isItemMatch||null,isAnyAllFieldPatternCache:{}}},setUnknownPatternFieldPolicy:function(e){this.__queryMatcher.unknownPatternFieldPolicy=e},setUnknownValueFieldPolicy:function(e){this.__queryMatcher.unknownValueFieldPolicy=e},registerPattern:function(e){this.__queryMatcher.patterns.push({id:e.id,query:e.query,data:e.data})},tryFindFirstMatch:function(e){const t=this.__queryMatcher.patterns,n=this.__parseQueryIfNeeded(e);for(let e=0;e<t.length;++e){const i=t[e];if(i.parsedQuery||(i.parsedQuery=this.__parseQueryIfNeeded(i.query)),this.__isQueryMatch(i.parsedQuery,n))return{id:i.id,query:i.query,data:i.data}}return null},tryFindAllMatches:function(e){const t=this.__queryMatcher.patterns,n=this.__parseQueryIfNeeded(e),i=[];for(const e of t)e.parsedQuery||(e.parsedQuery=this.__parseQueryIfNeeded(e.query)),this.__isQueryMatch(e.parsedQuery,n)&&i.push({id:e.id,query:e.query,data:e.data});return i},__isQueryMatch:function(e,t){const n=this.__parseQueryIfNeeded(e),i=this.__parseQueryIfNeeded(t);for(let e=0;e<n.length;++e){const t=n[e];let r="";for(let e=0;e<i.length;++e)if(i[e].name===t.name){r=i[e].value;break}if(!this.__isSingleFieldMatch(t.name,t.value,r))return!1}const r=this.__queryMatcher.unknownValueFieldPolicy;if("ignore"!==r)for(let e=0;e<i.length;++e){const t=i[e];if(!this.__queryMatcher.fields[t.name])switch(r){case"no-match":return!1;case"error":throw new Error('QueryMatcher: unrecognized field "'+t.name+'" in value');default:throw new Error('QueryMatcher: unrecognized unknown value field policy "'+r+'"')}}return!0},__parseQueryIfNeeded:function(e){if(Array.isArray(e))return e;const t=[];if(""!==e){const n=e.split("&");for(let e=0;e<n.length;++e){const i=decodeURIComponent(n[e]),r=i.indexOf("=");r>=0?t.push({name:i.substring(0,r),value:i.substring(r+1)}):t.push({name:null,value:i})}}return t},__isSingleFieldMatch:function(e,t,n){const i=this.__queryMatcher.fields[e];if(!i)switch(this.__queryMatcher.unknownPatternFieldPolicy){case"ignore":return!0;case"no-match":return!1;case"error":throw new Error('QueryMatcher: unrecognized field "'+e+'"');default:throw new Error('QueryMatcher: invalid unknown pattern field policy: "'+this.__queryMatcher.unknownPatternFieldPolicy+'"')}switch(i.rule){case"stringlist-subset":return this.__isStringListSubsetFieldMatch(i,t,n);case"hierarchicallist-subset":return this.__isHierarchicalListSubsetFieldMatch(i,t,n);case"number-lessorequal":return this.__isNumberLessOrEqualFieldMatch(i,t,n);case"number-greaterorequal":return this.__isNumberGreaterOrEqualFieldMatch(i,t,n);default:throw new Error('QueryMatcher: unrecognized field rule "'+i.rule+'" for field "'+e+'"')}},__tryGetAnyAllPatternForField:function(e){return"function"==typeof e.anyAllPattern&&(e.anyAllPattern=e.anyAllPattern()||null),e.anyAllPattern},__isAnyAllFieldPattern:function(e,t){let n=e.isAnyAllFieldPatternCache[t];if(void 0===n){const i=this.__tryGetAnyAllPatternForField(e);n=!(!i||!this.__isSingleFieldMatch(e.fieldName,t,i)),e.isAnyAllFieldPatternCache[t]=n}return n},__isStringListSubsetFieldMatch:function(e,t,n){const i=n.trim();if(""===i)return this.__isAnyAllFieldPattern(e,t);const r=i.split(","),s=t.split(","),o=e.isItemMatch||function(e,t){return e===t};for(let e=0;e<r.length;++e){const t=r[e];let n=!1;for(let e=0;e<s.length;++e)if(o(s[e],t)){n=!0;break}if(!n)return!1}return!0},__isHierarchicalListSubsetFieldMatch:function(e,t,n){const i=n.trim();if(""===i)return this.__isAnyAllFieldPattern(e,t);const r=e.isItemMatch||function(e,t){return e===t||t.length>e.length&&"-"===t.charAt(e.length)&&t.startsWith(e)};let s=t.split(","),o=i.split(",");s=this.__removeMaskedHierarchicalItems(s,r),o=this.__removeMaskedHierarchicalItems(o,r);for(let e=0;e<o.length;++e){const t=o[e];let n=!1;for(let e=0;e<s.length;++e)if(r(s[e],t)){n=!0;break}if(!n)return!1}return!0},__removeMaskedHierarchicalItems:function(e,t){const n=[];for(let i=0;i<e.length;++i){const r=e[i];let s=!1;for(let n=0;n<e.length;++n)if(i!==n){const i=e[n];if(i.length>r.length&&t(r,i)){s=!0;break}}s||n.push(r)}return n},__isNumberLessOrEqualFieldMatch:function(e,t,n){const i=n.trim();if(""===i)return this.__isAnyAllFieldPattern(e,t);const r=t.trim();if(""===r)throw new Error("QueryMatcher: number pattern value is empty");if(e.isItemMatch)return!!e.isItemMatch(r,i);const s=new Number(r);return new Number(i)<=s},__isNumberGreaterOrEqualFieldMatch:function(e,t,n){const i=n.trim();if(""===i)return this.__isAnyAllFieldPattern(e,t);const r=t.trim();if(""===r)throw new Error("QueryMatcher: number pattern value is empty");if(e.isItemMatch)return!!e.isItemMatch(r,i);const s=new Number(r);return new Number(i)>=s}}),phoenix4.QueryMatcher.createForVehicleSearch=function(){const e=new phoenix4.QueryMatcher;return e.setUnknownPatternFieldPolicy("no-match"),e.setUnknownValueFieldPolicy("ignore"),e.registerField({fieldName:"condition",rule:"stringlist-subset",anyAllPattern:"new,used",isItemMatch:function(e,t){return e===t||"certified-pre-owned"===t&&"used"===e}}),e.registerField({fieldName:"discount",rule:"stringlist-subset"}),e.registerField({fieldName:"make_model_trim",rule:"hierarchicallist-subset"}),e.registerField({fieldName:"price_min",rule:"number-greaterorequal"}),e.registerField({fieldName:"price_max",rule:"number-lessorequal"}),e.registerField({fieldName:"year_min",rule:"number-greaterorequal"}),e.registerField({fieldName:"year_max",rule:"number-lessorequal"}),e.registerField({fieldName:"engine",rule:"stringlist-subset"}),e}}(jQuery)},2880:()=>{!function(e){"use strict";window.phoenix4||(window.phoenix4={}),phoenix4.RecentlyViewedDataSource=function(e){this.__recentlyViewed={getKey:e.getKey,getItemsAsyncData:{serial:0,resolve:null,reject:null,promise:null,items:null,reloadID:null},changeListeners:[],lastChangeListenerID:0,visibilityChangeHandler:null,clearItemsTimeoutID:null}},e.extend(phoenix4.RecentlyViewedDataSource.prototype,{hasFavouritesAsync:function(){return this.getItemsAsync().then((function(e){return e.favourites.length>0}))},getItemsAsync:function(){var e=this.__recentlyViewed.getItemsAsyncData.promise;if(e)return e;var t=this.__recentlyViewed.getItemsAsyncData.items;return t?(e=Promise.resolve(t),this.__recentlyViewed.getItemsAsyncData.promise=e,e):this._forceReloadItemsAsync()},addChangeListener:function(e){this.throwIfDestroyed();var t=++this.__recentlyViewed.lastChangeListenerID,n={id:t,callback:e,isActive:!1};return this.__recentlyViewed.changeListeners.push(n),1===this.__recentlyViewed.changeListeners.length&&(document.visibilityState&&(this.__recentlyViewed.visibilityChangeHandler||(this.__recentlyViewed.visibilityChangeHandler=this.__handleDocumentVisibilityChange.bind(this)),document.addEventListener("visibilitychange",this.__recentlyViewed.visibilityChangeHandler)),document.visibilityState&&"visible"!==document.visibilityState||this._startListeningForChanges({reason:"listener"})),this.getItemsAsync().finally((function(){n.isActive=!0})),t},removeChangeListener:function(e){var t=this.__recentlyViewed.changeListeners.findIndex((function(t){return t.id===e}));return-1!==t&&(this.__recentlyViewed.changeListeners.splice(t,1),0===this.__recentlyViewed.changeListeners.length&&(this.__recentlyViewed.visibilityChangeHandler&&document.removeEventListener("visibilitychange",this.__recentlyViewed.visibilityChangeHandler),this._stopListeningForChanges()),!0)},recordRecentlyViewedAsync:function(e){throw new Error("not implemented")},markAsFavouriteAsync:function(e){throw new Error("not implemented")},unmarkAsFavouriteAsync:function(e){var t=this._getKey(e);return this.unmarkKeyAsFavouriteAsync(t)},unmarkKeyAsFavouriteAsync:function(e){throw new Error("not implemented")},deleteAllFavouritesAsync:function(){throw new Error("not implemented")},deleteAllRecentlyViewedAsync:function(){throw new Error("not implemented")},deleteKeysAsync:function(e){throw new Error("not implemented")},destroy:function(){if(!this.__recentlyViewed.isDestroyed){this.__recentlyViewed.visibilityChangeHandler&&document.removeEventListener("visibilitychange",this.__recentlyViewed.visibilityChangeHandler),this.__recentlyViewed.changeListeners.length>0&&(this.__recentlyViewed.changeListeners=[],this._stopListeningForChanges());var e=this.__recentlyViewed.getItemsAsyncData.reject;if(this.__recentlyViewed.getItemsAsyncData.promise=null,this.__recentlyViewed.getItemsAsyncData.items=null,this.__recentlyViewed.getItemsAsyncData.resolve=null,this.__recentlyViewed.getItemsAsyncData.reject=null,e)try{throw new Error("data source has been destoyed")}catch(t){e(t)}this.__recentlyViewed.isDestroyed=!0}},isDestroyed:function(){return this.__recentlyViewed.isDestroyed},throwIfDestroyed:function(){if(this.__recentlyViewed.isDestroyed)throw new Error("data source has been destroyed")},_getKey:function(e){return this.__recentlyViewed.getKey(e)},_startListeningForChanges:function(e){},_stopListeningForChanges:function(){},_setItems:function(e){if(!this.__recentlyViewed.isDestroyed){var t=this;this.__recentlyViewed.getItemsAsyncData.items=e,this.__recentlyViewed.getItemsAsyncData.promise=null;var n=this.__recentlyViewed.getItemsAsyncData.resolve;if(n&&(this.__recentlyViewed.getItemsAsyncData.serial+=1,this.__recentlyViewed.getItemsAsyncData.resolve=null,this.__recentlyViewed.getItemsAsyncData.reject=null,e?n(e):this._forceReloadItemsAsync().catch((function(e){console.error(e)}))),e){for(var i=this.__recentlyViewed.changeListeners.slice(),r=0;r<i.length;++r)if(i[r].isActive)try{i[r].callback(e)}catch(e){console.error(e)}null!==this.__recentlyViewed.clearItemsTimeoutID&&clearTimeout(this.__recentlyViewed.clearItemsTimeoutID),this.__recentlyViewed.clearItemsTimeoutID=setTimeout((function(){t.__recentlyViewed.clearItemsTimeoutID=null,t.__recentlyViewed.getItemsAsyncData.items&&(t.__recentlyViewed.getItemsAsyncData.items=null,t.__recentlyViewed.getItemsAsyncData.promise=null)}),100)}}},_forceReloadItemsAsync:function(){var e=this,t=this.__recentlyViewed.getItemsAsyncData.promise;if(t&&null!==this.__recentlyViewed.getItemsAsyncData.reloadID)return t;try{this.throwIfDestroyed()}catch(e){return Promise.reject(e)}var n=++this.__recentlyViewed.getItemsAsyncData.serial;return this.__recentlyViewed.getItemsAsyncData.items=null,t||(t=new Promise((function(t,n){e.__recentlyViewed.getItemsAsyncData.resolve=t,e.__recentlyViewed.getItemsAsyncData.reject=n})),e.__recentlyViewed.getItemsAsyncData.promise=t),this.__recentlyViewed.getItemsAsyncData.reloadID=setTimeout((function(){e.__recentlyViewed.getItemsAsyncData.reloadID=null,e.__recentlyViewed.isDestroyed||e.__recentlyViewed.getItemsAsyncData.serial!==n||e._loadItemsAsync().then((function(t){e.__recentlyViewed&&e.__recentlyViewed.getItemsAsyncData.serial===n&&e._setItems(t)})).catch((function(t){if(e.__recentlyViewed&&e.__recentlyViewed.getItemsAsyncData.serial===n){var i=e.__recentlyViewed.getItemsAsyncData.reject;e.__recentlyViewed.getItemsAsyncData.promise=null,e.__recentlyViewed.getItemsAsyncData.reject=null,e.__recentlyViewed.getItemsAsyncData.resolve=null,i(t)}}))}),0),t},_loadItemsAsync:function(){throw new Error("not implemented")},__handleDocumentVisibilityChange:function(e){"visible"===document.visibilityState?this.__recentlyViewed.changeListeners.length>0&&this._startListeningForChanges({reason:"page-visibility"}):this.__recentlyViewed.changeListeners.length>0&&this._stopListeningForChanges()}}),phoenix4.IndexedDBRecentlyViewedDataSource=function(e){if(phoenix4.RecentlyViewedDataSource.call(this,{getKey:e.getKey}),this.__indexedDB={dbName:e.dbName,dbSchemaVersion:1,itemVersion:e.itemVersion||1,upgradeItem:e.upgradeItem||null,recentlyViewedLimit:e.recentlyViewedLimit||20,recentlyViewedMilliseconds:this.__convertDurationToMilliseconds(e.recentlyViewedDuration||"4w"),favouriteLimit:e.favouriteLimit||100,favouriteMilliseconds:this.__convertDurationToMilliseconds(e.favouriteDuration||"26w"),upgradeDatabaseHandler:null,lastLoadedItems:{dbSerial:null,items:null},changeListenerTimeoutID:null,changePollingMilliseconds:e.changePollingMilliseconds||2e3},!Number.isSafeInteger(this.__indexedDB.itemVersion)||this.__indexedDB.itemVersion<1||this.__indexedDB.itemVersion>9999)throw new Error("item version must be an integer between 1 and 9999")},phoenix4.IndexedDBRecentlyViewedDataSource.prototype.__proto__=phoenix4.RecentlyViewedDataSource.prototype,e.extend(phoenix4.IndexedDBRecentlyViewedDataSource.prototype,{recordRecentlyViewedAsync:function(e){var t,n=this,i=this._getKey(e);return n.__openDatabaseAsync().then((function(r){return r.runTransactionAsync(["meta","recentlyViewedItems"],"readwrite",(function(r){var s=r.store("recentlyViewedItems");return s.tryGetAsync(i).then((function(n){var r=Date.now();return n?(t=!0,n.lastViewedAt=r,n.item=e):(t=!1,n={key:i,createdAt:r,lastViewedAt:r,favouriteAt:0,item:e}),s.putAsync(n)})).then((function(){if(!t)return n.__garbageCollectAsync(r)})).then((function(){return n.__completeUpdateAsync(r)}))})).finally((function(){r.close()}))}))},markAsFavouriteAsync:function(e){var t,n=this,i=this._getKey(e);return n.__openDatabaseAsync().then((function(r){return r.runTransactionAsync(["meta","recentlyViewedItems"],"readwrite",(function(r){var s=r.store("recentlyViewedItems");return s.tryGetAsync(i).then((function(n){var r=Date.now();return n?(t=!0,n.lastViewedAt=r,n.favouriteAt=r,n.item=e):(t=!1,n={key:i,createdAt:r,lastViewedAt:r,favouriteAt:r,item:e}),s.putAsync(n)})).then((function(){if(!t)return n.__garbageCollectAsync(r)})).then((function(){return n.__completeUpdateAsync(r)}))})).finally((function(){r.close()}))}))},unmarkKeyAsFavouriteAsync:function(e){var t=this,n=!1;return t.__openDatabaseAsync().then((function(i){return i.runTransactionAsync(["meta","recentlyViewedItems"],"readwrite",(function(i){var r=i.store("recentlyViewedItems");return r.whereKey().is(e).firstOrDefaultAsync().then((function(e){if(e&&e.favouriteAt)return e.lastViewedAt=Date.now(),e.favouriteAt=0,n=!0,r.putAsync(e)})).then((function(){if(n)return t.__garbageCollectAsync(i)})).then((function(){return n?t.__completeUpdateAsync(i):n}))})).finally((function(){i.close()}))}))},deleteAllFavouritesAsync:function(){var e=this;return e.__openDatabaseAsync().then((function(t){return t.runTransactionAsync(["meta","recentlyViewedItems"],"readwrite",(function(t){return t.store("recentlyViewedItems").whereIndexedValue("favouriteAt").greaterThan(0).deleteAsync().then((function(){return e.__completeUpdateAsync(t)}))})).finally((function(){t.close()}))}))},deleteAllRecentlyViewedAsync:function(){var e=this;return e.__openDatabaseAsync().then((function(t){return t.runTransactionAsync(["meta","recentlyViewedItems"],"readwrite",(function(t){return t.store("recentlyViewedItems").whereIndexedValue("favouriteAt").is(0).deleteAsync().then((function(){return e.__completeUpdateAsync(t)}))}))}))},deleteKeysAsync:function(e){var t=this;return t.__openDatabaseAsync().then((function(n){return n.runTransactionAsync(["meta","recentlyViewedItems"],"readwrite",(function(n){return n.store("recentlyViewedItems").deleteAsync(e).then((function(){return t.__completeUpdateAsync(n)}))})).finally((function(){n.close()}))}))},_loadItemsAsync:function(){var e=this;return this.__openDatabaseAsync().then((function(t){return t.runTransactionAsync(["meta","recentlyViewedItems"],"readonly",(function(t){return e.__loadItemsWithTransactionAsync(t).then((function(e){return e}))})).finally((function(){t.close()}))}))},_startListeningForChanges:function(e){var t,n=this,i=function(){n.__loadItemsIfChangedAsync().then((function(e){e&&n._setItems(e)})).catch((function(e){console.error(e)})).finally((function(){n.__indexedDB.changeListenerTimeoutID===t&&(t=setTimeout(i,n.__indexedDB.changePollingMilliseconds),n.__indexedDB.changeListenerTimeoutID=t)}))};t=setTimeout(i,"page-visibility"===e.reason?0:n.__indexedDB.initialChangePollingMilliseconds),this.__indexedDB.changeListenerTimeoutID=t},_stopListeningForChanges:function(){this.__indexedDB.changeListenerTimeoutID=null},__loadItemsIfChangedAsync:function(){var e=this;return this.__openDatabaseAsync().then((function(t){return t.runTransactionAsync(["meta","recentlyViewedItems"],"readonly",(function(t){return e.__indexedDB.lastLoadedItems.dbSerial?t.store("meta").tryGetAsync(1).then((function(n){if(n&&n.serial>e.__indexedDB.lastLoadedItems.dbSerial)return e.__loadItemsWithTransactionAsync(t)})):null})).finally((function(){t.close()}))}))},__garbageCollectAsync:function(e){var t=this,n=Date.now(),i=n-Math.max(t.__indexedDB.favouriteMilliseconds,t.__indexedDB.recentlyViewedMilliseconds),r=n-t.__indexedDB.favouriteMilliseconds,s=n-t.__indexedDB.recentlyViewedMilliseconds,o=e.store("recentlyViewedItems");return o.whereIndexedValue("lastViewedAt").lessThanOrEqualTo(i).deleteAsync().then((function(){return o.whereIndexedValue("lastViewedAt").lessThanOrEqualTo(r).filter((function(e){return!!e.favouriteAt})).forEachAsync((function(e){return e.favouriteAt=0,o.putAsync(e)}))})).then((function(){return o.whereIndexedValue("favouriteAt").greaterThan(0).countAsync()})).then((function(e){var n=Math.max(0,e-t.__indexedDB.favouriteLimit);if(n>0)return o.whereIndexedValue("lastViewedAt").isAny().filter((function(e){return!!e.favouriteAt})).forEachAsync((function(e){return e.favouriteAt=0,o.putAsync(e).then((function(){return--n>0}))}))})).then((function(){return o.whereIndexedValue("lastViewedAt").lessThanOrEqualTo(s).filter((function(e){return!e.favouriteAt})).deleteAsync()})).then((function(){return o.whereIndexedValue("favouriteAt").is(0).countAsync()})).then((function(e){var n=Math.max(0,e-t.__indexedDB.recentlyViewedLimit);return o.whereIndexedValue("lastViewedAt").isAny().filter((function(e){return!e.favouriteAt})).deleteFirstNAsync(n)}))},__openDatabaseAsync:function(){var e=this;return phoenix4.waitForScript("phoenix4-base-indexeddb").then((function(){e.__indexedDB.upgradeDatabaseHandler||(e.__indexedDB.upgradeDatabaseHandler=e.__upgradeDatabase.bind(e));var t=1e4*e.__indexedDB.dbSchemaVersion+e.__indexedDB.itemVersion;return phoenix4.IndexedDB.openAsync({name:e.__indexedDB.dbName,version:t,upgrade:e.__indexedDB.upgradeDatabaseHandler})}))},__upgradeDatabase:function(e){var t,n,i,r=this,s=e.transaction,o=(e.newVersion,e.oldVersion>>>16),a=65535&e.newVersion,l=65535&e.oldVersion;return Promise.resolve().then((function(){if(0===o)return t=s.createObjectStore("meta",{keyPath:"id"}),n={id:1,serial:1},l=0,t.putAsync(n);t=s.store("meta")})).then((function(){0===o?((i=s.createObjectStore("recentlyViewedItems",{keyPath:"key"})).createIndex("lastViewedAt","lastViewedAt"),i.createIndex("favouriteAt","favouriteAt")):i=s.store("recentlyViewedItems")})).then((function(){if(0!==l&&l!==a){if(!r.__indexedDB.upgradeItem)throw new Error("database items require upgrading and no upgrade function was provided");return i.whereKey().isAny().forEachAsync((function(e){var t=r.__indexedDB.upgradeItem({item:e.item,oldVersion:l,newVersion:a});return null!==t?(e.item=t,s.putAsync(e)):i.whereKey().is(e.key).deleteAsync()}))}}))},__completeUpdateAsync:function(e){var t=this,n=e.store("meta");return n.tryGetAsync(1).then((function(e){return e||(e={id:1,serial:0}),e.serial+=1,n.putAsync(e)})).then((function(){return t.__loadItemsWithTransactionAsync(e)})).then((function(e){t._setItems(e)}))},__loadItemsWithTransactionAsync:function(e){var t=this;return e.store("meta").tryGetAsync(1).then((function(n){return e.store("recentlyViewedItems").allAsync().then((function(e){var i=t.__createItems(n,e);return t.__indexedDB.lastLoadedItems={dbSerial:n.serial,items:i},i}))}))},__createItems:function(e,t){for(var n=[],i=[],r=Date.now(),s=r-this.__indexedDB.favouriteMilliseconds,o=r-this.__indexedDB.recentlyViewedMilliseconds,a=0;a<t.length;++a){var l=t[a];l.favouriteAt&&l.lastViewedAt>s?n.push(l):l.lastViewedAt>o&&i.push(l)}return n.sort((function(e,t){return t.lastViewedAt-e.lastViewedAt})),i.sort((function(e,t){return t.lastViewedAt-e.lastViewedAt})),n.splice(this.__indexedDB.favouriteLimit),i.splice(this.__indexedDB.recentlyViewedLimit),{favourites:n.map((function(e){return{item:e.item}})),recentlyViewed:i.map((function(e){return{item:e.item}}))}},__convertDurationToMilliseconds:function(e){var t=/^(\d+|\d*\.\d+)([smhdw])$/.exec(e);if(!t)throw new Error("Invalid duration: "+e);var n=parseFloat(t[1]);switch(t[2]){case"s":n*=1e3;break;case"m":n*=6e4;break;case"h":n*=36e5;break;case"d":n*=864e5;break;case"w":n*=6048e5;break;default:throw new Error("Invalid duration: "+e)}return n}}),phoenix4.VehicleRecentlyViewedDataSource=function(){phoenix4.IndexedDBRecentlyViewedDataSource.call(this,{dbName:"phoenix4_base_recentlyViewedVehicles",getKey:function(e){return e.stockNumber},recentlyViewedLimit:10,favouriteLimit:25})},phoenix4.VehicleRecentlyViewedDataSource.instance=function(){var e=phoenix4.VehicleRecentlyViewedDataSource.__vehiclesInstance;return e||(e=new phoenix4.VehicleRecentlyViewedDataSource,phoenix4.VehicleRecentlyViewedDataSource.__vehiclesInstance=e),e},phoenix4.VehicleRecentlyViewedDataSource.prototype.__proto__=phoenix4.IndexedDBRecentlyViewedDataSource.prototype,e.extend(phoenix4.VehicleRecentlyViewedDataSource.prototype,{loadVehicleSearchInformationAsync:function(e){const t=this,n=e.criteria||{},i=e.maximumCount;return this.getItemsAsync().then((function(e){const r={favourites:[],favouritesRemoved:[],recentlyViewed:[]},s=[];for(let t=0;t<e.favourites.length;++t)s.push(e.favourites[t].item.stockNumber);for(let t=0;t<e.recentlyViewed.length;++t)s.push(e.recentlyViewed[t].item.stockNumber);return 0===s.length?Promise.resolve(r):phoenix4.VehicleSearchProvider.getDefaultImplementation().searchAsync(n).then((n=>{const s={};n.forEach((e=>{s[e.stockNumber]=e}));const o=[];for(let t=0;t<e.favourites.length;++t){const n=e.favourites[t],i=s[n.item.stockNumber];i?r.favourites.push({searchVehicle:i}):(o.push(n.item.stockNumber),r.favouritesRemoved.push({favouriteVehicle:n}))}for(let t=0;t<e.recentlyViewed.length;++t){const n=e.recentlyViewed[t],a=s[n.item.stockNumber];if(a){if(r.recentlyViewed.push({searchVehicle:a}),r.recentlyViewed.length===i)break}else o.push(n.item.stockNumber)}return o.length>0&&t.deleteKeysAsync(o).catch(console.error),r}))}))}})}(jQuery)},8223:e=>{"use strict";const t=window.kintsugi;class n extends EventTarget{static get instance(){let e=i.instance;return e||(i.instance=e=new n,i.initializeAsync(e).catch((e=>console.error(e)))),e}get isDealerUserLoggedIn(){return!!this.__SecurityManager.dealerUser}get dealerUser(){return this.__SecurityManager.dealerUser}async startDealerUserLogInAsync(){const e=this.__SecurityManager,t=e.state;if("initialized"===t)await e.dealerUserAuthenticationProvider.startLogInAsync();else{if("error"===t)throw new Error("phoenix4: security manager initialization failed; can't log in");e.deferredLogInLogOut="login",await this.waitForInitializationAsync()}}async startDealerUserLogOutAsync(){const e=this.__SecurityManager,t=e.state;if("initialized"===t)await e.dealerUserAuthenticationProvider.startLogOutAsync();else{if("error"===t)throw new Error("phoenix4: security manager initialization failed; can't log out");e.deferredLogInLogOut="logout",await this.waitForInitializationAsync()}}async waitForInitializationAsync(){const e=this.__SecurityManager;if(!e.waitForInitializationPromise)if("new"===e.state||"initializing"===e.state)e.waitForInitializationPromise=new Promise(((t,n)=>{e.waitForInitializationResolve=t,e.waitForInitializationReject=n}));else{if("error"===e.state)throw e.initializationError;e.waitForInitializationPromise=Promise.resolve()}return e.waitForInitializationPromise}constructor(){var e;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(super(),i.instance)throw new Error("phoenix4: use SecurityManager.instance to access the singleton instance");const n={state:"new",dealerUserAuthenticationProvider:null!==(e=t.dealerUserAuthenticationProvider)&&void 0!==e?e:new s,dealerUser:null,deferredLogInLogOut:"none",waitForInitializationPromise:null,waitForInitializationResolve:null,waitForInitializationReject:null,initializationError:null};Object.defineProperty(this,"__SecurityManager",{value:n})}}const i=n.__SecurityManager={instance:null,async initializeAsync(e){const t=e.__SecurityManager;if("new"!==t.state)throw new Error("phoenix4: the initialization process has already started.");try{t.state="initializing",await t.dealerUserAuthenticationProvider.initializeAsync(),t.dealerUserAuthenticationProvider.addEventListener("change",(()=>i.handleDealerUserChange(e))),t.state="initialized",t.waitForInitializationResolve&&t.waitForInitializationResolve()}catch(e){throw t.state="error",t.initializationError=e,t.waitForInitializationReject&&t.waitForInitializationReject(e),e}finally{t.waitForInitializationResolve=t.waitForInitializationReject=null}const n=t.dealerUserAuthenticationProvider.dealerUser;i.setDealerUser(e,n),await i.performDeferredLogInLogOutAsync(e)},async performDeferredLogInLogOutAsync(e){const t=e.__SecurityManager,n=t.deferredLogInLogOut,i=t.dealerUser;switch(t.deferredLogInLogOut=null,n){case"none":break;case"login":i||await e.startDealerUserLogInAsync();break;case"logout":i&&await e.startDealerUserLogOutAsync();break;default:throw new Error("phoenix4: invalid deferred action requested: "+JSON.stringify(n))}},setDealerUser(e,n){const r=e.__SecurityManager,s=r.dealerUser;if(i.validateDealerUser(n),t.deepEquals(s,n))return!1;const o="phoenix4-dealer-user-is-logged-in";n?document.body.classList.add(o):document.body.classList.remove(o),r.dealerUser=n;const a=new window.CustomEvent("dealerUserChange",{detail:{dealerUser:n,oldDealerUser:s}});return e.dispatchEvent(a),!0},validateDealerUser(e){if(null===e)return;if(!t.isPlainObject(e))throw new Error("phoenix4: invalid dealer user: "+JSON.stringify(e));const{email:n,firstName:i,lastName:r}=e;if("string"!=typeof n||n.length>0&&!t.isValidEmail(n))throw new Error("phoenix4: invalid dealer user email: "+JSON.stringify(n));if("string"!=typeof i||i.length<1)throw new Error("phoenix4: invalid dealer user first name: "+JSON.stringify(i));if("string"!=typeof r||r.length<1)throw new Error("phoenix4: invalid dealer user last name: "+JSON.stringify(r))},handleDealerUserChange(e){const t=e.__SecurityManager.dealerUserAuthenticationProvider.dealerUser;i.setDealerUser(e,t)}};phoenix4.SecurityManager=n;class r extends EventTarget{constructor(e){super();const t={dealerUser:e.dealerUser};Object.defineProperty(this,"__DealerUserAuthenticationProvider",{value:t})}get dealerUser(){return this.__DealerUserAuthenticationProvider.dealerUser}async initializeAsync(){throw new Error("phoenix4: initializeAsync not implemented")}async startLogInAsync(){throw new Error("phoenix4: startLogInAsync not implemented")}async startLogOutAsync(){throw new Error("phoenix4: startLogOutAsync not implemented")}_setDealerUser(e){const n=this.__DealerUserAuthenticationProvider,i=n.dealerUser;if(t.deepEquals(i,e))return!1;n.dealerUser=e;const r=new window.CustomEvent("change",{dealerUser:e,oldDealerUser:i});return this.dispatchEvent(r),!0}}class s extends r{async initializeAsync(){const e=this.__BirchwoodNextDealerUserAuthenticationProvider;await phoenix4.loadBirchwoodNextAsync();const t=birchwoodNext.DealerUserAuthenticationProvider.instance;await t.waitForInitializationAsync(),e.internalAuthenticationProvider=t;const n=o.convertDealerUser(e.internalAuthenticationProvider.dealerUser);this._setDealerUser(n),e.internalAuthenticationProvider.addEventListener("change",(()=>{const t=o.convertDealerUser(e.internalAuthenticationProvider.dealerUser);this._setDealerUser(t)}))}async startLogInAsync(){return this.__BirchwoodNextDealerUserAuthenticationProvider.internalAuthenticationProvider.startLogIn()}async startLogOutAsync(){return this.__BirchwoodNextDealerUserAuthenticationProvider.internalAuthenticationProvider.startLogOut()}constructor(){super({dealerUser:null}),Object.defineProperty(this,"__BirchwoodNextDealerUserAuthenticationProvider",{value:{internalAuthenticationProvider:null}})}}const o={convertDealerUser:e=>e?{email:e.emailAddress,firstName:e.firstName,lastName:e.lastName}:e},a={SecurityManager:n,BirchwoodNextDealerUserAuthenticationProvider:s,DealerUserAuthenticationProvider:r,StubDealerUserAuthenticationProvider:class extends r{constructor(){var e;super({dealerUser:null!==(e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).dealerUser)&&void 0!==e?e:null})}setDealerUser(e){return this._setDealerUser(e)}async initializeAsync(){await t.timeoutAsync(0)}async startLogInAsync(){}async startLogOutAsync(){}}};e.exports=a},1401:()=>{!function(e){"use strict";const t=window.kintsugi;phoenix4.tryGetShiftDigitalConfiguration=function(){let e=H;return void 0===e&&(e=phoenix4.getServerData("base.shiftdigital.script",{}),e.enabled&&!phoenix4.isElementorPreview()||(e=null),H=e),e},phoenix4.tryGetShiftDigitalFormVehicle=function(){const e=phoenix4.tryGetShiftDigitalConfiguration();if(!e)return null;const t=e.vehicleData;if(!t||!t.success)return null;let n,i;switch(n=t.is_certified_preowned?"CPO":"new"===t.condition?"New":"used"===t.condition?"Used":null,t.fuel_type_code){case"gas":i="Gasoline";break;case"diesel":i="Diesel";break;case"hybrid":i="Hybrid";break;case"electric":i="Electric";break;default:i=null}return{status:n,year:t.year.toString(),make:t.make_text,model:t.model_text,trim:t.trim_text,engine:t.engine_text,transmission:t.transmission_text,interiorColor:t.detailed_interior_colour_text,exteriorColor:t.detailed_colour_text,vin:t.vin,driveTrain:t.drive_type_text,msrp:null==t.original_price?null:t.original_price.toString(),displayedPrice:null==t.price?null:t.price.toString(),fuelType:i}};const n={servicePageRegex:void 0,servicePagePaths:["/vehicle-servicing/","/lexus-maintenance-menu/"]},i=function(){if(q){let e;try{e=Array.prototype.slice.call(arguments).map((e=>JSON.stringify(e))).join(", ")}catch(t){e="..."}console.log("phoenix4: sd("+e+")")}return window.sd.apply(this,arguments)};e((function(){const t=phoenix4.tryGetShiftDigitalConfiguration();if(t){if(console.log("phoenix4: initializing Shift Digital integration"),e("body").addClass("phoenix4-shiftdigital-enabled"),m(t),phoenix4.whenBirchwoodNextLoaded((()=>{birchwoodNext.Widget.addGlobalEventListener("attached",r),birchwoodNext.Widget.addGlobalEventListener("detached",s)})),x(),phoenix4.isSearchResultsPage())if(1===phoenix4.vehicleSearchManagerVersion()){W=U(),phoenix4.VehicleSearchManager.instance().addSearchListener(d);const e=phoenix4.VehicleSearchManager.instance().getCriteria(),t=phoenix4.getServerData("base.searchManager.vehicle.results");let i=null;var n;t.success&&(i=null!==(n=t.metadata.total_results)&&void 0!==n?n:0);const r=M(e);P(r,i)}else{if(2!==phoenix4.vehicleSearchManagerVersion())throw new Error("phoenix4: invalid search manager version used");phoenix4.VehicleSearchManager2.instance.addEventListener("searchstatechanged",h)}console.log("phoenix4: Shift Digital has been initialized")}else console.warn("phoenix4: Shift Digital script was loaded even though Shift Digital was not enabled")}));const r=function(e){const t=e.currentTarget;t instanceof birchwoodNext.VdpCallToActionModal&&(t.addEventListener("formShown",a),t.addEventListener("formFocusIn",l),t.addEventListener("firstFormInteraction",c),t.addEventListener("leadSent",o),t.addEventListener("reserveLeadSent",o)),t instanceof birchwoodNext.VdpTradeInValueModal&&t.addEventListener("tradeInApplied",u)},s=function(e){const t=e.currentTarget;t instanceof birchwoodNext.VdpCallToActionModal&&(t.removeEventListener("formShown",a),t.removeEventListener("formFocusIn",l),t.removeEventListener("firstFormInteraction",c),t.removeEventListener("leadSent",o),t.removeEventListener("reserveLeadSent",o)),t instanceof birchwoodNext.VdpTradeInValueModal&&t.removeEventListener("tradeInApplied",u)},o=function(e){V(e)},a=function(e){N(e)},l=function(e){R(e)},c=function(e){O(e)},u=function(e){F(e)},d=function(e){if("success"!==e.type)return;const t=e.searchManager.getCriteria();i("send","pageview"),null!=t.query&&t.query!==G&&D(t.query);const n=M(t);phoenix4.deepEquals(n,j)||P(n,e.results.metadata.total_results)},h=function(){const e=phoenix4.VehicleSearchManager2.instance;if("success"!==e.searchState)return;const t=e.searchResult,n=e.metadata,r=e.criteria;i("send","pageview"),null!=r.query&&r.query!==G&&D(r.query);const s=E(r,n);phoenix4.deepEquals(s,j)||P(s,t.length)},m=function(e){var t,n,r,s,o,a,l;t=window,n=document,r="script",s=e.scriptUrl,o="sd",t.ShiftAnalyticsObject=o,t[o]=t[o]||function(){(t[o].q=t[o].q||[]).push(arguments)},t[o].l=1*new Date,a=n.createElement(r),l=n.getElementsByTagName(r)[0],a.async=1,a.src=s,l.parentNode.insertBefore(a,l),i("create",e.clientID,e.retailerID,e.providerID);const c={websiteTier:"Tier 3",pageBrand:e.clientID,sessionId:phoenix4.getSessionID(),language:"en",dealerName:e.location.name,dealerZipCode:e.location.postal_code,dealerState:e.location.province_code,dealerCity:e.location.city};c.pageType=L(e),e.isVehicleDetailsPage&&(c.vehicleDetails=phoenix4.tryGetShiftDigitalFormVehicle()),i("dataLayer",c),phoenix4.isSearchResultsPage()&&2===phoenix4.vehicleSearchManagerVersion()||i("send","pageview"),p(),f(),g()},p=function(){const t=e("form.sd-inpage-gform");null!==t&&t.each((function(){const t=e(this),n="in-page";y(t,n),_(t,n),v(t,n)}))},f=function(){e(window).on("jet-popup/show-event/after-show",(function(t,n){const i=e("#"+n.data.popupId).find("form.sd-modal-gform");null!==i&&i.each((function(){const t=e(this),n="modal";t.data("phoenix4-shiftdigital-gform-interacted-with",!1),y(t,n),_(t,n),v(t,n)}))}))},g=function(){e(window).on("elementor/popup/show",(function(t,n){const i=e("#elementor-popup-modal-"+n).find("form.sd-modal-gform");null!==i&&i.each((function(){const t=e(this),n="modal";t.data("phoenix4-shiftdigital-gform-interacted-with",!1),y(t,n),_(t,n),v(t,n)}))}))},y=function(t,n){const i="#"+t.attr("id");e("body").on("focusin",["input","textarea","select"].map((e=>i+" "+e)).join(","),(()=>{w(t,n)}))},_=function(t,n){phoenix4.addGravityFormSubmitHandlers({form:t,onFailure:()=>{t.data("phoenix4-shiftdigital-gform-interacted-with",!0)},onComplete:t=>{b(e(t.form),n,t.wasSuccessful)}})},v=function(e,t){const n=C(e);i("dataLayer",{formType:n,displayType:t,formVehicle:null,events:"formShown"}),i("send")},w=function(e,t){const n=C(e);e.data("phoenix4-shiftdigital-gform-interacted-with")||(e.data("phoenix4-shiftdigital-gform-interacted-with",!0),i("dataLayer",{formType:n,displayType:t,formVehicle:null,events:"formInitiation"}),i("send")),i("dataLayer",{formType:n,displayType:t,formVehicle:null,events:"formFieldInteraction"}),i("send")},b=function(e,t,n){const r={formType:C(e),leadType:"lead",formOptIn:"in-implicit",displayType:t,formVehicle:null},s=!e.hasClass("sd-send-form-submission-error");r.events=n||s?"formSubmission":"formSubmissionError",i("dataLayer",r),i("send")},x=function(){e(document).on("click",(function(t){const n=e(t.target).closest("a"),i=n.attr("href");if(!i||""===i)return;const r=I();/^tel:/.test(i)?k(n):r&&r.test(i)?A(t,i):/^https:\/\/www.google.com\/maps\/search\/?\?/.test(i)&&T()}))},I=()=>{let e=n.servicePageRegex;if(void 0===e){const i=n.servicePagePaths;if(i.length>0){const n=["^(?:"+t.regexEscape(location.origin)+")?(?:"];n.push(i.map(t.regexEscape).join("|")),n.push(")(?:$|\\?|#)");const r=n.join("");e=new RegExp(r)}else e=null;n.servicePageRegex=e}return e},C=e=>e.hasClass("sd-service-gform")?"Schedule Service":"General Contact",k=function(e){const t=S(e);i("dataLayer",{clickToCallDepartment:t,events:"clickToCall"}),i("send")},S=function(e){const t=e.attr("href").substr(4).replace(/[\W_]/g,"").replace(/^1/,"");let n=e.attr("data-phoenix4-department-code");if(!n){var i;const e=null===(i=phoenix4.tryGetShiftDigitalConfiguration())||void 0===i?void 0:i.location;e&&(t===e.phone?n="general":t===e.service_phone?n="service":t===e.parts_phone&&(n="parts"))}let r="Other";return"general"===n?r="Sales":"service"===n?r="Service":"parts"===n&&(r="Parts"),r},A=function(e,t){i("dataLayer",{events:"scheduleServiceClick"}),i("send"),e.preventDefault(),setTimeout((()=>window.location=t),100)},T=function(){i("dataLayer",{events:"getDirections"}),i("send")},D=function(e){i("dataLayer",{typedSearchContent:e.replace(/\s+/g,"|"),events:"typedSearch"}),i("send"),G=e},P=function(t,n){i("dataLayer",{countSearchResults:null!=n?n:0,filterSearch:t,events:"filterSearch"}),i("send"),j=e.extend(!0,{},t)},M=function(e){const t=W;if(null===t)throw new Error("phoenix4: could not find vehicle search metadata cache");const n=phoenix4.vehicleSearchMetadata();let i;i=e.conditions&&1===e.conditions.length?{new:"New",used:"Used","certified-pre-owned":"CPO"}[e.conditions[0]]:"Mixed";const r=e.make_model_trims||[],s=new Set,o=new Set,a=new Set;for(const e of r)switch(e.split("-").length){case 1:s.add(e);break;case 2:o.add(e);break;case 3:a.add(e);break;default:throw new Error(`phoenix4: Invalid make/model/trim criteria: ${JSON.stringify(e)}`)}const l=(e,t)=>{const n=null==e?[]:e,i=[];for(const e of n){const n=t.get(e);void 0!==n&&i.push(n)}return 0===i.length?"All":i.join("|")};return{status:i,bodyStyle:l(e.body_types,t.bodyStyles),make:l(s,t.makes),model:l(o,t.models),trim:l(a,t.trims),color:l(e.colours,t.colours),driveTrain:"All",features:l(e.features,t.features),year:((e,t)=>{if(null==e&&null==t)return"All";const i=null==e?n.year_min:e,r=null==t?n.year_max:t,s=[];for(let e=i;e<=r;++e)s.push(e.toString());return s.join("|")})(e.year_min,e.year_max),minPrice:null==e.price_min?void 0:e.price_min,maxPrice:null==e.price_max?void 0:e.price_max}},E=function(e,t){let n;n=e.conditions&&1===e.conditions.length?{new:"New",used:"Used","certified-pre-owned":"CPO"}[e.conditions[0]]:"Mixed";const i=e.makeModelTrims||[],r=[],s=[],o=[];i.forEach((e=>{switch(e.split("-").length){case 1:r.push(e);break;case 2:s.push(e);break;case 3:o.push(e);break;default:throw new Error(`phoenix4: Invalid make/model/trim criteria: ${JSON.stringify(key)}`)}}));const a=(e,t)=>{const n=null==e?[]:e,i=[];return t.forEach((e=>{-1!==n.indexOf(e.id)&&i.push(e.name)})),0===i.length?"All":i.join("|")};return{status:n,bodyStyle:a(e.bodyTypes,t.bodyTypes),make:a(r,t.makeModelTrims),model:((e,t)=>{const n=[];return t.forEach((t=>{t.models.forEach((t=>{-1!==e.indexOf(t.id)&&n.push(t.name)}))})),0===n.length?"All":n.join("|")})(s,t.makeModelTrims),trim:((e,t)=>{const n=[];return t.forEach((t=>{t.models.forEach((t=>{t.trims.forEach((t=>{-1!==e.indexOf(t.id)&&n.push(t.name)}))}))})),0===n.length?"All":n.join("|")})(o,t.makeModelTrims),color:a(e.colours,t.colours),driveTrain:"All",features:a(e.features,t.features),year:((e,n)=>{if(null==e&&null==n)return"All";const i=null==e?t.years[0]:e,r=null==n?t.years.slice(-1):n,s=[];for(let e=i;e<=r;++e)s.push(e.toString());return s.join("|")})(e.yearMin,e.yearMax),minPrice:null==e.priceMin?void 0:e.priceMin,maxPrice:null==e.priceMax?void 0:e.priceMax}},F=function(e){if(phoenix4.tryGetShiftDigitalConfiguration()){const t=e.data.tradeInValues;i("dataLayer",{formType:"Trade In",leadType:"lead",formOptIn:"in-implicit",displayType:"modal",prefContact:"other",tradeIn:{year:null==t.year?"":t.year,make:null==t.make?"":t.make,model:null==t.model?"":t.model},formVehicle:phoenix4.tryGetShiftDigitalFormVehicle(),events:"tradeInFormSubmission"}),i("send")}},V=function(e){if(phoenix4.tryGetShiftDigitalConfiguration()){const t={formType:z(e.data.leadType),leadType:"lead",formOptIn:"in-implicit",displayType:"modal",events:"formSubmission"};if(e.data.formValues.preferredContactMethod)switch(e.data.formValues.preferredContactMethod){case"text":t.prefContact="text";break;case"call":t.prefContact="phone";break;case"email":t.prefContact="email";break;default:t.prefContact="other"}else e.data.leadType.startsWith("phone-")?t.prefContact="phone":e.data.leadType.startsWith("email-")?t.prefContact="email":t.prefContact="other";t.formVehicle=phoenix4.tryGetShiftDigitalFormVehicle(),i("dataLayer",t),i("send")}},N=function(e){const t={formType:B(e.data.formType),displayType:"modal",formVehicle:phoenix4.tryGetShiftDigitalFormVehicle(),events:"formShown"};i("dataLayer",t),i("send")},R=function(e){const t={formType:B(e.data.formType),displayType:"modal",formVehicle:phoenix4.tryGetShiftDigitalFormVehicle(),events:"formFieldInteraction"};i("dataLayer",t),i("send")},O=function(e){const t={formType:B(e.data.formType),displayType:"modal",formVehicle:phoenix4.tryGetShiftDigitalFormVehicle(),events:"formInitiation"};i("dataLayer",t),i("send")},L=function(e){const t=new URL(e.currentUrl).pathname;return"/"===t?"Home":"/models/"===t?"Showroom":t.startsWith("/models/")?"Model Showroom":t.startsWith("/sell-or-trade-a-vehicle/")?"Trade In":e.isVehicleSearchPage?"Vehicle Listing":e.isVehicleDetailsPage?"Vehicle Details":t.startsWith("/parts-service-offers/")?"Service Specials":t.startsWith("/vehicle-financing/")?"Finance":t.startsWith("/vehicle-servicing/")||t.startsWith("/lexus-maintenance-menu/")?"Service":t.startsWith("/shop-for-tires/")?"Tire Store":t.startsWith("/about-us/")?"About Us":t.startsWith("/contact/")?"Contact Us":t.startsWith("/sales-offers/")?"Dealer Specials":t.startsWith("/vehicle-accessories/")?"Accessories":t.startsWith("/why-kia-certified-pre-owned/")?"CPOV Program":e.isPageNotFound?"Page Not Found":"Other"},z=function(e){return e.startsWith("testdrive-")?"Test Drive":e.startsWith("email-")?"Request More Info":e.startsWith("phone-")?"Send to Mobile":"Other"},B=function(e){switch(e){case"email":return"Request More Info";case"phone":return"Send to Mobile";case"testdrivehome":case"testdrivedealer":return"Test Drive";default:return"Other"}},U=function(){const e=phoenix4.vehicleSearchMetadata(),t=e=>new Map(e.map((e=>[e.id,e.text]))),n={makes:new Map,models:new Map,trims:new Map,bodyStyles:t(e.body_types),features:t(e.features),colours:t(e.colours)};for(const t of e.makes){n.makes.set(t.id,t.text);for(const e of t.models){n.models.set(e.id,e.text);for(const t of e.trims)n.trims.set(t.id,t.text)}}return n};let H,q=!0,W=null,j=null,G=null}(jQuery)},8616:()=>{!function(e){"use strict";e.widget("phoenix4.phoenix4Slider",{options:{min:0,max:100,step:1,range:!1,value:void 0,values:void 0,allowNoMax:!1,noMaxValue:null,allowNoMin:!1,noMinValue:null,formatValue:null,formatAriaValueText:null,label:null,valueCaption:null,formatValueCaption:null},values:function(e){if(arguments.length>0){if(e.length!==this.options.values.length)throw"phoenix4Slider: incorrect number of values passed";if(this.options.min<this.options.max&&!phoenix4.deepEquals(e,this.options.values)){this.options.values=e,1===e.length&&(this.options.value=e[0]);var t=this.__mapValuesToRawValues();this.element[0].noUiSlider.set(t),this.__fixAriaValues(),this.__updateValueCaptions()}}return this.options.values},value:function(e){if(arguments.length>0)return this.values([e])[0];if(1===this.options.values.length)return this.options.values[0];throw"phoenix4Slider: slider has more than one value"},valueCaptionText:function(){if(!this.__valueCaptionText){var e,t,n;if(this.options.formatValueCaption){var i={$widget:this.element,values:this.options.values};void 0!==this.options.value&&(i.value=this.options.value),e="custom",n=this.options.formatValueCaption(i)}else!0===this.options.range?this.options.values[0]===this.options.noMinValue&&this.options.allowNoMin?this.options.values[1]===this.options.noMaxValue&&this.options.allowNoMax?e="any":(e="up-to",t=this.options.values[1]):this.options.values[1]===this.options.noMaxValue&&this.options.allowNoMax?(e="or-more",t=this.options.values[0]):(e="custom",t=this.__formatValue(this.options.values[0])+" – "+this.__formatValue(this.options.values[1])):"min"===this.options.range?this.options.value===this.options.noMaxValue&&this.options.allowNoMax?e="any":(e="up-to",t=this.options.value):"max"===this.options.range?this.options.value===this.options.noMinValue&&this.options.allowNoMin?e="any":(e="or-more",t=this.options.value):(e="value",t=this.options.value);switch(e){case"value":n=this.__formatValue(t);break;case"up-to":n="Up to "+this.__formatValue(t);break;case"or-more":n=this.__formatValue(t)+" or more";break;case"any":n="Any";break;default:n=t}this.__valueCaptionText=n}return this.__valueCaptionText},_create:function(){var t=this.options;if(t.allowNoMin&&t.allowNoMax&&t.noMinValue===t.noMaxValue)throw"phoenix4Slider: the no-min and no-max values must be different";if(t.values?t.values=this.__normalizeValues(t.values):void 0!==t.value?t.values=this.__normalizeValues([t.value]):!0===t.range?t.values=[t.allowNoMin?t.noMinValue:t.min,t.allowNoMax?t.noMaxValue:t.max]:t.values=[t.allowNoMin?t.noMinValue:t.min],1===t.values.length){if(!0===t.range)throw"phoenix4Slider: must provide two values if range is true";t.value=t.values[0]}else{if(!0!==t.range)throw"phoenix4Slider: must provide a single value if range is not true";delete t.value}t.values;var n,i=this.__mapLimitsToRawLimits(),r=this.__mapValuesToRawValues();this.element.addClass("phoenix4-slider").empty(),this.options.min<this.options.max?(noUiSlider.create(this.element[0],{range:{min:i.min,max:i.max},connect:"min"===t.range?[!0,!1]:"max"===t.range?[!1,!0]:t.range,start:r,step:t.step}),this.element.prepend('<div class="phoenix4-slider-bar"></div>'),this.__fixAriaValues()):this.element.addClass("readonly noUi-target noUi-ltr noUi-horizontal").append('<div class="phoenix4-slider-bar"></div><div class="noUi-base"><div class="noUi-origin" style="transform:translate(-50%, 0); z-index: 4"><div class="noUi-handle"><div class="noUi-touch-area"></div></div></div></div>'),t.label?0===(n=e(t.label)).length&&console.warn("phoenix4Slider: explicit slider label not found"):(this.element.attr("id")&&(n=e('label[for="'+this.element.attr("id")+'"]')),n&&0!==n.length||(n=this.element.closest("label"))),n&&n.length>0?(n=e(n[0]).uniqueId(),this.element.find(".noUi-handle").attr({"aria-labelledby":n.attr("id")}),this.label=n):this.label=null,t.valueCaption&&(t.valueCaption=e(t.valueCaption),t.valueCaption.length>0?this.__updateValueCaptions():(console.warn("phoenix4Slider: value caption not found"),t.valueCaption=null)),this.options.min<this.options.max&&(this.element[0].noUiSlider.on("slide",this.__handleNoUiSliderSlideEvent.bind(this)),this.element[0].noUiSlider.on("change",this.__handleNoUiSliderChangeEvent.bind(this)))},_destroy:function(){this.options.min<this.options.max&&this.element[0].noUiSlider.destroy(),this.element.removeClass("phoenix4-slider readonly noUi-target noUi-ltr noUi-horizontal").empty()},__normalizeValues:function(e){var t=this.options;return e.map((function(e){if(e===t.noMinValue&&t.allowNoMin||e===t.noMaxValue&&t.allowNoMax)return e;if(Number.isFinite(e))return e<=t.min?t.min:e>=t.max?t.max:Math.min(t.max,t.min+Math.floor((e-t.min)/t.step)*t.step);throw"phoenix4Slider: invalid value: "+e}))},__mapLimitsToRawLimits:function(){var e=this.options;return{min:e.allowNoMin?e.min-e.step:e.min,max:e.allowNoMax?e.max+e.step:e.max}},__mapValuesToRawValues:function(e){var t=this.options;return(e||t.values).map((function(e){return e===t.noMinValue&&t.allowNoMin?t.min-t.step:e===t.noMaxValue&&t.allowNoMax?t.max+t.step:e}))},__setValuesFromRawValues:function(e){var t=this.options;t.allowNoMax||t.allowNoMin?t.values=e.map((function(e){var n=Math.floor(e);return n>t.max&&t.allowNoMax?t.noMaxValue:n<t.min&&t.allowNoMin?t.noMinValue:n})):t.values=e,void 0!==t.value&&(t.value=t.values[0])},__fixAriaValues:function(t){var n,i,r=this.options,s=this.element.find(".noUi-handle"),o=this.__mapLimitsToRawLimits();t||0===t?(n=t,i=t+1):(n=0,i=r.values.length);for(var a=n;a<i;++a){var l,c=r.values[a];l=r.formatAriaValueText?r.formatAriaValueText({$widget:this.element,value:c}):this.__formatValue(c),e(s[a]).attr({"aria-valuetext":l,"aria-valuenow":c,"aria-valuemin":o.min,"aria-valuemax":o.max})}},__formatValue:function(e){var t=this.options;return t.formatValue?t.formatValue({$widget:this.element,value:e}):e===t.noMinValue&&t.allowNoMin?"No min.":e===t.noMaxValue&&t.allowNoMax?"No max.":e.toString()},__updateValueCaptions:function(){if(delete this.__valueCaptionText,this.options.valueCaption){var e=this.valueCaptionText();this.options.valueCaption.text(e)}},__handleNoUiSliderSlideEvent:function(e,t,n,i,r){this.__setValuesFromRawValues(n),this.__updateValueCaptions(),this.__fixAriaValues(t);var s={values:this.options.values};void 0!==this.options.value&&(s.value=this.options.value),this._trigger("input",null,s)},__handleNoUiSliderChangeEvent:function(e,t,n,i,r){this.__setValuesFromRawValues(n),this.__updateValueCaptions();var s={values:this.options.values};void 0!==this.options.value&&(s.value=this.options.value),this._trigger("change",null,s)}})}(jQuery)},2111:()=>{!function(e){phoenix4.SuggestionEngine=function(e){this.__items=e.items,this.__src=e.src,this.__fields=e.fields,this.__implementation=e.implementation,this.__src=e.src,this.__maxSuggestions=e.maxSuggestions||20,this.__sort=e.sort||null,this.__filter=e.filter||null,this.__postProcess=e.postProcess||null},e.extend(phoenix4.SuggestionEngine.prototype,{initializeAsync:function(){if(this.__isInitialized)return Promise.resolve(this);if(this.__initPromise)return this.__initPromise;var t=this;try{var n;if(this.__implementation||(this.__implementation=new phoenix4.SuggestionEngine.DefaultImplementation),this.__items)n=Promise.resolve(this.__items);else{if(!this.__src)throw new Error("SuggestionEngine: either items or src must be provided");n=new Promise((function(n,i){e.ajax({url:t.__src,method:"GET",cache:!0,dataType:"json",success:function(e){n(e)},error:function(e,t,n){try{throw new Error("failed to download items for suggestions: "+t)}catch(e){i(e)}}})}))}return n=n.then((function(e){return t.__implementation.initializeAsync({items:e,fields:t.__fields,maxSuggestions:t.__filter?null:t.__maxSuggestions})})).then((function(){return t.__isInitialized=!0,delete t.__items,delete t.__src,delete t.__fields,t})).catch((function(e){throw e instanceof Error?e:"SuggestionEngine: failed to initialize (no details)"})).finally((function(){delete t.__initPromise})),this.__initPromise=n,n}catch(e){return Promise.reject(e)}},isInitialized:function(){return!!this.__isInitialized},suggestAsync:function(e){var t={query:e.query},n=this,i=this.__isInitialized?this.__implementation.suggestAsync(t):this.initializeAsync().then((function(){return n.__implementation.suggestAsync(t)}));return this.__filter&&(i=i.then((function(e){for(var t,i=e.items,r=0,s=!1,o=Math.min(i.length,n.__maxSuggestions||Number.POSITIVE_INFINITY);r<o;){var a=i[r];if(!n.__filter(a)){s=!0;break}++r}if(s){for(var l=r++;r<i.length&&l<o;)a=i[r++],n.__filter(a)&&(i[l++]=a);t=l}else t=r;return i.splice(t,i.length-t),e}))),this.__sort&&(i=i.then((function(e){return phoenix4.stableSort(e.items,n.__sort),e}))),this.__postProcess&&(i=i.then((function(e){var t=n.__postProcess(e);return void 0===t?e:t}))),i}}),phoenix4.registerLazyScript({handle:"phoenix4-base-jeancroy-fuzzysearch",url:"phoenix4-base/external/fuzzysearch-20181126/fuzzysearch.min.js"});var t=function(){this.__initializePromise=t.initializeAsync()};e.extend(t.prototype,{initializeAsync:function(e){var t=this;return this.__initializePromise.then((function(){t.__searcher=new window.FuzzySearch({source:t.__wrapItems(e.fields,e.items),keys:e.fields,output_map:"root",output_limit:e.maxSuggestions||0,token_field_min_length:2,token_sep:" .,:"}),delete this.__initializePromise}))},suggestAsync:function(e){var t=this;return new Promise((function(n,i){var r=t.__searcher.search(e.query);n({query:e.query,items:r.map((function(e){return e.item.__originalItem})),raw:{results:r}})}))},__wrapItems:function(e,t){var n=[];n.length=t.length;for(var i=0;i<t.length;++i)for(var r=t[i],s={__originalItem:r},o=0;o<e.length;++o){var a=e[o],l=r[a];s[a]=l||0===l?l.toString():"",n[i]=s}return n}}),t.initializeAsync=function(){return phoenix4.waitForScript("phoenix4-base-jeancroy-fuzzysearch")},phoenix4.SuggestionEngine.DefaultImplementation=t}(jQuery)},1754:(e,t,n)=>{!function(e){"use strict";const t=window.kintsugi,{VehicleSearchProvider:i}=n(8076),{DynamicTitleSelector:r}=n(5045);class s{static get instance(){let e=o.instance;return e||(e=o.instance=new s({provider:i.getDefaultImplementation({highlightedMakeIDs:phoenix4.highlightedMakeIDs()}),defaultPageTitle:phoenix4.defaultVehicleSearchPageTitle(),isSearchByPaymentEnabled:phoenix4.isSearchByPaymentEnabled()}),e.startInitializing()),e}constructor(e){this.__VehicleSearchManager2={provider:e.provider,state:"created",searchState:"initial",waitForInitializationPromise:null,waitForInitializationResolve:null,waitForInitializationReject:null,initializationError:null,metadata:null,searchResult:[],defaultPageTitle:e.defaultPageTitle,eventListeners:[],criteria:{},criteriaSnapshot:null,shouldQueueCriteriaChangedEvent:!1!==e.shouldQueueCriteriaChangedEvent,shouldUpdatePageUrl:!1!==e.shouldUpdatePageUrl,criteriaChangedTimeoutID:null,searchTimeoutID:null,searchCancelTokenSource:null,defaultFinanceType:!1!==e.isSearchByPaymentEnabled?"finance":"cash"}}get state(){return this.__VehicleSearchManager2.state}get searchState(){return this.__VehicleSearchManager2.searchState}get isInitialized(){const e=this.__VehicleSearchManager2.state;return"created"!==e&&"initializing"!==e&&"error"!==e}get isErrorState(){return"error"===this.__VehicleSearchManager2.state}get metadata(){return o.throwIfNotInitialized(this),this.__VehicleSearchManager2.metadata}get criteria(){o.throwIfNotInitialized(this);const e=this.__VehicleSearchManager2;let t=e.criteriaSnapshot;return t||(t=e.criteriaSnapshot=JSON.parse(JSON.stringify(e.criteria))),t}get criteriaFilters(){return Object.fromEntries(Object.entries(this.criteria).filter((e=>{let[t]=e;return!1!==o.criteriaCategoryDescription[t].isFilter})))}get searchResult(){return this.__VehicleSearchManager2.searchResult}get defaultFinanceType(){return this.__VehicleSearchManager2.defaultFinanceType}get isTradeInApplied(){return"tradeIn"in this.criteria}get isCashDownApplied(){return"cashDown"in this.criteria&&this.criteria.cashDown>0}startInitializing(){const e=this.__VehicleSearchManager2,t=e.provider;let n=null,i=null;if("created"!==e.state)return;const r=()=>{n?(e.initializationError=n,o.setState(this,"error"),o.dispatchEvent(this,"initializationcompleted"),e.waitForInitializationReject&&e.waitForInitializationReject(n)):(e.metadata=i,e.metadata.page=1,e.metadata.financeType=[{name:"Finance",id:"finance"},{name:"Lease",id:"lease"},{name:"Cash",id:"cash"}],o.updateCriteriaFromPageUrl(this),o.bestEffortSetAppliedTradeInFromStorage(this),o.bestEffortSetAppliedCashDownFromStorage(this),o.setState(this,"ready"),o.dispatchEvent(this,"initializationcompleted"),e.waitForInitializationResolve&&e.waitForInitializationResolve(),o.startSearch(this)),e.waitForInitializationResolve=e.waitForInitializationReject=null};try{o.setState(this,"initializing"),t.loadMetadataAsync().then((function(e){i=e})).catch((function(e){n=e})).finally((function(){r()}))}catch(e){n=e,r()}}waitForInitializationAsync(){const e=this.__VehicleSearchManager2;let t=e.waitForInitializationPromise;return t||(t="created"===e.state||"initializing"===e.state?new Promise((function(t,n){e.waitForInitializationResolve=t,e.waitForInitializationReject=n})):"error"===e.state?Promise.reject(e.initializationError):Promise.resolve(),e.waitForInitializationPromise=t),t}addEventListener(e,t){t&&this.__VehicleSearchManager2.eventListeners.push({eventName:e,handler:t})}resetPage(){this.__VehicleSearchManager2.criteria.page>1&&this.setCriteriaValue("page",null)}setCriteriaValue(e,t){const n=this.__VehicleSearchManager2,i=n.criteria,r=n.metadata;let s=!1;if(!(e in o.criteriaCategoryDescription))throw new Error("phoenix4: unrecognized/invalid category type: "+e);const a=o.criteriaCategoryDescription[e].valueType;if("identifier-array"===a){if(null!=t&&!Array.isArray(t))throw new Error("phoenix4: criteria "+e+" value must be an array with category identifiers: "+t);let n=[];if(null!=t&&(n="engineTypes2"===e?o.normalizeEngineTypeCriteriaValues(this,t):t.slice().sort().filter((function(e,t,n){return t==n.indexOf(e)}))),!o.areArraysEqual(n,i[e]||[])){for(const t of n)o.validateCriteriaValue(this,e,t);n.length>0?i[e]=n:delete i[e],s=!0}}else if("identifier"===a){if(null!=t&&!r[e].some((e=>e.id===t)))throw new Error("phoenix4: criteria "+e+" value must be a category identifier: "+t);if(null===t&&void 0===i[e])return;i[e]!==t&&(s=!0,t?i[e]=t:delete i[e])}else if("integer"===a){if(null!=t&&!Number.isInteger(t))throw new Error("phoenix4: criteria "+e+" value must be an integer: "+t);let n;n=null==t||"cashDown"===e&&0===t?void 0:t,i[e]!==n&&(s=!0,null!=n?i[e]=n:delete i[e],"cashDown"===e)&&o.setVdpCashDownAmount(n)}else if("boolean"===a){if(null!=t&&"boolean"!=typeof t)throw new Error("phoenix4: criteria "+e+" value must be a boolean: "+t);i[e]!==t&&(s=!0,t?i[e]=!0:delete i[e])}else if("string"===a){if(null!=t&&"string"!=typeof t)throw new Error("phoenix4: criteria "+e+" value must be a string: "+t);i[e]!==t&&(s=!0,t?i[e]=t:delete i[e])}else if("tradeIn"===a){if(!(null===t||"value"in t&&"owing"in t&&"type"in t))throw new Error("phoenix4: invalid criteria tradeIn value: "+t);if(null===t&&void 0===i.tradeIn)return void this.resetVdpTradeIn();i.tradeIn&&null===t?(s=!0,delete i.tradeIn,this.resetVdpTradeIn()):i.tradeIn||(s=!0,i.tradeIn={type:t.type,value:t.value,owing:t.owing})}s&&o.onCriteriaChanged(this)}addCriteriaValue(e,t){const n=this.__VehicleSearchManager2.criteria;if("identifier-array"!==o.criteriaCategoryDescription[e].valueType)throw new Error("phoenix4: can only add/remove values from criteria which are arrays");let i=[t];"makeModelTrims"===e&&(i=[...i,...o.getMakeModelTrimsParentValues(this,e,t)]);const r=[...n[e]||[]];i.forEach((e=>{r.includes(e)||r.push(e)})),this.setCriteriaValue(e,r)}removeCriteriaValue(e,t){const n=this.__VehicleSearchManager2.criteria;if("identifier-array"!==o.criteriaCategoryDescription[e].valueType)throw new Error("phoenix4: can only add/remove values from criteria which are arrays");let i=[t];"makeModelTrims"===e&&(i=[...i,...o.getMakeModelTrimsSubValues(this,t)]);const r=n[e].filter((e=>!i.includes(e)));this.setCriteriaValue(e,r)}clearAllCriteriaFilterValues(e){const t=this.__VehicleSearchManager2.criteria,n=o.criteriaCategoryDescription,i={};let r=!1;Object.keys(t).forEach((s=>{!1===n[s].isFilter||!e&&"tradeIn"===s?i[s]=t[s]:r=!0})),r&&(this.__VehicleSearchManager2.criteria=i,this.resetPage(),o.onCriteriaChanged(this),e&&this.resetVdpTradeIn(),o.setVdpCashDownAmount(null))}clearAllCriteriaPaymentFilterValues(e){const t=this.__VehicleSearchManager2.criteria,n=o.criteriaCategoryDescription,i={};let r=!1;Object.keys(t).forEach((s=>{!n[s].isPaymentFilter||!e&&"tradeIn"===s?i[s]=t[s]:r=!0})),r&&(this.__VehicleSearchManager2.criteria=i,this.resetPage(),o.onCriteriaChanged(this),e&&this.resetVdpTradeIn(),o.setVdpCashDownAmount(null))}clearAllCriteriaValues(){const e=this.__VehicleSearchManager2.criteria;0!==Object.keys(e).length&&(this.__VehicleSearchManager2.criteria={},o.onCriteriaChanged(this))}setCriteria(e){this.clearAllCriteriaValues();for(const t in e)this.setCriteriaValue(t,e[t]);"tradeIn"in e||this.resetVdpTradeIn(),"cashDown"in e||o.setVdpCashDownAmount(null)}setCriteriaFilters(e){this.clearAllCriteriaFilterValues();const t=this.__VehicleSearchManager2.criteria;this.setCriteria({...t,...e}),this.resetPage()}addOrRemoveCriteriaValue(e,t,n){n?this.addCriteriaValue(e,t):this.removeCriteriaValue(e,t)}static tryGetQueryParameters(e){const t=o.criteriaCategoryDescription,n=e.criteria,i=[];return Object.keys(t).forEach((e=>{if(e in n){const r=t[e].urlParameterName;if(!r)return;switch(t[e].valueType){case"identifier-array":i.push(r+"="+n[e].slice().sort().map(encodeURIComponent).join(","));break;case"identifier":case"boolean":case"integer":case"string":i.push(r+"="+encodeURIComponent(n[e]))}}})),i.join("&")}getDynamicPageTitle(){const e=this.__VehicleSearchManager2,t=e.criteria,n=e.metadata,i=new r;i.setDefaultValue(e.defaultPageTitle),i.addCalculatedField("makes",(function(e){return(e.makeModelTrims||[]).filter((e=>-1===e.indexOf("-")))})),i.addCalculatedField("models",(function(e){return(e.makeModelTrims||[]).filter((e=>1===(e.match(/-/g)||[]).length))})),i.addCalculatedField("cpo_name",(()=>"Certified Pre-Owned")),i.addMap("conditions",{new:"New",used:"Used","certified-pre-owned":"Certified Pre-Owned"});const s={};n.discountTypes.forEach((e=>{s[e.id]=e.name})),i.addMap("discountTypes",s);const o={};n.bodyTypes.forEach((e=>{o[e.id]=e.name})),i.addMap("bodyTypes",o);const a={};n.engineTypes.forEach((e=>{a[e.id]=e.name})),i.addMap("engineTypes",a);const l={};n.fuelTypes.forEach((e=>{l[e.id]=e.name})),i.addMap("fuelTypes",l);const c=[],u=[];return n.makeModelTrims.forEach((e=>{c[e.id]=e.name,e.models.forEach((e=>{u[e.id]=e.name}))})),i.addMap("makes",c),i.addMap("models",u),[{criteria:[{type:"=",field:"conditions",value:""},{type:"=",field:"discountTypes",value:""},{type:"=",field:"demo",value:""},{type:"=",field:"makes",value:""},{type:"=",field:"models",value:""},{type:"=",field:"bodyTypes",value:""},{type:"=",field:"engineTypes",value:""},{type:"=",field:"fuelTypes",value:""},{type:"=",field:"stockStatuses",value:""}],pattern:""},{criteria:[{type:"=",field:"conditions",value:"certified-pre-owned"}],pattern:"{cpo_name} Inventory"},{criteria:[{type:"COUNT",field:"makes",max:1},{type:"COUNT",field:"models",min:1,max:3}],pattern:"{discountTypes} {conditions} {makes} {models} Inventory"},{criteria:[{type:"COUNT",field:"makes",max:3}],pattern:"{discountTypes} {conditions} {makes} {bodyTypes} Inventory"}].forEach((e=>{i.addRule(e)})),i.getBestTitle(t)}getCriteriaFromSearchString(e){const t=o.criteriaCategoryDescription,n={},i=new URLSearchParams(e);return Object.keys(t).forEach((e=>{const r=t[e].urlParameterName;if(!r)return;const s=t[e].valueType;if(i.has(r)){const t=i.get(r);switch(s){case"identifier-array":const i=t.split(",");n[e]=i.filter((t=>{let n=!0;try{o.validateCriteriaValue(this,e,t)}catch(e){n=!1}return n}));break;case"identifier":try{o.validateCriteriaValue(this,e,t),n[e]=t}catch(e){}break;case"string":n[e]=t;break;case"integer":n[e]=parseInt(t);break;case"boolean":n[e]="true"===t}}})),n}setVdpTradeIn(e){localStorage.setItem("birchwoodNext.session.vdp.appliedTradeIn",JSON.stringify(e))}resetVdpTradeIn(){this.setVdpTradeIn({valuationUuid:null,value:"",estimateValue:"",owing:"",type:null,vehicleTitle:"",vehicleYear:null,vehicleMake:"",vehicleModel:"",vehicleTrim:"",vehicleKm:"",conditionID:null})}}phoenix4.VehicleSearchManager2=s;const o=s.__VehicleSearchManager2={instance:null,criteriaCategoryDescription:{page:{valueType:"integer",urlParameterName:"results_page",isFilter:!1},limit:{valueType:"integer",urlParameterName:"limit",isFilter:!0},conditions:{valueType:"identifier-array",urlParameterName:"condition"},discountTypes:{valueType:"identifier-array",urlParameterName:"discount"},bodyTypes:{valueType:"identifier-array",urlParameterName:"body_type"},engineTypes2:{valueType:"identifier-array",urlParameterName:"engine"},stockStatuses:{valueType:"identifier-array",urlParameterName:"stock_status"},makeModelTrims:{valueType:"identifier-array",urlParameterName:"make_model_trim"},colours:{valueType:"identifier-array",urlParameterName:"colour"},features:{valueType:"identifier-array",urlParameterName:"feature"},yearMin:{valueType:"integer",urlParameterName:"year_min"},yearMax:{valueType:"integer",urlParameterName:"year_max"},priceMin:{valueType:"integer",urlParameterName:"price_min",isPaymentFilter:!0},priceMax:{valueType:"integer",urlParameterName:"price_max",isPaymentFilter:!0},paymentMin:{valueType:"integer",urlParameterName:"payment_min",isPaymentFilter:!0},paymentMax:{valueType:"integer",urlParameterName:"payment_max",isPaymentFilter:!0},financeType:{valueType:"identifier",urlParameterName:"finance_type",isFilter:!1},paymentMaxTerm:{valueType:"integer",urlParameterName:"max_term",isPaymentFilter:!0},includeTaxes:{valueType:"boolean",urlParameterName:"include_taxes",isPaymentFilter:!0},excludeTradeInFromPrice:{valueType:"boolean",urlParameterName:"exclude_tradein",isPaymentFilter:!0},kmMin:{valueType:"integer",urlParameterName:"km_min"},kmMax:{valueType:"integer",urlParameterName:"km_max"},rangeMin:{valueType:"integer",urlParameterName:"range_min"},rangeMax:{valueType:"integer",urlParameterName:"range_max"},sort:{valueType:"identifier",urlParameterName:"sort",isFilter:!1},query:{valueType:"string",urlParameterName:"q"},tradeIn:{valueType:"tradeIn",isPaymentFilter:!0},cashDown:{valueType:"integer",isPaymentFilter:!0}},throwIfNotInitialized(e){const t=e.state;if("created"===t||"initializing"===t)throw new Error("phoenix4: vehicle search manager has not been initialized");if("error"===t)throw new Error("phoenix4: vehicle search manager failed to initialize")},dispatchEvent(e,t){let n,i;"string"==typeof t?(i=t,n={type:t}):(n=t,i=n.type);for(const t of e.__VehicleSearchManager2.eventListeners)if(t.eventName===i)try{t.handler(n)}catch(e){console.error(e)}},getMakeModelTrimsParentValues(e,t){const n=e.__VehicleSearchManager2.metadata,i=[];for(const e of n.makeModelTrims){if(e.id===t)return i;for(const n of e.models){if(n.id===t)return i.push(e.id),i;for(const r of n.trims)if(r.id===t)return i.push(e.id),i.push(n.id),i}}return i},getMakeModelTrimsSubValues(e,t){const n=e.__VehicleSearchManager2.metadata,i=[];let r=!1,s=!1;for(const e of n.makeModelTrims){e.id===t&&(r=!0);for(const n of e.models){r&&i.push(n.id),n.id===t&&(s=!0);for(const e of n.trims)(r||s)&&i.push(e.id);if(s)break}if(r)break}return i},normalizeEngineTypeCriteriaValues(e,t){const n=e.__VehicleSearchManager2.metadata.fuelTypes2,i=[];for(const e of n)if(t.includes(e.id))i.push(e.id);else{const n=e.engineTypes.map((e=>e.id));if(n.length>0&&n.every((e=>t.includes(e))))i.push(e.id);else for(const e of n)t.includes(e)&&i.push(e)}return i.sort().filter((function(e,t,n){return t==n.indexOf(e)}))},startSearch(e){o.throwIfNotInitialized(e),o.setSearchState(e,"searching");const n=e.__VehicleSearchManager2,i=n.criteria;n.searchTimeoutID&&(clearTimeout(n.searchTimeoutID),n.searchTimeoutID=null),n.searchCancelTokenSource&&n.searchCancelTokenSource.cancel(),n.searchTimeoutID=setTimeout((()=>{n.searchCancelTokenSource=new t.CancellationTokenSource,new Promise((async(e,t)=>{n.searchCancelTokenSource.token.register((()=>{try{n.searchCancelTokenSource.token.throwIfCancellationRequested()}catch(e){t(e)}}));try{e(await n.provider.searchAsync({financeType:n.defaultFinanceType,...i},{cancelToken:n.searchCancelTokenSource.token}))}catch(e){t(e)}})).then((t=>{n.searchResult=t,o.setSearchState(e,"success")})).catch((i=>{i instanceof t.CancelledError||(console.error(i),n.searchResult=[],o.setSearchState(e,"error"))}))}),100),n.shouldUpdatePageUrl&&o.bestEffortUpdatePageUrlIfAppropriate(e)},onCriteriaChanged(e){const t=e.__VehicleSearchManager2;if(t.criteriaSnapshot=null,t.shouldQueueCriteriaChangedEvent){let n=t.criteriaChangedTimeoutID;n||(n=t.criteriaChangedTimeoutID=setTimeout((function(){t.criteriaChangedTimeoutID=null,o.dispatchEvent(e,"criteriachanged"),o.startSearch(e)}),0))}else o.dispatchEvent(e,"criteriachanged"),o.startSearch(e)},validateCriteriaValue(e,t,n){const i=e.__VehicleSearchManager2.metadata;let r=!1;if("makeModelTrims"===t)r=o.isMakeModelTrimExisting(i.makeModelTrims,n);else if("engineTypes2"===t){const e=i.fuelTypes2;r=o.isEngineTypeValueExisting(e,n)}else{const e=Object.prototype.hasOwnProperty.call(i,t)?i[t]:null;if(!e)throw new Error("phoenix4: invalid category ID: "+JSON.stringify(t));r=e.some((function(e){return e.id===n}))}if(!r)throw new Error("phoenix4: the provided category value is invalid: "+n)},isEngineTypeValueExisting(e,t){for(const n of e){if(n.id===t)return!0;for(const e of n.engineTypes)if(e.id===t)return!0}return!1},isMakeModelTrimExisting(e,t){for(const n of e){if(n.id===t)return!0;for(const e of n.models){if(e.id===t)return!0;for(const n of e.trims)if(n.id===t)return!0}}return!1},areArraysEqual(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0},bestEffortUpdatePageUrlIfAppropriate(e){if(window.history&&window.history.replaceState&&phoenix4.isSearchResultsPage())try{const t=s.tryGetQueryParameters({criteria:e.criteria});let n=location.protocol+"//"+location.host+location.pathname;t.length>0&&(n+="?",n+=t),n=phoenix4.addUrlTrackingParametersFromCurrentUrl(n),window.history.replaceState(null,"",n)}catch(e){console.warn(e)}},updateCriteriaFromPageUrl(e){const t=e.getCriteriaFromSearchString(window.location.search);for(const n in t)e.setCriteriaValue(n,t[n])},bestEffortSetAppliedTradeInFromStorage(e){try{const t=phoenix4.tryGetAppliedTradeInFromLocalStorage();t&&e.setCriteriaValue("tradeIn",t)}catch(e){console.log(e)}},bestEffortSetAppliedCashDownFromStorage(e){try{const t=phoenix4.tryGetAppliedCashDownFromLocalStorage();t&&e.setCriteriaValue("cashDown",t)}catch(e){console.log(e)}},setVdpCashDownAmount(e){const t=null==e?"":e.toString();localStorage.setItem("birchwoodNext.session.vdp.cashDownAmount",t)},setState(e,t){const n=e.__VehicleSearchManager2;if(!["created","initializing","error","ready","searching"].includes(t))throw new Error("phoenix4: invalid state "+JSON.stringify(t));n.state=t,o.dispatchEvent(e,"statechanged")},setSearchState(e,t){const n=e.__VehicleSearchManager2;if(!["searching","success","error"].includes(t))throw new Error("phoenix4: invalid search state "+JSON.stringify(t));n.searchState=t,o.dispatchEvent(e,"searchstatechanged")}}}(jQuery)},8076:(e,t,n)=>{"use strict";const i=window.kintsugi,{LoanCalculator:r,LeaseCalculator:s,calculateLuxuryTax:o}=n(62);class a{static getDefaultImplementation(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return l.getInstance(e)}async loadMetadataAsync(){throw new Error("phoenix4: not implemented")}async searchAsync(e,t){throw new Error("phoenix4: not implemented")}}phoenix4.VehicleSearchProvider=a;class l extends a{static getInstance(e){let t=c.instance;return t||(t=c.instance=new l(e),t.startInitializing()),t}constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super(),this.__FileVehicleSearchProvider={state:"created",waitForInitializationPromise:null,waitForInitializationResolve:null,waitForInitializationReject:null,initializationError:null,vehicles:null,metadata:null,vehicleFinanceCalculator:new u,suggestionEngineForSearchByQuery:null,highlightedMakeIDs:e.highlightedMakeIDs||[]}}get isInitialized(){const e=this.__FileVehicleSearchProvider.state;return"created"!==e&&"initializing"!==e&&"error"!==e}startInitializing(){const e=this.__FileVehicleSearchProvider;let t=null,n=null;if("created"!==e.state)return;const r=()=>{t?(e.initializationError=t,c.setState(this,"error"),e.waitForInitializationReject&&e.waitForInitializationReject(t)):(c.setState(this,"ready"),e.waitForInitializationResolve&&e.waitForInitializationResolve()),e.waitForInitializationResolve=e.waitForInitializationReject=null};try{c.setState(this,"initializing");const s=phoenix4.tryGetInventoryListID();if(!s)throw new Error("phoenix4: inventory list ID is empty");const o=phoenix4.getBirchwoodNextInventoryOriginUrl();new i.Executor({concurrency:1}).queueAsync({action:()=>i.getAsync({url:o+"/api/phoenix-4/inventory/"+encodeURIComponent(s)+"/search/search-file.js"}),shouldRetry:(e,t)=>e instanceof i.HttpRequestError&&[502,503].includes(e.code)&&t<10}).then((t=>{n=t,({vehicles:e.vehicles,metadata:e.metadata}=c.normalizeInventorySearchData(this,n))})).catch((e=>{t=e})).finally((()=>{r()}))}catch(e){t=e,r()}}waitForInitializationAsync(){const e=this.__FileVehicleSearchProvider;let t=e.waitForInitializationPromise;return t||(t="created"===e.state||"initializing"===e.state?new Promise((function(t,n){e.waitForInitializationResolve=t,e.waitForInitializationReject=n})):"error"===e.state?Promise.reject(e.initializationError):Promise.resolve(),e.waitForInitializationPromise=t),t}async searchAsync(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.isInitialized||await this.waitForInitializationAsync(),"cancelToken"in t)try{t.cancelToken.throwIfCancellationRequested()}catch(e){return Promise.reject(e)}const n=this.__FileVehicleSearchProvider,r="query"in e,s="similarTo"in e,o="conditions"in e,a="discountTypes"in e,l="stockStatuses"in e,u="bodyTypes"in e,d="engineTypes2"in e,h="colours"in e,m="yearMin"in e,p="yearMax"in e,f="kmMin"in e,g="kmMax"in e,y="rangeMin"in e,_="rangeMax"in e,v="features"in e,w="makeModelTrims"in e,b="priceMin"in e,x="priceMax"in e,I="paymentMin"in e,C="paymentMax"in e,k="limit"in e,S=!!e.includeTaxes,A=!!e.excludeTradeInFromPrice,T="paymentMaxTerm"in e?e.paymentMaxTerm:null,D="financeType"in e?e.financeType:"finance";let P=n.vehicles;const M=[];if(r){if(null===n.suggestionEngineForSearchByQuery){await phoenix4.waitForScript("phoenix4-base-suggestionengine");const e=new phoenix4.SuggestionEngine({items:n.vehicles,fields:["stockNumber","searchString"],maxSuggestions:n.vehicles.length,postProcess:c.postProcessSuggestedItemsForSearchByQuery});await e.initializeAsync(),n.suggestionEngineForSearchByQuery=e}P=await n.suggestionEngineForSearchByQuery.suggestAsync({query:e.query})}const E=[{id:"year",score:11},{id:"makeID",score:18},{id:"modelID",score:30},{id:"bodyTypeID",score:4},{id:"colourID",score:5}];let F=null;s&&(F=P.find((t=>t.stockNumber===e.similarTo)),F||(P=[]));const V=w?c.parseMakeModelTrimsCriteria(e.makeModelTrims):null;if(P.forEach((t=>{if(s){if(t.stockNumber===F.stockNumber)return!1;let e=0;if(E.forEach((n=>{"array"===n.type?t[n.id].forEach((t=>{F[n.id].includes(t)&&(e+=n.score)})):F[n.id]===t[n.id]&&(e+=n.score)})),t.score=e,e<18)return}if(o&&!e.conditions.some((e=>"certified-pre-owned"===e?t.isCertifiedPreOwned:t.conditionID===e)))return!1;if(a&&!e.discountTypes.some((e=>{switch(e){case"demo":return t.isDemo;case"clearance":return t.isClearance;default:return!1}})))return!1;if(l&&!e.stockStatuses.includes(t.stockStatusID))return!1;if(u&&!e.bodyTypes.some((e=>{switch(e){case"convertible":return t.isConvertible;case"commercial":return t.isCommercial;default:return t.bodyTypeID===e}})))return!1;if(d){const i=n.metadata.fuelTypes2.map((e=>e.id));if(!e.engineTypes2.some((e=>i.includes(e)?t.fuelTypeID===e:t.engineTypeID2===e)))return!1}if(h&&!e.colours.includes(t.colourID))return!1;if(m&&t.year<e.yearMin)return!1;if(p&&t.year>e.yearMax)return!1;if(f&&t.kilometers<e.kmMin)return!1;if(g&&t.kilometers>e.kmMax)return!1;if(y&&t.range<e.rangeMin)return!1;if(_&&t.range>e.rangeMax)return!1;if(v&&!e.features.every((e=>t.featureIDs.includes(e))))return!1;if(w&&!c.doesVehicleMakeModelTrimMatchesCriteria(t,V))return!1;const i="cashDown"in e?e.cashDown:0,r="tradeIn"in e?e.tradeIn:null,k=t.basePrice,P=t.potentialFees,N=t.manufacturerCashIncentives,R=t.dealerDiscounts,O=[],L=[],z=P.filter((e=>{switch(D){case"finance":return e.appliesToFinance;case"lease":return e.appliesToLease;case"cash":return e.appliesToCash;default:throw new Error("bnext: Unknown financeType: "+JSON.stringify(D))}}));for(const e of z)e.appliesToCash&&("cash"===D||"finance"===D&&e.appliesToFinance||"lease"===D&&e.appliesToLease)?O.push(e):L.push(e);const B=O.reduce(((e,t)=>e+parseFloat(t.amount)),0),U=parseInt(k)+B;let H=0;N.forEach((e=>{H+=parseInt(e.amount)})),R.forEach((e=>{H+=parseInt(e.amount)})),t.cashSavings=H;const q=n.vehicleFinanceCalculator.calculatePurchasePrice({nominalPrice:U,cashIncentives:N,dealerDiscounts:R,financeType:"cash",includeTaxes:!1,tradeIn:A?null:r,cashDown:0,vehicle:t});if(t.purchasePrice=q,"cash"===D){if(b&&q<e.priceMin)return!1;if(x&&q>e.priceMax)return!1}else{if("finance"!==D&&"lease"!==D)throw new Error("phoenix4: unrecognized finance type: "+JSON.stringify(D));{if("lease"===D&&"new"!==t.conditionID)return;const s=n.vehicleFinanceCalculator.calculatePotentialPayments({vehicle:t,nominalPrice:U,dealerDiscounts:R,financeType:D,includeTaxes:S,cashDown:i,tradeIn:r,fees:L,paymentMaxTerm:T,minPaymentAmount:I?e.paymentMin:null});if(T&&!s.length)return!1;if((I||C)&&!s.some((t=>I&&C?t.amount>=e.paymentMin&&t.amount<=e.paymentMax:I?t.amount>=e.paymentMin:t.amount<=e.paymentMax)))return!1;t.payments=s}}M.push(t)})),s&&M.sort(((e,t)=>t.score-e.score)),"sort"in e){const t=(t,n)=>"cash"===e.financeType?i.compareFloats(t.purchasePrice,n.purchasePrice):t.payments.length&&n.payments.length?0===i.compareFloats(t.payments[0].amount,n.payments[0].amount)?i.compareFloats(t.payments[0].totalFinancedAmount,n.payments[0].totalFinancedAmount):i.compareFloats(t.payments[0].amount,n.payments[0].amount):t.payments.length?-1:n.payments.length?1:0;M.sort(((n,r)=>{switch(e.sort){case"newest":return r.year-n.year;case"oldest":return n.year-r.year;case"price":return i.compareFloats(n.purchasePrice,r.purchasePrice);case"payment":return t(n,r);case"new-arrivals":return null===n.stockInAt&&null===r.stockInAt?0:null===n.stockInAt?1:null===r.stockInAt?-1:n.stockInAt<r.stockInAt?1:n.stockInAt>r.stockInAt?-1:0;default:return console.warn("phoenix4: unrecognized sort order "+JSON.stringify(e.sort)),0}}))}let N=M;return k&&(N=N.slice(0,e.limit)),N=N.map((e=>({stockNumber:e.stockNumber,vin:e.vin,vdpUrl:c.getVehicleDetailsPageUrl({year:e.year,stockNumber:e.stockNumber,modelID:e.modelID,trimID:e.trimID,includeTaxes:S,financeType:D}),year:e.year,makeName:e.make,modelName:e.model,trimName:e.trim,marketingTrimName:e.marketingTrim,conditionID:e.conditionID,isClearance:e.isClearance,isDemo:e.isDemo,isCertifiedPreOwned:e.isCertifiedPreOwned,purchasePrice:e.purchasePrice,cashSavings:e.cashSavings,kilometers:e.kilometers,frontPhotoUrl:e.frontPhotoUrl,payments:e.payments}))),Promise.resolve(N)}async loadMetadataAsync(){return this.isInitialized||await this.waitForInitializationAsync(),Promise.resolve(this.__FileVehicleSearchProvider.metadata)}}const c=l.__FileVehicleSearchProvider={instance:null,normalizeInventorySearchData(e,t){const n=e.__FileVehicleSearchProvider,i=t.vehicles,r=t.dealers;if(!i||!Array.isArray(i))throw new Error("phoenix4: vehicles array is missing in the server response");const s=t.metadata;if(!s)throw new Error("phoenix4: metadata is missing in the server response");const o=c.combineMetadata(s);let a=i.map((e=>{const t=r.find((t=>e.dealerCode===t.dealerCode));return{...e,gstHstRate:parseFloat(t.gstHstRate),pstRate:parseFloat(t.pstRate),dealerCode:t.dealerCode,searchString:[e.make,e.model,e.trim,e.engineType,e.transmissionType,e.fuelType,e.driveType,e.exteriorColour,e.bodyType,e.marketingTrim].join()}}));return n.highlightedMakeIDs.length>0&&(a=a.sort(((e,t)=>{const i=n.highlightedMakeIDs.indexOf(e.makeID),r=n.highlightedMakeIDs.indexOf(t.makeID);return-1===i?1:-1===r?-1:i-r}))),{vehicles:a,metadata:o}},doesVehicleMakeModelTrimMatchesCriteria(e,t){const n=t.makes,i=t.models,r=t.trims;return null!==n&&n.has(e.makeID)||null!==i&&i.has(e.modelID)||null!==r&&r.has(e.trimID)},parseMakeModelTrimsCriteria(e){const t=new Set,n=new Set,i=new Set;e.forEach((e=>{switch(e.split("-").length){case 1:t.add(e);break;case 2:n.add(e);break;case 3:i.add(e);break;default:throw new Error("phoenix4: invalid makeModelTrims criteria identifier format: "+e)}}));const r=(e,t)=>{for(const n of e){const e=n.split("-");if(e.length>t.length&&e.slice(0,t.length).join("-")===t.join("-"))return!0}return!1},s=[];for(const e of t)r(n,[e])&&s.push(e);s.forEach((e=>t.delete(e)));const o=[];for(const e of n){const t=e.split("-");r(i,t)&&o.push(e)}return o.forEach((e=>n.delete(e))),{makes:t.size>0?t:null,models:n.size>0?n:null,trims:i.size>0?i:null}},getVehicleDetailsPageUrl(e){let t="/vehicles/"+encodeURIComponent(e.year)+"/"+encodeURIComponent((e.trimID||e.modelID).toLowerCase())+"/"+encodeURIComponent(e.stockNumber.toUpperCase())+"/",n=[];return e.includeTaxes&&n.push("include_taxes=true"),"lease"===e.financeType?n.push("finance_type=lease"):"finance"===e.financeType&&n.push("finance_type=finance"),n.length&&(t=t+"?"+n.join("&")),t},combineMetadata(e){const t=e.discountTypes.map((e=>"clearance"===e.id?{id:"clearance",name:phoenix4.getServerData("base.page").clearanceLabel}:e));return{makeModelTrims:e.makeModelTrims,conditions:e.conditions,stockStatuses:e.stockStatuses,discountTypes:t,bodyTypes:e.bodyTypes,fuelTypes:e.fuelTypes,fuelTypes2:e.fuelTypes2,engineTypes:e.engineTypes,colours:e.colours,years:e.years,kmMin:e.kilometersMin,kmMax:e.kilometersMax,rangeMin:e.rangeMin,rangeMax:e.rangeMax,features:e.features.filter((e=>e.searchable)),sort:[{id:"newest",name:"Newest - Oldest"},{id:"oldest",name:"Oldest - Newest"},{id:"price",name:"Lowest Vehicle Price"},{id:"payment",name:"Lowest Monthly Payment"},{id:"new-arrivals",name:"New Arrivals"}],priceMin:0,priceMax:2e5,financeTermsInMonths:[12,24,36,48,60,72,84,96],leaseTermsInMonths:[12,24,36,48,60,72,84,96]}},postProcessSuggestedItemsForSearchByQuery(e){let t=0;return e.items.forEach(((n,i)=>{const r=e.raw.results[i];0===r.matchIndex&&r.score>t&&(t=r.score)})),e.items.filter(((n,i)=>{const r=e.raw.results[i];switch(r.matchIndex){case 0:return r.score===t&&r.score>6;case 1:return r.score>5;default:return!1}}))},setState(e,t){const n=e.__FileVehicleSearchProvider;if(!["created","initializing","error","ready"].includes(t))throw new Error("phoenix4: invalid state "+JSON.stringify(t));n.state=t},throwIfNotInitialized(e){const t=e.state;if("created"===t||"initializing"===t)throw new Error("phoenix4: inventory search data provider has not been initialized");if("error"===t)throw new Error("phoenix4: inventory search data provider failed to initialize")}};phoenix4.FileVehicleSearchProvider=l;class u{constructor(){this.__VehicleFinanceCalculator={cachedFinancialCalculations:{}}}calculatePurchasePrice(e){const t=e.vehicle,n=e.nominalPrice,i=e.dealerDiscounts,r=e.cashIncentives,s=e.financeType,a="includeTaxes"in e&&e.includeTaxes,l="tradeIn"in e?e.tradeIn:null,c="cashDown"in e?e.cashDown:0,u=t.gstHstRate,d=t.pstRate,h=100*n;let m=h;if(i.forEach((e=>{m-=100*parseInt(e.amount)})),"cash"===s&&(m=r.reduce(((e,t)=>e-100*parseInt(t.amount)),m)),null!==l&&("tradein"===l.type?m-=100*l.value:m-=100*(l.value-l.owing)),a){let e=m;!1===t.luxuryTaxExempt&&(e+=100*o({purchasePrice:h/100,calculatedAt:(new Date).toISOString()})),(null===l||e>l.value-l.owing)&&(m=e+(e*u+e*d))}return c>0&&"cash"!==s&&(m-=100*c),null!==l&&"tradein"===l.type&&(m+=100*l.owing),m/100}calculatePotentialPayments(e){const t=this.__VehicleFinanceCalculator,n=e.vehicle,i=e.nominalPrice,a=e.dealerDiscounts,l=e.fees,c=e.financeType,u="finance"===c?n.financeTerms:n.leaseTerms,d="includeTaxes"in e&&e.includeTaxes,h="cashDown"in e?e.cashDown:0,m="tradeIn"in e?e.tradeIn:null,p="paymentMaxTerm"in e?e.paymentMaxTerm:null,f="minPaymentAmount"in e?e.minPaymentAmount:null,g=n.gstHstRate,y=n.pstRate,_=100*h,v=n.stockNumber+c+String(d)+String(h)+(m?String(m.value)+String(m.owing)+String(m.type):String(null))+String(p)+String(f);if(t.cachedFinancialCalculations[v])return t.cachedFinancialCalculations[v];const w=[];u.forEach((e=>{if(null!==p&&e.months>p)return;if("variable"===e.interestRateType)return;const t=Math.round(1e4*parseFloat(e.interestRate)),u="finance"===c?new r:new s;u.paymentFrequency("monthly").gstHstRate(0).pstRate(0).cashDown({value:_,divisor:"cents"}).removeAllItems().interestRate({value:t,divisor:1e4}).termInMonths(e.months),"lease"===c&&u.residualAmount({value:Math.round(100*parseFloat(e.residualAmount)),divisor:"cents"}),u.vehiclePrice({value:100*i,divisor:"cents"}),null!==m&&u.tradeInDetails({type:m.type,id:"trade-in",amount:{value:100*m.value,divisor:"cents"},owingAmount:{value:100*m.owing,divisor:"cents"}}),e.manufacturerIncentives.forEach(((e,t)=>{u.rebateDetails({id:"incentive"+t,name:e.name,amount:{value:100*parseInt(e.amount),divisor:"cents"},gstHst:!1!==e.gstHst,pst:!1!==e.pst})})),l.forEach(((e,t)=>{e.dueOnDelivery||u.itemDetails({id:"fee-"+t,name:e.name,amount:{value:Math.round(100*parseFloat(e.amount)),divisor:"cents"},gstHst:e.gstHst,pst:e.pst})})),a.forEach(((e,t)=>{u.itemDetails({id:"discount-"+t,name:e.name,amount:{value:Math.round(-100*parseFloat(e.amount)),divisor:"cents"},gstHst:!0,pst:!0})}));let h=null;const v=u.tryCalculate();if(!v.ok)return!1;{let t=0;a.forEach((e=>{t+=parseInt(e.amount)})),e.manufacturerIncentives.forEach((e=>{t+=parseInt(e.amount)})),h={amount:v.paymentAmount,termInMonths:v.termInMonths,interestRate:v.interestRate,totalFinancedAmount:v.totalFinancedAmount,savings:t}}if(d){if(u.gstHstRate(g).pstRate(y),!1===n.luxuryTaxExempt){const e=a.reduce(((e,t)=>e+parseFloat(t.amount)),0),t=l.reduce(((e,t)=>e+parseFloat(t.amount)),0),n=o({purchasePrice:i-e+t,calculatedAt:(new Date).toISOString()});u.item({id:"luxuryTax",name:"Luxury Tax",amount:n,gstHst:!0,pst:!0})}const e=u.tryCalculate();if(!v.ok)return!1;h.amount=e.paymentAmount}(null===f||h.amount>f)&&w.push(h)}));const b=w.sort(((e,t)=>e.amount-t.amount));return t.cachedFinancialCalculations[v]=b,b}}phoenix4.VehicleFinanceCalculator=u,e.exports={VehicleSearchProvider:a,FileVehicleSearchProvider:l}},4956:(e,t,n)=>{!function(e,t){"use strict";var i,r=window.phoenix4||{};window.phoenix4=r,r.mediaBreakpoints={tablet:1366,phone:812},r.getVersion=function(e,t){var n=s.versions[e||"phoenix4-base"];if(void 0!==n)return n;if(void 0===t)throw'phoenix4: version for "'+e+'" has not been registered';return t},r.getServerData=function(e,t){var n=s.serverData[e];if(void 0!==n)return n;if(void 0===t)throw'phoenix4: server data for "'+e+'" has not been registered';return t},r.isIE=function(){return s.isIE},r.isIosDevice=function(){return void 0===s.isIosDevice&&(s.isIosDevice=/\b(iPad|iPhone|iPod)\b/.test(navigator.userAgent)||"MacIntel"===navigator.platform&&navigator.maxTouchPoints>1),s.isIosDevice},r.isSafari=function(){return!!window.ApplePaySession},r.isPhone=function(){return void 0===s.isPhone&&(s.isPhone=screen.availWidth<=r.mediaBreakpoints.phone),s.isPhone},r.isWordPressPreview=function(){return void 0===s.isWordPressPreview&&(s.isWordPressPreview=-1!==location.search.indexOf("&preview_nonce=")),s.isWordPressPreview},r.isElementorPreview=function(){return void 0===s.isElementorPreview&&(s.isElementorPreview=/[?&]elementor-preview=/.test(location.search)),s.isElementorPreview},r.isIFrame=function(){if(void 0===s.isIFrame)try{s.isIFrame=window.self!==window.top}catch(e){s.isIFrame=!0}return s.isIFrame},r.isLocalOrStaging=function(){return void 0===s.isLocalOrStaging&&(s.isLocalOrStaging=/^(?:localhost|.*\.phoenix4-staging\.birchwood.ca)$/.test(location.hostname)),s.isLocalOrStaging},r.isMyVehiclesEnabled=function(){return void 0===s.isMyVehiclesEnabled&&(s.isMyVehiclesEnabled=!!r.getServerData("base.page",{}).isMyVehiclesEnabled,s.isMyVehiclesEnabled&&r.isIE()&&(console.warn('phoenix4: disabling "My Vehicles" feature on IE11'),s.isMyVehiclesEnabled=!1)),s.isMyVehiclesEnabled},r.shouldShowSavingsAmount=function(){return!!r.getServerData("base.page").shouldShowSavingsAmount},r.isSearchResultsPage=function(){return!!r.getServerData("base.page").isSearchResultsPage},r.getVehicleOfInterestForCTA=function(){const e=r.getServerData("base.page").basicPageVehicle;if(!e.success)throw new Error("phoenix4: basic page vehicle was not found");return{stockNumber:e.stock_number,vin:e.vin,year:e.year,make:e.make_name,model:e.model_name,trim:e.trim_name,conditionID:e.condition_id,price:e.price}},r.isVehicleDetailsPage=function(){return!!r.getServerData("base.page").isVehicleDetailsPage},r.vehicleSearchManagerVersion=function(){return r.getServerData("base.page").vehicleSearchManagerVersion},r.isSearchByPaymentEnabled=function(){return r.getServerData("base.page").isSearchByPaymentEnabled},r.highlightedMakeIDs=function(){return r.getServerData("base.page").highlightedMakeIDs},r.defaultVehicleSearchPageTitle=function(){return r.getServerData("base.page").defaultVehicleSearchPageTitle},r.tryGetInventoryListID=function(){const e=r.getServerData("base.page").inventoryListID;return""===e?null:e},r.getPhoenix4ServerExternalUrl=function(){return r.getServerData("base.page").phoenix4ServerExternalUrl},r.getBirchwoodNextInventoryOriginUrl=function(){return r.getServerData("base.birchwoodNext").inventoryOrigin},r.absoluteUrl=function(e){if(-1!==e.indexOf(":"))return e;if("/"==(e=e||"/")[0])return location.protocol+location.host+e;throw new Error("URL must either be absolute or start with /")},r.tryGetAppliedTradeInFromLocalStorage=function(){const e=localStorage.getItem("birchwoodNext.session.vdp.appliedTradeIn"),t=e?JSON.parse(e):null;return t&&""!==t.value?t:null},r.tryGetAppliedCashDownFromLocalStorage=function(){const e=localStorage.getItem("birchwoodNext.session.vdp.cashDownAmount"),t=e?parseInt(e):null;return t&&t>0?t:null},r.wordPressAjaxUrl=function(){return r.getServerData("base.wordPressAjaxUrl")},r.wordPressPluginsRoot=function(){return s.pluginsRoot},r.addUrlTrackingParametersFromCurrentUrl=function(e){if(window.location.search){var t=/^utm_|^confirm-appointment$|^(?:gclid|gclsrc|dclid|fbclid|mscklid|appointmentId|storeGroupId|customerId|sourceType)=/,n=window.location.search.substring(1).split("&").filter((function(e){return t.test(e)}));if(n.length>0)return e+(-1===e.indexOf("?")?"?":"&")+n.join("&")}return e},r.addGravityFormSubmitHandlers=function(t){s.isGravityFormsSubmitHandlerSetUp||(s.isGravityFormsSubmitHandlerSetUp=!0,e(document).on("submit",(function(t){const n=e(t.target),i=n.data("formid");n.parent().hasClass("gform_wrapper")&&-1===s.initializedGravityForms.indexOf(i)&&s.initializedGravityForms.push(i)})));const{form:n,onSuccess:i,onFailure:r,onComplete:o}=t;e(document).on("gform_post_render",((e,t,a)=>{let l=n;n instanceof jQuery?l=n.get():n.isArray||(l=[n]),l.forEach((e=>{const n=parseInt(e.dataset.formid);if(s.initializedGravityForms.indexOf(n)>-1&&n===t){const t=void 0===a,n={form:e,wasSuccessful:t};t?i&&i(n):r&&r(n),o&&o(n)}}))}))},r.timeoutAsync=function(e){return e>0?new Promise(((t,n)=>{setTimeout(t,e)})):Promise.resolve()},r.setCookie=function(e,t,n){var i=";path=/";if("https:"===location.protocol&&(i+=";secure"),null!=n&&"session"!==n){var r=/^(\d+)(s|m|h|d)$/.exec(n);if(!r)throw'phoenix4.setCookie: invalid value for expires: "'+n+'"';var s=parseInt(r[1]);switch(r[2]){case"m":s*=60;break;case"h":s*=3600;break;case"d":s*=86400}i+=";max-age="+s}var o=e+"="+encodeURIComponent(t)+i;document.cookie=o},r.getCookie=function(e,t){var n="(?:^|;\\s*)"+r.regexEscape(e)+"=([^;]*)",i=new RegExp(n).exec(document.cookie);if(!i)return t;try{return decodeURIComponent(i[1])}catch(n){return console.warn('phoenix4.getCookie: cookie for "'+e+'" was not properly encoded; ignored'),t}},r.deleteCookie=function(e){document.cookie=e+"=; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT"},r.getSessionID=function(){let e=s.sessionID;return e||(e=r.getCookie("phoenix4-session"),e&&/^[a-f0-9-]+$/.test(e)||(e=r.generateUuid(),r.setCookie("phoenix4-session",e,"session")),s.sessionID=e),e},r.generateUuid=function(e){const t=new Uint8Array(16);if(crypto.getRandomValues(t),t[8]=128|63&t[8],t[6]=64|15&t[6],e&&"string"!==e){if("binary"===e)return t;throw new Error("kintsugi: invalid format for generateUuid()")}{const e=[],n=(n,i)=>{for(let r=n;r<i;++r){const n=t[r].toString(16);1===n.length&&e.push("0"),e.push(n)}};return n(0,4),e.push("-"),n(4,6),e.push("-"),n(6,8),e.push("-"),n(8,10),e.push("-"),n(10,16),e.join("")}},r.setPageTitle=function(e){var t=document.title.match(/\s?(?:--|-|\u2013|\u2014|\|).*?$/);document.title=t?e.trim()+" "+t[0]:e.trim()},r.vehicleSearchMetadata=function(){return r.isElementorPreview()?{makes:[],year_min:2005,year_max:2020,price_min:1e4,price_max:1e5,body_types:[],colours:[],features:[],price_step:1e4,payment_min:100,payment_max:1e3,payment_step:100,km_min:1e4,km_max:1e5,km_step:1e4,engine_types:[],fuel_types:[],stock_statuses:[],sort_orders:[{id:"",text:"Default"}]}:r.getServerData("base.vehicleSearchMetadata")},r.asyncJobAjax=function(t){var n={status:0,statusText:"",responseText:null,abort:function(){}},i=null,s=function(e,i){t.error&&t.error(n,e,i),t.complete&&t.complete(n,e)},o=100,a=0,l=0,c=function(){e.ajax({url:r.wordPressAjaxUrl(),method:"GET",data:{action:"phoenix4_base_get_async_job_state",version:1,guid:i},dataType:"json",success:function(e,i,r){if(e.success&&e.job&&e.job.state)if("running"===e.job.state||"pending"===e.job.state){switch(++a,l=0,a){case 10:o=500;break;case 20:o=1e3;break;case 30:o=15e3;break;case 40:o=6e4}setTimeout(c,o)}else if("completed"===e.job.state){if(n.status=200,n.statusText="OK",t.success){if(n.responseText=e.job.result,""!==e.job.result)try{n.responseJSON=JSON.parse(e.job.result)}catch(e){return void s(n,"parseerror")}t.success&&t.success(n.responseJSON,"success",n),t.complete&&t.complete(n,"success")}}else n.status=200,n.statusText="OK",n.responseText=r.responseText,n.responseJson=r.responseJson,s(n,"error",e.job.state);else s(n,"parseerror")},error:function(e,t,i){++l<=5?setTimeout(c,Math.min(o,5e3)):(n.status=e.status,n.statusText=e.statusText,n.responseText=e.responseText,s(n,t))}})};return e.ajax({url:t.url,method:t.method,data:t.data,success:function(e,r,a){202===a.status?a.responseJSON&&a.responseJSON.success&&a.responseJSON.guid?(i=a.responseJSON.guid,setTimeout(c,o)):s("parsererror","Job GUID missing"):(n.status=a.status,n.statusText=a.statusText,n.responseText=a.responseText,n.responseJSON=a.responseJSON,t.success&&t.success(e,r,n),t.complete&&t.complete(n,r))},error:function(e,t,n){s(t,n)}}),n},r.quickFilterPresets=function(){return r.isElementorPreview()?[{id:"quick-filter-1",text:"Quick Filter 1",criteria:{body_types:["suv"]}},{id:"quick-filter-2",text:"Quick Filter 2",criteria:{features:["leather-interior"]}}]:r.getServerData("base.quickFilterPresets")},r.experienceFilterPresets=function(){return r.isElementorPreview()?[{id:"experience-filter-1",text:"Experience Filter 1",criteria:{body_types:["suv"]}},{id:"experience-filter-2",text:"Experience Filter 2",criteria:{features:["leather-interior"]}}]:r.getServerData("base.experienceFilterPresets")},r.raiseGtmPreConversionClickEvent=function(e){window.dataLayer&&(window.dataLayer.push((function(){var t=this.get("phoenix4");t.preConversionClick||(t.preConversionClick={clicks:[]}),t.preConversionClick.clicks.push(e),t.preConversionClick.justClicked=e})),window.dataLayer.push({event:"phoenix4.preConversionClick"}))},r.raiseGtmPreShareClickEvent=function(e){window.dataLayer&&(window.dataLayer.push((function(){var t=this.get("phoenix4");t.preShareClick||(t.preShareClick={}),t.preShareClick.justClicked=e})),window.dataLayer.push({event:"phoenix4.preShareClick"}))},r.waitForScript=function(e){"string"==typeof e&&(e=[e]);const t=[];for(const n of e){let e;if(s.asyncScripts&&(e=s.asyncScripts.promises[n],e||(e=m(n))),!e)try{throw'waitForScript: script "'+n+'" not registered for tracking'}catch(t){e=Promise.reject(t)}"string"==typeof e&&(e=new Promise((function(t,i){"load"===e?t():"error"===e?i():s.asyncScripts.executors[n]={resolve:t,reject:i}})),s.asyncScripts.promises[n]=e),t.push(e)}return Promise.all(t)},r.registerLazyScript=function(e){s.asyncScripts.lazy[e.handle]={url:e.url,style:e.style,version:e.version,requires:e.requires}},r.markScriptAsLoaded=function(e){s.asyncScripts.promises[e.handle]="load"},r.logPromise=function(e,t){return t.then((function(t){return console.log(e+": completed successfully"),t}),(function(t){return console.error(e+": failed"),null!=t&&""!==t&&console.error(t),t}))},r.htmlEncode=function(e){return e||""!==e&&null!=e?e.toString().replace(/[&<>'"\u0080-\uffff]/g,(function(e){return"&"===e?"&amp;":"<"===e?"&lt;":">"===e?"&gt;":"'"===e?"&#39;":'"'===e?"&quot;":"&#x"+e.charCodeAt(0).toString(16)+";"})):""},r.normalizeCssColour=function(e){if(/^#[a-fA-F0-9]+$/.test(e)){if(7===e.length)return e.toLowerCase();if(4===e.length)return"#"+(t=e.toLowerCase())[1]+t[1]+t[2]+t[2]+t[3]+t[3];if(9===e.length)return(s=parseInt(e.substring(7,9),16)/255)>=.9995?t=e.substring(0,7).toLowerCase():"rgba("+(n=parseInt(e.substring(1,3),16))+","+(i=parseInt(e.substring(3,5),16))+","+(r=parseInt(e.substring(5,7),16))+","+s.toPrecision(3)+")";if(5===e.length){var t;if((s=((s=parseInt(e[4],16))<<4|s)/255)>=.9995)return"#"+(t=e.toLowerCase())[1]+t[1]+t[2]+t[2]+t[3]+t[3];var n=parseInt(e[1],16);n|=n<<4;var i=parseInt(e[2],16);i|=i<<4;var r=parseInt(e[3],16);return"rgba("+n+","+i+","+(r|=r<<4)+","+s.toPrecision(3)+")"}}else{var s,o=e.match(/^rgba?\s*\((\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d+|\d*\.\d+)\s*)?\)$/);if(o)if(n=parseInt(o[1]),i=parseInt(o[2]),r=parseInt(o[3]),n<=255&&i<=255&&r<=255)return(s=o[4]?parseFloat(o[4]):1)>=.9995?"#"+n.toString(16).padStart(2,"0")+i.toString(16).padStart(2,"0")+r.toString(16).padStart(2,"0"):"rgba("+n+","+i+","+r+","+s.toPrecision(3)+")"}throw new Error('Invalid/unrecognized CSS colour: "'+e+'"')},r.regexEscape=function(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")},r.hash32=function(e){for(var t=0,n=0;n<e.length;++n)t=(t<<5>>>0)-t+e.charCodeAt(n);return t},r.isValidVin=function(e){if(null===e)throw"isValidVin: value is null";if("string"!=typeof e)throw"isValidVin: value must be a string";return 17===e.length&&r.isValidVinUsingCheckDigit(e)},r.isValidVinUsingCheckDigit=function(e){if(null===e)throw"isValidVinUsingCheckDigit: value is null";if("string"!=typeof e)throw"isValidVinUsingCheckDigit: value must be a string";if(17!==e.length)return!1;for(var t={A:1,B:2,C:3,D:4,E:5,F:6,G:7,H:8,J:1,K:2,L:3,M:4,N:5,P:7,R:9,S:2,T:3,U:4,V:5,W:6,X:7,Y:8,Z:9},n=[8,7,6,5,4,3,2,10,0,9,8,7,6,5,4,3,2],i=0,r=0;r<e.length;++r){var s,o=e[r];if(o>="0"&&o<="9")s=o.charCodeAt(0)-48;else if(!(s=t[o]))return!1;i+=s*n[r]}var a=i%11;return(10===a?"X":a.toString())===e[8]},r.formatNumber=function(e,t){if(t||(t={}),e||0===e){var n=e,i="";return"k"===t.units&&n>=1e3&&(n/=1e3,i="k"),n.toFixed(t.decimalPlaces||0).replace(/\B(?=(\d{3})+(?!\d))/g,",")+i}return t.nullValue||0===t.nullValue?t.nullValue.toString():""},r.formatCurrency=function(e,t){if(t||(t={}),e||0===e){var n=t.decimalPlaces||0===t.decimalPlaces?t.decimalPlaces:t.units?0:2;return"$"+r.formatNumber(e,{decimalPlaces:n,nullValue:t.nullValue,units:t.units})}return t.nullValue||0===t.nullValue?t.nullValue.toString():""},r.formatFancyDollarAmountHtml=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};var n="";const i=!("showCents"in t)||!!t.showCents;if(null==e){var s=t&&t.default?t.default:"N/A";n='<span class="phoenix4-formatfancydollar-novalue">'+r.htmlEncode(s)+"</span>"}else{var o=Math.round(100*Math.abs(e)),a=Math.floor(o/100),l=100*e>=0?1:-1,c=r.formatNumber(l*a),u=o-100*a;if(n='<span class="phoenix4-formatfancydollar-symbol">$</span><span class="phoenix4-formatfancydollar-dollars">'+r.htmlEncode(c)+"</span>",i){var d=r.formatNumber(u/100,{decimalPlaces:2}).substring(1);n+='<span class="phoenix4-formatfancydollar-cents">'+r.htmlEncode(d)+"</span>"}}return n},r.formatKilometers=function(e,t){return t||(t={}),e||0===e?r.formatNumber(e,{decimalPlaces:t.decimalPlaces||0,nullValue:t.nullValue,units:t.units})+" km":t.nullValue||0===t.nullValue?t.nullValue.toString():""},r.formatTelUrl=function(e,t){if(!e)return null;var n=e.replace(/[^0-9]+/g,"");if(!n)return null;var i="tel:";if(10===n.length)i+="+1-"+encodeURIComponent(n.substr(0,3)+"-"+n.substr(3,3)+"-"+n.substr(6,4));else if(11===n.length&&"1"===n[0])i+="+1-"+encodeURIComponent(n.substr(1,3)+"-"+n.substr(4,3)+"-"+n.substr(7,4));else{var r=e.trim();if(!r)return null;i+=encodeURIComponent(r)}if(t){var s=t.trim();s&&(i+=";"+encodeURIComponent(s))}return i},r.requestIdleCallback=function(e,t){if(t||(t={}),window.requestIdleCallback)return window.requestIdleCallback((function(){e()}),{timeout:t.timeout});var n=t.timeout||0===t.timeout?Math.min(100,t.timeout):100;return setTimeout(e,n)},r.cancelIdleCallback=function(e){window.cancelIdleCallback?window.cancelIdleCallback(e):clearTimeout(e)},r.requestAnimationFrame=function(e){return window.requestAnimationFrame?window.requestAnimationFrame((function(){e()})):setTimeout(e,0)},r.cancelAnimationFrame=function(e){window.cancelAnimationFrame?window.cancelAnimationFrame(e):clearTimeout(e)},r.isTextElided=function(t){var n=e(t);if(n.length>0){var i=n[0];return i.offsetWidth<i.scrollWidth}return!1},r.deepEquals=function(t,n){if(t===n)return!0;if(e.isPlainObject(t)){if(e.isPlainObject(n)){var i=Object.keys(t),s=Object.keys(n);if(i.length===s.length){i.sort(),s.sort();for(var o=0;o<i.length;++o)if(i[o]!==s[o]||!r.deepEquals(t[i[o]],n[i[o]]))return!1;return!0}return!1}return!1}if(e.isArray(t)){if(e.isArray(n)){if(t.length===n.length){for(o=0;o<t.length;++o)if(!r.deepEquals(t[o],n[o]))return!1;return!0}return!1}return!1}return!1},r.shuffle=function(e){for(var t=e.length-1;t>=1;--t){var n=Math.floor(Math.random()*(t+1)),i=e[n];e[n]=e[t],e[t]=i}return e},r.deepCopy=function(t){if(t){if(e.isArray(t))return t.map(r.deepCopy);if(e.isPlainObject(t)){var n={};for(var i in t)n[i]=r.deepCopy(t[i]);return n}var s=typeof t;if("string"===s||"boolean"===s||"number"===s)return t;throw"phoenix4.deepCopy: cannot deep copy objects or functions"}return t},r.scrollFocus=function(t,n){n||(n={});var i=e(t);if(i.length>0){var s=n.behaviour||n.behavior||"smooth";return r.scrollIntoViewIfNeeded(i,{behaviour:s}).then((function(){i.focus()}))}return Promise.resolve()},r.scrollTo=function(t,n){n||(n={});var i=e(t),r=n.behaviour||n.behavior||"smooth";if(i.stop("phoenix-scroll",!0,!1),"smooth"===r){for(var s=[],o=0;o<i.length;++o){var a=e(i[o]),l=a.scrollLeft(),c=a.scrollTop(),u=void 0===n.left?l:n.left,d=void 0===n.top?c:n.top;Math.abs(u-l)>10||Math.abs(d-c)>10?s.push(new Promise((function(t,i){a[0]===window?e({pageXOffset:window.pageXOffset,pageYOffset:window.pageYOffset}).animate({pageXOffset:void 0===n.left?window.pageXOffset:n.left,pageYOffset:void 0===n.top?window.pageYOffset:n.top},{step:function(e,t){"pageYOffset"===t.prop?a.scrollTop(t.now):a.scrollLeft(t.now)},complete:t}):a.animate({queue:"phoenix4-scroll",scrollLeft:void 0===n.left?a.scrollLeft():n.left,scrollTop:void 0===n.top?a.scrollTop():n.top},{complete:t}).dequeue("phoenix4-scroll")}))):d===c&&u===l||i.scrollTop(d).scrollLeft(u)}return 1===s.length?s[0]:s.length>0?Promise.all(s):Promise.resolve()}return void 0!==n.top&&i.scrollTop(n.top),void 0!==n.left&&i.scrollLeft(n.left),Promise.resolve()},r.scrollIntoViewIfNeeded=function(t,n){n||(n={});var i=[],s=e(t);if(s.length>0){var o=!1!==n.recursive,a=n.behaviour||n.behavior||"smooth";s.length>1&&(s=e(domElement),console.warn("phoenix4.scrollIntoViewIfNeeded: more than one element specified"));var l=s.offset().top,c=s.outerHeight(),u=s.scrollParent();for(u.is(document)&&(u=e(window));;){var d,h,m=u.scrollTop();u[0]===window?(d=m,h=u.height()):(d=u.offset().top,h=u.innerHeight());var p,f=l-d;if((p=f<0?m+f:f+c>h?c>=h?m+f:m+f+c-h:m)!==m&&(i.push(r.scrollTo(u,{top:p,behaviour:a})),l-=p-m),!o||u[0]===window)break;(u=u.scrollParent()).is(document)&&(u=e(window))}}return Promise.all(i)},r.enableScrollStop=function(t,n){s.scrollStop||(s.scrollStop={$currentlyScrolling:null},e(window).on("mouseup touchend",_));var i=e(t);return i.each((function(){var t=e(this),i=t.data("phoenix4-scroll-stop");i?i.handlers.push(n):(i={initialized:!0},t.data("phoenix4-scroll-stop",i),t.on("scroll",v))})),n&&i.on("phoenix4_scrollstop",n),i},r.enableMediaChanged=function(){if(!s.mediaChangedEvent){var t=function(){var e=window.innerWidth;e<=r.mediaBreakpoints.phone?s.mediaChangedEvent={current:"phone",lowerBound:-1,upperBound:r.mediaBreakpoints.phone}:e<=r.mediaBreakpoints.tablet?s.mediaChangedEvent={current:"tablet",lowerBound:r.mediaBreakpoints.phone,upperBound:r.mediaBreakpoints.tablet}:s.mediaChangedEvent={current:"desktop",lowerBound:r.mediaBreakpoints.tablet,upperBound:Number.POSITIVE_INFINITY}};t(),window.addEventListener("resize",(function(){var n=window.innerWidth;if(n<=s.mediaChangedEvent.lowerBound||n>s.mediaChangedEvent.upperBound){t();var i=jQuery.Event("phoenix4_mediachanged",{mediaBreakpoint:s.mediaChangedEvent.current});e(window).trigger(i)}}))}},r.stableSort=function(e,t){t?"function"==typeof t&&(t={compare:t}):t={};var n=t.compare||function(e,t){var n=""+e,i=""+t;return n<i?-1:n>i?1:0},i=e.map((function(e,n){return{index:n,item:e,key:t.key?t.key(e):e}}));if(i.sort((function(e,t){var i;return 0===(i=void 0===e.key?void 0===t.key?0:1:void 0===t.key?-1:e.index<t.index?n(e.key,t.key):-n(t.key,e.key))&&(i=e.index-t.index),i})),t.copy)return i.map((function(e){return e.item}));for(var r=0;r<i.length;++r)e[r]=i[r].item;return e},r.emToPx=function(t,n){var i=e(n||"body");return parseFloat(window.getComputedStyle(i[0])["font-size"])*t},r.preventBodyScroll=function(){s.preventBodyScroll||(s.preventBodyScroll={count:0}),s.preventBodyScroll.count+=1,1===s.preventBodyScroll.count&&(e("body").css("overflow","hidden"),e("html").css("overflow","hidden"),r.isIosDevice()&&(s.preventBodyScroll.originalScrollTop=window.pageYOffset,e("body").css("height",window.innerHeight+"px"),e('body > header, body > [data-elementor-type="header"]').css("margin-top","-"+s.preventBodyScroll.originalScrollTop+"px")))},r.allowBodyScroll=function(){s.preventBodyScroll&&0!==s.preventBodyScroll.count?(s.preventBodyScroll.count-=1,0===s.preventBodyScroll.count&&(e("body").css("overflow",""),e("html").css("overflow",""),void 0!==s.preventBodyScroll.originalScrollTop&&(e("body").css("height",""),e('body > header, body > [data-elementor-type="header"]').css("margin-top",""),e(window).scrollTop(s.preventBodyScroll.originalScrollTop)))):console.warn("phoenix4.allowBodyScroll: unbalanced call; needs to exactly match calls to preventBodyScroll()")},r.lightbox=function(t){const n=t.type||"lightbox",i=t.onClose||null,o=t.onMounted||null,a=t.contentHtml instanceof Promise,l=e('<div class="phoenix4-lightbox-content" tabindex="-1">').addClass(t.contentClass);if("modal"===n){const t=e('<div class="phoenix4-lightbox-close-icon-modal">').attr("aria-label","Close Overlay");l.append(t)}a?(l.addClass("loading"),t.contentHtml.then((function(e){l.removeClass("loading").addClass("loaded"),l.append(e),o&&o({root:l[0]})})).catch((function(){r.closeLightbox()}))):l.append(t.contentHtml);const c=e('<div class="phoenix4-lightbox-content-wrapper">');if(c.append(l),s.lightbox&&s.lightbox.stack.length){const e=s.lightbox.stack[s.lightbox.stack.length-1];s.lightbox.$container.append(c.hide()),s.lightbox.stack.push({$wrapper:c,type:n,onCloseCallback:i}),c.fadeIn(),e.$wrapper.fadeOut({complete:function(){if(t.replace){$currentWrapper.remove();var e=s.lightbox.stack.findIndex($currentWrapper);e>=0&&s.lightbox.stack.splice(e,1)}}}),s.lightbox.$container.removeClass("type-lightbox type-modal").addClass("type-"+n)}else{const t=e('<div class="phoenix4-lightbox">').addClass("type-"+n),o=e('<div class="phoenix4-lightbox-background">'),a=e('<div class="phoenix4-lightbox-close-icon">').attr("aria-label","Close Overlay");t.append(o),t.append(a),t.on("mousedown touchstart",".phoenix4-lightbox-content-wrapper, .phoenix4-lightbox-close-icon, .phoenix4-lightbox-close-icon-modal",f),t.on("keydown",g),s.lightbox={depth:1,$container:t,stack:[{$wrapper:c,type:n,onCloseCallback:i}]},t.hide().append(c).fadeIn(),r.preventBodyScroll(),e("body").append(t)}!a&&o&&o({root:l[0]});let u=l.find(":focusable").first();0===u.length&&(u=l),u.focus()},r.closeLightbox=function(e){if(s.lightbox&&s.lightbox.stack.length){e||(e={});var t=!!e.shouldCallOnCloseCallback,n=e.depth||1;if("all"===n||n>=s.lightbox.stack.length){s.lightbox.stack.forEach((e=>{e.onCloseCallback&&t&&e.onCloseCallback()}));var i=s.lightbox.$container;delete s.lightbox,i.fadeOut({complete:function(){i.remove(),r.allowBodyScroll()}})}else{for(var o=s.lightbox.stack.length-1-n,a=s.lightbox.stack[s.lightbox.stack.length-1],l=s.lightbox.stack[o],c=o+1;c<s.lightbox.stack.length-1;++c)s.lightbox.stack[c].$wrapper.remove();s.lightbox.stack.splice(o+1),a.$wrapper.fadeOut({complete:function(){a.onCloseCallback&&t&&a.onCloseCallback(),a.$wrapper.remove()}}),l.$wrapper.fadeIn(),s.lightbox.$container.removeClass("type-lightbox type-modal").addClass("type-"+l.type)}}},r.preloadApplyForFinancingAsync=function(){return"decision-pro"===r.getServerData("base.applyFinance",{}).method?window.dp360&&dp360.launch?Promise.resolve():r.waitForScript("phoenix4-base-external-decisionpro").then((function(){return new Promise((function(e,t){var n,i;n=setInterval((function(){window.dp360&&dp360.launch&&(clearInterval(n),clearTimeout(i),e())}),10),i=setTimeout((function(){clearInterval(n);try{throw new Error("phoenix4: timed out loading the DecisionPro script")}catch(e){t(e)}}),1e4)}))})):Promise.resolve()},r.startApplyForFinancingAsync=function(){return r.preloadApplyForFinancingAsync().then((function(){var e=r.getServerData("base.applyFinance",{}),t=r.getServerData("base.page",{}).basicPageVehicle||{};switch(e.method){case"decision-pro":return dp360.launch({year:t.year,make:t.make_name,model:t.model_name,trim:t.trim_name,price:t.price}),Promise.resolve();case"custom-url":return window.location=e.customUrl,new Promise((function(e){setTimeout(e,1e4)}));default:throw new Error("phoenix4: apply-for-financing method unrecognized or not set: "+JSON.stringify(e.method))}}))},r.loadBirchwoodNextAsync=function(){var e=s.loadBirchwoodNextPromise;return e||(e=(window.birchwoodNext?birchwoodNext.waitForInitializationAsync():r.waitForScript("phoenix4-base-external-birchwoodnext").then((function(){return birchwoodNext.waitForInitializationAsync()}))).then((()=>{for(var e of s.birchwoodNextLoadActions)try{e()}catch(e){console.error(e)}s.birchwoodNextLoadActions=null})),s.loadBirchwoodNextPromise=e),e},r.whenBirchwoodNextLoaded=function(e){var t=s.birchwoodNextLoadActions;null!=t?t.push(e):setTimeout((()=>e()),0)},r.launchImmersiveAsync=function(){return r.loadBirchwoodNextAsync().then((function(){return birchwoodNext.launchImmersiveAsync()}))},r.canLaunchImmersiveAsync=function(){return r.loadBirchwoodNextAsync().then((function(){return birchwoodNext.canLaunchImmersiveAsync()}))},r.TokenBucket=(i=function(e){if(e||(e={}),this.__max=e.max||0===e.max?e.max:100,!Number.isFinite(this.__max)||this.__max<1)throw"phoenix4.TokenBucket: invalid max token count: "+e.max;if(this.__timestampMilliseconds=this.__getNowMilliseconds(),this.__timestampCount=e.initial&&"full"!==e.initial||0===e.initial?Math.min(this.__max,e.initial):this.__max,!Number.isFinite(this.__timestampCount))throw"phoenix4.TokenBucket: invalid initial token count: "+e.initial;if(this.__waitQueue=[],this.__waitQueueTimeoutID=null,e.refill){var t=e.refill.match(/^(\d*(?:\.\d+)?|full)\/(\d*)(s|ms|min)$/);if(!t)throw"phoenix4.TokenBucket: invalid refill string: "+e.refill;var n="full"===t[1]?this.__max:parseFloat(t[1]);switch(""!==t[2]&&(n/=parseFloat(t[2])),t[3]){case"s":n/=1e3;break;case"min":n/=6e4}if(n<=0||!Number.isFinite(n))throw"phoenix4.TokenBucket: invalid refill string: "+e.refill;this.__refillPerMillisecond=n}else this.__refillPerMillisecond=this.__max/6e4},e.extend(i.prototype,{count:function(){var e=this.__getNowMilliseconds(),t=this.__calculateRawCount(e);return Math.floor(t)},max:function(){return this.__max},refillPerMillisecond:function(){return this.__refillPerMillisecond},tryAcquire:function(e){"number"==typeof e?e={count:e}:e||(e={});var t=(e.count||0===e.count)&&e.count;if(e.cancelToken&&e.cancelToken.isCancellationRequested())return!1;if((t=e.count||0===e.count?e.count:1)>0){var n=this.__getNowMilliseconds(),i=this.__calculateRawCount(n);if(i>=t)return this.__timestampCount=i-t,this.__timestampMilliseconds=n,!0;if(t<=this.__max)return!1;throw"phoenix4.TokenBucket: requested tokens exceeds maximum size of bucket"}if(0===t)return!0;throw"phoenix4.TokenBucket: invalid number of tokens requested: "+e.count},acquireAsync:function(e){"number"==typeof e?e={count:e}:e||(e={});var t=e.count||0===e.count?e.count:1;if(this.tryAcquire({count:t,cancelToken:e.cancelToken}))return Promise.resolve();var n=this;return new Promise((function(i,r){e.cancelToken&&(e.cancelToken.throwIfCancellationRequested(),e.cancelToken.register((function(){try{e.cancelToken.throwIfCancellationRequested()}catch(e){r(e)}}))),n.__waitQueue.push({acquireCount:t,resolve:i,reject:r,cancelToken:e.cancelToken}),1===n.__waitQueue.length&&n.__resetWaitQueueTimeout()}))},addTokens:function(e){if("number"==typeof e?e={count:e}:e||(e={}),0!==e.count){if(!e.count||e.count<0)throw"phoenix4.TokenBucket: invalid token count: "+e.count;var t=this.__getNowMilliseconds(),n=this.__calculateRawCount(t),i=Math.min(this.__max,n+e.count);this.__timestampCount=i,this.__timestampMilliseconds=t,this.__waitQueue.length>0&&setTimeout(this.__evaluateWaitQueue.bind(this),0)}},__calculateRawCount:function(e){var t=Math.max(0,e-this.__timestampMilliseconds),n=Math.max(0,t)*this.__refillPerMillisecond;return Math.min(this.__max,this.__timestampCount+n)},__getNowMilliseconds:function(){return window.performance?window.performance.now():Date.now()},__resetWaitQueueTimeout:function(){if(this.__waitQueueTimeoutID&&(clearTimeout(this.__waitQueueTimeoutID),this.__waitQueueTimeoutID=null),this.__waitQueue.length>0){var e=this.__getNowMilliseconds(),t=this.__calculateRawCount(e),n=this.__waitQueue[0].acquireCount-t,i=Math.max(0,Math.ceil(n/this.__refillPerMillisecond)),r=this;this.__waitQueueTimeoutID=setTimeout((function(){r.__waitQueueTimeoutID=null,r.__evaluateWaitQueue()}),i)}},__evaluateWaitQueue:function(){for(var e=0;e<this.__waitQueue.length;++e){var t=this.__waitQueue[e];if(!t.cancelToken||!t.cancelToken.isCancellationRequested()){if(!this.tryAcquire(t.acquireCount))break;try{t.resolve()}catch(e){console.error(e)}}}this.__waitQueue.splice(0,e),this.__resetWaitQueueTimeout()}}),i),e.widget("phoenix4.phoenix4TouchToMouse",{options:{capturePixels:16},_create:function(){this.__touchStartHandler=this.__handleTouchStart.bind(this),this.__touchMoveHandler=this.__handleTouchMove.bind(this),this.__touchEndHandler=this.__handleTouchEnd.bind(this),this.element[0].addEventListener("touchstart",this.__touchStartHandler)},_destroy:function(){this.__stopTrackingTouch(),this.element[0].removeEventListener("touchstart",this.__touchStartHandler)},__handleTouchStart:function(e){void 0===this.__touchIdentifier?e.defaultPrevented||1!==e.touches.length||(this.__touchIdentifier=e.touches[0].identifier,this.__trackingState="start",this.__startX=e.touches[0].clientX,this.__startY=e.touches[0].clientY,this.element[0].addEventListener("touchmove",this.__touchMoveHandler,{passive:!1}),this.element[0].addEventListener("touchend",this.__touchEndHandler,{passive:!1})):"start"===this.__trackingState&&this.__stopTrackingTouch()},__handleTouchMove:function(e){if(void 0!==this.__touchIdentifier&&e.cancelable&&!e.defaultPrevented){var t=this,n=Array.prototype.find.call(e.changedTouches,(function(e){return e.identifier===t.__touchIdentifier}));if(n)if("start"===this.__trackingState){var i=e.changedTouches[0].clientX-this.__startX,r=e.changedTouches[0].clientY-this.__startY;Math.sqrt(i*i+r*r)>=this.options.capturePixels&&(e.preventDefault(),this.__trackingState="mouse",this.__eventTarget=e.target,this.__simulateMouseEnterAndDown(n))}else"mouse"===this.__trackingState&&(e.preventDefault(),this.__simulateMouseMove(n))}},__handleTouchEnd:function(e){if(void 0!==this.__touchIdentifier&&e.cancelable){var t=this,n=Array.prototype.find.call(e.changedTouches,(function(e){return e.identifier===t.__touchIdentifier}));n&&("mouse"===this.__trackingState&&(e.preventDefault(),this.__simulateMouseUpAndLeave(n)),this.__stopTrackingTouch())}},__stopTrackingTouch:function(){delete this.__touchIdentifier,delete this.__trackingState,delete this.__eventTarget,this.element[0].removeEventListener("touchmove",this.__touchMoveHandler),this.element[0].removeEventListener("touchend",this.__touchEndHandler)},__simulateMouseEnterAndDown:function(e){var t=new MouseEvent("mouseover",{screenX:e.screenX,screenY:e.screenY,clientX:e.clientX,clientY:e.clientY,buttons:0,detail:1,bubbles:!0,cancelable:!0});this.__eventTarget.dispatchEvent(t);var n=new MouseEvent("mousemove",{screenX:e.screenX,screenY:e.screenY,clientX:e.clientX,clientY:e.clientY,buttons:0,detail:1,bubbles:!0,cancelable:!0});this.__eventTarget.dispatchEvent(n);var i=new MouseEvent("mousedown",{screenX:e.screenX,screenY:e.screenY,clientX:e.clientX,clientY:e.clientY,buttons:1,detail:1,bubbles:!0,cancelable:!0});this.__eventTarget.dispatchEvent(i)},__simulateMouseMove:function(e){var t=new MouseEvent("mousemove",{screenX:e.screenX,screenY:e.screenY,clientX:e.clientX,clientY:e.clientY,buttons:1,detail:1,bubbles:!0,cancelable:!0});this.__eventTarget.dispatchEvent(t)},__simulateMouseUpAndLeave:function(e){var t=new MouseEvent("mouseup",{screenX:e.screenX,screenY:e.screenY,clientX:e.clientX,clientY:e.clientY,buttons:0,detail:1,bubbles:!0,cancelable:!0});this.__eventTarget.dispatchEvent(t);var n=new MouseEvent("mouseout",{screenX:e.screenX,screenY:e.screenY,clientX:e.clientX,clientY:e.clientY,buttons:0,detail:1,bubbles:!0,cancelable:!0});this.__eventTarget.dispatchEvent(n)}}),e.widget("phoenix4.phoenix4Swipe",{options:{directions:"horizontal",capturePixels:16,gesturePixels:72,milliseconds:1e3,clickThrough:!0,screenEdgePixels:36},_create:function(){this.__touchStartHandler=this.__handleTouchStartEvent.bind(this),this.__touchMoveHandler=this.__handleTouchMoveEvent.bind(this),this.__touchEndHandler=this.__handleTouchEndEvent.bind(this),this.__touchCancelHandler=this.__handleTouchCancelEvent.bind(this),this.__touchIdentifier=null,this.element[0].addEventListener("touchstart",this.__touchStartHandler,{capture:!0,passive:!1})},_destroy:function(){this.element[0].removeEventListener("touchstart",this.__touchStartHandler),this.__stopTrackingTouch()},__handleTouchStartEvent:function(e){!e.defaultPrevented&&e.cancelable?null===this.__touchIdentifier?1===e.touches.length&&e.touches[0].clientX>=this.options.screenEdgePixels&&e.touches[0].clientX<window.innerWidth-this.options.screenEdgePixels&&(this.__originalTarget=e.target,this.__touchIdentifier=e.touches[0].identifier,this.__startX=e.touches[0].clientX,this.__startY=e.touches[0].clientY,this.__startMilliseconds=Date.now(),this.__swipeDetected=!1,this.__touchCaptured=!1,this.element[0].addEventListener("touchmove",this.__touchMoveHandler,{capture:!0,passive:!1}),this.element[0].addEventListener("touchend",this.__touchEndHandler,{capture:!0,passive:!1}),this.element[0].addEventListener("touchcancel",this.__touchCancelHandler,{capture:!0,passive:!1})):this.__stopTrackingTouch():null!==this.__touchIdentifier&&this.__stopTrackingTouch()},__handleTouchMoveEvent:function(e){if(!e.defaultPrevented){var t=this.__touchIdentifier;if(void 0!==t){var n=Array.prototype.find.call(e.changedTouches,(function(e){return e.identifier===t}));if(n){var i=n.clientX-this.__startX,r=n.clientY-this.__startY,s=Math.sqrt(i*i+r*r);if(!this.__touchCaptured&&s>=this.options.capturePixels&&(this.__touchCaptured=!0),this.__touchCaptured&&(e.preventDefault(),!this.__swipeDetected&&s>=this.options.gesturePixels&&(this.__swipeDetected=!0,Date.now()-this.__startMilliseconds<this.options.milliseconds))){var o=Math.atan2(-r,i);o<0&&(o+=2*Math.PI);var a,l,c=180*o/Math.PI;if("any"!==this.options.directions){a=c<30?0:c<60?1:c<120?2:c<150?3:c<210?4:c<240?5:c<300?6:c<330?7:0}else a=Math.min(Math.floor((c+22.5)/45),7);switch(this.options.directions){case"any":l=!0;break;case"vertical":l=2===a||6===a;break;case"horizontal":l=0===a||4===a;break;case"both":l=a%2==0}if(l){var u=["right","right-up","up","left-up","left","left-down","down","right-down"][a];this._trigger("detected",null,{direction:u,radians:o,degrees:Math.floor(c),exactDegrees:c,octant:a})}}}}}},__handleTouchEndEvent:function(e){var t=this.__touchIdentifier;if(void 0!==t){var n=Array.prototype.find.call(e.changedTouches,(function(e){return e.identifier===t}));if(n){e.preventDefault();var i=this.__startMilliseconds,r=this.__swipeDetected,s=this.__originalTarget;this.__stopTrackingTouch(),r||this._trigger("tap",null,{clientX:n.clientX,clientY:n.clientY,milliseconds:Date.now()-i})&&this.options.clickThrough&&s&&"function"==typeof s.click&&s.click()}}},__handleTouchCancelEvent:function(e){var t=this.__touchIdentifier;void 0!==t&&Array.prototype.find.call(e.changedTouches,(function(e){return e.identifier===t}))&&this.__stopTrackingTouch()},__stopTrackingTouch:function(){this.__touchIdentifier=null,this.__originalTarget=null,this.element[0].removeEventListener("touchmove",this.__touchMoveHandler),this.element[0].removeEventListener("touchend",this.__touchEndHandler),this.element[0].removeEventListener("touchcancel",this.__touchCancelHandler)}}),e.widget("phoenix4.phoenix4SuggestionBox",{defaultElement:'<div><div><input type="text" /></div><ul></ul></div>',options:{engine:[],getText:null,render:null,combobox:null,input:null,listbox:null,autoSelect:!1,minLength:3,preloadScript:!0,delayMilliseconds:100,maxSuggestions:null,noSuggestionHtml:null,submitFormOnClick:!1},initializeAsync:function(){if(this.__isInitialized)return Promise.resolve(this.element);if(this.__initializePromise)return this.__initializePromise;var e,t=this;if(this.options.input.off("focus mouseenter",this.__initialFocusOrMouseEnterHandler),"function"==typeof this.options.engine)if(this.options.preloadScript){var n=this.options.engine;this.options.engine=r.waitForScript("phoenix4-base-suggestionengine").then((function(){return n()}))}else this.options.engine=this.options.engine();return e=this.options.engine instanceof Promise?this.options.engine.then((function(e){return t.options.engine=e,e.initializeAsync()})):this.options.engine.initializeAsync(),this.__initializePromise=e.then((function(){return t.__isInitialized=!0,t.element})).finally((function(){delete t.__initializePromise})),this.__initializePromise},queueNewSuggestion:function(){if(!this.__suggestionTimeoutID&&!this.__requeueSuggestion)if(this.__suggestionPromise)this.__requeueSuggestion=!0;else{var e=this.__lastSuggestionAtMilliseconds||0,t=Date.now()-e,n=Math.max(1,this.options.delayMilliseconds-t),i=this;this.__suggestionTimeoutID=setTimeout((function(){delete this.__suggestionTimeoutID,i.__startSuggestion()}),n)}},selectActiveSuggestion:function(){if(this.options.listbox.is(".has-suggestions")){var e=this.options.listbox.find("> li.active");if(e.length>0){var t=e.data("suggestedItem");if(t){var n=this.options.getText(t);this.__selectedItem=t,this.__selectedItemText=n,this.options.input.val()!==n&&this.options.input.val(n).trigger("input")}return this.__cancelSuggestion(),this.__closeSuggestionList(),!0}}return!1},selectMatchingSuggestion:function(){var t=this.options.input.val();if(this.__selectedItem&&this.__selectedItemText===t)return!0;if(this.options.listbox.is(".has-suggestions"))for(var n=t.trim().toUpperCase(),i=this.options.listbox.find("> li"),r=0;r<i.length;++r){var s=e(i[r]).data("suggestedItem");if(s){var o=this.options.getText(s);if(o.trim().toUpperCase()===n)return this.__selectedItem=s,this.__selectedItemText=o,this.options.input.val()!==o&&this.options.input.val(o).trigger("input"),this.__cancelSuggestion(),this.__closeSuggestionList(),!0}}return!1},selectedItem:function(){return this.options.input.val(),this.__selectedItemText===this.options.input.val()?this.__selectedItem:null},activeItem:function(){if(this.options.listbox.is(".has-suggestions")){var e=this.options.listbox.find("> li.active");if(e.length>0)return e.data("suggestedItem")}return null},text:function(){return this.options.input.val()},setText:function(e){this.options.input.val()!==e&&(this.options.input.val(e),this.queueNewSuggestion())},clear:function(){this.element.find("input").val(""),this.__closeSuggestionList(),this.__cancelSuggestion()},closeSuggestionList:function(){this.__closeSuggestionList(),this.__cancelSuggestion()},_create:function(){var t=this;if(this.__selectedItem=null,this.__initialFocusOrMouseEnterHandler=this.__handleInitialFocusOrMouseEnter.bind(this),this.__inputKeyDownHandler=this.__handleInputKeyDown.bind(this),this.__inputInputHandler=this.__handleInputInput.bind(this),this.__inputBlurHandler=this.__handleInputBlur.bind(this),this.__listItemMouseDownHandler=this.__handleListItemMouseDown.bind(this),this.__listItemMouseMoveHandler=this.__handleListItemMouseMove.bind(this),this.__listMouseLeaveHandler=this.__handleListMouseLeave.bind(this),this.options.combobox=this.options.combobox?e(this.options.combobox):this.element.find("> div"),this.options.input=this.options.input?e(this.options.input):this.options.combobox.find("input"),this.options.listbox=this.options.listbox?e(this.options.listbox):this.options.combobox.next("ul"),this.options.listbox.uniqueId(),"function"!=typeof this.options.getText)if(this.options.getText){var n=this.options.getText.toString();this.options.getText=n||0===n?function(e){var t=e[n];return""!==(t=t||0===t?t.toString().trim():"")?t:"(empty)"}:function(e){var t=e||0===e?e.toString().trim():"";return""!==t?t:"(empty)"}}else this.options.getText=function(e){return e?e.toString():"(empty)"};this.options.render||(this.options.render=function(e){return r.htmlEncode(t.options.getText(e))}),this.element.addClass("phoenix4-suggestionbox"),this.options.combobox.attr("role","combobox").attr("aria-haspopup","listbox").attr("aria-owns",this.options.listbox.attr("id")).attr("aria-expanded","false"),this.options.input.attr("aria-autocomplete","list").attr("aria-controls",this.options.listbox.attr("id")).removeAttr("aria-activedescendant").attr("autocomplete","off").one("focus mouseenter",this.__initialFocusOrMouseEnterHandler).on("keydown",this.__inputKeyDownHandler).on("input",this.__inputInputHandler).on("blur",this.__inputBlurHandler),this.options.autoSelect&&this.options.input.attr("spellcheck","false"),this.options.listbox.addClass("phoenix4-suggestionbox-list").attr("role","listbox").on("mousedown","> li",this.__listItemMouseDownHandler).on("mousemove","> li",this.__listItemMouseMoveHandler).on("mouseleave",this.__listMouseLeaveHandler).empty()},_destroy:function(){this.__cancelSuggestion(),this.element.removeClass("phoenix4-suggestionbox expanded"),this.options.combobox.removeAttr("role").removeAttr("aria-haspopup").removeAttr("aria-owns").removeAttr("aria-expanded"),this.options.input.removeAttr("aria-autocomplete").removeAttr("aria-controls").removeAttr("aria-activedescendant").removeAttr("autocomplete").removeAttr("spellcheck").off("focus mouseenter",this.__initialFocusOrMouseEnterHandler).off("keydown",this.__inputKeyDownHandler).off("input",this.__inputInputHandler).off("input",this.__inputBlurHandler),this.options.listbox.removeClass("phoenix4-suggestionbox-list").removeAttr("role").empty().off("mousedown","> li",this.__listItemMouseDownHandler).off("mousenter","> li",this.__listItemMouseMoveHandler).off("mouseleave",this.__listMouseLeaveHandler)},__handleInitialFocusOrMouseEnter:function(e){this.initializeAsync()},__handleInputKeyDown:function(e){if(!e.isDefaultPrevented())if((38===e.which||40===e.which)&&this.options.listbox.is(".has-suggestions")||(35===e.which||36===e.which)&&!this.options.autoSelect&&this.options.listbox.find("li.active").length>0){e.preventDefault();var t,n=this.options.listbox.find("li.active");36===e.which||40===e.which&&0===n.length?t=this.options.listbox.find("> li:first-child"):35===e.which||38===e.which&&0===n.length?t=this.options.listbox.find("> li:last-child"):38===e.which?0===(t=n.prev()).length&&(t=this.options.listbox.find("> li:last-child")):0===(t=n.next()).length&&(t=this.options.listbox.find("> li:first-child")),t.length>0&&(this.__activateSuggestionListItem(t),this.__scrollActiveSuggestionIntoView())}else 13===e.which&&this.options.listbox.is(".has-suggestions")?this.selectActiveSuggestion()||this.selectMatchingSuggestion():27===e.which?(e.preventDefault(),""!==this.options.input.val()&&this.options.input.val("").trigger("input"),this.__closeSuggestionList()):37!==e.which&&39!==e.which||this.options.autoSelect||!this.options.listbox.is(".has-suggestions")||this.__activateSuggestionListItem(null)},__handleInputInput:function(e){this.queueNewSuggestion()},__handleInputBlur:function(e){this.options.autoSelect&&this.selectActiveSuggestion(),this.__closeSuggestionList(),this.__cancelSuggestion()},__handleListItemMouseDown:function(t){if(!t.isDefaultPrevented()){t.preventDefault();var n=e(t.currentTarget),i=n.closest("ul");i.is(".has-suggestions")&&(this.__activateSuggestionListItem(n),this.selectActiveSuggestion(),this.options.submitFormOnClick&&i.closest("form").submit())}},__handleListItemMouseMove:function(t){var n=e(t.currentTarget);n.is(".active")||n.closest("ul").is(".has-suggestions")&&this.__activateSuggestionListItem(n)},__handleListMouseLeave:function(e){this.options.autoSelect||this.__activateSuggestionListItem(null)},__cancelSuggestion:function(){this.__suggestionTimeoutID&&(clearTimeout(this.__suggestionTimeoutID),delete this.__suggestionTimeoutID),delete this.__requeueSuggestion,delete this.__suggestionPromise},__startSuggestion:function(){var e=this;this.__cancelSuggestion();var t,n=this.options.input.val().trim();n.length<this.options.minLength?this.__closeSuggestionList():(t=(t=this.__isInitialized?this.options.engine.suggestAsync({query:n}):this.initializeAsync().then((function(){if(!e.requeueSuggestion&&t===e.__suggestionPromise)return e.options.engine.suggestAsync({query:n})}))).then((function(n){e.requeueSuggestion||t!==e.__suggestionPromise||e.__showSuggestionResult(n)})).catch((function(n){e.requeueSuggestion||t!==e.__suggestionPromise||e.__handleSuggestionError(n)})).finally((function(){e.__lastSuggestionAtMilliseconds=Date.now(),e.requeueSuggestion||t!==e.__suggestionPromise||(delete e.__suggestionPromise,e.__requeueSuggestion&&(delete e.__requeueSuggestion,e.queueNewSuggestion()))})),e.__suggestionPromise=t)},__showSuggestionResult:function(t){for(var n=this.options.render,i=t.items,r=[],s=!1,o=this.options.input.val().trim(),a=o.toUpperCase(),l=0;l<i.length;++l){var c=i[l],u=n(c);if(null!==u){var d=e("<li>").data("suggestedItem",c).append(u).uniqueId();if(r.push(d),this.options.autoSelect||s||(s=this.options.getText(c).toUpperCase()===a),this.options.maxSuggestions&&r.length>=this.options.maxSuggestions)break}}if(!s&&!this.options.autoSelect&&r.length>0&&a&&(this.options.maxSuggestions&&r.length>=this.options.maxSuggestions&&r.splice(r.length-1,1),r.unshift(e('<li class="entered-text">').text(o).uniqueId())),0===r.length){this.element.removeClass("expanded"),this.options.combobox.attr("aria-expanded","false"),this.options.listbox.empty().removeClass("has-suggestions"),this.options.input.removeAttr("aria-activedescendant");var h="function"==typeof this.options.noSuggestionHtml?this.options.noSuggestionHtml(this.element):this.options.noSuggestionHtml;h?this.options.listbox.addClass("has-no-suggestion-content").append(e('<li class="no-suggestion-content">').html(h)):this.options.listbox.removeClass("has-no-suggestion-content")}else this.element.addClass("expanded"),this.options.combobox.attr("aria-expanded","true"),this.options.listbox.empty().append(r).addClass("has-suggestions").removeClass("has-no-suggestion-content"),this.options.autoSelect?this.__activateSuggestionListItem(r[0]):this.options.input.removeAttr("aria-activedescendant")},__handleSuggestionError:function(e){console.error(e),this.__closeSuggestionList()},__closeSuggestionList:function(){var e=this.options.listbox.is(".has-suggestions")&&this.options.listbox.find("> li.active").length>0;this.element.removeClass("expanded"),this.options.combobox.attr("aria-expanded","false"),this.options.listbox.empty().removeClass("has-suggestions").removeClass("has-no-suggestion-content"),this.options.input.removeAttr("aria-activedescendant"),e&&this.__triggerActiveItemChanged()},__activateSuggestionListItem:function(e){var t=this.options.listbox.find("> li.active");(e&&0!==e.length||0!==t.length)&&(e&&e.is(t)||(t.removeAttr("aria-selected").removeClass("active"),e&&0!==e.length?(e.attr("aria-selected","true").addClass("active"),this.options.input.attr("aria-activedescendant",e.attr("id"))):this.options.input.removeAttr("aria-activedescendant"),this.__triggerActiveItemChanged()))},__triggerActiveItemChanged:function(){this._trigger("activeitemchanged",null)},__scrollActiveSuggestionIntoView:function(){var e=this.options.listbox.find("> li.active");e.length>0&&r.scrollIntoViewIfNeeded(e)}}),e.widget("phoenix4.phoenix4PhotoHeader",{options:{fullSizeImageUrls:null,tileSizeImageUrls:null,altText:null,backgroundColours:null},_create:function(){this.__ensureFullSizeImageUrls(),this.__ensureTileSizeImageUrls(),this.__ensureAltText(),this.__ensureImageListsSameSize(),this.__ensureFourBackgroundColours(),this.__isCorrectStructure()||this.__rebuildStaticStructure(),this.__currentTileIndexForDesktop=1,this.__currentImageIndexForPhone=0,this.element.attr({role:"region",roledescription:"photo header"}),this.element.find("a[href]").attr("data-elementor-open-lightbox","no"),this.__keyDownHandler=this.__handleKeyDown.bind(this),this.element.find("a[href]").attr("tabindex","-1"),this.element.attr("tabindex","0"),this.element.on("keydown",this.__keyDownHandler),this.__moveImagesClickHandler=this.__handleMoveImagesClick.bind(this),this.__swipeDetectedHandler=this.__handleSwipeDetected.bind(this),this.__windowResizeHandler=this.__handleWindowResize.bind(this),this.__imageLinkClickHandler=this.__handleImageLinkAreaClick.bind(this),this.element.on("click",".move-images",this.__moveImagesClickHandler),this.element.phoenix4Swipe().on("phoenix4swipedetected",this.__swipeDetectedHandler),this.element.on("click","a[href]",this.__imageLinkClickHandler),e(window).on("resize",this.__windowResizeHandler),window.innerWidth<=r.mediaBreakpoints.phone?this.__switchToPhoneUI():this.__switchToDesktopUI()},_destroy:function(){this.element.removeAttr("role roledescription tabindex"),this.element.off("keydown",this.__keyDownHandler),this.element.off("click",".move-images",this.__moveImagesClickHandler),this.element.off("click",".tile-area",this.__tileAreaClickHandler),this.element.phoenix4Swipe("destroy"),e(window).off("resize",this.__windowResizeHandler),this.__rebuildStaticStructure()},__ensureFullSizeImageUrls:function(){if(!this.options.fullSizeImageUrls){var t=this.element.data("imagesFull");if(Array.isArray(t)&&(0===t.length||"string"==typeof t[0]))return void(this.options.fullSizeImageUrls=t);var n=this.element.find("a.main-image[href]").attr("href")||this.element.find(".main-image img[src]").attr("src"),i=this.element.find(".tile-container > .tile.has-image").map((function(){var t=e(this),n=t.attr("href");if(!n){var i=(t.find("span").css("background-image")||"").match(/^url\("?([^)]*?)\"\)/i);i&&(n=i[0])}return n})).toArray();this.options.fullSizeImageUrls=n?[n]:[],Array.prototype.push.apply(this.options.fullSizeImageUrls,i)}},__ensureTileSizeImageUrls:function(){if(!this.options.tileSizeImageUrls){var e=this.element.data("imagesTile");if(Array.isArray(e)&&(0===e.length||"string"==typeof e[0]))return void(this.options.tileSizeImageUrls=e);this.options.tileSizeImageUrls=this.options.fullSizeImageUrls}},__ensureAltText:function(){if(!this.options.altText){var e=this.element.data("imageAltText");if(e)return void(this.options.altText=Array.isArray(e)?e:e.toString());this.options.altText=this.element.find(".main-image.has-image img[alt]").attr("alt")||"Photo"}},__ensureFourBackgroundColours:function(){switch(Array.isArray(this.options.backgroundColours)?this.options.backgroundColours=this.options.backgroundColours.slice():this.options.backgroundColours?this.options.backgroundColours=[this.options.backgroundColours]:this.options.backgroundColours=[],0===this.options.backgroundColours.length&&(this.options.backgroundColours=this.element.find(".tile-area .tile").map((function(){return e(this).css("background-color")||void 0})).toArray()),this.options.backgroundColours.length){case 0:this.options.backgroundColours=["lightgray","darkgray","darkgray","lightgray"];break;case 1:this.options.backgroundColours.push(this.options.backgroundColours[0],this.options.backgroundColours[0],this.options.backgroundColours[0]);break;case 2:this.options.backgroundColours.push(this.options.backgroundColours[1],this.options.backgroundColours[0]);break;case 3:this.options.backgroundColours.push(this.options.backgroundColours[0]);break;default:this.options.backgroundColours.splice(4)}},__ensureImageListsSameSize:function(){if(this.options.tileSizeImageUrls.length<this.options.fullSizeImageUrls.length?Array.prototype.push.apply(this.options.tileSizeImageUrls,this.options.fullSizeImageUrls.slice(this.options.tileSizeImageUrls.length)):this.options.fullSizeImageUrls.length<this.options.tileSizeImageUrls.length&&Array.prototype.push.apply(this.options.fullSizeImageUrls,this.options.tileSizeImageUrls.slice(this.options.fullSizeImageUrls.length)),Array.isArray(this.options.altText))for(;this.options.altText.length<this.options.fullSizeImageUrls.length;)this.options.altText.push("Photo")},__isCorrectStructure:function(){return this.element.is(".phoenix4-photoheader")},__rebuildStaticStructure:function(){var t;0===this.options.tileSizeImageUrls.length?(t=e('<div class="main-image no-image">')).append(e('<span class="no-image-text>').text("Image coming soon")):(t=e('<a class="main-image has-image" target="_blank">').attr("href",this.options.fullSizeImageUrls[0])).append(e("<img>").attr("src",this.options.fullSizeImageUrls[0]).attr("alt",Array.isArray(this.options.altText)?this.options.altText[0]:this.options.altText));for(var n=e('<div class="tile-container">'),i=0;i<4;++i){var r;i+1<this.options.tileSizeImageUrls.length?(r=e('<a class="tile has-image" target="_blank">').attr({src:this.options.fullSizeImageUrls[i+1],style:"background-color: "+this.options.backgroundColours[i]})).append(e('<span class="image-wrapper">').append(e('<span role="img">').attr({"aria-label":Array.isArray(this.options.altText)?this.options.altText[i]:this.options.altText,style:'background-image: url("'+this.options.tileSizeImageUrls[i+1]+'")'}))):r=e('<span class="tile no-image">').attr({style:"background-color: "+this.options.backgroundColours[i]}),n.append(r)}var s=e('<div class="tile-area">');s.append(n),this.element.empty().addClass("phoenix4-photoheader").append([t,s])},__switchToDesktopUI:function(){if("desktop"!==this.__uiMode){if(this.element.removeClass("phone-mode phone-mode-has-image-overlay"),this.element.find(".phone-image-area").remove(),this.__currentImageIndexForPhone=0,this.options.tileSizeImageUrls.length>5){var t=this.element.find(".tile-area"),n=e('<div class="move-images move-images-left">').append(e('<span class="handle">')),i=e('<div class="move-images move-images-right">').append(e('<span class="handle">'));t.append([n,i])}this.__uiMode="desktop"}},__switchToPhoneUI:function(){if("phone"!==this.__uiMode){if(this.element.find(".tile-area").find(".move-images").remove(),this.element.addClass("phone-mode"),this.options.fullSizeImageUrls.length>1){this.element.addClass("phone-mode-has-image-overlay");var t=e('<div class="phone-image-area">'),n=e("<img>").attr({src:this.options.fullSizeImageUrls[this.__currentImageIndexForPhone],alt:Array.isArray(this.options.altText)?this.options.altText[this.__currentImageIndexForPhone]:this.options.altText});t.append(n);var i=e('<div class="move-images move-images-left">').append(e('<span class="handle">')),r=e('<div class="move-images move-images-right">').append(e('<span class="handle">'));t.append(i,r),this.element.append(t)}this.__uiMode="phone"}},__handleMoveImagesClick:function(t){t.isDefaultPrevented()||(t.preventDefault(),this.__moveImages(e(t.currentTarget).is(".move-images-left")?-1:1))},__handleKeyDown:function(e){if(!e.isDefaultPrevented()){if(e.ctrlKey||e.shiftKey||e.altKey||e.metaKey)return;switch(e.key){case"ArrowRight":e.preventDefault(),this.__moveImages(1);break;case"ArrowLeft":e.preventDefault(),this.__moveImages(-1);break;case" ":case"Enter":e.preventDefault(),this.__openCarouselAsync()}}},__handleSwipeDetected:function(e,t){e.isDefaultPrevented()||(e.preventDefault(),this.__moveImages("left"===t.direction?1:-1))},__handleWindowResize:function(e){window.innerWidth<=r.mediaBreakpoints.phone?this.__switchToPhoneUI():this.__switchToDesktopUI()},__handleImageLinkAreaClick:function(t){if(!t.isDefaultPrevented()){t.preventDefault();var n,i=e(t.target);n=i.is("a[href]")?i:i.closest("a[href]"),this.__openCarouselAsync(n)}},__moveImages:function(e){"desktop"===this.__uiMode?this.__moveImagesForDesktop(e):"phone"===this.__uiMode&&this.__moveImagesForPhone(e)},__moveImagesForDesktop:function(e){if(!this.__queuedMoveImagesDesktop){var t=this.options.tileSizeImageUrls.length-1,n=Math.ceil(t/4),i=this.__currentTileIndexForDesktop,r=(Math.floor((i-1)/4)+n+e)%n*4+1;if(i!==r){var s=this.__preloadTileContainerForDesktop(r);if(this.__isAnimatingImagesDesktop)this.__queuedMoveImagesDesktop={newIndex:r,promise:s,direction:e};else{var o=this,a=function(t){return new Promise((function(n,i){var r,s,a=o.element.find(".tile-area"),l=a.find(".tile-container");a.append(t),"desktop"!==o.__uiMode?(l.remove(),n()):(e<0?(r="-100%",s="100%"):(r="100%",s="-100%"),t.css("left",r).animate({left:"0%"},{complete:function(){l.remove(),n()}}),l.animate({left:s}))}))},l=function(){var t=o.__queuedMoveImagesDesktop;if(delete o.__queuedMoveImagesDesktop,t&&"desktop"===o.__uiMode)o.__currentTileIndexForDesktop=t.newIndex,e=t.direction,t.promise.then(a).finally(l);else if(o.__isAnimatingImagesDesktop=!1,"desktop"===o.__uiMode){var i=(Math.floor((o.__currentTileIndexForDesktop-1)/4)+n+e)%n*4+1;i!==o.__currentTileIndexForDesktop&&o.__preloadTileContainerForDesktop(i)}};this.__isAnimatingImagesDesktop=!0,this.__currentTileIndexForDesktop=r,s.then(a).finally(l)}}}},__moveImagesForPhone:function(e){if(!this.__queuedMoveImagesPhone){var t=this.__currentImageIndexForPhone,n=(t+this.options.fullSizeImageUrls.length+e)%this.options.fullSizeImageUrls.length;if(t!==n){var i=this.__preloadImageForPhone(n);if(this.__isAnimatingImagesPhone)this.__queuedMoveImagesPhone={newIndex:n,promise:i,direction:e};else{var r=this,s=function(t){return new Promise((function(n,i){if("phone"===r.__uiMode){var s,o,a=r.element.find(".phone-image-area"),l=a.find("> img");a.prepend(t),e<0?(s="-100%",o="100%"):(s="100%",o="-100%"),t.css("margin-left",s).animate({"margin-left":"0%"},{complete:function(){l.remove(),n()}}),l.animate({"margin-left":o})}else n()}))},o=function(){var t=r.__queuedMoveImagesPhone;if(delete r.__queuedMoveImagesPhone,t&&"phone"===r.__uiMode)r.__currentImageIndexForPhone=t.newIndex,e=t.direction,t.promise.then(s).finally(o);else if(r.__isAnimatingImagesPhone=!1,"phone"===r.__uiMode){var n=(r.__currentImageIndexForPhone+r.options.fullSizeImageUrls.length+e)%r.options.fullSizeImageUrls.length;r.__preloadImageForPhone(n)}};this.__isAnimatingImagesPhone=!0,this.__currentImageIndexForPhone=n,i.then(s).finally(o)}}}},__preloadTileContainerForDesktop:function(t){for(var n=[],i=e('<div class="tile-container">'),r=0;r<4;++r){var s,o=t+r;if(o<this.options.tileSizeImageUrls.length){var a=e("<img>").attr({src:this.options.tileSizeImageUrls[o],alt:Array.isArray(this.options.altText)?this.options.altText[o]:this.options.altText});n.push(new Promise((function(e,t){var n=function(i){a.off("load error",n),"load"===i.type?e():t()};a.one("load error",n)}))),(s=e('<a class="tile has-image" tabindex="-1">').attr({href:this.options.fullSizeImageUrls[o],style:"background-color: "+this.options.backgroundColours[r],"data-elementor-open-lightbox":"no"})).append(e('<span class="image-wrapper">').append(a))}else s=e('<span class="tile no-image">').attr({style:"background-color: "+this.options.backgroundColours[r]});i.append(s)}return 0===n.length?Promise.resolve(i):Promise.all(n).then((function(){return i}))},__preloadImageForPhone:function(t){var n=this;return new Promise((function(i,r){var s=e("<img>").attr({src:n.options.fullSizeImageUrls[t],altText:Array.isArray(n.options.altText)?n.options.altText[t]:n.options.altText}),o=function(e){"load"===e.type?i(s):r(),s.off("load error",o)};s.on("load error",o)}))},__openCarouselAsync:function(t){if(this.options.fullSizeImageUrls.length>0){for(var n=r.waitForScript("phoenix4-base-carousel"),i=t?t.attr("href"):null,s=[],o=-1,a="Photo",l=0;l<this.options.fullSizeImageUrls.length;++l)-1===o&&i===this.options.fullSizeImageUrls[l]&&(o=l),s.push({type:"image",url:this.options.fullSizeImageUrls[l],altText:e.isArray(this.options.altText)?l<this.options.altText.length?this.options.altText[l]:a:this.options.altText||a});var c=e('<div class="content loading dark-mode">').html('<span class="message">Loading…</span>');return r.lightbox({contentHtml:c,contentClass:"phoenix4-photoheader-lightbox"}),n.then((function(){c.is(":visible")&&(c.removeClass("loading").addClass("loaded"),c.phoenix4Carousel({items:s,startIndex:Math.max(0,o),itemWidth:function(e){return"calc("+e.parent().innerWidth()+"px - 8em)"},itemHeight:function(e){return"calc("+e.parent().innerHeight()+"px - 4em)"},preload:!0}),c.focus())})).catch((function(e){console.error(e),c.removeClass("loading").addClass("error").html('<span class="message">Sorry, an error occurred while trying to load the images.</span>')}))}}}),e.widget("phoenix4.phoenix4ScrollableButtonGroup",{options:{toggles:[],buttonType:"button",radioName:null},_create:function(){this.__windowResizeHandler=this.__handleWindowResize.bind(this),e(window).on("resize",this.__windowResizeHandler);var t=e('<div class="move-left disabled">').append(e('<div class="move-handle">')),n=e('<div class="move-right disabled">').append(e('<div class="move-handle">'));this.__queueEnableDisableScrollControls();var i=e('<div class="button-area">'),r=e('<div class="button-panel">'),s=this.options.buttonType;"radio"!==s||this.options.radioName||(this.options.radioName=this.element.attr("id")||i.uniqueId().attr("id"));for(var o=0;o<this.options.buttons.length;++o){o>0&&r.append(" ");var a,l=this.options.buttons[o];switch(s){case"radio":case"checkbox":var c=e("<input>").attr({type:s}).prop("checked",!!this.options.checked);"radio"===s&&c.attr("name",this.options.radioName),l.buttonAttrs&&c.attr(l.buttonAttrs),r.append(c),(a=e('<label class="phoenix4-scrollablebuttongroup-button">').attr("for",c.uniqueId().attr("id"))).append(e('<span class="caption">').text(l.caption)),r.append(a);break;case"link":a=e('<a class="phoenix4-scrollablebuttongroup-button">').attr("href",l.href||"#"),l.buttonAttrs&&a.attr(l.buttonAttrs),a.append(e('<span class="caption">').text(l.caption)),r.append(a);break;default:a=e('<button class="phoenix4-scrollablebuttongroup-button">'),l.buttonAttrs&&a.attr(l.buttonAttrs),a.append(e('<span class="caption">').text(l.caption)),r.append(a)}a.data("buttonID",l.id).addClass(this.options.buttonClass).addClass(l.buttonClass)}i.append(r),this.element.empty().addClass("phoenix4-scrollablebuttongroup"),this.element.append([t,n,i]),this.__moveClickHandler=this.__handleMoveClick.bind(this),this.element.on("click",".move-left, .move-right",this.__moveClickHandler),r.on("scroll",this.__handleButtonPanelScroll.bind(this)),r.on("focus",".phoenix4-scrollablebuttongroup-button",this.__handleButtonFocus.bind(this)),"radio"!==s&&"checkbox"!==s?r.on("click",".phoenix4-scrollablebuttongroup-button",this.__handleButtonClick.bind(this)):r.on("click","input[type=checkbox], input[type=radio]",this.__handleButtonClick.bind(this))},_destroy:function(){e(window).off("resize",this.__windowResizeHandler),this.element.empty().removeClass("phoenix4-scrollablebuttongroup has-title"),this.element.off("click",".move-left, .move-right",this.__moveClickHandler)},setChecked:function(e,t){if("radio"!==this.options.buttonType&&"checkbox"!==this.options.buttonType)console.warn("phoenix4.scrollableButtonGroup: attempted to set checked status of a button, but not using radio/checkbox buttons");else{var n=this.__findButton(e);n.length>0&&n.prev().prop("checked",!!t)}},__findButton:function(t){var n=this.element.find(".phoenix4-scrollablebuttongroup-button").filter((function(){return e(this).data("buttonID")===t}));return 0===n.length&&console.warn("phoenix4.scrollableButtonGroup: could not find button id: "+t),n},__handleMoveClick:function(t){t.isDefaultPrevented()||(t.preventDefault(),this.__changePage(e(t.currentTarget).is(".move-left")?-1:1))},__changePage:function(t){var n,i,s=this.element.find(".button-panel"),o=s.width(),a=s[0].scrollLeft,l=s[0].scrollWidth-o,c=s.find(".phoenix4-scrollablebuttongroup-button");if(t>0){for(var u=0;u<c.length;++u)if((d=e(c[u])).position().left+d.outerWidth()>=o){n=d;break}i=n?n.position().left+a:l}else{for(u=c.length-1;u>=0;--u){var d;if((d=e(c[u])).position().left<0){n=d;break}}i=n?Math.max(0,n.position().left+a+n.outerWidth(!0)-o):0}r.scrollTo(s,{left:i,behavior:"smooth"}),s.parent().scrollLeft(0)},__handleButtonPanelScroll:function(e){this.__queueEnableDisableScrollControls()},__queueEnableDisableScrollControls:function(){this.__enableDisableScrollControlsTimeoutID&&clearTimeout(this.__enableDisableScrollControlsTimeoutID);var e=this;this.__enableDisableScrollControlsTimeoutID=setTimeout((function(){delete e.__enableDisableScrollControlsTimeoutID,e.__enableDisableScrollControls()}),10)},__enableDisableScrollControls:function(){var e=this.element.find(".button-panel"),t=this.element.find(".move-left"),n=this.element.find(".move-right");e[0].scrollWidth<=e[0].clientWidth?(t.addClass("disabled"),n.addClass("disabled"),e.scrollLeft(0)):(e[0].scrollLeft<=0?t.addClass("disabled"):t.removeClass("disabled"),e[0].scrollLeft+e[0].clientWidth+1>e[0].scrollWidth?n.addClass("disabled"):n.removeClass("disabled"))},__handleButtonFocus:function(t){var n,i=this.element.find(".button-panel"),r=e(t.currentTarget),s=r.position();s.left<0?n=s.left+i[0].scrollLeft:s.left+r.outerWidth(!0)>=i.width()&&(n=Math.max(0,s.left+i[0].scrollLeft+r.outerWidth(!0)-i.width())),void 0!==n&&i.scrollLeft(n),i.parent().scrollLeft(0)},__handleWindowResize:function(e){this.__queueEnableDisableScrollControls()},__handleButtonClick:function(t){var n=e(t.currentTarget),i=("radio"===this.options.buttonType||"checkbox"===this.options.buttonType?n.next():n).data("buttonID"),r=this.options.buttons.find((function(e){return e.id===i}));if(r){var s={id:r.id,$widget:e(this)};"radio"!==this.options.buttonType&&"checkbox"!==this.options.buttonType||(s.checked=n.prop("checked")),r.click&&r.click(t,s),this.options.click&&this.options.click(t,s)}}}),r.createVehicleCardInterstitial=function(t){var n=e('<div class="phoenix4-vehiclecard-interstitial">').addClass("interstitial-"+t.id),i=e("<a>").attr({class:"card",href:t.url,"data-interstitial-id":t.id}),s=e('<div class="content">');return s.append(e('<span class="title">').text(t.title)),t.description&&(s.append(" "),s.append(e('<span class="description">').text(t.description))),s.append(" "),s.append(e('<span class="learn-more">').text(t.buttonCaption||"Learn More")),i.append(s),n.append(i),t.detailsPopupHtml&&(n.append(" "),n.append(e('<button class="details-popup-link">').text("Details").on("click",(function(e){e.isDefaultPrevented()||(e.preventDefault(),r.showPromotionDetailsPopup({title:t.detailsPopupTitle||t.title,contentHtml:t.detailsPopupHtml}))})))),n},r.showPromotionDetailsPopup=function(t){var n=e("<div>"),i=e("<h2>").text(t.title+" Details"),s=e('<div class="content">').append(t.contentHtml);n.append(i),n.append(s),r.lightbox({contentHtml:n,contentClass:"phoenix4-promotion-details-popup",type:"modal"})},e.widget("phoenix4.phoenix4VehicleCard2",{options:{altText:"Photo of vehicle"},_create:function(){this.__setUpFavouriteIconAsync().catch(console.error),this.__firstInteractionHandler=this.__handleFirstInteraction.bind(this),this.element.find("> a").one("mouseenter focus touchstart",this.__firstInteractionHandler),r.isMyVehiclesEnabled()&&r.requestIdleCallback((function(){const t=e("<img>").attr("src",r.wordPressPluginsRoot()+"/phoenix4-base/images/heart-filled.svg").css({position:"absolute",top:0,left:0,height:"1px",width:"1px",opacity:0,"z-index":"-1000"});e("body").append(t)}))},_destroy:function(){this.__firstInteractionHandler&&this.element.find("> a").off("mouseenter focus touchstart",this.__firstInteractionHandler),this.__keyDownHandler&&this.element.off("keydown",this.__keyDownHandler)},__setUpFavouriteIconAsync:function(){if(!r.isMyVehiclesEnabled())return Promise.resolve();const t=this;return r.waitForScript("phoenix4-base-recentlyvieweddatasource").then((function(){const n=r.VehicleRecentlyViewedDataSource.instance();return n.getItemsAsync().then((function(i){const r=e('<span class="favourite-icon">');r.insertAfter(t.element.find(".make-model-trim-container")),r.on("click",t.__handleFavouriteIconClick.bind(t)),t.__updateFavouriteIconStatus(i),t.__recentlyViewedListenerID=n.addChangeListener((function(e){t.__updateFavouriteIconStatus(e)}))}))}))},__updateFavouriteIconStatus:function(t){const n=this.element.data("stockNumber"),i=!!t.favourites.find((function(e){return e.item.stockNumber===n}));this.element.is(".is-favourite")!==i&&(i?(this.element.addClass("is-favourite").removeClass("was-favourite"),this.element.find(".favourite-icon").append(e('<span class="favourite-text phoenix4-accessibility-text"> (Favourite)</span>'))):(this.element.addClass("was-favourite").removeClass("is-favourite"),this.element.find(".favourite-text").remove()))},__toggleFavouriteAsync:function(){const e=this;return r.waitForScript("phoenix4-base-recentlyvieweddatasource").then((function(){const t=r.VehicleRecentlyViewedDataSource.instance(),n=e.element.is(".is-favourite"),i=e.element.find(".favourite-icon"),s=e.element.data("stockNumber");if(i.removeClass("phoenix4-base-oneheartbeat-animation"),n)return t.unmarkKeyAsFavouriteAsync(s).then((function(){window.dataLayer&&(window.dataLayer.push((function(){const e=this.get("phoenix4"),t={stockNumber:s};e.favouriteChanged||(e.favouriteChanged={}),e.favouriteChanged.justChanged=t,e.favouriteChanged.justRemoved=t,delete e.favouriteChanged.justAdded})),window.dataLayer.push({event:"phoenix4.favouriteChanged"}))}));{const n={stockNumber:e.element.data("stockNumber")};return setTimeout((function(){i.width(),i.addClass("phoenix4-base-oneheartbeat-animation")}),1),t.markAsFavouriteAsync(n).then((function(){window.dataLayer&&(window.dataLayer.push((function(){const e=this.get("phoenix4"),t={stockNumber:s};e.favouriteChanged||(e.favouriteChanged={}),e.favouriteChanged.justChanged=t,e.favouriteChanged.justAdded=t,delete e.favouriteChanged.justRemoved})),window.dataLayer.push({event:"phoenix4.favouriteChanged"}))}))}}))},__handleFirstInteraction:function(e){this.element.find("> a").off("mouseenter focus touchstart",this.__firstInteractionHandler),delete this.__firstInteractionHandler;const t=this.element.find(".year-make-model"),n=this.element.find(".trim"),i=t.text()+" "+n.text();t.attr("title",i),n.attr("title",i),this.__keyDownHandler=this.__handleKeyDown.bind(this),this.element.on("keydown",this.__keyDownHandler)},__handleKeyDown:function(e){e.isDefaultPrevented()||32===e.which&&r.isMyVehiclesEnabled()&&(e.preventDefault(),this.__toggleFavouriteAsync())},__handleFavouriteIconClick:function(e){e.isDefaultPrevented()||(e.preventDefault(),this.__toggleFavouriteAsync())}}),r.createRawVehicleCard2=function(n){const i=n.vehicle,s=n.financeType,o=!!n.includeTaxes,a=!!n.isTradeInApplied,l=!!n.isCashDownApplied,c=!!n.excludeTradeInFromPrice,u=r.getServerData("base.page").vehicleCardClearanceBanner,d=!u;let h=null;"cash"!==s&&i.payments.length>0&&i.payments.forEach((e=>{(null===h||h>e.amount)&&(h=e)}));const m=e('<div class="phoenix4-vehiclecard2">').attr("data-stock-number",i.stockNumber);m.addClass(i.frontPhotoUrl?"has-image":"no-image");const p=e("<a>").attr("href",i.vdpUrl);m.append(p);const f=e('<button class="inquire-button">Request Information</button>');f.on("click",(e=>{e.isDefaultPrevented()||(e.preventDefault(),r.loadBirchwoodNextAsync().then((function(){return birchwoodNext.openModal({type:"genericCallToAction",vehicle:{stockNumber:i.stockNumber,vin:i.vin,year:i.year,make:i.makeName,model:i.modelName,trim:i.trimName,conditionID:i.conditionID,price:parseInt(i.purchasePrice)}})})).catch((e=>{console.error(e)})))})),m.append(f);const g=e('<span class="image-area">');if(i.isClearance&&d){const t=e('<span class="sash">').text("Clearance");g.append([t," "])}else if(i.isDemo){const t=e('<span class="sash">').text("Demo");g.append([t," "])}else if(i.isCertifiedPreOwned){const t=e('<span class="sash">').text("Certified");g.append([t," "])}if(i.isClearance&&u){const t=e("<img/>",{src:u.imageUrl,alt:u.altText,class:"price-break-banner"});g.append(t)}if(i.frontPhotoUrl){const t=e('<img class="static-image" loading="lazy" alt="Photo of vehicle">').attr("src",i.frontPhotoUrl);g.append(t)}else{const t=e('<span class="no-image-text">Image coming soon</span>');g.append(t)}p.append([" ",g]);const y=e('<div class="content-area">'),_=e('<div class="title-section">'),v=e('<span class="make-model-trim-container">'),w=e('<span class="year-make-model">').text(i.year+" "+i.makeName+" "+i.modelName.replace("-","‑")),b=e('<span class="trim">').text(i.trimName);v.append([w,b]),_.append(v);const x=r.formatFancyDollarAmountHtml(i.purchasePrice,{showCents:!1});let I=i.cashSavings;"cash"!==s&&null!==h&&(I=h.savings);const C=r.shouldShowSavingsAmount()&&I>0?r.formatCurrency(I,{decimalPlaces:0}):null,k=e('<div class="finance-info-section">'),S=e('<span class="price">').append([`<span>${x}</span>`]);k.append([S]);const A=e('<div class="finance-stipulations">'),T=[],D=t.sprintf("Cash price %sexcl. taxes.",a&&!c?"incl. trade-in, ":"");if(T.push(D),"cash"!==s){const n=e('<span class="monthly-payment">');if(n.append(e("<span>or</span>")),null!==h){const i="lease"===s?t.sprintf("Lease for %s for %u mo.",t.i18n.formatPercent(h.interestRate).replace(/\s/g,""),h.termInMonths):t.sprintf("Finance for %s for %u mo.",t.i18n.formatPercent(h.interestRate).replace(/\s/g,""),h.termInMonths),c=o?"incl. taxes":"excl. taxes";let u=t.sprintf("%s %s",i,c);const d=[];a&&d.push("incl. trade-in"),l&&d.push("incl. cash down");let m="";d.length>0?m=d.join(", ")+".":u+=".",T.push(u),""!==m&&T.push(m);const p=r.formatFancyDollarAmountHtml(h.amount,{showCents:!1});n.append([p,e("<span>/mo.</span>")])}else n.append(e('<span class="monthly-payment-unknown">').html("Payment<br>T.B.D.").attr("title","to be determined"));k.append(n)}T.forEach((t=>{const n=e("<span>").text(t);A.append(n)})),null!==C&&k.append([" ",e('<div class="savings">').text("Save "+C)]),y.append(_),k.append(A),y.append([k]);const P=e('<span class="content-bottom-row">'),M=e('<span class="details-section">');if(i.marketingTrimName){const t=e('<span class="marketing-trim">').text(i.marketingTrimName.trim());M.append(t)}if("new"===i.conditionID||"used"===i.conditionID){const t=e('<span class="condition">').text("new"===i.conditionID?"New":"Pre-Owned");M.append(t)}if(i.kilometers){const t=e('<span class="mileage">').text(r.formatKilometers(i.kilometers));M.append(t)}P.append(M),y.append(P),p.append([" ",y]);const E=e('<span class="learn-more">View Details</span>');return p.append(E),m},e.widget("phoenix4.phoenix4Video",{_create:function(){var e;const t=this.element.data("video-config"),n=t.indexOf(":");if(0==t.length||-1==n)throw new Error("phoenix4: cannot initialize video widget due to empty or invalid data-video-config attribute format");const i=t.substring(0,n),s=t.substring(n+1);switch(this.__videoProperties={videoSourceUrl:"",thumbnailUrl:""},i){case"bunnycdn":const t=["videoID","videoLibraryID","pullZoneID","thumbnailFileName"],n=this.__parseVideoConfigFromJsonEncodedString(s,t);this.__videoProperties.videoSourceUrl="https://iframe.mediadelivery.net/embed/"+encodeURIComponent(n.videoLibraryID)+"/"+encodeURIComponent(n.videoID),this.__videoProperties.thumbnailUrl="https://"+encodeURIComponent(n.pullZoneID)+".b-cdn.net/"+encodeURIComponent(n.videoID)+"/"+encodeURIComponent(n.thumbnailFileName),this.element.append(this.__generateThumbnailImageButton({sourceUrl:this.__videoProperties.thumbnailUrl,altText:n.altText?n.altText:"Video Thumbnail",cssClass:"phoenix4-video-thumbnail-button"}));break;case"youtube":const o=this.__parseVideoConfigFromJsonEncodedString(s,["videoUrl","iframeHeight","iframeWidth"]),a=null!==(e=o.videoId)&&void 0!==e?e:this.__tryExtractYouTubeVideoIdFromUrl(o.videoUrl),l=this.element.attr("id");this.element.addClass("youtube-video"),r.waitForScript("phoenix4-base-youtube-iframe-api").then((function(){const e=window.YT;e.ready((function(){new e.Player(l,{height:o.iframeHeight,width:o.iframeWidth,videoId:a,playerVars:{playsinline:1,rel:0}})}))})).catch((function(e){console.error(e)}));const c="https://img.youtube.com/vi/"+encodeURIComponent(a)+"/default.jpg";this.__videoProperties.videoSourceUrl=o.videoUrl,this.__videoProperties.thumbnailUrl=c;break;default:throw new Error("phoenix4: the provided scheme is not supported: "+JSON.stringify(i))}},_destroy:function(){this.element.empty()},thumbnailUrl:function(){return this.__videoProperties.thumbnailUrl},__handleVideoThumbnailClick:function(t){if(!t.isDefaultPrevented()){t.preventDefault();const n=e("<div/>",{class:"phoenix4-video-modal-video-container"}).append(this.__generateVideoIframeElement({url:this.__videoProperties.videoSourceUrl,cssClass:"phoenix4-video-modal-video",loadType:"lazy",allowFullScreen:!0}));r.lightbox({contentHtml:n,contentClass:"phoenix4-video-modal-content",type:"modal"})}},__generateVideoIframeElement:function(t){return e("<iframe/>",{class:t.cssClass,src:t.url,allow:"autoplay; accelerometer; encrypted-media; gyroscope; picture-in-picture;",loading:t.loadType,allowFullScreen:t.allowFullScreen})},__generateThumbnailImageButton:function(t){const n=e("<button/>",{"aria-label":"Play Video",class:t.cssClass}),i=e("<img/>",{src:t.sourceUrl,alt:t.altText,class:"phoenix4-video-thumbnail-image"});return n.on("click",this.__handleVideoThumbnailClick.bind(this)),n.append(i)},__parseVideoConfigFromJsonEncodedString:function(e,t){const n=JSON.parse(e);for(const i of t)if(!n.hasOwnProperty(i))throw new Error("phoenix4: the provided video configuration data is invalid: "+JSON.stringify(e));return n},__tryExtractYouTubeVideoIdFromUrl:function(e){if(!e)throw new Error("phoenix4: unable to extract YouTube video ID due to missing URL parameter");let t=null;try{const n=new URL(e);t=["www.youtube.com","youtu.be","www.youtube-nocookie.com"].includes(n.hostname)}catch(e){t=!1}if(!t)throw new Error("phoenix4: the provided YouTube video URL is invalid");const n=new RegExp(/^.*(?:youtu\.be\/|youtube(?:-nocookie)?\.com\/(?:v\/|.*u\/\w\/|embed\/|.*v=))(?<videoId>[^#\&\?]*).*/),i=e.match(n);let r=null;return i&&(r=i.groups.videoId),r}}),e.widget("phoenix4.phoenix4PlainDropDown",{options:{items:[],getText:null,getLabelText:null,value:null,placeholder:"Select One",align:"left"},_create:function(){this.options.getText=this.options.getText||function(e){return e.text},this.options.getLabelText=this.options.getLabelText||this.options.getText,this.__useNativeSelect=r.isPhone(),this.element.empty().addClass("phoenix4-plaindropdown");for(var t=e("<select>").uniqueId(),n=null,i=this.options.items,s=0;s<i.length;++s){var o=e("<option>").attr("value",i[s].id).text(this.options.getText(i[s]));n||i[s].id!==this.options.value||(n=i[s],o.attr("selected","selected")),t.append(o)}var a=e("<label>").attr("for",t.attr("id")).text(n?this.options.getLabelText(n):this.options.placeholder);this.element.append([t,a]),t.on("mousedown",this.__handleSelectMouseDown.bind(this)),t.on("keydown",this.__handleSelectKeyDown.bind(this)),t.on("input",this.__handleSelectInput.bind(this)),this.__useNativeSelect||t.attr({role:"button","aria-haspopup":"true"})},_destroy:function(){this.__closeDesktopPopupAsync(),this.element.empty().removeClass("phoenix4-plaindropdown").removeAttr("role").removeAttr("aria-haspopup")},value:function(){return this.options.value},setValue:function(e){var t=null!==e?this.findItemByID(e):null;this.__selectItemAsync(t)},findItemByID:function(e){var t=this.tryFindItemByID(e);if(!t)throw'Could not find dropdown item "'+e+'"';return t},tryFindItemByID:function(e){return this.options.items.find((function(t){return t.id===e}))||null},__openDesktopPopup:function(t){if(!this.__$popup&&this.options.items.length>0){t||(t={});for(var n,i=t.initialItemID||null,r=e('<ul tabindex="-1">').attr({role:"menu"}).uniqueId(),s=this.options.items,o=0;o<s.length;++o){var a=e("<li>").uniqueId().data("itemID",s[o].id).attr({role:"menuitem"}).text(this.options.getText(s[o]));r.append(a),s[o].id===i&&(n=a)}n||(n=r.find('li[role="menuitem"]:first-child')),n.addClass("active"),r.attr({"aria-activedescendant":a.attr("id")}),this.element.append(r),this.element.find("select").attr({"aria-expanded":"true","aria-controls":r.attr("id")});var l=e(window),c=this.element.find("label"),u=r.offset(),d=r.width(),h=r.height(),m=l.scrollLeft(),p=l.scrollTop(),f=l.width(),g=l.height(),y=c.offset(),_=c.width(),v="right"===this.options.align?y.left+_-d:u.left,w=u.top,b="down";if(v+d>m+f&&(v=m+f-d),v<0&&(v=0),u.top+h>p+g&&y.top-h>=p&&(b="up"),u.left!==v||u.top!==w){var x=r.position(),I=x.left+(v-u.left),C=x.top+(w-u.top),k="auto";"up"===b&&(k="calc(100% + 0.5em)",C="auto"),r.css({left:I,top:C,bottom:k})}r.hide().slideDown().focus(),r.on("blur",this.__handleDesktopPopupBlur.bind(this)),r.on("keydown",this.__handleDesktopPopupKeyDown.bind(this)),r.on("mousemove",this.__handleDesktopPopupMouseMove.bind(this)),r.find('li[role="menuitem"]').on("click",this.__handleDesktopPopupMenuItemClick.bind(this)),this.__$popup=r}},__closeDesktopPopupAsync:function(){var e=this.__$popup;if(e){delete this.__$popup;var t=this.element.find("select");t.removeAttr("aria-controls").removeAttr("aria-expanded");var n=new Promise((function(t,n){e.stop().slideUp({complete:function(){e.remove(),t()}})}));return e.is(":focus")&&t.focus(),n}return Promise.resolve()},__selectItemAsync:function(e){var t,n,i=this.element.find("label"),r=this.element.find("select");return e?(t=e.id,n=this.options.getLabelText(e)):(t=null,n=this.options.placeholder),r.val(t),this.options.value=t,this.__closeDesktopPopupAsync().then((function(){r.val()===t&&i.text(n)}))},__activateItemByIDAsync:function(e){var t=this.findItemByID(e),n=this.__selectItemAsync(t);return this._trigger("input"),n},__setDesktopPopupActiveItem:function(e){e.is(".active")||(e.closest("ul").find("li.active").removeClass("active"),e.addClass("active"),this.element.find("select").attr("aria-activedescendant",e.attr("id")),r.scrollIntoViewIfNeeded(e,{behaviour:"auto"}))},__handleSelectMouseDown:function(e){e.isDefaultPrevented()||this.__useNativeSelect||(e.preventDefault(),this.__$popup?this.__closeDesktopPopupAsync():this.__openDesktopPopup())},__handleSelectKeyDown:function(e){e.isDefaultPrevented()||this.__useNativeSelect||13!==e.which&&32!==e.which&&40!==e.which&&38!==e.which||(e.preventDefault(),this.__openDesktopPopup({initialItemID:this.options.items.length<=0?null:40===e.which?this.options.items[0].id:38===e.which?this.options.items[this.options.items.length-1].id:this.options.value}))},__handleSelectInput:function(t){if(!t.isDefaultPrevented()){t.preventDefault();var n=e(t.currentTarget).val();this.__activateItemByIDAsync(n)}},__handleDesktopPopupBlur:function(e){this.__closeDesktopPopupAsync()},__handleDesktopPopupKeyDown:function(e){if(!e.isDefaultPrevented())if(32===e.which||13===e.which)e.preventDefault(),(n=this.element.find('li[role="menuitem"].active')).length>0&&this.__activateItemByIDAsync(n.data("itemID"));else if(27===e.which)e.preventDefault(),this.__closeDesktopPopupAsync();else if(38===e.which||40===e.which){e.preventDefault();var t,n=this.element.find('li[role="menuitem"].active');38===e.which?0===(t=n.prev()).length&&(t=this.element.find('li[role="menuitem"]:last-child')):40===e.which&&0===(t=n.next()).length&&(t=this.element.find('li[role="menuitem"]:first-child')),t.length>0&&!t.is("active")&&this.__setDesktopPopupActiveItem(t)}},__handleDesktopPopupMouseMove:function(t){var n,i=e(t.target);i.is("li")?n=i:(n=i.closest("li"),this.element.find(n)||(n=e())),n.length>0&&!n.is(".active")&&this.__setDesktopPopupActiveItem(n)},__handleDesktopPopupMenuItemClick:function(t){if(!t.isDefaultPrevented()){t.preventDefault();var n=e(t.currentTarget).data("itemID");this.__activateItemByIDAsync(n)}}}),r.RandomNumberGenerator=function(){},e.extend(r.RandomNumberGenerator.prototype,{next:function(e,t){var n=t-e;if(n<=0)throw new Error("range cannot be empty");if(n<=4294967296){var i=4294967296-4294967296%n;do{r=this.next32()}while(r>=i)}else{var r;i=Number.MAX_SAFE_INTEGER+1-(Number.MAX_SAFE_INTEGER+1)%n;do{r=this.nextInt()}while(r>=i)}return e+r%n},nextFloat:function(){return this.nextInt()/Math.pow(2,53)},nextInt:function(){return 4294967296*(2097151&this.next32())+this.next32()},next32:function(){return this.nextInt()>>>0},getRandomValues:function(e){if(e.byteLength>65536)throw new(window.QuotaExceededError||Error)("cannot generate more than 65,536 bytes of random values at a time");if(e instanceof Uint32Array)for(var t=0;t<e.length;++t)e[t]=this.next32();else{if(!(e instanceof Int32Array||e instanceof Uint16Array||e instanceof Int16Array||e instanceof Uint8Array||e instanceof Int8Array))throw new TypeError("parameter must be an integer-based typed array (Int8Array, Uint8Array, etc.)");if(e.byteLength%4==0){var n=new Uint32Array(e.buffer,e.byteOffset,e.byteLength/4);for(t=0;t<n.length;++t)n[t]=this.next32()}else{var i=Math.floor(e.byteLength/4),r=e.byteLength-4*i;if(i)for(n=new Uint32Array(e.buffer,e.byteOffset,i),t=0;t<n.length;++t)n[t]=this.next32();var s=new Uint32Array(Math.ceil(r/4));for(t=0;t<s.length;++t)s[t]=this.next32();var o=new Uint8Array(s.buffer),a=new Uint8Array(e.buffer,e.byteOffset+4*i,r);for(t=0;t<r;++t)a[t]=o[t]}}return e}}),r.RandomNumberGenerator.instance=function(){var e=r.RandomNumberGenerator.__instance;return e||(e=r.WebCryptoRandomNumberGenerator.isSupported()?r.WebCryptoRandomNumberGenerator.instance():r.MathRandomNumberGenerator.instance(),r.RandomNumberGenerator.__instance=e),e},r.RandomNumberGenerator.create=function(e){if(e&&void 0!==e.seed&&null!==e.seed){if(Number.isSafeInteger(e.seed))return new r.Xorshift128RandomNumberGenerator({seed:e.seed});throw new Error("seed must be an integer")}return r.RandomNumberGenerator.instance()},r.MathRandomNumberGenerator=function(){r.RandomNumberGenerator.call(this)},r.MathRandomNumberGenerator.prototype.__proto__=r.RandomNumberGenerator.prototype,e.extend(r.MathRandomNumberGenerator.prototype,{next:function(e,t){var n=t-e;if(n<=0)throw new Error("range cannot be empty");return e+Math.floor(Math.random()*n)},nextFloat:function(){return Math.random()},next32:function(){return Math.floor(4294967296*Math.random())},nextInt:function(){return Math.floor(Math.random()*(Number.MAX_SAFE_INTEGER+1))}}),r.MathRandomNumberGenerator.instance=function(){return r.MathRandomNumberGenerator.__instance||(r.MathRandomNumberGenerator.__instance=new r.MathRandomNumberGenerator),r.MathRandomNumberGenerator.__instance},r.WebCryptoRandomNumberGenerator=function(e){if(r.RandomNumberGenerator.call(this),this.__crypto=(e?e.baseSource:null)||window.crypto||window.msCrypto,!this.__crypto)throw new Error("Web Crypto API not supported on this platform")},r.WebCryptoRandomNumberGenerator.prototype.__proto__=r.RandomNumberGenerator.prototype,e.extend(r.WebCryptoRandomNumberGenerator.prototype,{getBaseSource:function(){return this.__crypto},next32:function(){var e=new Uint32Array(1);return this.__crypto.getRandomValues(e),e[0]},nextInt:function(){var e=new Uint32Array(2);return this.__crypto.getRandomValues(e),4294967296*(2097151&e[0])+e[1]},getRandomValues:function(e){return this.__crypto.getRandomValues(e)}}),r.WebCryptoRandomNumberGenerator.isSupported=function(){return window.crypto||window.msCrypto},r.WebCryptoRandomNumberGenerator.instance=function(){return r.WebCryptoRandomNumberGenerator.__instance||(r.WebCryptoRandomNumberGenerator.__instance=new r.WebCryptoRandomNumberGenerator),r.WebCryptoRandomNumberGenerator.__instance},r.Xorshift128RandomNumberGenerator=function(t){if(r.RandomNumberGenerator.call(this),Number.isSafeInteger(t.seed)){var n=Math.abs(Math.floor(t.seed||0)),i=n/4294967296&2097151;t.seed<0&&(i|=2097152);var s=(4294967295&n)>>>0;this.__xorshiftState=[1,0,i,s]}else if(e.isArray(t.seed)){if(this.__xorshiftState=t.seed.map((function(e){if(!Number.isInteger(e)||e<0||e>4294967295)throw Error("seed values must be 32-bit unsigned values");return e})),4!==this.__xorshiftState.length||!this.__xorshiftState[0]&&!this.__xorshiftState[1]&&!this.__xorshiftState[2]&&!this.__xorshiftState[3])throw new Error("seed must be an array of 4, 32-bit unsigned values, where not all values are 0")}else{if(null!==t.seed&&void 0!==t.seed)throw new Error("seed must be an array or integer");do{this.__xorshiftState=[Math.floor(4294967296*Math.random()),Math.floor(4294967296*Math.random()),Math.floor(4294967296*Math.random()),Math.floor(4294967296*Math.random())]}while(0===this.__xorshiftState[0]&&0===this.__xorshiftState[1]&&0===this.__xorshiftState[2]&&0===this.__xorshiftState[3])}},r.Xorshift128RandomNumberGenerator.prototype.__proto__=r.RandomNumberGenerator.prototype,e.extend(r.Xorshift128RandomNumberGenerator.prototype,{next32:function(){var e=this.__xorshiftState,t=e[3],n=e[0];e[3]=e[2],e[2]=e[1],e[1]=n,t^=t<<11;var i=((t^=t>>>8)^n^n>>>19)>>>0;return e[0]=i,i}}),r.CancellationToken=function(){},e.extend(r.CancellationToken.prototype,{throwIfCancellationRequested:function(){if(this.__source&&this.__source.__isCancellationRequested)throw new Error("Operation has been cancelled")},isCancellationRequested:function(){return!(!this.__source||!this.__source.__isCancellationRequested)},canBeCanceled:function(){return!!this.__source},rejectIfCancellationRequested:function(){try{return this.throwIfCancellationRequested(),Promise.resolve()}catch(e){return Promise.reject(e)}},register:function(e){return this.__source?this.__source.__register(arguments):(this.__lastFakeRegisterID=(this.__lastFakeRegisterID||0)+1,this.__lastFakeRegisterID)},unregister:function(e){this.__source&&this.__source.__unregister(e)}}),r.CancellationToken.none=function(){return r.CancellationToken.__none||(r.CancellationToken.__none=new r.CancellationToken),r.CancellationToken.__none},r.CancellationTokenSource=function(){this.__isCancellationRequested=!1,this.__token=new r.CancellationToken,this.__token.__source=this},e.extend(r.CancellationTokenSource.prototype,{isCancellationRequested:function(){return this.__isCancellationRequested},token:function(){return this.__token},cancel:function(){if(!this.__isCancellationRequested&&(this.__isCancellationRequested=!0,void 0!==this.__cancelTimeoutID&&(clearTimeout(this.__cancelTimeoutID),delete this.__cancelTimeoutID),this.__registeredCallbacks&&this.__registeredCallbacks.length>0)){var e=this;this.__callCallbacksTimeoutID=setTimeout((function(){delete this.__callCallbacksTimeoutID,e.__callCallbacks()}),0)}},cancelAfter:function(e){if(null!==e&&(!Number.isFinite(e)||e<0))throw new Error("phoenix4.CancellationTokenSource: invalid duration: "+e);if(!this.__isCancellationRequested)if(void 0!==this.__cancelTimeoutID&&clearTimeout(this.__cancelTimeoutID),null!==e){var t=this;this.__cancelTimeoutID=setTimeout((function(){t.cancel()}),e)}else delete this.__cancelTimeoutID},__register:function(e){if(this.__registeredCallbacks||(this.__lastRegisteredID=0,this.__registeredCallbacks=[]),this.__registeredCallbacks.push({id:++this.__lastRegisteredID,arguments:e}),this.__isCancellationRequested&&void 0===this.callCallbacksTimeoutID){var t=this;this.__callCallbacksTimeoutID=setTimeout((function(){delete this.__callCallbacksTimeoutID,t.__callCallbacks()}),0)}return this.__lastRegisteredID},__unregister:function(e){if(e>0&&this.__registeredCallbacks){var t=this.__registeredCallbacks.findIndex((function(t){return t.id===e}));-1!==t&&this.__registeredCallbacks.splice(t,1)}},__callCallbacks:function(){for(;this.__registeredCallbacks.length>0;){var e=this.__registeredCallbacks[0];this.__registeredCallbacks.splice(0,1);try{var t=e.arguments;"function"==typeof t[0]||1===t.length?t[0].apply(null,Array.prototype.slice.call(t,1)):t[1].apply(t[0],Array.prototype.slice.call(t,2))}catch(e){console.error(e)}}}});var s={sessionID:null,buttons:0,touches:[],asyncScripts:{promises:{},executors:{},lazy:{"phoenix4-base-backtotop":{handler:()=>n(3740)},"phoenix4-base-carousel":{handler:()=>n(6983),requires:"phoenix4-base-external-slick"},"phoenix4-base-indexeddb":{handler:()=>n(8294)},"phoenix4-base-querymatcher":{handler:()=>n(2767)},"phoenix4-base-recentlyvieweddatasource":{handler:()=>n(2880),requires:"phoenix4-base-indexeddb"},"phoenix4-base-slider":{handler:()=>n(8616),requires:"phoenix4-base-external-nouislider"},"phoenix4-base-suggestionengine":{handler:()=>n(2111)},"phoenix4-base-vehiclesearchmanager2":{handler:()=>n(1754)},"phoenix4-base-vehiclesearchprovider":{handler:()=>n(8076)},"phoenix4-base-external-nouislider":{url:"phoenix4-base/external/nouislider-13.1.5/nouislider.min.js",style:"phoenix4-base/external/nouislider-13.1.5/nouislider.min.css"},"phoenix4-base-external-slick":{url:"phoenix4-base/external/slick-1.8.1/slick/slick.min.js",style:"phoenix4-base/external/slick-1.8.1/slick/slick.css"},"phoenix4-base-external-decisionpro":{url:"https://apply.decisionpro360.com/dist/embed/v1/init.js",version:null},"phoenix4-base-external-birchwoodnext":{url:function(){return r.getServerData("base.birchwoodNext").jsUrl},version:null},"phoenix4-base-youtube-iframe-api":{url:"https://www.youtube.com/iframe_api",version:null},"phoenix4-base-security":{handler:()=>n(8223)}}},phoenix4VehicleCard:{pauseCount:0},birchwoodNextLoadActions:[],loadBirchwoodNextPromise:null,initializedGravityForms:[],isGravityFormsSubmitHandlerSetUp:!1};window.phoenix4.__state=s,r.__initialize=function(){var e=window.__phoenix4InitializationData;if(delete window.__phoenix4InitializationData,s.versions=e.versions,s.pluginsRoot=e.pluginsRoot,s.serverData=e.serverData||{},s.isIE=!(!document.documentMode||!/\b(?:Trident|MSIE)/.test(navigator.userAgent)),e.asyncScripts)for(var t in s.asyncScripts.autoLoad=[],e.asyncScripts){var n=e.asyncScripts[t];r.registerLazyScript({handle:t,url:n,version:null}),s.asyncScripts.autoLoad.push(t)}},e((function(){e("body").on("keydown",l),window.addEventListener("click",u,!0),r.requestIdleCallback(o)}));var o=function(){if(s.asyncScripts.autoLoad){for(var e=0;e<s.asyncScripts.autoLoad.length;++e){var t=s.asyncScripts.autoLoad[e];r.waitForScript(t).catch((function(){}))}delete s.asyncScripts.autoLoad}var n=function(e){s.buttons=e.buttons},i=function(e){s.touches=e.touches};r.isIE()?(window.addEventListener("mousedown",n,!0),window.addEventListener("mouseup",n,!0),window.addEventListener("touchstart",i,!0),window.addEventListener("touchend",i,!0)):(window.addEventListener("mousedown",n,{passive:!0,capture:!0}),window.addEventListener("mouseup",n,{passive:!0,capture:!0}),window.addEventListener("touchstart",i,{passive:!0,capture:!0}),window.addEventListener("touchend",i,{passive:!0,capture:!0})),a().catch((e=>console.error(e)));var o=r.getServerData("base.page",{});if(o.isBackToTopEnabled&&!r.isElementorPreview()&&r.waitForScript("phoenix4-base-backtotop").then((function(){r.BackToTop.instance().enable()})).catch((function(e){console.error(e)})),o.isVehicleDetailsPage&&r.isMyVehiclesEnabled()&&!r.isElementorPreview()){var l=r.getServerData("base.page",{}).basicPageVehicle;l&&l.success&&l.is_for_sale&&l.stock_number&&r.waitForScript("phoenix4-base-recentlyvieweddatasource").then((function(){return r.VehicleRecentlyViewedDataSource.instance().recordRecentlyViewedAsync({stockNumber:l.stock_number})})).catch((function(e){console.error(e)}))}};const a=async function(){var t=r.getServerData("base.chat",{});if(!t.enabled||r.isIFrame()||r.isElementorPreview())return;const n=t.denylistRegex;if(""!==n&&new RegExp(n,"i").test(location.pathname))return;e("body").addClass("phoenix4-chat-enabled");const i=t.type;switch(i){case"rapidrtc":{const e=t.configuration;if(""===e)throw new Error("phoenix4: RapidRTC configuration is missing");const n="https://canada.digital-interview.com/en-ca/launcher/"+encodeURIComponent(e);r.registerLazyScript({handle:"phoenix4-base-rapidrtc-chat",url:n,version:null}),await r.waitForScript("phoenix4-base-rapidrtc-chat"),console.log("phoenix4: activating RapidRTC chat"),DigitalInterview.Launcher.enableLaunchPoints(),console.log("phoenix4: RapidRTC chat active")}break;case"drivecentric":{const e=t.configuration;if(""===e)throw new Error("phoenix4: DriveCentric configuration is missing");window.ignitifySettings={ignitifyId:e},function(){var e=window,t=e.Ignitify;if("function"==typeof t)t("reattach_activator"),t("update",e.ignitifySettings);else{var n=document,i=function(){i.c(arguments)};i.q=[],i.c=function(e){i.q.push(e)},e.Ignitify=i;var r=function(){var e=n.createElement("script");e.type="text/javascript",e.async=!0,e.src="https://ignitify-tagmanager-scripts.drivecentric.io/prod/ignitify-tagmanager.js";var t=n.getElementsByTagName("script")[0];t.parentNode.insertBefore(e,t)};"complete"===document.readyState?r():e.attachEvent?e.attachEvent("onload",r):e.addEventListener("load",r,!1)}}()}break;default:throw new Error("phoenix4: chat provider type not recognized: "+JSON.stringify(i))}};var l=function(t){9===t.which&&e("body").addClass("phoenix4-kbd-nav").off("keydown",l).one("mousedown",c)},c=function(t){e("body").removeClass("phoenix4-kbd-nav").on("keydown",l)},u=function(t){var n=e(t.target);if("click"!==n.attr("data-phoenix4-gtm-event-trigger")||n.is(":disabled")||n.is(".disabled")||d(n),n.is("a[href]")&&!n.is(".disabled")){var i=n.attr("href");(i.startsWith("tel:")||i.startsWith("mailto:")&&!i.startsWith("mailto:?"))&&h(n)}},d=function(t){var n=e(t),i=n.attr("data-phoenix4-gtm-event");if(i){var s=n.attr("data-phoenix4-gtm-event-data")||void 0;if(s)try{s=JSON.parse(s)}catch(e){console.warn("phoenix4: the GTM event data is not valid JSON"),s=void 0}window.dataLayer&&("phoenix4.preConversionClick"===i?r.raiseGtmPreConversionClickEvent(e.extend({conversionType:"unknown"},s?s.justClicked:void 0)):"phoenix4.preShareClick"===i?r.raiseGtmPreShareClickEvent(e.extend({shareType:"unknown"},s?s.justClicked:void 0)):(window.dataLayer.push((function(){var e=i.split(".");if(1===e.length)this.set(e[0],s);else{var t=this.get(e[0]),n=!t;n&&(t={});for(var r=t,o=1;o<e.length-1;++o){var a=e[o],l=r[a];l||(l={},r[a]=l),r=l}s?r[e[e.length-1]]=s:delete r[e[e.length-1]],n&&this.set(e[0],t)}})),window.dataLayer.push({event:i})))}else console.warn("phoenix4: element does not have GTM event information")},h=function(e){var t={},n=e.attr("href");if(n.startsWith("tel:"))t.conversionType="phone",t.rawPhoneNumber=decodeURIComponent(n.substring(4)),t.phoneNumber=t.rawPhoneNumber.replace(/[^0-9]+/g,"");else{if(!n.startsWith("mailto:"))return void console.error("phoenix4: attempted to raise GTM pre-conversion event on an invalid target");var i=n.indexOf("?"),s=decodeURIComponent(n.substring(7,i>=0?i:n.length)).trim();if(!s)return void console.error("phoenix4: attempted to raise GTM pre-conversion event on a mailto: link without an email address");t.conversionType="email",t.email=s}var o=e.attr("data-phoenix4-gtm-preconversion-contact-name");o&&(t.contactName=o);var a=e.attr("data-phoenix4-gtm-preconversion-source");a&&(t.linkType=a),r.raiseGtmPreConversionClickEvent(t)},m=function(n){var i,o=s.asyncScripts?s.asyncScripts.lazy[n]:null;if(!o)return null;i=o.requires?Promise.all((e.isArray(o.requires)?o.requires:[o.requires]).map((function(e){return r.waitForScript(e)}))):Promise.resolve();var a=null;if(o.style){var l=e.isArray(o.style)?o.style:[o.style];a=[];for(var c=0;c<l.length;++c){var u,d=l[c];-1===d.indexOf(":")?(u=s.pluginsRoot,"/"!==o.style[0]&&(u+="/"),u+=d):u=d,null!==o.version&&(u=u+(-1===u.indexOf("?")?"?":"&")+"ver="+encodeURIComponent(o.version||r.getVersion())),a.push(u)}a.length>0&&i.then((()=>{for(var t=e("head"),n=0;n<a.length;++n){var i=e('<link rel="stylesheet" type="text/css">').attr("href",a[n]);t.append(i)}})).catch((e=>{console.error(e)}))}let h;if(o.handler)h=i.then(o.handler);else{var m,f,g="function"==typeof o.url?o.url():o.url;-1===g.indexOf(":")?(m=s.pluginsRoot,"/"!==g[0]&&(m+="/"),m+=g):m=g,null!==o.version&&(m=m+(-1===m.indexOf("?")?"?":"&")+"ver="+encodeURIComponent(o.version||r.getVersion())),h=new Promise((function(r,s){f={resolve:r,reject:s},i.then((function(){var i=function(t){p(n,t),e(t.currentTarget).off("load error",i)},r=document.createElement("script");r.async=!0,r.nonce=t.tryGetContentSecurityPolicyNonceForScripts(),r.src=m,document.body.appendChild(r),e(r).on("load error",i)})).catch((function(e){s(e)}))}))}return delete s.asyncScripts.lazy[n],s.asyncScripts.promises[n]=h,s.asyncScripts.executors[n]=f,h},p=function(e,t){if("loading"===s.asyncScripts.promises[e])s.asyncScripts.promises[e]=t.type;else{var n=s.asyncScripts.executors[e];if(delete s.asyncScripts.executors[e],"load"===t.type)n.resolve();else try{throw new Error("Failed to load "+t.currentTarget.src)}catch(t){n.reject(t)}}},f=function(t){if(!t.isDefaultPrevented()){var n=e(t.currentTarget).find(".phoenix4-lightbox-content");0!==n.length&&(n.is(t.target)||e.contains(n[0],t.target))||(t.preventDefault(),r.closeLightbox({shouldCallOnCloseCallback:!0}))}},g=function(e){e.isDefaultPrevented()||27===e.which&&(e.preventDefault(),r.closeLightbox({shouldCallOnCloseCallback:!0}))},y=function(){var e=s.scrollStop?s.scrollStop.$currentlyScrolling:null;if(e){s.scrollStop.$currentlyScrolling=null,null!==s.scrollStop.timeoutID&&(clearTimeout(s.scrollStop.timeoutID),s.scrollStop.timeoutID=null);var t=jQuery.Event("phoenix4_scrollstop",{target:e[0]});e.trigger(t)}},_=function(e){s.scrollStop.$currentlyScrolling&&null===s.scrollStop.timeoutID&&(s.scrollStop.timeoutID=setTimeout(w,100))},v=function(t){var n=e(t.currentTarget),i=s.scrollStop.$currentlyScrolling;i&&i.is(n)?null!==s.scrollStop.timeoutID&&(clearTimeout(s.scrollStop.timeoutID),s.scrollStop.timeoutID=setTimeout(w,300)):(y(),s.scrollStop.$currentlyScrolling=n,0===s.buttons&&0===s.touches.length&&(s.scrollStop.timeoutID=setTimeout(w,300)))},w=function(){s.scrollStop.timeoutID=null,y()}}(jQuery,kintsugi),window.__phoenix4InitializationData&&phoenix4.__initialize(window.__phoenix4InitializationData)}},t={};function n(i){var r=t[i];if(void 0!==r)return r.exports;var s=t[i]={exports:{}};return e[i](s,s.exports,n),s.exports}(()=>{const e=jQuery,t=Object.assign({},n(2250));t.widgets=Object.assign({},n(3938),{carousel:n(8434),dropdown:n(3125),numberfield:n(8617),emailfield:n(8456),checkboxfield:n(4505),validation:n(859)}),t.i18n=n(3784),window.kintsugi=t,n(4956),n(1577),e((function(){phoenix4.getServerData("base.shiftdigital.script",{}).enabled&&n(1401),phoenix4.getServerData("base.newModelDetailsManager.modelDetails",null)&&n(7531),e("#wpadminbar").length>0&&n(4229)}))})()})();