@joystick.js/ui-canary 0.0.0-canary.96 → 0.0.0-canary.98
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/_package.json +1 -1
- package/dist/component/class/index.js +2 -2
- package/dist/component/class/options/allowedComponentOptions.js +1 -1
- package/dist/component/class/options/registerOptions.js +14 -14
- package/dist/component/class/options/validateOptions.js +1 -1
- package/dist/component/class/render/forMount.js +1 -1
- package/dist/component/class/render/getExistingStateMap.js +1 -1
- package/dist/component/class/render/getUpdatedDOM.js +1 -1
- package/dist/component/class/render/toHTML.js +1 -1
- package/dist/component/class/renderMethods/compile.js +1 -1
- package/dist/component/class/renderMethods/component.js +1 -1
- package/dist/component/class/renderMethods/index.js +1 -1
- package/dist/component/class/values/compile.js +1 -0
- package/dist/component/index.js +2 -2
- package/dist/index.js +2 -2
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
var Mr=Object.create;var P=Object.defineProperty;var gr=Object.getOwnPropertyDescriptor;var Tr=Object.getOwnPropertyNames;var Fr=Object.getPrototypeOf,Sr=Object.prototype.hasOwnProperty;var br=r=>P(r,"__esModule",{value:!0});var Or=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var Er=(r,e,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Tr(e))!Sr.call(r,n)&&n!=="default"&&P(r,n,{get:()=>e[n],enumerable:!(t=gr(e,n))||t.enumerable});return r},kr=r=>Er(br(P(r!=null?Mr(Fr(r)):{},"default",r&&r.__esModule&&"default"in r?{get:()=>r.default,enumerable:!0}:{value:r,enumerable:!0})),r);var V=Or(L=>{(function(r,e){if(typeof define=="function"&&define.amd)define(["exports"],e);else if(typeof L!="undefined")e(L);else{var t={exports:{}};e(t.exports),r.index=t.exports}})(L,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():""},j=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),R=function(a){function c(p,g,d,F){var f;return l(this,c),f=t(this,o(c).call(this,"M",p)),f.item=g,f.lhsIndex=d,f.rhsIndex=F,f}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,"D",p)),d.lhs=g,d}return s(c,a),c}(M),N=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),b=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"],xr=function(h,u,w,O){h.forEach(function(S,y){var T=u.findIndex(function(x){return x[O]===S[O]});-1<T?(-1<f.indexOf("M")&&y!==T&&d.push(new R(w,S,y,T)),D(S,u[T],b(w,T))):-1<f.indexOf("D")&&d.push(new v(w,S))}),u.forEach(function(S,y){var T=h.findIndex(function(x){return S[O]===x[O]});-1<f.indexOf("A")&&T===-1&&d.push(new N(b(w,y),S))})},D=function(h,u,w){var O=Object.prototype.toString.call(h),S=Object.prototype.toString.call(u);if(-1<f.indexOf("E")&&O!==S)return d.push(new j(w,h,u)),!1;if(O==="[object Object]")Object.getOwnPropertyNames(h).forEach(function(x){Object.prototype.hasOwnProperty.call(u,x)?D(h[x],u[x],b(w,x)):-1<f.indexOf("D")&&d.push(new v(b(w,x),h[x]))}),Object.getOwnPropertyNames(u).forEach(function(x){-1<f.indexOf("A")&&!Object.prototype.hasOwnProperty.call(h,x)&&d.push(new N(b(w,x),u[x]))});else if(O!=="[object Array]")-1<f.indexOf("E")&&h!==u&&d.push(new j(w,h,u));else if(F)xr(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 v(b(w,y),h[y--]));if(-1<f.indexOf("A"))for(;T>y;)d.push(new N(b(w,T),u[T--]));for(;0<=y;--y)D(h[y],u[y],b(w,y))}};return D(c,p),d}})});var i=(r="",e={})=>{throw new Error(`[joystick${r?`.${r}`:""}] ${e.message||e.reason||e}`)};var B=r=>{try{return!!Array.isArray(r)}catch(e){i("types.isArray",e)}};var W=r=>{try{return typeof r=="function"}catch(e){i("types.isFunction",e)}};var z=r=>{try{return!!(r&&typeof r=="object"&&!Array.isArray(r))}catch(e){i("types.isObject",e)}};var G=r=>{try{return typeof r=="string"}catch(e){i("types.isString",e)}};var Q=(r=[],e="")=>{try{return(B(r)&&r.find(n=>n?.componentId===e))?.data||{}}catch(t){i("findComponentDataFromSSR",t)}};var Z=kr(V());var A=()=>typeof window=="undefined";var Cr=(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)}},C=(r="",e=null)=>{try{A()||(Cr(r)||{}).array.push({callback:e})}catch(t){i("addToQueue",t)}};var K=(r={},e="",t="id")=>{try{let n=r&&r.id;if(z(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 j=l[M],R=K(j,e,t);if(R!==null)return R}}}return null}catch(n){i("component.findComponentInTreeByField",n)}},X=K;var J=(r="",e={},t=null)=>{let n=X(t||window.joystick._internal.tree,r,"instanceId");n&&(n.children=[...n.children||[],e])};var E=(r="",e=[])=>{typeof window!="undefined"&&!!window.__joystick_test__&&(window.test={...window.test||{},functionCalls:{...window?.test?.functionCalls||{},[r]:[...window?.test?.functionCalls&&window?.test?.functionCalls[r]||[],{calledAt:new Date().toISOString(),args:e}]}})};var Y="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890".split(""),k=(r=16)=>{let e="",t=0;for(;t<r;)e+=Y[Math.floor(Math.random()*(Y.length-1))],t+=1;return e};var jr=(r={},e={},t=null)=>{try{let n=rr(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:[]};J(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&&C("lifecycle.onBeforeMount",()=>{e.options.lifecycle.onBeforeMount(e),E(`ui.${e?.options?.test?.name||k()}.lifecycle.onBeforeMount`,[e])}),!r.renderedComponent&&e.options.lifecycle.onMount&&C("lifecycle.onMount",()=>{e.options.lifecycle.onMount(e),E(`ui.${e?.options?.test?.name||k()}.lifecycle.onMount`,[e])}))}catch(t){i("component.renderMethods.component.handleLifecycle",t)}},vr=(r={},e={},t={})=>{try{!e.walkingTreeForSSR&&r?.options?.lifecycle?.onUpdateProps&&(0,Z.diff)(e?.existingPropsMap,t)?.length>0&&C("lifecycle.onUpdateProps",()=>{let o=e?.existingPropsMap&&e?.existingPropsMap[r.id];r.options.lifecycle.onUpdateProps(o||{},t,r),E(`ui.${r?.options?.test?.name||k()}.lifecycle.onBeforeMount`,[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),C("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)}},H=Pr;var Hr=function(e=[],t=null){try{return W(t)&&e&&Array.isArray(e)?e.map((n,o)=>t(n,o)).join(""):""}catch(n){i("component.renderMethods.each",n)}},_=Hr;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)}},Ir=(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=A()?this.translations:window.__joystick_i18n__,o=r?.includes(".")?Ir(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)}},U=Ur;var er={c:H,component:H,e:_,each:_,i:$,i18n:$,w:U,when:U};var tr=(r={},e={})=>{try{return Object.entries(er).reduce((t,[n,o])=>(t[n]=o.bind({...r,...e}),t),{})}catch(t){i("component.renderMethods.compile",t)}};var nr=(r={},e={})=>{try{return Object.entries(e).reduce((t={},[n,o])=>(t[n]=(...s)=>(E(`ui.${r?.options?.test?.name||k()}.methods.${n}`,[...s,{...r,setState:r.setState.bind(r),...r.renderMethods||{}}]),o(...s,{...r,setState:r.setState.bind(r),...r.renderMethods||{}})),t),{})}catch{i("component.methods.compile")}};var or=(r={})=>{try{return Object.entries(r)?.reduce((e={},[t,n]={})=>(e[t]=n?.map((o={})=>({state:o?.state,children:or(o?.children)})),e),{})}catch(e){i("component.render.getExistingStateMap.buildMapForChildren",e)}},ir=(r={})=>{try{return or(r)}catch(e){i("component.render.getExistingStateMap",e)}};var cr=new RegExp(/\<\!\-\-(?:.|\n|\r)*?-->/g),qr=new RegExp(/\n/g);var Br=(r="")=>{try{return(r.match(cr)||[]).forEach(t=>{r=r.replace(t,"")}),r}catch(e){i("component.render.sanitizeHTML.removeCommentedCode",e)}},ar=(r="")=>{try{let e=`${r}`;return e=Br(e),e}catch(e){i("component.render.sanitizeHTML",e)}};var sr=(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 dr=(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&&dr(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)}},lr=dr;var ur=(r={},e={})=>{try{e?.dataFromSSR&&(r.data=Q(e.dataFromSSR,r.id)||{}),lr(r?.children);let t=ir(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=nr(r,r.options.methods);let n=r.options.render({...r||{},setState:r.setState.bind(r),...r.renderMethods||{}}),o=ar(n),s=sr(r,o);return{unwrapped:o,wrapped:s}}catch(t){i("component.render.toHTML",t)}};var Wr=(r={})=>{try{return Object.values(r).reduce((e={},t)=>(e[t.name]=t.value,e),{})}catch(e){i("component.virtualDOM.build.parseAttributeMap",e)}},pr=(r={})=>{try{return r.tagName==="WHEN"?[].flatMap.call(r?.childNodes,e=>e?.tagName==="WHEN"?pr(e):q(e)):q(r)}catch(e){i("component.virtualDOM.build.flattenWhenTags",e)}},q=(r={})=>{try{let e=r&&r.tagName&&r.tagName.toLowerCase()||"text",t={tagName:e,attributes:Wr(r.attributes),children:[].flatMap.call(r.childNodes,n=>pr(n))};return e==="text"&&(t=r.textContent),t}catch(e){i("component.virtualDOM.build",e)}},fr=q;var zr=(r="")=>{try{let e=document.createElement("div");return e.innerHTML=r,e?.childNodes[0]}catch(e){i("component.virtualDOM.build.convertHTMLToDOM",e)}},hr=(r="")=>{try{let e=zr(r);return fr(e)}catch(e){i("component.virtualDOM.build",e)}};var mr=(r="")=>{try{return document.createElement("div").setAttribute(r,"Test"),!0}catch{return!1}};var Gr=(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];mr(o)&&e.setAttribute(o,s)}for(let n=0;n<r?.children?.length;n+=1){let o=r?.children[n];if(o){let s=wr(o);e.appendChild(s)}}return e}catch(e){i("component.virtualDOM.renderTreeToDOM.renderElement",e)}},wr=(r=null)=>{try{return G(r)?document.createTextNode(r):Gr(r)}catch(e){i("component.virtualDOM.renderTreeToDOM",e)}},yr=wr;var rr=(r={},e={})=>{try{let t=ur(r,{existingChildren:e?.existingChildren}),n=hr(t.wrapped,r),o=e.includeActual&&n?yr(n):null;return{html:t,virtual:n,actual:o}}catch(t){i("component.render.getUpdatedDOM",t)}};export{rr as default};
|
|
1
|
+
var Mr=Object.create;var P=Object.defineProperty;var gr=Object.getOwnPropertyDescriptor;var Tr=Object.getOwnPropertyNames;var Fr=Object.getPrototypeOf,Sr=Object.prototype.hasOwnProperty;var br=r=>P(r,"__esModule",{value:!0});var Or=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var Er=(r,e,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Tr(e))!Sr.call(r,n)&&n!=="default"&&P(r,n,{get:()=>e[n],enumerable:!(t=gr(e,n))||t.enumerable});return r},kr=r=>Er(br(P(r!=null?Mr(Fr(r)):{},"default",r&&r.__esModule&&"default"in r?{get:()=>r.default,enumerable:!0}:{value:r,enumerable:!0})),r);var V=Or(v=>{(function(r,e){if(typeof define=="function"&&define.amd)define(["exports"],e);else if(typeof v!="undefined")e(v);else{var t={exports:{}};e(t.exports),r.index=t.exports}})(v,function(r){"use strict";function e(c){return e=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(a){return typeof a}:function(a){return a&&typeof Symbol=="function"&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},e(c)}function t(c,a){return a&&(e(a)==="object"||typeof a=="function")?a:n(c)}function n(c){if(c===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return c}function o(c){return o=Object.setPrototypeOf?Object.getPrototypeOf:function(a){return a.__proto__||Object.getPrototypeOf(a)},o(c)}function s(c,a){if(typeof a!="function"&&a!==null)throw new TypeError("Super expression must either be null or a function");c.prototype=Object.create(a&&a.prototype,{constructor:{value:c,writable:!0,configurable:!0}}),a&&m(c,a)}function m(c,a){return m=Object.setPrototypeOf||function(p,g){return p.__proto__=g,p},m(c,a)}function l(c,a){if(!(c instanceof a))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0}),r.diff=void 0;var M=function c(a,p){l(this,c),this.type=a,this.path=p?p.toString():""},j=function(c){function a(p,g,d){var F;return l(this,a),F=t(this,o(a).call(this,"E",p)),F.lhs=g,F.rhs=d,F}return s(a,c),a}(M),R=function(c){function a(p,g,d,F){var f;return l(this,a),f=t(this,o(a).call(this,"M",p)),f.item=g,f.lhsIndex=d,f.rhsIndex=F,f}return s(a,c),a}(M),A=function(c){function a(p,g){var d;return l(this,a),d=t(this,o(a).call(this,"D",p)),d.lhs=g,d}return s(a,c),a}(M),N=function(c){function a(p,g){var d;return l(this,a),d=t(this,o(a).call(this,"A",p)),d.rhs=g,d}return s(a,c),a}(M),b=function(c,a){return c?"".concat(c,".").concat(a):a};r.diff=function(a,p){var g=2<arguments.length&&arguments[2]!==void 0?arguments[2]:{},d=[],F=g.matchKey,f=g.types||["E","A","D","M"],xr=function(h,u,w,O){h.forEach(function(S,y){var T=u.findIndex(function(x){return x[O]===S[O]});-1<T?(-1<f.indexOf("M")&&y!==T&&d.push(new R(w,S,y,T)),D(S,u[T],b(w,T))):-1<f.indexOf("D")&&d.push(new A(w,S))}),u.forEach(function(S,y){var T=h.findIndex(function(x){return S[O]===x[O]});-1<f.indexOf("A")&&T===-1&&d.push(new N(b(w,y),S))})},D=function(h,u,w){var O=Object.prototype.toString.call(h),S=Object.prototype.toString.call(u);if(-1<f.indexOf("E")&&O!==S)return d.push(new j(w,h,u)),!1;if(O==="[object Object]")Object.getOwnPropertyNames(h).forEach(function(x){Object.prototype.hasOwnProperty.call(u,x)?D(h[x],u[x],b(w,x)):-1<f.indexOf("D")&&d.push(new A(b(w,x),h[x]))}),Object.getOwnPropertyNames(u).forEach(function(x){-1<f.indexOf("A")&&!Object.prototype.hasOwnProperty.call(h,x)&&d.push(new N(b(w,x),u[x]))});else if(O!=="[object Array]")-1<f.indexOf("E")&&h!==u&&d.push(new j(w,h,u));else if(F)xr(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(b(w,y),h[y--]));if(-1<f.indexOf("A"))for(;T>y;)d.push(new N(b(w,T),u[T--]));for(;0<=y;--y)D(h[y],u[y],b(w,y))}};return D(a,p),d}})});var i=(r="",e={})=>{throw new Error(`[joystick${r?`.${r}`:""}] ${e.message||e.reason||e}`)};var B=r=>{try{return!!Array.isArray(r)}catch(e){i("types.isArray",e)}};var W=r=>{try{return typeof r=="function"}catch(e){i("types.isFunction",e)}};var z=r=>{try{return!!(r&&typeof r=="object"&&!Array.isArray(r))}catch(e){i("types.isObject",e)}};var G=r=>{try{return typeof r=="string"}catch(e){i("types.isString",e)}};var Q=(r=[],e="")=>{try{return(B(r)&&r.find(n=>n?.componentId===e))?.data||{}}catch(t){i("findComponentDataFromSSR",t)}};var Z=kr(V());var L=()=>typeof window=="undefined";var Cr=(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)}},C=(r="",e=null)=>{try{L()||(Cr(r)||{}).array.push({callback:e})}catch(t){i("addToQueue",t)}};var K=(r={},e="",t="id")=>{try{let n=r&&r.id;if(z(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 j=l[M],R=K(j,e,t);if(R!==null)return R}}}return null}catch(n){i("component.findComponentInTreeByField",n)}},X=K;var J=(r="",e={},t=null)=>{let n=X(t||window.joystick._internal.tree,r,"instanceId");n&&(n.children=[...n.children||[],e])};var E=(r="",e=[])=>{typeof window!="undefined"&&!!window.__joystick_test__&&(window.test={...window.test||{},functionCalls:{...window?.test?.functionCalls||{},[r]:[...window?.test?.functionCalls&&window?.test?.functionCalls[r]||[],{calledAt:new Date().toISOString(),args:e}]}})};var Y="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890".split(""),k=(r=16)=>{let e="",t=0;for(;t<r;)e+=Y[Math.floor(Math.random()*(Y.length-1))],t+=1;return e};var jr=(r={},e={},t=null)=>{try{let n=rr(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)}},vr=(r={})=>{try{let e={id:r.id,instanceId:r.instanceId,instance:r,children:[]};J(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&&C("lifecycle.onBeforeMount",()=>{e.options.lifecycle.onBeforeMount(e),E(`ui.${e?.options?.test?.name||k()}.lifecycle.onBeforeMount`,[e])}),!r.renderedComponent&&e.options.lifecycle.onMount&&C("lifecycle.onMount",()=>{e.options.lifecycle.onMount(e),E(`ui.${e?.options?.test?.name||k()}.lifecycle.onMount`,[e])}))}catch(t){i("component.renderMethods.component.handleLifecycle",t)}},Ar=(r={},e={},t={})=>{try{!e.walkingTreeForSSR&&r?.options?.lifecycle?.onUpdateProps&&(0,Z.diff)(e?.existingPropsMap,t)?.length>0&&C("lifecycle.onUpdateProps",()=>{let o=e?.existingPropsMap&&e?.existingPropsMap[r.id];r.options.lifecycle.onUpdateProps(o||{},t,r),E(`ui.${r?.options?.test?.name||k()}.lifecycle.onBeforeMount`,[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,o.values=l?.values||o.values,n.children[o.id]=[...n.children[o.id]||[],o],o.parent=n,Ar(o,n,t),C("lifecycle.onMount",()=>{o.setDOMNodeOnInstance()}),Lr(this,o),o.parent&&vr(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)}},H=Pr;var Hr=function(e=[],t=null){try{return W(t)&&e&&Array.isArray(e)?e.map((n,o)=>t(n,o)).join(""):""}catch(n){i("component.renderMethods.each",n)}},_=Hr;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)}},Ir=(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=L()?this.translations:window.__joystick_i18n__,o=r?.includes(".")?Ir(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)}},U=Ur;var er={c:H,component:H,e:_,each:_,i:$,i18n:$,w:U,when:U};var tr=(r={},e={})=>{try{return Object.entries(er).reduce((t,[n,o])=>(t[n]=o.bind({...r,...e}),t),{})}catch(t){i("component.renderMethods.compile",t)}};var nr=(r={},e={})=>{try{return Object.entries(e).reduce((t={},[n,o])=>(t[n]=(...s)=>(E(`ui.${r?.options?.test?.name||k()}.methods.${n}`,[...s,{...r,setState:r.setState.bind(r),...r.renderMethods||{}}]),o(...s,{...r,setState:r.setState.bind(r),...r.renderMethods||{}})),t),{})}catch{i("component.methods.compile")}};var or=(r={})=>{try{return Object.entries(r)?.reduce((e={},[t,n]={})=>(e[t]=n?.map((o={})=>({state:o?.state,values:o?.values,children:or(o?.children)})),e),{})}catch(e){i("component.render.getExistingStateMap.buildMapForChildren",e)}},ir=(r={})=>{try{return or(r)}catch(e){i("component.render.getExistingStateMap",e)}};var ar=new RegExp(/\<\!\-\-(?:.|\n|\r)*?-->/g),qr=new RegExp(/\n/g);var Br=(r="")=>{try{return(r.match(ar)||[]).forEach(t=>{r=r.replace(t,"")}),r}catch(e){i("component.render.sanitizeHTML.removeCommentedCode",e)}},cr=(r="")=>{try{let e=`${r}`;return e=Br(e),e}catch(e){i("component.render.sanitizeHTML",e)}};var sr=(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 dr=(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&&dr(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)}},lr=dr;var ur=(r={},e={})=>{try{e?.dataFromSSR&&(r.data=Q(e.dataFromSSR,r.id)||{}),lr(r?.children);let t=ir(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=nr(r,r.options.methods);let n=r.options.render({...r||{},setState:r.setState.bind(r),...r.renderMethods||{}}),o=cr(n),s=sr(r,o);return{unwrapped:o,wrapped:s}}catch(t){i("component.render.toHTML",t)}};var Wr=(r={})=>{try{return Object.values(r).reduce((e={},t)=>(e[t.name]=t.value,e),{})}catch(e){i("component.virtualDOM.build.parseAttributeMap",e)}},pr=(r={})=>{try{return r.tagName==="WHEN"?[].flatMap.call(r?.childNodes,e=>e?.tagName==="WHEN"?pr(e):q(e)):q(r)}catch(e){i("component.virtualDOM.build.flattenWhenTags",e)}},q=(r={})=>{try{let e=r&&r.tagName&&r.tagName.toLowerCase()||"text",t={tagName:e,attributes:Wr(r.attributes),children:[].flatMap.call(r.childNodes,n=>pr(n))};return e==="text"&&(t=r.textContent),t}catch(e){i("component.virtualDOM.build",e)}},fr=q;var zr=(r="")=>{try{let e=document.createElement("div");return e.innerHTML=r,e?.childNodes[0]}catch(e){i("component.virtualDOM.build.convertHTMLToDOM",e)}},hr=(r="")=>{try{let e=zr(r);return fr(e)}catch(e){i("component.virtualDOM.build",e)}};var mr=(r="")=>{try{return document.createElement("div").setAttribute(r,"Test"),!0}catch{return!1}};var Gr=(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];mr(o)&&e.setAttribute(o,s)}for(let n=0;n<r?.children?.length;n+=1){let o=r?.children[n];if(o){let s=wr(o);e.appendChild(s)}}return e}catch(e){i("component.virtualDOM.renderTreeToDOM.renderElement",e)}},wr=(r=null)=>{try{return G(r)?document.createTextNode(r):Gr(r)}catch(e){i("component.virtualDOM.renderTreeToDOM",e)}},yr=wr;var rr=(r={},e={})=>{try{let t=ur(r,{existingChildren:e?.existingChildren}),n=hr(t.wrapped,r),o=e.includeActual&&n?yr(n):null;return{html:t,virtual:n,actual:o}}catch(t){i("component.render.getUpdatedDOM",t)}};export{rr as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var Mr=Object.create;var P=Object.defineProperty;var gr=Object.getOwnPropertyDescriptor;var Tr=Object.getOwnPropertyNames;var Fr=Object.getPrototypeOf,Sr=Object.prototype.hasOwnProperty;var br=r=>P(r,"__esModule",{value:!0});var Or=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var Er=(r,e,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Tr(e))!Sr.call(r,n)&&n!=="default"&&P(r,n,{get:()=>e[n],enumerable:!(t=gr(e,n))||t.enumerable});return r},kr=r=>Er(br(P(r!=null?Mr(Fr(r)):{},"default",r&&r.__esModule&&"default"in r?{get:()=>r.default,enumerable:!0}:{value:r,enumerable:!0})),r);var V=Or(L=>{(function(r,e){if(typeof define=="function"&&define.amd)define(["exports"],e);else if(typeof L!="undefined")e(L);else{var t={exports:{}};e(t.exports),r.index=t.exports}})(L,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():""},j=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),R=function(a){function c(p,g,d,F){var f;return l(this,c),f=t(this,o(c).call(this,"M",p)),f.item=g,f.lhsIndex=d,f.rhsIndex=F,f}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,"D",p)),d.lhs=g,d}return s(c,a),c}(M),N=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),b=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"],xr=function(h,u,w,O){h.forEach(function(S,y){var T=u.findIndex(function(x){return x[O]===S[O]});-1<T?(-1<f.indexOf("M")&&y!==T&&d.push(new R(w,S,y,T)),D(S,u[T],b(w,T))):-1<f.indexOf("D")&&d.push(new v(w,S))}),u.forEach(function(S,y){var T=h.findIndex(function(x){return S[O]===x[O]});-1<f.indexOf("A")&&T===-1&&d.push(new N(b(w,y),S))})},D=function(h,u,w){var O=Object.prototype.toString.call(h),S=Object.prototype.toString.call(u);if(-1<f.indexOf("E")&&O!==S)return d.push(new j(w,h,u)),!1;if(O==="[object Object]")Object.getOwnPropertyNames(h).forEach(function(x){Object.prototype.hasOwnProperty.call(u,x)?D(h[x],u[x],b(w,x)):-1<f.indexOf("D")&&d.push(new v(b(w,x),h[x]))}),Object.getOwnPropertyNames(u).forEach(function(x){-1<f.indexOf("A")&&!Object.prototype.hasOwnProperty.call(h,x)&&d.push(new N(b(w,x),u[x]))});else if(O!=="[object Array]")-1<f.indexOf("E")&&h!==u&&d.push(new j(w,h,u));else if(F)xr(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 v(b(w,y),h[y--]));if(-1<f.indexOf("A"))for(;T>y;)d.push(new N(b(w,T),u[T--]));for(;0<=y;--y)D(h[y],u[y],b(w,y))}};return D(c,p),d}})});var i=(r="",e={})=>{throw new Error(`[joystick${r?`.${r}`:""}] ${e.message||e.reason||e}`)};var B=r=>{try{return!!Array.isArray(r)}catch(e){i("types.isArray",e)}};var W=r=>{try{return typeof r=="function"}catch(e){i("types.isFunction",e)}};var z=r=>{try{return!!(r&&typeof r=="object"&&!Array.isArray(r))}catch(e){i("types.isObject",e)}};var G=r=>{try{return typeof r=="string"}catch(e){i("types.isString",e)}};var Q=(r=[],e="")=>{try{return(B(r)&&r.find(n=>n?.componentId===e))?.data||{}}catch(t){i("findComponentDataFromSSR",t)}};var ar=kr(V());var A=()=>typeof window=="undefined";var Cr=(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)}},C=(r="",e=null)=>{try{A()||(Cr(r)||{}).array.push({callback:e})}catch(t){i("addToQueue",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)}},K=(r={})=>{try{return r.tagName==="WHEN"?[].flatMap.call(r?.childNodes,e=>e?.tagName==="WHEN"?K(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:jr(r.attributes),children:[].flatMap.call(r.childNodes,n=>K(n))};return e==="text"&&(t=r.textContent),t}catch(e){i("component.virtualDOM.build",e)}},X=H;var Rr=(r="")=>{try{let e=document.createElement("div");return e.innerHTML=r,e?.childNodes[0]}catch(e){i("component.virtualDOM.build.convertHTMLToDOM",e)}},J=(r="")=>{try{let e=Rr(r);return X(e)}catch(e){i("component.virtualDOM.build",e)}};var Y=(r="")=>{try{return document.createElement("div").setAttribute(r,"Test"),!0}catch{return!1}};var Dr=(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];Y(o)&&e.setAttribute(o,s)}for(let n=0;n<r?.children?.length;n+=1){let o=r?.children[n];if(o){let s=Z(o);e.appendChild(s)}}return e}catch(e){i("component.virtualDOM.renderTreeToDOM.renderElement",e)}},Z=(r=null)=>{try{return G(r)?document.createTextNode(r):Dr(r)}catch(e){i("component.virtualDOM.renderTreeToDOM",e)}},rr=Z;var er=(r={},e={})=>{try{let t=tr(r,{existingChildren:e?.existingChildren}),n=J(t.wrapped,r),o=e.includeActual&&n?rr(n):null;return{html:t,virtual:n,actual:o}}catch(t){i("component.render.getUpdatedDOM",t)}};var nr=(r={},e="",t="id")=>{try{let n=r&&r.id;if(z(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 j=l[M],R=nr(j,e,t);if(R!==null)return R}}}return null}catch(n){i("component.findComponentInTreeByField",n)}},or=nr;var ir=(r="",e={},t=null)=>{let n=or(t||window.joystick._internal.tree,r,"instanceId");n&&(n.children=[...n.children||[],e])};var E=(r="",e=[])=>{typeof window!="undefined"&&!!window.__joystick_test__&&(window.test={...window.test||{},functionCalls:{...window?.test?.functionCalls||{},[r]:[...window?.test?.functionCalls&&window?.test?.functionCalls[r]||[],{calledAt:new Date().toISOString(),args:e}]}})};var cr="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890".split(""),k=(r=16)=>{let e="",t=0;for(;t<r;)e+=cr[Math.floor(Math.random()*(cr.length-1))],t+=1;return e};var Lr=(r={},e={},t=null)=>{try{let n=er(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)}},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)}},vr=(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:[]};ir(r.parent.instanceId,e,r.parent&&r.parent.ssrTree||null)}catch(e){i("component.renderMethods.component.handleAddComponentToParent",e)}},Pr=(r={},e={})=>{try{!r.renderedComponent&&e.options&&e.options.lifecycle&&(e.options.lifecycle.onBeforeMount&&C("lifecycle.onBeforeMount",()=>{e.options.lifecycle.onBeforeMount(e),E(`ui.${e?.options?.test?.name||k()}.lifecycle.onBeforeMount`,[e])}),!r.renderedComponent&&e.options.lifecycle.onMount&&C("lifecycle.onMount",()=>{e.options.lifecycle.onMount(e),E(`ui.${e?.options?.test?.name||k()}.lifecycle.onMount`,[e])}))}catch(t){i("component.renderMethods.component.handleLifecycle",t)}},Hr=(r={},e={},t={})=>{try{!e.walkingTreeForSSR&&r?.options?.lifecycle?.onUpdateProps&&(0,ar.diff)(e?.existingPropsMap,t)?.length>0&&C("lifecycle.onUpdateProps",()=>{let o=e?.existingPropsMap&&e?.existingPropsMap[r.id];r.options.lifecycle.onUpdateProps(o||{},t,r),E(`ui.${r?.options?.test?.name||k()}.lifecycle.onBeforeMount`,[o||{},t,r])})}catch(n){i("component.renderMethods.component.handleOnChangeProps",n)}},_r=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,Hr(o,n,t),C("lifecycle.onMount",()=>{o.setDOMNodeOnInstance()}),Pr(this,o),o.parent&&Nr(o),o.options.data&&o.parent.walkingTreeForSSR&&o.parent.ssrTree.dataFunctions?vr(o):o.parent&&o.parent.ssrTree?Ar(o):Lr(o,this,l?.children)}},Ir=function(e,t){try{let n=this;return new _r().bind({})(e,t,n)}catch(n){i("component.renderMethods.component",n)}},_=Ir;var $r=function(e=[],t=null){try{return W(t)&&e&&Array.isArray(e)?e.map((n,o)=>t(n,o)).join(""):""}catch(n){i("component.renderMethods.each",n)}},I=$r;var Ur=(r="",e=[])=>{try{return e.reduce((t,[n,o])=>t.replace(`{{${n}}}`,o),r)}catch(t){i("component.renderMethods.i18n.replacePlaceholdersInString",t)}},$=(r="",e=[])=>{try{let t=typeof r=="string",n=Array.isArray(r),o=typeof r=="object"&&!n;if(t)return Ur(r,e);if(n)return r?.map(s=>$(s,e));if(o)return Object.entries(r)?.reduce((s={},[m,l])=>(s[m]=$(l,e),s),{})}catch(t){i("component.renderMethods.i18n.handleTranslationReplacement",t)}},qr=(r="",e={})=>{try{return r?.split(".").reduce((t,n)=>t[n],e)}catch(t){i("component.renderMethods.i18n.getTranslationAtPath",t)}},Br=function(r="",e={}){try{let t=A()?this.translations:window.__joystick_i18n__,o=r?.includes(".")?qr(r,t):t[r];if(!t||!o)return"";let s=Object.entries(e);return $(o,s)}catch(t){i("component.renderMethods.i18n",t)}},U=Br;var Wr=function(e=!1,t=""){try{return this?.renderingHTMLWithDataForSSR||e?`<when>${t.trim()}</when>`:"<when> </when>"}catch(n){i("component.renderMethods.when",n)}},q=Wr;var sr={c:_,component:_,e:I,each:I,i:U,i18n:U,w:q,when:q};var dr=(r={},e={})=>{try{return Object.entries(sr).reduce((t,[n,o])=>(t[n]=o.bind({...r,...e}),t),{})}catch(t){i("component.renderMethods.compile",t)}};var lr=(r={},e={})=>{try{return Object.entries(e).reduce((t={},[n,o])=>(t[n]=(...s)=>(E(`ui.${r?.options?.test?.name||k()}.methods.${n}`,[...s,{...r,setState:r.setState.bind(r),...r.renderMethods||{}}]),o(...s,{...r,setState:r.setState.bind(r),...r.renderMethods||{}})),t),{})}catch{i("component.methods.compile")}};var ur=(r={})=>{try{return Object.entries(r)?.reduce((e={},[t,n]={})=>(e[t]=n?.map((o={})=>({state:o?.state,children:ur(o?.children)})),e),{})}catch(e){i("component.render.getExistingStateMap.buildMapForChildren",e)}},pr=(r={})=>{try{return ur(r)}catch(e){i("component.render.getExistingStateMap",e)}};var fr=new RegExp(/\<\!\-\-(?:.|\n|\r)*?-->/g),zr=new RegExp(/\n/g);var Gr=(r="")=>{try{return(r.match(fr)||[]).forEach(t=>{r=r.replace(t,"")}),r}catch(e){i("component.render.sanitizeHTML.removeCommentedCode",e)}},hr=(r="")=>{try{let e=`${r}`;return e=Gr(e),e}catch(e){i("component.render.sanitizeHTML",e)}};var mr=(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 wr=(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&&wr(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)}},yr=wr;var tr=(r={},e={})=>{try{e?.dataFromSSR&&(r.data=Q(e.dataFromSSR,r.id)||{}),yr(r?.children);let t=pr(e?.existingChildren||r?.children)||{};r.children={},r.renderMethods=dr({...r,existingStateMap:t,translations:e?.translations||r.translations||{},ssrTree:e?.ssrTree,walkingTreeForSSR:e?.walkingTreeForSSR,renderingHTMLWithDataForSSR:e?.renderingHTMLWithDataForSSR,dataFromSSR:e?.dataFromSSR}),r.methods=lr(r,r.options.methods);let n=r.options.render({...r||{},setState:r.setState.bind(r),...r.renderMethods||{}}),o=hr(n),s=mr(r,o);return{unwrapped:o,wrapped:s}}catch(t){i("component.render.toHTML",t)}};export{tr as default};
|
|
1
|
+
var Mr=Object.create;var P=Object.defineProperty;var gr=Object.getOwnPropertyDescriptor;var Tr=Object.getOwnPropertyNames;var Fr=Object.getPrototypeOf,Sr=Object.prototype.hasOwnProperty;var br=r=>P(r,"__esModule",{value:!0});var Or=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var Er=(r,e,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Tr(e))!Sr.call(r,n)&&n!=="default"&&P(r,n,{get:()=>e[n],enumerable:!(t=gr(e,n))||t.enumerable});return r},kr=r=>Er(br(P(r!=null?Mr(Fr(r)):{},"default",r&&r.__esModule&&"default"in r?{get:()=>r.default,enumerable:!0}:{value:r,enumerable:!0})),r);var V=Or(v=>{(function(r,e){if(typeof define=="function"&&define.amd)define(["exports"],e);else if(typeof v!="undefined")e(v);else{var t={exports:{}};e(t.exports),r.index=t.exports}})(v,function(r){"use strict";function e(c){return e=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(a){return typeof a}:function(a){return a&&typeof Symbol=="function"&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},e(c)}function t(c,a){return a&&(e(a)==="object"||typeof a=="function")?a:n(c)}function n(c){if(c===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return c}function o(c){return o=Object.setPrototypeOf?Object.getPrototypeOf:function(a){return a.__proto__||Object.getPrototypeOf(a)},o(c)}function s(c,a){if(typeof a!="function"&&a!==null)throw new TypeError("Super expression must either be null or a function");c.prototype=Object.create(a&&a.prototype,{constructor:{value:c,writable:!0,configurable:!0}}),a&&m(c,a)}function m(c,a){return m=Object.setPrototypeOf||function(p,g){return p.__proto__=g,p},m(c,a)}function l(c,a){if(!(c instanceof a))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0}),r.diff=void 0;var M=function c(a,p){l(this,c),this.type=a,this.path=p?p.toString():""},j=function(c){function a(p,g,d){var F;return l(this,a),F=t(this,o(a).call(this,"E",p)),F.lhs=g,F.rhs=d,F}return s(a,c),a}(M),R=function(c){function a(p,g,d,F){var f;return l(this,a),f=t(this,o(a).call(this,"M",p)),f.item=g,f.lhsIndex=d,f.rhsIndex=F,f}return s(a,c),a}(M),A=function(c){function a(p,g){var d;return l(this,a),d=t(this,o(a).call(this,"D",p)),d.lhs=g,d}return s(a,c),a}(M),N=function(c){function a(p,g){var d;return l(this,a),d=t(this,o(a).call(this,"A",p)),d.rhs=g,d}return s(a,c),a}(M),b=function(c,a){return c?"".concat(c,".").concat(a):a};r.diff=function(a,p){var g=2<arguments.length&&arguments[2]!==void 0?arguments[2]:{},d=[],F=g.matchKey,f=g.types||["E","A","D","M"],xr=function(h,u,w,O){h.forEach(function(S,y){var T=u.findIndex(function(x){return x[O]===S[O]});-1<T?(-1<f.indexOf("M")&&y!==T&&d.push(new R(w,S,y,T)),D(S,u[T],b(w,T))):-1<f.indexOf("D")&&d.push(new A(w,S))}),u.forEach(function(S,y){var T=h.findIndex(function(x){return S[O]===x[O]});-1<f.indexOf("A")&&T===-1&&d.push(new N(b(w,y),S))})},D=function(h,u,w){var O=Object.prototype.toString.call(h),S=Object.prototype.toString.call(u);if(-1<f.indexOf("E")&&O!==S)return d.push(new j(w,h,u)),!1;if(O==="[object Object]")Object.getOwnPropertyNames(h).forEach(function(x){Object.prototype.hasOwnProperty.call(u,x)?D(h[x],u[x],b(w,x)):-1<f.indexOf("D")&&d.push(new A(b(w,x),h[x]))}),Object.getOwnPropertyNames(u).forEach(function(x){-1<f.indexOf("A")&&!Object.prototype.hasOwnProperty.call(h,x)&&d.push(new N(b(w,x),u[x]))});else if(O!=="[object Array]")-1<f.indexOf("E")&&h!==u&&d.push(new j(w,h,u));else if(F)xr(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(b(w,y),h[y--]));if(-1<f.indexOf("A"))for(;T>y;)d.push(new N(b(w,T),u[T--]));for(;0<=y;--y)D(h[y],u[y],b(w,y))}};return D(a,p),d}})});var i=(r="",e={})=>{throw new Error(`[joystick${r?`.${r}`:""}] ${e.message||e.reason||e}`)};var B=r=>{try{return!!Array.isArray(r)}catch(e){i("types.isArray",e)}};var W=r=>{try{return typeof r=="function"}catch(e){i("types.isFunction",e)}};var z=r=>{try{return!!(r&&typeof r=="object"&&!Array.isArray(r))}catch(e){i("types.isObject",e)}};var G=r=>{try{return typeof r=="string"}catch(e){i("types.isString",e)}};var Q=(r=[],e="")=>{try{return(B(r)&&r.find(n=>n?.componentId===e))?.data||{}}catch(t){i("findComponentDataFromSSR",t)}};var cr=kr(V());var L=()=>typeof window=="undefined";var Cr=(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)}},C=(r="",e=null)=>{try{L()||(Cr(r)||{}).array.push({callback:e})}catch(t){i("addToQueue",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)}},K=(r={})=>{try{return r.tagName==="WHEN"?[].flatMap.call(r?.childNodes,e=>e?.tagName==="WHEN"?K(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:jr(r.attributes),children:[].flatMap.call(r.childNodes,n=>K(n))};return e==="text"&&(t=r.textContent),t}catch(e){i("component.virtualDOM.build",e)}},X=H;var Rr=(r="")=>{try{let e=document.createElement("div");return e.innerHTML=r,e?.childNodes[0]}catch(e){i("component.virtualDOM.build.convertHTMLToDOM",e)}},J=(r="")=>{try{let e=Rr(r);return X(e)}catch(e){i("component.virtualDOM.build",e)}};var Y=(r="")=>{try{return document.createElement("div").setAttribute(r,"Test"),!0}catch{return!1}};var Dr=(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];Y(o)&&e.setAttribute(o,s)}for(let n=0;n<r?.children?.length;n+=1){let o=r?.children[n];if(o){let s=Z(o);e.appendChild(s)}}return e}catch(e){i("component.virtualDOM.renderTreeToDOM.renderElement",e)}},Z=(r=null)=>{try{return G(r)?document.createTextNode(r):Dr(r)}catch(e){i("component.virtualDOM.renderTreeToDOM",e)}},rr=Z;var er=(r={},e={})=>{try{let t=tr(r,{existingChildren:e?.existingChildren}),n=J(t.wrapped,r),o=e.includeActual&&n?rr(n):null;return{html:t,virtual:n,actual:o}}catch(t){i("component.render.getUpdatedDOM",t)}};var nr=(r={},e="",t="id")=>{try{let n=r&&r.id;if(z(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 j=l[M],R=nr(j,e,t);if(R!==null)return R}}}return null}catch(n){i("component.findComponentInTreeByField",n)}},or=nr;var ir=(r="",e={},t=null)=>{let n=or(t||window.joystick._internal.tree,r,"instanceId");n&&(n.children=[...n.children||[],e])};var E=(r="",e=[])=>{typeof window!="undefined"&&!!window.__joystick_test__&&(window.test={...window.test||{},functionCalls:{...window?.test?.functionCalls||{},[r]:[...window?.test?.functionCalls&&window?.test?.functionCalls[r]||[],{calledAt:new Date().toISOString(),args:e}]}})};var ar="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890".split(""),k=(r=16)=>{let e="",t=0;for(;t<r;)e+=ar[Math.floor(Math.random()*(ar.length-1))],t+=1;return e};var vr=(r={},e={},t=null)=>{try{let n=er(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)}},Nr=(r={})=>{try{let e={id:r.id,instanceId:r.instanceId,instance:r,children:[]};ir(r.parent.instanceId,e,r.parent&&r.parent.ssrTree||null)}catch(e){i("component.renderMethods.component.handleAddComponentToParent",e)}},Pr=(r={},e={})=>{try{!r.renderedComponent&&e.options&&e.options.lifecycle&&(e.options.lifecycle.onBeforeMount&&C("lifecycle.onBeforeMount",()=>{e.options.lifecycle.onBeforeMount(e),E(`ui.${e?.options?.test?.name||k()}.lifecycle.onBeforeMount`,[e])}),!r.renderedComponent&&e.options.lifecycle.onMount&&C("lifecycle.onMount",()=>{e.options.lifecycle.onMount(e),E(`ui.${e?.options?.test?.name||k()}.lifecycle.onMount`,[e])}))}catch(t){i("component.renderMethods.component.handleLifecycle",t)}},Hr=(r={},e={},t={})=>{try{!e.walkingTreeForSSR&&r?.options?.lifecycle?.onUpdateProps&&(0,cr.diff)(e?.existingPropsMap,t)?.length>0&&C("lifecycle.onUpdateProps",()=>{let o=e?.existingPropsMap&&e?.existingPropsMap[r.id];r.options.lifecycle.onUpdateProps(o||{},t,r),E(`ui.${r?.options?.test?.name||k()}.lifecycle.onBeforeMount`,[o||{},t,r])})}catch(n){i("component.renderMethods.component.handleOnChangeProps",n)}},_r=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,o.values=l?.values||o.values,n.children[o.id]=[...n.children[o.id]||[],o],o.parent=n,Hr(o,n,t),C("lifecycle.onMount",()=>{o.setDOMNodeOnInstance()}),Pr(this,o),o.parent&&Nr(o),o.options.data&&o.parent.walkingTreeForSSR&&o.parent.ssrTree.dataFunctions?Ar(o):o.parent&&o.parent.ssrTree?Lr(o):vr(o,this,l?.children)}},Ir=function(e,t){try{let n=this;return new _r().bind({})(e,t,n)}catch(n){i("component.renderMethods.component",n)}},_=Ir;var $r=function(e=[],t=null){try{return W(t)&&e&&Array.isArray(e)?e.map((n,o)=>t(n,o)).join(""):""}catch(n){i("component.renderMethods.each",n)}},I=$r;var Ur=(r="",e=[])=>{try{return e.reduce((t,[n,o])=>t.replace(`{{${n}}}`,o),r)}catch(t){i("component.renderMethods.i18n.replacePlaceholdersInString",t)}},$=(r="",e=[])=>{try{let t=typeof r=="string",n=Array.isArray(r),o=typeof r=="object"&&!n;if(t)return Ur(r,e);if(n)return r?.map(s=>$(s,e));if(o)return Object.entries(r)?.reduce((s={},[m,l])=>(s[m]=$(l,e),s),{})}catch(t){i("component.renderMethods.i18n.handleTranslationReplacement",t)}},qr=(r="",e={})=>{try{return r?.split(".").reduce((t,n)=>t[n],e)}catch(t){i("component.renderMethods.i18n.getTranslationAtPath",t)}},Br=function(r="",e={}){try{let t=L()?this.translations:window.__joystick_i18n__,o=r?.includes(".")?qr(r,t):t[r];if(!t||!o)return"";let s=Object.entries(e);return $(o,s)}catch(t){i("component.renderMethods.i18n",t)}},U=Br;var Wr=function(e=!1,t=""){try{return this?.renderingHTMLWithDataForSSR||e?`<when>${t.trim()}</when>`:"<when> </when>"}catch(n){i("component.renderMethods.when",n)}},q=Wr;var sr={c:_,component:_,e:I,each:I,i:U,i18n:U,w:q,when:q};var dr=(r={},e={})=>{try{return Object.entries(sr).reduce((t,[n,o])=>(t[n]=o.bind({...r,...e}),t),{})}catch(t){i("component.renderMethods.compile",t)}};var lr=(r={},e={})=>{try{return Object.entries(e).reduce((t={},[n,o])=>(t[n]=(...s)=>(E(`ui.${r?.options?.test?.name||k()}.methods.${n}`,[...s,{...r,setState:r.setState.bind(r),...r.renderMethods||{}}]),o(...s,{...r,setState:r.setState.bind(r),...r.renderMethods||{}})),t),{})}catch{i("component.methods.compile")}};var ur=(r={})=>{try{return Object.entries(r)?.reduce((e={},[t,n]={})=>(e[t]=n?.map((o={})=>({state:o?.state,values:o?.values,children:ur(o?.children)})),e),{})}catch(e){i("component.render.getExistingStateMap.buildMapForChildren",e)}},pr=(r={})=>{try{return ur(r)}catch(e){i("component.render.getExistingStateMap",e)}};var fr=new RegExp(/\<\!\-\-(?:.|\n|\r)*?-->/g),zr=new RegExp(/\n/g);var Gr=(r="")=>{try{return(r.match(fr)||[]).forEach(t=>{r=r.replace(t,"")}),r}catch(e){i("component.render.sanitizeHTML.removeCommentedCode",e)}},hr=(r="")=>{try{let e=`${r}`;return e=Gr(e),e}catch(e){i("component.render.sanitizeHTML",e)}};var mr=(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 wr=(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&&wr(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)}},yr=wr;var tr=(r={},e={})=>{try{e?.dataFromSSR&&(r.data=Q(e.dataFromSSR,r.id)||{}),yr(r?.children);let t=pr(e?.existingChildren||r?.children)||{};r.children={},r.renderMethods=dr({...r,existingStateMap:t,translations:e?.translations||r.translations||{},ssrTree:e?.ssrTree,walkingTreeForSSR:e?.walkingTreeForSSR,renderingHTMLWithDataForSSR:e?.renderingHTMLWithDataForSSR,dataFromSSR:e?.dataFromSSR}),r.methods=lr(r,r.options.methods);let n=r.options.render({...r||{},setState:r.setState.bind(r),...r.renderMethods||{}}),o=hr(n),s=mr(r,o);return{unwrapped:o,wrapped:s}}catch(t){i("component.render.toHTML",t)}};export{tr as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var Mr=Object.create;var P=Object.defineProperty;var gr=Object.getOwnPropertyDescriptor;var Tr=Object.getOwnPropertyNames;var Fr=Object.getPrototypeOf,Sr=Object.prototype.hasOwnProperty;var br=r=>P(r,"__esModule",{value:!0});var Or=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var Er=(r,e,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Tr(e))!Sr.call(r,n)&&n!=="default"&&P(r,n,{get:()=>e[n],enumerable:!(t=gr(e,n))||t.enumerable});return r},kr=r=>Er(br(P(r!=null?Mr(Fr(r)):{},"default",r&&r.__esModule&&"default"in r?{get:()=>r.default,enumerable:!0}:{value:r,enumerable:!0})),r);var B=Or(L=>{(function(r,e){if(typeof define=="function"&&define.amd)define(["exports"],e);else if(typeof L!="undefined")e(L);else{var t={exports:{}};e(t.exports),r.index=t.exports}})(L,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():""},j=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),R=function(a){function c(p,g,d,F){var f;return l(this,c),f=t(this,o(c).call(this,"M",p)),f.item=g,f.lhsIndex=d,f.rhsIndex=F,f}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,"D",p)),d.lhs=g,d}return s(c,a),c}(M),N=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),b=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"],xr=function(h,u,w,O){h.forEach(function(S,y){var T=u.findIndex(function(x){return x[O]===S[O]});-1<T?(-1<f.indexOf("M")&&y!==T&&d.push(new R(w,S,y,T)),D(S,u[T],b(w,T))):-1<f.indexOf("D")&&d.push(new v(w,S))}),u.forEach(function(S,y){var T=h.findIndex(function(x){return S[O]===x[O]});-1<f.indexOf("A")&&T===-1&&d.push(new N(b(w,y),S))})},D=function(h,u,w){var O=Object.prototype.toString.call(h),S=Object.prototype.toString.call(u);if(-1<f.indexOf("E")&&O!==S)return d.push(new j(w,h,u)),!1;if(O==="[object Object]")Object.getOwnPropertyNames(h).forEach(function(x){Object.prototype.hasOwnProperty.call(u,x)?D(h[x],u[x],b(w,x)):-1<f.indexOf("D")&&d.push(new v(b(w,x),h[x]))}),Object.getOwnPropertyNames(u).forEach(function(x){-1<f.indexOf("A")&&!Object.prototype.hasOwnProperty.call(h,x)&&d.push(new N(b(w,x),u[x]))});else if(O!=="[object Array]")-1<f.indexOf("E")&&h!==u&&d.push(new j(w,h,u));else if(F)xr(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 v(b(w,y),h[y--]));if(-1<f.indexOf("A"))for(;T>y;)d.push(new N(b(w,T),u[T--]));for(;0<=y;--y)D(h[y],u[y],b(w,y))}};return D(c,p),d}})});var i=(r="",e={})=>{throw new Error(`[joystick${r?`.${r}`:""}] ${e.message||e.reason||e}`)};var wr=kr(B());var A=()=>typeof window=="undefined";var Cr=(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)}},C=(r="",e=null)=>{try{A()||(Cr(r)||{}).array.push({callback:e})}catch(t){i("addToQueue",t)}};var W=r=>{try{return!!Array.isArray(r)}catch(e){i("types.isArray",e)}};var z=r=>{try{return typeof r=="function"}catch(e){i("types.isFunction",e)}};var G=r=>{try{return!!(r&&typeof r=="object"&&!Array.isArray(r))}catch(e){i("types.isObject",e)}};var Q=r=>{try{return typeof r=="string"}catch(e){i("types.isString",e)}};var V=(r=[],e="")=>{try{return(W(r)&&r.find(n=>n?.componentId===e))?.data||{}}catch(t){i("findComponentDataFromSSR",t)}};var K="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890".split(""),E=(r=16)=>{let e="",t=0;for(;t<r;)e+=K[Math.floor(Math.random()*(K.length-1))],t+=1;return e};var k=(r="",e=[])=>{typeof window!="undefined"&&!!window.__joystick_test__&&(window.test={...window.test||{},functionCalls:{...window?.test?.functionCalls||{},[r]:[...window?.test?.functionCalls&&window?.test?.functionCalls[r]||[],{calledAt:new Date().toISOString(),args:e}]}})};var X=(r={},e={})=>{try{return Object.entries(e).reduce((t={},[n,o])=>(t[n]=(...s)=>(k(`ui.${r?.options?.test?.name||E()}.methods.${n}`,[...s,{...r,setState:r.setState.bind(r),...r.renderMethods||{}}]),o(...s,{...r,setState:r.setState.bind(r),...r.renderMethods||{}})),t),{})}catch{i("component.methods.compile")}};var J=(r={})=>{try{return Object.entries(r)?.reduce((e={},[t,n]={})=>(e[t]=n?.map((o={})=>({state:o?.state,children:J(o?.children)})),e),{})}catch(e){i("component.render.getExistingStateMap.buildMapForChildren",e)}},Y=(r={})=>{try{return J(r)}catch(e){i("component.render.getExistingStateMap",e)}};var Z=new RegExp(/\<\!\-\-(?:.|\n|\r)*?-->/g),jr=new RegExp(/\n/g);var Rr=(r="")=>{try{return(r.match(Z)||[]).forEach(t=>{r=r.replace(t,"")}),r}catch(e){i("component.render.sanitizeHTML.removeCommentedCode",e)}},rr=(r="")=>{try{let e=`${r}`;return e=Rr(e),e}catch(e){i("component.render.sanitizeHTML",e)}};var er=(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 tr=(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&&tr(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)}},nr=tr;var or=(r={},e={})=>{try{e?.dataFromSSR&&(r.data=V(e.dataFromSSR,r.id)||{}),nr(r?.children);let t=Y(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=X(r,r.options.methods);let n=r.options.render({...r||{},setState:r.setState.bind(r),...r.renderMethods||{}}),o=rr(n),s=er(r,o);return{unwrapped:o,wrapped:s}}catch(t){i("component.render.toHTML",t)}};var Dr=(r={})=>{try{return Object.values(r).reduce((e={},t)=>(e[t.name]=t.value,e),{})}catch(e){i("component.virtualDOM.build.parseAttributeMap",e)}},cr=(r={})=>{try{return r.tagName==="WHEN"?[].flatMap.call(r?.childNodes,e=>e?.tagName==="WHEN"?cr(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:Dr(r.attributes),children:[].flatMap.call(r.childNodes,n=>cr(n))};return e==="text"&&(t=r.textContent),t}catch(e){i("component.virtualDOM.build",e)}},ar=H;var Lr=(r="")=>{try{let e=document.createElement("div");return e.innerHTML=r,e?.childNodes[0]}catch(e){i("component.virtualDOM.build.convertHTMLToDOM",e)}},sr=(r="")=>{try{let e=Lr(r);return ar(e)}catch(e){i("component.virtualDOM.build",e)}};var dr=(r="")=>{try{return document.createElement("div").setAttribute(r,"Test"),!0}catch{return!1}};var Ar=(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];dr(o)&&e.setAttribute(o,s)}for(let n=0;n<r?.children?.length;n+=1){let o=r?.children[n];if(o){let s=lr(o);e.appendChild(s)}}return e}catch(e){i("component.virtualDOM.renderTreeToDOM.renderElement",e)}},lr=(r=null)=>{try{return Q(r)?document.createTextNode(r):Ar(r)}catch(e){i("component.virtualDOM.renderTreeToDOM",e)}},ur=lr;var pr=(r={},e={})=>{try{let t=or(r,{existingChildren:e?.existingChildren}),n=sr(t.wrapped,r),o=e.includeActual&&n?ur(n):null;return{html:t,virtual:n,actual:o}}catch(t){i("component.render.getUpdatedDOM",t)}};var fr=(r={},e="",t="id")=>{try{let n=r&&r.id;if(G(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 j=l[M],R=fr(j,e,t);if(R!==null)return R}}}return null}catch(n){i("component.findComponentInTreeByField",n)}},hr=fr;var mr=(r="",e={},t=null)=>{let n=hr(t||window.joystick._internal.tree,r,"instanceId");n&&(n.children=[...n.children||[],e])};var vr=(r={},e={},t=null)=>{try{let n=pr(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)}},Nr=(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)}},Pr=(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)}},Hr=(r={})=>{try{let e={id:r.id,instanceId:r.instanceId,instance:r,children:[]};mr(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&&C("lifecycle.onBeforeMount",()=>{e.options.lifecycle.onBeforeMount(e),k(`ui.${e?.options?.test?.name||E()}.lifecycle.onBeforeMount`,[e])}),!r.renderedComponent&&e.options.lifecycle.onMount&&C("lifecycle.onMount",()=>{e.options.lifecycle.onMount(e),k(`ui.${e?.options?.test?.name||E()}.lifecycle.onMount`,[e])}))}catch(t){i("component.renderMethods.component.handleLifecycle",t)}},Ir=(r={},e={},t={})=>{try{!e.walkingTreeForSSR&&r?.options?.lifecycle?.onUpdateProps&&(0,wr.diff)(e?.existingPropsMap,t)?.length>0&&C("lifecycle.onUpdateProps",()=>{let o=e?.existingPropsMap&&e?.existingPropsMap[r.id];r.options.lifecycle.onUpdateProps(o||{},t,r),k(`ui.${r?.options?.test?.name||E()}.lifecycle.onBeforeMount`,[o||{},t,r])})}catch(n){i("component.renderMethods.component.handleOnChangeProps",n)}},$r=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,Ir(o,n,t),C("lifecycle.onMount",()=>{o.setDOMNodeOnInstance()}),_r(this,o),o.parent&&Hr(o),o.options.data&&o.parent.walkingTreeForSSR&&o.parent.ssrTree.dataFunctions?Pr(o):o.parent&&o.parent.ssrTree?Nr(o):vr(o,this,l?.children)}},Ur=function(e,t){try{let n=this;return new $r().bind({})(e,t,n)}catch(n){i("component.renderMethods.component",n)}},_=Ur;var qr=function(e=[],t=null){try{return z(t)&&e&&Array.isArray(e)?e.map((n,o)=>t(n,o)).join(""):""}catch(n){i("component.renderMethods.each",n)}},I=qr;var Br=(r="",e=[])=>{try{return e.reduce((t,[n,o])=>t.replace(`{{${n}}}`,o),r)}catch(t){i("component.renderMethods.i18n.replacePlaceholdersInString",t)}},$=(r="",e=[])=>{try{let t=typeof r=="string",n=Array.isArray(r),o=typeof r=="object"&&!n;if(t)return Br(r,e);if(n)return r?.map(s=>$(s,e));if(o)return Object.entries(r)?.reduce((s={},[m,l])=>(s[m]=$(l,e),s),{})}catch(t){i("component.renderMethods.i18n.handleTranslationReplacement",t)}},Wr=(r="",e={})=>{try{return r?.split(".").reduce((t,n)=>t[n],e)}catch(t){i("component.renderMethods.i18n.getTranslationAtPath",t)}},zr=function(r="",e={}){try{let t=A()?this.translations:window.__joystick_i18n__,o=r?.includes(".")?Wr(r,t):t[r];if(!t||!o)return"";let s=Object.entries(e);return $(o,s)}catch(t){i("component.renderMethods.i18n",t)}},U=zr;var Gr=function(e=!1,t=""){try{return this?.renderingHTMLWithDataForSSR||e?`<when>${t.trim()}</when>`:"<when> </when>"}catch(n){i("component.renderMethods.when",n)}},q=Gr;var yr={c:_,component:_,e:I,each:I,i:U,i18n:U,w:q,when:q};var ir=(r={},e={})=>{try{return Object.entries(yr).reduce((t,[n,o])=>(t[n]=o.bind({...r,...e}),t),{})}catch(t){i("component.renderMethods.compile",t)}};export{ir as default};
|
|
1
|
+
var Mr=Object.create;var P=Object.defineProperty;var gr=Object.getOwnPropertyDescriptor;var Tr=Object.getOwnPropertyNames;var Fr=Object.getPrototypeOf,Sr=Object.prototype.hasOwnProperty;var br=r=>P(r,"__esModule",{value:!0});var Or=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var Er=(r,e,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Tr(e))!Sr.call(r,n)&&n!=="default"&&P(r,n,{get:()=>e[n],enumerable:!(t=gr(e,n))||t.enumerable});return r},kr=r=>Er(br(P(r!=null?Mr(Fr(r)):{},"default",r&&r.__esModule&&"default"in r?{get:()=>r.default,enumerable:!0}:{value:r,enumerable:!0})),r);var B=Or(v=>{(function(r,e){if(typeof define=="function"&&define.amd)define(["exports"],e);else if(typeof v!="undefined")e(v);else{var t={exports:{}};e(t.exports),r.index=t.exports}})(v,function(r){"use strict";function e(c){return e=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(a){return typeof a}:function(a){return a&&typeof Symbol=="function"&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},e(c)}function t(c,a){return a&&(e(a)==="object"||typeof a=="function")?a:n(c)}function n(c){if(c===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return c}function o(c){return o=Object.setPrototypeOf?Object.getPrototypeOf:function(a){return a.__proto__||Object.getPrototypeOf(a)},o(c)}function s(c,a){if(typeof a!="function"&&a!==null)throw new TypeError("Super expression must either be null or a function");c.prototype=Object.create(a&&a.prototype,{constructor:{value:c,writable:!0,configurable:!0}}),a&&m(c,a)}function m(c,a){return m=Object.setPrototypeOf||function(p,g){return p.__proto__=g,p},m(c,a)}function l(c,a){if(!(c instanceof a))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0}),r.diff=void 0;var M=function c(a,p){l(this,c),this.type=a,this.path=p?p.toString():""},j=function(c){function a(p,g,d){var F;return l(this,a),F=t(this,o(a).call(this,"E",p)),F.lhs=g,F.rhs=d,F}return s(a,c),a}(M),R=function(c){function a(p,g,d,F){var f;return l(this,a),f=t(this,o(a).call(this,"M",p)),f.item=g,f.lhsIndex=d,f.rhsIndex=F,f}return s(a,c),a}(M),A=function(c){function a(p,g){var d;return l(this,a),d=t(this,o(a).call(this,"D",p)),d.lhs=g,d}return s(a,c),a}(M),N=function(c){function a(p,g){var d;return l(this,a),d=t(this,o(a).call(this,"A",p)),d.rhs=g,d}return s(a,c),a}(M),b=function(c,a){return c?"".concat(c,".").concat(a):a};r.diff=function(a,p){var g=2<arguments.length&&arguments[2]!==void 0?arguments[2]:{},d=[],F=g.matchKey,f=g.types||["E","A","D","M"],xr=function(h,u,w,O){h.forEach(function(S,y){var T=u.findIndex(function(x){return x[O]===S[O]});-1<T?(-1<f.indexOf("M")&&y!==T&&d.push(new R(w,S,y,T)),D(S,u[T],b(w,T))):-1<f.indexOf("D")&&d.push(new A(w,S))}),u.forEach(function(S,y){var T=h.findIndex(function(x){return S[O]===x[O]});-1<f.indexOf("A")&&T===-1&&d.push(new N(b(w,y),S))})},D=function(h,u,w){var O=Object.prototype.toString.call(h),S=Object.prototype.toString.call(u);if(-1<f.indexOf("E")&&O!==S)return d.push(new j(w,h,u)),!1;if(O==="[object Object]")Object.getOwnPropertyNames(h).forEach(function(x){Object.prototype.hasOwnProperty.call(u,x)?D(h[x],u[x],b(w,x)):-1<f.indexOf("D")&&d.push(new A(b(w,x),h[x]))}),Object.getOwnPropertyNames(u).forEach(function(x){-1<f.indexOf("A")&&!Object.prototype.hasOwnProperty.call(h,x)&&d.push(new N(b(w,x),u[x]))});else if(O!=="[object Array]")-1<f.indexOf("E")&&h!==u&&d.push(new j(w,h,u));else if(F)xr(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(b(w,y),h[y--]));if(-1<f.indexOf("A"))for(;T>y;)d.push(new N(b(w,T),u[T--]));for(;0<=y;--y)D(h[y],u[y],b(w,y))}};return D(a,p),d}})});var i=(r="",e={})=>{throw new Error(`[joystick${r?`.${r}`:""}] ${e.message||e.reason||e}`)};var wr=kr(B());var L=()=>typeof window=="undefined";var Cr=(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)}},C=(r="",e=null)=>{try{L()||(Cr(r)||{}).array.push({callback:e})}catch(t){i("addToQueue",t)}};var W=r=>{try{return!!Array.isArray(r)}catch(e){i("types.isArray",e)}};var z=r=>{try{return typeof r=="function"}catch(e){i("types.isFunction",e)}};var G=r=>{try{return!!(r&&typeof r=="object"&&!Array.isArray(r))}catch(e){i("types.isObject",e)}};var Q=r=>{try{return typeof r=="string"}catch(e){i("types.isString",e)}};var V=(r=[],e="")=>{try{return(W(r)&&r.find(n=>n?.componentId===e))?.data||{}}catch(t){i("findComponentDataFromSSR",t)}};var K="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890".split(""),E=(r=16)=>{let e="",t=0;for(;t<r;)e+=K[Math.floor(Math.random()*(K.length-1))],t+=1;return e};var k=(r="",e=[])=>{typeof window!="undefined"&&!!window.__joystick_test__&&(window.test={...window.test||{},functionCalls:{...window?.test?.functionCalls||{},[r]:[...window?.test?.functionCalls&&window?.test?.functionCalls[r]||[],{calledAt:new Date().toISOString(),args:e}]}})};var X=(r={},e={})=>{try{return Object.entries(e).reduce((t={},[n,o])=>(t[n]=(...s)=>(k(`ui.${r?.options?.test?.name||E()}.methods.${n}`,[...s,{...r,setState:r.setState.bind(r),...r.renderMethods||{}}]),o(...s,{...r,setState:r.setState.bind(r),...r.renderMethods||{}})),t),{})}catch{i("component.methods.compile")}};var J=(r={})=>{try{return Object.entries(r)?.reduce((e={},[t,n]={})=>(e[t]=n?.map((o={})=>({state:o?.state,values:o?.values,children:J(o?.children)})),e),{})}catch(e){i("component.render.getExistingStateMap.buildMapForChildren",e)}},Y=(r={})=>{try{return J(r)}catch(e){i("component.render.getExistingStateMap",e)}};var Z=new RegExp(/\<\!\-\-(?:.|\n|\r)*?-->/g),jr=new RegExp(/\n/g);var Rr=(r="")=>{try{return(r.match(Z)||[]).forEach(t=>{r=r.replace(t,"")}),r}catch(e){i("component.render.sanitizeHTML.removeCommentedCode",e)}},rr=(r="")=>{try{let e=`${r}`;return e=Rr(e),e}catch(e){i("component.render.sanitizeHTML",e)}};var er=(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 tr=(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&&tr(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)}},nr=tr;var or=(r={},e={})=>{try{e?.dataFromSSR&&(r.data=V(e.dataFromSSR,r.id)||{}),nr(r?.children);let t=Y(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=X(r,r.options.methods);let n=r.options.render({...r||{},setState:r.setState.bind(r),...r.renderMethods||{}}),o=rr(n),s=er(r,o);return{unwrapped:o,wrapped:s}}catch(t){i("component.render.toHTML",t)}};var Dr=(r={})=>{try{return Object.values(r).reduce((e={},t)=>(e[t.name]=t.value,e),{})}catch(e){i("component.virtualDOM.build.parseAttributeMap",e)}},ar=(r={})=>{try{return r.tagName==="WHEN"?[].flatMap.call(r?.childNodes,e=>e?.tagName==="WHEN"?ar(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:Dr(r.attributes),children:[].flatMap.call(r.childNodes,n=>ar(n))};return e==="text"&&(t=r.textContent),t}catch(e){i("component.virtualDOM.build",e)}},cr=H;var vr=(r="")=>{try{let e=document.createElement("div");return e.innerHTML=r,e?.childNodes[0]}catch(e){i("component.virtualDOM.build.convertHTMLToDOM",e)}},sr=(r="")=>{try{let e=vr(r);return cr(e)}catch(e){i("component.virtualDOM.build",e)}};var dr=(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 n=0;n<t.length;n+=1){let[o,s]=t[n];dr(o)&&e.setAttribute(o,s)}for(let n=0;n<r?.children?.length;n+=1){let o=r?.children[n];if(o){let s=lr(o);e.appendChild(s)}}return e}catch(e){i("component.virtualDOM.renderTreeToDOM.renderElement",e)}},lr=(r=null)=>{try{return Q(r)?document.createTextNode(r):Lr(r)}catch(e){i("component.virtualDOM.renderTreeToDOM",e)}},ur=lr;var pr=(r={},e={})=>{try{let t=or(r,{existingChildren:e?.existingChildren}),n=sr(t.wrapped,r),o=e.includeActual&&n?ur(n):null;return{html:t,virtual:n,actual:o}}catch(t){i("component.render.getUpdatedDOM",t)}};var fr=(r={},e="",t="id")=>{try{let n=r&&r.id;if(G(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 j=l[M],R=fr(j,e,t);if(R!==null)return R}}}return null}catch(n){i("component.findComponentInTreeByField",n)}},hr=fr;var mr=(r="",e={},t=null)=>{let n=hr(t||window.joystick._internal.tree,r,"instanceId");n&&(n.children=[...n.children||[],e])};var Ar=(r={},e={},t=null)=>{try{let n=pr(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)}},Nr=(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)}},Pr=(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)}},Hr=(r={})=>{try{let e={id:r.id,instanceId:r.instanceId,instance:r,children:[]};mr(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&&C("lifecycle.onBeforeMount",()=>{e.options.lifecycle.onBeforeMount(e),k(`ui.${e?.options?.test?.name||E()}.lifecycle.onBeforeMount`,[e])}),!r.renderedComponent&&e.options.lifecycle.onMount&&C("lifecycle.onMount",()=>{e.options.lifecycle.onMount(e),k(`ui.${e?.options?.test?.name||E()}.lifecycle.onMount`,[e])}))}catch(t){i("component.renderMethods.component.handleLifecycle",t)}},Ir=(r={},e={},t={})=>{try{!e.walkingTreeForSSR&&r?.options?.lifecycle?.onUpdateProps&&(0,wr.diff)(e?.existingPropsMap,t)?.length>0&&C("lifecycle.onUpdateProps",()=>{let o=e?.existingPropsMap&&e?.existingPropsMap[r.id];r.options.lifecycle.onUpdateProps(o||{},t,r),k(`ui.${r?.options?.test?.name||E()}.lifecycle.onBeforeMount`,[o||{},t,r])})}catch(n){i("component.renderMethods.component.handleOnChangeProps",n)}},$r=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,o.values=l?.values||o.values,n.children[o.id]=[...n.children[o.id]||[],o],o.parent=n,Ir(o,n,t),C("lifecycle.onMount",()=>{o.setDOMNodeOnInstance()}),_r(this,o),o.parent&&Hr(o),o.options.data&&o.parent.walkingTreeForSSR&&o.parent.ssrTree.dataFunctions?Pr(o):o.parent&&o.parent.ssrTree?Nr(o):Ar(o,this,l?.children)}},Ur=function(e,t){try{let n=this;return new $r().bind({})(e,t,n)}catch(n){i("component.renderMethods.component",n)}},_=Ur;var qr=function(e=[],t=null){try{return z(t)&&e&&Array.isArray(e)?e.map((n,o)=>t(n,o)).join(""):""}catch(n){i("component.renderMethods.each",n)}},I=qr;var Br=(r="",e=[])=>{try{return e.reduce((t,[n,o])=>t.replace(`{{${n}}}`,o),r)}catch(t){i("component.renderMethods.i18n.replacePlaceholdersInString",t)}},$=(r="",e=[])=>{try{let t=typeof r=="string",n=Array.isArray(r),o=typeof r=="object"&&!n;if(t)return Br(r,e);if(n)return r?.map(s=>$(s,e));if(o)return Object.entries(r)?.reduce((s={},[m,l])=>(s[m]=$(l,e),s),{})}catch(t){i("component.renderMethods.i18n.handleTranslationReplacement",t)}},Wr=(r="",e={})=>{try{return r?.split(".").reduce((t,n)=>t[n],e)}catch(t){i("component.renderMethods.i18n.getTranslationAtPath",t)}},zr=function(r="",e={}){try{let t=L()?this.translations:window.__joystick_i18n__,o=r?.includes(".")?Wr(r,t):t[r];if(!t||!o)return"";let s=Object.entries(e);return $(o,s)}catch(t){i("component.renderMethods.i18n",t)}},U=zr;var Gr=function(e=!1,t=""){try{return this?.renderingHTMLWithDataForSSR||e?`<when>${t.trim()}</when>`:"<when> </when>"}catch(n){i("component.renderMethods.when",n)}},q=Gr;var yr={c:_,component:_,e:I,each:I,i:U,i18n:U,w:q,when:q};var ir=(r={},e={})=>{try{return Object.entries(yr).reduce((t,[n,o])=>(t[n]=o.bind({...r,...e}),t),{})}catch(t){i("component.renderMethods.compile",t)}};export{ir as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var Mr=Object.create;var P=Object.defineProperty;var gr=Object.getOwnPropertyDescriptor;var Tr=Object.getOwnPropertyNames;var Fr=Object.getPrototypeOf,Sr=Object.prototype.hasOwnProperty;var br=r=>P(r,"__esModule",{value:!0});var Or=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var Er=(r,e,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Tr(e))!Sr.call(r,n)&&n!=="default"&&P(r,n,{get:()=>e[n],enumerable:!(t=gr(e,n))||t.enumerable});return r},kr=r=>Er(br(P(r!=null?Mr(Fr(r)):{},"default",r&&r.__esModule&&"default"in r?{get:()=>r.default,enumerable:!0}:{value:r,enumerable:!0})),r);var B=Or(L=>{(function(r,e){if(typeof define=="function"&&define.amd)define(["exports"],e);else if(typeof L!="undefined")e(L);else{var t={exports:{}};e(t.exports),r.index=t.exports}})(L,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():""},j=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),R=function(a){function c(p,g,d,F){var f;return l(this,c),f=t(this,o(c).call(this,"M",p)),f.item=g,f.lhsIndex=d,f.rhsIndex=F,f}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,"D",p)),d.lhs=g,d}return s(c,a),c}(M),N=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),b=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"],xr=function(h,u,w,O){h.forEach(function(S,y){var T=u.findIndex(function(x){return x[O]===S[O]});-1<T?(-1<f.indexOf("M")&&y!==T&&d.push(new R(w,S,y,T)),D(S,u[T],b(w,T))):-1<f.indexOf("D")&&d.push(new v(w,S))}),u.forEach(function(S,y){var T=h.findIndex(function(x){return S[O]===x[O]});-1<f.indexOf("A")&&T===-1&&d.push(new N(b(w,y),S))})},D=function(h,u,w){var O=Object.prototype.toString.call(h),S=Object.prototype.toString.call(u);if(-1<f.indexOf("E")&&O!==S)return d.push(new j(w,h,u)),!1;if(O==="[object Object]")Object.getOwnPropertyNames(h).forEach(function(x){Object.prototype.hasOwnProperty.call(u,x)?D(h[x],u[x],b(w,x)):-1<f.indexOf("D")&&d.push(new v(b(w,x),h[x]))}),Object.getOwnPropertyNames(u).forEach(function(x){-1<f.indexOf("A")&&!Object.prototype.hasOwnProperty.call(h,x)&&d.push(new N(b(w,x),u[x]))});else if(O!=="[object Array]")-1<f.indexOf("E")&&h!==u&&d.push(new j(w,h,u));else if(F)xr(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 v(b(w,y),h[y--]));if(-1<f.indexOf("A"))for(;T>y;)d.push(new N(b(w,T),u[T--]));for(;0<=y;--y)D(h[y],u[y],b(w,y))}};return D(c,p),d}})});var yr=kr(B());var i=(r="",e={})=>{throw new Error(`[joystick${r?`.${r}`:""}] ${e.message||e.reason||e}`)};var A=()=>typeof window=="undefined";var Cr=(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)}},C=(r="",e=null)=>{try{A()||(Cr(r)||{}).array.push({callback:e})}catch(t){i("addToQueue",t)}};var W=r=>{try{return!!Array.isArray(r)}catch(e){i("types.isArray",e)}};var z=r=>{try{return typeof r=="function"}catch(e){i("types.isFunction",e)}};var G=r=>{try{return!!(r&&typeof r=="object"&&!Array.isArray(r))}catch(e){i("types.isObject",e)}};var Q=r=>{try{return typeof r=="string"}catch(e){i("types.isString",e)}};var V=(r=[],e="")=>{try{return(W(r)&&r.find(n=>n?.componentId===e))?.data||{}}catch(t){i("findComponentDataFromSSR",t)}};var jr=function(e=[],t=null){try{return z(t)&&e&&Array.isArray(e)?e.map((n,o)=>t(n,o)).join(""):""}catch(n){i("component.renderMethods.each",n)}},H=jr;var Rr=(r="",e=[])=>{try{return e.reduce((t,[n,o])=>t.replace(`{{${n}}}`,o),r)}catch(t){i("component.renderMethods.i18n.replacePlaceholdersInString",t)}},_=(r="",e=[])=>{try{let t=typeof r=="string",n=Array.isArray(r),o=typeof r=="object"&&!n;if(t)return Rr(r,e);if(n)return r?.map(s=>_(s,e));if(o)return Object.entries(r)?.reduce((s={},[m,l])=>(s[m]=_(l,e),s),{})}catch(t){i("component.renderMethods.i18n.handleTranslationReplacement",t)}},Dr=(r="",e={})=>{try{return r?.split(".").reduce((t,n)=>t[n],e)}catch(t){i("component.renderMethods.i18n.getTranslationAtPath",t)}},Lr=function(r="",e={}){try{let t=A()?this.translations:window.__joystick_i18n__,o=r?.includes(".")?Dr(r,t):t[r];if(!t||!o)return"";let s=Object.entries(e);return _(o,s)}catch(t){i("component.renderMethods.i18n",t)}},I=Lr;var Ar=function(e=!1,t=""){try{return this?.renderingHTMLWithDataForSSR||e?`<when>${t.trim()}</when>`:"<when> </when>"}catch(n){i("component.renderMethods.when",n)}},$=Ar;var K={c:U,component:U,e:H,each:H,i:I,i18n:I,w:$,when:$};var X=(r={},e={})=>{try{return Object.entries(K).reduce((t,[n,o])=>(t[n]=o.bind({...r,...e}),t),{})}catch(t){i("component.renderMethods.compile",t)}};var J="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890".split(""),E=(r=16)=>{let e="",t=0;for(;t<r;)e+=J[Math.floor(Math.random()*(J.length-1))],t+=1;return e};var k=(r="",e=[])=>{typeof window!="undefined"&&!!window.__joystick_test__&&(window.test={...window.test||{},functionCalls:{...window?.test?.functionCalls||{},[r]:[...window?.test?.functionCalls&&window?.test?.functionCalls[r]||[],{calledAt:new Date().toISOString(),args:e}]}})};var Y=(r={},e={})=>{try{return Object.entries(e).reduce((t={},[n,o])=>(t[n]=(...s)=>(k(`ui.${r?.options?.test?.name||E()}.methods.${n}`,[...s,{...r,setState:r.setState.bind(r),...r.renderMethods||{}}]),o(...s,{...r,setState:r.setState.bind(r),...r.renderMethods||{}})),t),{})}catch{i("component.methods.compile")}};var Z=(r={})=>{try{return Object.entries(r)?.reduce((e={},[t,n]={})=>(e[t]=n?.map((o={})=>({state:o?.state,children:Z(o?.children)})),e),{})}catch(e){i("component.render.getExistingStateMap.buildMapForChildren",e)}},rr=(r={})=>{try{return Z(r)}catch(e){i("component.render.getExistingStateMap",e)}};var er=new RegExp(/\<\!\-\-(?:.|\n|\r)*?-->/g),vr=new RegExp(/\n/g);var Nr=(r="")=>{try{return(r.match(er)||[]).forEach(t=>{r=r.replace(t,"")}),r}catch(e){i("component.render.sanitizeHTML.removeCommentedCode",e)}},tr=(r="")=>{try{let e=`${r}`;return e=Nr(e),e}catch(e){i("component.render.sanitizeHTML",e)}};var nr=(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 or=(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&&or(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)}},ir=or;var cr=(r={},e={})=>{try{e?.dataFromSSR&&(r.data=V(e.dataFromSSR,r.id)||{}),ir(r?.children);let t=rr(e?.existingChildren||r?.children)||{};r.children={},r.renderMethods=X({...r,existingStateMap:t,translations:e?.translations||r.translations||{},ssrTree:e?.ssrTree,walkingTreeForSSR:e?.walkingTreeForSSR,renderingHTMLWithDataForSSR:e?.renderingHTMLWithDataForSSR,dataFromSSR:e?.dataFromSSR}),r.methods=Y(r,r.options.methods);let n=r.options.render({...r||{},setState:r.setState.bind(r),...r.renderMethods||{}}),o=tr(n),s=nr(r,o);return{unwrapped:o,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)}},ar=(r={})=>{try{return r.tagName==="WHEN"?[].flatMap.call(r?.childNodes,e=>e?.tagName==="WHEN"?ar(e):q(e)):q(r)}catch(e){i("component.virtualDOM.build.flattenWhenTags",e)}},q=(r={})=>{try{let e=r&&r.tagName&&r.tagName.toLowerCase()||"text",t={tagName:e,attributes:Pr(r.attributes),children:[].flatMap.call(r.childNodes,n=>ar(n))};return e==="text"&&(t=r.textContent),t}catch(e){i("component.virtualDOM.build",e)}},sr=q;var Hr=(r="")=>{try{let e=document.createElement("div");return e.innerHTML=r,e?.childNodes[0]}catch(e){i("component.virtualDOM.build.convertHTMLToDOM",e)}},dr=(r="")=>{try{let e=Hr(r);return sr(e)}catch(e){i("component.virtualDOM.build",e)}};var lr=(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 n=0;n<t.length;n+=1){let[o,s]=t[n];lr(o)&&e.setAttribute(o,s)}for(let n=0;n<r?.children?.length;n+=1){let o=r?.children[n];if(o){let s=ur(o);e.appendChild(s)}}return e}catch(e){i("component.virtualDOM.renderTreeToDOM.renderElement",e)}},ur=(r=null)=>{try{return Q(r)?document.createTextNode(r):_r(r)}catch(e){i("component.virtualDOM.renderTreeToDOM",e)}},pr=ur;var fr=(r={},e={})=>{try{let t=cr(r,{existingChildren:e?.existingChildren}),n=dr(t.wrapped,r),o=e.includeActual&&n?pr(n):null;return{html:t,virtual:n,actual:o}}catch(t){i("component.render.getUpdatedDOM",t)}};var hr=(r={},e="",t="id")=>{try{let n=r&&r.id;if(G(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 j=l[M],R=hr(j,e,t);if(R!==null)return R}}}return null}catch(n){i("component.findComponentInTreeByField",n)}},mr=hr;var wr=(r="",e={},t=null)=>{let n=mr(t||window.joystick._internal.tree,r,"instanceId");n&&(n.children=[...n.children||[],e])};var Ir=(r={},e={},t=null)=>{try{let n=fr(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)}},$r=(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)}},Ur=(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)}},qr=(r={})=>{try{let e={id:r.id,instanceId:r.instanceId,instance:r,children:[]};wr(r.parent.instanceId,e,r.parent&&r.parent.ssrTree||null)}catch(e){i("component.renderMethods.component.handleAddComponentToParent",e)}},Br=(r={},e={})=>{try{!r.renderedComponent&&e.options&&e.options.lifecycle&&(e.options.lifecycle.onBeforeMount&&C("lifecycle.onBeforeMount",()=>{e.options.lifecycle.onBeforeMount(e),k(`ui.${e?.options?.test?.name||E()}.lifecycle.onBeforeMount`,[e])}),!r.renderedComponent&&e.options.lifecycle.onMount&&C("lifecycle.onMount",()=>{e.options.lifecycle.onMount(e),k(`ui.${e?.options?.test?.name||E()}.lifecycle.onMount`,[e])}))}catch(t){i("component.renderMethods.component.handleLifecycle",t)}},Wr=(r={},e={},t={})=>{try{!e.walkingTreeForSSR&&r?.options?.lifecycle?.onUpdateProps&&(0,yr.diff)(e?.existingPropsMap,t)?.length>0&&C("lifecycle.onUpdateProps",()=>{let o=e?.existingPropsMap&&e?.existingPropsMap[r.id];r.options.lifecycle.onUpdateProps(o||{},t,r),k(`ui.${r?.options?.test?.name||E()}.lifecycle.onBeforeMount`,[o||{},t,r])})}catch(n){i("component.renderMethods.component.handleOnChangeProps",n)}},zr=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,Wr(o,n,t),C("lifecycle.onMount",()=>{o.setDOMNodeOnInstance()}),Br(this,o),o.parent&&qr(o),o.options.data&&o.parent.walkingTreeForSSR&&o.parent.ssrTree.dataFunctions?Ur(o):o.parent&&o.parent.ssrTree?$r(o):Ir(o,this,l?.children)}},Gr=function(e,t){try{let n=this;return new zr().bind({})(e,t,n)}catch(n){i("component.renderMethods.component",n)}},U=Gr;export{U as default};
|
|
1
|
+
var Mr=Object.create;var P=Object.defineProperty;var gr=Object.getOwnPropertyDescriptor;var Tr=Object.getOwnPropertyNames;var Fr=Object.getPrototypeOf,Sr=Object.prototype.hasOwnProperty;var br=r=>P(r,"__esModule",{value:!0});var Or=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var Er=(r,e,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Tr(e))!Sr.call(r,n)&&n!=="default"&&P(r,n,{get:()=>e[n],enumerable:!(t=gr(e,n))||t.enumerable});return r},kr=r=>Er(br(P(r!=null?Mr(Fr(r)):{},"default",r&&r.__esModule&&"default"in r?{get:()=>r.default,enumerable:!0}:{value:r,enumerable:!0})),r);var B=Or(v=>{(function(r,e){if(typeof define=="function"&&define.amd)define(["exports"],e);else if(typeof v!="undefined")e(v);else{var t={exports:{}};e(t.exports),r.index=t.exports}})(v,function(r){"use strict";function e(c){return e=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(a){return typeof a}:function(a){return a&&typeof Symbol=="function"&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},e(c)}function t(c,a){return a&&(e(a)==="object"||typeof a=="function")?a:n(c)}function n(c){if(c===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return c}function o(c){return o=Object.setPrototypeOf?Object.getPrototypeOf:function(a){return a.__proto__||Object.getPrototypeOf(a)},o(c)}function s(c,a){if(typeof a!="function"&&a!==null)throw new TypeError("Super expression must either be null or a function");c.prototype=Object.create(a&&a.prototype,{constructor:{value:c,writable:!0,configurable:!0}}),a&&m(c,a)}function m(c,a){return m=Object.setPrototypeOf||function(p,g){return p.__proto__=g,p},m(c,a)}function l(c,a){if(!(c instanceof a))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0}),r.diff=void 0;var M=function c(a,p){l(this,c),this.type=a,this.path=p?p.toString():""},j=function(c){function a(p,g,d){var F;return l(this,a),F=t(this,o(a).call(this,"E",p)),F.lhs=g,F.rhs=d,F}return s(a,c),a}(M),R=function(c){function a(p,g,d,F){var f;return l(this,a),f=t(this,o(a).call(this,"M",p)),f.item=g,f.lhsIndex=d,f.rhsIndex=F,f}return s(a,c),a}(M),A=function(c){function a(p,g){var d;return l(this,a),d=t(this,o(a).call(this,"D",p)),d.lhs=g,d}return s(a,c),a}(M),N=function(c){function a(p,g){var d;return l(this,a),d=t(this,o(a).call(this,"A",p)),d.rhs=g,d}return s(a,c),a}(M),b=function(c,a){return c?"".concat(c,".").concat(a):a};r.diff=function(a,p){var g=2<arguments.length&&arguments[2]!==void 0?arguments[2]:{},d=[],F=g.matchKey,f=g.types||["E","A","D","M"],xr=function(h,u,w,O){h.forEach(function(S,y){var T=u.findIndex(function(x){return x[O]===S[O]});-1<T?(-1<f.indexOf("M")&&y!==T&&d.push(new R(w,S,y,T)),D(S,u[T],b(w,T))):-1<f.indexOf("D")&&d.push(new A(w,S))}),u.forEach(function(S,y){var T=h.findIndex(function(x){return S[O]===x[O]});-1<f.indexOf("A")&&T===-1&&d.push(new N(b(w,y),S))})},D=function(h,u,w){var O=Object.prototype.toString.call(h),S=Object.prototype.toString.call(u);if(-1<f.indexOf("E")&&O!==S)return d.push(new j(w,h,u)),!1;if(O==="[object Object]")Object.getOwnPropertyNames(h).forEach(function(x){Object.prototype.hasOwnProperty.call(u,x)?D(h[x],u[x],b(w,x)):-1<f.indexOf("D")&&d.push(new A(b(w,x),h[x]))}),Object.getOwnPropertyNames(u).forEach(function(x){-1<f.indexOf("A")&&!Object.prototype.hasOwnProperty.call(h,x)&&d.push(new N(b(w,x),u[x]))});else if(O!=="[object Array]")-1<f.indexOf("E")&&h!==u&&d.push(new j(w,h,u));else if(F)xr(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(b(w,y),h[y--]));if(-1<f.indexOf("A"))for(;T>y;)d.push(new N(b(w,T),u[T--]));for(;0<=y;--y)D(h[y],u[y],b(w,y))}};return D(a,p),d}})});var yr=kr(B());var i=(r="",e={})=>{throw new Error(`[joystick${r?`.${r}`:""}] ${e.message||e.reason||e}`)};var L=()=>typeof window=="undefined";var Cr=(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)}},C=(r="",e=null)=>{try{L()||(Cr(r)||{}).array.push({callback:e})}catch(t){i("addToQueue",t)}};var W=r=>{try{return!!Array.isArray(r)}catch(e){i("types.isArray",e)}};var z=r=>{try{return typeof r=="function"}catch(e){i("types.isFunction",e)}};var G=r=>{try{return!!(r&&typeof r=="object"&&!Array.isArray(r))}catch(e){i("types.isObject",e)}};var Q=r=>{try{return typeof r=="string"}catch(e){i("types.isString",e)}};var V=(r=[],e="")=>{try{return(W(r)&&r.find(n=>n?.componentId===e))?.data||{}}catch(t){i("findComponentDataFromSSR",t)}};var jr=function(e=[],t=null){try{return z(t)&&e&&Array.isArray(e)?e.map((n,o)=>t(n,o)).join(""):""}catch(n){i("component.renderMethods.each",n)}},H=jr;var Rr=(r="",e=[])=>{try{return e.reduce((t,[n,o])=>t.replace(`{{${n}}}`,o),r)}catch(t){i("component.renderMethods.i18n.replacePlaceholdersInString",t)}},_=(r="",e=[])=>{try{let t=typeof r=="string",n=Array.isArray(r),o=typeof r=="object"&&!n;if(t)return Rr(r,e);if(n)return r?.map(s=>_(s,e));if(o)return Object.entries(r)?.reduce((s={},[m,l])=>(s[m]=_(l,e),s),{})}catch(t){i("component.renderMethods.i18n.handleTranslationReplacement",t)}},Dr=(r="",e={})=>{try{return r?.split(".").reduce((t,n)=>t[n],e)}catch(t){i("component.renderMethods.i18n.getTranslationAtPath",t)}},vr=function(r="",e={}){try{let t=L()?this.translations:window.__joystick_i18n__,o=r?.includes(".")?Dr(r,t):t[r];if(!t||!o)return"";let s=Object.entries(e);return _(o,s)}catch(t){i("component.renderMethods.i18n",t)}},I=vr;var Lr=function(e=!1,t=""){try{return this?.renderingHTMLWithDataForSSR||e?`<when>${t.trim()}</when>`:"<when> </when>"}catch(n){i("component.renderMethods.when",n)}},$=Lr;var K={c:U,component:U,e:H,each:H,i:I,i18n:I,w:$,when:$};var X=(r={},e={})=>{try{return Object.entries(K).reduce((t,[n,o])=>(t[n]=o.bind({...r,...e}),t),{})}catch(t){i("component.renderMethods.compile",t)}};var J="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890".split(""),E=(r=16)=>{let e="",t=0;for(;t<r;)e+=J[Math.floor(Math.random()*(J.length-1))],t+=1;return e};var k=(r="",e=[])=>{typeof window!="undefined"&&!!window.__joystick_test__&&(window.test={...window.test||{},functionCalls:{...window?.test?.functionCalls||{},[r]:[...window?.test?.functionCalls&&window?.test?.functionCalls[r]||[],{calledAt:new Date().toISOString(),args:e}]}})};var Y=(r={},e={})=>{try{return Object.entries(e).reduce((t={},[n,o])=>(t[n]=(...s)=>(k(`ui.${r?.options?.test?.name||E()}.methods.${n}`,[...s,{...r,setState:r.setState.bind(r),...r.renderMethods||{}}]),o(...s,{...r,setState:r.setState.bind(r),...r.renderMethods||{}})),t),{})}catch{i("component.methods.compile")}};var Z=(r={})=>{try{return Object.entries(r)?.reduce((e={},[t,n]={})=>(e[t]=n?.map((o={})=>({state:o?.state,values:o?.values,children:Z(o?.children)})),e),{})}catch(e){i("component.render.getExistingStateMap.buildMapForChildren",e)}},rr=(r={})=>{try{return Z(r)}catch(e){i("component.render.getExistingStateMap",e)}};var er=new RegExp(/\<\!\-\-(?:.|\n|\r)*?-->/g),Ar=new RegExp(/\n/g);var Nr=(r="")=>{try{return(r.match(er)||[]).forEach(t=>{r=r.replace(t,"")}),r}catch(e){i("component.render.sanitizeHTML.removeCommentedCode",e)}},tr=(r="")=>{try{let e=`${r}`;return e=Nr(e),e}catch(e){i("component.render.sanitizeHTML",e)}};var nr=(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 or=(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&&or(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)}},ir=or;var ar=(r={},e={})=>{try{e?.dataFromSSR&&(r.data=V(e.dataFromSSR,r.id)||{}),ir(r?.children);let t=rr(e?.existingChildren||r?.children)||{};r.children={},r.renderMethods=X({...r,existingStateMap:t,translations:e?.translations||r.translations||{},ssrTree:e?.ssrTree,walkingTreeForSSR:e?.walkingTreeForSSR,renderingHTMLWithDataForSSR:e?.renderingHTMLWithDataForSSR,dataFromSSR:e?.dataFromSSR}),r.methods=Y(r,r.options.methods);let n=r.options.render({...r||{},setState:r.setState.bind(r),...r.renderMethods||{}}),o=tr(n),s=nr(r,o);return{unwrapped:o,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)}},cr=(r={})=>{try{return r.tagName==="WHEN"?[].flatMap.call(r?.childNodes,e=>e?.tagName==="WHEN"?cr(e):q(e)):q(r)}catch(e){i("component.virtualDOM.build.flattenWhenTags",e)}},q=(r={})=>{try{let e=r&&r.tagName&&r.tagName.toLowerCase()||"text",t={tagName:e,attributes:Pr(r.attributes),children:[].flatMap.call(r.childNodes,n=>cr(n))};return e==="text"&&(t=r.textContent),t}catch(e){i("component.virtualDOM.build",e)}},sr=q;var Hr=(r="")=>{try{let e=document.createElement("div");return e.innerHTML=r,e?.childNodes[0]}catch(e){i("component.virtualDOM.build.convertHTMLToDOM",e)}},dr=(r="")=>{try{let e=Hr(r);return sr(e)}catch(e){i("component.virtualDOM.build",e)}};var lr=(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 n=0;n<t.length;n+=1){let[o,s]=t[n];lr(o)&&e.setAttribute(o,s)}for(let n=0;n<r?.children?.length;n+=1){let o=r?.children[n];if(o){let s=ur(o);e.appendChild(s)}}return e}catch(e){i("component.virtualDOM.renderTreeToDOM.renderElement",e)}},ur=(r=null)=>{try{return Q(r)?document.createTextNode(r):_r(r)}catch(e){i("component.virtualDOM.renderTreeToDOM",e)}},pr=ur;var fr=(r={},e={})=>{try{let t=ar(r,{existingChildren:e?.existingChildren}),n=dr(t.wrapped,r),o=e.includeActual&&n?pr(n):null;return{html:t,virtual:n,actual:o}}catch(t){i("component.render.getUpdatedDOM",t)}};var hr=(r={},e="",t="id")=>{try{let n=r&&r.id;if(G(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 j=l[M],R=hr(j,e,t);if(R!==null)return R}}}return null}catch(n){i("component.findComponentInTreeByField",n)}},mr=hr;var wr=(r="",e={},t=null)=>{let n=mr(t||window.joystick._internal.tree,r,"instanceId");n&&(n.children=[...n.children||[],e])};var Ir=(r={},e={},t=null)=>{try{let n=fr(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)}},$r=(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)}},Ur=(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)}},qr=(r={})=>{try{let e={id:r.id,instanceId:r.instanceId,instance:r,children:[]};wr(r.parent.instanceId,e,r.parent&&r.parent.ssrTree||null)}catch(e){i("component.renderMethods.component.handleAddComponentToParent",e)}},Br=(r={},e={})=>{try{!r.renderedComponent&&e.options&&e.options.lifecycle&&(e.options.lifecycle.onBeforeMount&&C("lifecycle.onBeforeMount",()=>{e.options.lifecycle.onBeforeMount(e),k(`ui.${e?.options?.test?.name||E()}.lifecycle.onBeforeMount`,[e])}),!r.renderedComponent&&e.options.lifecycle.onMount&&C("lifecycle.onMount",()=>{e.options.lifecycle.onMount(e),k(`ui.${e?.options?.test?.name||E()}.lifecycle.onMount`,[e])}))}catch(t){i("component.renderMethods.component.handleLifecycle",t)}},Wr=(r={},e={},t={})=>{try{!e.walkingTreeForSSR&&r?.options?.lifecycle?.onUpdateProps&&(0,yr.diff)(e?.existingPropsMap,t)?.length>0&&C("lifecycle.onUpdateProps",()=>{let o=e?.existingPropsMap&&e?.existingPropsMap[r.id];r.options.lifecycle.onUpdateProps(o||{},t,r),k(`ui.${r?.options?.test?.name||E()}.lifecycle.onBeforeMount`,[o||{},t,r])})}catch(n){i("component.renderMethods.component.handleOnChangeProps",n)}},zr=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,o.values=l?.values||o.values,n.children[o.id]=[...n.children[o.id]||[],o],o.parent=n,Wr(o,n,t),C("lifecycle.onMount",()=>{o.setDOMNodeOnInstance()}),Br(this,o),o.parent&&qr(o),o.options.data&&o.parent.walkingTreeForSSR&&o.parent.ssrTree.dataFunctions?Ur(o):o.parent&&o.parent.ssrTree?$r(o):Ir(o,this,l?.children)}},Gr=function(e,t){try{let n=this;return new zr().bind({})(e,t,n)}catch(n){i("component.renderMethods.component",n)}},U=Gr;export{U as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var Mr=Object.create;var P=Object.defineProperty;var gr=Object.getOwnPropertyDescriptor;var Tr=Object.getOwnPropertyNames;var Fr=Object.getPrototypeOf,Sr=Object.prototype.hasOwnProperty;var br=r=>P(r,"__esModule",{value:!0});var Or=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var Er=(r,e,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Tr(e))!Sr.call(r,n)&&n!=="default"&&P(r,n,{get:()=>e[n],enumerable:!(t=gr(e,n))||t.enumerable});return r},kr=r=>Er(br(P(r!=null?Mr(Fr(r)):{},"default",r&&r.__esModule&&"default"in r?{get:()=>r.default,enumerable:!0}:{value:r,enumerable:!0})),r);var B=Or(L=>{(function(r,e){if(typeof define=="function"&&define.amd)define(["exports"],e);else if(typeof L!="undefined")e(L);else{var t={exports:{}};e(t.exports),r.index=t.exports}})(L,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():""},j=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),R=function(a){function c(p,g,d,F){var f;return l(this,c),f=t(this,o(c).call(this,"M",p)),f.item=g,f.lhsIndex=d,f.rhsIndex=F,f}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,"D",p)),d.lhs=g,d}return s(c,a),c}(M),N=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),b=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"],xr=function(h,u,w,O){h.forEach(function(S,y){var T=u.findIndex(function(x){return x[O]===S[O]});-1<T?(-1<f.indexOf("M")&&y!==T&&d.push(new R(w,S,y,T)),D(S,u[T],b(w,T))):-1<f.indexOf("D")&&d.push(new v(w,S))}),u.forEach(function(S,y){var T=h.findIndex(function(x){return S[O]===x[O]});-1<f.indexOf("A")&&T===-1&&d.push(new N(b(w,y),S))})},D=function(h,u,w){var O=Object.prototype.toString.call(h),S=Object.prototype.toString.call(u);if(-1<f.indexOf("E")&&O!==S)return d.push(new j(w,h,u)),!1;if(O==="[object Object]")Object.getOwnPropertyNames(h).forEach(function(x){Object.prototype.hasOwnProperty.call(u,x)?D(h[x],u[x],b(w,x)):-1<f.indexOf("D")&&d.push(new v(b(w,x),h[x]))}),Object.getOwnPropertyNames(u).forEach(function(x){-1<f.indexOf("A")&&!Object.prototype.hasOwnProperty.call(h,x)&&d.push(new N(b(w,x),u[x]))});else if(O!=="[object Array]")-1<f.indexOf("E")&&h!==u&&d.push(new j(w,h,u));else if(F)xr(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 v(b(w,y),h[y--]));if(-1<f.indexOf("A"))for(;T>y;)d.push(new N(b(w,T),u[T--]));for(;0<=y;--y)D(h[y],u[y],b(w,y))}};return D(c,p),d}})});var yr=kr(B());var i=(r="",e={})=>{throw new Error(`[joystick${r?`.${r}`:""}] ${e.message||e.reason||e}`)};var A=()=>typeof window=="undefined";var Cr=(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)}},C=(r="",e=null)=>{try{A()||(Cr(r)||{}).array.push({callback:e})}catch(t){i("addToQueue",t)}};var W=r=>{try{return!!Array.isArray(r)}catch(e){i("types.isArray",e)}};var z=r=>{try{return typeof r=="function"}catch(e){i("types.isFunction",e)}};var G=r=>{try{return!!(r&&typeof r=="object"&&!Array.isArray(r))}catch(e){i("types.isObject",e)}};var Q=r=>{try{return typeof r=="string"}catch(e){i("types.isString",e)}};var V=(r=[],e="")=>{try{return(W(r)&&r.find(n=>n?.componentId===e))?.data||{}}catch(t){i("findComponentDataFromSSR",t)}};var K=(r={},e={})=>{try{return Object.entries(X).reduce((t,[n,o])=>(t[n]=o.bind({...r,...e}),t),{})}catch(t){i("component.renderMethods.compile",t)}};var J="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890".split(""),E=(r=16)=>{let e="",t=0;for(;t<r;)e+=J[Math.floor(Math.random()*(J.length-1))],t+=1;return e};var k=(r="",e=[])=>{typeof window!="undefined"&&!!window.__joystick_test__&&(window.test={...window.test||{},functionCalls:{...window?.test?.functionCalls||{},[r]:[...window?.test?.functionCalls&&window?.test?.functionCalls[r]||[],{calledAt:new Date().toISOString(),args:e}]}})};var Y=(r={},e={})=>{try{return Object.entries(e).reduce((t={},[n,o])=>(t[n]=(...s)=>(k(`ui.${r?.options?.test?.name||E()}.methods.${n}`,[...s,{...r,setState:r.setState.bind(r),...r.renderMethods||{}}]),o(...s,{...r,setState:r.setState.bind(r),...r.renderMethods||{}})),t),{})}catch{i("component.methods.compile")}};var Z=(r={})=>{try{return Object.entries(r)?.reduce((e={},[t,n]={})=>(e[t]=n?.map((o={})=>({state:o?.state,children:Z(o?.children)})),e),{})}catch(e){i("component.render.getExistingStateMap.buildMapForChildren",e)}},rr=(r={})=>{try{return Z(r)}catch(e){i("component.render.getExistingStateMap",e)}};var er=new RegExp(/\<\!\-\-(?:.|\n|\r)*?-->/g),jr=new RegExp(/\n/g);var Rr=(r="")=>{try{return(r.match(er)||[]).forEach(t=>{r=r.replace(t,"")}),r}catch(e){i("component.render.sanitizeHTML.removeCommentedCode",e)}},tr=(r="")=>{try{let e=`${r}`;return e=Rr(e),e}catch(e){i("component.render.sanitizeHTML",e)}};var nr=(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 or=(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&&or(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)}},ir=or;var cr=(r={},e={})=>{try{e?.dataFromSSR&&(r.data=V(e.dataFromSSR,r.id)||{}),ir(r?.children);let t=rr(e?.existingChildren||r?.children)||{};r.children={},r.renderMethods=K({...r,existingStateMap:t,translations:e?.translations||r.translations||{},ssrTree:e?.ssrTree,walkingTreeForSSR:e?.walkingTreeForSSR,renderingHTMLWithDataForSSR:e?.renderingHTMLWithDataForSSR,dataFromSSR:e?.dataFromSSR}),r.methods=Y(r,r.options.methods);let n=r.options.render({...r||{},setState:r.setState.bind(r),...r.renderMethods||{}}),o=tr(n),s=nr(r,o);return{unwrapped:o,wrapped:s}}catch(t){i("component.render.toHTML",t)}};var Dr=(r={})=>{try{return Object.values(r).reduce((e={},t)=>(e[t.name]=t.value,e),{})}catch(e){i("component.virtualDOM.build.parseAttributeMap",e)}},ar=(r={})=>{try{return r.tagName==="WHEN"?[].flatMap.call(r?.childNodes,e=>e?.tagName==="WHEN"?ar(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:Dr(r.attributes),children:[].flatMap.call(r.childNodes,n=>ar(n))};return e==="text"&&(t=r.textContent),t}catch(e){i("component.virtualDOM.build",e)}},sr=H;var Lr=(r="")=>{try{let e=document.createElement("div");return e.innerHTML=r,e?.childNodes[0]}catch(e){i("component.virtualDOM.build.convertHTMLToDOM",e)}},dr=(r="")=>{try{let e=Lr(r);return sr(e)}catch(e){i("component.virtualDOM.build",e)}};var lr=(r="")=>{try{return document.createElement("div").setAttribute(r,"Test"),!0}catch{return!1}};var Ar=(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];lr(o)&&e.setAttribute(o,s)}for(let n=0;n<r?.children?.length;n+=1){let o=r?.children[n];if(o){let s=ur(o);e.appendChild(s)}}return e}catch(e){i("component.virtualDOM.renderTreeToDOM.renderElement",e)}},ur=(r=null)=>{try{return Q(r)?document.createTextNode(r):Ar(r)}catch(e){i("component.virtualDOM.renderTreeToDOM",e)}},pr=ur;var fr=(r={},e={})=>{try{let t=cr(r,{existingChildren:e?.existingChildren}),n=dr(t.wrapped,r),o=e.includeActual&&n?pr(n):null;return{html:t,virtual:n,actual:o}}catch(t){i("component.render.getUpdatedDOM",t)}};var hr=(r={},e="",t="id")=>{try{let n=r&&r.id;if(G(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 j=l[M],R=hr(j,e,t);if(R!==null)return R}}}return null}catch(n){i("component.findComponentInTreeByField",n)}},mr=hr;var wr=(r="",e={},t=null)=>{let n=mr(t||window.joystick._internal.tree,r,"instanceId");n&&(n.children=[...n.children||[],e])};var vr=(r={},e={},t=null)=>{try{let n=fr(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)}},Nr=(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)}},Pr=(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)}},Hr=(r={})=>{try{let e={id:r.id,instanceId:r.instanceId,instance:r,children:[]};wr(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&&C("lifecycle.onBeforeMount",()=>{e.options.lifecycle.onBeforeMount(e),k(`ui.${e?.options?.test?.name||E()}.lifecycle.onBeforeMount`,[e])}),!r.renderedComponent&&e.options.lifecycle.onMount&&C("lifecycle.onMount",()=>{e.options.lifecycle.onMount(e),k(`ui.${e?.options?.test?.name||E()}.lifecycle.onMount`,[e])}))}catch(t){i("component.renderMethods.component.handleLifecycle",t)}},Ir=(r={},e={},t={})=>{try{!e.walkingTreeForSSR&&r?.options?.lifecycle?.onUpdateProps&&(0,yr.diff)(e?.existingPropsMap,t)?.length>0&&C("lifecycle.onUpdateProps",()=>{let o=e?.existingPropsMap&&e?.existingPropsMap[r.id];r.options.lifecycle.onUpdateProps(o||{},t,r),k(`ui.${r?.options?.test?.name||E()}.lifecycle.onBeforeMount`,[o||{},t,r])})}catch(n){i("component.renderMethods.component.handleOnChangeProps",n)}},$r=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,Ir(o,n,t),C("lifecycle.onMount",()=>{o.setDOMNodeOnInstance()}),_r(this,o),o.parent&&Hr(o),o.options.data&&o.parent.walkingTreeForSSR&&o.parent.ssrTree.dataFunctions?Pr(o):o.parent&&o.parent.ssrTree?Nr(o):vr(o,this,l?.children)}},Ur=function(e,t){try{let n=this;return new $r().bind({})(e,t,n)}catch(n){i("component.renderMethods.component",n)}},_=Ur;var qr=function(e=[],t=null){try{return z(t)&&e&&Array.isArray(e)?e.map((n,o)=>t(n,o)).join(""):""}catch(n){i("component.renderMethods.each",n)}},I=qr;var Br=(r="",e=[])=>{try{return e.reduce((t,[n,o])=>t.replace(`{{${n}}}`,o),r)}catch(t){i("component.renderMethods.i18n.replacePlaceholdersInString",t)}},$=(r="",e=[])=>{try{let t=typeof r=="string",n=Array.isArray(r),o=typeof r=="object"&&!n;if(t)return Br(r,e);if(n)return r?.map(s=>$(s,e));if(o)return Object.entries(r)?.reduce((s={},[m,l])=>(s[m]=$(l,e),s),{})}catch(t){i("component.renderMethods.i18n.handleTranslationReplacement",t)}},Wr=(r="",e={})=>{try{return r?.split(".").reduce((t,n)=>t[n],e)}catch(t){i("component.renderMethods.i18n.getTranslationAtPath",t)}},zr=function(r="",e={}){try{let t=A()?this.translations:window.__joystick_i18n__,o=r?.includes(".")?Wr(r,t):t[r];if(!t||!o)return"";let s=Object.entries(e);return $(o,s)}catch(t){i("component.renderMethods.i18n",t)}},U=zr;var Gr=function(e=!1,t=""){try{return this?.renderingHTMLWithDataForSSR||e?`<when>${t.trim()}</when>`:"<when> </when>"}catch(n){i("component.renderMethods.when",n)}},q=Gr;var X={c:_,component:_,e:I,each:I,i:U,i18n:U,w:q,when:q};export{X as default};
|
|
1
|
+
var Mr=Object.create;var P=Object.defineProperty;var gr=Object.getOwnPropertyDescriptor;var Tr=Object.getOwnPropertyNames;var Fr=Object.getPrototypeOf,Sr=Object.prototype.hasOwnProperty;var br=r=>P(r,"__esModule",{value:!0});var Or=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var Er=(r,e,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Tr(e))!Sr.call(r,n)&&n!=="default"&&P(r,n,{get:()=>e[n],enumerable:!(t=gr(e,n))||t.enumerable});return r},kr=r=>Er(br(P(r!=null?Mr(Fr(r)):{},"default",r&&r.__esModule&&"default"in r?{get:()=>r.default,enumerable:!0}:{value:r,enumerable:!0})),r);var B=Or(v=>{(function(r,e){if(typeof define=="function"&&define.amd)define(["exports"],e);else if(typeof v!="undefined")e(v);else{var t={exports:{}};e(t.exports),r.index=t.exports}})(v,function(r){"use strict";function e(c){return e=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(a){return typeof a}:function(a){return a&&typeof Symbol=="function"&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},e(c)}function t(c,a){return a&&(e(a)==="object"||typeof a=="function")?a:n(c)}function n(c){if(c===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return c}function o(c){return o=Object.setPrototypeOf?Object.getPrototypeOf:function(a){return a.__proto__||Object.getPrototypeOf(a)},o(c)}function s(c,a){if(typeof a!="function"&&a!==null)throw new TypeError("Super expression must either be null or a function");c.prototype=Object.create(a&&a.prototype,{constructor:{value:c,writable:!0,configurable:!0}}),a&&m(c,a)}function m(c,a){return m=Object.setPrototypeOf||function(p,g){return p.__proto__=g,p},m(c,a)}function l(c,a){if(!(c instanceof a))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0}),r.diff=void 0;var M=function c(a,p){l(this,c),this.type=a,this.path=p?p.toString():""},j=function(c){function a(p,g,d){var F;return l(this,a),F=t(this,o(a).call(this,"E",p)),F.lhs=g,F.rhs=d,F}return s(a,c),a}(M),R=function(c){function a(p,g,d,F){var f;return l(this,a),f=t(this,o(a).call(this,"M",p)),f.item=g,f.lhsIndex=d,f.rhsIndex=F,f}return s(a,c),a}(M),A=function(c){function a(p,g){var d;return l(this,a),d=t(this,o(a).call(this,"D",p)),d.lhs=g,d}return s(a,c),a}(M),N=function(c){function a(p,g){var d;return l(this,a),d=t(this,o(a).call(this,"A",p)),d.rhs=g,d}return s(a,c),a}(M),b=function(c,a){return c?"".concat(c,".").concat(a):a};r.diff=function(a,p){var g=2<arguments.length&&arguments[2]!==void 0?arguments[2]:{},d=[],F=g.matchKey,f=g.types||["E","A","D","M"],xr=function(h,u,w,O){h.forEach(function(S,y){var T=u.findIndex(function(x){return x[O]===S[O]});-1<T?(-1<f.indexOf("M")&&y!==T&&d.push(new R(w,S,y,T)),D(S,u[T],b(w,T))):-1<f.indexOf("D")&&d.push(new A(w,S))}),u.forEach(function(S,y){var T=h.findIndex(function(x){return S[O]===x[O]});-1<f.indexOf("A")&&T===-1&&d.push(new N(b(w,y),S))})},D=function(h,u,w){var O=Object.prototype.toString.call(h),S=Object.prototype.toString.call(u);if(-1<f.indexOf("E")&&O!==S)return d.push(new j(w,h,u)),!1;if(O==="[object Object]")Object.getOwnPropertyNames(h).forEach(function(x){Object.prototype.hasOwnProperty.call(u,x)?D(h[x],u[x],b(w,x)):-1<f.indexOf("D")&&d.push(new A(b(w,x),h[x]))}),Object.getOwnPropertyNames(u).forEach(function(x){-1<f.indexOf("A")&&!Object.prototype.hasOwnProperty.call(h,x)&&d.push(new N(b(w,x),u[x]))});else if(O!=="[object Array]")-1<f.indexOf("E")&&h!==u&&d.push(new j(w,h,u));else if(F)xr(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(b(w,y),h[y--]));if(-1<f.indexOf("A"))for(;T>y;)d.push(new N(b(w,T),u[T--]));for(;0<=y;--y)D(h[y],u[y],b(w,y))}};return D(a,p),d}})});var yr=kr(B());var i=(r="",e={})=>{throw new Error(`[joystick${r?`.${r}`:""}] ${e.message||e.reason||e}`)};var L=()=>typeof window=="undefined";var Cr=(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)}},C=(r="",e=null)=>{try{L()||(Cr(r)||{}).array.push({callback:e})}catch(t){i("addToQueue",t)}};var W=r=>{try{return!!Array.isArray(r)}catch(e){i("types.isArray",e)}};var z=r=>{try{return typeof r=="function"}catch(e){i("types.isFunction",e)}};var G=r=>{try{return!!(r&&typeof r=="object"&&!Array.isArray(r))}catch(e){i("types.isObject",e)}};var Q=r=>{try{return typeof r=="string"}catch(e){i("types.isString",e)}};var V=(r=[],e="")=>{try{return(W(r)&&r.find(n=>n?.componentId===e))?.data||{}}catch(t){i("findComponentDataFromSSR",t)}};var K=(r={},e={})=>{try{return Object.entries(X).reduce((t,[n,o])=>(t[n]=o.bind({...r,...e}),t),{})}catch(t){i("component.renderMethods.compile",t)}};var J="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890".split(""),E=(r=16)=>{let e="",t=0;for(;t<r;)e+=J[Math.floor(Math.random()*(J.length-1))],t+=1;return e};var k=(r="",e=[])=>{typeof window!="undefined"&&!!window.__joystick_test__&&(window.test={...window.test||{},functionCalls:{...window?.test?.functionCalls||{},[r]:[...window?.test?.functionCalls&&window?.test?.functionCalls[r]||[],{calledAt:new Date().toISOString(),args:e}]}})};var Y=(r={},e={})=>{try{return Object.entries(e).reduce((t={},[n,o])=>(t[n]=(...s)=>(k(`ui.${r?.options?.test?.name||E()}.methods.${n}`,[...s,{...r,setState:r.setState.bind(r),...r.renderMethods||{}}]),o(...s,{...r,setState:r.setState.bind(r),...r.renderMethods||{}})),t),{})}catch{i("component.methods.compile")}};var Z=(r={})=>{try{return Object.entries(r)?.reduce((e={},[t,n]={})=>(e[t]=n?.map((o={})=>({state:o?.state,values:o?.values,children:Z(o?.children)})),e),{})}catch(e){i("component.render.getExistingStateMap.buildMapForChildren",e)}},rr=(r={})=>{try{return Z(r)}catch(e){i("component.render.getExistingStateMap",e)}};var er=new RegExp(/\<\!\-\-(?:.|\n|\r)*?-->/g),jr=new RegExp(/\n/g);var Rr=(r="")=>{try{return(r.match(er)||[]).forEach(t=>{r=r.replace(t,"")}),r}catch(e){i("component.render.sanitizeHTML.removeCommentedCode",e)}},tr=(r="")=>{try{let e=`${r}`;return e=Rr(e),e}catch(e){i("component.render.sanitizeHTML",e)}};var nr=(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 or=(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&&or(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)}},ir=or;var ar=(r={},e={})=>{try{e?.dataFromSSR&&(r.data=V(e.dataFromSSR,r.id)||{}),ir(r?.children);let t=rr(e?.existingChildren||r?.children)||{};r.children={},r.renderMethods=K({...r,existingStateMap:t,translations:e?.translations||r.translations||{},ssrTree:e?.ssrTree,walkingTreeForSSR:e?.walkingTreeForSSR,renderingHTMLWithDataForSSR:e?.renderingHTMLWithDataForSSR,dataFromSSR:e?.dataFromSSR}),r.methods=Y(r,r.options.methods);let n=r.options.render({...r||{},setState:r.setState.bind(r),...r.renderMethods||{}}),o=tr(n),s=nr(r,o);return{unwrapped:o,wrapped:s}}catch(t){i("component.render.toHTML",t)}};var Dr=(r={})=>{try{return Object.values(r).reduce((e={},t)=>(e[t.name]=t.value,e),{})}catch(e){i("component.virtualDOM.build.parseAttributeMap",e)}},cr=(r={})=>{try{return r.tagName==="WHEN"?[].flatMap.call(r?.childNodes,e=>e?.tagName==="WHEN"?cr(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:Dr(r.attributes),children:[].flatMap.call(r.childNodes,n=>cr(n))};return e==="text"&&(t=r.textContent),t}catch(e){i("component.virtualDOM.build",e)}},sr=H;var vr=(r="")=>{try{let e=document.createElement("div");return e.innerHTML=r,e?.childNodes[0]}catch(e){i("component.virtualDOM.build.convertHTMLToDOM",e)}},dr=(r="")=>{try{let e=vr(r);return sr(e)}catch(e){i("component.virtualDOM.build",e)}};var lr=(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 n=0;n<t.length;n+=1){let[o,s]=t[n];lr(o)&&e.setAttribute(o,s)}for(let n=0;n<r?.children?.length;n+=1){let o=r?.children[n];if(o){let s=ur(o);e.appendChild(s)}}return e}catch(e){i("component.virtualDOM.renderTreeToDOM.renderElement",e)}},ur=(r=null)=>{try{return Q(r)?document.createTextNode(r):Lr(r)}catch(e){i("component.virtualDOM.renderTreeToDOM",e)}},pr=ur;var fr=(r={},e={})=>{try{let t=ar(r,{existingChildren:e?.existingChildren}),n=dr(t.wrapped,r),o=e.includeActual&&n?pr(n):null;return{html:t,virtual:n,actual:o}}catch(t){i("component.render.getUpdatedDOM",t)}};var hr=(r={},e="",t="id")=>{try{let n=r&&r.id;if(G(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 j=l[M],R=hr(j,e,t);if(R!==null)return R}}}return null}catch(n){i("component.findComponentInTreeByField",n)}},mr=hr;var wr=(r="",e={},t=null)=>{let n=mr(t||window.joystick._internal.tree,r,"instanceId");n&&(n.children=[...n.children||[],e])};var Ar=(r={},e={},t=null)=>{try{let n=fr(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)}},Nr=(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)}},Pr=(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)}},Hr=(r={})=>{try{let e={id:r.id,instanceId:r.instanceId,instance:r,children:[]};wr(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&&C("lifecycle.onBeforeMount",()=>{e.options.lifecycle.onBeforeMount(e),k(`ui.${e?.options?.test?.name||E()}.lifecycle.onBeforeMount`,[e])}),!r.renderedComponent&&e.options.lifecycle.onMount&&C("lifecycle.onMount",()=>{e.options.lifecycle.onMount(e),k(`ui.${e?.options?.test?.name||E()}.lifecycle.onMount`,[e])}))}catch(t){i("component.renderMethods.component.handleLifecycle",t)}},Ir=(r={},e={},t={})=>{try{!e.walkingTreeForSSR&&r?.options?.lifecycle?.onUpdateProps&&(0,yr.diff)(e?.existingPropsMap,t)?.length>0&&C("lifecycle.onUpdateProps",()=>{let o=e?.existingPropsMap&&e?.existingPropsMap[r.id];r.options.lifecycle.onUpdateProps(o||{},t,r),k(`ui.${r?.options?.test?.name||E()}.lifecycle.onBeforeMount`,[o||{},t,r])})}catch(n){i("component.renderMethods.component.handleOnChangeProps",n)}},$r=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,o.values=l?.values||o.values,n.children[o.id]=[...n.children[o.id]||[],o],o.parent=n,Ir(o,n,t),C("lifecycle.onMount",()=>{o.setDOMNodeOnInstance()}),_r(this,o),o.parent&&Hr(o),o.options.data&&o.parent.walkingTreeForSSR&&o.parent.ssrTree.dataFunctions?Pr(o):o.parent&&o.parent.ssrTree?Nr(o):Ar(o,this,l?.children)}},Ur=function(e,t){try{let n=this;return new $r().bind({})(e,t,n)}catch(n){i("component.renderMethods.component",n)}},_=Ur;var qr=function(e=[],t=null){try{return z(t)&&e&&Array.isArray(e)?e.map((n,o)=>t(n,o)).join(""):""}catch(n){i("component.renderMethods.each",n)}},I=qr;var Br=(r="",e=[])=>{try{return e.reduce((t,[n,o])=>t.replace(`{{${n}}}`,o),r)}catch(t){i("component.renderMethods.i18n.replacePlaceholdersInString",t)}},$=(r="",e=[])=>{try{let t=typeof r=="string",n=Array.isArray(r),o=typeof r=="object"&&!n;if(t)return Br(r,e);if(n)return r?.map(s=>$(s,e));if(o)return Object.entries(r)?.reduce((s={},[m,l])=>(s[m]=$(l,e),s),{})}catch(t){i("component.renderMethods.i18n.handleTranslationReplacement",t)}},Wr=(r="",e={})=>{try{return r?.split(".").reduce((t,n)=>t[n],e)}catch(t){i("component.renderMethods.i18n.getTranslationAtPath",t)}},zr=function(r="",e={}){try{let t=L()?this.translations:window.__joystick_i18n__,o=r?.includes(".")?Wr(r,t):t[r];if(!t||!o)return"";let s=Object.entries(e);return $(o,s)}catch(t){i("component.renderMethods.i18n",t)}},U=zr;var Gr=function(e=!1,t=""){try{return this?.renderingHTMLWithDataForSSR||e?`<when>${t.trim()}</when>`:"<when> </when>"}catch(n){i("component.renderMethods.when",n)}},q=Gr;var X={c:_,component:_,e:I,each:I,i:U,i18n:U,w:q,when:q};export{X as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var o=(r="",t={})=>{throw new Error(`[joystick${r?`.${r}`:""}] ${t.message||t.reason||t}`)};var n=r=>{try{return!!Array.isArray(r)}catch(t){o("types.isArray",t)}};var c=r=>{try{return typeof r=="function"}catch(t){o("types.isFunction",t)}};var s=r=>{try{return!!(r&&typeof r=="object"&&!Array.isArray(r))}catch(t){o("types.isObject",t)}};var i=(r={},t=null)=>{try{let e=t(r);return e&&s(e)&&!n(e)?Object.assign({},e):{}}catch(e){o("component.values.compile.compileValues",e)}},m=(r={},t={})=>{try{return c(t)?i(r,t):Object.assign({},t)}catch(e){o("component.values.compile",e)}};export{m as default};
|