@telia-ace/widget-components-grid 1.1.1-rc.0 → 1.1.1-rc.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime");require("@emotion/react");const c=require("./index-2542500f.js"),n=require("react");require("react-dom");require("react-transition-group");const d=require("./grid-3ce6ef77.js");require("@emotion/styled");require("react-router-dom");require("react-router");const a=({builder:i})=>{const u=c.useContainer(),[e,o]=n.useState(null);return n.useEffect(()=>{u.getAsync("components").then(t=>i(t).then(r=>{o(r)}))},[]),n.useEffect(()=>()=>{e&&u.getAsync("components").then(t=>{t.nodes.detached=t.nodes.detached.filter(r=>r.id!==e.id)})},[e]),e?s.jsx(d.Component,{id:e.id,node:e,branch:"default"}):null};exports.default=a;
@@ -0,0 +1,27 @@
1
+ import { jsx as s } from "react/jsx-runtime";
2
+ import "@emotion/react";
3
+ import { e as d } from "./index-fe430b79.mjs";
4
+ import { useState as p, useEffect as r } from "react";
5
+ import "react-dom";
6
+ import "react-transition-group";
7
+ import { C as a } from "./grid-f0087a03.mjs";
8
+ import "@emotion/styled";
9
+ import "react-router-dom";
10
+ import "react-router";
11
+ const b = ({ builder: i }) => {
12
+ const n = d(), [t, m] = p(null);
13
+ return r(() => {
14
+ n.getAsync("components").then((e) => i(e).then((o) => {
15
+ m(o);
16
+ }));
17
+ }, []), r(() => () => {
18
+ t && n.getAsync("components").then((e) => {
19
+ e.nodes.detached = e.nodes.detached.filter(
20
+ (o) => o.id !== t.id
21
+ );
22
+ });
23
+ }, [t]), t ? /* @__PURE__ */ s(a, { id: t.id, node: t, branch: "default" }) : null;
24
+ };
25
+ export {
26
+ b as default
27
+ };
@@ -0,0 +1,75 @@
1
+ "use strict";const d=require("react/jsx-runtime"),$=require("@emotion/react"),r=require("./index-2542500f.js"),l=require("react");require("react-dom");const I=require("react-transition-group"),j=require("@emotion/styled"),A=require("react-router"),F=e=>e==="entering"||e==="entered",H=e=>e==="exiting"||e==="exited",w={fade:{in:"opacity: 1;",out:"opacity: 0;"},"slide-left":{in:"transform: translateX(0);",out:"transform: translateX(-100%);"},"slide-right":{in:"transform: translateX(0);",out:"transform: translateX(100%);"},"slide-up":{in:"transform: translateY(0);",out:"transform: translateY(100%);"},"slide-down":{in:"transform: translateY(0);",out:"transform: translateY(-100%);"},scale:{in:"transform: scale(1);",out:"transform: scale(0);"}},L=["slide-up","slide-down","slide-left","slide-right","scale"],G={compose:(e="exited",t)=>{const{enter:n,exit:o}=t,s=n.transitionKeys.split(" "),i=L.indexOf(s[0])>-1?"transform":"opacity";if(F(e))return s&&s.length>0?$.css`
2
+ ${s&&s.length>0&&s.map(c=>w[c]?w[c].in:"")}
3
+ transition: ${i} ${n.duration}ms ${n.easing};
4
+ `:"";const a=s&&s.length>0&&$.css`
5
+ ${s.map(c=>w[c]?w[c].out:"")}
6
+ `;if(H(e)){const c=o.transitionKeys.split(" ");return c&&c.length>0&&e==="exiting"?$.css`
7
+ ${a};
8
+ ${c.map(u=>w[u]?w[u].out:"")}
9
+ transition: ${i} ${o.duration}ms ${o.easing};
10
+ `:a}},composeViewTransition:(e,t,n)=>{if(t==="slide")return G.compose(e,{enter:{transitionKeys:n==="forth"?"slide-right":"slide-left",duration:500},exit:{transitionKeys:n==="forth"?"slide-left":"slide-right",duration:500}});if(t==="fade")return G.compose(e,{enter:{transitionKeys:"fade",duration:500},exit:{transitionKeys:"fade",duration:500}})},get:e=>w[e]},X=(e={})=>(Object.keys(e).forEach(t=>{(e[t]===null||typeof e[t]>"u")&&delete e[t]}),e),Y=()=>l.useContext(r.ComponentNodeContext),K=(e,t)=>({id:e.id,type:e.type,name:e.name,branch:t||"default"}),W=()=>{const e=r.useComponentNode(),t=r.useComponentPlatform(),[n,o]=l.useState([]),s=r.useIsMounted(),i=l.useCallback(a=>{if(t&&s.current&&a){const c=t.getBranch(a),u=a.getChildren(c).map(m=>K(m));o(u)}},[s,t,o,e]);return l.useEffect(()=>{e&&i(e)},[e,t]),l.useEffect(()=>{if(t){const[a,c]=r.createEventSubscriber(t.events);return a("components:set-layout",(u,m)=>{(e===m.node.parent||m.node.parent===t.nodes.root)&&i(m.node.parent)}),a("components:node-appended",(u,m)=>{(e===m.node.parent||m.node.parent===t.nodes.root)&&i(m.node.parent)}),a("components:node-removed",(u,{parentNode:m})=>{(m===e||m===t.nodes.root)&&i(m)}),()=>{c()}}},[e,t,i]),n},U=()=>l.useContext(r.ColumnContext),J=(e,t)=>{const n=Y(),o=r.useContainer(),[s,i]=l.useState(void 0),a=r.useIsMounted(),c=e||n.type||"";return l.useEffect(()=>{if(c){let u;return(t||o).getAsync("componentResolver").then(m=>{if(a.current){const h=m.getComponent(c);i(h)}u=m.registerResolver(c,h=>{a.current&&i(h)})}),()=>{u&&u()}}},[a,c,t,o]),s},Q=e=>{const t=r.useComponentNode(e),n=r.useComponentPlatform(),[o,s]=l.useState({}),i=r.useIsMounted();return l.useEffect(()=>{t&&i.current&&s(t.attributes.layout)},[t,i]),l.useEffect(()=>{if(n){const a=n.events.subscribe("components:layout-changed",(c,u)=>{t===u.node&&i.current&&s(u.node.attributes.layout)});return()=>{a()}}},[n,i,t]),o},z=()=>l.useContext(r.ComponentPropertyContext),Z=e=>{const t=r.useContainer(),n=r.useRouter(),[o,s]=l.useState({name:"",params:{}}),i=r.useIsMounted();return l.useEffect(()=>{const a=(e||t).get("$widget");if(!a)return;const{events:c}=a;return c.subscribe("router:change",(m,{next:{routeData:h}})=>{if(i.current){const{name:p,params:b}=h;X(b),s({name:p,params:b})}})},[i,e,t]),l.useEffect(()=>{if(n&&n.history&&i.current){const a=n.getRouteData(),{name:c,params:u}=a;X(u),s({name:c,params:u})}},[n,i]),o};var _=(e=>(e.back="back",e.forth="forth",e))(_||{});const k=(e,t,n)=>typeof n[e]=="number"&&typeof n[t]=="number"&&n[e]>n[t]?"back":"forth",B=({views:e,location:t,render:n})=>d.jsx(A.Switch,{location:t&&{...t,pathname:t.pathname.split("?")[0]},children:[...Object.keys(e).filter(o=>!!e[o].path),...Object.keys(e).filter(o=>!e[o].path)].map(o=>{const{path:s}=e[o];return s?Array.isArray(s)?s.map(i=>d.jsx(A.Route,{exact:!0,path:i,render:()=>n(o)},o)):d.jsx(A.Route,{exact:!0,path:s,render:()=>n(o)},o):d.jsx(A.Route,{render:()=>n(o)},o)})}),ee=j.div`
11
+ position: relative;
12
+ width: 100%;
13
+ flex: 1;
14
+ `,te=j(r.Grid)`
15
+ position: absolute;
16
+ left: 0;
17
+ right: 0;
18
+ ${e=>!!e.animationCss&&e.animationCss}
19
+ ${e=>!!e.scrollableCss&&e.scrollableCss}
20
+ `,ne={index:1,search:2,browse:3,guide:4,contact:5,"contact-method":6,conversation:7},se=({className:e="",...t})=>{const[n,o]=l.useState("index"),[s,i]=l.useState(_.forth),a=Z(),c=r.useRouter(),u=z(),m=r.useContext(),h=r.useContainer(),p=r.useComponentNode(),{gap:b="0"}=m,{columns:N=1,animation:v="none",scrollable:g=!1,...E}=u,[T,R]=r.useScroll(g);if(!p||!c)return null;const{location:O}=c;a.name!==n&&a.name!==""&&v&&(i(k(n,a.name,ne)),o(a.name));const{views:y}=h.get("$settings");if(!Object.keys(y).length)return null;const C=(f,S,P)=>{const x=q(S,P),D=p.getChildren(f)[0];return d.jsx(te,{...t,...E,scrollableCss:T,ref:R,columns:N,gap:b,...x,className:r.appendClassNames(e,"humany-view"),children:d.jsx(V,{id:D.id,branch:"default"})})},q=(f,S)=>{if(v==="slide"||v==="fade")return{animationCss:G.composeViewTransition(f,v,S),"data-state":f}};return d.jsx(ee,{className:"humany-animated-view",children:d.jsx(I.TransitionGroup,{component:null,childFactory:f=>l.cloneElement(f,{direction:s}),children:d.jsx(I.Transition,{timeout:{enter:500,exit:500},onEnter:f=>f==null?void 0:f.clientHeight,unmountOnExit:!0,direction:_.forth,children:(f,{direction:S})=>d.jsx(B,{views:y,location:O,render:P=>C(P,f,S)})},n)})})},oe=j(r.Grid)`
21
+ ${e=>!!e.scrollableCss&&e.scrollableCss}
22
+ `,re=({className:e="",...t})=>{const n=z(),o=r.useContext(),s=r.useContainer(),i=r.useComponentNode(),{views:a}=s.get("$settings"),{gap:c="0"}=o,{columns:u=1,animation:m="none",scrollable:h=!1,...p}=n,[b,N]=r.useScroll(h);return i?d.jsx(oe,{...t,...p,scrollableCss:b,ref:N,columns:u,gap:c,className:r.appendClassNames(e,"humany-view"),children:d.jsx(B,{views:a,render:v=>{const g=i.getChildren(v)[0];return d.jsx(V,{id:g.id,node:g,branch:"default"})}})}):null},M=e=>{var t,n;return $.css`
23
+ outline: none;
24
+ box-sizing: border-box;
25
+ * {
26
+ box-sizing: border-box;
27
+ outline: none;
28
+ }
29
+
30
+ grid-column: ${e["data-indent"]?`${e["data-indent"]+1} / ${e["data-indent"]+(e["data-width"]||0)+1}`:`span ${e["data-width"]}`};
31
+
32
+ ${((t=e.theme.fonts)==null?void 0:t.type)&&`
33
+ font-family: ${e.theme.fonts.type};
34
+
35
+ input, textarea {
36
+ font-family: ${e.theme.fonts.type};
37
+ }
38
+ `}
39
+
40
+ ${((n=e.theme.fonts)==null?void 0:n.base)&&`
41
+ font-size: ${e.theme.fonts.base};
42
+ `}
43
+
44
+ &:focus-visible {
45
+ ${r.paddedBorderTabStyle(e)};
46
+ }
47
+ `},ie=j(re)`
48
+ ${e=>M(e)}
49
+ `,ae=j(se)`
50
+ ${e=>M(e)}
51
+ `,ce=j.div`
52
+ text-align: center;
53
+ ${e=>{var t,n,o;return typeof((t=e.theme.colors)==null?void 0:t.warning)<"u"&&$.css`
54
+ color: ${(n=e.theme.colors)==null?void 0:n.warning};
55
+ border: 2px dashed ${(o=e.theme.colors)==null?void 0:o.warning};
56
+ `}}
57
+ ${e=>typeof e.theme.borderRadius<"u"&&`border-radius: ${e.theme.borderRadius};`}
58
+ ${e=>M(e)}
59
+ `,ue=l.forwardRef(({className:e="",children:t,...n},o)=>{const s=J(),{name:i,type:a,id:c}=Y(),u=l.useMemo(()=>s?j(s)`
60
+ ${M}
61
+ ${r.filterCssPropsStyle}
62
+ `:null,[s]);return typeof s>"u"?null:s===null||u===null?process.env.NODE_ENV!=="production"?d.jsx(ce,{...n,title:`type: ${a}, definition-id: ${i}, instance-id: ${c}`,className:r.appendClassNames(e,"humany-non-resolved-component"),children:d.jsx(r.Typography,{variant:"h5",children:"Non Resolved Component Type"})}):null:d.jsx(l.Suspense,{fallback:null,children:d.jsx(u,{ref:o,...n,className:r.appendClassNames(e,"humany-component",`humany-component-${i}`),children:t})})}),le=e=>{const t=r.useComponentNode(e),n=r.useComponentPlatform(),[o,s]=l.useState({}),i=r.useIsMounted();return l.useEffect(()=>{t&&i.current&&s(t.attributes.properties)},[t,e,i]),l.useEffect(()=>{if(n){const a=n.events.subscribe("components:properties-changed",(c,u)=>{t===u.node&&i.current&&s(u.node.attributes.properties)});return()=>{a()}}},[n,i,e,t]),o},de=(e,t)=>t?!0:typeof e=="string"?e==="full":e>0,V=l.forwardRef(({className:e="",id:t,branch:n,node:o,ariaLabel:s,tabIndex:i,context:a,...c},u)=>{const m=r.useComponentPlatform(),h=r.useContainer(),[p,b]=l.useState(),N=U(),v=r.useContext(t),g=le(t),{size:E="none",indent:T=0}=Q(t),R=de(E,o);if(l.useEffect(()=>{if(m){if(t&&!o){const x=m.nodes.get(t);if(x&&(b(K(x,n)),R)){const D=x.mount(h);return()=>{D()}}}else if(o){b(K(o,n));const x=o.mount(h);return()=>{x()}}}},[m,t,o,R]),!p||!R)return null;const O={...v,...a||{}},{cardinal:y,fonts:C={},accessibility:q={},...f}=O,S={type:C.type,base:C.base||"16px",small:C.small||"0.8em",normal:C.normal||"1em",medium:C.medium||"1.2em",large:C.large||"1.6em",huge:C.huge||"2.5em"},P={...f,fonts:S,accessibility:{...q}};return typeof y=="number"&&(P.sizes={cardinal:y,small:`${y}px`,normal:`${y*3}px`,medium:`${y*5}px`,large:`${y*8}px`}),d.jsx($.ThemeProvider,{theme:P,children:d.jsx(r.ComponentNodeContext.Provider,{value:p,children:d.jsx(r.ComponentPropertyContext.Provider,{value:g,children:(()=>{const x={"data-width":E==="full"?N:Math.min(E,N),"data-indent":T,"data-name":p.name,"data-node-id":p.id,"data-component-type":p.type,"aria-label":s,tabIndex:i,id:p.id,role:g&&g.role,...c};switch(p.type){case"view":return typeof g.animation=="string"&&g.animation!=="none"?d.jsx(ae,{...x,className:e}):d.jsx(ie,{...x,className:e});default:{const D=r.filterCssProps(g);return d.jsx(ue,{ref:u,...x,...D,className:e})}}})()})})})});l.lazy(()=>Promise.resolve().then(()=>require("./detached-component-4dd7e2c3.js")));const me=e=>{const t=e.map(s=>"min-content").join(" "),n=e[0].split(" ").map(s=>"1fr").join(" "),o=e.map(s=>`'${s}'`).join(" ");return $.css`
63
+ grid-template-columns: ${n};
64
+ grid-template-rows: ${t};
65
+ grid-template-areas: ${o};
66
+ `},pe=e=>{const t=W(),n=l.useMemo(()=>Object.entries(e.areas).map(([o,s])=>{const i=t.find(a=>a.name===o);return r.isNestedGrid(s)?{name:o,componentDef:i,context:s.context,areaSettings:s.areaSettings,template:s.template,areas:s.areas,gap:s.gap}:{name:o,componentDef:i,areaSettings:s.areaSettings,child:s.child,context:s.context}}),[e,t]);return d.jsx(fe,{"data-grid-area":e.gridArea,gridArea:e.gridArea,gap:e.gap,template:e.template,className:r.appendClassNames(e.className,"humany-grid"),children:n.map(o=>o.componentDef?d.jsx(V,{id:o.componentDef.id,branch:"default",context:{}},o.componentDef.id):null)})},fe=j.div`
67
+ display: grid;
68
+ ${e=>e.gridArea&&$.css`
69
+ grid-area: ${e.gridArea};
70
+ `}
71
+ ${e=>me(e.template)}
72
+ ${e=>e.gap&&$.css`
73
+ grid-gap: ${e.gap}rem;
74
+ `}
75
+ `,he=({className:e})=>{const t=z();return d.jsx(pe,{template:t.template,areas:t.areas,gap:t.gap,areaSettings:t.areaSettings,context:t.context})},ge=Object.freeze(Object.defineProperty({__proto__:null,default:he},Symbol.toStringTag,{value:"Module"}));exports.Component=V;exports.grid=ge;
@@ -0,0 +1,549 @@
1
+ import { jsx as l } from "react/jsx-runtime";
2
+ import { css as C, ThemeProvider as se } from "@emotion/react";
3
+ import { C as k, u as E, a as j, b as O, c as ie, d as ae, e as M, f as q, g as J, G as Q, h as H, i as Z, j as T, p as ce, k as le, T as ue, l as de, m as me } from "./index-fe430b79.mjs";
4
+ import ee, { useContext as L, useState as v, useCallback as pe, useEffect as g, forwardRef as te, useMemo as ne, Suspense as fe } from "react";
5
+ import "react-dom";
6
+ import { TransitionGroup as he, Transition as ge } from "react-transition-group";
7
+ import w from "@emotion/styled";
8
+ import { Switch as be, Route as X } from "react-router";
9
+ const ye = (e) => e === "entering" || e === "entered", $e = (e) => e === "exiting" || e === "exited", N = {
10
+ fade: {
11
+ in: "opacity: 1;",
12
+ out: "opacity: 0;"
13
+ },
14
+ "slide-left": {
15
+ in: "transform: translateX(0);",
16
+ out: "transform: translateX(-100%);"
17
+ },
18
+ "slide-right": {
19
+ in: "transform: translateX(0);",
20
+ out: "transform: translateX(100%);"
21
+ },
22
+ "slide-up": {
23
+ in: "transform: translateY(0);",
24
+ out: "transform: translateY(100%);"
25
+ },
26
+ "slide-down": {
27
+ in: "transform: translateY(0);",
28
+ out: "transform: translateY(-100%);"
29
+ },
30
+ scale: {
31
+ in: "transform: scale(1);",
32
+ out: "transform: scale(0);"
33
+ }
34
+ }, xe = ["slide-up", "slide-down", "slide-left", "slide-right", "scale"], Y = {
35
+ compose: (e = "exited", t) => {
36
+ const { enter: n, exit: r } = t, o = n.transitionKeys.split(" "), s = xe.indexOf(o[0]) > -1 ? "transform" : "opacity";
37
+ if (ye(e))
38
+ return o && o.length > 0 ? C`
39
+ ${o && o.length > 0 && o.map((a) => N[a] ? N[a].in : "")}
40
+ transition: ${s} ${n.duration}ms ${n.easing};
41
+ ` : "";
42
+ const i = o && o.length > 0 && C`
43
+ ${o.map((a) => N[a] ? N[a].out : "")}
44
+ `;
45
+ if ($e(e)) {
46
+ const a = r.transitionKeys.split(" ");
47
+ return a && a.length > 0 && e === "exiting" ? C`
48
+ ${i};
49
+ ${a.map((c) => N[c] ? N[c].out : "")}
50
+ transition: ${s} ${r.duration}ms ${r.easing};
51
+ ` : i;
52
+ }
53
+ },
54
+ composeViewTransition: (e, t, n) => {
55
+ if (t === "slide")
56
+ return Y.compose(e, {
57
+ enter: {
58
+ transitionKeys: n === "forth" ? "slide-right" : "slide-left",
59
+ duration: 500
60
+ },
61
+ exit: {
62
+ transitionKeys: n === "forth" ? "slide-left" : "slide-right",
63
+ duration: 500
64
+ }
65
+ });
66
+ if (t === "fade")
67
+ return Y.compose(e, {
68
+ enter: {
69
+ transitionKeys: "fade",
70
+ duration: 500
71
+ },
72
+ exit: {
73
+ transitionKeys: "fade",
74
+ duration: 500
75
+ }
76
+ });
77
+ },
78
+ get: (e) => N[e]
79
+ }, U = (e = {}) => (Object.keys(e).forEach((t) => {
80
+ (e[t] === null || typeof e[t] > "u") && delete e[t];
81
+ }), e), oe = () => L(k), B = (e, t) => ({
82
+ id: e.id,
83
+ type: e.type,
84
+ name: e.name,
85
+ branch: t || "default"
86
+ }), Ce = () => {
87
+ const e = E(), t = j(), [n, r] = v([]), o = O(), s = pe(
88
+ (i) => {
89
+ if (t && o.current && i) {
90
+ const a = t.getBranch(i), c = i.getChildren(a).map((u) => B(u));
91
+ r(c);
92
+ }
93
+ },
94
+ [o, t, r, e]
95
+ );
96
+ return g(() => {
97
+ e && s(e);
98
+ }, [e, t]), g(() => {
99
+ if (t) {
100
+ const [i, a] = ie(t.events);
101
+ return i("components:set-layout", (c, u) => {
102
+ (e === u.node.parent || u.node.parent === t.nodes.root) && s(u.node.parent);
103
+ }), i("components:node-appended", (c, u) => {
104
+ (e === u.node.parent || u.node.parent === t.nodes.root) && s(u.node.parent);
105
+ }), i("components:node-removed", (c, { parentNode: u }) => {
106
+ (u === e || u === t.nodes.root) && s(u);
107
+ }), () => {
108
+ a();
109
+ };
110
+ }
111
+ }, [e, t, s]), n;
112
+ }, ve = () => L(ae), we = (e, t) => {
113
+ const n = oe(), r = M(), [o, s] = v(void 0), i = O(), a = e || n.type || "";
114
+ return g(() => {
115
+ if (a) {
116
+ let c;
117
+ return (t || r).getAsync("componentResolver").then((u) => {
118
+ if (i.current) {
119
+ const p = u.getComponent(a);
120
+ s(p);
121
+ }
122
+ c = u.registerResolver(a, (p) => {
123
+ i.current && s(p);
124
+ });
125
+ }), () => {
126
+ c && c();
127
+ };
128
+ }
129
+ }, [i, a, t, r]), o;
130
+ }, Se = (e) => {
131
+ const t = E(e), n = j(), [r, o] = v({}), s = O();
132
+ return g(() => {
133
+ t && s.current && o(t.attributes.layout);
134
+ }, [t, s]), g(() => {
135
+ if (n) {
136
+ const i = n.events.subscribe(
137
+ "components:layout-changed",
138
+ (a, c) => {
139
+ t === c.node && s.current && o(c.node.attributes.layout);
140
+ }
141
+ );
142
+ return () => {
143
+ i();
144
+ };
145
+ }
146
+ }, [n, s, t]), r;
147
+ }, W = () => L(q), Ne = (e) => {
148
+ const t = M(), n = J(), [r, o] = v({ name: "", params: {} }), s = O();
149
+ return g(() => {
150
+ const i = (e || t).get("$widget");
151
+ if (!i)
152
+ return;
153
+ const { events: a } = i;
154
+ return a.subscribe("router:change", (u, { next: { routeData: p } }) => {
155
+ if (s.current) {
156
+ const { name: d, params: b } = p;
157
+ U(b), o({ name: d, params: b });
158
+ }
159
+ });
160
+ }, [s, e, t]), g(() => {
161
+ if (n && n.history && s.current) {
162
+ const i = n.getRouteData(), { name: a, params: c } = i;
163
+ U(c), o({ name: a, params: c });
164
+ }
165
+ }, [n, s]), r;
166
+ };
167
+ var F = /* @__PURE__ */ ((e) => (e.back = "back", e.forth = "forth", e))(F || {});
168
+ const De = (e, t, n) => typeof n[e] == "number" && typeof n[t] == "number" && n[e] > n[t] ? "back" : "forth", re = ({ views: e, location: t, render: n }) => /* @__PURE__ */ l(
169
+ be,
170
+ {
171
+ location: t && {
172
+ ...t,
173
+ pathname: t.pathname.split("?")[0]
174
+ },
175
+ children: [
176
+ ...Object.keys(e).filter((r) => !!e[r].path),
177
+ ...Object.keys(e).filter((r) => !e[r].path)
178
+ ].map((r) => {
179
+ const { path: o } = e[r];
180
+ return o ? Array.isArray(o) ? o.map((s) => /* @__PURE__ */ l(X, { exact: !0, path: s, render: () => n(r) }, r)) : /* @__PURE__ */ l(X, { exact: !0, path: o, render: () => n(r) }, r) : /* @__PURE__ */ l(X, { render: () => n(r) }, r);
181
+ })
182
+ }
183
+ ), Pe = w.div`
184
+ position: relative;
185
+ width: 100%;
186
+ flex: 1;
187
+ `, Ae = w(Q)`
188
+ position: absolute;
189
+ left: 0;
190
+ right: 0;
191
+ ${(e) => !!e.animationCss && e.animationCss}
192
+ ${(e) => !!e.scrollableCss && e.scrollableCss}
193
+ `, Ve = {
194
+ index: 1,
195
+ search: 2,
196
+ browse: 3,
197
+ guide: 4,
198
+ contact: 5,
199
+ "contact-method": 6,
200
+ conversation: 7
201
+ }, Re = ({ className: e = "", ...t }) => {
202
+ const [n, r] = v("index"), [o, s] = v(
203
+ F.forth
204
+ ), i = Ne(), a = J(), c = W(), u = H(), p = M(), d = E(), { gap: b = "0" } = u, {
205
+ columns: D = 1,
206
+ animation: x = "none",
207
+ scrollable: f = !1,
208
+ ...A
209
+ } = c, [G, V] = Z(f);
210
+ if (!d || !a)
211
+ return null;
212
+ const { location: _ } = a;
213
+ i.name !== n && i.name !== "" && x && (s(
214
+ De(n, i.name, Ve)
215
+ ), r(i.name));
216
+ const { views: y } = p.get("$settings");
217
+ if (!Object.keys(y).length)
218
+ return null;
219
+ const $ = (m, S, P) => {
220
+ const h = z(S, P), R = d.getChildren(m)[0];
221
+ return /* @__PURE__ */ l(
222
+ Ae,
223
+ {
224
+ ...t,
225
+ ...A,
226
+ scrollableCss: G,
227
+ ref: V,
228
+ columns: D,
229
+ gap: b,
230
+ ...h,
231
+ className: T(e, "humany-view"),
232
+ children: /* @__PURE__ */ l(I, { id: R.id, branch: "default" })
233
+ }
234
+ );
235
+ }, z = (m, S) => {
236
+ if (x === "slide" || x === "fade")
237
+ return {
238
+ animationCss: Y.composeViewTransition(
239
+ m,
240
+ x,
241
+ S
242
+ ),
243
+ "data-state": m
244
+ };
245
+ };
246
+ return /* @__PURE__ */ l(Pe, { className: "humany-animated-view", children: /* @__PURE__ */ l(
247
+ he,
248
+ {
249
+ component: null,
250
+ childFactory: (m) => ee.cloneElement(m, { direction: o }),
251
+ children: /* @__PURE__ */ l(
252
+ ge,
253
+ {
254
+ timeout: { enter: 500, exit: 500 },
255
+ onEnter: (m) => m == null ? void 0 : m.clientHeight,
256
+ unmountOnExit: !0,
257
+ direction: F.forth,
258
+ children: (m, { direction: S }) => /* @__PURE__ */ l(
259
+ re,
260
+ {
261
+ views: y,
262
+ location: _,
263
+ render: (P) => $(P, m, S)
264
+ }
265
+ )
266
+ },
267
+ n
268
+ )
269
+ }
270
+ ) });
271
+ }, Te = w(Q)`
272
+ ${(e) => !!e.scrollableCss && e.scrollableCss}
273
+ `, Ee = ({ className: e = "", ...t }) => {
274
+ const n = W(), r = H(), o = M(), s = E(), { views: i } = o.get("$settings"), { gap: a = "0" } = r, { columns: c = 1, animation: u = "none", scrollable: p = !1, ...d } = n, [b, D] = Z(p);
275
+ return s ? /* @__PURE__ */ l(
276
+ Te,
277
+ {
278
+ ...t,
279
+ ...d,
280
+ scrollableCss: b,
281
+ ref: D,
282
+ columns: c,
283
+ gap: a,
284
+ className: T(e, "humany-view"),
285
+ children: /* @__PURE__ */ l(
286
+ re,
287
+ {
288
+ views: i,
289
+ render: (x) => {
290
+ const f = s.getChildren(x)[0];
291
+ return /* @__PURE__ */ l(I, { id: f.id, node: f, branch: "default" });
292
+ }
293
+ }
294
+ )
295
+ }
296
+ ) : null;
297
+ }, K = (e) => {
298
+ var t, n;
299
+ return C`
300
+ outline: none;
301
+ box-sizing: border-box;
302
+ * {
303
+ box-sizing: border-box;
304
+ outline: none;
305
+ }
306
+
307
+ grid-column: ${e["data-indent"] ? `${e["data-indent"] + 1} / ${e["data-indent"] + (e["data-width"] || 0) + 1}` : `span ${e["data-width"]}`};
308
+
309
+ ${((t = e.theme.fonts) == null ? void 0 : t.type) && `
310
+ font-family: ${e.theme.fonts.type};
311
+
312
+ input, textarea {
313
+ font-family: ${e.theme.fonts.type};
314
+ }
315
+ `}
316
+
317
+ ${((n = e.theme.fonts) == null ? void 0 : n.base) && `
318
+ font-size: ${e.theme.fonts.base};
319
+ `}
320
+
321
+ &:focus-visible {
322
+ ${ce(e)};
323
+ }
324
+ `;
325
+ }, Oe = w(Ee)`
326
+ ${(e) => K(e)}
327
+ `, Me = w(Re)`
328
+ ${(e) => K(e)}
329
+ `, je = w.div`
330
+ text-align: center;
331
+ ${(e) => {
332
+ var t, n, r;
333
+ return typeof ((t = e.theme.colors) == null ? void 0 : t.warning) < "u" && C`
334
+ color: ${(n = e.theme.colors) == null ? void 0 : n.warning};
335
+ border: 2px dashed ${(r = e.theme.colors) == null ? void 0 : r.warning};
336
+ `;
337
+ }}
338
+ ${(e) => typeof e.theme.borderRadius < "u" && `border-radius: ${e.theme.borderRadius};`}
339
+ ${(e) => K(e)}
340
+ `, Ke = te(
341
+ ({ className: e = "", children: t, ...n }, r) => {
342
+ const o = we(), { name: s, type: i, id: a } = oe(), c = ne(() => o ? w(o)`
343
+ ${K}
344
+ ${le}
345
+ ` : null, [o]);
346
+ return typeof o > "u" ? null : o === null || c === null ? process.env.NODE_ENV !== "production" ? /* @__PURE__ */ l(
347
+ je,
348
+ {
349
+ ...n,
350
+ title: `type: ${i}, definition-id: ${s}, instance-id: ${a}`,
351
+ className: T(e, "humany-non-resolved-component"),
352
+ children: /* @__PURE__ */ l(ue, { variant: "h5", children: "Non Resolved Component Type" })
353
+ }
354
+ ) : null : /* @__PURE__ */ l(fe, { fallback: null, children: /* @__PURE__ */ l(
355
+ c,
356
+ {
357
+ ref: r,
358
+ ...n,
359
+ className: T(
360
+ e,
361
+ "humany-component",
362
+ `humany-component-${s}`
363
+ ),
364
+ children: t
365
+ }
366
+ ) });
367
+ }
368
+ ), Ge = (e) => {
369
+ const t = E(e), n = j(), [r, o] = v({}), s = O();
370
+ return g(() => {
371
+ t && s.current && o(t.attributes.properties);
372
+ }, [t, e, s]), g(() => {
373
+ if (n) {
374
+ const i = n.events.subscribe(
375
+ "components:properties-changed",
376
+ (a, c) => {
377
+ t === c.node && s.current && o(c.node.attributes.properties);
378
+ }
379
+ );
380
+ return () => {
381
+ i();
382
+ };
383
+ }
384
+ }, [n, s, e, t]), r;
385
+ }, _e = (e, t) => t ? !0 : typeof e == "string" ? e === "full" : e > 0, I = te(
386
+ ({
387
+ className: e = "",
388
+ id: t,
389
+ branch: n,
390
+ node: r,
391
+ ariaLabel: o,
392
+ tabIndex: s,
393
+ context: i,
394
+ ...a
395
+ }, c) => {
396
+ const u = j(), p = M(), [d, b] = v(), D = ve(), x = H(t), f = Ge(t), { size: A = "none", indent: G = 0 } = Se(t), V = _e(A, r);
397
+ if (g(() => {
398
+ if (u) {
399
+ if (t && !r) {
400
+ const h = u.nodes.get(t);
401
+ if (h && (b(B(h, n)), V)) {
402
+ const R = h.mount(p);
403
+ return () => {
404
+ R();
405
+ };
406
+ }
407
+ } else if (r) {
408
+ b(B(r, n));
409
+ const h = r.mount(p);
410
+ return () => {
411
+ h();
412
+ };
413
+ }
414
+ }
415
+ }, [u, t, r, V]), !d || !V)
416
+ return null;
417
+ const _ = { ...x, ...i || {} }, {
418
+ cardinal: y,
419
+ fonts: $ = {},
420
+ accessibility: z = {},
421
+ ...m
422
+ } = _, S = {
423
+ type: $.type,
424
+ base: $.base || "16px",
425
+ small: $.small || "0.8em",
426
+ normal: $.normal || "1em",
427
+ medium: $.medium || "1.2em",
428
+ large: $.large || "1.6em",
429
+ huge: $.huge || "2.5em"
430
+ }, P = {
431
+ ...m,
432
+ fonts: S,
433
+ accessibility: {
434
+ ...z
435
+ }
436
+ };
437
+ return typeof y == "number" && (P.sizes = {
438
+ cardinal: y,
439
+ small: `${y}px`,
440
+ normal: `${y * 3}px`,
441
+ medium: `${y * 5}px`,
442
+ large: `${y * 8}px`
443
+ }), /* @__PURE__ */ l(se, { theme: P, children: /* @__PURE__ */ l(k.Provider, { value: d, children: /* @__PURE__ */ l(q.Provider, { value: f, children: (() => {
444
+ const h = {
445
+ "data-width": A === "full" ? D : Math.min(A, D),
446
+ "data-indent": G,
447
+ "data-name": d.name,
448
+ "data-node-id": d.id,
449
+ "data-component-type": d.type,
450
+ "aria-label": o,
451
+ tabIndex: s,
452
+ id: d.id,
453
+ role: f && f.role,
454
+ ...a
455
+ };
456
+ switch (d.type) {
457
+ case "view":
458
+ return typeof f.animation == "string" && f.animation !== "none" ? /* @__PURE__ */ l(Me, { ...h, className: e }) : /* @__PURE__ */ l(Oe, { ...h, className: e });
459
+ default: {
460
+ const R = de(f);
461
+ return /* @__PURE__ */ l(
462
+ Ke,
463
+ {
464
+ ref: c,
465
+ ...h,
466
+ ...R,
467
+ className: e
468
+ }
469
+ );
470
+ }
471
+ }
472
+ })() }) }) });
473
+ }
474
+ );
475
+ ee.lazy(() => import("./detached-component-ccd8259a.mjs"));
476
+ const ze = (e) => {
477
+ const t = e.map((o) => "min-content").join(" "), n = e[0].split(" ").map((o) => "1fr").join(" "), r = e.map((o) => `'${o}'`).join(" ");
478
+ return C`
479
+ grid-template-columns: ${n};
480
+ grid-template-rows: ${t};
481
+ grid-template-areas: ${r};
482
+ `;
483
+ }, Xe = (e) => {
484
+ const t = Ce(), n = ne(() => Object.entries(e.areas).map(([r, o]) => {
485
+ const s = t.find((i) => i.name === r);
486
+ return me(o) ? {
487
+ name: r,
488
+ componentDef: s,
489
+ context: o.context,
490
+ areaSettings: o.areaSettings,
491
+ template: o.template,
492
+ areas: o.areas,
493
+ gap: o.gap
494
+ } : {
495
+ name: r,
496
+ componentDef: s,
497
+ areaSettings: o.areaSettings,
498
+ child: o.child,
499
+ context: o.context
500
+ };
501
+ }), [e, t]);
502
+ return /* @__PURE__ */ l(
503
+ Ye,
504
+ {
505
+ "data-grid-area": e.gridArea,
506
+ gridArea: e.gridArea,
507
+ gap: e.gap,
508
+ template: e.template,
509
+ className: T(e.className, "humany-grid"),
510
+ children: n.map((r) => r.componentDef ? /* @__PURE__ */ l(
511
+ I,
512
+ {
513
+ id: r.componentDef.id,
514
+ branch: "default",
515
+ context: {}
516
+ },
517
+ r.componentDef.id
518
+ ) : null)
519
+ }
520
+ );
521
+ }, Ye = w.div`
522
+ display: grid;
523
+ ${(e) => e.gridArea && C`
524
+ grid-area: ${e.gridArea};
525
+ `}
526
+ ${(e) => ze(e.template)}
527
+ ${(e) => e.gap && C`
528
+ grid-gap: ${e.gap}rem;
529
+ `}
530
+ `, Be = ({ className: e }) => {
531
+ const t = W();
532
+ return /* @__PURE__ */ l(
533
+ Xe,
534
+ {
535
+ template: t.template,
536
+ areas: t.areas,
537
+ gap: t.gap,
538
+ areaSettings: t.areaSettings,
539
+ context: t.context
540
+ }
541
+ );
542
+ }, Je = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
543
+ __proto__: null,
544
+ default: Be
545
+ }, Symbol.toStringTag, { value: "Module" }));
546
+ export {
547
+ I as C,
548
+ Je as g
549
+ };