@realmorg/realm 0.0.17 → 0.0.19

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.
@@ -556,7 +556,13 @@ var _setCSSProperty = (self) => (selector, name, value) => forEachCSSRules($adop
556
556
  });
557
557
  var updateRuleProperty = (rule) => ([property, value]) => setStyleProperty(getStyle(rule), property, value);
558
558
  var removeRuleProperty = (rule) => ([property]) => getStyle(rule).removeProperty(property);
559
- var bindCSS = (element, name, value, dataType, isGlobalUpdate = false) => {
559
+ var bindCSS = (element, name, value, valueType, dataType, isGlobalUpdate = false) => {
560
+ if (![
561
+ "string" /* STRING */,
562
+ "boolean" /* BOOLEAN */,
563
+ "number" /* NUMBER */
564
+ ].includes(valueType))
565
+ return;
560
566
  const sheet = $adoptedStyleSheets(element);
561
567
  const strValue = `${value}`;
562
568
  forEachCSSRules(sheet, (rule) => {
@@ -941,8 +947,8 @@ var attrMutableLookup = (statesBinding = createSet(), attrsBinding = createSet()
941
947
  [RealmMutableAttr.SRC]: srcDataBinding,
942
948
  [RealmMutableAttr.META]: metasBinding
943
949
  });
944
- var bindElement = (element, dataType, dataBinding, name, value, isGlobalUpdate, isUpdate) => {
945
- bindCSS(element, name, value, dataType, isGlobalUpdate);
950
+ var bindElement = (element, dataType, dataBinding, name, value, valueType, isGlobalUpdate, isUpdate) => {
951
+ bindCSS(element, name, value, valueType, dataType, isGlobalUpdate);
946
952
  forEach(
947
953
  dataBinding,
948
954
  ([node, ...bindings]) => bindAttr(
@@ -1067,17 +1073,19 @@ var getDefaultAttrValues = (element) => fromEntries(
1067
1073
  );
1068
1074
 
1069
1075
  // src/elements/import-element.ts
1070
- var IMPORT_ELEMENT_REQUEST_CACHE = createMap();
1076
+ var IMPORT_CACHE = createMap();
1077
+ var IMPORT_STATUS = createMap();
1071
1078
  var importElement = defineElement({
1072
1079
  name: RealmTagNames.IMPORT_ELEMENT,
1073
1080
  async onBeforeInit(element) {
1074
1081
  const { from, automount, as: tagAlias, ...attrs } = element.$attrsKv();
1075
- const [, cachedHtml] = getMap(IMPORT_ELEMENT_REQUEST_CACHE, from) ?? [];
1076
- if (!cachedHtml) {
1082
+ const hasFromAttr = !!from;
1083
+ const [, cachedHtml] = getMap(IMPORT_CACHE, from) ?? [];
1084
+ if (!cachedHtml && hasFromAttr) {
1077
1085
  try {
1078
1086
  const response = await fetch(from);
1079
1087
  const html = await response.text();
1080
- setMap(IMPORT_ELEMENT_REQUEST_CACHE, from, html);
1088
+ setMap(IMPORT_CACHE, from, html);
1081
1089
  } catch {
1082
1090
  newError(`Failed to fetch "${from}"`);
1083
1091
  }
@@ -1085,7 +1093,7 @@ var importElement = defineElement({
1085
1093
  const customElement2 = element.$qs(
1086
1094
  RealmTagNames.CUSTOM_ELEMENT,
1087
1095
  [],
1088
- DOMFrom(getMap(IMPORT_ELEMENT_REQUEST_CACHE, from))
1096
+ DOMFrom(getMap(IMPORT_CACHE, from))
1089
1097
  );
1090
1098
  if (!customElement2)
1091
1099
  return element._remove();
@@ -1094,10 +1102,11 @@ var importElement = defineElement({
1094
1102
  customElement2
1095
1103
  );
1096
1104
  let customElementName = tagAlias ?? nameAttr;
1105
+ if (getMap(IMPORT_STATUS, customElementName))
1106
+ return;
1097
1107
  const hasDefined = !!customElements.get(customElementName);
1098
- if (hasDefined) {
1108
+ if (hasDefined)
1099
1109
  customElementName = customElementName + DOT_NOTATION + element.$randId();
1100
- }
1101
1110
  element._attr(RealmAttributeNames.NAME, customElementName, customElement2);
1102
1111
  if (automount !== void 0) {
1103
1112
  const mountElement = element._createElement(customElementName);
@@ -1108,6 +1117,7 @@ var importElement = defineElement({
1108
1117
  element._append(customElement2, doc.body);
1109
1118
  element._remove();
1110
1119
  }
1120
+ setMap(IMPORT_STATUS, customElementName, true);
1111
1121
  }
1112
1122
  });
1113
1123
 
@@ -1974,8 +1984,10 @@ var setAttrAction = defineAction({
1974
1984
  onTrigger(element, _elementName, actionArgs, event2) {
1975
1985
  const [nameAttr] = findAttr(actionArgs, RealmAttributeNames.NAME);
1976
1986
  const attrType = getAttrType(nameAttr, element.attrsRegistry);
1987
+ const attrValue = element.$attr(nameAttr);
1988
+ const parsedValue = attrType === "boolean" /* BOOLEAN */ ? Boolean(attrValue) : attrValue;
1977
1989
  const mutatedValue = getMutatedValue(element, actionArgs, attrType, event2);
1978
- const prevValue = parseValue(attrType, element.$attr(nameAttr));
1990
+ const prevValue = parseValue(attrType, parsedValue);
1979
1991
  const value = mutatedValue(prevValue);
1980
1992
  element._attr(nameAttr, `${value}`);
1981
1993
  }
@@ -2207,23 +2219,23 @@ var repeatListElement = defineElement({
2207
2219
  const elementShadow = element.$shadow();
2208
2220
  element._clear();
2209
2221
  element._clear(elementShadow);
2210
- forEach(entries, (item, index) => {
2222
+ forEach(entries, (value, index) => {
2211
2223
  element._append(
2212
2224
  element.$clone(fragment),
2213
2225
  elementShadow
2214
2226
  );
2215
2227
  const elementAttrBindings2 = getElementAttrBindings(element);
2216
- forEach(
2217
- toDotNotation(item),
2218
- (name) => bindElement(
2228
+ forEach(toDotNotation(value), (mutateName) => {
2229
+ bindElement(
2219
2230
  element,
2220
2231
  RealmMutableAttr.SRC,
2221
2232
  elementAttrBindings2,
2222
- name,
2223
- item,
2233
+ mutateName,
2234
+ value,
2235
+ void 0,
2224
2236
  false
2225
- )
2226
- );
2237
+ );
2238
+ });
2227
2239
  const meta = { index, length: entries.length };
2228
2240
  forEach(
2229
2241
  toDotNotation(meta, META_PREFIX),
@@ -2233,6 +2245,7 @@ var repeatListElement = defineElement({
2233
2245
  elementAttrBindings2,
2234
2246
  name,
2235
2247
  meta,
2248
+ void 0,
2236
2249
  false
2237
2250
  )
2238
2251
  );
@@ -2248,12 +2261,14 @@ var repeatListElement = defineElement({
2248
2261
  [RealmMutableAttr.ATTR]: () => hostElement.$attr(mutateName),
2249
2262
  [RealmMutableAttr.STATE]: () => hostElementStates.get(mutateName)
2250
2263
  };
2264
+ const valueType = getAttrType(mutateName, registry);
2251
2265
  bindElement(
2252
2266
  element,
2253
2267
  dataType,
2254
2268
  elementAttrBindings,
2255
2269
  mutateName,
2256
2270
  valueLookup[dataType](),
2271
+ valueType,
2257
2272
  false
2258
2273
  );
2259
2274
  })
@@ -2276,6 +2291,7 @@ var repeatListElement = defineElement({
2276
2291
  getElementAttrBindings(element),
2277
2292
  mutatorName,
2278
2293
  value,
2294
+ void 0,
2279
2295
  isGlobalState,
2280
2296
  true
2281
2297
  );
@@ -2397,6 +2413,7 @@ var registerElement = (elementName) => defineElement({
2397
2413
  bindingElements,
2398
2414
  mutateName,
2399
2415
  valueLookup[dataType](),
2416
+ valueType,
2400
2417
  isGlobalState
2401
2418
  );
2402
2419
  })
@@ -2409,6 +2426,10 @@ var registerElement = (elementName) => defineElement({
2409
2426
  ]),
2410
2427
  ([mutator, mutateType, globalState2]) => mutator.subscribe((mutatorName, value, oldValue) => {
2411
2428
  const eventDetail = [mutatorName, value, oldValue];
2429
+ const valueType = globalState2 ? getGlobalStateType(mutatorName) : getAttrType(
2430
+ mutatorName,
2431
+ mutateType === RealmMutableAttr.STATE ? statesRegistry : attributesRegistry
2432
+ );
2412
2433
  if (mutateType === RealmMutableAttr.STATE)
2413
2434
  arrayPush(eventDetail, globalState2);
2414
2435
  element._sendEvent(
@@ -2421,6 +2442,7 @@ var registerElement = (elementName) => defineElement({
2421
2442
  bindingElements,
2422
2443
  mutatorName,
2423
2444
  value,
2445
+ valueType,
2424
2446
  globalState2,
2425
2447
  true
2426
2448
  );
@@ -8,4 +8,4 @@
8
8
  * This source code is licensed under the MIT license found in the
9
9
  * LICENSE file in the root directory of this source tree.
10
10
  */
11
- var t={t:"action",AS:"as",o:"async",i:"children",l:"debounce",u:"debug",h:"defer",m:"element",g:"every",T:"from",S:"global",v:"href",R:"index",p:"loaded",_:"mount",A:"mutate",O:"name",M:"of",I:"once",L:"ref",N:"rel",C:"script-id",D:"slot",U:"src",P:"storage",q:"to",B:"toggle",j:"type",G:"value",H:"method",F:"url"},e="attr",n="meta",o="src",s="state",r="",a="$",i="RLM:",c="data-",l="-",u=":",h=".",d="contains",m="slot",f="custom-element",E="element-attr",$="element-flow",g="import-script",T="import-style",S="script",y=JSON.stringify,v=JSON.parse,R=(t="")=>"object"==typeof t?y(t):""+t,p=t=>v(R(t)),_=/([A-Z])+/g,b=/(?=[A-Z])|[.\-\s_]/,A=/^((?!chrome|android).)*safari/i.test(navigator.userAgent)?/:host\(\[([#@][a-zA-Z0-9-_.]+?)\](\[(global)\])?(\[(eq|neq|gt|gte|lt|lte|contains)=\"(\w+?)\"\])?\)/g:/:host\(\[\\([#@][a-zA-Z0-9-_.]+?)\](\[(global)\])?(\[(eq|neq|gt|gte|lt|lte|contains)="(\w+?)"\])?\)/g,w=/[$|#|@|!]([.]?(?:\w+[.-])*\w+)/gm,O=class{#t;#e;constructor(){this.#t=B(),this.#e=j()}set(t,e,n){const o=et(this.#t,t),s="function"==typeof e?e(o):e;"memory"!==n&&window?.[n]?.setItem(t,R(s)),nt(this.#t,t,s),x(this.#e,e=>e.call(this,t,s,o))}get(t,e){if("memory"!==e){const n=window?.[e]?.getItem(t);if(void 0!==n)return v(y(n))}return et(this.#t,t)}async subscribe(t){this.#n(t),ot(this.#e,t)}#n(t){k(this.#t,(e,n)=>t.call(this,n,e))}},M=t=>t.trim(),I=(t,e=1,n)=>null==t?r:t.slice(e,n),L=(t,e)=>t.split(e),N=t=>t?.toLowerCase?.(),C=(t,e,n)=>t.replace(e,n),D=(t,e)=>t.startsWith(e),U=(t,e)=>t.includes(e),P=t=>{if(!t)return r;const[e,...n]=L(N(t),r);return(t=>t.toUpperCase())(e)+X(n,r)},q=t=>Error(t),B=(t=[])=>new Map(t),j=t=>new Set(t),G=t=>Array.from(t),H=(t,e,n)=>{if(!e)return t;if(!w.test(e))return e;if(n&&!D(e,n))return e;const o=t instanceof O;return e.replace(w,(e,n)=>{const s=z(I(n),h),r=Q(s,(t=>(e,n,o)=>t&&0===o?e.get(n):e[n])(o),t);return"object"==typeof r?y(r):r})},F=(t,e=a)=>{const n=rt(t);return Q(n,(t,[n,o])=>"object"==typeof o?Q(F(o),(t,o)=>[...t,`${e}${h}${n}${h}${o}`],t):[...t,`${e}${h}${n}`],[])},V=t=>Array.isArray(t),x=(t,e)=>{Q(G(t),(t,n,o)=>(e?.(n,o),t))},k=(t,e)=>t.forEach(e),Y=(t,e)=>t.forEach(e),Q=(t,e,n)=>t.reduce(e,n),Z=(t,e)=>t.push(e),J=(t,e)=>t.map(e),X=(t,e)=>t.join(e),z=(t,e)=>t.split(e),K=(t,e,n,...o)=>t.splice(e,n,...o),W=(t,e)=>t.some(e),tt=(t,e)=>t.find(e),et=(t,e)=>t.get(e),nt=(t,e,n)=>t.set(e,n),ot=(t,e)=>t.add(e),st=t=>Object.fromEntries(t),rt=t=>Object.entries(t),at=document,it=at.head,ct=window,lt=(t,e)=>t.innerHTML=e,ut=t=>(e,n)=>(n??t).append(e),ht=t=>e=>(e??t).remove(),dt=t=>at.createElement(t),mt=()=>at.createDocumentFragment(),ft=t=>(e,n)=>{const o=n??t,s=o.setAttribute.bind(o),a=o.removeAttribute.bind(o),i=(t,e)=>t in o&&(o[t]=e);x(e.filter(t=>t),([t,e])=>{if("boolean"!=typeof e){const n=R(e);return s(t,n),void i(t,n)}e?s(t,r):a(t),i(t,e)})},Et=t=>(e,n,o)=>ft(t)([[e,n]],o),$t=(t,e)=>t&&!!e&&t.assign(...e),gt=t=>(e,n,o)=>(o??t).addEventListener(e,n),Tt=()=>parseInt(C(Math.random().toString(),h,r)).toString(16),St=t=>t?.innerHTML,yt=t=>e=>(e??t).cloneNode(1),vt=(t,e)=>V(e)?Q(e.filter(t=>V(t)),(t,[e,n])=>(e&&(t+=`[${e}${n?`="${n}"`:r}]`),t),t):t,Rt=t=>(e,n,o)=>(o??t)?.querySelector(vt(e,n)),pt=t=>(e,n,o)=>(o??t)?.querySelectorAll(vt(e,n)),_t=t=>t.name,bt=t=>t.value,At=t=>e=>G((e||t)?.attributes??[]),wt=t=>(e,n)=>(n||t)?.getAttribute?.(e),Ot=t=>(e,n,o)=>Rt(t)(e,V(n)?n:[[n,o]]),Mt=t=>(e,n,o)=>pt(t)(e,V(n)?n:[[n,o]]),It=t=>"@"+t,Lt=t=>"#"+t,Nt=t=>()=>t.V,Ct=t=>()=>t.getRootNode(),Dt=":host",Ut="comp",Pt="style",qt="global",Bt=(t,e,n)=>{const o="eq"===t?e:null,s="neq"===t?e:null,r="gt"===t?e:null,a="gte"===t?e:null,i="lt"===t?e:null,c="lte"===t?e:null,l=t===d?e:null;return["true","false"].includes(n)||isNaN(+n)?!!o&&n===o||!!s&&n!==s||!!l&&U(n,l):!!o&&+n==+o||!!s&&+n!=+s||!!r&&+n>+r||!!a&&+n>=+a||!!i&&+n<+i||!!c&&+n<=+c},jt=t=>t?.style,Gt=(t,e)=>{if(!e)return t?.selectorText;t.selectorText=e},Ht=(t,e,n)=>t.setProperty(e,n),Ft=(t,e)=>t.getPropertyValue(e),Vt=(t,e)=>x(t,t=>x(Object.values(t.cssRules),e)),xt=t=>Nt(t)().adoptedStyleSheets,kt=t=>()=>{const e=new CSSStyleSheet;return Z(xt(t),e),e},Yt=(t,e,n,o=1)=>{const s=`${l}${l}${CSS.escape((t=>{const e=J((t=>L(t?.replace(_,P),b))(t),N)??[],n=e.length;return 0===n?r:1===n?e.at(0):X(e,l)})(t))}`,a=jt(e);if(!a)return s;const i=()=>Ft(a,s);if(void 0===n)return i();o||i(),Ht(a,s,""+n)},Qt=t=>`var(${l}${l}${t})`,Zt=(t,e)=>t.insertRule(Q(e,(t,[e,n])=>t+(e+"{")+X(Q(n,(t,[e,n])=>[...t,X([e,n],u)],[]),";")+"}",r)),Jt=class extends HTMLElement{name;id;#o;V;k;Y;Z;J=(t=>e=>lt(e??t,r))(this);X=(t,e)=>{e?lt(e,""+t):(()=>{this.#o=""+t})()};K=(t=>e=>{if(!e)return;const n=yt(t),o=e instanceof HTMLTemplateElement?n(e).content:e;ut(t)(o,Nt(t)())})(this);W=t=>t&&ut(this)(yt(this)(t),this.tt());et=(t=>(e,n)=>(n??t).textContent="object"==typeof e?y(e):""+e)(this);nt=(t=>()=>{const e=t;return e.V=t.attachShadow({mode:"closed",slotAssignment:"manual"}),Nt(e)()})(this);ot=ut(this);st=ht(this);rt=(t=>(e,n)=>(n??t).replaceWith(e))(this);it=dt;ct=mt;lt=ft(this);ut=Et(this);ht=(t=>(e,n)=>(n??t).removeAttribute(e))(this);dt=(t=>(e,n,o)=>Et(t)(`${c}${e}`,n,o))(this);ft=(t=>(e,n)=>ft(t)(e,n))(this);Et=$t;$t=gt(this);gt=(t=>(e,n,o)=>(o??t).removeEventListener(e,n))(this);Tt=(t=>(e,n,o)=>gt(t)(i+e,e=>n.call(o??t,e.detail)))(this);St=(t=>(e,n,o)=>(o??t).dispatchEvent(new CustomEvent(i+e,{detail:n})))(this);yt=(e=>(n,o,s)=>{const r=wt(s??e)(t.u,n);r&&((t,e="log")=>{console[e](...t)})([r,o])})(this);vt=t=>St(t??this);Rt=Tt;_t=(t=>()=>t.name)(this);bt=(t=>e=>(e??t).id)(this);At=(t=>e=>N((e??t)?.tagName))(this);wt=(t=>e=>(e??t).parentElement)(this);Ot=(t=>e=>(e??t).parentNode)(this);tt=Nt(this);Mt=Ct(this);It=t=>{return(e=t??this,()=>Ct(e)().host)();var e};Lt=yt(this);Nt=vt;Ct=Rt(this);Dt=pt(this);Ut=(t=>e=>G((e??t).children))(this);Pt=(t=>e=>G((e??t).childNodes))(this);qt=At(this);Bt=(t=>e=>Q(At(t)(e),(t,e)=>(t[_t(e)]=bt(e),t),{}))(this);jt=wt(this);Gt=(t=>(e,n)=>(n||t).hasAttribute(e))(this);Ht=(t=>(e,n)=>wt(t)(`${c}${e}`,n))(this);Ft=Ot(this);Vt=Mt(this);xt=(t=>(e,n,o)=>Rt(t)(e,V(n)?n:[[n,o]],Nt(t)()))(this);kt=(t=>(e,n,o)=>pt(t)(e,V(n)?n:[[n,o]],Nt(t)()))(this);Yt=It;Qt=Lt;Zt=kt(this);Jt=(t=>n=>{if(!n)return;const o=St(n),r=kt(t)();Z(xt(t),r),r.replaceSync(o),Vt([r],t=>{const n=Gt(t),o=G(n?.matchAll(A)??[]);if(!o.length)return;const r=jt(t),a=Q(z(r.cssText,";"),(t,e)=>e?[...t,J(z(e,u),M)]:t,[]);Gt(t,C(n,A,Dt)),Yt(Pt,t,X(J(a,t=>X(t,u)),"|"));for(const n of o){const[,o,r,a,...i]=n,c=D(o,"#")?s:e,u=I(o);Yt(c,t,u);const h=u+l;a===qt&&Yt(h+qt,t,1);const[d,m,f]=i??[];if(!d)return;Yt(h+"op",t,m),Yt(h+Ut,t,f)}}),ht(n)()})(this);Xt=Zt;zt=(t=>(e,n,o)=>Vt(xt(t),t=>{if(Gt(t)!==e)return;const s=t.style;Ft(s,n)!==o&&Ht(s,n,o)}))(this);Kt=Yt;Wt=Qt},Xt=(t,e)=>{let n=setTimeout(t,e);return[n,()=>clearTimeout(n)]},zt=t=>{let e=requestAnimationFrame(t);return[e,()=>cancelAnimationFrame(e)]},Kt=class extends Jt{te;ee;ne;oe;k=new O;Y=j();Z=j();#s=[];constructor({name:t,te:e,se:n,ee:o,ne:s,oe:r}){super(),this.name=t,this.id=this.Rt(),this.ee=o,this.ne=s,this.oe=r,n?.(this),this.X(this.vt()),e?.(this),zt(()=>this.ee?.(this))}subscribe(t){Z(this.#s,t)}async connectedCallback(){const[t]=ue(this,(t,e,n)=>{x(this.#s,o=>o?.(t,e,n)),this.oe?.(this,t,e,n)});t()}disconnectedCallback(){this.ne?.(this)}},Wt=(t=>(t.re="string",t.ae="number",t.ie="boolean",t.ce="array",t.le="object",t.ue="html",t.he="json",t))(Wt||{}),te=({name:t,extends:e,de:n,me:o,fe:s,...r})=>()=>new Promise(a=>{const i=U(t,l),c=customElements.get(t);if(!i||c)throw q(`Element \`${t}\` has invalid name or already defined`);customElements.whenDefined(t).then(async()=>{o?.(t),a(1)}),n?.(t),customElements.define(t,class extends Kt{constructor(){super({name:t,...r})}async connectedCallback(){super.connectedCallback(),s?.(this)}},{extends:e})}),ee=(t,e)=>{const n=t=>"string"!=typeof e?e:p(e||t),o={number:()=>+e,boolean:()=>n(e),array:()=>n("[]"),object:()=>n("{}")};return o?.[t]?.()??e},ne=(t,e=E)=>G(t.Vt(e)),oe=(e,n)=>j(Q(ne(e,n),(n,o)=>{const s=e.jt(t.O,o),r=e.jt(t.j,o);return[...n,[s,r,ee(r,e.vt(o))]]},[])),se=(t,e)=>x(ne(t,e),e=>t.st(e)),re=(t,e)=>tt(G(e),([e])=>e===t)?.at(1),ae=(r,a,i,h,d,f,E)=>(((t,n,o,r,a=0)=>{const i=xt(t),c=""+o;Vt(i,t=>{Yt((a?qt:r)+l+n,t,c,0);const o=Yt(s,t),i=Yt(e,t);if(!o&&!i)return;if(o&&o!==n||i&&i!==n)return;const h=n+l;Yt(h+"value",t,c);const d=Yt(h+"op",t),m=Yt(Pt,t),f=J(z(m,"|"),t=>z(t,u)),E=!!d,$=Yt(h+Ut,t),g=Bt(d,$,c);if(E&&!g){if(!W(f,([e])=>!!jt(t)[e]))return;return x(f,(t=>([e])=>jt(t).removeProperty(e))(t))}x(f,(t=>([e,n])=>Ht(jt(t),e,n))(t))})})(r,h,d,a,f),x(i,([i,...c])=>((r,a,i,c,l,u,h)=>{const d=()=>u,m=()=>H(u,l),f={[s]:d,[e]:d,[o]:m,[n]:m}[a](),E=r.Gt(t.S,c);x(i,([t,e,n])=>{(h?n:!n||E)&&l===e&&r.ut(t,f,c)})})(r,a,((t=j(),r=j(),a=j(),i=j())=>({[s]:t,[e]:r,[o]:a,[n]:i}))?.(...c)[a],i,h,d,f)),E?((n,r,a,i,l)=>{const u={[s]:n.Qt(a),[e]:n.Yt(a),[o]:a}[r],h={[s]:re(a,n.Y),[e]:re(a,n.Z)}[r],d=l?m:`[${c}${r}="${u}"]:not([${t.S}])`,f=l?[[t.S],[`${c}${r}`,u]]:[],E=G([...n.Dt(d,f),...n.Dt(d,f,l?at:void 0)]);x(E,e=>{e&&("html"===h?n.X(i,e):n.et(i,e),n.yt(n.xt(d,[...f,[t.O,n.jt(t.D,e)],[t.u]]),i))})})(r,a,h,d,f):(f||a!==s||r.k.set(h,d),((r,a,i,c,l)=>{const u=()=>i,h=()=>c,d=()=>H(c,i),f={[s]:()=>r.Qt(i),[e]:()=>r.Yt(i),[o]:u,[n]:u},E=f[a]?.(),$={[s]:h,[e]:h,[o]:d,[n]:d},g=$[a]?.(),T={[s]:re(i,r.Y),[e]:re(i,r.Z)}[a];Y(r.kt(t.D,[[t.O,E],l&&[t.S]]),e=>{if(!e)return;if(!l&&r.Gt(t.S,e))return;const n=r.it(m),o=r.Qt(r.Rt()),s=B();nt(s,e,t.O),nt(s,n,t.D),x([e,n],e=>{r.dt(a,E,e),r.lt([[et(s,e),o],l&&[t.S]],e)}),"html"===T?r.X(g,n):r.et(g,n),r.ot(n),r.Et(e,[n]),r.yt(e,g)})})(r,a,h,d,f))),ie=(e,n)=>{const o=`${n}${u}${t.S}`,s=e.Gt(o)?o:n;e.ut("_"+s,e.jt(s))},ce=(t,e,n,o,s)=>t&&ot(e,[n,o,s]),le=e=>Q(G(e.kt("*")),(n,o)=>{const s=j(),r=j(),i=j(),c=j(),[l,h,d,m]=Q(e.qt(o),(n,l)=>{const h=D(_t(l),"_");if(e.Gt(_t(l),o)&&!h)return n;const[d,m]=L(_t(l),u),f=m===t.S,E=bt(l),$=I(d),g=I(E),T=D(E,"#");ce(T,s,$,g,f);const S=D(E,"@");ce(S,r,$,g,0);const y=D(E,a);ce(y,i,$,E,0);const v=D(E,"!");return ce(v,c,$,E,0),(y||v)&&e.ht(l.name,o),[s,r,i,c]},[]);return[...n,[o,l,h,d,m]]},[]),ue=(t,e)=>((t,e)=>{const n=new MutationObserver(e?.Ee);return[()=>n.observe(t,e),()=>n.disconnect()]})(t,{attributes:1,attributeOldValue:1,Ee:n=>{for(const o of n){if("attributes"!==o.type)return;const n=o.attributeName,s=t.jt(n,o.target),r=o.oldValue;r!==s&&e?.(n,s,r)}}}),he=(t,e,n)=>{return n?J((o=([t])=>t===e,t.filter(o)),([,t])=>t):tt(t,([t])=>t===e)?.at(1);var o},de=t=>st(J(G(t.Z),([t,,e])=>[t,e])),me=B(),fe=te({name:"import-element",async se(e){const{from:n,automount:o,as:s,...r}=e.Bt(),[,a]=et(me,n)??[];if(!a)try{const t=await fetch(n),e=await t.text();nt(me,n,e)}catch{q(`Failed to fetch "${n}"`)}const i=e.Ct(f,[],(c=et(me,n),(new DOMParser).parseFromString(c,"text/html")));var c;if(!i)return e.st();const l=e.jt(t.O,i);let u=s??l;if(!!customElements.get(u)&&(u=u+h+e.Rt()),e.ut(t.O,u,i),void 0!==o){const t=e.it(u);e.lt(rt(r),t),e.ot(i,at.body),e.rt(t,e)}else e.ot(i,at.body),e.st()}}),Ee=B(),$e=B(),ge=(t,e,n,o)=>{const s=t.it(e);t.lt(n,s),t.ot(s,o)},Te=te({name:g,ee(e){if(!(e.Ot()instanceof ShadowRoot))return;const{from:n,local:o,...s}=e.Bt();et(Ee,n)||void 0!==o||(ge(e,S,[[t.U,n],...rt(s)],it),nt(Ee,n,1)),e.st()}}),Se=te({name:T,ee(e){if(!(e.Ot()instanceof ShadowRoot))return;const{from:n,local:o,...s}=e.Bt(),r=et($e,n),a=void 0!==o,i=[e,"link",[[t.v,n],[t.N,"stylesheet"],...rt(s)]];r||(ge(...i,it),nt($e,n,1)),a&&ge(...i,e.It().tt()),e.st()}}),ye=t=>Q(["eq","neq","gt","gte","lt","lte",d],(e,n)=>t.Gt(n)?[n,t.jt(n)]:e,[]),ve=(e,n,o,s,r)=>{const a=e.Gt(t.G),i=((t,e)=>{const[n,o]=ye(t);return Bt(n,o,""+e)})(e,n||a&&""===n);e.zt(Dt,e.Kt(o),i?s:r)},Re=(e,[n,o])=>{const s="var-"+Tt();return te({name:e,se(e){const[n]=ye(e);ie(e,t.G),ie(e,n);const r=e.it(m),a=[[Dt,[[Yt(s),o],["display",e.Wt(s)]]]];e.nt(),e.ot(r,e.tt()),e.Xt(e.Zt(),a),e.Et(r,e.Pt())},te(e){ve(e,e.jt(t.G),s,o,n)},oe(e,r,a){r===t.G&&ve(e,a,s,o,n)}})},pe="contents",_e="none",be=Re("is-visible",[_e,pe]),Ae=Re("is-hidden",[pe,_e]),we={$e:"trigger-event",ge:"listen-event"},Oe="on",Me={[e]:"attrchanged",[s]:"statechanged"},Ie={Te:"set-state",Se:"set-attr",ye:"set-timer",ve:"send-event",Re:"trigger-element",pe:"script",_e:"http-request",be:"request-header",Ae:"request-body",we:"response-ok",Oe:"response-fail"},Le={Me:"=",Ie:"+",Le:"-",Ne:"*",Ce:"/",De:"add",Ue:"assign",Pe:"push",qe:"pop",Be:"remove"},Ne=B(),Ce=B(),De=t=>et(Ne,t);window.__REALM_ADD_CUSTOM_FLOW=(t,e,n)=>nt(De(t),e,n);var Ue=t=>et(Ce,t)??B(),Pe=(e,n)=>()=>(o,s)=>((e,n,o,s)=>{const r=n.At(s),a=n.qt(s),i=n.vt(s),c=Q(a,qe,[]);if(r===Ie.Te&&Z(c,[t.G,i]),r===S){const{type:o,use:s=""}=st(c);if("module/realm"===o){const o=`${r}-${n.bt()}-${n.Rt()}`,a=z("*"===s?"localState,globalState,event,attrs, attr,$":s,",").map(t=>t.trim());Z(c,[t.C,o]),((e,n,o,s,r)=>{const a=((t,e,n,o)=>{const s=`__REALM_ADD_CUSTOM_FLOW('${t}', '${e}', async (${o.length?`{ ${X(o,", ")} }`:""})=>{\n${n}\n})`;return URL.createObjectURL((t=>new Blob([t],{type:"application/javascript"}))(s))})(e,n,o,s),i=dt(S);i.onload=()=>{URL.revokeObjectURL(a),ht(it)(i)},ft(i)([[t.U,a],[t.j,"module"],[t.o],[t.C,n]]),ut(it)(i)})(e,o,i,a)}}if([Ie.ye,Ie._e,Ie.we,Ie.Oe].includes(r)){const o=Pe(e,n);Z(c,[t.t,Q(n.Ut(s),o(),[])])}return[Ie.ve,Ie.Ae].includes(r)&&Z(c,[t.t,n.vt(s)]),[...o,[r,c]]})(e,n,o,s),qe=(t,e)=>[...t,[_t(e),bt(e)]],Be=({name:t,de:e,me:n,je:o,Ge:s})=>{const r=e=>async(n,o)=>{const s=((t,e)=>et(Ue(t),e))(t,n.At());s&&e?.(s,n,o)};return[async(o,s)=>{const r=G(s.Vt(t)),a=Pe(o,s),i=j(Q(r,(t,e)=>[...t,[Q(s.qt(e),(t,e)=>qe(t,e),[]),Q(s.Ut(e),a(),[])]],[]));nt(Ne,o,B()),e?.(o),((t,e,n)=>{const o=Ue(t)??B();nt(o,e,n),nt(Ce,t,o)})(t,o,i),n?.(o,i)},r(o),r(s)]},je=ct.globalState=new O,Ge=j(),He=t=>tt(G(Ge),([e])=>e===t),Fe=t=>{const e=He(t)?.at(3);return e?.storage??"memory"},Ve=()=>je,xe=(t,e)=>je.set(t,e,Fe(t)),ke=te({name:"global-state",se(e){const[n,o,s]=J([t.O,t.j,t.P],t=>e.jt(t)),r=ee(o,e.vt());ot(Ge,[n,o,r,{storage:s}]),xe(n,(t=>je.get(t,Fe(t)))(n)??r)},ee(t){t.st()}}),Ye=B(),Qe=B(),Ze=B(),Je=(t,e,n)=>n.size&&nt(t,e,n),Xe=(t,e)=>Je(Qe,t,e),ze=(t,e)=>Je(Ze,t,e),{Me:Ke,Be:We,qe:tn,Pe:en,Ue:nn,De:on}=Le,{A:sn,R:rn,G:an,T:cn,B:ln}=t,{ce:un,ue:hn,ie:dn}=Wt,mn=(t,e,n,o)=>{const s=""+e,r={event:()=>H(o,s),globalState:()=>H(Ve(),s),localState:()=>H(t.k,s),"event:attr":()=>{const e=o.target,n=t.Bt(e);return H(n,s)},attr:()=>H({...de(t),...t.Bt(t)},s)};return r?.[n]?.()},fn=(t,e,n,o,s)=>{const r=()=>mn(t,n,o,s),a={event:()=>ee(e,r()),"event:attr":r,attr:r,globalState:()=>ee(e,r()),localState:()=>ee(e,r())};return a?.[o]?.()??ee(e,n)},En=(t,e,n,o=0)=>{const s=he(t,e,o),r=void 0!==s;return[r?s:n,r]},$n=(t,e,n,o)=>{const[s]=En(e,sn,Ke),[r,i]=En(e,rn),[c,l]=En(e,an),u=n===un,h=n===dn;if(!(!u&&l||n===hn||u&&(s===tn||(s===We||s===on||s===nn)&&i||(s===en||s===Ke)&&l)))return;const[d]=En(e,cn),m=i?fn(t,n,r,d,o):"-1";let f=fn(t,n,c,d,o);const[,E]=En(e,ln);E&&h&&(f=!f);const $=(([t,e,n,o,s])=>{const r=["number","array"].includes(e);return e=>{if(!r)return n;const i={[Le.Me]:()=>V(n)?n:+n,[Le.Ie]:()=>+e+ +n,[Le.Le]:()=>+e-+n,[Le.Ne]:()=>+e*+n,[Le.Ce]:()=>+e/+n,[Le.Ue]:()=>{const t=[...e],s=t[+o];return void 0!==s&&(t[+o]="object"==typeof s?{...s,...n?.[0]}:n),t},[Le.Pe]:()=>Q(n,(t,e)=>{const n=(o=t=>t===e,t.findIndex(o));var o;if(s&&n>-1)return K(t,n,1),t;const r=`${a}${a}${Tt()}`;return[...t,"object"==typeof e?{[r]:Symbol(r),...e}:e]},[...e]),[Le.qe]:()=>{const t=[...e];return(t=>{t.pop()})(t),t},[Le.Be]:()=>{const t=[...e];return K(t,+o,1),t}};return i?.[t]?.()}})([s,n,f,+m,E]);return $},gn=(t,e)=>Q(G(e),(e,[n,o])=>n===t?o:e),Tn=(t,e,n)=>(o,s,r)=>x(n,([n,a])=>{const[i=[],c]=et(Ye,n),l=W(i,t=>{const[,e]=En(a,t);return e});if(!i.length||l)return c?.(t,e,a,r,o,s)}),Sn=({name:t,He:e,Fe:n})=>()=>nt(Ye,t,[e,n]),yn={GET:"GET",POST:"POST",PUT:"PUT",DELETE:"DELETE",PATCH:"PATCH"},vn={JSON:"json",ue:"html",TEXT:"text"},Rn=Sn({name:Ie._e,async Fe(e,n,o,s,r,a){const[i,c]=En(o,t.F);if(!c)throw q(`Missing "${t.F}" attribute on <${Ie._e} />`);const[l]=En(o,t.t),[u=[],h]=En(l,Ie.we),[d,m]=En(u,t.t),[f=[],E]=En(l,Ie.Oe),[$,g]=En(f,t.t);if(!h&&!E)return;const[T=yn.GET]=En(o,t.H),[S=vn.TEXT]=En(o,t.AS),[y=[]]=En(l,Ie.be,[],1),v=new Headers;x(y,e=>{const n=st(e);v.set(n[t.O],n[t.G])});const[R,p]=En(l,Ie.Ae);let _;if(p){const[n,o]=En(R,t.t);p&&o&&(_=n);const[r,a]=En(R,t.G),[i,c]=En(R,t.T);a&&c&&(_=mn(e,r,i,s))}const b=(t,o)=>Tn(e,n,t)(a,r,o);try{const t=await fetch(i,{body:_,method:T,headers:v});if(!t.ok)throw q(`[${t.status}] ${i}`);if(!m)return;const e=()=>t.text(),n={[vn.JSON]:()=>t.json(),[vn.ue]:e,[vn.TEXT]:e};b(d,await(n?.[S]?.()))}catch(t){if(!g)return;b($,{message:"[ERROR] "+t?.message})}}}),pn=Sn({name:Ie.pe,He:[t.C],Fe(e,n,o,s){const[a]=En(o,t.C),i=s?.target?.[t.G],c=()=>zt(()=>{const o=((t,e)=>et(De(t),e))(n,a);if(!o)return c();void 0!==i&&s?.target&&(s.target[t.G]=i),o?.apply(e,((e,n)=>{event=void 0;const o={...de(e),...e.Bt()},s=e=>[r,[[t.L,e]]];return[{$:e,attr:{get:t=>e.jt(t)??o?.[t],set:e.ut},refs:t=>e.kt.apply(null,s(t)),ref:t=>e.xt.apply(null,s(t)),attrs:e.Bt(),localState:e.k,globalState:Ve(),event:n}]})(e,s))});c()}}),_n=Sn({name:Ie.ve,He:[t.O],Fe(e,n,o,s){const[a]=En(o,t.O),[i,c]=En(o,t.q),[l,h]=En(o,t.q+u+"parent"),[d,m]=En(o,t.j),[f,E]=En(o,t.G),[$,g]=En(o,t.T),[T]=En(o,t.t),S={html:()=>T,json:()=>p(T)},y=[r,t.L,i],v=Oe+u+a;let R=s;m&&(R=E&&g?fn(e,d,f,$,s)||f:S[d]?.()??f);let _=[e];if(c&&(_=G(e.kt.apply(null,y))),h){const t=e.It();_=[t],l!==r&&(_=G(t.kt.apply(null,y)))}x(_,t=>t.St(v,R))}}),bn=Sn({name:Ie.Te,He:[t.O],Fe(e,n,o,s){const[r]=En(o,t.O),[,a]=En(o,t.S),i=a?(c=r,He(c)?.at(1)):gn(r,e.Y);var c;const l=a?xe:(t,n)=>e.k.set(t,n);l(r,$n(e,o,i,s))}}),An=Sn({name:Ie.Se,He:[t.O],Fe(e,n,o,s){const[r]=En(o,t.O),a=gn(r,e.Z),i=$n(e,o,a,s)(ee(a,e.jt(r)));e.ut(r,""+i)}}),wn=Sn({name:Ie.ye,He:[t.I,t.g],Fe(e,n,o,s,r,a){const[i,c]=En(o,t.t);if(!c)return;const[l,u]=En(o,t.I),[h,d]=En(o,t.g),m=()=>Tn(e,n,i)(a,r,s);u?Xt(m,+l):d&&setInterval(m,+h)}}),On=Sn({name:Ie.Re,Fe(e,n,o,s){x(o,([n,o])=>Y(e.kt(r,[[t.L,o]]),t=>t?.[n]?.(s)))}}),Mn=t=>(e,n,o,s)=>{const r=!!o,a=t?e.gt:e.Tt,i=n===Oe;a(i?Oe+u+o:n,t=>{!i&&r&&o!==t[0]||zt(()=>e.St(we.ge,[n,o,s,t]))})},In=(t,e,n)=>x(t,([t,o])=>x(t,([t,s])=>n(e,t,s,o))),Ln=Be({name:we.ge,async je(t,e,n){In(t,n??e,Mn())},async Ge(t,e,n){In(t,n??e,Mn(1))}}),Nn=(e,n)=>(o,s,a,i)=>c=>{(n?o.gt:o.$t)(a,((e,n,o,s,a)=>i=>{const[,c]=n||[];if(c?.(),!(o>0))return e.St(we.$e,[r,s,a,i]);{const c=i?.target?.[t.G];n=Xt(()=>{void 0!==c&&i?.target&&(i.target[t.G]=c),e.St(we.$e,[r,s,a,i])},o)}})(e,void 0,s,a,i),c)},Cn=(e,n,o)=>x(e,([e,s])=>{const a=+he(e,t.l);x(e,([e,i])=>{e!==t.l&&Y(n.kt(r,t.L,i),o(n,a,e,s))})}),Dn=[Ln,Be({name:we.$e,async je(t,e,n){Cn(t,n??e,Nn(e))},async Ge(t,e,n){Cn(t,n??e,Nn(e,1))}})],Un=[Rn,pn,_n,An,bn,wn,On],Pn=te({name:$,async se(e){const n=e.wt();if(!n)return;const o=e.jt(t.O,n);for(const t of Un)await t();for(const[t]of Dn)await t(o,e)},async ee(t){if(!(t.Ot()instanceof ShadowRoot))return;const e=t.It();for(const[,t]of Dn)await t(e);t.st()}}),qn=te({name:"repeat-list",se(r){const a=r.ct();x(r.Pt(),t=>{r.ot(r.Lt(t),a),r.st(t)}),r.nt(),r.J();const i=r.It();if(!i)return;const c=r.jt(t.M),l=I(c);if(!l)return;const u=i?.k,h=i.Y,d=i.Z;x(G([[i,e],[u,s],[Ve(),s,1]]),([t,c,m])=>{t.subscribe(async(t,f)=>{if(!V(f)||t!==l)return ae(r,c,le(r),t,f,m,1);await(async()=>{for(const[,,t]of Dn)await t(i,r)})(),(t=>{const c=r.tt();r.J(),r.J(c),x(t,(e,s)=>{r.ot(r.Lt(a),c);const i=le(r);x(F(e),t=>ae(r,o,i,t,e,0));const l={index:s,length:t.length};x(F(l,"!"),t=>ae(r,n,i,t,l,0))});const l=le(r);x(G([[h,s],[d,e]]),([t,n])=>x(t,([t])=>{ae(r,n,l,t,{[e]:()=>i.jt(t),[s]:()=>u.get(t)}[n](),0)}))})(f),await(async()=>{for(const[,t]of Dn)await t(i,r)})()})})}}),Bn=te({name:"web-app",ee(e){e.ut(t.p,1)}}),jn=B(),Gn=B(),Hn=B(),Fn=B(),Vn=B(),xn=te({name:f,se(e){const n=[[E,Xe],["element-state",ze]],o=e.jt(t.O);for(const[t,s]of n){const n=oe(e,t);n&&s(o,n),se(e,t)}},te(r){var a;(a=r.jt(t.O),te({name:a,de(){const e=Ot(at)(f,t.O,a),n=Ot(e)("template");nt(jn,a,n),n&&Y(Mt(n.content)("style"),t=>nt(Gn,a,t)),x([[$,Hn],[g,Fn],[T,Vn]],([t,n])=>{nt(n,a,j(G(Mt(e)(t))))})},se(r){r.nt(),r.Jt(et(Gn,a)),r.K(et(jn,a)),x([Hn,Fn,Vn],t=>x(et(t,a),r.W));const i=r.xt(m,[[t.i]]),c=Q(r.Pt(),(e,n)=>{const o=r.jt(t.D,n);return o?(r.Et(r.xt(m,[[t.O,o]]),[n]),e):[...e,n]},[]);r.Et(i,c);const l=le(r),u=(t=>et(Qe,t)??j())(a),h=(t=>et(Ze,t)??j())(a);x(G([[G(u),e],[G(h),s],[Ge,s,1]]),([t,a,i])=>x(t,([t,c,u])=>{const h=()=>ee(c,u),d=()=>H(u,t),m={[e]:()=>r.jt(t)??h(),[s]:h,[o]:d,[n]:d};a===e&&ot(r.Z,[t,c,u]),i||a!==s||ot(r.Y,[t,c,u]),ae(r,a,l,t,m[a](),i)})),x(G([[r,e],[r.k,s,0],[Ve(),s,1]]),([t,e,n])=>t.subscribe((t,o,a)=>{const i=[t,o,a];e===s&&Z(i,n),r.St(Me[e],i),ae(r,e,l,t,o,n,1)}));const d=(t=>((t,e)=>n=>Tn(t,e,n))(t,t._t()))(r);x(rt(we),([,t])=>r.Tt(t,([t,e,n,o])=>d(n)(t,e,o)))},ee(t){t.St("mounted")},ne(t){t.St("unmounted")}})).call(this)},ee(t){t.st()}}),kn=[fe,Te,Se,qn,be,Ae,Pn],Yn=[ke,xn,Bn];(async()=>{for(const t of kn)await t();for(const t of Yn)t()})()}();//# sourceMappingURL=realm.production.min.js.map
11
+ var t={t:"action",AS:"as",o:"async",i:"children",l:"debounce",u:"debug",h:"defer",m:"element",g:"every",T:"from",S:"global",v:"href",R:"index",p:"loaded",_:"mount",A:"mutate",O:"name",M:"of",I:"once",L:"ref",N:"rel",C:"script-id",D:"slot",U:"src",P:"storage",q:"to",B:"toggle",j:"type",G:"value",H:"method",F:"url"},e="attr",n="meta",o="src",s="state",r="",a="$",i="RLM:",c="data-",l="-",u=":",h=".",d="contains",m="slot",f="custom-element",E="element-attr",$="element-flow",g="import-script",T="import-style",S="script",y=JSON.stringify,v=JSON.parse,b=(t="")=>"object"==typeof t?y(t):""+t,R=t=>v(b(t)),p=/([A-Z])+/g,_=/(?=[A-Z])|[.\-\s_]/,A=/^((?!chrome|android).)*safari/i.test(navigator.userAgent)?/:host\(\[([#@][a-zA-Z0-9-_.]+?)\](\[(global)\])?(\[(eq|neq|gt|gte|lt|lte|contains)=\"(\w+?)\"\])?\)/g:/:host\(\[\\([#@][a-zA-Z0-9-_.]+?)\](\[(global)\])?(\[(eq|neq|gt|gte|lt|lte|contains)="(\w+?)"\])?\)/g,w=/[$|#|@|!]([.]?(?:\w+[.-])*\w+)/gm,O=class{#t;#e;constructor(){this.#t=B(),this.#e=j()}set(t,e,n){const o=et(this.#t,t),s="function"==typeof e?e(o):e;"memory"!==n&&window?.[n]?.setItem(t,b(s)),nt(this.#t,t,s),x(this.#e,e=>e.call(this,t,s,o))}get(t,e){if("memory"!==e){const n=window?.[e]?.getItem(t);if(void 0!==n)return v(y(n))}return et(this.#t,t)}async subscribe(t){this.#n(t),ot(this.#e,t)}#n(t){k(this.#t,(e,n)=>t.call(this,n,e))}},M=t=>t.trim(),I=(t,e=1,n)=>null==t?r:t.slice(e,n),L=(t,e)=>t.split(e),N=t=>t?.toLowerCase?.(),C=(t,e,n)=>t.replace(e,n),D=(t,e)=>t.startsWith(e),U=(t,e)=>t.includes(e),P=t=>{if(!t)return r;const[e,...n]=L(N(t),r);return(t=>t.toUpperCase())(e)+X(n,r)},q=t=>Error(t),B=(t=[])=>new Map(t),j=t=>new Set(t),G=t=>Array.from(t),H=(t,e,n)=>{if(!e)return t;if(!w.test(e))return e;if(n&&!D(e,n))return e;const o=t instanceof O;return e.replace(w,(e,n)=>{const s=z(I(n),h),r=Q(s,(t=>(e,n,o)=>t&&0===o?e.get(n):e[n])(o),t);return"object"==typeof r?y(r):r})},F=(t,e=a)=>{const n=rt(t);return Q(n,(t,[n,o])=>"object"==typeof o?Q(F(o),(t,o)=>[...t,`${e}${h}${n}${h}${o}`],t):[...t,`${e}${h}${n}`],[])},V=t=>Array.isArray(t),x=(t,e)=>{Q(G(t),(t,n,o)=>(e?.(n,o),t))},k=(t,e)=>t.forEach(e),Y=(t,e)=>t.forEach(e),Q=(t,e,n)=>t.reduce(e,n),Z=(t,e)=>t.push(e),J=(t,e)=>t.map(e),X=(t,e)=>t.join(e),z=(t,e)=>t.split(e),K=(t,e,n,...o)=>t.splice(e,n,...o),W=(t,e)=>t.some(e),tt=(t,e)=>t.find(e),et=(t,e)=>t.get(e),nt=(t,e,n)=>t.set(e,n),ot=(t,e)=>t.add(e),st=t=>Object.fromEntries(t),rt=t=>Object.entries(t),at=document,it=at.head,ct=window,lt=(t,e)=>t.innerHTML=e,ut=t=>(e,n)=>(n??t).append(e),ht=t=>e=>(e??t).remove(),dt=t=>at.createElement(t),mt=()=>at.createDocumentFragment(),ft=t=>(e,n)=>{const o=n??t,s=o.setAttribute.bind(o),a=o.removeAttribute.bind(o),i=(t,e)=>t in o&&(o[t]=e);x(e.filter(t=>t),([t,e])=>{if("boolean"!=typeof e){const n=b(e);return s(t,n),void i(t,n)}e?s(t,r):a(t),i(t,e)})},Et=t=>(e,n,o)=>ft(t)([[e,n]],o),$t=(t,e)=>t&&!!e&&t.assign(...e),gt=t=>(e,n,o)=>(o??t).addEventListener(e,n),Tt=()=>parseInt(C(Math.random().toString(),h,r)).toString(16),St=t=>t?.innerHTML,yt=t=>e=>(e??t).cloneNode(1),vt=(t,e)=>V(e)?Q(e.filter(t=>V(t)),(t,[e,n])=>(e&&(t+=`[${e}${n?`="${n}"`:r}]`),t),t):t,bt=t=>(e,n,o)=>(o??t)?.querySelector(vt(e,n)),Rt=t=>(e,n,o)=>(o??t)?.querySelectorAll(vt(e,n)),pt=t=>t.name,_t=t=>t.value,At=t=>e=>G((e||t)?.attributes??[]),wt=t=>(e,n)=>(n||t)?.getAttribute?.(e),Ot=t=>(e,n,o)=>bt(t)(e,V(n)?n:[[n,o]]),Mt=t=>(e,n,o)=>Rt(t)(e,V(n)?n:[[n,o]]),It=t=>"@"+t,Lt=t=>"#"+t,Nt=t=>()=>t.V,Ct=t=>()=>t.getRootNode(),Dt=":host",Ut="comp",Pt="style",qt="global",Bt=(t,e,n)=>{const o="eq"===t?e:null,s="neq"===t?e:null,r="gt"===t?e:null,a="gte"===t?e:null,i="lt"===t?e:null,c="lte"===t?e:null,l=t===d?e:null;return["true","false"].includes(n)||isNaN(+n)?!!o&&n===o||!!s&&n!==s||!!l&&U(n,l):!!o&&+n==+o||!!s&&+n!=+s||!!r&&+n>+r||!!a&&+n>=+a||!!i&&+n<+i||!!c&&+n<=+c},jt=t=>t?.style,Gt=(t,e)=>{if(!e)return t?.selectorText;t.selectorText=e},Ht=(t,e,n)=>t.setProperty(e,n),Ft=(t,e)=>t.getPropertyValue(e),Vt=(t,e)=>x(t,t=>x(Object.values(t.cssRules),e)),xt=t=>Nt(t)().adoptedStyleSheets,kt=t=>()=>{const e=new CSSStyleSheet;return Z(xt(t),e),e},Yt=(t,e,n,o=1)=>{const s=`${l}${l}${CSS.escape((t=>{const e=J((t=>L(t?.replace(p,P),_))(t),N)??[],n=e.length;return 0===n?r:1===n?e.at(0):X(e,l)})(t))}`,a=jt(e);if(!a)return s;const i=()=>Ft(a,s);if(void 0===n)return i();o||i(),Ht(a,s,""+n)},Qt=t=>`var(${l}${l}${t})`,Zt=(t,e)=>t.insertRule(Q(e,(t,[e,n])=>t+(e+"{")+X(Q(n,(t,[e,n])=>[...t,X([e,n],u)],[]),";")+"}",r)),Jt=class extends HTMLElement{name;id;#o;V;k;Y;Z;J=(t=>e=>lt(e??t,r))(this);X=(t,e)=>{e?lt(e,""+t):(()=>{this.#o=""+t})()};K=(t=>e=>{if(!e)return;const n=yt(t),o=e instanceof HTMLTemplateElement?n(e).content:e;ut(t)(o,Nt(t)())})(this);W=t=>t&&ut(this)(yt(this)(t),this.tt());et=(t=>(e,n)=>(n??t).textContent="object"==typeof e?y(e):""+e)(this);nt=(t=>()=>{const e=t;return e.V=t.attachShadow({mode:"closed",slotAssignment:"manual"}),Nt(e)()})(this);ot=ut(this);st=ht(this);rt=(t=>(e,n)=>(n??t).replaceWith(e))(this);it=dt;ct=mt;lt=ft(this);ut=Et(this);ht=(t=>(e,n)=>(n??t).removeAttribute(e))(this);dt=(t=>(e,n,o)=>Et(t)(`${c}${e}`,n,o))(this);ft=(t=>(e,n)=>ft(t)(e,n))(this);Et=$t;$t=gt(this);gt=(t=>(e,n,o)=>(o??t).removeEventListener(e,n))(this);Tt=(t=>(e,n,o)=>gt(t)(i+e,e=>n.call(o??t,e.detail)))(this);St=(t=>(e,n,o)=>(o??t).dispatchEvent(new CustomEvent(i+e,{detail:n})))(this);yt=(e=>(n,o,s)=>{const r=wt(s??e)(t.u,n);r&&((t,e="log")=>{console[e](...t)})([r,o])})(this);vt=t=>St(t??this);bt=Tt;Rt=(t=>()=>t.name)(this);_t=(t=>e=>(e??t).id)(this);At=(t=>e=>N((e??t)?.tagName))(this);wt=(t=>e=>(e??t).parentElement)(this);Ot=(t=>e=>(e??t).parentNode)(this);tt=Nt(this);Mt=Ct(this);It=t=>{return(e=t??this,()=>Ct(e)().host)();var e};Lt=yt(this);Nt=vt;Ct=bt(this);Dt=Rt(this);Ut=(t=>e=>G((e??t).children))(this);Pt=(t=>e=>G((e??t).childNodes))(this);qt=At(this);Bt=(t=>e=>Q(At(t)(e),(t,e)=>(t[pt(e)]=_t(e),t),{}))(this);jt=wt(this);Gt=(t=>(e,n)=>(n||t).hasAttribute(e))(this);Ht=(t=>(e,n)=>wt(t)(`${c}${e}`,n))(this);Ft=Ot(this);Vt=Mt(this);xt=(t=>(e,n,o)=>bt(t)(e,V(n)?n:[[n,o]],Nt(t)()))(this);kt=(t=>(e,n,o)=>Rt(t)(e,V(n)?n:[[n,o]],Nt(t)()))(this);Yt=It;Qt=Lt;Zt=kt(this);Jt=(t=>n=>{if(!n)return;const o=St(n),r=kt(t)();Z(xt(t),r),r.replaceSync(o),Vt([r],t=>{const n=Gt(t),o=G(n?.matchAll(A)??[]);if(!o.length)return;const r=jt(t),a=Q(z(r.cssText,";"),(t,e)=>e?[...t,J(z(e,u),M)]:t,[]);Gt(t,C(n,A,Dt)),Yt(Pt,t,X(J(a,t=>X(t,u)),"|"));for(const n of o){const[,o,r,a,...i]=n,c=D(o,"#")?s:e,u=I(o);Yt(c,t,u);const h=u+l;a===qt&&Yt(h+qt,t,1);const[d,m,f]=i??[];if(!d)return;Yt(h+"op",t,m),Yt(h+Ut,t,f)}}),ht(n)()})(this);Xt=Zt;zt=(t=>(e,n,o)=>Vt(xt(t),t=>{if(Gt(t)!==e)return;const s=t.style;Ft(s,n)!==o&&Ht(s,n,o)}))(this);Kt=Yt;Wt=Qt},Xt=(t,e)=>{let n=setTimeout(t,e);return[n,()=>clearTimeout(n)]},zt=t=>{let e=requestAnimationFrame(t);return[e,()=>cancelAnimationFrame(e)]},Kt=class extends Jt{te;ee;ne;oe;k=new O;Y=j();Z=j();#s=[];constructor({name:t,te:e,se:n,ee:o,ne:s,oe:r}){super(),this.name=t,this.id=this.bt(),this.ee=o,this.ne=s,this.oe=r,n?.(this),this.X(this.vt()),e?.(this),zt(()=>this.ee?.(this))}subscribe(t){Z(this.#s,t)}async connectedCallback(){const[t]=ue(this,(t,e,n)=>{x(this.#s,o=>o?.(t,e,n)),this.oe?.(this,t,e,n)});t()}disconnectedCallback(){this.ne?.(this)}},Wt=(t=>(t.re="string",t.ae="number",t.ie="boolean",t.ce="array",t.le="object",t.ue="html",t.he="json",t))(Wt||{}),te=({name:t,extends:e,de:n,me:o,fe:s,...r})=>()=>new Promise(a=>{const i=U(t,l),c=customElements.get(t);if(!i||c)throw q(`Element \`${t}\` has invalid name or already defined`);customElements.whenDefined(t).then(async()=>{o?.(t),a(1)}),n?.(t),customElements.define(t,class extends Kt{constructor(){super({name:t,...r})}async connectedCallback(){super.connectedCallback(),s?.(this)}},{extends:e})}),ee=(t,e)=>{const n=t=>"string"!=typeof e?e:R(e||t),o={number:()=>+e,boolean:()=>n(e),array:()=>n("[]"),object:()=>n("{}")};return o?.[t]?.()??e},ne=(t,e=E)=>G(t.Vt(e)),oe=(e,n)=>j(Q(ne(e,n),(n,o)=>{const s=e.jt(t.O,o),r=e.jt(t.j,o);return[...n,[s,r,ee(r,e.vt(o))]]},[])),se=(t,e)=>x(ne(t,e),e=>t.st(e)),re=(t,e)=>tt(G(e),([e])=>e===t)?.at(1),ae=(r,a,i,h,d,f,E,$)=>(((t,n,o,r,a,i=0)=>{if(!["string","boolean","number"].includes(r))return;const c=xt(t),h=""+o;Vt(c,t=>{Yt((i?qt:a)+l+n,t,h,0);const o=Yt(s,t),r=Yt(e,t);if(!o&&!r)return;if(o&&o!==n||r&&r!==n)return;const c=n+l;Yt(c+"value",t,h);const d=Yt(c+"op",t),m=Yt(Pt,t),f=J(z(m,"|"),t=>z(t,u)),E=!!d,$=Yt(c+Ut,t),g=Bt(d,$,h);if(E&&!g){if(!W(f,([e])=>!!jt(t)[e]))return;return x(f,(t=>([e])=>jt(t).removeProperty(e))(t))}x(f,(t=>([e,n])=>Ht(jt(t),e,n))(t))})})(r,h,d,f,a,E),x(i,([i,...c])=>((r,a,i,c,l,u,h)=>{const d=()=>u,m=()=>H(u,l),f={[s]:d,[e]:d,[o]:m,[n]:m}[a](),E=r.Gt(t.S,c);x(i,([t,e,n])=>{(h?n:!n||E)&&l===e&&r.ut(t,f,c)})})(r,a,((t=j(),r=j(),a=j(),i=j())=>({[s]:t,[e]:r,[o]:a,[n]:i}))?.(...c)[a],i,h,d,E)),$?((n,r,a,i,l)=>{const u={[s]:n.Qt(a),[e]:n.Yt(a),[o]:a}[r],h={[s]:re(a,n.Y),[e]:re(a,n.Z)}[r],d=l?m:`[${c}${r}="${u}"]:not([${t.S}])`,f=l?[[t.S],[`${c}${r}`,u]]:[],E=G([...n.Dt(d,f),...n.Dt(d,f,l?at:void 0)]);x(E,e=>{e&&("html"===h?n.X(i,e):n.et(i,e),n.yt(n.xt(d,[...f,[t.O,n.jt(t.D,e)],[t.u]]),i))})})(r,a,h,d,E):(E||a!==s||r.k.set(h,d),((r,a,i,c,l)=>{const u=()=>i,h=()=>c,d=()=>H(c,i),f={[s]:()=>r.Qt(i),[e]:()=>r.Yt(i),[o]:u,[n]:u},E=f[a]?.(),$={[s]:h,[e]:h,[o]:d,[n]:d},g=$[a]?.(),T={[s]:re(i,r.Y),[e]:re(i,r.Z)}[a];Y(r.kt(t.D,[[t.O,E],l&&[t.S]]),e=>{if(!e)return;if(!l&&r.Gt(t.S,e))return;const n=r.it(m),o=r.Qt(r.bt()),s=B();nt(s,e,t.O),nt(s,n,t.D),x([e,n],e=>{r.dt(a,E,e),r.lt([[et(s,e),o],l&&[t.S]],e)}),"html"===T?r.X(g,n):r.et(g,n),r.ot(n),r.Et(e,[n]),r.yt(e,g)})})(r,a,h,d,E))),ie=(e,n)=>{const o=`${n}${u}${t.S}`,s=e.Gt(o)?o:n;e.ut("_"+s,e.jt(s))},ce=(t,e,n,o,s)=>t&&ot(e,[n,o,s]),le=e=>Q(G(e.kt("*")),(n,o)=>{const s=j(),r=j(),i=j(),c=j(),[l,h,d,m]=Q(e.qt(o),(n,l)=>{const h=D(pt(l),"_");if(e.Gt(pt(l),o)&&!h)return n;const[d,m]=L(pt(l),u),f=m===t.S,E=_t(l),$=I(d),g=I(E),T=D(E,"#");ce(T,s,$,g,f);const S=D(E,"@");ce(S,r,$,g,0);const y=D(E,a);ce(y,i,$,E,0);const v=D(E,"!");return ce(v,c,$,E,0),(y||v)&&e.ht(l.name,o),[s,r,i,c]},[]);return[...n,[o,l,h,d,m]]},[]),ue=(t,e)=>((t,e)=>{const n=new MutationObserver(e?.Ee);return[()=>n.observe(t,e),()=>n.disconnect()]})(t,{attributes:1,attributeOldValue:1,Ee:n=>{for(const o of n){if("attributes"!==o.type)return;const n=o.attributeName,s=t.jt(n,o.target),r=o.oldValue;r!==s&&e?.(n,s,r)}}}),he=(t,e,n)=>{return n?J((o=([t])=>t===e,t.filter(o)),([,t])=>t):tt(t,([t])=>t===e)?.at(1);var o},de=t=>st(J(G(t.Z),([t,,e])=>[t,e])),me=B(),fe=B(),Ee=te({name:"import-element",async se(e){const{from:n,automount:o,as:s,...r}=e.Bt(),a=!!n,[,i]=et(me,n)??[];if(!i&&a)try{const t=await fetch(n),e=await t.text();nt(me,n,e)}catch{q(`Failed to fetch "${n}"`)}const c=e.Ct(f,[],(l=et(me,n),(new DOMParser).parseFromString(l,"text/html")));var l;if(!c)return e.st();const u=e.jt(t.O,c);let d=s??u;if(!et(fe,d)){if(!!customElements.get(d)&&(d=d+h+e.bt()),e.ut(t.O,d,c),void 0!==o){const t=e.it(d);e.lt(rt(r),t),e.ot(c,at.body),e.rt(t,e)}else e.ot(c,at.body),e.st();nt(fe,d,1)}}}),$e=B(),ge=B(),Te=(t,e,n,o)=>{const s=t.it(e);t.lt(n,s),t.ot(s,o)},Se=te({name:g,ee(e){if(!(e.Ot()instanceof ShadowRoot))return;const{from:n,local:o,...s}=e.Bt();et($e,n)||void 0!==o||(Te(e,S,[[t.U,n],...rt(s)],it),nt($e,n,1)),e.st()}}),ye=te({name:T,ee(e){if(!(e.Ot()instanceof ShadowRoot))return;const{from:n,local:o,...s}=e.Bt(),r=et(ge,n),a=void 0!==o,i=[e,"link",[[t.v,n],[t.N,"stylesheet"],...rt(s)]];r||(Te(...i,it),nt(ge,n,1)),a&&Te(...i,e.It().tt()),e.st()}}),ve=t=>Q(["eq","neq","gt","gte","lt","lte",d],(e,n)=>t.Gt(n)?[n,t.jt(n)]:e,[]),be=(e,n,o,s,r)=>{const a=e.Gt(t.G),i=((t,e)=>{const[n,o]=ve(t);return Bt(n,o,""+e)})(e,n||a&&""===n);e.zt(Dt,e.Kt(o),i?s:r)},Re=(e,[n,o])=>{const s="var-"+Tt();return te({name:e,se(e){const[n]=ve(e);ie(e,t.G),ie(e,n);const r=e.it(m),a=[[Dt,[[Yt(s),o],["display",e.Wt(s)]]]];e.nt(),e.ot(r,e.tt()),e.Xt(e.Zt(),a),e.Et(r,e.Pt())},te(e){be(e,e.jt(t.G),s,o,n)},oe(e,r,a){r===t.G&&be(e,a,s,o,n)}})},pe="contents",_e="none",Ae=Re("is-visible",[_e,pe]),we=Re("is-hidden",[pe,_e]),Oe={$e:"trigger-event",ge:"listen-event"},Me="on",Ie={[e]:"attrchanged",[s]:"statechanged"},Le={Te:"set-state",Se:"set-attr",ye:"set-timer",ve:"send-event",be:"trigger-element",Re:"script",pe:"http-request",_e:"request-header",Ae:"request-body",we:"response-ok",Oe:"response-fail"},Ne={Me:"=",Ie:"+",Le:"-",Ne:"*",Ce:"/",De:"add",Ue:"assign",Pe:"push",qe:"pop",Be:"remove"},Ce=B(),De=B(),Ue=t=>et(Ce,t);window.__REALM_ADD_CUSTOM_FLOW=(t,e,n)=>nt(Ue(t),e,n);var Pe=t=>et(De,t)??B(),qe=(e,n)=>()=>(o,s)=>((e,n,o,s)=>{const r=n.At(s),a=n.qt(s),i=n.vt(s),c=Q(a,Be,[]);if(r===Le.Te&&Z(c,[t.G,i]),r===S){const{type:o,use:s=""}=st(c);if("module/realm"===o){const o=`${r}-${n._t()}-${n.bt()}`,a=z("*"===s?"localState,globalState,event,attrs, attr,$":s,",").map(t=>t.trim());Z(c,[t.C,o]),((e,n,o,s,r)=>{const a=((t,e,n,o)=>{const s=`__REALM_ADD_CUSTOM_FLOW('${t}', '${e}', async (${o.length?`{ ${X(o,", ")} }`:""})=>{\n${n}\n})`;return URL.createObjectURL((t=>new Blob([t],{type:"application/javascript"}))(s))})(e,n,o,s),i=dt(S);i.onload=()=>{URL.revokeObjectURL(a),ht(it)(i)},ft(i)([[t.U,a],[t.j,"module"],[t.o],[t.C,n]]),ut(it)(i)})(e,o,i,a)}}if([Le.ye,Le.pe,Le.we,Le.Oe].includes(r)){const o=qe(e,n);Z(c,[t.t,Q(n.Ut(s),o(),[])])}return[Le.ve,Le.Ae].includes(r)&&Z(c,[t.t,n.vt(s)]),[...o,[r,c]]})(e,n,o,s),Be=(t,e)=>[...t,[pt(e),_t(e)]],je=({name:t,de:e,me:n,je:o,Ge:s})=>{const r=e=>async(n,o)=>{const s=((t,e)=>et(Pe(t),e))(t,n.At());s&&e?.(s,n,o)};return[async(o,s)=>{const r=G(s.Vt(t)),a=qe(o,s),i=j(Q(r,(t,e)=>[...t,[Q(s.qt(e),(t,e)=>Be(t,e),[]),Q(s.Ut(e),a(),[])]],[]));nt(Ce,o,B()),e?.(o),((t,e,n)=>{const o=Pe(t)??B();nt(o,e,n),nt(De,t,o)})(t,o,i),n?.(o,i)},r(o),r(s)]},Ge=ct.globalState=new O,He=j(),Fe=t=>tt(G(He),([e])=>e===t),Ve=t=>Fe(t)?.at(1),xe=t=>{const e=Fe(t)?.at(3);return e?.storage??"memory"},ke=()=>Ge,Ye=(t,e)=>Ge.set(t,e,xe(t)),Qe=te({name:"global-state",se(e){const[n,o,s]=J([t.O,t.j,t.P],t=>e.jt(t)),r=ee(o,e.vt());ot(He,[n,o,r,{storage:s}]),Ye(n,(t=>Ge.get(t,xe(t)))(n)??r)},ee(t){t.st()}}),Ze=B(),Je=B(),Xe=B(),ze=(t,e,n)=>n.size&&nt(t,e,n),Ke=(t,e)=>ze(Je,t,e),We=(t,e)=>ze(Xe,t,e),{Me:tn,Be:en,qe:nn,Pe:on,Ue:sn,De:rn}=Ne,{A:an,R:cn,G:ln,T:un,B:hn}=t,{ce:dn,ue:mn,ie:fn}=Wt,En=(t,e,n,o)=>{const s=""+e,r={event:()=>H(o,s),globalState:()=>H(ke(),s),localState:()=>H(t.k,s),"event:attr":()=>{const e=o.target,n=t.Bt(e);return H(n,s)},attr:()=>H({...de(t),...t.Bt(t)},s)};return r?.[n]?.()},$n=(t,e,n,o,s)=>{const r=()=>En(t,n,o,s),a={event:()=>ee(e,r()),"event:attr":r,attr:r,globalState:()=>ee(e,r()),localState:()=>ee(e,r())};return a?.[o]?.()??ee(e,n)},gn=(t,e,n,o=0)=>{const s=he(t,e,o),r=void 0!==s;return[r?s:n,r]},Tn=(t,e,n,o)=>{const[s]=gn(e,an,tn),[r,i]=gn(e,cn),[c,l]=gn(e,ln),u=n===dn,h=n===fn;if(!(!u&&l||n===mn||u&&(s===nn||(s===en||s===rn||s===sn)&&i||(s===on||s===tn)&&l)))return;const[d]=gn(e,un),m=i?$n(t,n,r,d,o):"-1";let f=$n(t,n,c,d,o);const[,E]=gn(e,hn);E&&h&&(f=!f);const $=(([t,e,n,o,s])=>{const r=["number","array"].includes(e);return e=>{if(!r)return n;const i={[Ne.Me]:()=>V(n)?n:+n,[Ne.Ie]:()=>+e+ +n,[Ne.Le]:()=>+e-+n,[Ne.Ne]:()=>+e*+n,[Ne.Ce]:()=>+e/+n,[Ne.Ue]:()=>{const t=[...e],s=t[+o];return void 0!==s&&(t[+o]="object"==typeof s?{...s,...n?.[0]}:n),t},[Ne.Pe]:()=>Q(n,(t,e)=>{const n=(o=t=>t===e,t.findIndex(o));var o;if(s&&n>-1)return K(t,n,1),t;const r=`${a}${a}${Tt()}`;return[...t,"object"==typeof e?{[r]:Symbol(r),...e}:e]},[...e]),[Ne.qe]:()=>{const t=[...e];return(t=>{t.pop()})(t),t},[Ne.Be]:()=>{const t=[...e];return K(t,+o,1),t}};return i?.[t]?.()}})([s,n,f,+m,E]);return $},Sn=(t,e)=>Q(G(e),(e,[n,o])=>n===t?o:e),yn=(t,e,n)=>(o,s,r)=>x(n,([n,a])=>{const[i=[],c]=et(Ze,n),l=W(i,t=>{const[,e]=gn(a,t);return e});if(!i.length||l)return c?.(t,e,a,r,o,s)}),vn=({name:t,He:e,Fe:n})=>()=>nt(Ze,t,[e,n]),bn={GET:"GET",POST:"POST",PUT:"PUT",DELETE:"DELETE",PATCH:"PATCH"},Rn={JSON:"json",ue:"html",TEXT:"text"},pn=vn({name:Le.pe,async Fe(e,n,o,s,r,a){const[i,c]=gn(o,t.F);if(!c)throw q(`Missing "${t.F}" attribute on <${Le.pe} />`);const[l]=gn(o,t.t),[u=[],h]=gn(l,Le.we),[d,m]=gn(u,t.t),[f=[],E]=gn(l,Le.Oe),[$,g]=gn(f,t.t);if(!h&&!E)return;const[T=bn.GET]=gn(o,t.H),[S=Rn.TEXT]=gn(o,t.AS),[y=[]]=gn(l,Le._e,[],1),v=new Headers;x(y,e=>{const n=st(e);v.set(n[t.O],n[t.G])});const[b,R]=gn(l,Le.Ae);let p;if(R){const[n,o]=gn(b,t.t);R&&o&&(p=n);const[r,a]=gn(b,t.G),[i,c]=gn(b,t.T);a&&c&&(p=En(e,r,i,s))}const _=(t,o)=>yn(e,n,t)(a,r,o);try{const t=await fetch(i,{body:p,method:T,headers:v});if(!t.ok)throw q(`[${t.status}] ${i}`);if(!m)return;const e=()=>t.text(),n={[Rn.JSON]:()=>t.json(),[Rn.ue]:e,[Rn.TEXT]:e};_(d,await(n?.[S]?.()))}catch(t){if(!g)return;_($,{message:"[ERROR] "+t?.message})}}}),_n=vn({name:Le.Re,He:[t.C],Fe(e,n,o,s){const[a]=gn(o,t.C),i=s?.target?.[t.G],c=()=>zt(()=>{const o=((t,e)=>et(Ue(t),e))(n,a);if(!o)return c();void 0!==i&&s?.target&&(s.target[t.G]=i),o?.apply(e,((e,n)=>{event=void 0;const o={...de(e),...e.Bt()},s=e=>[r,[[t.L,e]]];return[{$:e,attr:{get:t=>e.jt(t)??o?.[t],set:e.ut},refs:t=>e.kt.apply(null,s(t)),ref:t=>e.xt.apply(null,s(t)),attrs:e.Bt(),localState:e.k,globalState:ke(),event:n}]})(e,s))});c()}}),An=vn({name:Le.ve,He:[t.O],Fe(e,n,o,s){const[a]=gn(o,t.O),[i,c]=gn(o,t.q),[l,h]=gn(o,t.q+u+"parent"),[d,m]=gn(o,t.j),[f,E]=gn(o,t.G),[$,g]=gn(o,t.T),[T]=gn(o,t.t),S={html:()=>T,json:()=>R(T)},y=[r,t.L,i],v=Me+u+a;let b=s;m&&(b=E&&g?$n(e,d,f,$,s)||f:S[d]?.()??f);let p=[e];if(c&&(p=G(e.kt.apply(null,y))),h){const t=e.It();p=[t],l!==r&&(p=G(t.kt.apply(null,y)))}x(p,t=>t.St(v,b))}}),wn=vn({name:Le.Te,He:[t.O],Fe(e,n,o,s){const[r]=gn(o,t.O),[,a]=gn(o,t.S),i=a?Ve(r):Sn(r,e.Y);(a?Ye:(t,n)=>e.k.set(t,n))(r,Tn(e,o,i,s))}}),On=vn({name:Le.Se,He:[t.O],Fe(e,n,o,s){const[r]=gn(o,t.O),a=Sn(r,e.Z),i=e.jt(r),c="boolean"===a?!!i:i,l=Tn(e,o,a,s)(ee(a,c));e.ut(r,""+l)}}),Mn=vn({name:Le.ye,He:[t.I,t.g],Fe(e,n,o,s,r,a){const[i,c]=gn(o,t.t);if(!c)return;const[l,u]=gn(o,t.I),[h,d]=gn(o,t.g),m=()=>yn(e,n,i)(a,r,s);u?Xt(m,+l):d&&setInterval(m,+h)}}),In=vn({name:Le.be,Fe(e,n,o,s){x(o,([n,o])=>Y(e.kt(r,[[t.L,o]]),t=>t?.[n]?.(s)))}}),Ln=t=>(e,n,o,s)=>{const r=!!o,a=t?e.gt:e.Tt,i=n===Me;a(i?Me+u+o:n,t=>{!i&&r&&o!==t[0]||zt(()=>e.St(Oe.ge,[n,o,s,t]))})},Nn=(t,e,n)=>x(t,([t,o])=>x(t,([t,s])=>n(e,t,s,o))),Cn=je({name:Oe.ge,async je(t,e,n){Nn(t,n??e,Ln())},async Ge(t,e,n){Nn(t,n??e,Ln(1))}}),Dn=(e,n)=>(o,s,a,i)=>c=>{(n?o.gt:o.$t)(a,((e,n,o,s,a)=>i=>{const[,c]=n||[];if(c?.(),!(o>0))return e.St(Oe.$e,[r,s,a,i]);{const c=i?.target?.[t.G];n=Xt(()=>{void 0!==c&&i?.target&&(i.target[t.G]=c),e.St(Oe.$e,[r,s,a,i])},o)}})(e,void 0,s,a,i),c)},Un=(e,n,o)=>x(e,([e,s])=>{const a=+he(e,t.l);x(e,([e,i])=>{e!==t.l&&Y(n.kt(r,t.L,i),o(n,a,e,s))})}),Pn=[Cn,je({name:Oe.$e,async je(t,e,n){Un(t,n??e,Dn(e))},async Ge(t,e,n){Un(t,n??e,Dn(e,1))}})],qn=[pn,_n,An,On,wn,Mn,In],Bn=te({name:$,async se(e){const n=e.wt();if(!n)return;const o=e.jt(t.O,n);for(const t of qn)await t();for(const[t]of Pn)await t(o,e)},async ee(t){if(!(t.Ot()instanceof ShadowRoot))return;const e=t.It();for(const[,t]of Pn)await t(e);t.st()}}),jn=te({name:"repeat-list",se(r){const a=r.ct();x(r.Pt(),t=>{r.ot(r.Lt(t),a),r.st(t)}),r.nt(),r.J();const i=r.It();if(!i)return;const c=r.jt(t.M),l=I(c);if(!l)return;const u=i?.k,h=i.Y,d=i.Z;x(G([[i,e],[u,s],[ke(),s,1]]),([t,c,m])=>{t.subscribe(async(t,f)=>{if(!V(f)||t!==l)return ae(r,c,le(r),t,f,void 0,m,1);await(async()=>{for(const[,,t]of Pn)await t(i,r)})(),(t=>{const c=r.tt();r.J(),r.J(c),x(t,(e,s)=>{r.ot(r.Lt(a),c);const i=le(r);x(F(e),t=>{ae(r,o,i,t,e,void 0,0)});const l={index:s,length:t.length};x(F(l,"!"),t=>ae(r,n,i,t,l,void 0,0))});const l=le(r);x(G([[h,s],[d,e]]),([t,n])=>x(t,([o])=>{const a={[e]:()=>i.jt(o),[s]:()=>u.get(o)},c=Sn(o,t);ae(r,n,l,o,a[n](),c,0)}))})(f),await(async()=>{for(const[,t]of Pn)await t(i,r)})()})})}}),Gn=te({name:"web-app",ee(e){e.ut(t.p,1)}}),Hn=B(),Fn=B(),Vn=B(),xn=B(),kn=B(),Yn=te({name:f,se(e){const n=[[E,Ke],["element-state",We]],o=e.jt(t.O);for(const[t,s]of n){const n=oe(e,t);n&&s(o,n),se(e,t)}},te(r){var a;(a=r.jt(t.O),te({name:a,de(){const e=Ot(at)(f,t.O,a),n=Ot(e)("template");nt(Hn,a,n),n&&Y(Mt(n.content)("style"),t=>nt(Fn,a,t)),x([[$,Vn],[g,xn],[T,kn]],([t,n])=>{nt(n,a,j(G(Mt(e)(t))))})},se(r){r.nt(),r.Jt(et(Fn,a)),r.K(et(Hn,a)),x([Vn,xn,kn],t=>x(et(t,a),r.W));const i=r.xt(m,[[t.i]]),c=Q(r.Pt(),(e,n)=>{const o=r.jt(t.D,n);return o?(r.Et(r.xt(m,[[t.O,o]]),[n]),e):[...e,n]},[]);r.Et(i,c);const l=le(r),u=(t=>et(Je,t)??j())(a),h=(t=>et(Xe,t)??j())(a);x(G([[G(u),e],[G(h),s],[He,s,1]]),([t,a,i])=>x(t,([t,c,u])=>{const h=()=>ee(c,u),d=()=>H(u,t),m={[e]:()=>r.jt(t)??h(),[s]:h,[o]:d,[n]:d};a===e&&ot(r.Z,[t,c,u]),i||a!==s||ot(r.Y,[t,c,u]),ae(r,a,l,t,m[a](),c,i)})),x(G([[r,e],[r.k,s,0],[ke(),s,1]]),([t,e,n])=>t.subscribe((t,o,a)=>{const i=[t,o,a],c=n?Ve(t):Sn(t,e===s?h:u);e===s&&Z(i,n),r.St(Ie[e],i),ae(r,e,l,t,o,c,n,1)}));const d=(t=>((t,e)=>n=>yn(t,e,n))(t,t.Rt()))(r);x(rt(Oe),([,t])=>r.Tt(t,([t,e,n,o])=>d(n)(t,e,o)))},ee(t){t.St("mounted")},ne(t){t.St("unmounted")}})).call(this)},ee(t){t.st()}}),Qn=[Ee,Se,ye,jn,Ae,we,Bn],Zn=[Qe,Yn,Gn];(async()=>{for(const t of Qn)await t();for(const t of Zn)t()})()}();//# sourceMappingURL=realm.production.min.js.map