@joystick.js/ui-canary 0.0.0-canary.51 → 0.0.0-canary.52

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- var Wt=Object.create;var oe=Object.defineProperty;var Jt=Object.getOwnPropertyDescriptor;var Qt=Object.getOwnPropertyNames;var Yt=Object.getPrototypeOf,Xt=Object.prototype.hasOwnProperty;var er=t=>oe(t,"__esModule",{value:!0});var tr=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var rr=(t,e,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Qt(e))!Xt.call(t,o)&&o!=="default"&&oe(t,o,{get:()=>e[o],enumerable:!(r=Jt(e,o))||r.enumerable});return t},or=t=>rr(er(oe(t!=null?Wt(Yt(t)):{},"default",t&&t.__esModule&&"default"in t?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t);var xt=tr(Y=>{(function(t,e){if(typeof define=="function"&&define.amd)define(["exports"],e);else if(typeof Y!="undefined")e(Y);else{var r={exports:{}};e(r.exports),t.index=r.exports}})(Y,function(t){"use strict";function e(p){return e=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(d){return typeof d}:function(d){return d&&typeof Symbol=="function"&&d.constructor===Symbol&&d!==Symbol.prototype?"symbol":typeof d},e(p)}function r(p,d){return d&&(e(d)==="object"||typeof d=="function")?d:o(p)}function o(p){if(p===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return p}function i(p){return i=Object.setPrototypeOf?Object.getPrototypeOf:function(d){return d.__proto__||Object.getPrototypeOf(d)},i(p)}function s(p,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function");p.prototype=Object.create(d&&d.prototype,{constructor:{value:p,writable:!0,configurable:!0}}),d&&c(p,d)}function c(p,d){return c=Object.setPrototypeOf||function(b,O){return b.__proto__=O,b},c(p,d)}function a(p,d){if(!(p instanceof d))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0}),t.diff=void 0;var m=function p(d,b){a(this,p),this.type=d,this.path=b?b.toString():""},y=function(p){function d(b,O,h){var A;return a(this,d),A=r(this,i(d).call(this,"E",b)),A.lhs=O,A.rhs=h,A}return s(d,p),d}(m),w=function(p){function d(b,O,h,A){var $;return a(this,d),$=r(this,i(d).call(this,"M",b)),$.item=O,$.lhsIndex=h,$.rhsIndex=A,$}return s(d,p),d}(m),x=function(p){function d(b,O){var h;return a(this,d),h=r(this,i(d).call(this,"D",b)),h.lhs=O,h}return s(d,p),d}(m),v=function(p){function d(b,O){var h;return a(this,d),h=r(this,i(d).call(this,"A",b)),h.rhs=O,h}return s(d,p),d}(m),f=function(p,d){return p?"".concat(p,".").concat(d):d};t.diff=function(d,b){var O=2<arguments.length&&arguments[2]!==void 0?arguments[2]:{},h=[],A=O.matchKey,$=O.types||["E","A","D","M"],Kt=function(F,g,E,_){F.forEach(function(L,k){var T=g.findIndex(function(M){return M[_]===L[_]});-1<T?(-1<$.indexOf("M")&&k!==T&&h.push(new w(E,L,k,T)),Z(L,g[T],f(E,T))):-1<$.indexOf("D")&&h.push(new x(E,L))}),g.forEach(function(L,k){var T=F.findIndex(function(M){return L[_]===M[_]});-1<$.indexOf("A")&&T===-1&&h.push(new v(f(E,k),L))})},Z=function(F,g,E){var _=Object.prototype.toString.call(F),L=Object.prototype.toString.call(g);if(-1<$.indexOf("E")&&_!==L)return h.push(new y(E,F,g)),!1;if(_==="[object Object]")Object.getOwnPropertyNames(F).forEach(function(M){Object.prototype.hasOwnProperty.call(g,M)?Z(F[M],g[M],f(E,M)):-1<$.indexOf("D")&&h.push(new x(f(E,M),F[M]))}),Object.getOwnPropertyNames(g).forEach(function(M){-1<$.indexOf("A")&&!Object.prototype.hasOwnProperty.call(F,M)&&h.push(new v(f(E,M),g[M]))});else if(_!=="[object Array]")-1<$.indexOf("E")&&F!==g&&h.push(new y(E,F,g));else if(A)Kt(F,g,E,A);else{var k=F.length-1,T=g.length-1;if(-1<$.indexOf("D"))for(;k>T;)h.push(new x(f(E,k),F[k--]));if(-1<$.indexOf("A"))for(;T>k;)h.push(new v(f(E,T),g[T--]));for(;0<=k;--k)Z(F[k],g[k],f(E,k))}};return Z(d,b),h}})});var n=(t="",e={})=>{throw new Error(`[joystick${t?`.${t}`:""}] ${e.message||e.reason||e}`)};var pe=["render"];var ue=(t={})=>{try{return pe.every(e=>Object.keys(t).includes(e))}catch(e){n("component.hasAllRequiredOptions",e)}};var fe=["_componentId","_ssrId","api","dataFromSSR","existingProps","existingState","instanceId","parent","req","css","data","defaultProps","events","id","lifecycle","methods","name","props","render","state","translations","url","websockets","wrapper"];var he=t=>{try{return typeof t=="undefined"}catch(e){n("types.isUndefined",e)}},we=t=>{try{return t===null}catch(e){n("types.isNull",e)}};var j=t=>{try{return!!Array.isArray(t)}catch(e){n("types.isArray",e)}};var l=t=>{try{return typeof t=="function"}catch(e){n("types.isFunction",e)}};var u=t=>{try{return!!(t&&typeof t=="object"&&!Array.isArray(t))}catch(e){n("types.isObject",e)}};var C=t=>{try{return typeof t=="string"}catch(e){n("types.isString",e)}};var ye=(t=null)=>{try{!C(t)&&!l(t)&&!u(t)&&n("component.optionValidators.css","options.css must be a string, function returning a string, or an object returning breakpoints.")}catch(e){n("component.optionValidators.css",e)}};var xe=["readystatechange","pointerlockchange","pointerlockerror","beforecopy","beforecut","beforepaste","freeze","resume","search","securitypolicyviolation","visibilitychange","fullscreenchange","fullscreenerror","webkitfullscreenchange","webkitfullscreenerror","beforexrselect","abort","blur","cancel","canplay","canplaythrough","change","click","close","contextmenu","cuechange","dblclick","drag","dragend","dragenter","dragleave","dragover","dragstart","drop","durationchange","emptied","ended","error","focus","formdata","input","invalid","keydown","keypress","keyup","load","loadeddata","loadedmetadata","loadstart","mousedown","mouseenter","mouseleave","mousemove","mouseout","mouseover","mouseup","mousewheel","pause","play","playing","progress","ratechange","reset","resize","scroll","seeked","seeking","select","stalled","submit","suspend","timeupdate","toggle","volumechange","waiting","webkitanimationend","webkitanimationiteration","webkitanimationstart","webkittransitionend","wheel","auxclick","gotpointercapture","lostpointercapture","pointerdown","pointermove","pointerup","pointercancel","pointerover","pointerout","pointerenter","pointerleave","selectstart","selectionchange","animationend","animationiteration","animationstart","transitionrun","transitionstart","transitionend","transitioncancel","copy","cut","paste","pointerrawupdate"];var ge=(t=null)=>{try{u(t)||n("component.optionValidators.events","options.events must be an object.");for(let e of Object.keys(t)){let[r]=e.split(" ");xe.includes(r)||n("component.optionValidators.events",`${r} is not a supported JavaScript event type.`)}for(let[e,r]of Object.entries(t))l(r)||n("component.optionValidators.events",`options.events.${e} must be assigned a function.`)}catch(e){n("component.optionValidators.events",e)}};var be=["onBeforeMount","onMount","onUpdateProps","onBeforeUnmount","onRefetchData"];var $e=(t=null)=>{try{u(t)||n("component.optionValidators.lifecycle","options.lifecycle must be an object.");for(let[e,r]of Object.entries(t))be.includes(e)||n("component.optionValidators.lifecycle",`options.lifecycle.${e} is not supported.`),l(r)||n("component.optionValidators.lifecycle",`options.lifecycle.${e} must be assigned a function.`)}catch(e){n("component.optionValidators.lifecycle",e)}};var Fe=(t=null)=>{try{u(t)||n("component.optionValidators.methods","options.methods must be an object.");for(let[e,r]of Object.entries(t))l(r)||n("component.optionValidators.methods",`options.methods.${e} must be assigned a function.`)}catch(e){n("component.optionValidators.methods",e)}};var Ee=(t=null)=>{typeof t!="string"&&n("component.optionValidators.name","options.name must be a string.")};var ke=(t=null)=>{try{l(t)||n("component.optionValidators.render","options.render must be a function returning a string.")}catch(e){n("component.optionValidators.render",e)}};var Me=(t=null)=>{try{l(t)||n("component.optionValidators.websockets","options.websockets must be a function returning an object.")}catch(e){n("component.optionValidators.websockets",e)}};var Se=(t=null)=>{try{u(t)||n("component.optionValidators.wrapper","options.wrapper must be an object.");for(let[e,r]of Object.entries(t))e==="id"&&!C(r)&&n("component.optionValidators.wrapper",`options.wrapper.${e} must be assigned a string.`),e==="classList"&&!j(r)&&n("component.optionValidators.wrapper",`options.wrapper.${e} must be assigned an array of strings.`)}catch(e){n("component.optionValidators.wrapper",e)}};var Oe={css:ye,events:ge,lifecycle:$e,methods:Fe,name:Ee,render:ke,websockets:Me,wrapper:Se};var Te=(t={})=>{try{ue(t)||n("component.validateOptions",`component options must include ${required.options.join(",")}.`);for(let[e,r]of Object.entries(t)){fe.includes(e)||n("component.validateOptions",`${e} is not supported by joystick.component.`);let o=Oe[e];o&&l(o)&&o(r)}}catch(e){n("component.validateOptions",e)}};var ve="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890".split(""),U=(t=16)=>{let e="",r=0;for(;r<t;)e+=ve[Math.floor(Math.random()*(ve.length-1))],r+=1;return e};var B=(t=[],e="")=>{try{return(j(t)&&t.find(o=>o?.componentId===e))?.data||{}}catch(r){n("findComponentDataFromSSR",r)}};var Ce=(()=>{let t=0;return(e,r)=>{clearTimeout(t),t=setTimeout(e,r)}})();var D=t=>!!(t&&typeof t=="object"&&!Array.isArray(t));var Re=t=>typeof t=="string";var Ae=/^(?:4[0-9]{12}(?:[0-9]{3,6})?|5[1-5][0-9]{14}|(222[1-9]|22[3-9][0-9]|2[3-6][0-9]{2}|27[01][0-9]|2720)[0-9]{12}|6(?:011|5[0-9][0-9])[0-9]{12,15}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\d{3})\d{11}|6[27][0-9]{14}|^(81[0-9]{14,17}))$/,Le=(t,e="")=>{if(!e)return!0;if(e&&!Re(e))return!1;let r=e?e.replace(/[- ]+/g,""):"";return t===!0?r.match(new RegExp(Ae)):!r.match(new RegExp(Ae))};var _e=/^((?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\]))$/,je=(t,e="")=>t===!0?!!e.match(_e):!e.match(_e);var De=(t,e="")=>t===e;var Pe=(t,e="")=>t===e;var Ie=(t,e="")=>e.length<=t;var Ne=(t,e="")=>e.length>=t;var Ve=/^[\+]?[(]?[0-9]{3}[)]?[-\s\.]?[0-9]{3}[-\s\.]?[0-9]{4,6}$/,Ue=(t,e="")=>t===!0?!!e.match(Ve):!e.match(Ve);var qe={AF:/^\d{4}$/,AX:/^\d{5}$/,AL:/^\d{4}$/,DZ:/^\d{5}$/,AS:/^\d{5}(-{1}\d{4,6})$/,AD:/^[Aa][Dd]\d{3}$/,AI:/^[Aa][I][-][2][6][4][0]$/,AR:/^\d{4}|[A-Za-z]\d{4}[a-zA-Z]{3}$/,AM:/^\d{4}$/,AC:/^[Aa][Ss][Cc][Nn]\s{0,1}[1][Zz][Zz]$/,AU:/^\d{4}$/,AT:/^\d{4}$/,AZ:/^[Aa][Zz]\d{4}$/,BH:/^\d{3,4}$/,BD:/^\d{4}$/,BB:/^[Aa][Zz]\d{5}$/,BY:/^\d{6}$/,BE:/^\d{4}$/,BM:/^[A-Za-z]{2}\s([A-Za-z]{2}|\d{2})$/,BT:/^\d{5}$/,BO:/^\d{4}$/,BA:/^\d{5}$/,BR:/^\d{5}-\d{3}$/,"":/^[Bb][Ii][Qq]{2}\s{0,1}[1][Zz]{2}$/,IO:/^[Bb]{2}[Nn][Dd]\s{0,1}[1][Zz]{2}$/,VG:/^[Vv][Gg]\d{4}$/,BN:/^[A-Za-z]{2}\d{4}$/,BG:/^\d{4}$/,KH:/^\d{5}$/,CA:/^(?=[^DdFfIiOoQqUu\d\s])[A-Za-z]\d(?=[^DdFfIiOoQqUu\d\s])[A-Za-z]\s{0,1}\d(?=[^DdFfIiOoQqUu\d\s])[A-Za-z]\d$/,CV:/^\d{4}$/,KY:/^[Kk][Yy]\d[-\s]{0,1}\d{4}$/,TD:/^\d{5}$/,CL:/^\d{7}\s\(\d{3}-\d{4}\)$/,CN:/^\d{6}$/,CX:/^\d{4}$/,CC:/^\d{4}$/,CO:/^\d{6}$/,CD:/^[Cc][Dd]$/,CR:/^\d{4,5}$/,HR:/^\d{5}$/,CU:/^\d{5}$/,CY:/^\d{4}$/,CZ:/^\d{5}\s\(\d{3}\s\d{2}\)$/,DK:/^\d{4}$/,DO:/^\d{5}$/,EC:/^\d{6}$/,SV:/^1101$/,EG:/^\d{5}$/,EE:/^\d{5}$/,ET:/^\d{4}$/,FK:/^[Ff][Ii][Qq]{2}\s{0,1}[1][Zz]{2}$/,FO:/^\d{3}$/,FI:/^\d{5}$/,FR:/^\d{5}$/,GF:/^973\d{2}$/,PF:/^987\d{2}$/,GA:/^\d{2}\s[a-zA-Z-_ ]\s\d{2}$/,GE:/^\d{4}$/,DE:/^\d{2}$/,GI:/^[Gg][Xx][1]{2}\s{0,1}[1][Aa]{2}$/,GR:/^\d{3}\s{0,1}\d{2}$/,GL:/^\d{4}$/,GP:/^971\d{2}$/,GU:/^\d{5}$/,GT:/^\d{5}$/,GG:/^[A-Za-z]{2}\d\s{0,1}\d[A-Za-z]{2}$/,GW:/^\d{4}$/,HT:/^\d{4}$/,HM:/^\d{4}$/,HN:/^\d{5}$/,HU:/^\d{4}$/,IS:/^\d{3}$/,IN:/^\d{6}$/,ID:/^\d{5}$/,IR:/^\d{5}-\d{5}$/,IQ:/^\d{5}$/,IM:/^[Ii[Mm]\d{1,2}\s\d\[A-Z]{2}$/,IL:/^\b\d{5}(\d{2})?$/,IT:/^\d{5}$/,JM:/^\d{2}$/,JP:/^\d{7}\s\(\d{3}-\d{4}\)$/,JE:/^[Jj][Ee]\d\s{0,1}\d[A-Za-z]{2}$/,JO:/^\d{5}$/,KZ:/^\d{6}$/,KE:/^\d{5}$/,KR:/^\d{6}\s\(\d{3}-\d{3}\)$/,XK:/^\d{5}$/,KW:/^\d{5}$/,KG:/^\d{6}$/,LV:/^[Ll][Vv][- ]{0,1}\d{4}$/,LA:/^\d{5}$/,LB:/^\d{4}\s{0,1}\d{4}$/,LS:/^\d{3}$/,LR:/^\d{4}$/,LY:/^\d{5}$/,LI:/^\d{4}$/,LT:/^[Ll][Tt][- ]{0,1}\d{5}$/,LU:/^\d{4}$/,MK:/^\d{4}$/,MG:/^\d{3}$/,MV:/^\d{4,5}$/,MY:/^\d{5}$/,MT:/^[A-Za-z]{3}\s{0,1}\d{4}$/,MH:/^\d{5}$/,MQ:/^972\d{2}$/,YT:/^976\d{2}$/,FM:/^\d{5}(-{1}\d{4})$/,MX:/^\d{5}$/,MD:/^[Mm][Dd][- ]{0,1}\d{4}$/,MC:/^980\d{2}$/,MN:/^\d{5}$/,ME:/^\d{5}$/,MS:/^[Mm][Ss][Rr]\s{0,1}\d{4}$/,MA:/^\d{5}$/,MZ:/^\d{4}$/,MM:/^\d{5}$/,NA:/^\d{5}$/,NP:/^\d{5}$/,NL:/^\d{4}\s{0,1}[A-Za-z]{2}$/,NC:/^988\d{2}$/,NZ:/^\d{4}$/,NI:/^\d{5}$/,NE:/^\d{4}$/,NG:/^\d{6}$/,NF:/^\d{4}$/,MP:/^\d{5}$/,NO:/^\d{4}$/,OM:/^\d{3}$/,PK:/^\d{5}$/,PW:/^\d{5}$/,PA:/^\d{6}$/,PG:/^\d{3}$/,PY:/^\d{4}$/,PE:/^\d{5}$/,PH:/^\d{4}$/,PN:/^[Pp][Cc][Rr][Nn]\s{0,1}[1][Zz]{2}$/,PL:/^\d{2}[- ]{0,1}\d{3}$/,PT:/^\d{4}$/,PR:/^\d{5}$/,RE:/^974\d{2}$/,RO:/^\d{6}$/,RU:/^\d{6}$/,BL:/^97133$/,SH:/^[Ss][Tt][Hh][Ll]\s{0,1}[1][Zz]{2}$/,MF:/^97150$/,PM:/^97500$/,VC:/^[Vv][Cc]\d{4}$/,SM:/^4789\d$/,SA:/^\d{5}(-{1}\d{4})?$/,SN:/^\d{5}$/,RS:/^\d{5}$/,SG:/^\d{2}$/,SK:/^\d{5}\s\(\d{3}\s\d{2}\)$/,SI:/^([Ss][Ii][- ]{0,1}){0,1}\d{4}$/,ZA:/^\d{4}$/,GS:/^[Ss][Ii][Qq]{2}\s{0,1}[1][Zz]{2}$/,ES:/^\d{5}$/,LK:/^\d{5}$/,SD:/^\d{5}$/,SZ:/^[A-Za-z]\d{3}$/,SE:/^\d{3}\s*\d{2}$/,CH:/^\d{4}$/,SJ:/^\d{4}$/,TW:/^\d{5}$/,TJ:/^\d{6}$/,TH:/^\d{5}$/,TT:/^\d{6}$/,TN:/^\d{4}$/,TR:/^\d{5}$/,TM:/^\d{6}$/,TC:/^[Tt][Kk][Cc][Aa]\s{0,1}[1][Zz]{2}$/,UA:/^\d{5}$/,GB:/^[A-Z]{1,2}[0-9R][0-9A-Z]?\s*[0-9][A-Z-[CIKMOV]]{2}/,US:/^\b\d{5}\b(?:[- ]{1}\d{4})?$/,UY:/^\d{5}$/,VI:/^\d{5}$/,UZ:/^\d{3} \d{3}$/,VA:/^120$/,VE:/^\d{4}(\s[a-zA-Z]{1})?$/,VN:/^\d{6}$/,WF:/^986\d{2}$/,ZM:/^\d{5}$/},He=(t,e="")=>{let r=D(t)&&t.iso?qe[t.iso||"US"]:qe.US;return D(t)?t.rule===!0?!!e.match(r):!e.match(r):t===!0?!!e.match(r):!e.match(r)};var ze=(t,e="",r={isChecked:!1})=>{if(!r.isChecked)return t===!0?e&&e.trim()!=="":e&&e.trim()==="";if(r.isChecked)return t===!0?e:!e};var Ze=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/,Be=(t,e="")=>t===!0?!!e.match(Ze):!e.match(Ze);var Ge=/^[a-z0-9]+(?:-[a-z0-9]+)*$/,Ke=(t,e="")=>t===!0?!!e.match(Ge):!e.match(Ge);var We=/^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[#?!@$ %^&*-]).{8,}$/,Je=(t,e="")=>t===!0?!!e.match(We):!e.match(We);var Qe=/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()!@:%_\+.~#?&\/\/=]*)/,Ye=(t,e="")=>t===!0?!!e.match(Qe):!e.match(Qe);var Xe={AT:/^(AT)(U\d{8}$)/i,BE:/^(BE)(\d{10}$)/i,BG:/^(BG)(\d{9,10}$)/i,CY:/^(CY)([0-5|9]\d{7}[A-Z]$)/i,CZ:/^(CZ)(\d{8,10})?$/i,DE:/^(DE)([1-9]\d{8}$)/i,DK:/^(DK)(\d{8}$)/i,EE:/^(EE)(10\d{7}$)/i,EL:/^(EL)(\d{9}$)/i,ES:/^(ES)([0-9A-Z][0-9]{7}[0-9A-Z]$)/i,EU:/^(EU)(\d{9}$)/i,FI:/^(FI)(\d{8}$)/i,FR:/^(FR)([0-9A-Z]{2}[0-9]{9}$)/i,GB:/^(GB)((?:[0-9]{12}|[0-9]{9}|(?:GD|HA)[0-9]{3})$)/i,GR:/^(GR)(\d{8,9}$)/i,HR:/^(HR)(\d{11}$)/i,HU:/^(HU)(\d{8}$)/i,IE:/^(IE)([0-9A-Z\*\+]{7}[A-Z]{1,2}$)/i,IT:/^(IT)(\d{11}$)/i,LV:/^(LV)(\d{11}$)/i,LT:/^(LT)(\d{9}$|\d{12}$)/i,LU:/^(LU)(\d{8}$)/i,MT:/^(MT)([1-9]\d{7}$)/i,NL:/^(NL)(\d{9}B\d{2}$)/i,NO:/^(NO)(\d{9}$)/i,PL:/^(PL)(\d{10}$)/i,PT:/^(PT)(\d{9}$)/i,RO:/^(RO)([1-9]\d{1,9}$)/i,RU:/^(RU)(\d{10}$|\d{12}$)/i,RS:/^(RS)(\d{9}$)/i,SI:/^(SI)([1-9]\d{7}$)/i,SK:/^(SK)([1-9]\d[(2-4)|(6-9)]\d{7}$)/i,SE:/^(SE)(\d{10}01$)/i},et=(t,e="")=>{let r=D(t)&&t.iso?Xe[t.iso||"EU"]:Xe.EU;return D(t)?t.rule===!0?!!e.match(r):!e.match(r):t===!0?!!e.match(r):!e.match(r)};var tt={creditCard:Le,email:je,equals:De,matches:Pe,maxLength:Ie,minLength:Ne,phone:Ue,postalCode:He,required:ze,semVer:Be,slug:Ke,strongPassword:Je,url:Ye,vat:et};var rt=class{constructor(e,r={}){this.fieldsToListenToForChanges=["checkbox","color","date","datetime-local","email","file","hidden","month","number","password","radio","range","search","tel","text","time","url","week"],this.defaultValidationErrors={required:()=>"This field is required.",email:()=>"Must be a valid email.",creditCard:()=>"Must be a valid credit card number.",equals:o=>`Value must equal ${o}.`,matches:o=>`Field must match ${o}.`,maxLength:o=>`Field value can be no greater than ${o}.`,minLength:o=>`Field value can be no less than ${o}.`,phone:()=>"Field value must be a valid telephone number.",postalCode:()=>"Field value must be a valid postal code.",semVer:()=>"Field value must be a valid semantic version.",slug:()=>"Field value must be a valid URL slug.",strongPassword:()=>"Field value must be a valid password.",url:()=>"Field value must be a valid URL.",vat:()=>"Field value must be a valid VAT code."},e||console.warn("[validateForm] Must pass an HTML <form></form> element to validate."),this.form=e,this.setOptions(r),this.attachEventListeners()}setOptions(e={}){this.rules=e.rules||{},this.messages=e.messages||{},this.onSubmit=e.onSubmit,this.fields=this.serialize()}updateOptions(e={}){this.setOptions(e)}serialize(){if(this.form)return Object.keys(this.rules).map(r=>{let o=this.form.querySelector(`[name="${r}"]`),i=o?.type;return{listenForChanges:this.fieldsToListenToForChanges.includes(i),type:i,name:r,element:o,validations:Object.entries(this.rules[r]).map(([c,a])=>({name:c,rule:a,valid:!1})).sort((c,a)=>c.name>a.name?1:-1),errorMessages:this.messages[r]?Object.keys(this.messages[r]):{}}})}attachEventListeners(){if(this.form){let e=r=>{r.stopPropagation(),r.preventDefault(),this.validate()&&this.onSubmit&&this.onSubmit()};if(this.form.listeners?.length>0)for(let r=0;r<this.form.listeners.length;r+=1){let o=this.form.listeners[r];this.form.removeEventListener("submit",o)}this.form.addEventListener("submit",e),this.form.listeners=[...this.form.listeners||[],e]}this.fields.forEach(e=>{if(e?.element&&e?.listenForChanges){let r=()=>{Ce(()=>{this.validate(e.name)},100)};e.element.removeEventListener("input",r),e.element.addEventListener("input",r),e.element.removeEventListener("change",r),e.element.addEventListener("change",r)}})}validate(e=null){if(e){this.clearExistingErrors();let r=this.fields.find(o=>o.name===e);return this.validateField(r),this.checkIfValid()}else return this.clearExistingErrors(),this.fields.forEach(r=>{this.validateField(r)}),this.checkIfValid()}checkIfValid(){return!this.fields.map(r=>r.validations.some(o=>!o.valid)).includes(!0)}validateField(e){let r=this.form.querySelector(`[name="${e.name}"]`),o=["checkbox","radio"].includes(e.type),i=o?null:e?.element?.value?.trim(),s=o?e?.element?.checked:null;e.validations.forEach(a=>{if(this.isValidValue(o,o?s:i,a))this.markValidationAsValid(e,a.name);else{let m=this.messages[e.name]&&this.messages[e.name][a.name];this.markValidationAsInvalid(e,a.name),this.renderError(e.element,m||this.defaultValidationErrors[a.name](a.rule,i))}});let c=e.validations.some(a=>!a.valid);return c&&(r.classList.add("error"),r.focus()),c||(r.classList.remove("error"),this.clearExistingError(e.name)),!c}markValidationAsInvalid(e,r){let i=[...e.validations].find(s=>s.name===r);i.valid=!1}markValidationAsValid(e,r){let i=[...e.validations].find(s=>s.name===r);i.valid=!0}isValidValue(e,r,o){let i=tt[o.name];return i?i(o.rule,r,{isChecked:e}):!0}clearExistingErrors(){this.form&&this.form.querySelectorAll(".input-hint.error").forEach(e=>e.remove())}clearExistingError(e=""){let r=document.getElementById(`error-${e}`);r&&r.remove()}renderError(e,r=""){if(e){this.clearExistingError(e.name);let o=document.createElement("p");o.classList.add("input-hint"),o.classList.add("error"),o.setAttribute("id",`error-${e.name}`),o.innerText=r,e.after(o)}}},ir=(t,e)=>new Promise((r,o)=>{try{new rt(t,e).validate()?r():o()}catch(i){console.warn(i)}}),ot=ir;var it=(t={},e={})=>{try{return[...Object.keys(e),...Object.keys(t)].filter((o,i,s)=>s.indexOf(o)===i).reduce((o,i)=>{let s=e[i],c=t[i]||null,a=!he(s)&&!we(s);return o[i]=a?s:c,o},{})}catch(r){n("component.props.compile",r)}};var nt=(t="",e={})=>{try{let r="";if(t&&C(t))return r=t,r;if(t&&l(t))return r=t(e),r;if(t&&u(t)){let o=t?.print&&(C(t?.print)||l(t?.print)),i=t?.min&&u(t?.min),s=t?.min?.width&&u(t?.min?.width),c=t?.min?.height&&u(t?.min?.height),a=t?.max&&u(t?.max),m=t?.max?.width&&u(t?.max?.width),y=t?.max?.height&&u(t?.max?.height);if(o&&(r+=`
1
+ var Jt=Object.create;var oe=Object.defineProperty;var Qt=Object.getOwnPropertyDescriptor;var Yt=Object.getOwnPropertyNames;var Xt=Object.getPrototypeOf,er=Object.prototype.hasOwnProperty;var tr=t=>oe(t,"__esModule",{value:!0});var rr=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var or=(t,e,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Yt(e))!er.call(t,o)&&o!=="default"&&oe(t,o,{get:()=>e[o],enumerable:!(r=Qt(e,o))||r.enumerable});return t},ir=t=>or(tr(oe(t!=null?Jt(Xt(t)):{},"default",t&&t.__esModule&&"default"in t?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t);var gt=rr(Y=>{(function(t,e){if(typeof define=="function"&&define.amd)define(["exports"],e);else if(typeof Y!="undefined")e(Y);else{var r={exports:{}};e(r.exports),t.index=r.exports}})(Y,function(t){"use strict";function e(p){return e=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(d){return typeof d}:function(d){return d&&typeof Symbol=="function"&&d.constructor===Symbol&&d!==Symbol.prototype?"symbol":typeof d},e(p)}function r(p,d){return d&&(e(d)==="object"||typeof d=="function")?d:o(p)}function o(p){if(p===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return p}function i(p){return i=Object.setPrototypeOf?Object.getPrototypeOf:function(d){return d.__proto__||Object.getPrototypeOf(d)},i(p)}function s(p,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function");p.prototype=Object.create(d&&d.prototype,{constructor:{value:p,writable:!0,configurable:!0}}),d&&c(p,d)}function c(p,d){return c=Object.setPrototypeOf||function(b,O){return b.__proto__=O,b},c(p,d)}function a(p,d){if(!(p instanceof d))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0}),t.diff=void 0;var m=function p(d,b){a(this,p),this.type=d,this.path=b?b.toString():""},y=function(p){function d(b,O,h){var A;return a(this,d),A=r(this,i(d).call(this,"E",b)),A.lhs=O,A.rhs=h,A}return s(d,p),d}(m),w=function(p){function d(b,O,h,A){var $;return a(this,d),$=r(this,i(d).call(this,"M",b)),$.item=O,$.lhsIndex=h,$.rhsIndex=A,$}return s(d,p),d}(m),x=function(p){function d(b,O){var h;return a(this,d),h=r(this,i(d).call(this,"D",b)),h.lhs=O,h}return s(d,p),d}(m),v=function(p){function d(b,O){var h;return a(this,d),h=r(this,i(d).call(this,"A",b)),h.rhs=O,h}return s(d,p),d}(m),f=function(p,d){return p?"".concat(p,".").concat(d):d};t.diff=function(d,b){var O=2<arguments.length&&arguments[2]!==void 0?arguments[2]:{},h=[],A=O.matchKey,$=O.types||["E","A","D","M"],Wt=function(F,g,E,j){F.forEach(function(L,k){var T=g.findIndex(function(M){return M[j]===L[j]});-1<T?(-1<$.indexOf("M")&&k!==T&&h.push(new w(E,L,k,T)),Z(L,g[T],f(E,T))):-1<$.indexOf("D")&&h.push(new x(E,L))}),g.forEach(function(L,k){var T=F.findIndex(function(M){return L[j]===M[j]});-1<$.indexOf("A")&&T===-1&&h.push(new v(f(E,k),L))})},Z=function(F,g,E){var j=Object.prototype.toString.call(F),L=Object.prototype.toString.call(g);if(-1<$.indexOf("E")&&j!==L)return h.push(new y(E,F,g)),!1;if(j==="[object Object]")Object.getOwnPropertyNames(F).forEach(function(M){Object.prototype.hasOwnProperty.call(g,M)?Z(F[M],g[M],f(E,M)):-1<$.indexOf("D")&&h.push(new x(f(E,M),F[M]))}),Object.getOwnPropertyNames(g).forEach(function(M){-1<$.indexOf("A")&&!Object.prototype.hasOwnProperty.call(F,M)&&h.push(new v(f(E,M),g[M]))});else if(j!=="[object Array]")-1<$.indexOf("E")&&F!==g&&h.push(new y(E,F,g));else if(A)Wt(F,g,E,A);else{var k=F.length-1,T=g.length-1;if(-1<$.indexOf("D"))for(;k>T;)h.push(new x(f(E,k),F[k--]));if(-1<$.indexOf("A"))for(;T>k;)h.push(new v(f(E,T),g[T--]));for(;0<=k;--k)Z(F[k],g[k],f(E,k))}};return Z(d,b),h}})});var n=(t="",e={})=>{throw new Error(`[joystick${t?`.${t}`:""}] ${e.message||e.reason||e}`)};var ue=["render"];var fe=(t={})=>{try{return ue.every(e=>Object.keys(t).includes(e))}catch(e){n("component.hasAllRequiredOptions",e)}};var he=["_componentId","_ssrId","api","dataFromSSR","existingProps","existingState","instanceId","parent","req","css","data","defaultProps","events","id","lifecycle","methods","name","props","render","state","translations","url","websockets","wrapper"];var we=t=>{try{return typeof t=="undefined"}catch(e){n("types.isUndefined",e)}},ye=t=>{try{return t===null}catch(e){n("types.isNull",e)}};var D=t=>{try{return!!Array.isArray(t)}catch(e){n("types.isArray",e)}};var l=t=>{try{return typeof t=="function"}catch(e){n("types.isFunction",e)}};var u=t=>{try{return!!(t&&typeof t=="object"&&!Array.isArray(t))}catch(e){n("types.isObject",e)}};var C=t=>{try{return typeof t=="string"}catch(e){n("types.isString",e)}};var xe=(t=null)=>{try{!C(t)&&!l(t)&&!u(t)&&n("component.optionValidators.css","options.css must be a string, function returning a string, or an object returning breakpoints.")}catch(e){n("component.optionValidators.css",e)}};var ge=["readystatechange","pointerlockchange","pointerlockerror","beforecopy","beforecut","beforepaste","freeze","resume","search","securitypolicyviolation","visibilitychange","fullscreenchange","fullscreenerror","webkitfullscreenchange","webkitfullscreenerror","beforexrselect","abort","blur","cancel","canplay","canplaythrough","change","click","close","contextmenu","cuechange","dblclick","drag","dragend","dragenter","dragleave","dragover","dragstart","drop","durationchange","emptied","ended","error","focus","formdata","input","invalid","keydown","keypress","keyup","load","loadeddata","loadedmetadata","loadstart","mousedown","mouseenter","mouseleave","mousemove","mouseout","mouseover","mouseup","mousewheel","pause","play","playing","progress","ratechange","reset","resize","scroll","seeked","seeking","select","stalled","submit","suspend","timeupdate","toggle","volumechange","waiting","webkitanimationend","webkitanimationiteration","webkitanimationstart","webkittransitionend","wheel","auxclick","gotpointercapture","lostpointercapture","pointerdown","pointermove","pointerup","pointercancel","pointerover","pointerout","pointerenter","pointerleave","selectstart","selectionchange","animationend","animationiteration","animationstart","transitionrun","transitionstart","transitionend","transitioncancel","copy","cut","paste","pointerrawupdate"];var be=(t=null)=>{try{u(t)||n("component.optionValidators.events","options.events must be an object.");for(let e of Object.keys(t)){let[r]=e.split(" ");ge.includes(r)||n("component.optionValidators.events",`${r} is not a supported JavaScript event type.`)}for(let[e,r]of Object.entries(t))l(r)||n("component.optionValidators.events",`options.events.${e} must be assigned a function.`)}catch(e){n("component.optionValidators.events",e)}};var $e=["onBeforeMount","onMount","onUpdateProps","onBeforeUnmount","onRefetchData"];var Fe=(t=null)=>{try{u(t)||n("component.optionValidators.lifecycle","options.lifecycle must be an object.");for(let[e,r]of Object.entries(t))$e.includes(e)||n("component.optionValidators.lifecycle",`options.lifecycle.${e} is not supported.`),l(r)||n("component.optionValidators.lifecycle",`options.lifecycle.${e} must be assigned a function.`)}catch(e){n("component.optionValidators.lifecycle",e)}};var Ee=(t=null)=>{try{u(t)||n("component.optionValidators.methods","options.methods must be an object.");for(let[e,r]of Object.entries(t))l(r)||n("component.optionValidators.methods",`options.methods.${e} must be assigned a function.`)}catch(e){n("component.optionValidators.methods",e)}};var ke=(t=null)=>{typeof t!="string"&&n("component.optionValidators.name","options.name must be a string.")};var Me=(t=null)=>{try{l(t)||n("component.optionValidators.render","options.render must be a function returning a string.")}catch(e){n("component.optionValidators.render",e)}};var Se=(t=null)=>{try{l(t)||n("component.optionValidators.websockets","options.websockets must be a function returning an object.")}catch(e){n("component.optionValidators.websockets",e)}};var Oe=(t=null)=>{try{u(t)||n("component.optionValidators.wrapper","options.wrapper must be an object.");for(let[e,r]of Object.entries(t))e==="id"&&!C(r)&&n("component.optionValidators.wrapper",`options.wrapper.${e} must be assigned a string.`),e==="classList"&&!D(r)&&n("component.optionValidators.wrapper",`options.wrapper.${e} must be assigned an array of strings.`)}catch(e){n("component.optionValidators.wrapper",e)}};var Te={css:xe,events:be,lifecycle:Fe,methods:Ee,name:ke,render:Me,websockets:Se,wrapper:Oe};var ve=(t={})=>{try{fe(t)||n("component.validateOptions",`component options must include ${required.options.join(",")}.`);for(let[e,r]of Object.entries(t)){he.includes(e)||n("component.validateOptions",`${e} is not supported by joystick.component.`);let o=Te[e];o&&l(o)&&o(r)}}catch(e){n("component.validateOptions",e)}};var Ce="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890".split(""),U=(t=16)=>{let e="",r=0;for(;r<t;)e+=Ce[Math.floor(Math.random()*(Ce.length-1))],r+=1;return e};var B=(t=[],e="")=>{try{return(D(t)&&t.find(o=>o?.componentId===e))?.data||{}}catch(r){n("findComponentDataFromSSR",r)}};var Re=(()=>{let t=0;return(e,r)=>{clearTimeout(t),t=setTimeout(e,r)}})();var _=t=>!!(t&&typeof t=="object"&&!Array.isArray(t));var Ae=t=>typeof t=="string";var Le=/^(?:4[0-9]{12}(?:[0-9]{3,6})?|5[1-5][0-9]{14}|(222[1-9]|22[3-9][0-9]|2[3-6][0-9]{2}|27[01][0-9]|2720)[0-9]{12}|6(?:011|5[0-9][0-9])[0-9]{12,15}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\d{3})\d{11}|6[27][0-9]{14}|^(81[0-9]{14,17}))$/,je=(t,e="")=>{if(!e)return!0;if(e&&!Ae(e))return!1;let r=e?e.replace(/[- ]+/g,""):"";return t===!0?r.match(new RegExp(Le)):!r.match(new RegExp(Le))};var De=/^((?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\]))$/,_e=(t,e="")=>t===!0?!!e.match(De):!e.match(De);var Pe=(t,e="")=>t===e;var Ie=(t,e="")=>t===e;var Ne=(t,e="")=>e.length<=t;var Ve=(t,e="")=>e.length>=t;var Ue=/^[\+]?[(]?[0-9]{3}[)]?[-\s\.]?[0-9]{3}[-\s\.]?[0-9]{4,6}$/,qe=(t,e="")=>t===!0?!!e.match(Ue):!e.match(Ue);var He={AF:/^\d{4}$/,AX:/^\d{5}$/,AL:/^\d{4}$/,DZ:/^\d{5}$/,AS:/^\d{5}(-{1}\d{4,6})$/,AD:/^[Aa][Dd]\d{3}$/,AI:/^[Aa][I][-][2][6][4][0]$/,AR:/^\d{4}|[A-Za-z]\d{4}[a-zA-Z]{3}$/,AM:/^\d{4}$/,AC:/^[Aa][Ss][Cc][Nn]\s{0,1}[1][Zz][Zz]$/,AU:/^\d{4}$/,AT:/^\d{4}$/,AZ:/^[Aa][Zz]\d{4}$/,BH:/^\d{3,4}$/,BD:/^\d{4}$/,BB:/^[Aa][Zz]\d{5}$/,BY:/^\d{6}$/,BE:/^\d{4}$/,BM:/^[A-Za-z]{2}\s([A-Za-z]{2}|\d{2})$/,BT:/^\d{5}$/,BO:/^\d{4}$/,BA:/^\d{5}$/,BR:/^\d{5}-\d{3}$/,"":/^[Bb][Ii][Qq]{2}\s{0,1}[1][Zz]{2}$/,IO:/^[Bb]{2}[Nn][Dd]\s{0,1}[1][Zz]{2}$/,VG:/^[Vv][Gg]\d{4}$/,BN:/^[A-Za-z]{2}\d{4}$/,BG:/^\d{4}$/,KH:/^\d{5}$/,CA:/^(?=[^DdFfIiOoQqUu\d\s])[A-Za-z]\d(?=[^DdFfIiOoQqUu\d\s])[A-Za-z]\s{0,1}\d(?=[^DdFfIiOoQqUu\d\s])[A-Za-z]\d$/,CV:/^\d{4}$/,KY:/^[Kk][Yy]\d[-\s]{0,1}\d{4}$/,TD:/^\d{5}$/,CL:/^\d{7}\s\(\d{3}-\d{4}\)$/,CN:/^\d{6}$/,CX:/^\d{4}$/,CC:/^\d{4}$/,CO:/^\d{6}$/,CD:/^[Cc][Dd]$/,CR:/^\d{4,5}$/,HR:/^\d{5}$/,CU:/^\d{5}$/,CY:/^\d{4}$/,CZ:/^\d{5}\s\(\d{3}\s\d{2}\)$/,DK:/^\d{4}$/,DO:/^\d{5}$/,EC:/^\d{6}$/,SV:/^1101$/,EG:/^\d{5}$/,EE:/^\d{5}$/,ET:/^\d{4}$/,FK:/^[Ff][Ii][Qq]{2}\s{0,1}[1][Zz]{2}$/,FO:/^\d{3}$/,FI:/^\d{5}$/,FR:/^\d{5}$/,GF:/^973\d{2}$/,PF:/^987\d{2}$/,GA:/^\d{2}\s[a-zA-Z-_ ]\s\d{2}$/,GE:/^\d{4}$/,DE:/^\d{2}$/,GI:/^[Gg][Xx][1]{2}\s{0,1}[1][Aa]{2}$/,GR:/^\d{3}\s{0,1}\d{2}$/,GL:/^\d{4}$/,GP:/^971\d{2}$/,GU:/^\d{5}$/,GT:/^\d{5}$/,GG:/^[A-Za-z]{2}\d\s{0,1}\d[A-Za-z]{2}$/,GW:/^\d{4}$/,HT:/^\d{4}$/,HM:/^\d{4}$/,HN:/^\d{5}$/,HU:/^\d{4}$/,IS:/^\d{3}$/,IN:/^\d{6}$/,ID:/^\d{5}$/,IR:/^\d{5}-\d{5}$/,IQ:/^\d{5}$/,IM:/^[Ii[Mm]\d{1,2}\s\d\[A-Z]{2}$/,IL:/^\b\d{5}(\d{2})?$/,IT:/^\d{5}$/,JM:/^\d{2}$/,JP:/^\d{7}\s\(\d{3}-\d{4}\)$/,JE:/^[Jj][Ee]\d\s{0,1}\d[A-Za-z]{2}$/,JO:/^\d{5}$/,KZ:/^\d{6}$/,KE:/^\d{5}$/,KR:/^\d{6}\s\(\d{3}-\d{3}\)$/,XK:/^\d{5}$/,KW:/^\d{5}$/,KG:/^\d{6}$/,LV:/^[Ll][Vv][- ]{0,1}\d{4}$/,LA:/^\d{5}$/,LB:/^\d{4}\s{0,1}\d{4}$/,LS:/^\d{3}$/,LR:/^\d{4}$/,LY:/^\d{5}$/,LI:/^\d{4}$/,LT:/^[Ll][Tt][- ]{0,1}\d{5}$/,LU:/^\d{4}$/,MK:/^\d{4}$/,MG:/^\d{3}$/,MV:/^\d{4,5}$/,MY:/^\d{5}$/,MT:/^[A-Za-z]{3}\s{0,1}\d{4}$/,MH:/^\d{5}$/,MQ:/^972\d{2}$/,YT:/^976\d{2}$/,FM:/^\d{5}(-{1}\d{4})$/,MX:/^\d{5}$/,MD:/^[Mm][Dd][- ]{0,1}\d{4}$/,MC:/^980\d{2}$/,MN:/^\d{5}$/,ME:/^\d{5}$/,MS:/^[Mm][Ss][Rr]\s{0,1}\d{4}$/,MA:/^\d{5}$/,MZ:/^\d{4}$/,MM:/^\d{5}$/,NA:/^\d{5}$/,NP:/^\d{5}$/,NL:/^\d{4}\s{0,1}[A-Za-z]{2}$/,NC:/^988\d{2}$/,NZ:/^\d{4}$/,NI:/^\d{5}$/,NE:/^\d{4}$/,NG:/^\d{6}$/,NF:/^\d{4}$/,MP:/^\d{5}$/,NO:/^\d{4}$/,OM:/^\d{3}$/,PK:/^\d{5}$/,PW:/^\d{5}$/,PA:/^\d{6}$/,PG:/^\d{3}$/,PY:/^\d{4}$/,PE:/^\d{5}$/,PH:/^\d{4}$/,PN:/^[Pp][Cc][Rr][Nn]\s{0,1}[1][Zz]{2}$/,PL:/^\d{2}[- ]{0,1}\d{3}$/,PT:/^\d{4}$/,PR:/^\d{5}$/,RE:/^974\d{2}$/,RO:/^\d{6}$/,RU:/^\d{6}$/,BL:/^97133$/,SH:/^[Ss][Tt][Hh][Ll]\s{0,1}[1][Zz]{2}$/,MF:/^97150$/,PM:/^97500$/,VC:/^[Vv][Cc]\d{4}$/,SM:/^4789\d$/,SA:/^\d{5}(-{1}\d{4})?$/,SN:/^\d{5}$/,RS:/^\d{5}$/,SG:/^\d{2}$/,SK:/^\d{5}\s\(\d{3}\s\d{2}\)$/,SI:/^([Ss][Ii][- ]{0,1}){0,1}\d{4}$/,ZA:/^\d{4}$/,GS:/^[Ss][Ii][Qq]{2}\s{0,1}[1][Zz]{2}$/,ES:/^\d{5}$/,LK:/^\d{5}$/,SD:/^\d{5}$/,SZ:/^[A-Za-z]\d{3}$/,SE:/^\d{3}\s*\d{2}$/,CH:/^\d{4}$/,SJ:/^\d{4}$/,TW:/^\d{5}$/,TJ:/^\d{6}$/,TH:/^\d{5}$/,TT:/^\d{6}$/,TN:/^\d{4}$/,TR:/^\d{5}$/,TM:/^\d{6}$/,TC:/^[Tt][Kk][Cc][Aa]\s{0,1}[1][Zz]{2}$/,UA:/^\d{5}$/,GB:/^[A-Z]{1,2}[0-9R][0-9A-Z]?\s*[0-9][A-Z-[CIKMOV]]{2}/,US:/^\b\d{5}\b(?:[- ]{1}\d{4})?$/,UY:/^\d{5}$/,VI:/^\d{5}$/,UZ:/^\d{3} \d{3}$/,VA:/^120$/,VE:/^\d{4}(\s[a-zA-Z]{1})?$/,VN:/^\d{6}$/,WF:/^986\d{2}$/,ZM:/^\d{5}$/},ze=(t,e="")=>{let r=_(t)&&t.iso?He[t.iso||"US"]:He.US;return _(t)?t.rule===!0?!!e.match(r):!e.match(r):t===!0?!!e.match(r):!e.match(r)};var Ze=(t,e="",r={isChecked:!1})=>{if(!r.isChecked)return t===!0?e&&e.trim()!=="":e&&e.trim()==="";if(r.isChecked)return t===!0?e:!e};var Be=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/,Ge=(t,e="")=>t===!0?!!e.match(Be):!e.match(Be);var Ke=/^[a-z0-9]+(?:-[a-z0-9]+)*$/,We=(t,e="")=>t===!0?!!e.match(Ke):!e.match(Ke);var Je=/^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[#?!@$ %^&*-]).{8,}$/,Qe=(t,e="")=>t===!0?!!e.match(Je):!e.match(Je);var Ye=/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()!@:%_\+.~#?&\/\/=]*)/,Xe=(t,e="")=>t===!0?!!e.match(Ye):!e.match(Ye);var et={AT:/^(AT)(U\d{8}$)/i,BE:/^(BE)(\d{10}$)/i,BG:/^(BG)(\d{9,10}$)/i,CY:/^(CY)([0-5|9]\d{7}[A-Z]$)/i,CZ:/^(CZ)(\d{8,10})?$/i,DE:/^(DE)([1-9]\d{8}$)/i,DK:/^(DK)(\d{8}$)/i,EE:/^(EE)(10\d{7}$)/i,EL:/^(EL)(\d{9}$)/i,ES:/^(ES)([0-9A-Z][0-9]{7}[0-9A-Z]$)/i,EU:/^(EU)(\d{9}$)/i,FI:/^(FI)(\d{8}$)/i,FR:/^(FR)([0-9A-Z]{2}[0-9]{9}$)/i,GB:/^(GB)((?:[0-9]{12}|[0-9]{9}|(?:GD|HA)[0-9]{3})$)/i,GR:/^(GR)(\d{8,9}$)/i,HR:/^(HR)(\d{11}$)/i,HU:/^(HU)(\d{8}$)/i,IE:/^(IE)([0-9A-Z\*\+]{7}[A-Z]{1,2}$)/i,IT:/^(IT)(\d{11}$)/i,LV:/^(LV)(\d{11}$)/i,LT:/^(LT)(\d{9}$|\d{12}$)/i,LU:/^(LU)(\d{8}$)/i,MT:/^(MT)([1-9]\d{7}$)/i,NL:/^(NL)(\d{9}B\d{2}$)/i,NO:/^(NO)(\d{9}$)/i,PL:/^(PL)(\d{10}$)/i,PT:/^(PT)(\d{9}$)/i,RO:/^(RO)([1-9]\d{1,9}$)/i,RU:/^(RU)(\d{10}$|\d{12}$)/i,RS:/^(RS)(\d{9}$)/i,SI:/^(SI)([1-9]\d{7}$)/i,SK:/^(SK)([1-9]\d[(2-4)|(6-9)]\d{7}$)/i,SE:/^(SE)(\d{10}01$)/i},tt=(t,e="")=>{let r=_(t)&&t.iso?et[t.iso||"EU"]:et.EU;return _(t)?t.rule===!0?!!e.match(r):!e.match(r):t===!0?!!e.match(r):!e.match(r)};var rt={creditCard:je,email:_e,equals:Pe,matches:Ie,maxLength:Ne,minLength:Ve,phone:qe,postalCode:ze,required:Ze,semVer:Ge,slug:We,strongPassword:Qe,url:Xe,vat:tt};var ot=class{constructor(e,r={}){this.fieldsToListenToForChanges=["checkbox","color","date","datetime-local","email","file","hidden","month","number","password","radio","range","search","tel","text","time","url","week"],this.defaultValidationErrors={required:()=>"This field is required.",email:()=>"Must be a valid email.",creditCard:()=>"Must be a valid credit card number.",equals:o=>`Value must equal ${o}.`,matches:o=>`Field must match ${o}.`,maxLength:o=>`Field value can be no greater than ${o}.`,minLength:o=>`Field value can be no less than ${o}.`,phone:()=>"Field value must be a valid telephone number.",postalCode:()=>"Field value must be a valid postal code.",semVer:()=>"Field value must be a valid semantic version.",slug:()=>"Field value must be a valid URL slug.",strongPassword:()=>"Field value must be a valid password.",url:()=>"Field value must be a valid URL.",vat:()=>"Field value must be a valid VAT code."},e||console.warn("[validateForm] Must pass an HTML <form></form> element to validate."),this.form=e,this.setOptions(r),this.attachEventListeners()}setOptions(e={}){this.rules=e.rules||{},this.messages=e.messages||{},this.onSubmit=e.onSubmit,this.fields=this.serialize()}updateOptions(e={}){this.setOptions(e)}serialize(){if(this.form)return Object.keys(this.rules).map(r=>{let o=this.form.querySelector(`[name="${r}"]`),i=o?.type;return{listenForChanges:this.fieldsToListenToForChanges.includes(i),type:i,name:r,element:o,validations:Object.entries(this.rules[r]).map(([c,a])=>({name:c,rule:a,valid:!1})).sort((c,a)=>c.name>a.name?1:-1),errorMessages:this.messages[r]?Object.keys(this.messages[r]):{}}})}attachEventListeners(){if(this.form){let e=r=>{r.stopPropagation(),r.preventDefault(),this.validate()&&this.onSubmit&&this.onSubmit()};if(this.form.listeners?.length>0)for(let r=0;r<this.form.listeners.length;r+=1){let o=this.form.listeners[r];this.form.removeEventListener("submit",o)}this.form.addEventListener("submit",e),this.form.listeners=[...this.form.listeners||[],e]}this.fields.forEach(e=>{if(e?.element&&e?.listenForChanges){let r=()=>{Re(()=>{this.validate(e.name)},100)};e.element.removeEventListener("input",r),e.element.addEventListener("input",r),e.element.removeEventListener("change",r),e.element.addEventListener("change",r)}})}validate(e=null){if(e){this.clearExistingErrors();let r=this.fields.find(o=>o.name===e);return this.validateField(r),this.checkIfValid()}else return this.clearExistingErrors(),this.fields.forEach(r=>{this.validateField(r)}),this.checkIfValid()}checkIfValid(){return!this.fields.map(r=>r.validations.some(o=>!o.valid)).includes(!0)}validateField(e){let r=this.form.querySelector(`[name="${e.name}"]`),o=["checkbox","radio"].includes(e.type),i=o?null:e?.element?.value?.trim(),s=o?e?.element?.checked:null;e.validations.forEach(a=>{if(this.isValidValue(o,o?s:i,a))this.markValidationAsValid(e,a.name);else{let m=this.messages[e.name]&&this.messages[e.name][a.name];this.markValidationAsInvalid(e,a.name),this.renderError(e.element,m||this.defaultValidationErrors[a.name](a.rule,i))}});let c=e.validations.some(a=>!a.valid);return c&&(r.classList.add("error"),r.focus()),c||(r.classList.remove("error"),this.clearExistingError(e.name)),!c}markValidationAsInvalid(e,r){let i=[...e.validations].find(s=>s.name===r);i.valid=!1}markValidationAsValid(e,r){let i=[...e.validations].find(s=>s.name===r);i.valid=!0}isValidValue(e,r,o){let i=rt[o.name];return i?i(o.rule,r,{isChecked:e}):!0}clearExistingErrors(){this.form&&this.form.querySelectorAll(".input-hint.error").forEach(e=>e.remove())}clearExistingError(e=""){let r=document.getElementById(`error-${e}`);r&&r.remove()}renderError(e,r=""){if(e){this.clearExistingError(e.name);let o=document.createElement("p");o.classList.add("input-hint"),o.classList.add("error"),o.setAttribute("id",`error-${e.name}`),o.innerText=r,e.after(o)}}},nr=(t,e)=>new Promise((r,o)=>{try{new ot(t,e).validate()?r():o()}catch(i){console.warn(i)}}),it=nr;var nt=(t={},e={})=>{try{return[...Object.keys(e),...Object.keys(t)].filter((o,i,s)=>s.indexOf(o)===i).reduce((o,i)=>{let s=e[i],c=t[i]||null,a=!we(s)&&!ye(s);return o[i]=a?s:c,o},{})}catch(r){n("component.props.compile",r)}};var st=(t="",e={})=>{try{let r="";if(t&&C(t))return r=t,r;if(t&&l(t))return r=t(e),r;if(t&&u(t)){let o=t?.print&&(C(t?.print)||l(t?.print)),i=t?.min&&u(t?.min),s=t?.min?.width&&u(t?.min?.width),c=t?.min?.height&&u(t?.min?.height),a=t?.max&&u(t?.max),m=t?.max?.width&&u(t?.max?.width),y=t?.max?.height&&u(t?.max?.height);if(o&&(r+=`
2
2
  @media print {
3
3
  ${typeof t?.print=="function"?t?.print(e):t.print}
4
4
  }
@@ -18,4 +18,4 @@ var Wt=Object.create;var oe=Object.defineProperty;var Jt=Object.getOwnPropertyDe
18
18
  @media screen and (max-height: ${v}px) {
19
19
  ${typeof f=="function"?f(e):f}
20
20
  }
21
- `}}return r}return""}catch(r){n("component.css.compileCSS",r)}};var nr=(t={},e=null)=>{try{let r=e(t);return r&&u(r)&&!j(r)?Object.assign({},r):{}}catch(r){n("component.state.compile.compileState",r)}},G=(t={},e={})=>{try{return l(e)?nr(t,e):Object.assign({},e)}catch(r){n("component.state.compile",r)}};var ie={onBeforeMount:()=>null,onMount:()=>null,onBeforeUnmount:()=>null,onUpdateProps:()=>null,onRefetchData:()=>null};var st=(t={},e={})=>{try{return e?Object.entries({...ie,...e||{}}).reduce((r={},[o,i])=>(r[o]=()=>i({...t,setState:t.setState.bind(t),...t.renderMethods||{}}),r),{}):ie}catch(r){n("component.lifecycle.compile",r)}};var K=(t={},e={})=>{try{return Object.entries(e).reduce((r={},[o,i])=>(r[o]=(...s)=>i(...s,{...t,setState:t.setState.bind(t),...t.renderMethods||{}}),r),{})}catch{n("component.methods.compile")}};var ne=(t={})=>{try{return{...t,query:{...t?.query||{},set:(e="",r="")=>{if(typeof window!="undefined"){let o=new URL(window.location);o.searchParams.append(e,r),window.history.pushState({},"",o)}},unset:(e="")=>{if(typeof window!="undefined"){let r=new URL(window.location);r.searchParams.delete(e),window.history.pushState({},"",r)}}},isActive:(e="")=>C(e)&&t?.route!=="*"?e===(typeof location!="undefined"?location.pathname:t.path):!1}}catch(e){n("component.url.compile",e)}};var S=()=>typeof window=="undefined";var P=null,W=0,at=(t={},e=null)=>{try{let r=t?.url;t?.query&&(r=`${r}?${new URLSearchParams(t.query).toString()}`);let o=new WebSocket(r);P&&(clearInterval(P),P=null);let i={client:o,send:(s={})=>o.send(JSON.stringify(s))};return o.addEventListener("open",()=>{t?.options?.logging&&console.log(`[joystick.websockets] Connected to ${t?.url}`),t?.events?.onOpen&&t.events.onOpen(i),W=0}),o.addEventListener("message",s=>{s?.data&&t?.events?.onMessage&&t.events.onMessage(JSON.parse(s.data||{}),i)}),o.addEventListener("close",s=>{t?.options?.logging&&console.log(`[joystick.websockets] Disconnected from ${t?.url}`),t?.events?.onClose&&t.events.onClose(s?.code,s?.reason,i),o=null;let c=[1e3,1001].includes(s?.code);t?.options?.autoReconnect&&!P&&!c&&(P=setInterval(()=>{o=null,W<(t?.options?.reconnectAttempts||12)?(at(t,e),t?.options?.logging&&console.log(`[joystick.websockets] Attempting to reconnect (${W+1}/12)...`),W+=1):clearInterval(P)},t?.options?.reconnectDelayInSeconds*1e3||5e3))}),e&&e(i),i}catch(r){n("websockets.client",r)}},dt=at;var sr=(t={},e=null)=>{try{let r=e(t);return r&&u(r)&&!j(r)?Object.assign({},r):{}}catch(r){n("component.props.compileDefaultProps.compile",r)}},ct=(t={},e={})=>{try{return l(e)?sr(t,e):Object.assign({},e)}catch(r){n("component.props.compileDefaultProps",r)}};var lt=(t={},e={})=>{try{t.options=e||{},t.id=e?._componentId||null,t.instanceId=U(8),t.ssrId=e?._ssrId||null,t.css=nt(),t.data=B(e?.dataFromSSR,e?._componentId),t.defaultProps=ct(t,e?.defaultProps),t.props=it(t?.defaultProps,e?.props),t.state=G(t,e?.state),t.events=e?.events||{},t.lifecycle=st(t,e?.lifecycle),t.methods=K(t,e?.methods),t.wrapper=e?.wrapper||{},t.translations=e?.translations||{},t.validateForm=ot,t.DOMNode=null,t.dom={},t.dom.virtual={},t.dom.actual={};let r=!S();if(r||(t.url=ne(e?.url)),r&&window.__joystick_url__&&(t.url=ne(window.__joystick_url__)),r&&e?.websockets&&l(e?.websockets)){let o=e.websockets(t),i=u(o)&&Object.entries(o);for(let s=0;s<i?.length;s+=1){let[c,a]=i[s];dt({url:`${window?.process?.env.NODE_ENV==="development"?"ws":"wss"}://${location.host}/api/_websockets/${c}`,options:a?.options||{},query:a?.query||{},events:a?.events||{}},(m={})=>{t.websockets={...t.websockets||{},[c]:m}})}}}catch(r){n("component.registerOptions",r)}};var I=(t="",e=[])=>{try{console.error(`${t} failed with the following errors:`),e.forEach(r=>{console.log(r.message),r.stack&&console.log(r.stack)})}catch(r){n(t,r)}};var J=(t="{}")=>{try{return JSON.parse(t)}catch{return t}};var mt=(t={})=>Object.entries(t).map(([e,r])=>`${e}=${r}`)?.join("; ");var ar=async(t={})=>{try{let e=await t.text();return J(e)}catch(e){n("api.get.handleParseResponse",e)}},pt=(t="",e={})=>{try{return typeof window.fetch!="undefined"&&!e?.skip?new Promise((r,o)=>{let i=e.input?JSON.stringify(e.input):null,s=e.output?JSON.stringify(e.output):null,c=`${window.location.origin}/api/_getters/${t}?input=${i}&output=${s}`,a=document.querySelector('[name="csrf"]')?.getAttribute("content"),m={...e?.headers||{},"x-joystick-csrf":a};return window?.__joystick_test__&&(m.Cookie=mt({joystickLoginToken:window.__joystick_test_login_token__,joystickLoginTokenExpiresAt:window.__joystick_test_login_token_expires_at__})),fetch(c,{method:"GET",mode:"cors",headers:m,credentials:"include"}).then(async y=>{let w=await ar(y);return w?.errors?(I("get request",w.errors),o(w)):r(w)}).catch(y=>(I("get request",[y]),o({errors:[y]})))}):Promise.resolve()}catch(r){n("get request",r)}};var dr=async(t={})=>{try{let e=await t.text();return J(e)}catch(e){n("api.set.handleParseResponse",e)}},cr=(t={})=>{try{return JSON.stringify(t)}catch(e){n("api.set.getBody",e)}},ut=(t="",e={})=>{try{return typeof window.fetch!="undefined"?new Promise((r,o)=>{let i=`${window.location.origin}/api/_setters/${t}`,s=cr(e),c=document.querySelector('[name="csrf"]')?.getAttribute("content"),a={...e?.headers||{},"Content-Type":"application/json","x-joystick-csrf":c};return window?.__joystick_test__&&(a.Cookie=generateCookieHeader({joystickLoginToken:window?.__joystick_test_login_token__,joystickLoginTokenExpiresAt:window.__joystick_test_login_token_expirs_at__})),fetch(i,{method:"POST",mode:"cors",headers:a,body:s,credentials:"include"}).then(async m=>{let y=await dr(m);return y?.errors?(I("set request",y.errors),o(y)):r(y)}).catch(m=>(I("set request",[m]),o({errors:[m]})))}):Promise.resolve()}catch(r){n("set request",r)}};var ft={get:pt,set:ut};var lr=(t="")=>{try{let[e,r]=t?.split(".");return r?window?.joystick?._internal?.queues[e][r]:window?.joystick?._internal?.queues[e]}catch(e){n("addToQueue.getQueue",e)}},q=(t="",e=null)=>{try{S()||(lr(t)||{}).array.push({callback:e})}catch(r){n("addToQueue",r)}};var Q=async(t={},e={},r={},o={})=>{try{if(o?.options?.data&&l(o.options.data)){let i=await o.options.data(t,e,r,o);return Promise.resolve(i)}return Promise.resolve()}catch(i){n("component.data.fetch",i)}};var ht=(t={},e={},r={})=>{try{return{...t,refetch:async(o={})=>{let i=await Q(ft,e,o,r);return r.data=ht(i,e,r),window.__joystick_data__[r?.id]&&(window.__joystick_data__[r?.id]=i),window?.__joystick_test__||r.render({afterRefetchDataRender:()=>{r?.lifecycle?.onRefetchData&&r?.lifecycle?.onRefetchData(r)}}),r.data}}}catch(o){n("component.data.compile",o)}},wt=ht;var yt=(t={})=>{try{if(!S()){let e=window.__joystick_data__&&window.__joystick_data__[t?.id]||{},r=window.__joystick_req__||{};return wt(e,r,t)}return t?.data||{}}catch(e){n("component.loadDataFromWindow",e)}};var $t=or(xt());var gt=(t={},e="",r="id")=>{try{let o=t&&t.id;if(u(t)&&o){let i=Object.keys(t);for(let s=0;s<i.length;s+=1){let c=i[s],a=t[c];if(c===r&&a===e)return t;if(c==="children"&&Array.isArray(a))for(let m=0;m<a.length;m+=1){let y=a[m],w=gt(y,e,r);if(w!==null)return w}}}return null}catch(o){n("component.findComponentInTreeByField",o)}},R=gt;var bt=(t="",e={},r=null)=>{let o=R(r||window.joystick._internal.tree,t,"instanceId");o&&(o.children=[...o.children||[],e])};var mr=(t={},e={},r=null)=>{try{let o=N(t,{includeActual:!0,existingChildren:r});return t.dom=o,t.setDOMNodeOnInstance(),e.renderedComponent=t,o.html.wrapped}catch(o){n("component.renderMethods.component.renderForClient",o)}},pr=(t={})=>{try{return t.renderToHTML({ssrTree:t.parent.ssrTree,translations:t.parent.translations,walkingTreeForSSR:t?.parent?.walkingTreeForSSR,dataFromSSR:t.parent?.dataFromSSR}).wrapped}catch(e){n("component.renderMethods.component.renderToHTMLForSSR",e)}},ur=(t={})=>{try{return t.parent.ssrTree.dataFunctions.push(async()=>{try{let e=await t.options.data(t.parent.options.api,t.parent.options.req);return t.data=e||{},{componentId:t.id,ssrId:t.ssrId,data:e}}catch(e){return{componentId:t.id,ssrId:t.ssrId,data:null,error:e}}}),t.renderToHTML({ssrTree:t?.parent?.ssrTree,translations:t?.parent?.translations,walkingTreeForSSR:t?.parent?.walkingTreeForSSR,dataFromSSR:t?.parent?.dataFromSSR})}catch(e){n("component.renderMethods.component.collectDataFunctionsForSSR",e)}},fr=(t={})=>{try{let e={id:t.id,instanceId:t.instanceId,instance:t,children:[]};bt(t.parent.instanceId,e,t.parent&&t.parent.ssrTree||null)}catch(e){n("component.renderMethods.component.handleAddComponentToParent",e)}},hr=(t={},e={})=>{try{!t.renderedComponent&&e.options&&e.options.lifecycle&&(e.options.lifecycle.onBeforeMount&&q("lifecycle.onBeforeMount",()=>{e.options.lifecycle.onBeforeMount(e)}),!t.renderedComponent&&e.options.lifecycle.onMount&&q("lifecycle.onMount",()=>{e.options.lifecycle.onMount(e)}))}catch(r){n("component.renderMethods.component.handleLifecycle",r)}},wr=(t={},e={},r={})=>{try{!e.walkingTreeForSSR&&t?.options?.lifecycle?.onUpdateProps&&(0,$t.diff)(e?.existingPropsMap,r)?.length>0&&q("lifecycle.onUpdateProps",()=>{let i=e?.existingPropsMap&&e?.existingPropsMap[t.id];t.options.lifecycle.onUpdateProps(i||{},r,t)})}catch(o){n("component.renderMethods.component.handleOnChangeProps",o)}},yr=function(){return function(e=null,r={},o={}){let i=e({props:r,url:o.url,translations:o.translations,api:o.options.api,req:o.options.req,dataFromSSR:o?.dataFromSSR,parent:o}),s=o?.existingStateMap[i.id]||{},c=o.children[i.id]||[],a=s[c?.length];return i.state=a?.state||i.state,o.children[i.id]=[...o.children[i.id]||[],i],i.parent=o,wr(i,o,r),q("lifecycle.onMount",()=>{i.setDOMNodeOnInstance()}),hr(this,i),i.parent&&fr(i),i.options.data&&i.parent.walkingTreeForSSR&&i.parent.ssrTree.dataFunctions?ur(i):i.parent&&i.parent.ssrTree?pr(i):mr(i,this,a?.children)}},xr=function(e,r){try{let o=this;return new yr().bind({})(e,r,o)}catch(o){n("component.renderMethods.component",o)}},se=xr;var gr=function(e=[],r=null){try{return l(r)&&e&&Array.isArray(e)?e.map((o,i)=>r(o,i)).join(""):""}catch(o){n("component.renderMethods.each",o)}},ae=gr;var br=function(e="",r={}){try{let o=S()?this.translations:window.__joystick_i18n__;if(!o||!o[e])return"";let i=Object.entries(r);return i.length>0?i.reduce((s,[c,a])=>s.replace(`{{${c}}}`,a),o[e]):o[e]}catch(o){n("component.renderMethods.i18n",o)}},de=br;var $r=function(e=!1,r=""){try{return this?.renderingHTMLWithDataForSSR||e?`<when>${r.trim()}</when>`:"<when> </when>"}catch(o){n("component.renderMethods.when",o)}},ce=$r;var Ft={c:se,component:se,e:ae,each:ae,i:de,i18n:de,w:ce,when:ce};var Et=(t={},e={})=>{try{return Object.entries(Ft).reduce((r,[o,i])=>(r[o]=i.bind({...t,...e}),r),{})}catch(r){n("component.renderMethods.compile",r)}};var kt=(t={})=>{try{return Object.entries(t)?.reduce((e={},[r,o]={})=>(e[r]=o?.map((i={})=>({state:i?.state,children:kt(i?.children)})),e),{})}catch(e){n("component.render.getExistingStateMap.buildMapForChildren",e)}},Mt=(t={})=>{try{return kt(t)}catch(e){n("component.render.getExistingStateMap",e)}};var St=new RegExp(/\<\!\-\-(?:.|\n|\r)*?-->/g),Fr=new RegExp(/\n/g);var Er=(t="")=>{try{return(t.match(St)||[]).forEach(r=>{t=t.replace(r,"")}),t}catch(e){n("component.render.sanitizeHTML.removeCommentedCode",e)}},Ot=(t="")=>{try{let e=`${t}`;return e=Er(e),e}catch(e){n("component.render.sanitizeHTML",e)}};var Tt=(t={},e="")=>{try{let{wrapper:r=null,id:o=null,instanceId:i=null}=t;return`<div ${r?.id?`id="${r.id}" `:""}${r?.classList?`class="${r.classList?.join(" ")}" `:""} js-c="${o}" js-i="${i}">${e}</div>`}catch(r){n("component.render.wrapHTML",r)}};var vt=(t={},e=[])=>{try{let r=[...e],o=Object.entries(t);for(let i=0;i<o?.length;i+=1){let[s,c]=o[i];for(let a=0;a<c?.length;a+=1){let m=c[a];Object.entries(m?.timers)?.length>0&&r.push(...Object.values(m?.timers)),Object.entries(m?.children)?.length>0&&vt(m?.children,r)}}if(r?.length>0)for(let i=0;i<r?.length;i+=1)clearTimeout(r[i])}catch(r){n("component.render.clearTimersOnChildren",r)}},Ct=vt;var X=(t={},e={})=>{try{e?.dataFromSSR&&(t.data=B(e.dataFromSSR,t.id)||{}),Ct(t?.children);let r=Mt(e?.existingChildren||t?.children)||{};t.children={},t.renderMethods=Et({...t,existingStateMap:r,translations:e?.translations||t.translations||{},ssrTree:e?.ssrTree,walkingTreeForSSR:e?.walkingTreeForSSR,renderingHTMLWithDataForSSR:e?.renderingHTMLWithDataForSSR,dataFromSSR:e?.dataFromSSR}),t.methods=K(t,t.options.methods);let o=t.options.render({...t||{},setState:t.setState.bind(t),...t.renderMethods||{}}),i=Ot(o),s=Tt(t,i);return{unwrapped:i,wrapped:s}}catch(r){n("component.render.toHTML",r)}};var kr=(t={})=>{try{return Object.values(t).reduce((e={},r)=>(e[r.name]=r.value,e),{})}catch(e){n("component.virtualDOM.build.parseAttributeMap",e)}},Rt=(t={})=>{try{return t.tagName==="WHEN"?[].flatMap.call(t?.childNodes,e=>e?.tagName==="WHEN"?Rt(e):le(e)):le(t)}catch(e){n("component.virtualDOM.build.flattenWhenTags",e)}},le=(t={})=>{try{let e=t&&t.tagName&&t.tagName.toLowerCase()||"text",r={tagName:e,attributes:kr(t.attributes),children:[].flatMap.call(t.childNodes,o=>Rt(o))};return e==="text"&&(r=t.textContent),r}catch(e){n("component.virtualDOM.build",e)}},H=le;var Mr=(t="")=>{try{let e=document.createElement("div");return e.innerHTML=t,e?.childNodes[0]}catch(e){n("component.virtualDOM.build.convertHTMLToDOM",e)}},At=(t="")=>{try{let e=Mr(t);return H(e)}catch(e){n("component.virtualDOM.build",e)}};var Lt=(t="")=>{try{return document.createElement("div").setAttribute(t,"Test"),!0}catch{return!1}};var Sr=(t={})=>{try{let e=document.createElement(t.tagName),r=Object.entries(t.attributes);for(let o=0;o<r.length;o+=1){let[i,s]=r[o];Lt(i)&&e.setAttribute(i,s)}for(let o=0;o<t?.children?.length;o+=1){let i=t?.children[o];if(i){let s=_t(i);e.appendChild(s)}}return e}catch(e){n("component.virtualDOM.renderTreeToDOM.renderElement",e)}},_t=(t=null)=>{try{return C(t)?document.createTextNode(t):Sr(t)}catch(e){n("component.virtualDOM.renderTreeToDOM",e)}},V=_t;var N=(t={},e={})=>{try{let r=X(t,{existingChildren:e?.existingChildren}),o=At(r.wrapped,t),i=e.includeActual&&o?V(o):null;return{html:r,virtual:o,actual:i}}catch(r){n("component.render.getUpdatedDOM",r)}};var jt=(t={},e={})=>{try{let r=N(t,{includeActual:!0,existingChildren:e?.existingChildren});return t.dom=r,r.actual}catch(r){n("component.render.forMount",r)}};var Or=(t={},e={})=>{let r=[];for(let[o,i]of Object.entries(e))r.push(s=>(s&&s.setAttribute&&s.setAttribute(o,i),s));for(let o in t)o in e||r.push(i=>(i&&i.removeAttribute&&i.removeAttribute(o),i));return o=>{for(let i of r)i&&typeof i=="function"&&i(o)}},ee=Or;var Tr=(t=[],e=[])=>{let r=[],o=Math.max(t.length,e.length);for(let i=0;i<o;i+=1){let s=t[i],c=e[i];r.push([s,c])}return r},Dt=Tr;var vr=(t=[],e)=>{t.forEach(r=>{r&&typeof r=="function"&&r(e)})},Cr=(t=[])=>{t.forEach(([e,r])=>{e&&typeof e=="function"&&e(r)})},Rr=(t=[],e=[])=>{let r=[];return e.slice(t.length).forEach(i=>{let s=c=>{let a=V(i);return c.appendChild(a),c};r.push(s)}),r},Ar=(t=[],e=[])=>{let r=[];return t.forEach((o,i)=>{let s=re(o,e[i]);r.push(s)}),r},Lr=(t=[],e=[])=>{let r=Ar(t,e),o=Rr(t,e);return i=>{if(i){let s=Dt(r,i.childNodes);Cr(s),vr(o,i)}return i}},te=Lr;var Pt={select:(t,e)=>r=>{let o=r.value;r.replaceChildren(),ee(t.attributes,e.attributes)(r),te([],e.children)(r);let i=r.querySelector(`option[value="${o}"]`);if(i&&(r.value=o),!i){let s=r.querySelector("option");r.value=s?.value||""}return r}};var me=(t,e)=>r=>{let o=t?V(t):null;return r&&r.replaceWith(o),o},_r=()=>t=>{t&&t.remove()},jr=(t=void 0,e=void 0)=>t===void 0||e===void 0?_r():typeof t=="string"||typeof e=="string"?me(e,t):t.tagName!==e.tagName?me(e):e.tagName==="select"?Pt.select(t,e):["pre","code"].includes(e.tagName)?me(e,t):i=>(ee(t.attributes,e.attributes)(i),te(t.children,e.children)(i),i),re=jr;var Dr=(t="")=>{try{let[e,r]=t?.split(".");return r?window?.joystick?._internal?.queues[e][r]:window?.joystick?._internal?.queues[e]}catch(e){n("processQueue.getQueue",e)}},z=(t="",e=null)=>{try{S()||(Dr(t)||{}).process(e)}catch(r){n("processQueue",r)}};var It=(t="",e=null)=>{let r=R(e||window.joystick._internal.tree,t,"instanceId");r&&(r.children=[])};var Nt=(t="",e={},r=null)=>{let o=R(r||window.joystick._internal.tree,t,"instanceId");o&&(o.instanceId=e?.instanceId,o.instance=e)};var Vt=(t={},e="",r={})=>{for(let o=0;o<t?.children?.length;o+=1){let i=t?.children[o];if(u(i)&&i.attributes&&i.attributes["js-i"]&&i.attributes["js-i"]===e){t.children[o]=r;break}u(i)&&Vt(i,e,r)}},Ut=Vt;var qt=(t={})=>{try{return Object.entries(t).map(([e,r])=>{let[o,...i]=e.split(" ");return{type:o.toLowerCase(),selector:i.join(" "),handler:r}})}catch(e){n("component.events.serialize",e)}};var Ht=(t={},e={},r=[])=>{try{let o=Object.keys(t?.events||{})?.length>0?qt(t?.events):[];for(let i=0;i<o?.length;i+=1){let s=o[i];r.push({...s,instance:t,elements:document.querySelectorAll(`body [js-i="${t.instanceId}"] ${s?.selector}`),handler:function(a){s.handler(a,{...t||{},setState:t?.setState.bind(t),...e||{}})}})}if(t?.children){let i=Object.entries(t?.children)?.flatMap(([s,c])=>c);for(let s=0;s<i?.length;s+=1){let c=i[s];Ht(c,e,r)}}return r}catch(o){n("component.eve!nts.registerListenersFix.getListeners",o)}},Pr=(t={},e={})=>{try{let o=Ht(t,e,[])?.flatMap((i={})=>[].flatMap.call(i?.elements||[],s=>{let{elements:c=[],...a}=i||{};return{...a,element:s}}));for(let i=0;i<o?.length;i+=1){let{instance:s,element:c,elementSelector:a,type:m,handler:y}=o[i];c.addEventListener(m,y),s._eventListeners=[...s?._eventListeners||[],{instance:s,element:c,elementSelector:a,type:m,handler:y}]}}catch(r){n("component.events.registerListenersFix",r)}},zt=Pr;var Zt=(t={})=>{try{let e=t?._eventListeners||[];if(t?.children){let o=(Object.values(t?.children||{})?.reduce((i=[],s=[])=>[...i,...s],[])).flatMap((i={})=>Zt(i));e=[...e,...o]}return e}catch(e){n("component.events.unregisterListenersFix.getListeners",e)}},Ir=(t={})=>{try{let e=Zt(t);for(let r=0;r<e?.length;r+=1){let{instance:o,element:i,type:s,handler:c}=e[r];i.removeEventListener(s,c),o._eventListeners=o._eventListeners?.splice(r,1)}}catch(e){n("component.events.unregisterListenersFix",e)}},Bt=Ir;var Gt=class{constructor(e={}){this.parent=e?.parent||null,this.onUpdateChildComponent=this.handleUpdateChildComponentInVDOM,this.updateVirtualDOM=this.handleUpdateVirtualDOM,this.timers={},this.children={},Te(e),lt(this,e),this.data=yt(this)}setDOMNodeOnInstance(){this.DOMNode=document.querySelector(`body [js-i="${this.instanceId}"]`)}async handleFetchData(e={},r={},o={},i=this){let s=await Q(e,r,o,i);return this.data=s,s}handleGetInstance(){return this}handleUpdateVirtualDOM(){if(this.DOMNode){let r=H(this.DOMNode);this.dom.virtual=r}let e=this.parent?R(window.joystick._internal.tree,this.parent?.instanceId,"instanceId"):null;e?.instance&&e.instance.updateVirtualDOM()}onBeforeRender(){if(!S())return{instanceId:this.instanceId}}render(e={}){if(e?.mounting)return jt(this,e);let r=this.onBeforeRender();Bt(this),It(this.instanceId);let o=N(this,{}),i=re(this.dom.virtual,o.virtual);i&&l(i)&&z("lifecycle.onBeforeMount",()=>{let s=i(this.DOMNode);this.dom.actual=s,this.dom.virtual=o.virtual,zt(this,this.renderMethods),this.setDOMNodeOnInstance(),z("domNodes",()=>{z("lifecycle.onMount",()=>{this.onAfterRender(r,e)})})})}renderToHTML(e={}){return X(this,e)}onAfterRender(e={},r={}){S()||(Nt(e.instanceId,this),window.joystick._internal.css.update(),z("lifecycle.onUpdateProps"),r?.afterSetStateRender&&l(r.afterSetStateRender)&&r.afterSetStateRender(),r?.afterRefetchDataRender&&l(r.afterRefetchDataRender)&&r.afterRefetchDataRender(),this.parent&&this.parent.onUpdateChildComponent(this.id,this.instanceId))}setState(e={},r=null){this.state=G(this,{...this.state||{},...e}),this.render({afterSetStateRender:()=>{r&&l(r)&&r()}})}setTimeout(e=null,r=0){e&&(this.timers[U()]=window.setTimeout(e,r))}setInterval(e=null,r=0){e&&(this.timers[U()]=window.setInterval(e,r))}handleUpdateChildComponentInVDOM(e="",r=""){let o=R(window.joystick._internal.tree,this.instanceId,"instanceId"),i=R(window.joystick._internal.tree,r,"instanceId");if(i?.instance?.DOMNode){let s=H(i?.instance?.DOMNode);Ut(o?.instance?.dom?.virtual,i?.instanceId,s)}}},Xa=Gt;export{Xa as default};
21
+ `}}return r}return""}catch(r){n("component.css.compileCSS",r)}};var sr=(t={},e=null)=>{try{let r=e(t);return r&&u(r)&&!D(r)?Object.assign({},r):{}}catch(r){n("component.state.compile.compileState",r)}},G=(t={},e={})=>{try{return l(e)?sr(t,e):Object.assign({},e)}catch(r){n("component.state.compile",r)}};var ie={onBeforeMount:()=>null,onMount:()=>null,onBeforeUnmount:()=>null,onUpdateProps:()=>null,onRefetchData:()=>null};var at=(t={},e={})=>{try{return e?Object.entries({...ie,...e||{}}).reduce((r={},[o,i])=>(r[o]=()=>i({...t,setState:t.setState.bind(t),...t.renderMethods||{}}),r),{}):ie}catch(r){n("component.lifecycle.compile",r)}};var K=(t={},e={})=>{try{return Object.entries(e).reduce((r={},[o,i])=>(r[o]=(...s)=>i(...s,{...t,setState:t.setState.bind(t),...t.renderMethods||{}}),r),{})}catch{n("component.methods.compile")}};var ne=(t={})=>{try{return{...t,query:{...t?.query||{},set:(e="",r="")=>{if(typeof window!="undefined"){let o=new URL(window.location);o.searchParams.append(e,r),window.history.pushState({},"",o)}},unset:(e="")=>{if(typeof window!="undefined"){let r=new URL(window.location);r.searchParams.delete(e),window.history.pushState({},"",r)}}},isActive:(e="")=>C(e)&&t?.route!=="*"?e===(typeof location!="undefined"?location.pathname:t.path):!1}}catch(e){n("component.url.compile",e)}};var S=()=>typeof window=="undefined";var P=null,W=0,dt=(t={},e=null)=>{try{let r=t?.url;t?.query&&(r=`${r}?${new URLSearchParams(t.query).toString()}`);let o=new WebSocket(r);P&&(clearInterval(P),P=null);let i={client:o,send:(s={})=>o.send(JSON.stringify(s))};return o.addEventListener("open",()=>{t?.options?.logging&&console.log(`[joystick.websockets] Connected to ${t?.url}`),t?.events?.onOpen&&t.events.onOpen(i),W=0}),o.addEventListener("message",s=>{s?.data&&t?.events?.onMessage&&t.events.onMessage(JSON.parse(s.data||{}),i)}),o.addEventListener("close",s=>{t?.options?.logging&&console.log(`[joystick.websockets] Disconnected from ${t?.url}`),t?.events?.onClose&&t.events.onClose(s?.code,s?.reason,i),o=null;let c=[1e3,1001].includes(s?.code);t?.options?.autoReconnect&&!P&&!c&&(P=setInterval(()=>{o=null,W<(t?.options?.reconnectAttempts||12)?(dt(t,e),t?.options?.logging&&console.log(`[joystick.websockets] Attempting to reconnect (${W+1}/12)...`),W+=1):clearInterval(P)},t?.options?.reconnectDelayInSeconds*1e3||5e3))}),e&&e(i),i}catch(r){n("websockets.client",r)}},ct=dt;var ar=(t={},e=null)=>{try{let r=e(t);return r&&u(r)&&!D(r)?Object.assign({},r):{}}catch(r){n("component.props.compileDefaultProps.compile",r)}},lt=(t={},e={})=>{try{return l(e)?ar(t,e):Object.assign({},e)}catch(r){n("component.props.compileDefaultProps",r)}};var mt=(t={},e={})=>{try{t.options=e||{},t.id=e?._componentId||null,t.instanceId=U(8),t.ssrId=e?._ssrId||null,t.css=st(),t.data=B(e?.dataFromSSR,e?._componentId),t.defaultProps=lt(t,e?.defaultProps),t.props=nt(t?.defaultProps,e?.props),t.state=G(t,e?.state),t.events=e?.events||{},t.lifecycle=at(t,e?.lifecycle),t.methods=K(t,e?.methods),t.wrapper=e?.wrapper||{},t.translations=e?.translations||{},t.validateForm=it,t.DOMNode=null,t.dom={},t.dom.virtual={},t.dom.actual={};let r=!S();if(r||(t.url=ne(e?.url)),r&&window.__joystick_url__&&(t.url=ne(window.__joystick_url__)),r&&e?.websockets&&l(e?.websockets)){let o=e.websockets(t),i=u(o)&&Object.entries(o);for(let s=0;s<i?.length;s+=1){let[c,a]=i[s];ct({url:`${window?.process?.env.NODE_ENV==="development"?"ws":"wss"}://${location.host}/api/_websockets/${c}`,options:a?.options||{},query:a?.query||{},events:a?.events||{}},(m={})=>{t.websockets={...t.websockets||{},[c]:m}})}}}catch(r){n("component.registerOptions",r)}};var I=(t="",e=[])=>{try{console.error(`${t} failed with the following errors:`),e.forEach(r=>{console.log(r.message),r.stack&&console.log(r.stack)})}catch(r){n(t,r)}};var J=(t="{}")=>{try{return JSON.parse(t)}catch{return t}};var pt=(t={})=>Object.entries(t).map(([e,r])=>`${e}=${r}`)?.join("; ");var dr=async(t={})=>{try{let e=await t.text();return J(e)}catch(e){n("api.get.handleParseResponse",e)}},ut=(t="",e={})=>{try{return typeof window.fetch!="undefined"&&!e?.skip?new Promise((r,o)=>{let i=e.input?JSON.stringify(e.input):null,s=e.output?JSON.stringify(e.output):null,c=`${window.location.origin}/api/_getters/${t}?input=${i}&output=${s}`,a=document.querySelector('[name="csrf"]')?.getAttribute("content"),m={...e?.headers||{},"x-joystick-csrf":a};return window?.__joystick_test__&&(m.Cookie=pt({joystickLoginToken:window.__joystick_test_login_token__,joystickLoginTokenExpiresAt:window.__joystick_test_login_token_expires_at__})),fetch(c,{method:"GET",mode:"cors",headers:m,credentials:"include"}).then(async y=>{let w=await dr(y);return w?.errors?(I("get request",w.errors),o(w)):r(w)}).catch(y=>(I("get request",[y]),o({errors:[y]})))}):Promise.resolve()}catch(r){n("get request",r)}};var cr=async(t={})=>{try{let e=await t.text();return J(e)}catch(e){n("api.set.handleParseResponse",e)}},lr=(t={})=>{try{return JSON.stringify(t)}catch(e){n("api.set.getBody",e)}},ft=(t="",e={})=>{try{return typeof window.fetch!="undefined"?new Promise((r,o)=>{let i=`${window.location.origin}/api/_setters/${t}`,s=lr(e),c=document.querySelector('[name="csrf"]')?.getAttribute("content"),a={...e?.headers||{},"Content-Type":"application/json","x-joystick-csrf":c};return window?.__joystick_test__&&(a.Cookie=generateCookieHeader({joystickLoginToken:window?.__joystick_test_login_token__,joystickLoginTokenExpiresAt:window.__joystick_test_login_token_expirs_at__})),fetch(i,{method:"POST",mode:"cors",headers:a,body:s,credentials:"include"}).then(async m=>{let y=await cr(m);return y?.errors?(I("set request",y.errors),o(y)):r(y)}).catch(m=>(I("set request",[m]),o({errors:[m]})))}):Promise.resolve()}catch(r){n("set request",r)}};var ht={get:ut,set:ft};var mr=(t="")=>{try{let[e,r]=t?.split(".");return r?window?.joystick?._internal?.queues[e][r]:window?.joystick?._internal?.queues[e]}catch(e){n("addToQueue.getQueue",e)}},q=(t="",e=null)=>{try{S()||(mr(t)||{}).array.push({callback:e})}catch(r){n("addToQueue",r)}};var Q=async(t={},e={},r={},o={})=>{try{if(o?.options?.data&&l(o.options.data)){let i=await o.options.data(t,e,r,o);return Promise.resolve(i)}return Promise.resolve()}catch(i){n("component.data.fetch",i)}};var wt=(t={},e={},r={})=>{try{return{...t,refetch:async(o={})=>{let i=await Q(ht,e,o,r);return r.data=wt(i,e,r),window.__joystick_data__[r?.id]&&(window.__joystick_data__[r?.id]=i),window?.__joystick_test__||r.render({afterRefetchDataRender:()=>{r?.lifecycle?.onRefetchData&&r?.lifecycle?.onRefetchData(r)}}),r.data}}}catch(o){n("component.data.compile",o)}},yt=wt;var xt=(t={})=>{try{if(!S()){let e=window.__joystick_data__&&window.__joystick_data__[t?.id]||{},r=window.__joystick_req__||{};return yt(e,r,t)}return t?.data||{}}catch(e){n("component.loadDataFromWindow",e)}};var Ft=ir(gt());var bt=(t={},e="",r="id")=>{try{let o=t&&t.id;if(u(t)&&o){let i=Object.keys(t);for(let s=0;s<i.length;s+=1){let c=i[s],a=t[c];if(c===r&&a===e)return t;if(c==="children"&&Array.isArray(a))for(let m=0;m<a.length;m+=1){let y=a[m],w=bt(y,e,r);if(w!==null)return w}}}return null}catch(o){n("component.findComponentInTreeByField",o)}},R=bt;var $t=(t="",e={},r=null)=>{let o=R(r||window.joystick._internal.tree,t,"instanceId");o&&(o.children=[...o.children||[],e])};var pr=(t={},e={},r=null)=>{try{let o=N(t,{includeActual:!0,existingChildren:r});return t.dom=o,t.setDOMNodeOnInstance(),e.renderedComponent=t,o.html.wrapped}catch(o){n("component.renderMethods.component.renderForClient",o)}},ur=(t={})=>{try{return t.renderToHTML({ssrTree:t.parent.ssrTree,translations:t.parent.translations,walkingTreeForSSR:t?.parent?.walkingTreeForSSR,dataFromSSR:t.parent?.dataFromSSR}).wrapped}catch(e){n("component.renderMethods.component.renderToHTMLForSSR",e)}},fr=(t={})=>{try{return t.parent.ssrTree.dataFunctions.push(async()=>{try{let e=await t.options.data(t.parent.options.api,t.parent.options.req);return t.data=e||{},{componentId:t.id,ssrId:t.ssrId,data:e}}catch(e){return{componentId:t.id,ssrId:t.ssrId,data:null,error:e}}}),t.renderToHTML({ssrTree:t?.parent?.ssrTree,translations:t?.parent?.translations,walkingTreeForSSR:t?.parent?.walkingTreeForSSR,dataFromSSR:t?.parent?.dataFromSSR})}catch(e){n("component.renderMethods.component.collectDataFunctionsForSSR",e)}},hr=(t={})=>{try{let e={id:t.id,instanceId:t.instanceId,instance:t,children:[]};$t(t.parent.instanceId,e,t.parent&&t.parent.ssrTree||null)}catch(e){n("component.renderMethods.component.handleAddComponentToParent",e)}},wr=(t={},e={})=>{try{!t.renderedComponent&&e.options&&e.options.lifecycle&&(e.options.lifecycle.onBeforeMount&&q("lifecycle.onBeforeMount",()=>{e.options.lifecycle.onBeforeMount(e)}),!t.renderedComponent&&e.options.lifecycle.onMount&&q("lifecycle.onMount",()=>{e.options.lifecycle.onMount(e)}))}catch(r){n("component.renderMethods.component.handleLifecycle",r)}},yr=(t={},e={},r={})=>{try{!e.walkingTreeForSSR&&t?.options?.lifecycle?.onUpdateProps&&(0,Ft.diff)(e?.existingPropsMap,r)?.length>0&&q("lifecycle.onUpdateProps",()=>{let i=e?.existingPropsMap&&e?.existingPropsMap[t.id];t.options.lifecycle.onUpdateProps(i||{},r,t)})}catch(o){n("component.renderMethods.component.handleOnChangeProps",o)}},xr=function(){return function(e=null,r={},o={}){let i=e({props:r,url:o.url,translations:o.translations,api:o.options.api,req:o.options.req,dataFromSSR:o?.dataFromSSR,parent:o}),s=o?.existingStateMap[i.id]||{},c=o.children[i.id]||[],a=s[c?.length];return i.state=a?.state||i.state,o.children[i.id]=[...o.children[i.id]||[],i],i.parent=o,yr(i,o,r),q("lifecycle.onMount",()=>{i.setDOMNodeOnInstance()}),wr(this,i),i.parent&&hr(i),i.options.data&&i.parent.walkingTreeForSSR&&i.parent.ssrTree.dataFunctions?fr(i):i.parent&&i.parent.ssrTree?ur(i):pr(i,this,a?.children)}},gr=function(e,r){try{let o=this;return new xr().bind({})(e,r,o)}catch(o){n("component.renderMethods.component",o)}},se=gr;var br=function(e=[],r=null){try{return l(r)&&e&&Array.isArray(e)?e.map((o,i)=>r(o,i)).join(""):""}catch(o){n("component.renderMethods.each",o)}},ae=br;var $r=(t="",e=[])=>{try{return e.reduce((r,[o,i])=>r.replace(`{{${o}}}`,i),t)}catch(r){n("component.renderMethods.i18n.replacePlaceholdersInString",r)}},de=(t="",e=[])=>{try{let r=typeof t=="string",o=Array.isArray(t),i=typeof t=="object"&&!o;if(r)return $r(t,e);if(o)return t?.map(s=>de(s,e));if(i)return Object.entries(t)?.reduce((s={},[c,a])=>(s[c]=de(a,e),s),{})}catch(r){n("component.renderMethods.i18n.handleTranslationReplacement",r)}},Fr=(t="",e={})=>{try{return t?.split(".").reduce((r,o)=>r[o],e)}catch(r){n("component.renderMethods.i18n.getTranslationAtPath",r)}},Er=function(t="",e={}){try{let r=S()?this.translations:window.__joystick_i18n__,i=t?.includes(".")?Fr(t,r):r[t];if(!r||!i)return"";let s=Object.entries(e);return de(i,s)}catch(r){n("component.renderMethods.i18n",r)}},ce=Er;var kr=function(e=!1,r=""){try{return this?.renderingHTMLWithDataForSSR||e?`<when>${r.trim()}</when>`:"<when> </when>"}catch(o){n("component.renderMethods.when",o)}},le=kr;var Et={c:se,component:se,e:ae,each:ae,i:ce,i18n:ce,w:le,when:le};var kt=(t={},e={})=>{try{return Object.entries(Et).reduce((r,[o,i])=>(r[o]=i.bind({...t,...e}),r),{})}catch(r){n("component.renderMethods.compile",r)}};var Mt=(t={})=>{try{return Object.entries(t)?.reduce((e={},[r,o]={})=>(e[r]=o?.map((i={})=>({state:i?.state,children:Mt(i?.children)})),e),{})}catch(e){n("component.render.getExistingStateMap.buildMapForChildren",e)}},St=(t={})=>{try{return Mt(t)}catch(e){n("component.render.getExistingStateMap",e)}};var Ot=new RegExp(/\<\!\-\-(?:.|\n|\r)*?-->/g),Mr=new RegExp(/\n/g);var Sr=(t="")=>{try{return(t.match(Ot)||[]).forEach(r=>{t=t.replace(r,"")}),t}catch(e){n("component.render.sanitizeHTML.removeCommentedCode",e)}},Tt=(t="")=>{try{let e=`${t}`;return e=Sr(e),e}catch(e){n("component.render.sanitizeHTML",e)}};var vt=(t={},e="")=>{try{let{wrapper:r=null,id:o=null,instanceId:i=null}=t;return`<div ${r?.id?`id="${r.id}" `:""}${r?.classList?`class="${r.classList?.join(" ")}" `:""} js-c="${o}" js-i="${i}">${e}</div>`}catch(r){n("component.render.wrapHTML",r)}};var Ct=(t={},e=[])=>{try{let r=[...e],o=Object.entries(t);for(let i=0;i<o?.length;i+=1){let[s,c]=o[i];for(let a=0;a<c?.length;a+=1){let m=c[a];Object.entries(m?.timers)?.length>0&&r.push(...Object.values(m?.timers)),Object.entries(m?.children)?.length>0&&Ct(m?.children,r)}}if(r?.length>0)for(let i=0;i<r?.length;i+=1)clearTimeout(r[i])}catch(r){n("component.render.clearTimersOnChildren",r)}},Rt=Ct;var X=(t={},e={})=>{try{e?.dataFromSSR&&(t.data=B(e.dataFromSSR,t.id)||{}),Rt(t?.children);let r=St(e?.existingChildren||t?.children)||{};t.children={},t.renderMethods=kt({...t,existingStateMap:r,translations:e?.translations||t.translations||{},ssrTree:e?.ssrTree,walkingTreeForSSR:e?.walkingTreeForSSR,renderingHTMLWithDataForSSR:e?.renderingHTMLWithDataForSSR,dataFromSSR:e?.dataFromSSR}),t.methods=K(t,t.options.methods);let o=t.options.render({...t||{},setState:t.setState.bind(t),...t.renderMethods||{}}),i=Tt(o),s=vt(t,i);return{unwrapped:i,wrapped:s}}catch(r){n("component.render.toHTML",r)}};var Or=(t={})=>{try{return Object.values(t).reduce((e={},r)=>(e[r.name]=r.value,e),{})}catch(e){n("component.virtualDOM.build.parseAttributeMap",e)}},At=(t={})=>{try{return t.tagName==="WHEN"?[].flatMap.call(t?.childNodes,e=>e?.tagName==="WHEN"?At(e):me(e)):me(t)}catch(e){n("component.virtualDOM.build.flattenWhenTags",e)}},me=(t={})=>{try{let e=t&&t.tagName&&t.tagName.toLowerCase()||"text",r={tagName:e,attributes:Or(t.attributes),children:[].flatMap.call(t.childNodes,o=>At(o))};return e==="text"&&(r=t.textContent),r}catch(e){n("component.virtualDOM.build",e)}},H=me;var Tr=(t="")=>{try{let e=document.createElement("div");return e.innerHTML=t,e?.childNodes[0]}catch(e){n("component.virtualDOM.build.convertHTMLToDOM",e)}},Lt=(t="")=>{try{let e=Tr(t);return H(e)}catch(e){n("component.virtualDOM.build",e)}};var jt=(t="")=>{try{return document.createElement("div").setAttribute(t,"Test"),!0}catch{return!1}};var vr=(t={})=>{try{let e=document.createElement(t.tagName),r=Object.entries(t.attributes);for(let o=0;o<r.length;o+=1){let[i,s]=r[o];jt(i)&&e.setAttribute(i,s)}for(let o=0;o<t?.children?.length;o+=1){let i=t?.children[o];if(i){let s=Dt(i);e.appendChild(s)}}return e}catch(e){n("component.virtualDOM.renderTreeToDOM.renderElement",e)}},Dt=(t=null)=>{try{return C(t)?document.createTextNode(t):vr(t)}catch(e){n("component.virtualDOM.renderTreeToDOM",e)}},V=Dt;var N=(t={},e={})=>{try{let r=X(t,{existingChildren:e?.existingChildren}),o=Lt(r.wrapped,t),i=e.includeActual&&o?V(o):null;return{html:r,virtual:o,actual:i}}catch(r){n("component.render.getUpdatedDOM",r)}};var _t=(t={},e={})=>{try{let r=N(t,{includeActual:!0,existingChildren:e?.existingChildren});return t.dom=r,r.actual}catch(r){n("component.render.forMount",r)}};var Cr=(t={},e={})=>{let r=[];for(let[o,i]of Object.entries(e))r.push(s=>(s&&s.setAttribute&&s.setAttribute(o,i),s));for(let o in t)o in e||r.push(i=>(i&&i.removeAttribute&&i.removeAttribute(o),i));return o=>{for(let i of r)i&&typeof i=="function"&&i(o)}},ee=Cr;var Rr=(t=[],e=[])=>{let r=[],o=Math.max(t.length,e.length);for(let i=0;i<o;i+=1){let s=t[i],c=e[i];r.push([s,c])}return r},Pt=Rr;var Ar=(t=[],e)=>{t.forEach(r=>{r&&typeof r=="function"&&r(e)})},Lr=(t=[])=>{t.forEach(([e,r])=>{e&&typeof e=="function"&&e(r)})},jr=(t=[],e=[])=>{let r=[];return e.slice(t.length).forEach(i=>{let s=c=>{let a=V(i);return c.appendChild(a),c};r.push(s)}),r},Dr=(t=[],e=[])=>{let r=[];return t.forEach((o,i)=>{let s=re(o,e[i]);r.push(s)}),r},_r=(t=[],e=[])=>{let r=Dr(t,e),o=jr(t,e);return i=>{if(i){let s=Pt(r,i.childNodes);Lr(s),Ar(o,i)}return i}},te=_r;var It={select:(t,e)=>r=>{let o=r.value;r.replaceChildren(),ee(t.attributes,e.attributes)(r),te([],e.children)(r);let i=r.querySelector(`option[value="${o}"]`);if(i&&(r.value=o),!i){let s=r.querySelector("option");r.value=s?.value||""}return r}};var pe=(t,e)=>r=>{let o=t?V(t):null;return r&&r.replaceWith(o),o},Pr=()=>t=>{t&&t.remove()},Ir=(t=void 0,e=void 0)=>t===void 0||e===void 0?Pr():typeof t=="string"||typeof e=="string"?pe(e,t):t.tagName!==e.tagName?pe(e):e.tagName==="select"?It.select(t,e):["pre","code"].includes(e.tagName)?pe(e,t):i=>(ee(t.attributes,e.attributes)(i),te(t.children,e.children)(i),i),re=Ir;var Nr=(t="")=>{try{let[e,r]=t?.split(".");return r?window?.joystick?._internal?.queues[e][r]:window?.joystick?._internal?.queues[e]}catch(e){n("processQueue.getQueue",e)}},z=(t="",e=null)=>{try{S()||(Nr(t)||{}).process(e)}catch(r){n("processQueue",r)}};var Nt=(t="",e=null)=>{let r=R(e||window.joystick._internal.tree,t,"instanceId");r&&(r.children=[])};var Vt=(t="",e={},r=null)=>{let o=R(r||window.joystick._internal.tree,t,"instanceId");o&&(o.instanceId=e?.instanceId,o.instance=e)};var Ut=(t={},e="",r={})=>{for(let o=0;o<t?.children?.length;o+=1){let i=t?.children[o];if(u(i)&&i.attributes&&i.attributes["js-i"]&&i.attributes["js-i"]===e){t.children[o]=r;break}u(i)&&Ut(i,e,r)}},qt=Ut;var Ht=(t={})=>{try{return Object.entries(t).map(([e,r])=>{let[o,...i]=e.split(" ");return{type:o.toLowerCase(),selector:i.join(" "),handler:r}})}catch(e){n("component.events.serialize",e)}};var zt=(t={},e={},r=[])=>{try{let o=Object.keys(t?.events||{})?.length>0?Ht(t?.events):[];for(let i=0;i<o?.length;i+=1){let s=o[i];r.push({...s,instance:t,elements:document.querySelectorAll(`body [js-i="${t.instanceId}"] ${s?.selector}`),handler:function(a){s.handler(a,{...t||{},setState:t?.setState.bind(t),...e||{}})}})}if(t?.children){let i=Object.entries(t?.children)?.flatMap(([s,c])=>c);for(let s=0;s<i?.length;s+=1){let c=i[s];zt(c,e,r)}}return r}catch(o){n("component.eve!nts.registerListenersFix.getListeners",o)}},Vr=(t={},e={})=>{try{let o=zt(t,e,[])?.flatMap((i={})=>[].flatMap.call(i?.elements||[],s=>{let{elements:c=[],...a}=i||{};return{...a,element:s}}));for(let i=0;i<o?.length;i+=1){let{instance:s,element:c,elementSelector:a,type:m,handler:y}=o[i];c.addEventListener(m,y),s._eventListeners=[...s?._eventListeners||[],{instance:s,element:c,elementSelector:a,type:m,handler:y}]}}catch(r){n("component.events.registerListenersFix",r)}},Zt=Vr;var Bt=(t={})=>{try{let e=t?._eventListeners||[];if(t?.children){let o=(Object.values(t?.children||{})?.reduce((i=[],s=[])=>[...i,...s],[])).flatMap((i={})=>Bt(i));e=[...e,...o]}return e}catch(e){n("component.events.unregisterListenersFix.getListeners",e)}},Ur=(t={})=>{try{let e=Bt(t);for(let r=0;r<e?.length;r+=1){let{instance:o,element:i,type:s,handler:c}=e[r];i.removeEventListener(s,c),o._eventListeners=o._eventListeners?.splice(r,1)}}catch(e){n("component.events.unregisterListenersFix",e)}},Gt=Ur;var Kt=class{constructor(e={}){this.parent=e?.parent||null,this.onUpdateChildComponent=this.handleUpdateChildComponentInVDOM,this.updateVirtualDOM=this.handleUpdateVirtualDOM,this.timers={},this.children={},ve(e),mt(this,e),this.data=xt(this)}setDOMNodeOnInstance(){this.DOMNode=document.querySelector(`body [js-i="${this.instanceId}"]`)}async handleFetchData(e={},r={},o={},i=this){let s=await Q(e,r,o,i);return this.data=s,s}handleGetInstance(){return this}handleUpdateVirtualDOM(){if(this.DOMNode){let r=H(this.DOMNode);this.dom.virtual=r}let e=this.parent?R(window.joystick._internal.tree,this.parent?.instanceId,"instanceId"):null;e?.instance&&e.instance.updateVirtualDOM()}onBeforeRender(){if(!S())return{instanceId:this.instanceId}}render(e={}){if(e?.mounting)return _t(this,e);let r=this.onBeforeRender();Gt(this),Nt(this.instanceId);let o=N(this,{}),i=re(this.dom.virtual,o.virtual);i&&l(i)&&z("lifecycle.onBeforeMount",()=>{let s=i(this.DOMNode);this.dom.actual=s,this.dom.virtual=o.virtual,Zt(this,this.renderMethods),this.setDOMNodeOnInstance(),z("domNodes",()=>{z("lifecycle.onMount",()=>{this.onAfterRender(r,e)})})})}renderToHTML(e={}){return X(this,e)}onAfterRender(e={},r={}){S()||(Vt(e.instanceId,this),window.joystick._internal.css.update(),z("lifecycle.onUpdateProps"),r?.afterSetStateRender&&l(r.afterSetStateRender)&&r.afterSetStateRender(),r?.afterRefetchDataRender&&l(r.afterRefetchDataRender)&&r.afterRefetchDataRender(),this.parent&&this.parent.onUpdateChildComponent(this.id,this.instanceId))}setState(e={},r=null){this.state=G(this,{...this.state||{},...e}),this.render({afterSetStateRender:()=>{r&&l(r)&&r()}})}setTimeout(e=null,r=0){e&&(this.timers[U()]=window.setTimeout(e,r))}setInterval(e=null,r=0){e&&(this.timers[U()]=window.setInterval(e,r))}handleUpdateChildComponentInVDOM(e="",r=""){let o=R(window.joystick._internal.tree,this.instanceId,"instanceId"),i=R(window.joystick._internal.tree,r,"instanceId");if(i?.instance?.DOMNode){let s=H(i?.instance?.DOMNode);qt(o?.instance?.dom?.virtual,i?.instanceId,s)}}},rd=Kt;export{rd as default};
@@ -1 +1 @@
1
- var mr=Object.create;var H=Object.defineProperty;var wr=Object.getOwnPropertyDescriptor;var yr=Object.getOwnPropertyNames;var xr=Object.getPrototypeOf,Mr=Object.prototype.hasOwnProperty;var gr=r=>H(r,"__esModule",{value:!0});var Tr=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var Fr=(r,e,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of yr(e))!Mr.call(r,o)&&o!=="default"&&H(r,o,{get:()=>e[o],enumerable:!(t=wr(e,o))||t.enumerable});return r},Or=r=>Fr(gr(H(r!=null?mr(xr(r)):{},"default",r&&r.__esModule&&"default"in r?{get:()=>r.default,enumerable:!0}:{value:r,enumerable:!0})),r);var G=Tr(j=>{(function(r,e){if(typeof define=="function"&&define.amd)define(["exports"],e);else if(typeof j!="undefined")e(j);else{var t={exports:{}};e(t.exports),r.index=t.exports}})(j,function(r){"use strict";function e(a){return e=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(c){return typeof c}:function(c){return c&&typeof Symbol=="function"&&c.constructor===Symbol&&c!==Symbol.prototype?"symbol":typeof c},e(a)}function t(a,c){return c&&(e(c)==="object"||typeof c=="function")?c:o(a)}function o(a){if(a===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return a}function n(a){return n=Object.setPrototypeOf?Object.getPrototypeOf:function(c){return c.__proto__||Object.getPrototypeOf(c)},n(a)}function s(a,c){if(typeof c!="function"&&c!==null)throw new TypeError("Super expression must either be null or a function");a.prototype=Object.create(c&&c.prototype,{constructor:{value:a,writable:!0,configurable:!0}}),c&&m(a,c)}function m(a,c){return m=Object.setPrototypeOf||function(p,g){return p.__proto__=g,p},m(a,c)}function l(a,c){if(!(a instanceof c))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0}),r.diff=void 0;var M=function a(c,p){l(this,a),this.type=c,this.path=p?p.toString():""},k=function(a){function c(p,g,d){var F;return l(this,c),F=t(this,n(c).call(this,"E",p)),F.lhs=g,F.rhs=d,F}return s(c,a),c}(M),C=function(a){function c(p,g,d,F){var f;return l(this,c),f=t(this,n(c).call(this,"M",p)),f.item=g,f.lhsIndex=d,f.rhsIndex=F,f}return s(c,a),c}(M),A=function(a){function c(p,g){var d;return l(this,c),d=t(this,n(c).call(this,"D",p)),d.lhs=g,d}return s(c,a),c}(M),v=function(a){function c(p,g){var d;return l(this,c),d=t(this,n(c).call(this,"A",p)),d.rhs=g,d}return s(c,a),c}(M),S=function(a,c){return a?"".concat(a,".").concat(c):c};r.diff=function(c,p){var g=2<arguments.length&&arguments[2]!==void 0?arguments[2]:{},d=[],F=g.matchKey,f=g.types||["E","A","D","M"],hr=function(h,u,w,b){h.forEach(function(O,y){var T=u.findIndex(function(x){return x[b]===O[b]});-1<T?(-1<f.indexOf("M")&&y!==T&&d.push(new C(w,O,y,T)),R(O,u[T],S(w,T))):-1<f.indexOf("D")&&d.push(new A(w,O))}),u.forEach(function(O,y){var T=h.findIndex(function(x){return O[b]===x[b]});-1<f.indexOf("A")&&T===-1&&d.push(new v(S(w,y),O))})},R=function(h,u,w){var b=Object.prototype.toString.call(h),O=Object.prototype.toString.call(u);if(-1<f.indexOf("E")&&b!==O)return d.push(new k(w,h,u)),!1;if(b==="[object Object]")Object.getOwnPropertyNames(h).forEach(function(x){Object.prototype.hasOwnProperty.call(u,x)?R(h[x],u[x],S(w,x)):-1<f.indexOf("D")&&d.push(new A(S(w,x),h[x]))}),Object.getOwnPropertyNames(u).forEach(function(x){-1<f.indexOf("A")&&!Object.prototype.hasOwnProperty.call(h,x)&&d.push(new v(S(w,x),u[x]))});else if(b!=="[object Array]")-1<f.indexOf("E")&&h!==u&&d.push(new k(w,h,u));else if(F)hr(h,u,w,F);else{var y=h.length-1,T=u.length-1;if(-1<f.indexOf("D"))for(;y>T;)d.push(new A(S(w,y),h[y--]));if(-1<f.indexOf("A"))for(;T>y;)d.push(new v(S(w,T),u[T--]));for(;0<=y;--y)R(h[y],u[y],S(w,y))}};return R(c,p),d}})});var i=(r="",e={})=>{throw new Error(`[joystick${r?`.${r}`:""}] ${e.message||e.reason||e}`)};var $=r=>{try{return!!Array.isArray(r)}catch(e){i("types.isArray",e)}};var q=r=>{try{return typeof r=="function"}catch(e){i("types.isFunction",e)}};var B=r=>{try{return!!(r&&typeof r=="object"&&!Array.isArray(r))}catch(e){i("types.isObject",e)}};var W=r=>{try{return typeof r=="string"}catch(e){i("types.isString",e)}};var z=(r=[],e="")=>{try{return($(r)&&r.find(o=>o?.componentId===e))?.data||{}}catch(t){i("findComponentDataFromSSR",t)}};var X=Or(G());var D=()=>typeof window=="undefined";var Sr=(r="")=>{try{let[e,t]=r?.split(".");return t?window?.joystick?._internal?.queues[e][t]:window?.joystick?._internal?.queues[e]}catch(e){i("addToQueue.getQueue",e)}},E=(r="",e=null)=>{try{D()||(Sr(r)||{}).array.push({callback:e})}catch(t){i("addToQueue",t)}};var Q=(r={},e="",t="id")=>{try{let o=r&&r.id;if(B(r)&&o){let n=Object.keys(r);for(let s=0;s<n.length;s+=1){let m=n[s],l=r[m];if(m===t&&l===e)return r;if(m==="children"&&Array.isArray(l))for(let M=0;M<l.length;M+=1){let k=l[M],C=Q(k,e,t);if(C!==null)return C}}}return null}catch(o){i("component.findComponentInTreeByField",o)}},V=Q;var K=(r="",e={},t=null)=>{let o=V(t||window.joystick._internal.tree,r,"instanceId");o&&(o.children=[...o.children||[],e])};var br=(r={},e={},t=null)=>{try{let o=L(r,{includeActual:!0,existingChildren:t});return r.dom=o,r.setDOMNodeOnInstance(),e.renderedComponent=r,o.html.wrapped}catch(o){i("component.renderMethods.component.renderForClient",o)}},Er=(r={})=>{try{return r.renderToHTML({ssrTree:r.parent.ssrTree,translations:r.parent.translations,walkingTreeForSSR:r?.parent?.walkingTreeForSSR,dataFromSSR:r.parent?.dataFromSSR}).wrapped}catch(e){i("component.renderMethods.component.renderToHTMLForSSR",e)}},kr=(r={})=>{try{return r.parent.ssrTree.dataFunctions.push(async()=>{try{let e=await r.options.data(r.parent.options.api,r.parent.options.req);return r.data=e||{},{componentId:r.id,ssrId:r.ssrId,data:e}}catch(e){return{componentId:r.id,ssrId:r.ssrId,data:null,error:e}}}),r.renderToHTML({ssrTree:r?.parent?.ssrTree,translations:r?.parent?.translations,walkingTreeForSSR:r?.parent?.walkingTreeForSSR,dataFromSSR:r?.parent?.dataFromSSR})}catch(e){i("component.renderMethods.component.collectDataFunctionsForSSR",e)}},Cr=(r={})=>{try{let e={id:r.id,instanceId:r.instanceId,instance:r,children:[]};K(r.parent.instanceId,e,r.parent&&r.parent.ssrTree||null)}catch(e){i("component.renderMethods.component.handleAddComponentToParent",e)}},Rr=(r={},e={})=>{try{!r.renderedComponent&&e.options&&e.options.lifecycle&&(e.options.lifecycle.onBeforeMount&&E("lifecycle.onBeforeMount",()=>{e.options.lifecycle.onBeforeMount(e)}),!r.renderedComponent&&e.options.lifecycle.onMount&&E("lifecycle.onMount",()=>{e.options.lifecycle.onMount(e)}))}catch(t){i("component.renderMethods.component.handleLifecycle",t)}},jr=(r={},e={},t={})=>{try{!e.walkingTreeForSSR&&r?.options?.lifecycle?.onUpdateProps&&(0,X.diff)(e?.existingPropsMap,t)?.length>0&&E("lifecycle.onUpdateProps",()=>{let n=e?.existingPropsMap&&e?.existingPropsMap[r.id];r.options.lifecycle.onUpdateProps(n||{},t,r)})}catch(o){i("component.renderMethods.component.handleOnChangeProps",o)}},Dr=function(){return function(e=null,t={},o={}){let n=e({props:t,url:o.url,translations:o.translations,api:o.options.api,req:o.options.req,dataFromSSR:o?.dataFromSSR,parent:o}),s=o?.existingStateMap[n.id]||{},m=o.children[n.id]||[],l=s[m?.length];return n.state=l?.state||n.state,o.children[n.id]=[...o.children[n.id]||[],n],n.parent=o,jr(n,o,t),E("lifecycle.onMount",()=>{n.setDOMNodeOnInstance()}),Rr(this,n),n.parent&&Cr(n),n.options.data&&n.parent.walkingTreeForSSR&&n.parent.ssrTree.dataFunctions?kr(n):n.parent&&n.parent.ssrTree?Er(n):br(n,this,l?.children)}},Lr=function(e,t){try{let o=this;return new Dr().bind({})(e,t,o)}catch(o){i("component.renderMethods.component",o)}},N=Lr;var Ar=function(e=[],t=null){try{return q(t)&&e&&Array.isArray(e)?e.map((o,n)=>t(o,n)).join(""):""}catch(o){i("component.renderMethods.each",o)}},_=Ar;var vr=function(e="",t={}){try{let o=D()?this.translations:window.__joystick_i18n__;if(!o||!o[e])return"";let n=Object.entries(t);return n.length>0?n.reduce((s,[m,l])=>s.replace(`{{${m}}}`,l),o[e]):o[e]}catch(o){i("component.renderMethods.i18n",o)}},P=vr;var Hr=function(e=!1,t=""){try{return this?.renderingHTMLWithDataForSSR||e?`<when>${t.trim()}</when>`:"<when> </when>"}catch(o){i("component.renderMethods.when",o)}},I=Hr;var J={c:N,component:N,e:_,each:_,i:P,i18n:P,w:I,when:I};var Y=(r={},e={})=>{try{return Object.entries(J).reduce((t,[o,n])=>(t[o]=n.bind({...r,...e}),t),{})}catch(t){i("component.renderMethods.compile",t)}};var Z=(r={},e={})=>{try{return Object.entries(e).reduce((t={},[o,n])=>(t[o]=(...s)=>n(...s,{...r,setState:r.setState.bind(r),...r.renderMethods||{}}),t),{})}catch{i("component.methods.compile")}};var rr=(r={})=>{try{return Object.entries(r)?.reduce((e={},[t,o]={})=>(e[t]=o?.map((n={})=>({state:n?.state,children:rr(n?.children)})),e),{})}catch(e){i("component.render.getExistingStateMap.buildMapForChildren",e)}},er=(r={})=>{try{return rr(r)}catch(e){i("component.render.getExistingStateMap",e)}};var tr=new RegExp(/\<\!\-\-(?:.|\n|\r)*?-->/g),Nr=new RegExp(/\n/g);var _r=(r="")=>{try{return(r.match(tr)||[]).forEach(t=>{r=r.replace(t,"")}),r}catch(e){i("component.render.sanitizeHTML.removeCommentedCode",e)}},or=(r="")=>{try{let e=`${r}`;return e=_r(e),e}catch(e){i("component.render.sanitizeHTML",e)}};var nr=(r={},e="")=>{try{let{wrapper:t=null,id:o=null,instanceId:n=null}=r;return`<div ${t?.id?`id="${t.id}" `:""}${t?.classList?`class="${t.classList?.join(" ")}" `:""} js-c="${o}" js-i="${n}">${e}</div>`}catch(t){i("component.render.wrapHTML",t)}};var ir=(r={},e=[])=>{try{let t=[...e],o=Object.entries(r);for(let n=0;n<o?.length;n+=1){let[s,m]=o[n];for(let l=0;l<m?.length;l+=1){let M=m[l];Object.entries(M?.timers)?.length>0&&t.push(...Object.values(M?.timers)),Object.entries(M?.children)?.length>0&&ir(M?.children,t)}}if(t?.length>0)for(let n=0;n<t?.length;n+=1)clearTimeout(t[n])}catch(t){i("component.render.clearTimersOnChildren",t)}},cr=ir;var ar=(r={},e={})=>{try{e?.dataFromSSR&&(r.data=z(e.dataFromSSR,r.id)||{}),cr(r?.children);let t=er(e?.existingChildren||r?.children)||{};r.children={},r.renderMethods=Y({...r,existingStateMap:t,translations:e?.translations||r.translations||{},ssrTree:e?.ssrTree,walkingTreeForSSR:e?.walkingTreeForSSR,renderingHTMLWithDataForSSR:e?.renderingHTMLWithDataForSSR,dataFromSSR:e?.dataFromSSR}),r.methods=Z(r,r.options.methods);let o=r.options.render({...r||{},setState:r.setState.bind(r),...r.renderMethods||{}}),n=or(o),s=nr(r,n);return{unwrapped:n,wrapped:s}}catch(t){i("component.render.toHTML",t)}};var Pr=(r={})=>{try{return Object.values(r).reduce((e={},t)=>(e[t.name]=t.value,e),{})}catch(e){i("component.virtualDOM.build.parseAttributeMap",e)}},sr=(r={})=>{try{return r.tagName==="WHEN"?[].flatMap.call(r?.childNodes,e=>e?.tagName==="WHEN"?sr(e):U(e)):U(r)}catch(e){i("component.virtualDOM.build.flattenWhenTags",e)}},U=(r={})=>{try{let e=r&&r.tagName&&r.tagName.toLowerCase()||"text",t={tagName:e,attributes:Pr(r.attributes),children:[].flatMap.call(r.childNodes,o=>sr(o))};return e==="text"&&(t=r.textContent),t}catch(e){i("component.virtualDOM.build",e)}},dr=U;var Ir=(r="")=>{try{let e=document.createElement("div");return e.innerHTML=r,e?.childNodes[0]}catch(e){i("component.virtualDOM.build.convertHTMLToDOM",e)}},lr=(r="")=>{try{let e=Ir(r);return dr(e)}catch(e){i("component.virtualDOM.build",e)}};var ur=(r="")=>{try{return document.createElement("div").setAttribute(r,"Test"),!0}catch{return!1}};var Ur=(r={})=>{try{let e=document.createElement(r.tagName),t=Object.entries(r.attributes);for(let o=0;o<t.length;o+=1){let[n,s]=t[o];ur(n)&&e.setAttribute(n,s)}for(let o=0;o<r?.children?.length;o+=1){let n=r?.children[o];if(n){let s=pr(n);e.appendChild(s)}}return e}catch(e){i("component.virtualDOM.renderTreeToDOM.renderElement",e)}},pr=(r=null)=>{try{return W(r)?document.createTextNode(r):Ur(r)}catch(e){i("component.virtualDOM.renderTreeToDOM",e)}},fr=pr;var L=(r={},e={})=>{try{let t=ar(r,{existingChildren:e?.existingChildren}),o=lr(t.wrapped,r),n=e.includeActual&&o?fr(o):null;return{html:t,virtual:o,actual:n}}catch(t){i("component.render.getUpdatedDOM",t)}};var ft=(r={},e={})=>{try{let t=L(r,{includeActual:!0,existingChildren:e?.existingChildren});return r.dom=t,t.actual}catch(t){i("component.render.forMount",t)}};export{ft as default};
1
+ var wr=Object.create;var N=Object.defineProperty;var yr=Object.getOwnPropertyDescriptor;var xr=Object.getOwnPropertyNames;var Mr=Object.getPrototypeOf,gr=Object.prototype.hasOwnProperty;var Tr=r=>N(r,"__esModule",{value:!0});var Fr=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var Or=(r,e,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of xr(e))!gr.call(r,n)&&n!=="default"&&N(r,n,{get:()=>e[n],enumerable:!(t=yr(e,n))||t.enumerable});return r},Sr=r=>Or(Tr(N(r!=null?wr(Mr(r)):{},"default",r&&r.__esModule&&"default"in r?{get:()=>r.default,enumerable:!0}:{value:r,enumerable:!0})),r);var Q=Fr(D=>{(function(r,e){if(typeof define=="function"&&define.amd)define(["exports"],e);else if(typeof D!="undefined")e(D);else{var t={exports:{}};e(t.exports),r.index=t.exports}})(D,function(r){"use strict";function e(a){return e=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(c){return typeof c}:function(c){return c&&typeof Symbol=="function"&&c.constructor===Symbol&&c!==Symbol.prototype?"symbol":typeof c},e(a)}function t(a,c){return c&&(e(c)==="object"||typeof c=="function")?c:n(a)}function n(a){if(a===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return a}function o(a){return o=Object.setPrototypeOf?Object.getPrototypeOf:function(c){return c.__proto__||Object.getPrototypeOf(c)},o(a)}function s(a,c){if(typeof c!="function"&&c!==null)throw new TypeError("Super expression must either be null or a function");a.prototype=Object.create(c&&c.prototype,{constructor:{value:a,writable:!0,configurable:!0}}),c&&m(a,c)}function m(a,c){return m=Object.setPrototypeOf||function(p,g){return p.__proto__=g,p},m(a,c)}function l(a,c){if(!(a instanceof c))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0}),r.diff=void 0;var M=function a(c,p){l(this,a),this.type=c,this.path=p?p.toString():""},k=function(a){function c(p,g,d){var F;return l(this,c),F=t(this,o(c).call(this,"E",p)),F.lhs=g,F.rhs=d,F}return s(c,a),c}(M),C=function(a){function c(p,g,d,F){var h;return l(this,c),h=t(this,o(c).call(this,"M",p)),h.item=g,h.lhsIndex=d,h.rhsIndex=F,h}return s(c,a),c}(M),A=function(a){function c(p,g){var d;return l(this,c),d=t(this,o(c).call(this,"D",p)),d.lhs=g,d}return s(c,a),c}(M),v=function(a){function c(p,g){var d;return l(this,c),d=t(this,o(c).call(this,"A",p)),d.rhs=g,d}return s(c,a),c}(M),S=function(a,c){return a?"".concat(a,".").concat(c):c};r.diff=function(c,p){var g=2<arguments.length&&arguments[2]!==void 0?arguments[2]:{},d=[],F=g.matchKey,h=g.types||["E","A","D","M"],mr=function(f,u,w,b){f.forEach(function(O,y){var T=u.findIndex(function(x){return x[b]===O[b]});-1<T?(-1<h.indexOf("M")&&y!==T&&d.push(new C(w,O,y,T)),j(O,u[T],S(w,T))):-1<h.indexOf("D")&&d.push(new A(w,O))}),u.forEach(function(O,y){var T=f.findIndex(function(x){return O[b]===x[b]});-1<h.indexOf("A")&&T===-1&&d.push(new v(S(w,y),O))})},j=function(f,u,w){var b=Object.prototype.toString.call(f),O=Object.prototype.toString.call(u);if(-1<h.indexOf("E")&&b!==O)return d.push(new k(w,f,u)),!1;if(b==="[object Object]")Object.getOwnPropertyNames(f).forEach(function(x){Object.prototype.hasOwnProperty.call(u,x)?j(f[x],u[x],S(w,x)):-1<h.indexOf("D")&&d.push(new A(S(w,x),f[x]))}),Object.getOwnPropertyNames(u).forEach(function(x){-1<h.indexOf("A")&&!Object.prototype.hasOwnProperty.call(f,x)&&d.push(new v(S(w,x),u[x]))});else if(b!=="[object Array]")-1<h.indexOf("E")&&f!==u&&d.push(new k(w,f,u));else if(F)mr(f,u,w,F);else{var y=f.length-1,T=u.length-1;if(-1<h.indexOf("D"))for(;y>T;)d.push(new A(S(w,y),f[y--]));if(-1<h.indexOf("A"))for(;T>y;)d.push(new v(S(w,T),u[T--]));for(;0<=y;--y)j(f[y],u[y],S(w,y))}};return j(c,p),d}})});var i=(r="",e={})=>{throw new Error(`[joystick${r?`.${r}`:""}] ${e.message||e.reason||e}`)};var q=r=>{try{return!!Array.isArray(r)}catch(e){i("types.isArray",e)}};var B=r=>{try{return typeof r=="function"}catch(e){i("types.isFunction",e)}};var W=r=>{try{return!!(r&&typeof r=="object"&&!Array.isArray(r))}catch(e){i("types.isObject",e)}};var z=r=>{try{return typeof r=="string"}catch(e){i("types.isString",e)}};var G=(r=[],e="")=>{try{return(q(r)&&r.find(n=>n?.componentId===e))?.data||{}}catch(t){i("findComponentDataFromSSR",t)}};var J=Sr(Q());var R=()=>typeof window=="undefined";var br=(r="")=>{try{let[e,t]=r?.split(".");return t?window?.joystick?._internal?.queues[e][t]:window?.joystick?._internal?.queues[e]}catch(e){i("addToQueue.getQueue",e)}},E=(r="",e=null)=>{try{R()||(br(r)||{}).array.push({callback:e})}catch(t){i("addToQueue",t)}};var V=(r={},e="",t="id")=>{try{let n=r&&r.id;if(W(r)&&n){let o=Object.keys(r);for(let s=0;s<o.length;s+=1){let m=o[s],l=r[m];if(m===t&&l===e)return r;if(m==="children"&&Array.isArray(l))for(let M=0;M<l.length;M+=1){let k=l[M],C=V(k,e,t);if(C!==null)return C}}}return null}catch(n){i("component.findComponentInTreeByField",n)}},K=V;var X=(r="",e={},t=null)=>{let n=K(t||window.joystick._internal.tree,r,"instanceId");n&&(n.children=[...n.children||[],e])};var Er=(r={},e={},t=null)=>{try{let n=L(r,{includeActual:!0,existingChildren:t});return r.dom=n,r.setDOMNodeOnInstance(),e.renderedComponent=r,n.html.wrapped}catch(n){i("component.renderMethods.component.renderForClient",n)}},kr=(r={})=>{try{return r.renderToHTML({ssrTree:r.parent.ssrTree,translations:r.parent.translations,walkingTreeForSSR:r?.parent?.walkingTreeForSSR,dataFromSSR:r.parent?.dataFromSSR}).wrapped}catch(e){i("component.renderMethods.component.renderToHTMLForSSR",e)}},Cr=(r={})=>{try{return r.parent.ssrTree.dataFunctions.push(async()=>{try{let e=await r.options.data(r.parent.options.api,r.parent.options.req);return r.data=e||{},{componentId:r.id,ssrId:r.ssrId,data:e}}catch(e){return{componentId:r.id,ssrId:r.ssrId,data:null,error:e}}}),r.renderToHTML({ssrTree:r?.parent?.ssrTree,translations:r?.parent?.translations,walkingTreeForSSR:r?.parent?.walkingTreeForSSR,dataFromSSR:r?.parent?.dataFromSSR})}catch(e){i("component.renderMethods.component.collectDataFunctionsForSSR",e)}},jr=(r={})=>{try{let e={id:r.id,instanceId:r.instanceId,instance:r,children:[]};X(r.parent.instanceId,e,r.parent&&r.parent.ssrTree||null)}catch(e){i("component.renderMethods.component.handleAddComponentToParent",e)}},Dr=(r={},e={})=>{try{!r.renderedComponent&&e.options&&e.options.lifecycle&&(e.options.lifecycle.onBeforeMount&&E("lifecycle.onBeforeMount",()=>{e.options.lifecycle.onBeforeMount(e)}),!r.renderedComponent&&e.options.lifecycle.onMount&&E("lifecycle.onMount",()=>{e.options.lifecycle.onMount(e)}))}catch(t){i("component.renderMethods.component.handleLifecycle",t)}},Rr=(r={},e={},t={})=>{try{!e.walkingTreeForSSR&&r?.options?.lifecycle?.onUpdateProps&&(0,J.diff)(e?.existingPropsMap,t)?.length>0&&E("lifecycle.onUpdateProps",()=>{let o=e?.existingPropsMap&&e?.existingPropsMap[r.id];r.options.lifecycle.onUpdateProps(o||{},t,r)})}catch(n){i("component.renderMethods.component.handleOnChangeProps",n)}},Lr=function(){return function(e=null,t={},n={}){let o=e({props:t,url:n.url,translations:n.translations,api:n.options.api,req:n.options.req,dataFromSSR:n?.dataFromSSR,parent:n}),s=n?.existingStateMap[o.id]||{},m=n.children[o.id]||[],l=s[m?.length];return o.state=l?.state||o.state,n.children[o.id]=[...n.children[o.id]||[],o],o.parent=n,Rr(o,n,t),E("lifecycle.onMount",()=>{o.setDOMNodeOnInstance()}),Dr(this,o),o.parent&&jr(o),o.options.data&&o.parent.walkingTreeForSSR&&o.parent.ssrTree.dataFunctions?Cr(o):o.parent&&o.parent.ssrTree?kr(o):Er(o,this,l?.children)}},Ar=function(e,t){try{let n=this;return new Lr().bind({})(e,t,n)}catch(n){i("component.renderMethods.component",n)}},P=Ar;var vr=function(e=[],t=null){try{return B(t)&&e&&Array.isArray(e)?e.map((n,o)=>t(n,o)).join(""):""}catch(n){i("component.renderMethods.each",n)}},H=vr;var Nr=(r="",e=[])=>{try{return e.reduce((t,[n,o])=>t.replace(`{{${n}}}`,o),r)}catch(t){i("component.renderMethods.i18n.replacePlaceholdersInString",t)}},I=(r="",e=[])=>{try{let t=typeof r=="string",n=Array.isArray(r),o=typeof r=="object"&&!n;if(t)return Nr(r,e);if(n)return r?.map(s=>I(s,e));if(o)return Object.entries(r)?.reduce((s={},[m,l])=>(s[m]=I(l,e),s),{})}catch(t){i("component.renderMethods.i18n.handleTranslationReplacement",t)}},Pr=(r="",e={})=>{try{return r?.split(".").reduce((t,n)=>t[n],e)}catch(t){i("component.renderMethods.i18n.getTranslationAtPath",t)}},Hr=function(r="",e={}){try{let t=R()?this.translations:window.__joystick_i18n__,o=r?.includes(".")?Pr(r,t):t[r];if(!t||!o)return"";let s=Object.entries(e);return I(o,s)}catch(t){i("component.renderMethods.i18n",t)}},_=Hr;var Ir=function(e=!1,t=""){try{return this?.renderingHTMLWithDataForSSR||e?`<when>${t.trim()}</when>`:"<when> </when>"}catch(n){i("component.renderMethods.when",n)}},U=Ir;var Y={c:P,component:P,e:H,each:H,i:_,i18n:_,w:U,when:U};var Z=(r={},e={})=>{try{return Object.entries(Y).reduce((t,[n,o])=>(t[n]=o.bind({...r,...e}),t),{})}catch(t){i("component.renderMethods.compile",t)}};var rr=(r={},e={})=>{try{return Object.entries(e).reduce((t={},[n,o])=>(t[n]=(...s)=>o(...s,{...r,setState:r.setState.bind(r),...r.renderMethods||{}}),t),{})}catch{i("component.methods.compile")}};var er=(r={})=>{try{return Object.entries(r)?.reduce((e={},[t,n]={})=>(e[t]=n?.map((o={})=>({state:o?.state,children:er(o?.children)})),e),{})}catch(e){i("component.render.getExistingStateMap.buildMapForChildren",e)}},tr=(r={})=>{try{return er(r)}catch(e){i("component.render.getExistingStateMap",e)}};var nr=new RegExp(/\<\!\-\-(?:.|\n|\r)*?-->/g),_r=new RegExp(/\n/g);var Ur=(r="")=>{try{return(r.match(nr)||[]).forEach(t=>{r=r.replace(t,"")}),r}catch(e){i("component.render.sanitizeHTML.removeCommentedCode",e)}},or=(r="")=>{try{let e=`${r}`;return e=Ur(e),e}catch(e){i("component.render.sanitizeHTML",e)}};var ir=(r={},e="")=>{try{let{wrapper:t=null,id:n=null,instanceId:o=null}=r;return`<div ${t?.id?`id="${t.id}" `:""}${t?.classList?`class="${t.classList?.join(" ")}" `:""} js-c="${n}" js-i="${o}">${e}</div>`}catch(t){i("component.render.wrapHTML",t)}};var cr=(r={},e=[])=>{try{let t=[...e],n=Object.entries(r);for(let o=0;o<n?.length;o+=1){let[s,m]=n[o];for(let l=0;l<m?.length;l+=1){let M=m[l];Object.entries(M?.timers)?.length>0&&t.push(...Object.values(M?.timers)),Object.entries(M?.children)?.length>0&&cr(M?.children,t)}}if(t?.length>0)for(let o=0;o<t?.length;o+=1)clearTimeout(t[o])}catch(t){i("component.render.clearTimersOnChildren",t)}},ar=cr;var sr=(r={},e={})=>{try{e?.dataFromSSR&&(r.data=G(e.dataFromSSR,r.id)||{}),ar(r?.children);let t=tr(e?.existingChildren||r?.children)||{};r.children={},r.renderMethods=Z({...r,existingStateMap:t,translations:e?.translations||r.translations||{},ssrTree:e?.ssrTree,walkingTreeForSSR:e?.walkingTreeForSSR,renderingHTMLWithDataForSSR:e?.renderingHTMLWithDataForSSR,dataFromSSR:e?.dataFromSSR}),r.methods=rr(r,r.options.methods);let n=r.options.render({...r||{},setState:r.setState.bind(r),...r.renderMethods||{}}),o=or(n),s=ir(r,o);return{unwrapped:o,wrapped:s}}catch(t){i("component.render.toHTML",t)}};var $r=(r={})=>{try{return Object.values(r).reduce((e={},t)=>(e[t.name]=t.value,e),{})}catch(e){i("component.virtualDOM.build.parseAttributeMap",e)}},dr=(r={})=>{try{return r.tagName==="WHEN"?[].flatMap.call(r?.childNodes,e=>e?.tagName==="WHEN"?dr(e):$(e)):$(r)}catch(e){i("component.virtualDOM.build.flattenWhenTags",e)}},$=(r={})=>{try{let e=r&&r.tagName&&r.tagName.toLowerCase()||"text",t={tagName:e,attributes:$r(r.attributes),children:[].flatMap.call(r.childNodes,n=>dr(n))};return e==="text"&&(t=r.textContent),t}catch(e){i("component.virtualDOM.build",e)}},lr=$;var qr=(r="")=>{try{let e=document.createElement("div");return e.innerHTML=r,e?.childNodes[0]}catch(e){i("component.virtualDOM.build.convertHTMLToDOM",e)}},ur=(r="")=>{try{let e=qr(r);return lr(e)}catch(e){i("component.virtualDOM.build",e)}};var pr=(r="")=>{try{return document.createElement("div").setAttribute(r,"Test"),!0}catch{return!1}};var Br=(r={})=>{try{let e=document.createElement(r.tagName),t=Object.entries(r.attributes);for(let n=0;n<t.length;n+=1){let[o,s]=t[n];pr(o)&&e.setAttribute(o,s)}for(let n=0;n<r?.children?.length;n+=1){let o=r?.children[n];if(o){let s=hr(o);e.appendChild(s)}}return e}catch(e){i("component.virtualDOM.renderTreeToDOM.renderElement",e)}},hr=(r=null)=>{try{return z(r)?document.createTextNode(r):Br(r)}catch(e){i("component.virtualDOM.renderTreeToDOM",e)}},fr=hr;var L=(r={},e={})=>{try{let t=sr(r,{existingChildren:e?.existingChildren}),n=ur(t.wrapped,r),o=e.includeActual&&n?fr(n):null;return{html:t,virtual:n,actual:o}}catch(t){i("component.render.getUpdatedDOM",t)}};var wt=(r={},e={})=>{try{let t=L(r,{includeActual:!0,existingChildren:e?.existingChildren});return r.dom=t,t.actual}catch(t){i("component.render.forMount",t)}};export{wt as default};
@@ -1 +1 @@
1
- var mr=Object.create;var A=Object.defineProperty;var wr=Object.getOwnPropertyDescriptor;var yr=Object.getOwnPropertyNames;var xr=Object.getPrototypeOf,Mr=Object.prototype.hasOwnProperty;var Tr=r=>A(r,"__esModule",{value:!0});var gr=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var Fr=(r,e,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of yr(e))!Mr.call(r,o)&&o!=="default"&&A(r,o,{get:()=>e[o],enumerable:!(t=wr(e,o))||t.enumerable});return r},Or=r=>Fr(Tr(A(r!=null?mr(xr(r)):{},"default",r&&r.__esModule&&"default"in r?{get:()=>r.default,enumerable:!0}:{value:r,enumerable:!0})),r);var z=gr(j=>{(function(r,e){if(typeof define=="function"&&define.amd)define(["exports"],e);else if(typeof j!="undefined")e(j);else{var t={exports:{}};e(t.exports),r.index=t.exports}})(j,function(r){"use strict";function e(a){return e=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(c){return typeof c}:function(c){return c&&typeof Symbol=="function"&&c.constructor===Symbol&&c!==Symbol.prototype?"symbol":typeof c},e(a)}function t(a,c){return c&&(e(c)==="object"||typeof c=="function")?c:o(a)}function o(a){if(a===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return a}function n(a){return n=Object.setPrototypeOf?Object.getPrototypeOf:function(c){return c.__proto__||Object.getPrototypeOf(c)},n(a)}function s(a,c){if(typeof c!="function"&&c!==null)throw new TypeError("Super expression must either be null or a function");a.prototype=Object.create(c&&c.prototype,{constructor:{value:a,writable:!0,configurable:!0}}),c&&m(a,c)}function m(a,c){return m=Object.setPrototypeOf||function(p,T){return p.__proto__=T,p},m(a,c)}function l(a,c){if(!(a instanceof c))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0}),r.diff=void 0;var M=function a(c,p){l(this,a),this.type=c,this.path=p?p.toString():""},k=function(a){function c(p,T,d){var F;return l(this,c),F=t(this,n(c).call(this,"E",p)),F.lhs=T,F.rhs=d,F}return s(c,a),c}(M),C=function(a){function c(p,T,d,F){var f;return l(this,c),f=t(this,n(c).call(this,"M",p)),f.item=T,f.lhsIndex=d,f.rhsIndex=F,f}return s(c,a),c}(M),L=function(a){function c(p,T){var d;return l(this,c),d=t(this,n(c).call(this,"D",p)),d.lhs=T,d}return s(c,a),c}(M),v=function(a){function c(p,T){var d;return l(this,c),d=t(this,n(c).call(this,"A",p)),d.rhs=T,d}return s(c,a),c}(M),S=function(a,c){return a?"".concat(a,".").concat(c):c};r.diff=function(c,p){var T=2<arguments.length&&arguments[2]!==void 0?arguments[2]:{},d=[],F=T.matchKey,f=T.types||["E","A","D","M"],hr=function(h,u,w,b){h.forEach(function(O,y){var g=u.findIndex(function(x){return x[b]===O[b]});-1<g?(-1<f.indexOf("M")&&y!==g&&d.push(new C(w,O,y,g)),R(O,u[g],S(w,g))):-1<f.indexOf("D")&&d.push(new L(w,O))}),u.forEach(function(O,y){var g=h.findIndex(function(x){return O[b]===x[b]});-1<f.indexOf("A")&&g===-1&&d.push(new v(S(w,y),O))})},R=function(h,u,w){var b=Object.prototype.toString.call(h),O=Object.prototype.toString.call(u);if(-1<f.indexOf("E")&&b!==O)return d.push(new k(w,h,u)),!1;if(b==="[object Object]")Object.getOwnPropertyNames(h).forEach(function(x){Object.prototype.hasOwnProperty.call(u,x)?R(h[x],u[x],S(w,x)):-1<f.indexOf("D")&&d.push(new L(S(w,x),h[x]))}),Object.getOwnPropertyNames(u).forEach(function(x){-1<f.indexOf("A")&&!Object.prototype.hasOwnProperty.call(h,x)&&d.push(new v(S(w,x),u[x]))});else if(b!=="[object Array]")-1<f.indexOf("E")&&h!==u&&d.push(new k(w,h,u));else if(F)hr(h,u,w,F);else{var y=h.length-1,g=u.length-1;if(-1<f.indexOf("D"))for(;y>g;)d.push(new L(S(w,y),h[y--]));if(-1<f.indexOf("A"))for(;g>y;)d.push(new v(S(w,g),u[g--]));for(;0<=y;--y)R(h[y],u[y],S(w,y))}};return R(c,p),d}})});var i=(r="",e={})=>{throw new Error(`[joystick${r?`.${r}`:""}] ${e.message||e.reason||e}`)};var $=r=>{try{return!!Array.isArray(r)}catch(e){i("types.isArray",e)}};var U=r=>{try{return typeof r=="function"}catch(e){i("types.isFunction",e)}};var q=r=>{try{return!!(r&&typeof r=="object"&&!Array.isArray(r))}catch(e){i("types.isObject",e)}};var B=r=>{try{return typeof r=="string"}catch(e){i("types.isString",e)}};var W=(r=[],e="")=>{try{return($(r)&&r.find(o=>o?.componentId===e))?.data||{}}catch(t){i("findComponentDataFromSSR",t)}};var K=Or(z());var D=()=>typeof window=="undefined";var Sr=(r="")=>{try{let[e,t]=r?.split(".");return t?window?.joystick?._internal?.queues[e][t]:window?.joystick?._internal?.queues[e]}catch(e){i("addToQueue.getQueue",e)}},E=(r="",e=null)=>{try{D()||(Sr(r)||{}).array.push({callback:e})}catch(t){i("addToQueue",t)}};var G=(r={},e="",t="id")=>{try{let o=r&&r.id;if(q(r)&&o){let n=Object.keys(r);for(let s=0;s<n.length;s+=1){let m=n[s],l=r[m];if(m===t&&l===e)return r;if(m==="children"&&Array.isArray(l))for(let M=0;M<l.length;M+=1){let k=l[M],C=G(k,e,t);if(C!==null)return C}}}return null}catch(o){i("component.findComponentInTreeByField",o)}},Q=G;var V=(r="",e={},t=null)=>{let o=Q(t||window.joystick._internal.tree,r,"instanceId");o&&(o.children=[...o.children||[],e])};var br=(r={},e={},t=null)=>{try{let o=X(r,{includeActual:!0,existingChildren:t});return r.dom=o,r.setDOMNodeOnInstance(),e.renderedComponent=r,o.html.wrapped}catch(o){i("component.renderMethods.component.renderForClient",o)}},Er=(r={})=>{try{return r.renderToHTML({ssrTree:r.parent.ssrTree,translations:r.parent.translations,walkingTreeForSSR:r?.parent?.walkingTreeForSSR,dataFromSSR:r.parent?.dataFromSSR}).wrapped}catch(e){i("component.renderMethods.component.renderToHTMLForSSR",e)}},kr=(r={})=>{try{return r.parent.ssrTree.dataFunctions.push(async()=>{try{let e=await r.options.data(r.parent.options.api,r.parent.options.req);return r.data=e||{},{componentId:r.id,ssrId:r.ssrId,data:e}}catch(e){return{componentId:r.id,ssrId:r.ssrId,data:null,error:e}}}),r.renderToHTML({ssrTree:r?.parent?.ssrTree,translations:r?.parent?.translations,walkingTreeForSSR:r?.parent?.walkingTreeForSSR,dataFromSSR:r?.parent?.dataFromSSR})}catch(e){i("component.renderMethods.component.collectDataFunctionsForSSR",e)}},Cr=(r={})=>{try{let e={id:r.id,instanceId:r.instanceId,instance:r,children:[]};V(r.parent.instanceId,e,r.parent&&r.parent.ssrTree||null)}catch(e){i("component.renderMethods.component.handleAddComponentToParent",e)}},Rr=(r={},e={})=>{try{!r.renderedComponent&&e.options&&e.options.lifecycle&&(e.options.lifecycle.onBeforeMount&&E("lifecycle.onBeforeMount",()=>{e.options.lifecycle.onBeforeMount(e)}),!r.renderedComponent&&e.options.lifecycle.onMount&&E("lifecycle.onMount",()=>{e.options.lifecycle.onMount(e)}))}catch(t){i("component.renderMethods.component.handleLifecycle",t)}},jr=(r={},e={},t={})=>{try{!e.walkingTreeForSSR&&r?.options?.lifecycle?.onUpdateProps&&(0,K.diff)(e?.existingPropsMap,t)?.length>0&&E("lifecycle.onUpdateProps",()=>{let n=e?.existingPropsMap&&e?.existingPropsMap[r.id];r.options.lifecycle.onUpdateProps(n||{},t,r)})}catch(o){i("component.renderMethods.component.handleOnChangeProps",o)}},Dr=function(){return function(e=null,t={},o={}){let n=e({props:t,url:o.url,translations:o.translations,api:o.options.api,req:o.options.req,dataFromSSR:o?.dataFromSSR,parent:o}),s=o?.existingStateMap[n.id]||{},m=o.children[n.id]||[],l=s[m?.length];return n.state=l?.state||n.state,o.children[n.id]=[...o.children[n.id]||[],n],n.parent=o,jr(n,o,t),E("lifecycle.onMount",()=>{n.setDOMNodeOnInstance()}),Rr(this,n),n.parent&&Cr(n),n.options.data&&n.parent.walkingTreeForSSR&&n.parent.ssrTree.dataFunctions?kr(n):n.parent&&n.parent.ssrTree?Er(n):br(n,this,l?.children)}},Lr=function(e,t){try{let o=this;return new Dr().bind({})(e,t,o)}catch(o){i("component.renderMethods.component",o)}},H=Lr;var vr=function(e=[],t=null){try{return U(t)&&e&&Array.isArray(e)?e.map((o,n)=>t(o,n)).join(""):""}catch(o){i("component.renderMethods.each",o)}},N=vr;var Ar=function(e="",t={}){try{let o=D()?this.translations:window.__joystick_i18n__;if(!o||!o[e])return"";let n=Object.entries(t);return n.length>0?n.reduce((s,[m,l])=>s.replace(`{{${m}}}`,l),o[e]):o[e]}catch(o){i("component.renderMethods.i18n",o)}},_=Ar;var Hr=function(e=!1,t=""){try{return this?.renderingHTMLWithDataForSSR||e?`<when>${t.trim()}</when>`:"<when> </when>"}catch(o){i("component.renderMethods.when",o)}},P=Hr;var J={c:H,component:H,e:N,each:N,i:_,i18n:_,w:P,when:P};var Y=(r={},e={})=>{try{return Object.entries(J).reduce((t,[o,n])=>(t[o]=n.bind({...r,...e}),t),{})}catch(t){i("component.renderMethods.compile",t)}};var Z=(r={},e={})=>{try{return Object.entries(e).reduce((t={},[o,n])=>(t[o]=(...s)=>n(...s,{...r,setState:r.setState.bind(r),...r.renderMethods||{}}),t),{})}catch{i("component.methods.compile")}};var rr=(r={})=>{try{return Object.entries(r)?.reduce((e={},[t,o]={})=>(e[t]=o?.map((n={})=>({state:n?.state,children:rr(n?.children)})),e),{})}catch(e){i("component.render.getExistingStateMap.buildMapForChildren",e)}},er=(r={})=>{try{return rr(r)}catch(e){i("component.render.getExistingStateMap",e)}};var tr=new RegExp(/\<\!\-\-(?:.|\n|\r)*?-->/g),Nr=new RegExp(/\n/g);var _r=(r="")=>{try{return(r.match(tr)||[]).forEach(t=>{r=r.replace(t,"")}),r}catch(e){i("component.render.sanitizeHTML.removeCommentedCode",e)}},or=(r="")=>{try{let e=`${r}`;return e=_r(e),e}catch(e){i("component.render.sanitizeHTML",e)}};var nr=(r={},e="")=>{try{let{wrapper:t=null,id:o=null,instanceId:n=null}=r;return`<div ${t?.id?`id="${t.id}" `:""}${t?.classList?`class="${t.classList?.join(" ")}" `:""} js-c="${o}" js-i="${n}">${e}</div>`}catch(t){i("component.render.wrapHTML",t)}};var ir=(r={},e=[])=>{try{let t=[...e],o=Object.entries(r);for(let n=0;n<o?.length;n+=1){let[s,m]=o[n];for(let l=0;l<m?.length;l+=1){let M=m[l];Object.entries(M?.timers)?.length>0&&t.push(...Object.values(M?.timers)),Object.entries(M?.children)?.length>0&&ir(M?.children,t)}}if(t?.length>0)for(let n=0;n<t?.length;n+=1)clearTimeout(t[n])}catch(t){i("component.render.clearTimersOnChildren",t)}},cr=ir;var ar=(r={},e={})=>{try{e?.dataFromSSR&&(r.data=W(e.dataFromSSR,r.id)||{}),cr(r?.children);let t=er(e?.existingChildren||r?.children)||{};r.children={},r.renderMethods=Y({...r,existingStateMap:t,translations:e?.translations||r.translations||{},ssrTree:e?.ssrTree,walkingTreeForSSR:e?.walkingTreeForSSR,renderingHTMLWithDataForSSR:e?.renderingHTMLWithDataForSSR,dataFromSSR:e?.dataFromSSR}),r.methods=Z(r,r.options.methods);let o=r.options.render({...r||{},setState:r.setState.bind(r),...r.renderMethods||{}}),n=or(o),s=nr(r,n);return{unwrapped:n,wrapped:s}}catch(t){i("component.render.toHTML",t)}};var Pr=(r={})=>{try{return Object.values(r).reduce((e={},t)=>(e[t.name]=t.value,e),{})}catch(e){i("component.virtualDOM.build.parseAttributeMap",e)}},sr=(r={})=>{try{return r.tagName==="WHEN"?[].flatMap.call(r?.childNodes,e=>e?.tagName==="WHEN"?sr(e):I(e)):I(r)}catch(e){i("component.virtualDOM.build.flattenWhenTags",e)}},I=(r={})=>{try{let e=r&&r.tagName&&r.tagName.toLowerCase()||"text",t={tagName:e,attributes:Pr(r.attributes),children:[].flatMap.call(r.childNodes,o=>sr(o))};return e==="text"&&(t=r.textContent),t}catch(e){i("component.virtualDOM.build",e)}},dr=I;var Ir=(r="")=>{try{let e=document.createElement("div");return e.innerHTML=r,e?.childNodes[0]}catch(e){i("component.virtualDOM.build.convertHTMLToDOM",e)}},lr=(r="")=>{try{let e=Ir(r);return dr(e)}catch(e){i("component.virtualDOM.build",e)}};var ur=(r="")=>{try{return document.createElement("div").setAttribute(r,"Test"),!0}catch{return!1}};var $r=(r={})=>{try{let e=document.createElement(r.tagName),t=Object.entries(r.attributes);for(let o=0;o<t.length;o+=1){let[n,s]=t[o];ur(n)&&e.setAttribute(n,s)}for(let o=0;o<r?.children?.length;o+=1){let n=r?.children[o];if(n){let s=pr(n);e.appendChild(s)}}return e}catch(e){i("component.virtualDOM.renderTreeToDOM.renderElement",e)}},pr=(r=null)=>{try{return B(r)?document.createTextNode(r):$r(r)}catch(e){i("component.virtualDOM.renderTreeToDOM",e)}},fr=pr;var X=(r={},e={})=>{try{let t=ar(r,{existingChildren:e?.existingChildren}),o=lr(t.wrapped,r),n=e.includeActual&&o?fr(o):null;return{html:t,virtual:o,actual:n}}catch(t){i("component.render.getUpdatedDOM",t)}};export{X as default};
1
+ var wr=Object.create;var v=Object.defineProperty;var yr=Object.getOwnPropertyDescriptor;var xr=Object.getOwnPropertyNames;var Mr=Object.getPrototypeOf,Tr=Object.prototype.hasOwnProperty;var gr=r=>v(r,"__esModule",{value:!0});var Fr=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var Sr=(r,e,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of xr(e))!Tr.call(r,n)&&n!=="default"&&v(r,n,{get:()=>e[n],enumerable:!(t=yr(e,n))||t.enumerable});return r},Or=r=>Sr(gr(v(r!=null?wr(Mr(r)):{},"default",r&&r.__esModule&&"default"in r?{get:()=>r.default,enumerable:!0}:{value:r,enumerable:!0})),r);var G=Fr(R=>{(function(r,e){if(typeof define=="function"&&define.amd)define(["exports"],e);else if(typeof R!="undefined")e(R);else{var t={exports:{}};e(t.exports),r.index=t.exports}})(R,function(r){"use strict";function e(a){return e=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(c){return typeof c}:function(c){return c&&typeof Symbol=="function"&&c.constructor===Symbol&&c!==Symbol.prototype?"symbol":typeof c},e(a)}function t(a,c){return c&&(e(c)==="object"||typeof c=="function")?c:n(a)}function n(a){if(a===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return a}function o(a){return o=Object.setPrototypeOf?Object.getPrototypeOf:function(c){return c.__proto__||Object.getPrototypeOf(c)},o(a)}function s(a,c){if(typeof c!="function"&&c!==null)throw new TypeError("Super expression must either be null or a function");a.prototype=Object.create(c&&c.prototype,{constructor:{value:a,writable:!0,configurable:!0}}),c&&m(a,c)}function m(a,c){return m=Object.setPrototypeOf||function(u,T){return u.__proto__=T,u},m(a,c)}function l(a,c){if(!(a instanceof c))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0}),r.diff=void 0;var M=function a(c,u){l(this,a),this.type=c,this.path=u?u.toString():""},k=function(a){function c(u,T,d){var F;return l(this,c),F=t(this,o(c).call(this,"E",u)),F.lhs=T,F.rhs=d,F}return s(c,a),c}(M),C=function(a){function c(u,T,d,F){var h;return l(this,c),h=t(this,o(c).call(this,"M",u)),h.item=T,h.lhsIndex=d,h.rhsIndex=F,h}return s(c,a),c}(M),L=function(a){function c(u,T){var d;return l(this,c),d=t(this,o(c).call(this,"D",u)),d.lhs=T,d}return s(c,a),c}(M),A=function(a){function c(u,T){var d;return l(this,c),d=t(this,o(c).call(this,"A",u)),d.rhs=T,d}return s(c,a),c}(M),O=function(a,c){return a?"".concat(a,".").concat(c):c};r.diff=function(c,u){var T=2<arguments.length&&arguments[2]!==void 0?arguments[2]:{},d=[],F=T.matchKey,h=T.types||["E","A","D","M"],mr=function(f,p,w,b){f.forEach(function(S,y){var g=p.findIndex(function(x){return x[b]===S[b]});-1<g?(-1<h.indexOf("M")&&y!==g&&d.push(new C(w,S,y,g)),j(S,p[g],O(w,g))):-1<h.indexOf("D")&&d.push(new L(w,S))}),p.forEach(function(S,y){var g=f.findIndex(function(x){return S[b]===x[b]});-1<h.indexOf("A")&&g===-1&&d.push(new A(O(w,y),S))})},j=function(f,p,w){var b=Object.prototype.toString.call(f),S=Object.prototype.toString.call(p);if(-1<h.indexOf("E")&&b!==S)return d.push(new k(w,f,p)),!1;if(b==="[object Object]")Object.getOwnPropertyNames(f).forEach(function(x){Object.prototype.hasOwnProperty.call(p,x)?j(f[x],p[x],O(w,x)):-1<h.indexOf("D")&&d.push(new L(O(w,x),f[x]))}),Object.getOwnPropertyNames(p).forEach(function(x){-1<h.indexOf("A")&&!Object.prototype.hasOwnProperty.call(f,x)&&d.push(new A(O(w,x),p[x]))});else if(b!=="[object Array]")-1<h.indexOf("E")&&f!==p&&d.push(new k(w,f,p));else if(F)mr(f,p,w,F);else{var y=f.length-1,g=p.length-1;if(-1<h.indexOf("D"))for(;y>g;)d.push(new L(O(w,y),f[y--]));if(-1<h.indexOf("A"))for(;g>y;)d.push(new A(O(w,g),p[g--]));for(;0<=y;--y)j(f[y],p[y],O(w,y))}};return j(c,u),d}})});var i=(r="",e={})=>{throw new Error(`[joystick${r?`.${r}`:""}] ${e.message||e.reason||e}`)};var U=r=>{try{return!!Array.isArray(r)}catch(e){i("types.isArray",e)}};var q=r=>{try{return typeof r=="function"}catch(e){i("types.isFunction",e)}};var B=r=>{try{return!!(r&&typeof r=="object"&&!Array.isArray(r))}catch(e){i("types.isObject",e)}};var W=r=>{try{return typeof r=="string"}catch(e){i("types.isString",e)}};var z=(r=[],e="")=>{try{return(U(r)&&r.find(n=>n?.componentId===e))?.data||{}}catch(t){i("findComponentDataFromSSR",t)}};var X=Or(G());var D=()=>typeof window=="undefined";var br=(r="")=>{try{let[e,t]=r?.split(".");return t?window?.joystick?._internal?.queues[e][t]:window?.joystick?._internal?.queues[e]}catch(e){i("addToQueue.getQueue",e)}},E=(r="",e=null)=>{try{D()||(br(r)||{}).array.push({callback:e})}catch(t){i("addToQueue",t)}};var Q=(r={},e="",t="id")=>{try{let n=r&&r.id;if(B(r)&&n){let o=Object.keys(r);for(let s=0;s<o.length;s+=1){let m=o[s],l=r[m];if(m===t&&l===e)return r;if(m==="children"&&Array.isArray(l))for(let M=0;M<l.length;M+=1){let k=l[M],C=Q(k,e,t);if(C!==null)return C}}}return null}catch(n){i("component.findComponentInTreeByField",n)}},V=Q;var K=(r="",e={},t=null)=>{let n=V(t||window.joystick._internal.tree,r,"instanceId");n&&(n.children=[...n.children||[],e])};var Er=(r={},e={},t=null)=>{try{let n=J(r,{includeActual:!0,existingChildren:t});return r.dom=n,r.setDOMNodeOnInstance(),e.renderedComponent=r,n.html.wrapped}catch(n){i("component.renderMethods.component.renderForClient",n)}},kr=(r={})=>{try{return r.renderToHTML({ssrTree:r.parent.ssrTree,translations:r.parent.translations,walkingTreeForSSR:r?.parent?.walkingTreeForSSR,dataFromSSR:r.parent?.dataFromSSR}).wrapped}catch(e){i("component.renderMethods.component.renderToHTMLForSSR",e)}},Cr=(r={})=>{try{return r.parent.ssrTree.dataFunctions.push(async()=>{try{let e=await r.options.data(r.parent.options.api,r.parent.options.req);return r.data=e||{},{componentId:r.id,ssrId:r.ssrId,data:e}}catch(e){return{componentId:r.id,ssrId:r.ssrId,data:null,error:e}}}),r.renderToHTML({ssrTree:r?.parent?.ssrTree,translations:r?.parent?.translations,walkingTreeForSSR:r?.parent?.walkingTreeForSSR,dataFromSSR:r?.parent?.dataFromSSR})}catch(e){i("component.renderMethods.component.collectDataFunctionsForSSR",e)}},jr=(r={})=>{try{let e={id:r.id,instanceId:r.instanceId,instance:r,children:[]};K(r.parent.instanceId,e,r.parent&&r.parent.ssrTree||null)}catch(e){i("component.renderMethods.component.handleAddComponentToParent",e)}},Rr=(r={},e={})=>{try{!r.renderedComponent&&e.options&&e.options.lifecycle&&(e.options.lifecycle.onBeforeMount&&E("lifecycle.onBeforeMount",()=>{e.options.lifecycle.onBeforeMount(e)}),!r.renderedComponent&&e.options.lifecycle.onMount&&E("lifecycle.onMount",()=>{e.options.lifecycle.onMount(e)}))}catch(t){i("component.renderMethods.component.handleLifecycle",t)}},Dr=(r={},e={},t={})=>{try{!e.walkingTreeForSSR&&r?.options?.lifecycle?.onUpdateProps&&(0,X.diff)(e?.existingPropsMap,t)?.length>0&&E("lifecycle.onUpdateProps",()=>{let o=e?.existingPropsMap&&e?.existingPropsMap[r.id];r.options.lifecycle.onUpdateProps(o||{},t,r)})}catch(n){i("component.renderMethods.component.handleOnChangeProps",n)}},Lr=function(){return function(e=null,t={},n={}){let o=e({props:t,url:n.url,translations:n.translations,api:n.options.api,req:n.options.req,dataFromSSR:n?.dataFromSSR,parent:n}),s=n?.existingStateMap[o.id]||{},m=n.children[o.id]||[],l=s[m?.length];return o.state=l?.state||o.state,n.children[o.id]=[...n.children[o.id]||[],o],o.parent=n,Dr(o,n,t),E("lifecycle.onMount",()=>{o.setDOMNodeOnInstance()}),Rr(this,o),o.parent&&jr(o),o.options.data&&o.parent.walkingTreeForSSR&&o.parent.ssrTree.dataFunctions?Cr(o):o.parent&&o.parent.ssrTree?kr(o):Er(o,this,l?.children)}},Ar=function(e,t){try{let n=this;return new Lr().bind({})(e,t,n)}catch(n){i("component.renderMethods.component",n)}},N=Ar;var vr=function(e=[],t=null){try{return q(t)&&e&&Array.isArray(e)?e.map((n,o)=>t(n,o)).join(""):""}catch(n){i("component.renderMethods.each",n)}},P=vr;var Nr=(r="",e=[])=>{try{return e.reduce((t,[n,o])=>t.replace(`{{${n}}}`,o),r)}catch(t){i("component.renderMethods.i18n.replacePlaceholdersInString",t)}},H=(r="",e=[])=>{try{let t=typeof r=="string",n=Array.isArray(r),o=typeof r=="object"&&!n;if(t)return Nr(r,e);if(n)return r?.map(s=>H(s,e));if(o)return Object.entries(r)?.reduce((s={},[m,l])=>(s[m]=H(l,e),s),{})}catch(t){i("component.renderMethods.i18n.handleTranslationReplacement",t)}},Pr=(r="",e={})=>{try{return r?.split(".").reduce((t,n)=>t[n],e)}catch(t){i("component.renderMethods.i18n.getTranslationAtPath",t)}},Hr=function(r="",e={}){try{let t=D()?this.translations:window.__joystick_i18n__,o=r?.includes(".")?Pr(r,t):t[r];if(!t||!o)return"";let s=Object.entries(e);return H(o,s)}catch(t){i("component.renderMethods.i18n",t)}},I=Hr;var Ir=function(e=!1,t=""){try{return this?.renderingHTMLWithDataForSSR||e?`<when>${t.trim()}</when>`:"<when> </when>"}catch(n){i("component.renderMethods.when",n)}},_=Ir;var Y={c:N,component:N,e:P,each:P,i:I,i18n:I,w:_,when:_};var Z=(r={},e={})=>{try{return Object.entries(Y).reduce((t,[n,o])=>(t[n]=o.bind({...r,...e}),t),{})}catch(t){i("component.renderMethods.compile",t)}};var rr=(r={},e={})=>{try{return Object.entries(e).reduce((t={},[n,o])=>(t[n]=(...s)=>o(...s,{...r,setState:r.setState.bind(r),...r.renderMethods||{}}),t),{})}catch{i("component.methods.compile")}};var er=(r={})=>{try{return Object.entries(r)?.reduce((e={},[t,n]={})=>(e[t]=n?.map((o={})=>({state:o?.state,children:er(o?.children)})),e),{})}catch(e){i("component.render.getExistingStateMap.buildMapForChildren",e)}},tr=(r={})=>{try{return er(r)}catch(e){i("component.render.getExistingStateMap",e)}};var nr=new RegExp(/\<\!\-\-(?:.|\n|\r)*?-->/g),_r=new RegExp(/\n/g);var $r=(r="")=>{try{return(r.match(nr)||[]).forEach(t=>{r=r.replace(t,"")}),r}catch(e){i("component.render.sanitizeHTML.removeCommentedCode",e)}},or=(r="")=>{try{let e=`${r}`;return e=$r(e),e}catch(e){i("component.render.sanitizeHTML",e)}};var ir=(r={},e="")=>{try{let{wrapper:t=null,id:n=null,instanceId:o=null}=r;return`<div ${t?.id?`id="${t.id}" `:""}${t?.classList?`class="${t.classList?.join(" ")}" `:""} js-c="${n}" js-i="${o}">${e}</div>`}catch(t){i("component.render.wrapHTML",t)}};var cr=(r={},e=[])=>{try{let t=[...e],n=Object.entries(r);for(let o=0;o<n?.length;o+=1){let[s,m]=n[o];for(let l=0;l<m?.length;l+=1){let M=m[l];Object.entries(M?.timers)?.length>0&&t.push(...Object.values(M?.timers)),Object.entries(M?.children)?.length>0&&cr(M?.children,t)}}if(t?.length>0)for(let o=0;o<t?.length;o+=1)clearTimeout(t[o])}catch(t){i("component.render.clearTimersOnChildren",t)}},ar=cr;var sr=(r={},e={})=>{try{e?.dataFromSSR&&(r.data=z(e.dataFromSSR,r.id)||{}),ar(r?.children);let t=tr(e?.existingChildren||r?.children)||{};r.children={},r.renderMethods=Z({...r,existingStateMap:t,translations:e?.translations||r.translations||{},ssrTree:e?.ssrTree,walkingTreeForSSR:e?.walkingTreeForSSR,renderingHTMLWithDataForSSR:e?.renderingHTMLWithDataForSSR,dataFromSSR:e?.dataFromSSR}),r.methods=rr(r,r.options.methods);let n=r.options.render({...r||{},setState:r.setState.bind(r),...r.renderMethods||{}}),o=or(n),s=ir(r,o);return{unwrapped:o,wrapped:s}}catch(t){i("component.render.toHTML",t)}};var Ur=(r={})=>{try{return Object.values(r).reduce((e={},t)=>(e[t.name]=t.value,e),{})}catch(e){i("component.virtualDOM.build.parseAttributeMap",e)}},dr=(r={})=>{try{return r.tagName==="WHEN"?[].flatMap.call(r?.childNodes,e=>e?.tagName==="WHEN"?dr(e):$(e)):$(r)}catch(e){i("component.virtualDOM.build.flattenWhenTags",e)}},$=(r={})=>{try{let e=r&&r.tagName&&r.tagName.toLowerCase()||"text",t={tagName:e,attributes:Ur(r.attributes),children:[].flatMap.call(r.childNodes,n=>dr(n))};return e==="text"&&(t=r.textContent),t}catch(e){i("component.virtualDOM.build",e)}},lr=$;var qr=(r="")=>{try{let e=document.createElement("div");return e.innerHTML=r,e?.childNodes[0]}catch(e){i("component.virtualDOM.build.convertHTMLToDOM",e)}},pr=(r="")=>{try{let e=qr(r);return lr(e)}catch(e){i("component.virtualDOM.build",e)}};var ur=(r="")=>{try{return document.createElement("div").setAttribute(r,"Test"),!0}catch{return!1}};var Br=(r={})=>{try{let e=document.createElement(r.tagName),t=Object.entries(r.attributes);for(let n=0;n<t.length;n+=1){let[o,s]=t[n];ur(o)&&e.setAttribute(o,s)}for(let n=0;n<r?.children?.length;n+=1){let o=r?.children[n];if(o){let s=hr(o);e.appendChild(s)}}return e}catch(e){i("component.virtualDOM.renderTreeToDOM.renderElement",e)}},hr=(r=null)=>{try{return W(r)?document.createTextNode(r):Br(r)}catch(e){i("component.virtualDOM.renderTreeToDOM",e)}},fr=hr;var J=(r={},e={})=>{try{let t=sr(r,{existingChildren:e?.existingChildren}),n=pr(t.wrapped,r),o=e.includeActual&&n?fr(n):null;return{html:t,virtual:n,actual:o}}catch(t){i("component.render.getUpdatedDOM",t)}};export{J as default};
@@ -1 +1 @@
1
- var mr=Object.create;var A=Object.defineProperty;var wr=Object.getOwnPropertyDescriptor;var yr=Object.getOwnPropertyNames;var xr=Object.getPrototypeOf,Mr=Object.prototype.hasOwnProperty;var Tr=r=>A(r,"__esModule",{value:!0});var gr=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var Fr=(r,e,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of yr(e))!Mr.call(r,o)&&o!=="default"&&A(r,o,{get:()=>e[o],enumerable:!(t=wr(e,o))||t.enumerable});return r},Or=r=>Fr(Tr(A(r!=null?mr(xr(r)):{},"default",r&&r.__esModule&&"default"in r?{get:()=>r.default,enumerable:!0}:{value:r,enumerable:!0})),r);var z=gr(j=>{(function(r,e){if(typeof define=="function"&&define.amd)define(["exports"],e);else if(typeof j!="undefined")e(j);else{var t={exports:{}};e(t.exports),r.index=t.exports}})(j,function(r){"use strict";function e(a){return e=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(c){return typeof c}:function(c){return c&&typeof Symbol=="function"&&c.constructor===Symbol&&c!==Symbol.prototype?"symbol":typeof c},e(a)}function t(a,c){return c&&(e(c)==="object"||typeof c=="function")?c:o(a)}function o(a){if(a===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return a}function n(a){return n=Object.setPrototypeOf?Object.getPrototypeOf:function(c){return c.__proto__||Object.getPrototypeOf(c)},n(a)}function s(a,c){if(typeof c!="function"&&c!==null)throw new TypeError("Super expression must either be null or a function");a.prototype=Object.create(c&&c.prototype,{constructor:{value:a,writable:!0,configurable:!0}}),c&&m(a,c)}function m(a,c){return m=Object.setPrototypeOf||function(p,T){return p.__proto__=T,p},m(a,c)}function l(a,c){if(!(a instanceof c))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0}),r.diff=void 0;var M=function a(c,p){l(this,a),this.type=c,this.path=p?p.toString():""},k=function(a){function c(p,T,d){var F;return l(this,c),F=t(this,n(c).call(this,"E",p)),F.lhs=T,F.rhs=d,F}return s(c,a),c}(M),C=function(a){function c(p,T,d,F){var f;return l(this,c),f=t(this,n(c).call(this,"M",p)),f.item=T,f.lhsIndex=d,f.rhsIndex=F,f}return s(c,a),c}(M),L=function(a){function c(p,T){var d;return l(this,c),d=t(this,n(c).call(this,"D",p)),d.lhs=T,d}return s(c,a),c}(M),v=function(a){function c(p,T){var d;return l(this,c),d=t(this,n(c).call(this,"A",p)),d.rhs=T,d}return s(c,a),c}(M),S=function(a,c){return a?"".concat(a,".").concat(c):c};r.diff=function(c,p){var T=2<arguments.length&&arguments[2]!==void 0?arguments[2]:{},d=[],F=T.matchKey,f=T.types||["E","A","D","M"],hr=function(h,u,w,b){h.forEach(function(O,y){var g=u.findIndex(function(x){return x[b]===O[b]});-1<g?(-1<f.indexOf("M")&&y!==g&&d.push(new C(w,O,y,g)),R(O,u[g],S(w,g))):-1<f.indexOf("D")&&d.push(new L(w,O))}),u.forEach(function(O,y){var g=h.findIndex(function(x){return O[b]===x[b]});-1<f.indexOf("A")&&g===-1&&d.push(new v(S(w,y),O))})},R=function(h,u,w){var b=Object.prototype.toString.call(h),O=Object.prototype.toString.call(u);if(-1<f.indexOf("E")&&b!==O)return d.push(new k(w,h,u)),!1;if(b==="[object Object]")Object.getOwnPropertyNames(h).forEach(function(x){Object.prototype.hasOwnProperty.call(u,x)?R(h[x],u[x],S(w,x)):-1<f.indexOf("D")&&d.push(new L(S(w,x),h[x]))}),Object.getOwnPropertyNames(u).forEach(function(x){-1<f.indexOf("A")&&!Object.prototype.hasOwnProperty.call(h,x)&&d.push(new v(S(w,x),u[x]))});else if(b!=="[object Array]")-1<f.indexOf("E")&&h!==u&&d.push(new k(w,h,u));else if(F)hr(h,u,w,F);else{var y=h.length-1,g=u.length-1;if(-1<f.indexOf("D"))for(;y>g;)d.push(new L(S(w,y),h[y--]));if(-1<f.indexOf("A"))for(;g>y;)d.push(new v(S(w,g),u[g--]));for(;0<=y;--y)R(h[y],u[y],S(w,y))}};return R(c,p),d}})});var i=(r="",e={})=>{throw new Error(`[joystick${r?`.${r}`:""}] ${e.message||e.reason||e}`)};var $=r=>{try{return!!Array.isArray(r)}catch(e){i("types.isArray",e)}};var U=r=>{try{return typeof r=="function"}catch(e){i("types.isFunction",e)}};var q=r=>{try{return!!(r&&typeof r=="object"&&!Array.isArray(r))}catch(e){i("types.isObject",e)}};var B=r=>{try{return typeof r=="string"}catch(e){i("types.isString",e)}};var W=(r=[],e="")=>{try{return($(r)&&r.find(o=>o?.componentId===e))?.data||{}}catch(t){i("findComponentDataFromSSR",t)}};var or=Or(z());var D=()=>typeof window=="undefined";var Sr=(r="")=>{try{let[e,t]=r?.split(".");return t?window?.joystick?._internal?.queues[e][t]:window?.joystick?._internal?.queues[e]}catch(e){i("addToQueue.getQueue",e)}},E=(r="",e=null)=>{try{D()||(Sr(r)||{}).array.push({callback:e})}catch(t){i("addToQueue",t)}};var br=(r={})=>{try{return Object.values(r).reduce((e={},t)=>(e[t.name]=t.value,e),{})}catch(e){i("component.virtualDOM.build.parseAttributeMap",e)}},G=(r={})=>{try{return r.tagName==="WHEN"?[].flatMap.call(r?.childNodes,e=>e?.tagName==="WHEN"?G(e):H(e)):H(r)}catch(e){i("component.virtualDOM.build.flattenWhenTags",e)}},H=(r={})=>{try{let e=r&&r.tagName&&r.tagName.toLowerCase()||"text",t={tagName:e,attributes:br(r.attributes),children:[].flatMap.call(r.childNodes,o=>G(o))};return e==="text"&&(t=r.textContent),t}catch(e){i("component.virtualDOM.build",e)}},Q=H;var Er=(r="")=>{try{let e=document.createElement("div");return e.innerHTML=r,e?.childNodes[0]}catch(e){i("component.virtualDOM.build.convertHTMLToDOM",e)}},V=(r="")=>{try{let e=Er(r);return Q(e)}catch(e){i("component.virtualDOM.build",e)}};var K=(r="")=>{try{return document.createElement("div").setAttribute(r,"Test"),!0}catch{return!1}};var kr=(r={})=>{try{let e=document.createElement(r.tagName),t=Object.entries(r.attributes);for(let o=0;o<t.length;o+=1){let[n,s]=t[o];K(n)&&e.setAttribute(n,s)}for(let o=0;o<r?.children?.length;o+=1){let n=r?.children[o];if(n){let s=X(n);e.appendChild(s)}}return e}catch(e){i("component.virtualDOM.renderTreeToDOM.renderElement",e)}},X=(r=null)=>{try{return B(r)?document.createTextNode(r):kr(r)}catch(e){i("component.virtualDOM.renderTreeToDOM",e)}},J=X;var Y=(r={},e={})=>{try{let t=Z(r,{existingChildren:e?.existingChildren}),o=V(t.wrapped,r),n=e.includeActual&&o?J(o):null;return{html:t,virtual:o,actual:n}}catch(t){i("component.render.getUpdatedDOM",t)}};var rr=(r={},e="",t="id")=>{try{let o=r&&r.id;if(q(r)&&o){let n=Object.keys(r);for(let s=0;s<n.length;s+=1){let m=n[s],l=r[m];if(m===t&&l===e)return r;if(m==="children"&&Array.isArray(l))for(let M=0;M<l.length;M+=1){let k=l[M],C=rr(k,e,t);if(C!==null)return C}}}return null}catch(o){i("component.findComponentInTreeByField",o)}},er=rr;var tr=(r="",e={},t=null)=>{let o=er(t||window.joystick._internal.tree,r,"instanceId");o&&(o.children=[...o.children||[],e])};var Cr=(r={},e={},t=null)=>{try{let o=Y(r,{includeActual:!0,existingChildren:t});return r.dom=o,r.setDOMNodeOnInstance(),e.renderedComponent=r,o.html.wrapped}catch(o){i("component.renderMethods.component.renderForClient",o)}},Rr=(r={})=>{try{return r.renderToHTML({ssrTree:r.parent.ssrTree,translations:r.parent.translations,walkingTreeForSSR:r?.parent?.walkingTreeForSSR,dataFromSSR:r.parent?.dataFromSSR}).wrapped}catch(e){i("component.renderMethods.component.renderToHTMLForSSR",e)}},jr=(r={})=>{try{return r.parent.ssrTree.dataFunctions.push(async()=>{try{let e=await r.options.data(r.parent.options.api,r.parent.options.req);return r.data=e||{},{componentId:r.id,ssrId:r.ssrId,data:e}}catch(e){return{componentId:r.id,ssrId:r.ssrId,data:null,error:e}}}),r.renderToHTML({ssrTree:r?.parent?.ssrTree,translations:r?.parent?.translations,walkingTreeForSSR:r?.parent?.walkingTreeForSSR,dataFromSSR:r?.parent?.dataFromSSR})}catch(e){i("component.renderMethods.component.collectDataFunctionsForSSR",e)}},Dr=(r={})=>{try{let e={id:r.id,instanceId:r.instanceId,instance:r,children:[]};tr(r.parent.instanceId,e,r.parent&&r.parent.ssrTree||null)}catch(e){i("component.renderMethods.component.handleAddComponentToParent",e)}},Lr=(r={},e={})=>{try{!r.renderedComponent&&e.options&&e.options.lifecycle&&(e.options.lifecycle.onBeforeMount&&E("lifecycle.onBeforeMount",()=>{e.options.lifecycle.onBeforeMount(e)}),!r.renderedComponent&&e.options.lifecycle.onMount&&E("lifecycle.onMount",()=>{e.options.lifecycle.onMount(e)}))}catch(t){i("component.renderMethods.component.handleLifecycle",t)}},vr=(r={},e={},t={})=>{try{!e.walkingTreeForSSR&&r?.options?.lifecycle?.onUpdateProps&&(0,or.diff)(e?.existingPropsMap,t)?.length>0&&E("lifecycle.onUpdateProps",()=>{let n=e?.existingPropsMap&&e?.existingPropsMap[r.id];r.options.lifecycle.onUpdateProps(n||{},t,r)})}catch(o){i("component.renderMethods.component.handleOnChangeProps",o)}},Ar=function(){return function(e=null,t={},o={}){let n=e({props:t,url:o.url,translations:o.translations,api:o.options.api,req:o.options.req,dataFromSSR:o?.dataFromSSR,parent:o}),s=o?.existingStateMap[n.id]||{},m=o.children[n.id]||[],l=s[m?.length];return n.state=l?.state||n.state,o.children[n.id]=[...o.children[n.id]||[],n],n.parent=o,vr(n,o,t),E("lifecycle.onMount",()=>{n.setDOMNodeOnInstance()}),Lr(this,n),n.parent&&Dr(n),n.options.data&&n.parent.walkingTreeForSSR&&n.parent.ssrTree.dataFunctions?jr(n):n.parent&&n.parent.ssrTree?Rr(n):Cr(n,this,l?.children)}},Hr=function(e,t){try{let o=this;return new Ar().bind({})(e,t,o)}catch(o){i("component.renderMethods.component",o)}},N=Hr;var Nr=function(e=[],t=null){try{return U(t)&&e&&Array.isArray(e)?e.map((o,n)=>t(o,n)).join(""):""}catch(o){i("component.renderMethods.each",o)}},_=Nr;var _r=function(e="",t={}){try{let o=D()?this.translations:window.__joystick_i18n__;if(!o||!o[e])return"";let n=Object.entries(t);return n.length>0?n.reduce((s,[m,l])=>s.replace(`{{${m}}}`,l),o[e]):o[e]}catch(o){i("component.renderMethods.i18n",o)}},P=_r;var Pr=function(e=!1,t=""){try{return this?.renderingHTMLWithDataForSSR||e?`<when>${t.trim()}</when>`:"<when> </when>"}catch(o){i("component.renderMethods.when",o)}},I=Pr;var nr={c:N,component:N,e:_,each:_,i:P,i18n:P,w:I,when:I};var ir=(r={},e={})=>{try{return Object.entries(nr).reduce((t,[o,n])=>(t[o]=n.bind({...r,...e}),t),{})}catch(t){i("component.renderMethods.compile",t)}};var cr=(r={},e={})=>{try{return Object.entries(e).reduce((t={},[o,n])=>(t[o]=(...s)=>n(...s,{...r,setState:r.setState.bind(r),...r.renderMethods||{}}),t),{})}catch{i("component.methods.compile")}};var ar=(r={})=>{try{return Object.entries(r)?.reduce((e={},[t,o]={})=>(e[t]=o?.map((n={})=>({state:n?.state,children:ar(n?.children)})),e),{})}catch(e){i("component.render.getExistingStateMap.buildMapForChildren",e)}},sr=(r={})=>{try{return ar(r)}catch(e){i("component.render.getExistingStateMap",e)}};var dr=new RegExp(/\<\!\-\-(?:.|\n|\r)*?-->/g),Ir=new RegExp(/\n/g);var $r=(r="")=>{try{return(r.match(dr)||[]).forEach(t=>{r=r.replace(t,"")}),r}catch(e){i("component.render.sanitizeHTML.removeCommentedCode",e)}},lr=(r="")=>{try{let e=`${r}`;return e=$r(e),e}catch(e){i("component.render.sanitizeHTML",e)}};var ur=(r={},e="")=>{try{let{wrapper:t=null,id:o=null,instanceId:n=null}=r;return`<div ${t?.id?`id="${t.id}" `:""}${t?.classList?`class="${t.classList?.join(" ")}" `:""} js-c="${o}" js-i="${n}">${e}</div>`}catch(t){i("component.render.wrapHTML",t)}};var pr=(r={},e=[])=>{try{let t=[...e],o=Object.entries(r);for(let n=0;n<o?.length;n+=1){let[s,m]=o[n];for(let l=0;l<m?.length;l+=1){let M=m[l];Object.entries(M?.timers)?.length>0&&t.push(...Object.values(M?.timers)),Object.entries(M?.children)?.length>0&&pr(M?.children,t)}}if(t?.length>0)for(let n=0;n<t?.length;n+=1)clearTimeout(t[n])}catch(t){i("component.render.clearTimersOnChildren",t)}},fr=pr;var Z=(r={},e={})=>{try{e?.dataFromSSR&&(r.data=W(e.dataFromSSR,r.id)||{}),fr(r?.children);let t=sr(e?.existingChildren||r?.children)||{};r.children={},r.renderMethods=ir({...r,existingStateMap:t,translations:e?.translations||r.translations||{},ssrTree:e?.ssrTree,walkingTreeForSSR:e?.walkingTreeForSSR,renderingHTMLWithDataForSSR:e?.renderingHTMLWithDataForSSR,dataFromSSR:e?.dataFromSSR}),r.methods=cr(r,r.options.methods);let o=r.options.render({...r||{},setState:r.setState.bind(r),...r.renderMethods||{}}),n=lr(o),s=ur(r,n);return{unwrapped:n,wrapped:s}}catch(t){i("component.render.toHTML",t)}};export{Z as default};
1
+ var wr=Object.create;var v=Object.defineProperty;var yr=Object.getOwnPropertyDescriptor;var xr=Object.getOwnPropertyNames;var Mr=Object.getPrototypeOf,Tr=Object.prototype.hasOwnProperty;var gr=r=>v(r,"__esModule",{value:!0});var Fr=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var Sr=(r,e,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of xr(e))!Tr.call(r,n)&&n!=="default"&&v(r,n,{get:()=>e[n],enumerable:!(t=yr(e,n))||t.enumerable});return r},Or=r=>Sr(gr(v(r!=null?wr(Mr(r)):{},"default",r&&r.__esModule&&"default"in r?{get:()=>r.default,enumerable:!0}:{value:r,enumerable:!0})),r);var G=Fr(R=>{(function(r,e){if(typeof define=="function"&&define.amd)define(["exports"],e);else if(typeof R!="undefined")e(R);else{var t={exports:{}};e(t.exports),r.index=t.exports}})(R,function(r){"use strict";function e(a){return e=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(c){return typeof c}:function(c){return c&&typeof Symbol=="function"&&c.constructor===Symbol&&c!==Symbol.prototype?"symbol":typeof c},e(a)}function t(a,c){return c&&(e(c)==="object"||typeof c=="function")?c:n(a)}function n(a){if(a===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return a}function o(a){return o=Object.setPrototypeOf?Object.getPrototypeOf:function(c){return c.__proto__||Object.getPrototypeOf(c)},o(a)}function s(a,c){if(typeof c!="function"&&c!==null)throw new TypeError("Super expression must either be null or a function");a.prototype=Object.create(c&&c.prototype,{constructor:{value:a,writable:!0,configurable:!0}}),c&&m(a,c)}function m(a,c){return m=Object.setPrototypeOf||function(u,T){return u.__proto__=T,u},m(a,c)}function l(a,c){if(!(a instanceof c))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0}),r.diff=void 0;var M=function a(c,u){l(this,a),this.type=c,this.path=u?u.toString():""},k=function(a){function c(u,T,d){var F;return l(this,c),F=t(this,o(c).call(this,"E",u)),F.lhs=T,F.rhs=d,F}return s(c,a),c}(M),C=function(a){function c(u,T,d,F){var h;return l(this,c),h=t(this,o(c).call(this,"M",u)),h.item=T,h.lhsIndex=d,h.rhsIndex=F,h}return s(c,a),c}(M),L=function(a){function c(u,T){var d;return l(this,c),d=t(this,o(c).call(this,"D",u)),d.lhs=T,d}return s(c,a),c}(M),A=function(a){function c(u,T){var d;return l(this,c),d=t(this,o(c).call(this,"A",u)),d.rhs=T,d}return s(c,a),c}(M),O=function(a,c){return a?"".concat(a,".").concat(c):c};r.diff=function(c,u){var T=2<arguments.length&&arguments[2]!==void 0?arguments[2]:{},d=[],F=T.matchKey,h=T.types||["E","A","D","M"],mr=function(f,p,w,b){f.forEach(function(S,y){var g=p.findIndex(function(x){return x[b]===S[b]});-1<g?(-1<h.indexOf("M")&&y!==g&&d.push(new C(w,S,y,g)),j(S,p[g],O(w,g))):-1<h.indexOf("D")&&d.push(new L(w,S))}),p.forEach(function(S,y){var g=f.findIndex(function(x){return S[b]===x[b]});-1<h.indexOf("A")&&g===-1&&d.push(new A(O(w,y),S))})},j=function(f,p,w){var b=Object.prototype.toString.call(f),S=Object.prototype.toString.call(p);if(-1<h.indexOf("E")&&b!==S)return d.push(new k(w,f,p)),!1;if(b==="[object Object]")Object.getOwnPropertyNames(f).forEach(function(x){Object.prototype.hasOwnProperty.call(p,x)?j(f[x],p[x],O(w,x)):-1<h.indexOf("D")&&d.push(new L(O(w,x),f[x]))}),Object.getOwnPropertyNames(p).forEach(function(x){-1<h.indexOf("A")&&!Object.prototype.hasOwnProperty.call(f,x)&&d.push(new A(O(w,x),p[x]))});else if(b!=="[object Array]")-1<h.indexOf("E")&&f!==p&&d.push(new k(w,f,p));else if(F)mr(f,p,w,F);else{var y=f.length-1,g=p.length-1;if(-1<h.indexOf("D"))for(;y>g;)d.push(new L(O(w,y),f[y--]));if(-1<h.indexOf("A"))for(;g>y;)d.push(new A(O(w,g),p[g--]));for(;0<=y;--y)j(f[y],p[y],O(w,y))}};return j(c,u),d}})});var i=(r="",e={})=>{throw new Error(`[joystick${r?`.${r}`:""}] ${e.message||e.reason||e}`)};var U=r=>{try{return!!Array.isArray(r)}catch(e){i("types.isArray",e)}};var q=r=>{try{return typeof r=="function"}catch(e){i("types.isFunction",e)}};var B=r=>{try{return!!(r&&typeof r=="object"&&!Array.isArray(r))}catch(e){i("types.isObject",e)}};var W=r=>{try{return typeof r=="string"}catch(e){i("types.isString",e)}};var z=(r=[],e="")=>{try{return(U(r)&&r.find(n=>n?.componentId===e))?.data||{}}catch(t){i("findComponentDataFromSSR",t)}};var or=Or(G());var D=()=>typeof window=="undefined";var br=(r="")=>{try{let[e,t]=r?.split(".");return t?window?.joystick?._internal?.queues[e][t]:window?.joystick?._internal?.queues[e]}catch(e){i("addToQueue.getQueue",e)}},E=(r="",e=null)=>{try{D()||(br(r)||{}).array.push({callback:e})}catch(t){i("addToQueue",t)}};var Er=(r={})=>{try{return Object.values(r).reduce((e={},t)=>(e[t.name]=t.value,e),{})}catch(e){i("component.virtualDOM.build.parseAttributeMap",e)}},Q=(r={})=>{try{return r.tagName==="WHEN"?[].flatMap.call(r?.childNodes,e=>e?.tagName==="WHEN"?Q(e):N(e)):N(r)}catch(e){i("component.virtualDOM.build.flattenWhenTags",e)}},N=(r={})=>{try{let e=r&&r.tagName&&r.tagName.toLowerCase()||"text",t={tagName:e,attributes:Er(r.attributes),children:[].flatMap.call(r.childNodes,n=>Q(n))};return e==="text"&&(t=r.textContent),t}catch(e){i("component.virtualDOM.build",e)}},V=N;var kr=(r="")=>{try{let e=document.createElement("div");return e.innerHTML=r,e?.childNodes[0]}catch(e){i("component.virtualDOM.build.convertHTMLToDOM",e)}},K=(r="")=>{try{let e=kr(r);return V(e)}catch(e){i("component.virtualDOM.build",e)}};var X=(r="")=>{try{return document.createElement("div").setAttribute(r,"Test"),!0}catch{return!1}};var Cr=(r={})=>{try{let e=document.createElement(r.tagName),t=Object.entries(r.attributes);for(let n=0;n<t.length;n+=1){let[o,s]=t[n];X(o)&&e.setAttribute(o,s)}for(let n=0;n<r?.children?.length;n+=1){let o=r?.children[n];if(o){let s=J(o);e.appendChild(s)}}return e}catch(e){i("component.virtualDOM.renderTreeToDOM.renderElement",e)}},J=(r=null)=>{try{return W(r)?document.createTextNode(r):Cr(r)}catch(e){i("component.virtualDOM.renderTreeToDOM",e)}},Y=J;var Z=(r={},e={})=>{try{let t=rr(r,{existingChildren:e?.existingChildren}),n=K(t.wrapped,r),o=e.includeActual&&n?Y(n):null;return{html:t,virtual:n,actual:o}}catch(t){i("component.render.getUpdatedDOM",t)}};var er=(r={},e="",t="id")=>{try{let n=r&&r.id;if(B(r)&&n){let o=Object.keys(r);for(let s=0;s<o.length;s+=1){let m=o[s],l=r[m];if(m===t&&l===e)return r;if(m==="children"&&Array.isArray(l))for(let M=0;M<l.length;M+=1){let k=l[M],C=er(k,e,t);if(C!==null)return C}}}return null}catch(n){i("component.findComponentInTreeByField",n)}},tr=er;var nr=(r="",e={},t=null)=>{let n=tr(t||window.joystick._internal.tree,r,"instanceId");n&&(n.children=[...n.children||[],e])};var jr=(r={},e={},t=null)=>{try{let n=Z(r,{includeActual:!0,existingChildren:t});return r.dom=n,r.setDOMNodeOnInstance(),e.renderedComponent=r,n.html.wrapped}catch(n){i("component.renderMethods.component.renderForClient",n)}},Rr=(r={})=>{try{return r.renderToHTML({ssrTree:r.parent.ssrTree,translations:r.parent.translations,walkingTreeForSSR:r?.parent?.walkingTreeForSSR,dataFromSSR:r.parent?.dataFromSSR}).wrapped}catch(e){i("component.renderMethods.component.renderToHTMLForSSR",e)}},Dr=(r={})=>{try{return r.parent.ssrTree.dataFunctions.push(async()=>{try{let e=await r.options.data(r.parent.options.api,r.parent.options.req);return r.data=e||{},{componentId:r.id,ssrId:r.ssrId,data:e}}catch(e){return{componentId:r.id,ssrId:r.ssrId,data:null,error:e}}}),r.renderToHTML({ssrTree:r?.parent?.ssrTree,translations:r?.parent?.translations,walkingTreeForSSR:r?.parent?.walkingTreeForSSR,dataFromSSR:r?.parent?.dataFromSSR})}catch(e){i("component.renderMethods.component.collectDataFunctionsForSSR",e)}},Lr=(r={})=>{try{let e={id:r.id,instanceId:r.instanceId,instance:r,children:[]};nr(r.parent.instanceId,e,r.parent&&r.parent.ssrTree||null)}catch(e){i("component.renderMethods.component.handleAddComponentToParent",e)}},Ar=(r={},e={})=>{try{!r.renderedComponent&&e.options&&e.options.lifecycle&&(e.options.lifecycle.onBeforeMount&&E("lifecycle.onBeforeMount",()=>{e.options.lifecycle.onBeforeMount(e)}),!r.renderedComponent&&e.options.lifecycle.onMount&&E("lifecycle.onMount",()=>{e.options.lifecycle.onMount(e)}))}catch(t){i("component.renderMethods.component.handleLifecycle",t)}},vr=(r={},e={},t={})=>{try{!e.walkingTreeForSSR&&r?.options?.lifecycle?.onUpdateProps&&(0,or.diff)(e?.existingPropsMap,t)?.length>0&&E("lifecycle.onUpdateProps",()=>{let o=e?.existingPropsMap&&e?.existingPropsMap[r.id];r.options.lifecycle.onUpdateProps(o||{},t,r)})}catch(n){i("component.renderMethods.component.handleOnChangeProps",n)}},Nr=function(){return function(e=null,t={},n={}){let o=e({props:t,url:n.url,translations:n.translations,api:n.options.api,req:n.options.req,dataFromSSR:n?.dataFromSSR,parent:n}),s=n?.existingStateMap[o.id]||{},m=n.children[o.id]||[],l=s[m?.length];return o.state=l?.state||o.state,n.children[o.id]=[...n.children[o.id]||[],o],o.parent=n,vr(o,n,t),E("lifecycle.onMount",()=>{o.setDOMNodeOnInstance()}),Ar(this,o),o.parent&&Lr(o),o.options.data&&o.parent.walkingTreeForSSR&&o.parent.ssrTree.dataFunctions?Dr(o):o.parent&&o.parent.ssrTree?Rr(o):jr(o,this,l?.children)}},Pr=function(e,t){try{let n=this;return new Nr().bind({})(e,t,n)}catch(n){i("component.renderMethods.component",n)}},P=Pr;var Hr=function(e=[],t=null){try{return q(t)&&e&&Array.isArray(e)?e.map((n,o)=>t(n,o)).join(""):""}catch(n){i("component.renderMethods.each",n)}},H=Hr;var Ir=(r="",e=[])=>{try{return e.reduce((t,[n,o])=>t.replace(`{{${n}}}`,o),r)}catch(t){i("component.renderMethods.i18n.replacePlaceholdersInString",t)}},I=(r="",e=[])=>{try{let t=typeof r=="string",n=Array.isArray(r),o=typeof r=="object"&&!n;if(t)return Ir(r,e);if(n)return r?.map(s=>I(s,e));if(o)return Object.entries(r)?.reduce((s={},[m,l])=>(s[m]=I(l,e),s),{})}catch(t){i("component.renderMethods.i18n.handleTranslationReplacement",t)}},_r=(r="",e={})=>{try{return r?.split(".").reduce((t,n)=>t[n],e)}catch(t){i("component.renderMethods.i18n.getTranslationAtPath",t)}},$r=function(r="",e={}){try{let t=D()?this.translations:window.__joystick_i18n__,o=r?.includes(".")?_r(r,t):t[r];if(!t||!o)return"";let s=Object.entries(e);return I(o,s)}catch(t){i("component.renderMethods.i18n",t)}},_=$r;var Ur=function(e=!1,t=""){try{return this?.renderingHTMLWithDataForSSR||e?`<when>${t.trim()}</when>`:"<when> </when>"}catch(n){i("component.renderMethods.when",n)}},$=Ur;var ir={c:P,component:P,e:H,each:H,i:_,i18n:_,w:$,when:$};var cr=(r={},e={})=>{try{return Object.entries(ir).reduce((t,[n,o])=>(t[n]=o.bind({...r,...e}),t),{})}catch(t){i("component.renderMethods.compile",t)}};var ar=(r={},e={})=>{try{return Object.entries(e).reduce((t={},[n,o])=>(t[n]=(...s)=>o(...s,{...r,setState:r.setState.bind(r),...r.renderMethods||{}}),t),{})}catch{i("component.methods.compile")}};var sr=(r={})=>{try{return Object.entries(r)?.reduce((e={},[t,n]={})=>(e[t]=n?.map((o={})=>({state:o?.state,children:sr(o?.children)})),e),{})}catch(e){i("component.render.getExistingStateMap.buildMapForChildren",e)}},dr=(r={})=>{try{return sr(r)}catch(e){i("component.render.getExistingStateMap",e)}};var lr=new RegExp(/\<\!\-\-(?:.|\n|\r)*?-->/g),qr=new RegExp(/\n/g);var Br=(r="")=>{try{return(r.match(lr)||[]).forEach(t=>{r=r.replace(t,"")}),r}catch(e){i("component.render.sanitizeHTML.removeCommentedCode",e)}},pr=(r="")=>{try{let e=`${r}`;return e=Br(e),e}catch(e){i("component.render.sanitizeHTML",e)}};var ur=(r={},e="")=>{try{let{wrapper:t=null,id:n=null,instanceId:o=null}=r;return`<div ${t?.id?`id="${t.id}" `:""}${t?.classList?`class="${t.classList?.join(" ")}" `:""} js-c="${n}" js-i="${o}">${e}</div>`}catch(t){i("component.render.wrapHTML",t)}};var hr=(r={},e=[])=>{try{let t=[...e],n=Object.entries(r);for(let o=0;o<n?.length;o+=1){let[s,m]=n[o];for(let l=0;l<m?.length;l+=1){let M=m[l];Object.entries(M?.timers)?.length>0&&t.push(...Object.values(M?.timers)),Object.entries(M?.children)?.length>0&&hr(M?.children,t)}}if(t?.length>0)for(let o=0;o<t?.length;o+=1)clearTimeout(t[o])}catch(t){i("component.render.clearTimersOnChildren",t)}},fr=hr;var rr=(r={},e={})=>{try{e?.dataFromSSR&&(r.data=z(e.dataFromSSR,r.id)||{}),fr(r?.children);let t=dr(e?.existingChildren||r?.children)||{};r.children={},r.renderMethods=cr({...r,existingStateMap:t,translations:e?.translations||r.translations||{},ssrTree:e?.ssrTree,walkingTreeForSSR:e?.walkingTreeForSSR,renderingHTMLWithDataForSSR:e?.renderingHTMLWithDataForSSR,dataFromSSR:e?.dataFromSSR}),r.methods=ar(r,r.options.methods);let n=r.options.render({...r||{},setState:r.setState.bind(r),...r.renderMethods||{}}),o=pr(n),s=ur(r,o);return{unwrapped:o,wrapped:s}}catch(t){i("component.render.toHTML",t)}};export{rr as default};
@@ -1 +1 @@
1
- var mr=Object.create;var A=Object.defineProperty;var wr=Object.getOwnPropertyDescriptor;var yr=Object.getOwnPropertyNames;var xr=Object.getPrototypeOf,Mr=Object.prototype.hasOwnProperty;var Tr=r=>A(r,"__esModule",{value:!0});var gr=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var Fr=(r,e,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of yr(e))!Mr.call(r,o)&&o!=="default"&&A(r,o,{get:()=>e[o],enumerable:!(t=wr(e,o))||t.enumerable});return r},Or=r=>Fr(Tr(A(r!=null?mr(xr(r)):{},"default",r&&r.__esModule&&"default"in r?{get:()=>r.default,enumerable:!0}:{value:r,enumerable:!0})),r);var $=gr(j=>{(function(r,e){if(typeof define=="function"&&define.amd)define(["exports"],e);else if(typeof j!="undefined")e(j);else{var t={exports:{}};e(t.exports),r.index=t.exports}})(j,function(r){"use strict";function e(a){return e=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(c){return typeof c}:function(c){return c&&typeof Symbol=="function"&&c.constructor===Symbol&&c!==Symbol.prototype?"symbol":typeof c},e(a)}function t(a,c){return c&&(e(c)==="object"||typeof c=="function")?c:o(a)}function o(a){if(a===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return a}function n(a){return n=Object.setPrototypeOf?Object.getPrototypeOf:function(c){return c.__proto__||Object.getPrototypeOf(c)},n(a)}function s(a,c){if(typeof c!="function"&&c!==null)throw new TypeError("Super expression must either be null or a function");a.prototype=Object.create(c&&c.prototype,{constructor:{value:a,writable:!0,configurable:!0}}),c&&m(a,c)}function m(a,c){return m=Object.setPrototypeOf||function(p,T){return p.__proto__=T,p},m(a,c)}function l(a,c){if(!(a instanceof c))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0}),r.diff=void 0;var M=function a(c,p){l(this,a),this.type=c,this.path=p?p.toString():""},k=function(a){function c(p,T,d){var F;return l(this,c),F=t(this,n(c).call(this,"E",p)),F.lhs=T,F.rhs=d,F}return s(c,a),c}(M),C=function(a){function c(p,T,d,F){var f;return l(this,c),f=t(this,n(c).call(this,"M",p)),f.item=T,f.lhsIndex=d,f.rhsIndex=F,f}return s(c,a),c}(M),L=function(a){function c(p,T){var d;return l(this,c),d=t(this,n(c).call(this,"D",p)),d.lhs=T,d}return s(c,a),c}(M),v=function(a){function c(p,T){var d;return l(this,c),d=t(this,n(c).call(this,"A",p)),d.rhs=T,d}return s(c,a),c}(M),S=function(a,c){return a?"".concat(a,".").concat(c):c};r.diff=function(c,p){var T=2<arguments.length&&arguments[2]!==void 0?arguments[2]:{},d=[],F=T.matchKey,f=T.types||["E","A","D","M"],hr=function(h,u,w,b){h.forEach(function(O,y){var g=u.findIndex(function(x){return x[b]===O[b]});-1<g?(-1<f.indexOf("M")&&y!==g&&d.push(new C(w,O,y,g)),R(O,u[g],S(w,g))):-1<f.indexOf("D")&&d.push(new L(w,O))}),u.forEach(function(O,y){var g=h.findIndex(function(x){return O[b]===x[b]});-1<f.indexOf("A")&&g===-1&&d.push(new v(S(w,y),O))})},R=function(h,u,w){var b=Object.prototype.toString.call(h),O=Object.prototype.toString.call(u);if(-1<f.indexOf("E")&&b!==O)return d.push(new k(w,h,u)),!1;if(b==="[object Object]")Object.getOwnPropertyNames(h).forEach(function(x){Object.prototype.hasOwnProperty.call(u,x)?R(h[x],u[x],S(w,x)):-1<f.indexOf("D")&&d.push(new L(S(w,x),h[x]))}),Object.getOwnPropertyNames(u).forEach(function(x){-1<f.indexOf("A")&&!Object.prototype.hasOwnProperty.call(h,x)&&d.push(new v(S(w,x),u[x]))});else if(b!=="[object Array]")-1<f.indexOf("E")&&h!==u&&d.push(new k(w,h,u));else if(F)hr(h,u,w,F);else{var y=h.length-1,g=u.length-1;if(-1<f.indexOf("D"))for(;y>g;)d.push(new L(S(w,y),h[y--]));if(-1<f.indexOf("A"))for(;g>y;)d.push(new v(S(w,g),u[g--]));for(;0<=y;--y)R(h[y],u[y],S(w,y))}};return R(c,p),d}})});var i=(r="",e={})=>{throw new Error(`[joystick${r?`.${r}`:""}] ${e.message||e.reason||e}`)};var pr=Or($());var D=()=>typeof window=="undefined";var Sr=(r="")=>{try{let[e,t]=r?.split(".");return t?window?.joystick?._internal?.queues[e][t]:window?.joystick?._internal?.queues[e]}catch(e){i("addToQueue.getQueue",e)}},E=(r="",e=null)=>{try{D()||(Sr(r)||{}).array.push({callback:e})}catch(t){i("addToQueue",t)}};var U=r=>{try{return!!Array.isArray(r)}catch(e){i("types.isArray",e)}};var q=r=>{try{return typeof r=="function"}catch(e){i("types.isFunction",e)}};var B=r=>{try{return!!(r&&typeof r=="object"&&!Array.isArray(r))}catch(e){i("types.isObject",e)}};var W=r=>{try{return typeof r=="string"}catch(e){i("types.isString",e)}};var z=(r=[],e="")=>{try{return(U(r)&&r.find(o=>o?.componentId===e))?.data||{}}catch(t){i("findComponentDataFromSSR",t)}};var G=(r={},e={})=>{try{return Object.entries(e).reduce((t={},[o,n])=>(t[o]=(...s)=>n(...s,{...r,setState:r.setState.bind(r),...r.renderMethods||{}}),t),{})}catch{i("component.methods.compile")}};var Q=(r={})=>{try{return Object.entries(r)?.reduce((e={},[t,o]={})=>(e[t]=o?.map((n={})=>({state:n?.state,children:Q(n?.children)})),e),{})}catch(e){i("component.render.getExistingStateMap.buildMapForChildren",e)}},V=(r={})=>{try{return Q(r)}catch(e){i("component.render.getExistingStateMap",e)}};var K=new RegExp(/\<\!\-\-(?:.|\n|\r)*?-->/g),br=new RegExp(/\n/g);var Er=(r="")=>{try{return(r.match(K)||[]).forEach(t=>{r=r.replace(t,"")}),r}catch(e){i("component.render.sanitizeHTML.removeCommentedCode",e)}},X=(r="")=>{try{let e=`${r}`;return e=Er(e),e}catch(e){i("component.render.sanitizeHTML",e)}};var J=(r={},e="")=>{try{let{wrapper:t=null,id:o=null,instanceId:n=null}=r;return`<div ${t?.id?`id="${t.id}" `:""}${t?.classList?`class="${t.classList?.join(" ")}" `:""} js-c="${o}" js-i="${n}">${e}</div>`}catch(t){i("component.render.wrapHTML",t)}};var Y=(r={},e=[])=>{try{let t=[...e],o=Object.entries(r);for(let n=0;n<o?.length;n+=1){let[s,m]=o[n];for(let l=0;l<m?.length;l+=1){let M=m[l];Object.entries(M?.timers)?.length>0&&t.push(...Object.values(M?.timers)),Object.entries(M?.children)?.length>0&&Y(M?.children,t)}}if(t?.length>0)for(let n=0;n<t?.length;n+=1)clearTimeout(t[n])}catch(t){i("component.render.clearTimersOnChildren",t)}},Z=Y;var rr=(r={},e={})=>{try{e?.dataFromSSR&&(r.data=z(e.dataFromSSR,r.id)||{}),Z(r?.children);let t=V(e?.existingChildren||r?.children)||{};r.children={},r.renderMethods=er({...r,existingStateMap:t,translations:e?.translations||r.translations||{},ssrTree:e?.ssrTree,walkingTreeForSSR:e?.walkingTreeForSSR,renderingHTMLWithDataForSSR:e?.renderingHTMLWithDataForSSR,dataFromSSR:e?.dataFromSSR}),r.methods=G(r,r.options.methods);let o=r.options.render({...r||{},setState:r.setState.bind(r),...r.renderMethods||{}}),n=X(o),s=J(r,n);return{unwrapped:n,wrapped:s}}catch(t){i("component.render.toHTML",t)}};var kr=(r={})=>{try{return Object.values(r).reduce((e={},t)=>(e[t.name]=t.value,e),{})}catch(e){i("component.virtualDOM.build.parseAttributeMap",e)}},tr=(r={})=>{try{return r.tagName==="WHEN"?[].flatMap.call(r?.childNodes,e=>e?.tagName==="WHEN"?tr(e):H(e)):H(r)}catch(e){i("component.virtualDOM.build.flattenWhenTags",e)}},H=(r={})=>{try{let e=r&&r.tagName&&r.tagName.toLowerCase()||"text",t={tagName:e,attributes:kr(r.attributes),children:[].flatMap.call(r.childNodes,o=>tr(o))};return e==="text"&&(t=r.textContent),t}catch(e){i("component.virtualDOM.build",e)}},or=H;var Cr=(r="")=>{try{let e=document.createElement("div");return e.innerHTML=r,e?.childNodes[0]}catch(e){i("component.virtualDOM.build.convertHTMLToDOM",e)}},nr=(r="")=>{try{let e=Cr(r);return or(e)}catch(e){i("component.virtualDOM.build",e)}};var ir=(r="")=>{try{return document.createElement("div").setAttribute(r,"Test"),!0}catch{return!1}};var Rr=(r={})=>{try{let e=document.createElement(r.tagName),t=Object.entries(r.attributes);for(let o=0;o<t.length;o+=1){let[n,s]=t[o];ir(n)&&e.setAttribute(n,s)}for(let o=0;o<r?.children?.length;o+=1){let n=r?.children[o];if(n){let s=cr(n);e.appendChild(s)}}return e}catch(e){i("component.virtualDOM.renderTreeToDOM.renderElement",e)}},cr=(r=null)=>{try{return W(r)?document.createTextNode(r):Rr(r)}catch(e){i("component.virtualDOM.renderTreeToDOM",e)}},ar=cr;var sr=(r={},e={})=>{try{let t=rr(r,{existingChildren:e?.existingChildren}),o=nr(t.wrapped,r),n=e.includeActual&&o?ar(o):null;return{html:t,virtual:o,actual:n}}catch(t){i("component.render.getUpdatedDOM",t)}};var dr=(r={},e="",t="id")=>{try{let o=r&&r.id;if(B(r)&&o){let n=Object.keys(r);for(let s=0;s<n.length;s+=1){let m=n[s],l=r[m];if(m===t&&l===e)return r;if(m==="children"&&Array.isArray(l))for(let M=0;M<l.length;M+=1){let k=l[M],C=dr(k,e,t);if(C!==null)return C}}}return null}catch(o){i("component.findComponentInTreeByField",o)}},lr=dr;var ur=(r="",e={},t=null)=>{let o=lr(t||window.joystick._internal.tree,r,"instanceId");o&&(o.children=[...o.children||[],e])};var jr=(r={},e={},t=null)=>{try{let o=sr(r,{includeActual:!0,existingChildren:t});return r.dom=o,r.setDOMNodeOnInstance(),e.renderedComponent=r,o.html.wrapped}catch(o){i("component.renderMethods.component.renderForClient",o)}},Dr=(r={})=>{try{return r.renderToHTML({ssrTree:r.parent.ssrTree,translations:r.parent.translations,walkingTreeForSSR:r?.parent?.walkingTreeForSSR,dataFromSSR:r.parent?.dataFromSSR}).wrapped}catch(e){i("component.renderMethods.component.renderToHTMLForSSR",e)}},Lr=(r={})=>{try{return r.parent.ssrTree.dataFunctions.push(async()=>{try{let e=await r.options.data(r.parent.options.api,r.parent.options.req);return r.data=e||{},{componentId:r.id,ssrId:r.ssrId,data:e}}catch(e){return{componentId:r.id,ssrId:r.ssrId,data:null,error:e}}}),r.renderToHTML({ssrTree:r?.parent?.ssrTree,translations:r?.parent?.translations,walkingTreeForSSR:r?.parent?.walkingTreeForSSR,dataFromSSR:r?.parent?.dataFromSSR})}catch(e){i("component.renderMethods.component.collectDataFunctionsForSSR",e)}},vr=(r={})=>{try{let e={id:r.id,instanceId:r.instanceId,instance:r,children:[]};ur(r.parent.instanceId,e,r.parent&&r.parent.ssrTree||null)}catch(e){i("component.renderMethods.component.handleAddComponentToParent",e)}},Ar=(r={},e={})=>{try{!r.renderedComponent&&e.options&&e.options.lifecycle&&(e.options.lifecycle.onBeforeMount&&E("lifecycle.onBeforeMount",()=>{e.options.lifecycle.onBeforeMount(e)}),!r.renderedComponent&&e.options.lifecycle.onMount&&E("lifecycle.onMount",()=>{e.options.lifecycle.onMount(e)}))}catch(t){i("component.renderMethods.component.handleLifecycle",t)}},Hr=(r={},e={},t={})=>{try{!e.walkingTreeForSSR&&r?.options?.lifecycle?.onUpdateProps&&(0,pr.diff)(e?.existingPropsMap,t)?.length>0&&E("lifecycle.onUpdateProps",()=>{let n=e?.existingPropsMap&&e?.existingPropsMap[r.id];r.options.lifecycle.onUpdateProps(n||{},t,r)})}catch(o){i("component.renderMethods.component.handleOnChangeProps",o)}},Nr=function(){return function(e=null,t={},o={}){let n=e({props:t,url:o.url,translations:o.translations,api:o.options.api,req:o.options.req,dataFromSSR:o?.dataFromSSR,parent:o}),s=o?.existingStateMap[n.id]||{},m=o.children[n.id]||[],l=s[m?.length];return n.state=l?.state||n.state,o.children[n.id]=[...o.children[n.id]||[],n],n.parent=o,Hr(n,o,t),E("lifecycle.onMount",()=>{n.setDOMNodeOnInstance()}),Ar(this,n),n.parent&&vr(n),n.options.data&&n.parent.walkingTreeForSSR&&n.parent.ssrTree.dataFunctions?Lr(n):n.parent&&n.parent.ssrTree?Dr(n):jr(n,this,l?.children)}},_r=function(e,t){try{let o=this;return new Nr().bind({})(e,t,o)}catch(o){i("component.renderMethods.component",o)}},N=_r;var Pr=function(e=[],t=null){try{return q(t)&&e&&Array.isArray(e)?e.map((o,n)=>t(o,n)).join(""):""}catch(o){i("component.renderMethods.each",o)}},_=Pr;var Ir=function(e="",t={}){try{let o=D()?this.translations:window.__joystick_i18n__;if(!o||!o[e])return"";let n=Object.entries(t);return n.length>0?n.reduce((s,[m,l])=>s.replace(`{{${m}}}`,l),o[e]):o[e]}catch(o){i("component.renderMethods.i18n",o)}},P=Ir;var $r=function(e=!1,t=""){try{return this?.renderingHTMLWithDataForSSR||e?`<when>${t.trim()}</when>`:"<when> </when>"}catch(o){i("component.renderMethods.when",o)}},I=$r;var fr={c:N,component:N,e:_,each:_,i:P,i18n:P,w:I,when:I};var er=(r={},e={})=>{try{return Object.entries(fr).reduce((t,[o,n])=>(t[o]=n.bind({...r,...e}),t),{})}catch(t){i("component.renderMethods.compile",t)}};export{er as default};
1
+ var wr=Object.create;var v=Object.defineProperty;var yr=Object.getOwnPropertyDescriptor;var xr=Object.getOwnPropertyNames;var Mr=Object.getPrototypeOf,Tr=Object.prototype.hasOwnProperty;var gr=r=>v(r,"__esModule",{value:!0});var Fr=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var Sr=(r,e,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of xr(e))!Tr.call(r,n)&&n!=="default"&&v(r,n,{get:()=>e[n],enumerable:!(t=yr(e,n))||t.enumerable});return r},Or=r=>Sr(gr(v(r!=null?wr(Mr(r)):{},"default",r&&r.__esModule&&"default"in r?{get:()=>r.default,enumerable:!0}:{value:r,enumerable:!0})),r);var U=Fr(R=>{(function(r,e){if(typeof define=="function"&&define.amd)define(["exports"],e);else if(typeof R!="undefined")e(R);else{var t={exports:{}};e(t.exports),r.index=t.exports}})(R,function(r){"use strict";function e(a){return e=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(c){return typeof c}:function(c){return c&&typeof Symbol=="function"&&c.constructor===Symbol&&c!==Symbol.prototype?"symbol":typeof c},e(a)}function t(a,c){return c&&(e(c)==="object"||typeof c=="function")?c:n(a)}function n(a){if(a===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return a}function o(a){return o=Object.setPrototypeOf?Object.getPrototypeOf:function(c){return c.__proto__||Object.getPrototypeOf(c)},o(a)}function s(a,c){if(typeof c!="function"&&c!==null)throw new TypeError("Super expression must either be null or a function");a.prototype=Object.create(c&&c.prototype,{constructor:{value:a,writable:!0,configurable:!0}}),c&&m(a,c)}function m(a,c){return m=Object.setPrototypeOf||function(u,T){return u.__proto__=T,u},m(a,c)}function l(a,c){if(!(a instanceof c))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0}),r.diff=void 0;var M=function a(c,u){l(this,a),this.type=c,this.path=u?u.toString():""},k=function(a){function c(u,T,d){var F;return l(this,c),F=t(this,o(c).call(this,"E",u)),F.lhs=T,F.rhs=d,F}return s(c,a),c}(M),C=function(a){function c(u,T,d,F){var h;return l(this,c),h=t(this,o(c).call(this,"M",u)),h.item=T,h.lhsIndex=d,h.rhsIndex=F,h}return s(c,a),c}(M),L=function(a){function c(u,T){var d;return l(this,c),d=t(this,o(c).call(this,"D",u)),d.lhs=T,d}return s(c,a),c}(M),A=function(a){function c(u,T){var d;return l(this,c),d=t(this,o(c).call(this,"A",u)),d.rhs=T,d}return s(c,a),c}(M),O=function(a,c){return a?"".concat(a,".").concat(c):c};r.diff=function(c,u){var T=2<arguments.length&&arguments[2]!==void 0?arguments[2]:{},d=[],F=T.matchKey,h=T.types||["E","A","D","M"],mr=function(f,p,w,b){f.forEach(function(S,y){var g=p.findIndex(function(x){return x[b]===S[b]});-1<g?(-1<h.indexOf("M")&&y!==g&&d.push(new C(w,S,y,g)),j(S,p[g],O(w,g))):-1<h.indexOf("D")&&d.push(new L(w,S))}),p.forEach(function(S,y){var g=f.findIndex(function(x){return S[b]===x[b]});-1<h.indexOf("A")&&g===-1&&d.push(new A(O(w,y),S))})},j=function(f,p,w){var b=Object.prototype.toString.call(f),S=Object.prototype.toString.call(p);if(-1<h.indexOf("E")&&b!==S)return d.push(new k(w,f,p)),!1;if(b==="[object Object]")Object.getOwnPropertyNames(f).forEach(function(x){Object.prototype.hasOwnProperty.call(p,x)?j(f[x],p[x],O(w,x)):-1<h.indexOf("D")&&d.push(new L(O(w,x),f[x]))}),Object.getOwnPropertyNames(p).forEach(function(x){-1<h.indexOf("A")&&!Object.prototype.hasOwnProperty.call(f,x)&&d.push(new A(O(w,x),p[x]))});else if(b!=="[object Array]")-1<h.indexOf("E")&&f!==p&&d.push(new k(w,f,p));else if(F)mr(f,p,w,F);else{var y=f.length-1,g=p.length-1;if(-1<h.indexOf("D"))for(;y>g;)d.push(new L(O(w,y),f[y--]));if(-1<h.indexOf("A"))for(;g>y;)d.push(new A(O(w,g),p[g--]));for(;0<=y;--y)j(f[y],p[y],O(w,y))}};return j(c,u),d}})});var i=(r="",e={})=>{throw new Error(`[joystick${r?`.${r}`:""}] ${e.message||e.reason||e}`)};var hr=Or(U());var D=()=>typeof window=="undefined";var br=(r="")=>{try{let[e,t]=r?.split(".");return t?window?.joystick?._internal?.queues[e][t]:window?.joystick?._internal?.queues[e]}catch(e){i("addToQueue.getQueue",e)}},E=(r="",e=null)=>{try{D()||(br(r)||{}).array.push({callback:e})}catch(t){i("addToQueue",t)}};var q=r=>{try{return!!Array.isArray(r)}catch(e){i("types.isArray",e)}};var B=r=>{try{return typeof r=="function"}catch(e){i("types.isFunction",e)}};var W=r=>{try{return!!(r&&typeof r=="object"&&!Array.isArray(r))}catch(e){i("types.isObject",e)}};var z=r=>{try{return typeof r=="string"}catch(e){i("types.isString",e)}};var G=(r=[],e="")=>{try{return(q(r)&&r.find(n=>n?.componentId===e))?.data||{}}catch(t){i("findComponentDataFromSSR",t)}};var Q=(r={},e={})=>{try{return Object.entries(e).reduce((t={},[n,o])=>(t[n]=(...s)=>o(...s,{...r,setState:r.setState.bind(r),...r.renderMethods||{}}),t),{})}catch{i("component.methods.compile")}};var V=(r={})=>{try{return Object.entries(r)?.reduce((e={},[t,n]={})=>(e[t]=n?.map((o={})=>({state:o?.state,children:V(o?.children)})),e),{})}catch(e){i("component.render.getExistingStateMap.buildMapForChildren",e)}},K=(r={})=>{try{return V(r)}catch(e){i("component.render.getExistingStateMap",e)}};var X=new RegExp(/\<\!\-\-(?:.|\n|\r)*?-->/g),Er=new RegExp(/\n/g);var kr=(r="")=>{try{return(r.match(X)||[]).forEach(t=>{r=r.replace(t,"")}),r}catch(e){i("component.render.sanitizeHTML.removeCommentedCode",e)}},J=(r="")=>{try{let e=`${r}`;return e=kr(e),e}catch(e){i("component.render.sanitizeHTML",e)}};var Y=(r={},e="")=>{try{let{wrapper:t=null,id:n=null,instanceId:o=null}=r;return`<div ${t?.id?`id="${t.id}" `:""}${t?.classList?`class="${t.classList?.join(" ")}" `:""} js-c="${n}" js-i="${o}">${e}</div>`}catch(t){i("component.render.wrapHTML",t)}};var Z=(r={},e=[])=>{try{let t=[...e],n=Object.entries(r);for(let o=0;o<n?.length;o+=1){let[s,m]=n[o];for(let l=0;l<m?.length;l+=1){let M=m[l];Object.entries(M?.timers)?.length>0&&t.push(...Object.values(M?.timers)),Object.entries(M?.children)?.length>0&&Z(M?.children,t)}}if(t?.length>0)for(let o=0;o<t?.length;o+=1)clearTimeout(t[o])}catch(t){i("component.render.clearTimersOnChildren",t)}},rr=Z;var er=(r={},e={})=>{try{e?.dataFromSSR&&(r.data=G(e.dataFromSSR,r.id)||{}),rr(r?.children);let t=K(e?.existingChildren||r?.children)||{};r.children={},r.renderMethods=tr({...r,existingStateMap:t,translations:e?.translations||r.translations||{},ssrTree:e?.ssrTree,walkingTreeForSSR:e?.walkingTreeForSSR,renderingHTMLWithDataForSSR:e?.renderingHTMLWithDataForSSR,dataFromSSR:e?.dataFromSSR}),r.methods=Q(r,r.options.methods);let n=r.options.render({...r||{},setState:r.setState.bind(r),...r.renderMethods||{}}),o=J(n),s=Y(r,o);return{unwrapped:o,wrapped:s}}catch(t){i("component.render.toHTML",t)}};var Cr=(r={})=>{try{return Object.values(r).reduce((e={},t)=>(e[t.name]=t.value,e),{})}catch(e){i("component.virtualDOM.build.parseAttributeMap",e)}},nr=(r={})=>{try{return r.tagName==="WHEN"?[].flatMap.call(r?.childNodes,e=>e?.tagName==="WHEN"?nr(e):N(e)):N(r)}catch(e){i("component.virtualDOM.build.flattenWhenTags",e)}},N=(r={})=>{try{let e=r&&r.tagName&&r.tagName.toLowerCase()||"text",t={tagName:e,attributes:Cr(r.attributes),children:[].flatMap.call(r.childNodes,n=>nr(n))};return e==="text"&&(t=r.textContent),t}catch(e){i("component.virtualDOM.build",e)}},or=N;var jr=(r="")=>{try{let e=document.createElement("div");return e.innerHTML=r,e?.childNodes[0]}catch(e){i("component.virtualDOM.build.convertHTMLToDOM",e)}},ir=(r="")=>{try{let e=jr(r);return or(e)}catch(e){i("component.virtualDOM.build",e)}};var cr=(r="")=>{try{return document.createElement("div").setAttribute(r,"Test"),!0}catch{return!1}};var Rr=(r={})=>{try{let e=document.createElement(r.tagName),t=Object.entries(r.attributes);for(let n=0;n<t.length;n+=1){let[o,s]=t[n];cr(o)&&e.setAttribute(o,s)}for(let n=0;n<r?.children?.length;n+=1){let o=r?.children[n];if(o){let s=ar(o);e.appendChild(s)}}return e}catch(e){i("component.virtualDOM.renderTreeToDOM.renderElement",e)}},ar=(r=null)=>{try{return z(r)?document.createTextNode(r):Rr(r)}catch(e){i("component.virtualDOM.renderTreeToDOM",e)}},sr=ar;var dr=(r={},e={})=>{try{let t=er(r,{existingChildren:e?.existingChildren}),n=ir(t.wrapped,r),o=e.includeActual&&n?sr(n):null;return{html:t,virtual:n,actual:o}}catch(t){i("component.render.getUpdatedDOM",t)}};var lr=(r={},e="",t="id")=>{try{let n=r&&r.id;if(W(r)&&n){let o=Object.keys(r);for(let s=0;s<o.length;s+=1){let m=o[s],l=r[m];if(m===t&&l===e)return r;if(m==="children"&&Array.isArray(l))for(let M=0;M<l.length;M+=1){let k=l[M],C=lr(k,e,t);if(C!==null)return C}}}return null}catch(n){i("component.findComponentInTreeByField",n)}},pr=lr;var ur=(r="",e={},t=null)=>{let n=pr(t||window.joystick._internal.tree,r,"instanceId");n&&(n.children=[...n.children||[],e])};var Dr=(r={},e={},t=null)=>{try{let n=dr(r,{includeActual:!0,existingChildren:t});return r.dom=n,r.setDOMNodeOnInstance(),e.renderedComponent=r,n.html.wrapped}catch(n){i("component.renderMethods.component.renderForClient",n)}},Lr=(r={})=>{try{return r.renderToHTML({ssrTree:r.parent.ssrTree,translations:r.parent.translations,walkingTreeForSSR:r?.parent?.walkingTreeForSSR,dataFromSSR:r.parent?.dataFromSSR}).wrapped}catch(e){i("component.renderMethods.component.renderToHTMLForSSR",e)}},Ar=(r={})=>{try{return r.parent.ssrTree.dataFunctions.push(async()=>{try{let e=await r.options.data(r.parent.options.api,r.parent.options.req);return r.data=e||{},{componentId:r.id,ssrId:r.ssrId,data:e}}catch(e){return{componentId:r.id,ssrId:r.ssrId,data:null,error:e}}}),r.renderToHTML({ssrTree:r?.parent?.ssrTree,translations:r?.parent?.translations,walkingTreeForSSR:r?.parent?.walkingTreeForSSR,dataFromSSR:r?.parent?.dataFromSSR})}catch(e){i("component.renderMethods.component.collectDataFunctionsForSSR",e)}},vr=(r={})=>{try{let e={id:r.id,instanceId:r.instanceId,instance:r,children:[]};ur(r.parent.instanceId,e,r.parent&&r.parent.ssrTree||null)}catch(e){i("component.renderMethods.component.handleAddComponentToParent",e)}},Nr=(r={},e={})=>{try{!r.renderedComponent&&e.options&&e.options.lifecycle&&(e.options.lifecycle.onBeforeMount&&E("lifecycle.onBeforeMount",()=>{e.options.lifecycle.onBeforeMount(e)}),!r.renderedComponent&&e.options.lifecycle.onMount&&E("lifecycle.onMount",()=>{e.options.lifecycle.onMount(e)}))}catch(t){i("component.renderMethods.component.handleLifecycle",t)}},Pr=(r={},e={},t={})=>{try{!e.walkingTreeForSSR&&r?.options?.lifecycle?.onUpdateProps&&(0,hr.diff)(e?.existingPropsMap,t)?.length>0&&E("lifecycle.onUpdateProps",()=>{let o=e?.existingPropsMap&&e?.existingPropsMap[r.id];r.options.lifecycle.onUpdateProps(o||{},t,r)})}catch(n){i("component.renderMethods.component.handleOnChangeProps",n)}},Hr=function(){return function(e=null,t={},n={}){let o=e({props:t,url:n.url,translations:n.translations,api:n.options.api,req:n.options.req,dataFromSSR:n?.dataFromSSR,parent:n}),s=n?.existingStateMap[o.id]||{},m=n.children[o.id]||[],l=s[m?.length];return o.state=l?.state||o.state,n.children[o.id]=[...n.children[o.id]||[],o],o.parent=n,Pr(o,n,t),E("lifecycle.onMount",()=>{o.setDOMNodeOnInstance()}),Nr(this,o),o.parent&&vr(o),o.options.data&&o.parent.walkingTreeForSSR&&o.parent.ssrTree.dataFunctions?Ar(o):o.parent&&o.parent.ssrTree?Lr(o):Dr(o,this,l?.children)}},Ir=function(e,t){try{let n=this;return new Hr().bind({})(e,t,n)}catch(n){i("component.renderMethods.component",n)}},P=Ir;var _r=function(e=[],t=null){try{return B(t)&&e&&Array.isArray(e)?e.map((n,o)=>t(n,o)).join(""):""}catch(n){i("component.renderMethods.each",n)}},H=_r;var $r=(r="",e=[])=>{try{return e.reduce((t,[n,o])=>t.replace(`{{${n}}}`,o),r)}catch(t){i("component.renderMethods.i18n.replacePlaceholdersInString",t)}},I=(r="",e=[])=>{try{let t=typeof r=="string",n=Array.isArray(r),o=typeof r=="object"&&!n;if(t)return $r(r,e);if(n)return r?.map(s=>I(s,e));if(o)return Object.entries(r)?.reduce((s={},[m,l])=>(s[m]=I(l,e),s),{})}catch(t){i("component.renderMethods.i18n.handleTranslationReplacement",t)}},Ur=(r="",e={})=>{try{return r?.split(".").reduce((t,n)=>t[n],e)}catch(t){i("component.renderMethods.i18n.getTranslationAtPath",t)}},qr=function(r="",e={}){try{let t=D()?this.translations:window.__joystick_i18n__,o=r?.includes(".")?Ur(r,t):t[r];if(!t||!o)return"";let s=Object.entries(e);return I(o,s)}catch(t){i("component.renderMethods.i18n",t)}},_=qr;var Br=function(e=!1,t=""){try{return this?.renderingHTMLWithDataForSSR||e?`<when>${t.trim()}</when>`:"<when> </when>"}catch(n){i("component.renderMethods.when",n)}},$=Br;var fr={c:P,component:P,e:H,each:H,i:_,i18n:_,w:$,when:$};var tr=(r={},e={})=>{try{return Object.entries(fr).reduce((t,[n,o])=>(t[n]=o.bind({...r,...e}),t),{})}catch(t){i("component.renderMethods.compile",t)}};export{tr as default};
@@ -1 +1 @@
1
- var mr=Object.create;var A=Object.defineProperty;var wr=Object.getOwnPropertyDescriptor;var yr=Object.getOwnPropertyNames;var xr=Object.getPrototypeOf,Mr=Object.prototype.hasOwnProperty;var Tr=r=>A(r,"__esModule",{value:!0});var gr=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var Fr=(r,e,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of yr(e))!Mr.call(r,o)&&o!=="default"&&A(r,o,{get:()=>e[o],enumerable:!(t=wr(e,o))||t.enumerable});return r},Or=r=>Fr(Tr(A(r!=null?mr(xr(r)):{},"default",r&&r.__esModule&&"default"in r?{get:()=>r.default,enumerable:!0}:{value:r,enumerable:!0})),r);var $=gr(j=>{(function(r,e){if(typeof define=="function"&&define.amd)define(["exports"],e);else if(typeof j!="undefined")e(j);else{var t={exports:{}};e(t.exports),r.index=t.exports}})(j,function(r){"use strict";function e(a){return e=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(c){return typeof c}:function(c){return c&&typeof Symbol=="function"&&c.constructor===Symbol&&c!==Symbol.prototype?"symbol":typeof c},e(a)}function t(a,c){return c&&(e(c)==="object"||typeof c=="function")?c:o(a)}function o(a){if(a===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return a}function n(a){return n=Object.setPrototypeOf?Object.getPrototypeOf:function(c){return c.__proto__||Object.getPrototypeOf(c)},n(a)}function s(a,c){if(typeof c!="function"&&c!==null)throw new TypeError("Super expression must either be null or a function");a.prototype=Object.create(c&&c.prototype,{constructor:{value:a,writable:!0,configurable:!0}}),c&&m(a,c)}function m(a,c){return m=Object.setPrototypeOf||function(p,T){return p.__proto__=T,p},m(a,c)}function l(a,c){if(!(a instanceof c))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0}),r.diff=void 0;var M=function a(c,p){l(this,a),this.type=c,this.path=p?p.toString():""},k=function(a){function c(p,T,d){var F;return l(this,c),F=t(this,n(c).call(this,"E",p)),F.lhs=T,F.rhs=d,F}return s(c,a),c}(M),C=function(a){function c(p,T,d,F){var f;return l(this,c),f=t(this,n(c).call(this,"M",p)),f.item=T,f.lhsIndex=d,f.rhsIndex=F,f}return s(c,a),c}(M),L=function(a){function c(p,T){var d;return l(this,c),d=t(this,n(c).call(this,"D",p)),d.lhs=T,d}return s(c,a),c}(M),v=function(a){function c(p,T){var d;return l(this,c),d=t(this,n(c).call(this,"A",p)),d.rhs=T,d}return s(c,a),c}(M),S=function(a,c){return a?"".concat(a,".").concat(c):c};r.diff=function(c,p){var T=2<arguments.length&&arguments[2]!==void 0?arguments[2]:{},d=[],F=T.matchKey,f=T.types||["E","A","D","M"],hr=function(h,u,w,b){h.forEach(function(O,y){var g=u.findIndex(function(x){return x[b]===O[b]});-1<g?(-1<f.indexOf("M")&&y!==g&&d.push(new C(w,O,y,g)),R(O,u[g],S(w,g))):-1<f.indexOf("D")&&d.push(new L(w,O))}),u.forEach(function(O,y){var g=h.findIndex(function(x){return O[b]===x[b]});-1<f.indexOf("A")&&g===-1&&d.push(new v(S(w,y),O))})},R=function(h,u,w){var b=Object.prototype.toString.call(h),O=Object.prototype.toString.call(u);if(-1<f.indexOf("E")&&b!==O)return d.push(new k(w,h,u)),!1;if(b==="[object Object]")Object.getOwnPropertyNames(h).forEach(function(x){Object.prototype.hasOwnProperty.call(u,x)?R(h[x],u[x],S(w,x)):-1<f.indexOf("D")&&d.push(new L(S(w,x),h[x]))}),Object.getOwnPropertyNames(u).forEach(function(x){-1<f.indexOf("A")&&!Object.prototype.hasOwnProperty.call(h,x)&&d.push(new v(S(w,x),u[x]))});else if(b!=="[object Array]")-1<f.indexOf("E")&&h!==u&&d.push(new k(w,h,u));else if(F)hr(h,u,w,F);else{var y=h.length-1,g=u.length-1;if(-1<f.indexOf("D"))for(;y>g;)d.push(new L(S(w,y),h[y--]));if(-1<f.indexOf("A"))for(;g>y;)d.push(new v(S(w,g),u[g--]));for(;0<=y;--y)R(h[y],u[y],S(w,y))}};return R(c,p),d}})});var fr=Or($());var i=(r="",e={})=>{throw new Error(`[joystick${r?`.${r}`:""}] ${e.message||e.reason||e}`)};var D=()=>typeof window=="undefined";var Sr=(r="")=>{try{let[e,t]=r?.split(".");return t?window?.joystick?._internal?.queues[e][t]:window?.joystick?._internal?.queues[e]}catch(e){i("addToQueue.getQueue",e)}},E=(r="",e=null)=>{try{D()||(Sr(r)||{}).array.push({callback:e})}catch(t){i("addToQueue",t)}};var U=r=>{try{return!!Array.isArray(r)}catch(e){i("types.isArray",e)}};var q=r=>{try{return typeof r=="function"}catch(e){i("types.isFunction",e)}};var B=r=>{try{return!!(r&&typeof r=="object"&&!Array.isArray(r))}catch(e){i("types.isObject",e)}};var W=r=>{try{return typeof r=="string"}catch(e){i("types.isString",e)}};var z=(r=[],e="")=>{try{return(U(r)&&r.find(o=>o?.componentId===e))?.data||{}}catch(t){i("findComponentDataFromSSR",t)}};var br=function(e=[],t=null){try{return q(t)&&e&&Array.isArray(e)?e.map((o,n)=>t(o,n)).join(""):""}catch(o){i("component.renderMethods.each",o)}},H=br;var Er=function(e="",t={}){try{let o=D()?this.translations:window.__joystick_i18n__;if(!o||!o[e])return"";let n=Object.entries(t);return n.length>0?n.reduce((s,[m,l])=>s.replace(`{{${m}}}`,l),o[e]):o[e]}catch(o){i("component.renderMethods.i18n",o)}},N=Er;var kr=function(e=!1,t=""){try{return this?.renderingHTMLWithDataForSSR||e?`<when>${t.trim()}</when>`:"<when> </when>"}catch(o){i("component.renderMethods.when",o)}},_=kr;var G={c:P,component:P,e:H,each:H,i:N,i18n:N,w:_,when:_};var Q=(r={},e={})=>{try{return Object.entries(G).reduce((t,[o,n])=>(t[o]=n.bind({...r,...e}),t),{})}catch(t){i("component.renderMethods.compile",t)}};var V=(r={},e={})=>{try{return Object.entries(e).reduce((t={},[o,n])=>(t[o]=(...s)=>n(...s,{...r,setState:r.setState.bind(r),...r.renderMethods||{}}),t),{})}catch{i("component.methods.compile")}};var K=(r={})=>{try{return Object.entries(r)?.reduce((e={},[t,o]={})=>(e[t]=o?.map((n={})=>({state:n?.state,children:K(n?.children)})),e),{})}catch(e){i("component.render.getExistingStateMap.buildMapForChildren",e)}},X=(r={})=>{try{return K(r)}catch(e){i("component.render.getExistingStateMap",e)}};var J=new RegExp(/\<\!\-\-(?:.|\n|\r)*?-->/g),Cr=new RegExp(/\n/g);var Rr=(r="")=>{try{return(r.match(J)||[]).forEach(t=>{r=r.replace(t,"")}),r}catch(e){i("component.render.sanitizeHTML.removeCommentedCode",e)}},Y=(r="")=>{try{let e=`${r}`;return e=Rr(e),e}catch(e){i("component.render.sanitizeHTML",e)}};var Z=(r={},e="")=>{try{let{wrapper:t=null,id:o=null,instanceId:n=null}=r;return`<div ${t?.id?`id="${t.id}" `:""}${t?.classList?`class="${t.classList?.join(" ")}" `:""} js-c="${o}" js-i="${n}">${e}</div>`}catch(t){i("component.render.wrapHTML",t)}};var rr=(r={},e=[])=>{try{let t=[...e],o=Object.entries(r);for(let n=0;n<o?.length;n+=1){let[s,m]=o[n];for(let l=0;l<m?.length;l+=1){let M=m[l];Object.entries(M?.timers)?.length>0&&t.push(...Object.values(M?.timers)),Object.entries(M?.children)?.length>0&&rr(M?.children,t)}}if(t?.length>0)for(let n=0;n<t?.length;n+=1)clearTimeout(t[n])}catch(t){i("component.render.clearTimersOnChildren",t)}},er=rr;var tr=(r={},e={})=>{try{e?.dataFromSSR&&(r.data=z(e.dataFromSSR,r.id)||{}),er(r?.children);let t=X(e?.existingChildren||r?.children)||{};r.children={},r.renderMethods=Q({...r,existingStateMap:t,translations:e?.translations||r.translations||{},ssrTree:e?.ssrTree,walkingTreeForSSR:e?.walkingTreeForSSR,renderingHTMLWithDataForSSR:e?.renderingHTMLWithDataForSSR,dataFromSSR:e?.dataFromSSR}),r.methods=V(r,r.options.methods);let o=r.options.render({...r||{},setState:r.setState.bind(r),...r.renderMethods||{}}),n=Y(o),s=Z(r,n);return{unwrapped:n,wrapped:s}}catch(t){i("component.render.toHTML",t)}};var jr=(r={})=>{try{return Object.values(r).reduce((e={},t)=>(e[t.name]=t.value,e),{})}catch(e){i("component.virtualDOM.build.parseAttributeMap",e)}},or=(r={})=>{try{return r.tagName==="WHEN"?[].flatMap.call(r?.childNodes,e=>e?.tagName==="WHEN"?or(e):I(e)):I(r)}catch(e){i("component.virtualDOM.build.flattenWhenTags",e)}},I=(r={})=>{try{let e=r&&r.tagName&&r.tagName.toLowerCase()||"text",t={tagName:e,attributes:jr(r.attributes),children:[].flatMap.call(r.childNodes,o=>or(o))};return e==="text"&&(t=r.textContent),t}catch(e){i("component.virtualDOM.build",e)}},nr=I;var Dr=(r="")=>{try{let e=document.createElement("div");return e.innerHTML=r,e?.childNodes[0]}catch(e){i("component.virtualDOM.build.convertHTMLToDOM",e)}},ir=(r="")=>{try{let e=Dr(r);return nr(e)}catch(e){i("component.virtualDOM.build",e)}};var cr=(r="")=>{try{return document.createElement("div").setAttribute(r,"Test"),!0}catch{return!1}};var Lr=(r={})=>{try{let e=document.createElement(r.tagName),t=Object.entries(r.attributes);for(let o=0;o<t.length;o+=1){let[n,s]=t[o];cr(n)&&e.setAttribute(n,s)}for(let o=0;o<r?.children?.length;o+=1){let n=r?.children[o];if(n){let s=ar(n);e.appendChild(s)}}return e}catch(e){i("component.virtualDOM.renderTreeToDOM.renderElement",e)}},ar=(r=null)=>{try{return W(r)?document.createTextNode(r):Lr(r)}catch(e){i("component.virtualDOM.renderTreeToDOM",e)}},sr=ar;var dr=(r={},e={})=>{try{let t=tr(r,{existingChildren:e?.existingChildren}),o=ir(t.wrapped,r),n=e.includeActual&&o?sr(o):null;return{html:t,virtual:o,actual:n}}catch(t){i("component.render.getUpdatedDOM",t)}};var lr=(r={},e="",t="id")=>{try{let o=r&&r.id;if(B(r)&&o){let n=Object.keys(r);for(let s=0;s<n.length;s+=1){let m=n[s],l=r[m];if(m===t&&l===e)return r;if(m==="children"&&Array.isArray(l))for(let M=0;M<l.length;M+=1){let k=l[M],C=lr(k,e,t);if(C!==null)return C}}}return null}catch(o){i("component.findComponentInTreeByField",o)}},ur=lr;var pr=(r="",e={},t=null)=>{let o=ur(t||window.joystick._internal.tree,r,"instanceId");o&&(o.children=[...o.children||[],e])};var vr=(r={},e={},t=null)=>{try{let o=dr(r,{includeActual:!0,existingChildren:t});return r.dom=o,r.setDOMNodeOnInstance(),e.renderedComponent=r,o.html.wrapped}catch(o){i("component.renderMethods.component.renderForClient",o)}},Ar=(r={})=>{try{return r.renderToHTML({ssrTree:r.parent.ssrTree,translations:r.parent.translations,walkingTreeForSSR:r?.parent?.walkingTreeForSSR,dataFromSSR:r.parent?.dataFromSSR}).wrapped}catch(e){i("component.renderMethods.component.renderToHTMLForSSR",e)}},Hr=(r={})=>{try{return r.parent.ssrTree.dataFunctions.push(async()=>{try{let e=await r.options.data(r.parent.options.api,r.parent.options.req);return r.data=e||{},{componentId:r.id,ssrId:r.ssrId,data:e}}catch(e){return{componentId:r.id,ssrId:r.ssrId,data:null,error:e}}}),r.renderToHTML({ssrTree:r?.parent?.ssrTree,translations:r?.parent?.translations,walkingTreeForSSR:r?.parent?.walkingTreeForSSR,dataFromSSR:r?.parent?.dataFromSSR})}catch(e){i("component.renderMethods.component.collectDataFunctionsForSSR",e)}},Nr=(r={})=>{try{let e={id:r.id,instanceId:r.instanceId,instance:r,children:[]};pr(r.parent.instanceId,e,r.parent&&r.parent.ssrTree||null)}catch(e){i("component.renderMethods.component.handleAddComponentToParent",e)}},_r=(r={},e={})=>{try{!r.renderedComponent&&e.options&&e.options.lifecycle&&(e.options.lifecycle.onBeforeMount&&E("lifecycle.onBeforeMount",()=>{e.options.lifecycle.onBeforeMount(e)}),!r.renderedComponent&&e.options.lifecycle.onMount&&E("lifecycle.onMount",()=>{e.options.lifecycle.onMount(e)}))}catch(t){i("component.renderMethods.component.handleLifecycle",t)}},Pr=(r={},e={},t={})=>{try{!e.walkingTreeForSSR&&r?.options?.lifecycle?.onUpdateProps&&(0,fr.diff)(e?.existingPropsMap,t)?.length>0&&E("lifecycle.onUpdateProps",()=>{let n=e?.existingPropsMap&&e?.existingPropsMap[r.id];r.options.lifecycle.onUpdateProps(n||{},t,r)})}catch(o){i("component.renderMethods.component.handleOnChangeProps",o)}},Ir=function(){return function(e=null,t={},o={}){let n=e({props:t,url:o.url,translations:o.translations,api:o.options.api,req:o.options.req,dataFromSSR:o?.dataFromSSR,parent:o}),s=o?.existingStateMap[n.id]||{},m=o.children[n.id]||[],l=s[m?.length];return n.state=l?.state||n.state,o.children[n.id]=[...o.children[n.id]||[],n],n.parent=o,Pr(n,o,t),E("lifecycle.onMount",()=>{n.setDOMNodeOnInstance()}),_r(this,n),n.parent&&Nr(n),n.options.data&&n.parent.walkingTreeForSSR&&n.parent.ssrTree.dataFunctions?Hr(n):n.parent&&n.parent.ssrTree?Ar(n):vr(n,this,l?.children)}},$r=function(e,t){try{let o=this;return new Ir().bind({})(e,t,o)}catch(o){i("component.renderMethods.component",o)}},P=$r;export{P as default};
1
+ var wr=Object.create;var v=Object.defineProperty;var yr=Object.getOwnPropertyDescriptor;var xr=Object.getOwnPropertyNames;var Mr=Object.getPrototypeOf,Tr=Object.prototype.hasOwnProperty;var gr=r=>v(r,"__esModule",{value:!0});var Fr=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var Sr=(r,e,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of xr(e))!Tr.call(r,n)&&n!=="default"&&v(r,n,{get:()=>e[n],enumerable:!(t=yr(e,n))||t.enumerable});return r},Or=r=>Sr(gr(v(r!=null?wr(Mr(r)):{},"default",r&&r.__esModule&&"default"in r?{get:()=>r.default,enumerable:!0}:{value:r,enumerable:!0})),r);var U=Fr(R=>{(function(r,e){if(typeof define=="function"&&define.amd)define(["exports"],e);else if(typeof R!="undefined")e(R);else{var t={exports:{}};e(t.exports),r.index=t.exports}})(R,function(r){"use strict";function e(a){return e=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(c){return typeof c}:function(c){return c&&typeof Symbol=="function"&&c.constructor===Symbol&&c!==Symbol.prototype?"symbol":typeof c},e(a)}function t(a,c){return c&&(e(c)==="object"||typeof c=="function")?c:n(a)}function n(a){if(a===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return a}function o(a){return o=Object.setPrototypeOf?Object.getPrototypeOf:function(c){return c.__proto__||Object.getPrototypeOf(c)},o(a)}function s(a,c){if(typeof c!="function"&&c!==null)throw new TypeError("Super expression must either be null or a function");a.prototype=Object.create(c&&c.prototype,{constructor:{value:a,writable:!0,configurable:!0}}),c&&m(a,c)}function m(a,c){return m=Object.setPrototypeOf||function(u,T){return u.__proto__=T,u},m(a,c)}function l(a,c){if(!(a instanceof c))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0}),r.diff=void 0;var M=function a(c,u){l(this,a),this.type=c,this.path=u?u.toString():""},k=function(a){function c(u,T,d){var F;return l(this,c),F=t(this,o(c).call(this,"E",u)),F.lhs=T,F.rhs=d,F}return s(c,a),c}(M),C=function(a){function c(u,T,d,F){var h;return l(this,c),h=t(this,o(c).call(this,"M",u)),h.item=T,h.lhsIndex=d,h.rhsIndex=F,h}return s(c,a),c}(M),L=function(a){function c(u,T){var d;return l(this,c),d=t(this,o(c).call(this,"D",u)),d.lhs=T,d}return s(c,a),c}(M),A=function(a){function c(u,T){var d;return l(this,c),d=t(this,o(c).call(this,"A",u)),d.rhs=T,d}return s(c,a),c}(M),O=function(a,c){return a?"".concat(a,".").concat(c):c};r.diff=function(c,u){var T=2<arguments.length&&arguments[2]!==void 0?arguments[2]:{},d=[],F=T.matchKey,h=T.types||["E","A","D","M"],mr=function(f,p,w,b){f.forEach(function(S,y){var g=p.findIndex(function(x){return x[b]===S[b]});-1<g?(-1<h.indexOf("M")&&y!==g&&d.push(new C(w,S,y,g)),j(S,p[g],O(w,g))):-1<h.indexOf("D")&&d.push(new L(w,S))}),p.forEach(function(S,y){var g=f.findIndex(function(x){return S[b]===x[b]});-1<h.indexOf("A")&&g===-1&&d.push(new A(O(w,y),S))})},j=function(f,p,w){var b=Object.prototype.toString.call(f),S=Object.prototype.toString.call(p);if(-1<h.indexOf("E")&&b!==S)return d.push(new k(w,f,p)),!1;if(b==="[object Object]")Object.getOwnPropertyNames(f).forEach(function(x){Object.prototype.hasOwnProperty.call(p,x)?j(f[x],p[x],O(w,x)):-1<h.indexOf("D")&&d.push(new L(O(w,x),f[x]))}),Object.getOwnPropertyNames(p).forEach(function(x){-1<h.indexOf("A")&&!Object.prototype.hasOwnProperty.call(f,x)&&d.push(new A(O(w,x),p[x]))});else if(b!=="[object Array]")-1<h.indexOf("E")&&f!==p&&d.push(new k(w,f,p));else if(F)mr(f,p,w,F);else{var y=f.length-1,g=p.length-1;if(-1<h.indexOf("D"))for(;y>g;)d.push(new L(O(w,y),f[y--]));if(-1<h.indexOf("A"))for(;g>y;)d.push(new A(O(w,g),p[g--]));for(;0<=y;--y)j(f[y],p[y],O(w,y))}};return j(c,u),d}})});var fr=Or(U());var i=(r="",e={})=>{throw new Error(`[joystick${r?`.${r}`:""}] ${e.message||e.reason||e}`)};var D=()=>typeof window=="undefined";var br=(r="")=>{try{let[e,t]=r?.split(".");return t?window?.joystick?._internal?.queues[e][t]:window?.joystick?._internal?.queues[e]}catch(e){i("addToQueue.getQueue",e)}},E=(r="",e=null)=>{try{D()||(br(r)||{}).array.push({callback:e})}catch(t){i("addToQueue",t)}};var q=r=>{try{return!!Array.isArray(r)}catch(e){i("types.isArray",e)}};var B=r=>{try{return typeof r=="function"}catch(e){i("types.isFunction",e)}};var W=r=>{try{return!!(r&&typeof r=="object"&&!Array.isArray(r))}catch(e){i("types.isObject",e)}};var z=r=>{try{return typeof r=="string"}catch(e){i("types.isString",e)}};var G=(r=[],e="")=>{try{return(q(r)&&r.find(n=>n?.componentId===e))?.data||{}}catch(t){i("findComponentDataFromSSR",t)}};var Er=function(e=[],t=null){try{return B(t)&&e&&Array.isArray(e)?e.map((n,o)=>t(n,o)).join(""):""}catch(n){i("component.renderMethods.each",n)}},N=Er;var kr=(r="",e=[])=>{try{return e.reduce((t,[n,o])=>t.replace(`{{${n}}}`,o),r)}catch(t){i("component.renderMethods.i18n.replacePlaceholdersInString",t)}},P=(r="",e=[])=>{try{let t=typeof r=="string",n=Array.isArray(r),o=typeof r=="object"&&!n;if(t)return kr(r,e);if(n)return r?.map(s=>P(s,e));if(o)return Object.entries(r)?.reduce((s={},[m,l])=>(s[m]=P(l,e),s),{})}catch(t){i("component.renderMethods.i18n.handleTranslationReplacement",t)}},Cr=(r="",e={})=>{try{return r?.split(".").reduce((t,n)=>t[n],e)}catch(t){i("component.renderMethods.i18n.getTranslationAtPath",t)}},jr=function(r="",e={}){try{let t=D()?this.translations:window.__joystick_i18n__,o=r?.includes(".")?Cr(r,t):t[r];if(!t||!o)return"";let s=Object.entries(e);return P(o,s)}catch(t){i("component.renderMethods.i18n",t)}},H=jr;var Rr=function(e=!1,t=""){try{return this?.renderingHTMLWithDataForSSR||e?`<when>${t.trim()}</when>`:"<when> </when>"}catch(n){i("component.renderMethods.when",n)}},I=Rr;var Q={c:_,component:_,e:N,each:N,i:H,i18n:H,w:I,when:I};var V=(r={},e={})=>{try{return Object.entries(Q).reduce((t,[n,o])=>(t[n]=o.bind({...r,...e}),t),{})}catch(t){i("component.renderMethods.compile",t)}};var K=(r={},e={})=>{try{return Object.entries(e).reduce((t={},[n,o])=>(t[n]=(...s)=>o(...s,{...r,setState:r.setState.bind(r),...r.renderMethods||{}}),t),{})}catch{i("component.methods.compile")}};var X=(r={})=>{try{return Object.entries(r)?.reduce((e={},[t,n]={})=>(e[t]=n?.map((o={})=>({state:o?.state,children:X(o?.children)})),e),{})}catch(e){i("component.render.getExistingStateMap.buildMapForChildren",e)}},J=(r={})=>{try{return X(r)}catch(e){i("component.render.getExistingStateMap",e)}};var Y=new RegExp(/\<\!\-\-(?:.|\n|\r)*?-->/g),Dr=new RegExp(/\n/g);var Lr=(r="")=>{try{return(r.match(Y)||[]).forEach(t=>{r=r.replace(t,"")}),r}catch(e){i("component.render.sanitizeHTML.removeCommentedCode",e)}},Z=(r="")=>{try{let e=`${r}`;return e=Lr(e),e}catch(e){i("component.render.sanitizeHTML",e)}};var rr=(r={},e="")=>{try{let{wrapper:t=null,id:n=null,instanceId:o=null}=r;return`<div ${t?.id?`id="${t.id}" `:""}${t?.classList?`class="${t.classList?.join(" ")}" `:""} js-c="${n}" js-i="${o}">${e}</div>`}catch(t){i("component.render.wrapHTML",t)}};var er=(r={},e=[])=>{try{let t=[...e],n=Object.entries(r);for(let o=0;o<n?.length;o+=1){let[s,m]=n[o];for(let l=0;l<m?.length;l+=1){let M=m[l];Object.entries(M?.timers)?.length>0&&t.push(...Object.values(M?.timers)),Object.entries(M?.children)?.length>0&&er(M?.children,t)}}if(t?.length>0)for(let o=0;o<t?.length;o+=1)clearTimeout(t[o])}catch(t){i("component.render.clearTimersOnChildren",t)}},tr=er;var nr=(r={},e={})=>{try{e?.dataFromSSR&&(r.data=G(e.dataFromSSR,r.id)||{}),tr(r?.children);let t=J(e?.existingChildren||r?.children)||{};r.children={},r.renderMethods=V({...r,existingStateMap:t,translations:e?.translations||r.translations||{},ssrTree:e?.ssrTree,walkingTreeForSSR:e?.walkingTreeForSSR,renderingHTMLWithDataForSSR:e?.renderingHTMLWithDataForSSR,dataFromSSR:e?.dataFromSSR}),r.methods=K(r,r.options.methods);let n=r.options.render({...r||{},setState:r.setState.bind(r),...r.renderMethods||{}}),o=Z(n),s=rr(r,o);return{unwrapped:o,wrapped:s}}catch(t){i("component.render.toHTML",t)}};var Ar=(r={})=>{try{return Object.values(r).reduce((e={},t)=>(e[t.name]=t.value,e),{})}catch(e){i("component.virtualDOM.build.parseAttributeMap",e)}},or=(r={})=>{try{return r.tagName==="WHEN"?[].flatMap.call(r?.childNodes,e=>e?.tagName==="WHEN"?or(e):$(e)):$(r)}catch(e){i("component.virtualDOM.build.flattenWhenTags",e)}},$=(r={})=>{try{let e=r&&r.tagName&&r.tagName.toLowerCase()||"text",t={tagName:e,attributes:Ar(r.attributes),children:[].flatMap.call(r.childNodes,n=>or(n))};return e==="text"&&(t=r.textContent),t}catch(e){i("component.virtualDOM.build",e)}},ir=$;var vr=(r="")=>{try{let e=document.createElement("div");return e.innerHTML=r,e?.childNodes[0]}catch(e){i("component.virtualDOM.build.convertHTMLToDOM",e)}},cr=(r="")=>{try{let e=vr(r);return ir(e)}catch(e){i("component.virtualDOM.build",e)}};var ar=(r="")=>{try{return document.createElement("div").setAttribute(r,"Test"),!0}catch{return!1}};var Nr=(r={})=>{try{let e=document.createElement(r.tagName),t=Object.entries(r.attributes);for(let n=0;n<t.length;n+=1){let[o,s]=t[n];ar(o)&&e.setAttribute(o,s)}for(let n=0;n<r?.children?.length;n+=1){let o=r?.children[n];if(o){let s=sr(o);e.appendChild(s)}}return e}catch(e){i("component.virtualDOM.renderTreeToDOM.renderElement",e)}},sr=(r=null)=>{try{return z(r)?document.createTextNode(r):Nr(r)}catch(e){i("component.virtualDOM.renderTreeToDOM",e)}},dr=sr;var lr=(r={},e={})=>{try{let t=nr(r,{existingChildren:e?.existingChildren}),n=cr(t.wrapped,r),o=e.includeActual&&n?dr(n):null;return{html:t,virtual:n,actual:o}}catch(t){i("component.render.getUpdatedDOM",t)}};var pr=(r={},e="",t="id")=>{try{let n=r&&r.id;if(W(r)&&n){let o=Object.keys(r);for(let s=0;s<o.length;s+=1){let m=o[s],l=r[m];if(m===t&&l===e)return r;if(m==="children"&&Array.isArray(l))for(let M=0;M<l.length;M+=1){let k=l[M],C=pr(k,e,t);if(C!==null)return C}}}return null}catch(n){i("component.findComponentInTreeByField",n)}},ur=pr;var hr=(r="",e={},t=null)=>{let n=ur(t||window.joystick._internal.tree,r,"instanceId");n&&(n.children=[...n.children||[],e])};var Pr=(r={},e={},t=null)=>{try{let n=lr(r,{includeActual:!0,existingChildren:t});return r.dom=n,r.setDOMNodeOnInstance(),e.renderedComponent=r,n.html.wrapped}catch(n){i("component.renderMethods.component.renderForClient",n)}},Hr=(r={})=>{try{return r.renderToHTML({ssrTree:r.parent.ssrTree,translations:r.parent.translations,walkingTreeForSSR:r?.parent?.walkingTreeForSSR,dataFromSSR:r.parent?.dataFromSSR}).wrapped}catch(e){i("component.renderMethods.component.renderToHTMLForSSR",e)}},Ir=(r={})=>{try{return r.parent.ssrTree.dataFunctions.push(async()=>{try{let e=await r.options.data(r.parent.options.api,r.parent.options.req);return r.data=e||{},{componentId:r.id,ssrId:r.ssrId,data:e}}catch(e){return{componentId:r.id,ssrId:r.ssrId,data:null,error:e}}}),r.renderToHTML({ssrTree:r?.parent?.ssrTree,translations:r?.parent?.translations,walkingTreeForSSR:r?.parent?.walkingTreeForSSR,dataFromSSR:r?.parent?.dataFromSSR})}catch(e){i("component.renderMethods.component.collectDataFunctionsForSSR",e)}},_r=(r={})=>{try{let e={id:r.id,instanceId:r.instanceId,instance:r,children:[]};hr(r.parent.instanceId,e,r.parent&&r.parent.ssrTree||null)}catch(e){i("component.renderMethods.component.handleAddComponentToParent",e)}},$r=(r={},e={})=>{try{!r.renderedComponent&&e.options&&e.options.lifecycle&&(e.options.lifecycle.onBeforeMount&&E("lifecycle.onBeforeMount",()=>{e.options.lifecycle.onBeforeMount(e)}),!r.renderedComponent&&e.options.lifecycle.onMount&&E("lifecycle.onMount",()=>{e.options.lifecycle.onMount(e)}))}catch(t){i("component.renderMethods.component.handleLifecycle",t)}},Ur=(r={},e={},t={})=>{try{!e.walkingTreeForSSR&&r?.options?.lifecycle?.onUpdateProps&&(0,fr.diff)(e?.existingPropsMap,t)?.length>0&&E("lifecycle.onUpdateProps",()=>{let o=e?.existingPropsMap&&e?.existingPropsMap[r.id];r.options.lifecycle.onUpdateProps(o||{},t,r)})}catch(n){i("component.renderMethods.component.handleOnChangeProps",n)}},qr=function(){return function(e=null,t={},n={}){let o=e({props:t,url:n.url,translations:n.translations,api:n.options.api,req:n.options.req,dataFromSSR:n?.dataFromSSR,parent:n}),s=n?.existingStateMap[o.id]||{},m=n.children[o.id]||[],l=s[m?.length];return o.state=l?.state||o.state,n.children[o.id]=[...n.children[o.id]||[],o],o.parent=n,Ur(o,n,t),E("lifecycle.onMount",()=>{o.setDOMNodeOnInstance()}),$r(this,o),o.parent&&_r(o),o.options.data&&o.parent.walkingTreeForSSR&&o.parent.ssrTree.dataFunctions?Ir(o):o.parent&&o.parent.ssrTree?Hr(o):Pr(o,this,l?.children)}},Br=function(e,t){try{let n=this;return new qr().bind({})(e,t,n)}catch(n){i("component.renderMethods.component",n)}},_=Br;export{_ as default};