@mantou/gem 1.4.1 → 1.5.3

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.
@@ -112,6 +112,7 @@ export abstract class GemElement<T = Record<string, unknown>> extends HTMLElemen
112
112
  #isAppendReason?: boolean;
113
113
  #isAsync?: boolean;
114
114
  #effectList?: EffectItem<any>[];
115
+ #momeList?: EffectItem<any>[];
115
116
  #unmountCallback?: any;
116
117
 
117
118
  constructor({ isAsync, isLight, delegatesFocus }: GemElementOptions = {}) {
@@ -193,11 +194,8 @@ export abstract class GemElement<T = Record<string, unknown>> extends HTMLElemen
193
194
  addMicrotask(this.#update);
194
195
  };
195
196
 
196
- /**
197
- * 每次更新完检查依赖,执行对应的副作用回调
198
- * */
199
- #execEffect = () => {
200
- this.#effectList?.forEach((effectItem) => {
197
+ #exec = (list?: EffectItem<any>[]) => {
198
+ list?.forEach((effectItem) => {
201
199
  const { callback, getDep, values, preCallback } = effectItem;
202
200
  const newValues = getDep?.();
203
201
  if (!getDep || isArrayChange(values, newValues)) {
@@ -208,6 +206,17 @@ export abstract class GemElement<T = Record<string, unknown>> extends HTMLElemen
208
206
  });
209
207
  };
210
208
 
209
+ /**
210
+ * 每次更新完检查依赖,执行对应的副作用回调
211
+ * */
212
+ #execEffect = () => {
213
+ this.#exec(this.#effectList);
214
+ };
215
+
216
+ #execMemo = () => {
217
+ this.#exec(this.#momeList);
218
+ };
219
+
211
220
  /**
212
221
  * @helper
213
222
  * 记录副作用回调和值,在 `constructor`/`mounted` 中使用
@@ -238,6 +247,31 @@ export abstract class GemElement<T = Record<string, unknown>> extends HTMLElemen
238
247
  this.#effectList.push(effectItem);
239
248
  };
240
249
 
250
+ /**
251
+ * @helper
252
+ * 在 `render` 前执行回调,和 `effect` 一样接受依赖数组参数,在 `constructor`/`willMount` 中使用
253
+ *
254
+ * ```js
255
+ * class App extends GemElement {
256
+ * willMount() {
257
+ * this.memo(() => {
258
+ * this.a = exec(this.attrName);
259
+ * }), () => [this.attrName]);
260
+ * }
261
+ * }
262
+ * ```
263
+ * */
264
+ memo = <T = any[] | undefined>(callback: EffectCallback<T>, getDep?: T extends any[] ? () => [...T] : undefined) => {
265
+ if (!this.#momeList) this.#momeList = [];
266
+ this.#momeList.push({
267
+ callback,
268
+ getDep,
269
+ values: [Symbol()],
270
+ // 是否是 `willMount` 中定义
271
+ initialized: this.isConnected,
272
+ });
273
+ };
274
+
241
275
  /**
242
276
  * 元素挂载后执行还未初始化的副作用
243
277
  * */
@@ -262,6 +296,7 @@ export abstract class GemElement<T = Record<string, unknown>> extends HTMLElemen
262
296
  render?(): TemplateResult | null | undefined;
263
297
 
264
298
  #render = () => {
299
+ this.#execMemo();
265
300
  if (this.render) return this.render();
266
301
  return this.#renderRoot === this ? undefined : html`<slot></slot>`;
267
302
  };
@@ -292,7 +327,10 @@ export abstract class GemElement<T = Record<string, unknown>> extends HTMLElemen
292
327
  }
293
328
  };
294
329
 
295
- /**@helper */
330
+ /**
331
+ * @helper
332
+ * async
333
+ */
296
334
  update = () => {
297
335
  addMicrotask(this.#update);
298
336
  };
@@ -396,6 +434,7 @@ export abstract class GemElement<T = Record<string, unknown>> extends HTMLElemen
396
434
  this.#effectList?.forEach((effectItem) => {
397
435
  execCallback(effectItem.preCallback);
398
436
  });
437
+ this.#momeList = this.#momeList?.filter(({ initialized }) => !initialized);
399
438
  }
400
439
  }
401
440
 
package/src/lib/utils.ts CHANGED
@@ -121,10 +121,7 @@ declare global {
121
121
  }
122
122
  }
123
123
  export class QueryString extends URLSearchParams {
124
- constructor(param: any) {
125
- if (param instanceof QueryString) {
126
- return param;
127
- }
124
+ constructor(param?: any) {
128
125
  super(param);
129
126
  }
130
127
 
@@ -140,6 +137,37 @@ export class QueryString extends URLSearchParams {
140
137
  });
141
138
  }
142
139
 
140
+ #stringify = (value: any) => (typeof value === 'string' ? value : JSON.stringify(value));
141
+
142
+ setAny(key: string, value: any) {
143
+ if (Array.isArray(value)) {
144
+ this.delete(key);
145
+ value.forEach((e) => this.append(key, this.#stringify(e)));
146
+ } else {
147
+ const v = this.#stringify(value);
148
+ v ? this.set(key, v) : this.delete(key);
149
+ }
150
+ }
151
+
152
+ #parse = (value: any) => {
153
+ if (!value) return null;
154
+ try {
155
+ return JSON.parse(value);
156
+ } catch {
157
+ return null;
158
+ }
159
+ };
160
+
161
+ getAny(key: string) {
162
+ return this.getAnyAll(key)[0];
163
+ }
164
+
165
+ getAnyAll(key: string) {
166
+ return this.getAll(key)
167
+ .filter((e) => e !== '')
168
+ .map((e) => this.#parse(e));
169
+ }
170
+
143
171
  toString() {
144
172
  const string = super.toString();
145
173
  return string ? `?${string}` : '';
@@ -186,12 +214,12 @@ declare global {
186
214
  }
187
215
  }
188
216
 
189
- type StyledType = 'id' | 'class' | 'keyframes';
190
- interface StyledValueObject {
217
+ export type StyledType = 'id' | 'class' | 'keyframes';
218
+ export interface StyledValueObject {
191
219
  styledContent: string;
192
220
  type: StyledType;
193
221
  }
194
- interface StyledKeyValuePair {
222
+ export interface StyledKeyValuePair {
195
223
  [key: string]: StyledValueObject;
196
224
  }
197
225
 
@@ -316,7 +344,9 @@ export function removeItems(target: any[], items: any[]) {
316
344
  export function styleMap(obj: Partial<CSSStyleDeclaration>) {
317
345
  let styleString = '';
318
346
  for (const key in obj) {
319
- styleString += `${camelToKebabCase(key)}:${obj[key]};`;
347
+ if (obj[key]) {
348
+ styleString += `${camelToKebabCase(key)}:${obj[key]};`;
349
+ }
320
350
  }
321
351
  return styleString;
322
352
  }
@@ -1,2 +1,2 @@
1
1
  // Do not modify manually
2
- export const version = '1.4.1';
2
+ export const version = '1.5.3';
@@ -197,6 +197,53 @@ describe('gem element 副作用', () => {
197
197
  });
198
198
  });
199
199
 
200
+ class MemoGemDemo extends GemElement {
201
+ @attribute attr = 'a';
202
+ @property prop = {};
203
+ memoCount = 0;
204
+ constructor() {
205
+ super();
206
+ this.memo(
207
+ () => this.memoCount++,
208
+ () => [this.attr, this.prop],
209
+ );
210
+ }
211
+ willMount() {
212
+ this.memo(
213
+ (_arr) => {
214
+ this.memoCount++;
215
+ },
216
+ () => [],
217
+ );
218
+ this.memo(() => {
219
+ this.memoCount++;
220
+ });
221
+ }
222
+ }
223
+ customElements.define('memo-gem-demo', MemoGemDemo);
224
+ describe('gem element Memo', () => {
225
+ it('依赖当前值', async () => {
226
+ const el: MemoGemDemo = await fixture(html`<memo-gem-demo></memo-gem-demo>`);
227
+ expect(el.memoCount).to.equal(3);
228
+ el.attr = 'b';
229
+ el.prop = {};
230
+ await nextFrame();
231
+ expect(el.memoCount).to.equal(5);
232
+
233
+ el.update();
234
+ await Promise.resolve();
235
+ expect(el.memoCount).to.equal(6);
236
+
237
+ document.body.append(el);
238
+ expect(el.memoCount).to.equal(6);
239
+
240
+ el.remove();
241
+ await Promise.resolve();
242
+ document.body.append(el);
243
+ expect(el.memoCount).to.equal(8);
244
+ });
245
+ });
246
+
200
247
  class I extends GemElement {
201
248
  @attribute appTitle = 'string';
202
249
  @property appData = { a: 1 };
@@ -47,6 +47,12 @@ describe('utils 测试', () => {
47
47
  expect(query.get('c')).to.equal('3');
48
48
  query.concat({ d: 4 });
49
49
  expect(query.toString()).to.equal('?a=1&b=2&c=3&d=4');
50
+ query.setAny('obj', { a: 1, b: 2 });
51
+ expect(query.getAny('obj')).to.deep.equal({ a: 1, b: 2 });
52
+ expect(query.getAnyAll('obj')).to.deep.equal([{ a: 1, b: 2 }]);
53
+ query.setAny('obj', [{ a: 1, b: 2 }]);
54
+ expect(query.getAny('obj')).to.deep.equal({ a: 1, b: 2 });
55
+ expect(query.getAnyAll('obj')).to.deep.equal([{ a: 1, b: 2 }]);
50
56
  expect(new QueryString({ a: 1 }).toString()).to.equal('?a=1');
51
57
  expect(new QueryString(query).toString()).to.equal(query.toString());
52
58
  });
package/umd.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*! For license information please see umd.js.LICENSE.txt */
2
- !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.Gem=e():t.Gem=e()}(self,(function(){return(()=>{"use strict";var t={d:(e,n)=>{for(var s in n)t.o(n,s)&&!t.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:n[s]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{DialogBaseElement:()=>Pn,GemActiveLinkElement:()=>rn,GemElement:()=>ye,GemError:()=>x,GemLightRouteElement:()=>nn,GemLinkElement:()=>on,GemReflectElement:()=>gn,GemRouteElement:()=>en,GemTitleElement:()=>ln,GemUnsafeElement:()=>fn,GemUseElement:()=>dn,I18n:()=>Rn,LinkedList:()=>l,PropProxyMap:()=>h,QueryString:()=>u,SVGTemplateResult:()=>wt,SheetToken:()=>f,StoreListenerMap:()=>C,TemplateResult:()=>yt,absoluteLocation:()=>c,addMicrotask:()=>o,addMicrotaskToStack:()=>a,adoptedStyle:()=>We,attribute:()=>Ce,basePathStore:()=>J,boolattribute:()=>$e,camelToKebabCase:()=>b,classMap:()=>O,cleanObject:()=>E,connect:()=>M,connectStore:()=>Ve,createCSSSheet:()=>m,createHistoryParams:()=>tn,createModalClass:()=>yn,createPath:()=>Ye,createStore:()=>$,createStoreSet:()=>L,createTheme:()=>$n,css:()=>p,customElement:()=>qe,defineAttribute:()=>be,defineCSSState:()=>_e,defineProperty:()=>Ee,defineRef:()=>xe,del:()=>Dn,directive:()=>Y,disconnect:()=>j,emitter:()=>Ae,get:()=>Vn,getThemeProp:()=>Cn,getThemeStore:()=>On,globalemitter:()=>He,guard:()=>Kt,history:()=>R,html:()=>At,ifDefined:()=>Jt,isArrayChange:()=>_,kebabToCamelCase:()=>S,matchPath:()=>Xe,mediaQuery:()=>Gn,nativeDefineElement:()=>Pe,numattribute:()=>Le,part:()=>Re,partMap:()=>T,post:()=>Un,property:()=>Ne,put:()=>qn,randomStr:()=>g,raw:()=>d,refobject:()=>Oe,removeItems:()=>P,render:()=>Rt,repeat:()=>Bt,request:()=>Hn,rootElement:()=>De,slot:()=>je,state:()=>Me,styleMap:()=>k,styled:()=>w,svg:()=>Ht,titleStore:()=>Q,updateStore:()=>N,updateTheme:()=>Ln,version:()=>Ue});var n={};t.r(n),t.d(n,{GemElement:()=>ye,GemError:()=>x,LinkedList:()=>l,PropProxyMap:()=>h,QueryString:()=>u,SVGTemplateResult:()=>wt,SheetToken:()=>f,StoreListenerMap:()=>C,TemplateResult:()=>yt,absoluteLocation:()=>c,addMicrotask:()=>o,addMicrotaskToStack:()=>a,adoptedStyle:()=>We,attribute:()=>Ce,basePathStore:()=>J,boolattribute:()=>$e,camelToKebabCase:()=>b,classMap:()=>O,cleanObject:()=>E,connect:()=>M,connectStore:()=>Ve,createCSSSheet:()=>m,createStore:()=>$,createStoreSet:()=>L,css:()=>p,customElement:()=>qe,defineAttribute:()=>be,defineCSSState:()=>_e,defineProperty:()=>Ee,defineRef:()=>xe,directive:()=>Y,disconnect:()=>j,emitter:()=>Ae,globalemitter:()=>He,guard:()=>Kt,history:()=>R,html:()=>At,ifDefined:()=>Jt,isArrayChange:()=>_,kebabToCamelCase:()=>S,nativeDefineElement:()=>Pe,numattribute:()=>Le,part:()=>Re,partMap:()=>T,property:()=>Ne,randomStr:()=>g,raw:()=>d,refobject:()=>Oe,removeItems:()=>P,render:()=>Rt,repeat:()=>Bt,rootElement:()=>De,slot:()=>je,state:()=>Me,styleMap:()=>k,styled:()=>w,svg:()=>Ht,titleStore:()=>Q,updateStore:()=>N,version:()=>Ue});const s=new Set;function o(t){"function"==typeof t&&(s.size||globalThis.queueMicrotask((()=>{s.forEach((t=>t())),s.clear()})),s.delete(t),s.add(t))}const i=[];function r(){for(let t=i.length-1;t>=0;t--)i[t]();i.length=0}function a(t){i.length||o(r),i.push(t)}function c(t="",e=""){const{pathname:n,search:s,hash:o}=new URL(e,location.origin+t);return n+s+o}class l extends(globalThis.EventTarget||Object){constructor(){super(...arguments),this.pool=new Map}add(t){const e={value:t};this.firstItem||(this.dispatchEvent(new CustomEvent("start")),this.firstItem=e),this.lastItem&&(this.lastItem.next=e,e.prev=this.lastItem),this.lastItem=e;const n=this.pool.get(t);n&&(n.prev?n.prev.next=n.next:this.firstItem=n.next,n.next&&(n.next.prev=n.prev)),this.pool.set(t,e)}get(){const t=this.firstItem;if(t)return this.pool.delete(t.value),this.firstItem=t.next,this.firstItem||(this.lastItem=void 0,this.dispatchEvent(new CustomEvent("end"))),t.value}}class h extends WeakMap{get(t){let e=super.get(t);return e||(e={},this.set(t,e)),e}}class u extends URLSearchParams{constructor(t){if(t instanceof u)return t;super(t)}concat(t){let e;e="string"==typeof t?Object.fromEntries(new URLSearchParams(t).entries()):t,Object.keys(e).forEach((t=>{this.append(t,e[t])}))}toString(){const t=super.toString();return t?`?${t}`:""}toJSON(){return this.toString()}}function d(t,...e){return t.reduce(((t,n,s)=>{var o;return t+(null!==(o=e[s-1])&&void 0!==o?o:"")+n}))}function p(t,...e){return d(t,...e)}const f=Symbol("sheet token");function m(t,e=""){const n=new CSSStyleSheet,s={};n.media.mediaText=e;let o="";return"string"==typeof t?o=t:Object.keys(t).forEach((e=>{s[e]=`${e}-${g()}`,o+=t[e].styledContent.replace(/&/g,s[e])})),n.replaceSync(o),s[f]=n,s}function g(t=5,e="0123456789abcdefghijklmnopqrstuvwxyz"){const n=e.length;let s="";for(let o=0;o<t;o++)s+=e[Math.floor(Math.random()*n)];return s}const v=new RegExp("&.*{((.|\n)*)}","g");function y(t,e){const n=[];let s=`& {${t.replace(v,(t=>(n.push(t),"")))}}`+n.join("");return s=s.replace(/&/g,"class"===e?".&":"#&"),{styledContent:s,type:e}}const w={class:(t,...e)=>y(d(t,...e),"class"),id:(t,...e)=>y(d(t,...e),"id"),keyframes:(t,...e)=>({styledContent:`@keyframes & {${d(t,...e)}}`,type:"keyframes"})};function b(t){return t.replace(/[A-Z]/g,(t=>"-"+t.toLowerCase()))}function S(t){return t.replace(/-(.)/g,((t,e)=>e.toUpperCase()))}function E(t){return Object.keys(t).forEach((e=>{delete t[e]})),t}class x extends Error{constructor(t){super(t),this.message=`gem: ${this.message}`}}function _(t,e){const n=t.length;for(let s=0;s<n;s++)if(t[s]!==e[s])return!0;return!1}function P(t,e){const n=new Set(e);return t.filter((t=>!n.has(t)||(n.delete(t),!1)))}function k(t){let e="";for(const n in t)e+=`${b(n)}:${t[n]};`;return e}function O(t){let e=" ";for(const n in t)t[n]&&(e+=`${n} `);return e}const T=O,C=new WeakMap;function $(t){if(C.has(t))throw new x("argument error");return C.set(t,new Set),t}function L(t){return Object.keys(t).forEach((e=>{$(t[e])})),t}function N(t,e){Object.assign(t,e);const n=C.get(t);null==n||n.forEach((t=>{o(t)}))}function M(t,e){const n=C.get(t);null==n||n.add(e)}function j(t,e){const n=C.get(t);null==n||n.delete(e)}const R=window.history,A=window.location,H=R.pushState.bind(R),I=R.replaceState.bind(R);let W=0;const V=()=>`${performance.now()}-${++W}`,D=$({$hasCloseHandle:!1,$hasOpenHandle:!1,$hasShouldCloseHandle:!1,$key:""}),q=new Map;function U({$key:t,$hasCloseHandle:e,$hasOpenHandle:n,$hasShouldCloseHandle:s}={}){if(D.$key!==t){if(t)throw new x("`$key` is not allowed");if(e)throw new x("`$hasCloseHandle` is not allowed");if(n)throw new x("`$hasOpenHandle` is not allowed");if(s)throw new x("`$hasShouldCloseHandle` is not allowed")}}function G(t){return R.basePath?R.basePath+t:t}function B(t){return t===R.basePath?"/":t.replace(new RegExp(`^${R.basePath}/`),"/")}function F(t){const e=q.get(D.$key)||{},n=t.path?c(e.path,t.path):B(A.pathname),s=new u(t.query||(t.path?"":A.search)),o=t.path&&t.path!==e.path||t.query&&String(t.query)!==String(e.query),i=t.title||"",r=t.close||t.data||t.open||t.shouldClose,a=t.hash||(!o&&r?decodeURIComponent(A.hash):"");return Object.assign(Object.assign({},t),{title:i,path:n,query:s,hash:a})}function K(t,e){U(e.data);const n=F(e),{title:s,path:o,query:i,hash:r,close:a,open:c,shouldClose:l,data:h}=n,d=Object.assign({$hasCloseHandle:!!a,$hasOpenHandle:!!c,$hasShouldCloseHandle:!!l,$key:V()},h);q.set(d.$key,n),N(E(D),d);const p=G(o)+new u(i)+r,f=decodeURIComponent(A.hash);("push"===t?H:I)(d,s,p),f!==r&&window.dispatchEvent(new CustomEvent("hashchange"))}function z(t,e,n,s){U(e);const o=Object.assign({$key:V()},e||{}),{pathname:i,search:r,hash:a}=new URL(s,A.origin+A.pathname),c=F({path:i,query:new u(r),hash:a,title:n,data:e});q.set(o.$key,c),N(E(D),o);const l=G(i)+c.query+a,h=A.hash;("push"===t?H:I)(o,n,l),h!==a&&window.dispatchEvent(new CustomEvent("hashchange"))}const J=$({basePath:""});if(window.addEventListener("hashchange",(({isTrusted:t})=>{t&&R.replace({hash:decodeURIComponent(A.hash)})})),Object.defineProperties(R,{basePath:{get:()=>J.basePath,set(t){N(J,{basePath:t}),Object.assign(q.get(D.$key),{path:B(A.pathname)})}},getParams:{value:function(){return q.get(D.$key)}},updateParams:{value:function(t){Object.assign(q.get(D.$key),t),N(D,{})}},store:{value:D},push:{value:function(t){R.pushState(t,"")}},pushIgnoreCloseHandle:{value:function(t){var e,n;D.$hasCloseHandle?(null===(n=null===(e=q.get(D.$key))||void 0===e?void 0:e.close)||void 0===n||n.call(e),R.replace(t)):R.push(t)}},replace:{value:function(t){K("replace",t)}}}),R.pushState=function(t,e,n){n?z("push",t,e,n):K("push",t)},R.replaceState=function(t,e,n){z("replace",t,e,n)},R.state)if(R.state.$hasCloseHandle){N(D,R.state);const t=F({title:document.title});q.set(D.$key,t),R.back()}else{const t=F({title:document.title,hash:A.hash});N(D,Object.assign({$key:V()},R.state||{})),q.set(D.$key,t)}else{const{pathname:t,search:e,hash:n}=A;R.replace({path:t,query:e,hash:n})}const Q=$({title:""});M(Q,(()=>{const t=q.get(D.$key);t&&(t.title=Q.title)})),M(D,(()=>{const{title:t}=R.getParams();t!==Q.title&&N(Q,{title:t})}));let Z=!1;window.addEventListener("popstate",(t=>{var e,n;const s=t.state;if(!(null==s?void 0:s.$key))return;if(Z)return void(Z=!1);if(!q.has(s.$key)){const{pathname:t,search:e,hash:n}=A;q.set(s.$key,{path:t,query:new u(e),hash:n,title:document.title,data:s})}const o=D;if(parseFloat(s.$key)>parseFloat(o.$key)&&s.$hasOpenHandle)null===(n=null===(e=q.get(s.$key))||void 0===e?void 0:e.open)||void 0===n||n.call(e);else if(o.$hasCloseHandle){const t=q.get(o.$key),e=null==t?void 0:t.close,n=null==t?void 0:t.shouldClose;if(n&&!n())return Z=!0,void R.forward();e?e():s.$hasCloseHandle&&(Z=!0,R.back())}N(E(D),s)}));const X=new WeakMap,Y=t=>(...e)=>{const n=t(...e);return X.set(n,!0),n},tt=t=>"function"==typeof t&&X.has(t),et="undefined"!=typeof window&&null!=window.customElements&&void 0!==window.customElements.polyfillWrapFlushCallback,nt=(t,e,n=null,s=null)=>{for(;e!==n;){const n=e.nextSibling;t.insertBefore(e,s),e=n}},st=(t,e,n=null)=>{for(;e!==n;){const n=e.nextSibling;t.removeChild(e),e=n}},ot={},it={},rt=`{{lit-${String(Math.random()).slice(2)}}}`,at=`\x3c!--${rt}--\x3e`,ct=new RegExp(`${rt}|${at}`),lt="$lit$";class ht{constructor(t,e){this.parts=[],this.element=e;const n=[],s=[],o=document.createTreeWalker(e.content,133,null,!1);let i=0,r=-1,a=0;const{strings:c,values:{length:l}}=t;for(;a<l;){const t=o.nextNode();if(null!==t){if(r++,1===t.nodeType){if(t.hasAttributes()){const e=t.attributes,{length:n}=e;let s=0;for(let t=0;t<n;t++)ut(e[t].name,lt)&&s++;for(;s-- >0;){const e=c[a],n=ft.exec(e)[2],s=n.toLowerCase()+lt,o=t.getAttribute(s);t.removeAttribute(s);const i=o.split(ct);this.parts.push({type:"attribute",index:r,name:n,strings:i}),a+=i.length-1}}"TEMPLATE"===t.tagName&&(s.push(t),o.currentNode=t.content)}else if(3===t.nodeType){const e=t.data;if(e.indexOf(rt)>=0){const s=t.parentNode,o=e.split(ct),i=o.length-1;for(let e=0;e<i;e++){let n,i=o[e];if(""===i)n=pt();else{const t=ft.exec(i);null!==t&&ut(t[2],lt)&&(i=i.slice(0,t.index)+t[1]+t[2].slice(0,-lt.length)+t[3]),n=document.createTextNode(i)}s.insertBefore(n,t),this.parts.push({type:"node",index:++r})}""===o[i]?(s.insertBefore(pt(),t),n.push(t)):t.data=o[i],a+=i}}else if(8===t.nodeType)if(t.data===rt){const e=t.parentNode;null!==t.previousSibling&&r!==i||(r++,e.insertBefore(pt(),t)),i=r,this.parts.push({type:"node",index:r}),null===t.nextSibling?t.data="":(n.push(t),r--),a++}else{let e=-1;for(;-1!==(e=t.data.indexOf(rt,e+1));)this.parts.push({type:"node",index:-1}),a++}}else o.currentNode=s.pop()}for(const t of n)t.parentNode.removeChild(t)}}const ut=(t,e)=>{const n=t.length-e.length;return n>=0&&t.slice(n)===e},dt=t=>-1!==t.index,pt=()=>document.createComment(""),ft=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/;class mt{constructor(t,e,n){this.__parts=[],this.template=t,this.processor=e,this.options=n}update(t){let e=0;for(const n of this.__parts)void 0!==n&&n.setValue(t[e]),e++;for(const t of this.__parts)void 0!==t&&t.commit()}_clone(){const t=et?this.template.element.content.cloneNode(!0):document.importNode(this.template.element.content,!0),e=[],n=this.template.parts,s=document.createTreeWalker(t,133,null,!1);let o,i=0,r=0,a=s.nextNode();for(;i<n.length;)if(o=n[i],dt(o)){for(;r<o.index;)r++,"TEMPLATE"===a.nodeName&&(e.push(a),s.currentNode=a.content),null===(a=s.nextNode())&&(s.currentNode=e.pop(),a=s.nextNode());if("node"===o.type){const t=this.processor.handleTextExpression(this.options);t.insertAfterNode(a.previousSibling),this.__parts.push(t)}else this.__parts.push(...this.processor.handleAttributeExpressions(a,o.name,o.strings,this.options));i++}else this.__parts.push(void 0),i++;return et&&(document.adoptNode(t),customElements.upgrade(t)),t}}const gt=window.trustedTypes&&trustedTypes.createPolicy("lit-html",{createHTML:t=>t}),vt=` ${rt} `;class yt{constructor(t,e,n,s){this.strings=t,this.values=e,this.type=n,this.processor=s}getHTML(){const t=this.strings.length-1;let e="",n=!1;for(let s=0;s<t;s++){const t=this.strings[s],o=t.lastIndexOf("\x3c!--");n=(o>-1||n)&&-1===t.indexOf("--\x3e",o+1);const i=ft.exec(t);e+=null===i?t+(n?vt:at):t.substr(0,i.index)+i[1]+i[2]+lt+i[3]+rt}return e+=this.strings[t],e}getTemplateElement(){const t=document.createElement("template");let e=this.getHTML();return void 0!==gt&&(e=gt.createHTML(e)),t.innerHTML=e,t}}class wt extends yt{getHTML(){return`<svg>${super.getHTML()}</svg>`}getTemplateElement(){const t=super.getTemplateElement(),e=t.content,n=e.firstChild;return e.removeChild(n),nt(e,n.firstChild),t}}const bt=t=>null===t||!("object"==typeof t||"function"==typeof t),St=t=>Array.isArray(t)||!(!t||!t[Symbol.iterator]);class Et{constructor(t,e,n){this.dirty=!0,this.element=t,this.name=e,this.strings=n,this.parts=[];for(let t=0;t<n.length-1;t++)this.parts[t]=this._createPart()}_createPart(){return new xt(this)}_getValue(){const t=this.strings,e=t.length-1,n=this.parts;if(1===e&&""===t[0]&&""===t[1]){const t=n[0].value;if("symbol"==typeof t)return String(t);if("string"==typeof t||!St(t))return t}let s="";for(let o=0;o<e;o++){s+=t[o];const e=n[o];if(void 0!==e){const t=e.value;if(bt(t)||!St(t))s+="string"==typeof t?t:String(t);else for(const e of t)s+="string"==typeof e?e:String(e)}}return s+=t[e],s}commit(){this.dirty&&(this.dirty=!1,this.element.setAttribute(this.name,this._getValue()))}}class xt{constructor(t){this.value=void 0,this.committer=t}setValue(t){t===ot||bt(t)&&t===this.value||(this.value=t,tt(t)||(this.committer.dirty=!0))}commit(){for(;tt(this.value);){const t=this.value;this.value=ot,t(this)}this.value!==ot&&this.committer.commit()}}class _t{constructor(t){this.value=void 0,this.__pendingValue=void 0,this.options=t}appendInto(t){this.startNode=t.appendChild(pt()),this.endNode=t.appendChild(pt())}insertAfterNode(t){this.startNode=t,this.endNode=t.nextSibling}appendIntoPart(t){t.__insert(this.startNode=pt()),t.__insert(this.endNode=pt())}insertAfterPart(t){t.__insert(this.startNode=pt()),this.endNode=t.endNode,t.endNode=this.startNode}setValue(t){this.__pendingValue=t}commit(){if(null===this.startNode.parentNode)return;for(;tt(this.__pendingValue);){const t=this.__pendingValue;this.__pendingValue=ot,t(this)}const t=this.__pendingValue;t!==ot&&(bt(t)?t!==this.value&&this.__commitText(t):t instanceof yt?this.__commitTemplateResult(t):t instanceof Node?this.__commitNode(t):St(t)?this.__commitIterable(t):t===it?(this.value=it,this.clear()):this.__commitText(t))}__insert(t){this.endNode.parentNode.insertBefore(t,this.endNode)}__commitNode(t){this.value!==t&&(this.clear(),this.__insert(t),this.value=t)}__commitText(t){const e=this.startNode.nextSibling,n="string"==typeof(t=null==t?"":t)?t:String(t);e===this.endNode.previousSibling&&3===e.nodeType?e.data=n:this.__commitNode(document.createTextNode(n)),this.value=t}__commitTemplateResult(t){const e=this.options.templateFactory(t);if(this.value instanceof mt&&this.value.template===e)this.value.update(t.values);else{const n=new mt(e,t.processor,this.options),s=n._clone();n.update(t.values),this.__commitNode(s),this.value=n}}__commitIterable(t){Array.isArray(this.value)||(this.value=[],this.clear());const e=this.value;let n,s=0;for(const o of t)n=e[s],void 0===n&&(n=new _t(this.options),e.push(n),0===s?n.appendIntoPart(this):n.insertAfterPart(e[s-1])),n.setValue(o),n.commit(),s++;s<e.length&&(e.length=s,this.clear(n&&n.endNode))}clear(t=this.startNode){st(this.startNode.parentNode,t.nextSibling,this.endNode)}}class Pt{constructor(t,e,n){if(this.value=void 0,this.__pendingValue=void 0,2!==n.length||""!==n[0]||""!==n[1])throw new Error("Boolean attributes can only contain a single expression");this.element=t,this.name=e,this.strings=n}setValue(t){this.__pendingValue=t}commit(){for(;tt(this.__pendingValue);){const t=this.__pendingValue;this.__pendingValue=ot,t(this)}if(this.__pendingValue===ot)return;const t=!!this.__pendingValue;this.value!==t&&(t?this.element.setAttribute(this.name,""):this.element.removeAttribute(this.name),this.value=t),this.__pendingValue=ot}}class kt extends Et{constructor(t,e,n){super(t,e,n),this.single=2===n.length&&""===n[0]&&""===n[1]}_createPart(){return new Ot(this)}_getValue(){return this.single?this.parts[0].value:super._getValue()}commit(){this.dirty&&(this.dirty=!1,this.element[this.name]=this._getValue())}}class Ot extends xt{}let Tt=!1;(()=>{try{const t={get capture(){return Tt=!0,!1}};window.addEventListener("test",t,t),window.removeEventListener("test",t,t)}catch(t){}})();class Ct{constructor(t,e,n){this.value=void 0,this.__pendingValue=void 0,this.element=t,this.eventName=e,this.eventContext=n,this.__boundHandleEvent=t=>this.handleEvent(t)}setValue(t){this.__pendingValue=t}commit(){for(;tt(this.__pendingValue);){const t=this.__pendingValue;this.__pendingValue=ot,t(this)}if(this.__pendingValue===ot)return;const t=this.__pendingValue,e=this.value,n=null==t||null!=e&&(t.capture!==e.capture||t.once!==e.once||t.passive!==e.passive),s=null!=t&&(null==e||n);n&&this.element.removeEventListener(this.eventName,this.__boundHandleEvent,this.__options),s&&(this.__options=$t(t),this.element.addEventListener(this.eventName,this.__boundHandleEvent,this.__options)),this.value=t,this.__pendingValue=ot}handleEvent(t){"function"==typeof this.value?this.value.call(this.eventContext||this.element,t):this.value.handleEvent(t)}}const $t=t=>t&&(Tt?{capture:t.capture,passive:t.passive,once:t.once}:t.capture),Lt=new class{handleAttributeExpressions(t,e,n,s){const o=e[0];return"."===o?new kt(t,e.slice(1),n).parts:"@"===o?[new Ct(t,e.slice(1),s.eventContext)]:"?"===o?[new Pt(t,e.slice(1),n)]:new Et(t,e,n).parts}handleTextExpression(t){return new _t(t)}};function Nt(t){let e=Mt.get(t.type);void 0===e&&(e={stringsArray:new WeakMap,keyString:new Map},Mt.set(t.type,e));let n=e.stringsArray.get(t.strings);if(void 0!==n)return n;const s=t.strings.join(rt);return n=e.keyString.get(s),void 0===n&&(n=new ht(t,t.getTemplateElement()),e.keyString.set(s,n)),e.stringsArray.set(t.strings,n),n}const Mt=new Map,jt=new WeakMap,Rt=(t,e,n)=>{let s=jt.get(e);void 0===s&&(st(e,e.firstChild),jt.set(e,s=new _t(Object.assign({templateFactory:Nt},n))),s.appendInto(e)),s.setValue(t),s.commit()};"undefined"!=typeof window&&(window.litHtmlVersions||(window.litHtmlVersions=[])).push("1.4.1");const At=(t,...e)=>new yt(t,e,"html",Lt),Ht=(t,...e)=>new wt(t,e,"svg",Lt),It=(t,e)=>{const n=t.startNode.parentNode,s=void 0===e?t.endNode:e.startNode,o=n.insertBefore(pt(),s);n.insertBefore(pt(),s);const i=new _t(t.options);return i.insertAfterNode(o),i},Wt=(t,e)=>(t.setValue(e),t.commit(),t),Vt=(t,e,n)=>{const s=t.startNode.parentNode,o=n?n.startNode:t.endNode,i=e.endNode.nextSibling;i!==o&&nt(s,e.startNode,i,o)},Dt=t=>{st(t.startNode.parentNode,t.startNode,t.endNode.nextSibling)},qt=(t,e,n)=>{const s=new Map;for(let o=e;o<=n;o++)s.set(t[o],o);return s},Ut=new WeakMap,Gt=new WeakMap,Bt=Y(((t,e,n)=>{let s;return void 0===n?n=e:void 0!==e&&(s=e),e=>{if(!(e instanceof _t))throw new Error("repeat can only be used in text bindings");const o=Ut.get(e)||[],i=Gt.get(e)||[],r=[],a=[],c=[];let l,h,u=0;for(const e of t)c[u]=s?s(e,u):u,a[u]=n(e,u),u++;let d=0,p=o.length-1,f=0,m=a.length-1;for(;d<=p&&f<=m;)if(null===o[d])d++;else if(null===o[p])p--;else if(i[d]===c[f])r[f]=Wt(o[d],a[f]),d++,f++;else if(i[p]===c[m])r[m]=Wt(o[p],a[m]),p--,m--;else if(i[d]===c[m])r[m]=Wt(o[d],a[m]),Vt(e,o[d],r[m+1]),d++,m--;else if(i[p]===c[f])r[f]=Wt(o[p],a[f]),Vt(e,o[p],o[d]),p--,f++;else if(void 0===l&&(l=qt(c,f,m),h=qt(i,d,p)),l.has(i[d]))if(l.has(i[p])){const t=h.get(c[f]),n=void 0!==t?o[t]:null;if(null===n){const t=It(e,o[d]);Wt(t,a[f]),r[f]=t}else r[f]=Wt(n,a[f]),Vt(e,n,o[d]),o[t]=null;f++}else Dt(o[p]),p--;else Dt(o[d]),d++;for(;f<=m;){const t=It(e,r[m+1]);Wt(t,a[f]),r[f++]=t}for(;d<=p;){const t=o[d++];null!==t&&Dt(t)}Ut.set(e,r),Gt.set(e,c)}})),Ft=new WeakMap,Kt=Y(((t,e)=>n=>{const s=Ft.get(n);if(Array.isArray(t)){if(Array.isArray(s)&&s.length===t.length&&t.every(((t,e)=>t===s[e])))return}else if(s===t&&(void 0!==t||Ft.has(n)))return;n.setValue(e()),Ft.set(n,Array.isArray(t)?Array.from(t):t)})),zt=new WeakMap,Jt=Y((t=>e=>{const n=zt.get(e);if(void 0===t&&e instanceof xt){if(void 0!==n||!zt.has(e)){const t=e.committer.name;e.committer.element.removeAttribute(t)}}else t!==n&&e.setValue(t);zt.set(e,t)}));var Qt,Zt,Xt,Yt,te,ee,ne,se,oe,ie,re,ae,ce,le,he=function(t,e,n,s){if("a"===n&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!s:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?s:"a"===n?s.call(t):s?s.value:e.get(t)},ue=function(t,e,n,s,o){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===s?o.call(t,n):o?o.value=n:e.set(t,n),n};function de(){}function pe(t){"function"==typeof t&&t()}const fe=new l,me=()=>{window.requestAnimationFrame((function t(e){if(performance.now()>e+16)return void me();const n=fe.get();n&&(n(),t(e))}))};fe.addEventListener("start",me);const ge=Symbol("init"),ve=Symbol("update");class ye extends HTMLElement{constructor({isAsync:t,isLight:e,delegatesFocus:n}={}){super(),Qt.set(this,void 0),Zt.set(this,void 0),Xt.set(this,void 0),Yt.set(this,void 0),te.set(this,void 0),ee.set(this,void 0),this.setState=t=>{if(!this.state)throw new x("`state` not initialized");Object.assign(this.state,t),o(he(this,ae,"f"))},ne.set(this,(()=>{var t;null===(t=he(this,te,"f"))||void 0===t||t.forEach((t=>{const{callback:e,getDep:n,values:s,preCallback:o}=t,i=null==n?void 0:n();n&&!_(s,i)||(pe(o),t.preCallback=e(i,s),t.values=i)}))})),this.effect=(t,e)=>{he(this,te,"f")||ue(this,te,[],"f");const n=null==e?void 0:e(),s={callback:t,getDep:e,values:n,initialized:!!this.isConnected};this.isConnected&&(s.preCallback=t(n)),he(this,te,"f").push(s)},se.set(this,(()=>{var t;null===(t=he(this,te,"f"))||void 0===t||t.forEach((t=>{const{callback:e,getDep:n,initialized:s}=t;s||(t.preCallback=e(null==n?void 0:n()),t.initialized=!0)}))})),oe.set(this,(()=>this.render?this.render():he(this,Qt,"f")===this?void 0:At`<slot></slot>`)),ie.set(this,(()=>!this.shouldUpdate||this.shouldUpdate())),re.set(this,(()=>{if(this.isConnected&&he(this,ie,"f").call(this)){const t=he(this,oe,"f").call(this);void 0!==t&&Rt(t,he(this,Qt,"f")),o(he(this,ce,"f")),o(he(this,ne,"f"))}})),ae.set(this,(()=>{he(this,Yt,"f")?fe.add(he(this,re,"f")):he(this,re,"f").call(this)})),this.update=()=>{o(he(this,ae,"f"))},ce.set(this,(()=>{var t;null===(t=this.updated)||void 0===t||t.call(this)})),le.set(this,(()=>{var t,e,n;if(he(this,Xt,"f"))return void ue(this,Xt,!1,"f");null===(t=this.willMount)||void 0===t||t.call(this);const{observedStores:s,rootElement:o}=this.constructor;null==s||s.forEach((t=>{M(t,he(this,ae,"f"))}));const i=he(this,oe,"f").call(this);if(void 0!==i&&Rt(i,he(this,Qt,"f")),ue(this,ee,null===(e=this.mounted)||void 0===e?void 0:e.call(this),"f"),he(this,se,"f").call(this),o&&(null===(n=this.getRootNode().host)||void 0===n?void 0:n.tagName)!==o.toUpperCase())throw new x("not allow current root type")})),o((()=>this[ge]=!1)),this[ge]=!0,this[ve]=()=>{this.isConnected&&o(he(this,ae,"f"))},ue(this,Yt,t,"f"),ue(this,Qt,e?this:this.attachShadow({mode:"open",delegatesFocus:n}),"f");const{adoptedStyleSheets:s}=new.target;if(s){const t=s.map((t=>t[f]||t));this.shadowRoot?this.shadowRoot.adoptedStyleSheets=t:this.effect((()=>{const e=this.getRootNode();return e.adoptedStyleSheets=[...e.adoptedStyleSheets,...t],()=>{e.adoptedStyleSheets=P(e.adoptedStyleSheets,t)}}),(()=>[]))}}get internals(){if(!he(this,Zt,"f")){const t=()=>{const{classList:t}=this;return{has:e=>t.contains(e),add:e=>t.add(e),delete:e=>t.remove(e)}};this.attachInternals||(this.attachInternals=()=>({states:t()})),ue(this,Zt,this.attachInternals(),"f"),he(this,Zt,"f").states||(he(this,Zt,"f").states=t())}return he(this,Zt,"f")}attributeChangedCallback(){this.isConnected&&o(he(this,ae,"f"))}closestElement(t){const e="function"==typeof t,n="string"==typeof t&&t.toUpperCase(),s=o=>{const i=o.parentElement||o.getRootNode().host;if(!i)return null;if(e){if(i.constructor===t)return i}else if(i.tagName===n)return i;return s(i)};return s(this)}connectedCallback(){he(this,Yt,"f")?fe.add(he(this,le,"f")):he(this,le,"f").call(this)}disconnectedCallback(){var t,e;if(this.isConnected)return void ue(this,Xt,!0,"f");const{observedStores:n}=this.constructor;null==n||n.forEach((t=>{j(t,he(this,ae,"f"))})),pe(he(this,ee,"f")),null===(t=this.unmounted)||void 0===t||t.call(this),null===(e=he(this,te,"f"))||void 0===e||e.forEach((t=>{pe(t.preCallback)}))}}Qt=new WeakMap,Zt=new WeakMap,Xt=new WeakMap,Yt=new WeakMap,te=new WeakMap,ee=new WeakMap,ne=new WeakMap,se=new WeakMap,oe=new WeakMap,ie=new WeakMap,re=new WeakMap,ae=new WeakMap,ce=new WeakMap,le=new WeakMap;const we=new h;function be(t,e,n){const{booleanAttributes:s,numberAttributes:o}=t.constructor;Object.defineProperty(t,e,{configurable:!0,get(){if(!(ge in this))return;const t=this.getAttribute(n);return(null==s?void 0:s.has(n))?null!==t:(null==o?void 0:o.has(n))?Number(t):t||""},set(t){const o=this,i=we.get(this),r=i[e],a=o.getAttribute(n);if(this[ge]&&null!==a&&!r)return;i[e]=!0;const c=null==s?void 0:s.has(n);null==t?o.removeAttribute(n):c?o.toggleAttribute(n,!!t):a!==String(t)&&o.setAttribute(n,String(t))}})}const Se=Symbol("event handle");function Ee(t,e,n,s){Object.defineProperty(t,e,{configurable:!0,get(){const t=we.get(this)[e];return t||!n?t:(this[e]=de,this[e])},set(t){const o=this,i=we.get(o);t!==i[e]&&(n?(i[e]=(null==t?void 0:t[Se])?t:(e,i)=>{const r=new CustomEvent(n,Object.assign(Object.assign(Object.assign({},i),s),{detail:e}));o.dispatchEvent(r),t(e,i)},i[e][Se]=!0):(i[e]=t,this[ve]()))}})}function xe(t,e,n){Object.defineProperty(t,e,{configurable:!0,get(){const t=we.get(this);let s=t[e];if(!s){const o=this,i=o.shadowRoot||o;s={get ref(){return n},get element(){const t=[...i.querySelectorAll("gem-reflect")].map((t=>t.target));for(const e of[i,...t]){const t=e.querySelector(`[ref=${n}]`);if(t)return t}}},t[e]=s}return s}})}function _e(t,e,n){Object.defineProperty(t,e,{configurable:!0,get(){var t;const{states:e}=this.internals;return null===(t=e.has)||void 0===t?void 0:t.call(e,n)},set(t){const{states:e}=this.internals;t?e.add(n):e.delete(n)}})}const Pe=customElements.define.bind(customElements);function ke(t,e,n,s=!1){const o=t.constructor,i=o[e];o.hasOwnProperty(e)||Object.defineProperty(o,e,{value:s?new Set(i):i?Array.from(i):[]}),o[e][s?"add":"push"](n)}function Oe(t,e){const n=`${b(e)}-${g()}`;ke(t,"defineRefs",n),xe(t,e,n)}function Te(t,e,n){ke(t,"observedAttributes",n),be(t,e,n)}function Ce(t,e){Te(t,e,b(e))}function $e(t,e){const n=b(e);ke(t,"booleanAttributes",n,!0),Te(t,e,n)}function Le(t,e){const n=b(e);ke(t,"numberAttributes",n,!0),Te(t,e,n)}function Ne(t,e){ke(t,"observedPropertys",e),Ee(t,e)}function Me(t,e){const n=b(e);ke(t,"defineCSSStates",n),_e(t,e,`--${n}`)}function je(t,e){const n=b(t[e]||e);t[e]=n,ke(t instanceof ye?t:t.prototype,"defineSlots",n)}function Re(t,e){const n=b(t[e]||e);t[e]=n,ke(t instanceof ye?t:t.prototype,"defineParts",n)}function Ae(t,e){Ie(t,e)}function He(t,e){Ie(t,e,{bubbles:!0,composed:!0})}function Ie(t,e,n){const s=b(e);ke(t,"defineEvents",s),Ee(t,e,s,n)}function We(t){return function(e){ke(e.prototype,"adoptedStyleSheets",t)}}function Ve(t){return function(e){ke(e.prototype,"observedStores",t)}}function De(t){return function(e){e.rootElement=t}}function qe(t){return function(e){Pe(t,e)}}customElements.define=(t,e,n)=>{if(e.prototype instanceof ye){const{observedAttributes:t,observedPropertys:n,defineEvents:s,defineCSSStates:o,defineRefs:i}=e;null==t||t.forEach((t=>be(e.prototype,S(t),t))),null==n||n.forEach((t=>Ee(e.prototype,t))),null==s||s.forEach((t=>Ee(e.prototype,S(t),t))),null==o||o.forEach((t=>_e(e.prototype,S(t),`--${t}`))),null==i||i.forEach((t=>xe(e.prototype,S(t),t)))}Pe(t,e,n)};const Ue="1.4.1";window.__GEM_DEVTOOLS__HOOK__&&Object.assign(window.__GEM_DEVTOOLS__HOOK__,Object.assign({},n));var Ge,Be,Fe,Ke,ze=function(t,e,n,s){var o,i=arguments.length,r=i<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,n):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,n,s);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(i<3?o(r):i>3?o(e,n,r):o(e,n))||r);return i>3&&r&&Object.defineProperty(e,n,r),r},Je=function(t,e,n,s,o){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===s?o.call(t,n):o?o.value=n:e.set(t,n),n},Qe=function(t,e,n,s){if("a"===n&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!s:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?s:"a"===n?s.call(t):s?s.value:e.get(t)};class Ze extends RegExp{constructor(t){const e={};let n=0;super(`^${t.replace(/:([^/$]+)/g,((t,s)=>(e[s]=n++,"([^/]+)"))).replace("*",".*")}$`,"i"),this.namePosition=e}}function Xe(t,e){const n=new Ze(t),s=e.match(n)||`${e}/`.match(n);if(!s)return null;const o={};return s&&Object.keys(n.namePosition).forEach((t=>{o[t]=s[n.namePosition[t]+1]})),o}function Ye(t,e){let n=t.pattern;const s=null==e?void 0:e.params;return s&&Object.keys(s).forEach((t=>{n=n.replace(new RegExp(`:${t}`,"g"),s[t])})),n}function tn(t,e){const n=Ye(t,e);return Object.assign({path:n},e)}let en=Ke=class extends ye{constructor({isLight:t,routes:e}={}){super({isLight:t}),this.currentParams={},Ge.set(this,void 0),this.state={content:void 0},Be.set(this,(()=>{if(this.locationStore){const{path:t,query:e,data:n}=R.getParams();N(this.locationStore,{path:t,params:this.currentParams,query:e,data:n})}})),Fe.set(this,((t,e,n)=>{Je(this,Ge,void 0,"f"),this.currentRoute=t,this.currentParams=e,this.setState({content:n}),this.change(this.currentRoute);const s=null==t?void 0:t.title;s&&N(Q,{title:s}),Qe(this,Be,"f").call(this)})),this.routes=e}mounted(){this.effect((([t,e])=>{const{route:n,params:s={}}=Ke.findRoute(this.routes,e),{redirect:o,content:i,getContent:r}=n||{};if(o)return void R.replace({path:o});const a=i||(null==r?void 0:r(s));if(a instanceof Promise){this.loading(n),Je(this,Ge,a,"f");const t=()=>Qe(this,Ge,"f")===a;a.then((e=>{t()&&Qe(this,Fe,"f").call(this,n,s,e)})).catch((e=>{t()&&this.error(e)}))}else Qe(this,Fe,"f").call(this,n,s,a)}),(()=>{const{path:t}=R.getParams();return[this.key,t]})),this.effect(Qe(this,Be,"f"),(()=>[location.search]))}shouldUpdate(){return!this.inert}render(){const{content:t}=this.state;return this.shadowRoot?At`
2
+ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.Gem=e():t.Gem=e()}(self,(function(){return(()=>{"use strict";var t={d:(e,n)=>{for(var s in n)t.o(n,s)&&!t.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:n[s]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{DialogBaseElement:()=>Mn,GemActiveLinkElement:()=>dn,GemElement:()=>_e,GemError:()=>k,GemLightRouteElement:()=>ln,GemLinkElement:()=>un,GemReflectElement:()=>En,GemRouteElement:()=>cn,GemTitleElement:()=>mn,GemUnsafeElement:()=>bn,GemUseElement:()=>yn,I18n:()=>Dn,LinkedList:()=>d,PropProxyMap:()=>p,QueryString:()=>f,SVGTemplateResult:()=>Et,SheetToken:()=>v,StoreListenerMap:()=>N,TemplateResult:()=>St,absoluteLocation:()=>u,addMicrotask:()=>a,addMicrotaskToStack:()=>h,adoptedStyle:()=>Be,attribute:()=>Ae,basePathStore:()=>X,boolattribute:()=>Re,camelToKebabCase:()=>x,classMap:()=>$,cleanObject:()=>P,connect:()=>R,connectStore:()=>Fe,createCSSSheet:()=>y,createHistoryParams:()=>an,createModalClass:()=>_n,createPath:()=>rn,createStore:()=>L,createStoreSet:()=>j,createTheme:()=>Rn,css:()=>g,customElement:()=>ze,defineAttribute:()=>ke,defineCSSState:()=>$e,defineProperty:()=>Te,defineRef:()=>Ce,del:()=>Kn,directive:()=>nt,disconnect:()=>H,emitter:()=>qe,get:()=>Fn,getThemeProp:()=>An,getThemeStore:()=>Ln,globalemitter:()=>Ue,guard:()=>Qt,history:()=>W,html:()=>It,ifDefined:()=>Xt,isArrayChange:()=>O,kebabToCamelCase:()=>_,matchPath:()=>on,mediaQuery:()=>Qn,nativeDefineElement:()=>Me,numattribute:()=>He,part:()=>De,partMap:()=>M,post:()=>Jn,property:()=>We,put:()=>zn,randomStr:()=>w,raw:()=>m,refobject:()=>Le,removeItems:()=>T,render:()=>Wt,repeat:()=>zt,request:()=>Un,rootElement:()=>Ke,slot:()=>Ve,state:()=>Ie,styleMap:()=>C,styled:()=>E,svg:()=>Vt,titleStore:()=>Y,updateStore:()=>A,updateTheme:()=>Hn,version:()=>Je});var n={};t.r(n),t.d(n,{GemElement:()=>_e,GemError:()=>k,LinkedList:()=>d,PropProxyMap:()=>p,QueryString:()=>f,SVGTemplateResult:()=>Et,SheetToken:()=>v,StoreListenerMap:()=>N,TemplateResult:()=>St,absoluteLocation:()=>u,addMicrotask:()=>a,addMicrotaskToStack:()=>h,adoptedStyle:()=>Be,attribute:()=>Ae,basePathStore:()=>X,boolattribute:()=>Re,camelToKebabCase:()=>x,classMap:()=>$,cleanObject:()=>P,connect:()=>R,connectStore:()=>Fe,createCSSSheet:()=>y,createStore:()=>L,createStoreSet:()=>j,css:()=>g,customElement:()=>ze,defineAttribute:()=>ke,defineCSSState:()=>$e,defineProperty:()=>Te,defineRef:()=>Ce,directive:()=>nt,disconnect:()=>H,emitter:()=>qe,globalemitter:()=>Ue,guard:()=>Qt,history:()=>W,html:()=>It,ifDefined:()=>Xt,isArrayChange:()=>O,kebabToCamelCase:()=>_,nativeDefineElement:()=>Me,numattribute:()=>He,part:()=>De,partMap:()=>M,property:()=>We,randomStr:()=>w,raw:()=>m,refobject:()=>Le,removeItems:()=>T,render:()=>Wt,repeat:()=>zt,rootElement:()=>Ke,slot:()=>Ve,state:()=>Ie,styleMap:()=>C,styled:()=>E,svg:()=>Vt,titleStore:()=>Y,updateStore:()=>A,version:()=>Je});var s,i,o=function(t,e,n,s){if("a"===n&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!s:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?s:"a"===n?s.call(t):s?s.value:e.get(t)};const r=new Set;function a(t){"function"==typeof t&&(r.size||globalThis.queueMicrotask((()=>{r.forEach((t=>t())),r.clear()})),r.delete(t),r.add(t))}const c=[];function l(){for(let t=c.length-1;t>=0;t--)c[t]();c.length=0}function h(t){c.length||a(l),c.push(t)}function u(t="",e=""){const{pathname:n,search:s,hash:i}=new URL(e,location.origin+t);return n+s+i}class d extends(globalThis.EventTarget||Object){constructor(){super(...arguments),this.pool=new Map}add(t){const e={value:t};this.firstItem||(this.dispatchEvent(new CustomEvent("start")),this.firstItem=e),this.lastItem&&(this.lastItem.next=e,e.prev=this.lastItem),this.lastItem=e;const n=this.pool.get(t);n&&(n.prev?n.prev.next=n.next:this.firstItem=n.next,n.next&&(n.next.prev=n.prev)),this.pool.set(t,e)}get(){const t=this.firstItem;if(t)return this.pool.delete(t.value),this.firstItem=t.next,this.firstItem||(this.lastItem=void 0,this.dispatchEvent(new CustomEvent("end"))),t.value}}class p extends WeakMap{get(t){let e=super.get(t);return e||(e={},this.set(t,e)),e}}class f extends URLSearchParams{constructor(t){super(t),s.set(this,(t=>"string"==typeof t?t:JSON.stringify(t))),i.set(this,(t=>{if(!t)return null;try{return JSON.parse(t)}catch(t){return null}}))}concat(t){let e;e="string"==typeof t?Object.fromEntries(new URLSearchParams(t).entries()):t,Object.keys(e).forEach((t=>{this.append(t,e[t])}))}setAny(t,e){if(Array.isArray(e))this.delete(t),e.forEach((e=>this.append(t,o(this,s,"f").call(this,e))));else{const n=o(this,s,"f").call(this,e);n?this.set(t,n):this.delete(t)}}getAny(t){return this.getAnyAll(t)[0]}getAnyAll(t){return this.getAll(t).filter((t=>""!==t)).map((t=>o(this,i,"f").call(this,t)))}toString(){const t=super.toString();return t?`?${t}`:""}toJSON(){return this.toString()}}function m(t,...e){return t.reduce(((t,n,s)=>{var i;return t+(null!==(i=e[s-1])&&void 0!==i?i:"")+n}))}function g(t,...e){return m(t,...e)}s=new WeakMap,i=new WeakMap;const v=Symbol("sheet token");function y(t,e=""){const n=new CSSStyleSheet,s={};n.media.mediaText=e;let i="";return"string"==typeof t?i=t:Object.keys(t).forEach((e=>{s[e]=`${e}-${w()}`,i+=t[e].styledContent.replace(/&/g,s[e])})),n.replaceSync(i),s[v]=n,s}function w(t=5,e="0123456789abcdefghijklmnopqrstuvwxyz"){const n=e.length;let s="";for(let i=0;i<t;i++)s+=e[Math.floor(Math.random()*n)];return s}const b=new RegExp("&.*{((.|\n)*)}","g");function S(t,e){const n=[];let s=`& {${t.replace(b,(t=>(n.push(t),"")))}}`+n.join("");return s=s.replace(/&/g,"class"===e?".&":"#&"),{styledContent:s,type:e}}const E={class:(t,...e)=>S(m(t,...e),"class"),id:(t,...e)=>S(m(t,...e),"id"),keyframes:(t,...e)=>({styledContent:`@keyframes & {${m(t,...e)}}`,type:"keyframes"})};function x(t){return t.replace(/[A-Z]/g,(t=>"-"+t.toLowerCase()))}function _(t){return t.replace(/-(.)/g,((t,e)=>e.toUpperCase()))}function P(t){return Object.keys(t).forEach((e=>{delete t[e]})),t}class k extends Error{constructor(t){super(t),this.message=`gem: ${this.message}`}}function O(t,e){const n=t.length;for(let s=0;s<n;s++)if(t[s]!==e[s])return!0;return!1}function T(t,e){const n=new Set(e);return t.filter((t=>!n.has(t)||(n.delete(t),!1)))}function C(t){let e="";for(const n in t)t[n]&&(e+=`${x(n)}:${t[n]};`);return e}function $(t){let e=" ";for(const n in t)t[n]&&(e+=`${n} `);return e}const M=$,N=new WeakMap;function L(t){if(N.has(t))throw new k("argument error");return N.set(t,new Set),t}function j(t){return Object.keys(t).forEach((e=>{L(t[e])})),t}function A(t,e){Object.assign(t,e);const n=N.get(t);null==n||n.forEach((t=>{a(t)}))}function R(t,e){const n=N.get(t);null==n||n.add(e)}function H(t,e){const n=N.get(t);null==n||n.delete(e)}const W=window.history,I=window.location,V=W.pushState.bind(W),D=W.replaceState.bind(W);let q=0;const U=()=>`${performance.now()}-${++q}`,G=L({$hasCloseHandle:!1,$hasOpenHandle:!1,$hasShouldCloseHandle:!1,$key:""}),B=new Map;function F({$key:t,$hasCloseHandle:e,$hasOpenHandle:n,$hasShouldCloseHandle:s}={}){if(G.$key!==t){if(t)throw new k("`$key` is not allowed");if(e)throw new k("`$hasCloseHandle` is not allowed");if(n)throw new k("`$hasOpenHandle` is not allowed");if(s)throw new k("`$hasShouldCloseHandle` is not allowed")}}function K(t){return W.basePath?W.basePath+t:t}function z(t){return t===W.basePath?"/":t.replace(new RegExp(`^${W.basePath}/`),"/")}function J(t){const e=B.get(G.$key)||{},n=t.path?u(e.path,t.path):z(I.pathname),s=new f(t.query||(t.path?"":I.search)),i=t.path&&t.path!==e.path||t.query&&String(t.query)!==String(e.query),o=t.title||"",r=t.close||t.data||t.open||t.shouldClose,a=t.hash||(!i&&r?decodeURIComponent(I.hash):"");return Object.assign(Object.assign({},t),{title:o,path:n,query:s,hash:a})}function Q(t,e){F(e.data);const n=J(e),{title:s,path:i,query:o,hash:r,close:a,open:c,shouldClose:l,data:h}=n,u=Object.assign({$hasCloseHandle:!!a,$hasOpenHandle:!!c,$hasShouldCloseHandle:!!l,$key:U()},h);B.set(u.$key,n),A(P(G),u);const d=K(i)+new f(o)+r,p=decodeURIComponent(I.hash);("push"===t?V:D)(u,s,d),p!==r&&window.dispatchEvent(new CustomEvent("hashchange"))}function Z(t,e,n,s){F(e);const i=Object.assign({$key:U()},e||{}),{pathname:o,search:r,hash:a}=new URL(s,I.origin+I.pathname),c=J({path:o,query:new f(r),hash:a,title:n,data:e});B.set(i.$key,c),A(P(G),i);const l=K(o)+c.query+a,h=I.hash;("push"===t?V:D)(i,n,l),h!==a&&window.dispatchEvent(new CustomEvent("hashchange"))}const X=L({basePath:""});if(window.addEventListener("hashchange",(({isTrusted:t})=>{t&&W.replace({hash:decodeURIComponent(I.hash)})})),Object.defineProperties(W,{basePath:{get:()=>X.basePath,set(t){A(X,{basePath:t}),Object.assign(B.get(G.$key),{path:z(I.pathname)})}},getParams:{value:function(){return B.get(G.$key)}},updateParams:{value:function(t){Object.assign(B.get(G.$key),t),A(G,{})}},store:{value:G},push:{value:function(t){W.pushState(t,"")}},pushIgnoreCloseHandle:{value:function(t){var e,n;G.$hasCloseHandle?(null===(n=null===(e=B.get(G.$key))||void 0===e?void 0:e.close)||void 0===n||n.call(e),W.replace(t)):W.push(t)}},replace:{value:function(t){Q("replace",t)}}}),W.pushState=function(t,e,n){n?Z("push",t,e,n):Q("push",t)},W.replaceState=function(t,e,n){Z("replace",t,e,n)},W.state)if(W.state.$hasCloseHandle){A(G,W.state);const t=J({title:document.title});B.set(G.$key,t),W.back()}else{const t=J({title:document.title,hash:I.hash});A(G,Object.assign({$key:U()},W.state||{})),B.set(G.$key,t)}else{const{pathname:t,search:e,hash:n}=I;W.replace({path:t,query:e,hash:n})}const Y=L({title:""});R(Y,(()=>{const t=B.get(G.$key);t&&(t.title=Y.title)})),R(G,(()=>{const{title:t}=W.getParams();t!==Y.title&&A(Y,{title:t})}));let tt=!1;window.addEventListener("popstate",(t=>{var e,n;const s=t.state;if(!(null==s?void 0:s.$key))return;if(tt)return void(tt=!1);if(!B.has(s.$key)){const{pathname:t,search:e,hash:n}=I;B.set(s.$key,{path:t,query:new f(e),hash:n,title:document.title,data:s})}const i=G;if(parseFloat(s.$key)>parseFloat(i.$key)&&s.$hasOpenHandle)null===(n=null===(e=B.get(s.$key))||void 0===e?void 0:e.open)||void 0===n||n.call(e);else if(i.$hasCloseHandle){const t=B.get(i.$key),e=null==t?void 0:t.close,n=null==t?void 0:t.shouldClose;if(n&&!n())return tt=!0,void W.forward();e?e():s.$hasCloseHandle&&(tt=!0,W.back())}A(P(G),s)}));const et=new WeakMap,nt=t=>(...e)=>{const n=t(...e);return et.set(n,!0),n},st=t=>"function"==typeof t&&et.has(t),it="undefined"!=typeof window&&null!=window.customElements&&void 0!==window.customElements.polyfillWrapFlushCallback,ot=(t,e,n=null,s=null)=>{for(;e!==n;){const n=e.nextSibling;t.insertBefore(e,s),e=n}},rt=(t,e,n=null)=>{for(;e!==n;){const n=e.nextSibling;t.removeChild(e),e=n}},at={},ct={},lt=`{{lit-${String(Math.random()).slice(2)}}}`,ht=`\x3c!--${lt}--\x3e`,ut=new RegExp(`${lt}|${ht}`),dt="$lit$";class pt{constructor(t,e){this.parts=[],this.element=e;const n=[],s=[],i=document.createTreeWalker(e.content,133,null,!1);let o=0,r=-1,a=0;const{strings:c,values:{length:l}}=t;for(;a<l;){const t=i.nextNode();if(null!==t){if(r++,1===t.nodeType){if(t.hasAttributes()){const e=t.attributes,{length:n}=e;let s=0;for(let t=0;t<n;t++)ft(e[t].name,dt)&&s++;for(;s-- >0;){const e=c[a],n=vt.exec(e)[2],s=n.toLowerCase()+dt,i=t.getAttribute(s);t.removeAttribute(s);const o=i.split(ut);this.parts.push({type:"attribute",index:r,name:n,strings:o}),a+=o.length-1}}"TEMPLATE"===t.tagName&&(s.push(t),i.currentNode=t.content)}else if(3===t.nodeType){const e=t.data;if(e.indexOf(lt)>=0){const s=t.parentNode,i=e.split(ut),o=i.length-1;for(let e=0;e<o;e++){let n,o=i[e];if(""===o)n=gt();else{const t=vt.exec(o);null!==t&&ft(t[2],dt)&&(o=o.slice(0,t.index)+t[1]+t[2].slice(0,-dt.length)+t[3]),n=document.createTextNode(o)}s.insertBefore(n,t),this.parts.push({type:"node",index:++r})}""===i[o]?(s.insertBefore(gt(),t),n.push(t)):t.data=i[o],a+=o}}else if(8===t.nodeType)if(t.data===lt){const e=t.parentNode;null!==t.previousSibling&&r!==o||(r++,e.insertBefore(gt(),t)),o=r,this.parts.push({type:"node",index:r}),null===t.nextSibling?t.data="":(n.push(t),r--),a++}else{let e=-1;for(;-1!==(e=t.data.indexOf(lt,e+1));)this.parts.push({type:"node",index:-1}),a++}}else i.currentNode=s.pop()}for(const t of n)t.parentNode.removeChild(t)}}const ft=(t,e)=>{const n=t.length-e.length;return n>=0&&t.slice(n)===e},mt=t=>-1!==t.index,gt=()=>document.createComment(""),vt=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/;class yt{constructor(t,e,n){this.__parts=[],this.template=t,this.processor=e,this.options=n}update(t){let e=0;for(const n of this.__parts)void 0!==n&&n.setValue(t[e]),e++;for(const t of this.__parts)void 0!==t&&t.commit()}_clone(){const t=it?this.template.element.content.cloneNode(!0):document.importNode(this.template.element.content,!0),e=[],n=this.template.parts,s=document.createTreeWalker(t,133,null,!1);let i,o=0,r=0,a=s.nextNode();for(;o<n.length;)if(i=n[o],mt(i)){for(;r<i.index;)r++,"TEMPLATE"===a.nodeName&&(e.push(a),s.currentNode=a.content),null===(a=s.nextNode())&&(s.currentNode=e.pop(),a=s.nextNode());if("node"===i.type){const t=this.processor.handleTextExpression(this.options);t.insertAfterNode(a.previousSibling),this.__parts.push(t)}else this.__parts.push(...this.processor.handleAttributeExpressions(a,i.name,i.strings,this.options));o++}else this.__parts.push(void 0),o++;return it&&(document.adoptNode(t),customElements.upgrade(t)),t}}const wt=window.trustedTypes&&trustedTypes.createPolicy("lit-html",{createHTML:t=>t}),bt=` ${lt} `;class St{constructor(t,e,n,s){this.strings=t,this.values=e,this.type=n,this.processor=s}getHTML(){const t=this.strings.length-1;let e="",n=!1;for(let s=0;s<t;s++){const t=this.strings[s],i=t.lastIndexOf("\x3c!--");n=(i>-1||n)&&-1===t.indexOf("--\x3e",i+1);const o=vt.exec(t);e+=null===o?t+(n?bt:ht):t.substr(0,o.index)+o[1]+o[2]+dt+o[3]+lt}return e+=this.strings[t],e}getTemplateElement(){const t=document.createElement("template");let e=this.getHTML();return void 0!==wt&&(e=wt.createHTML(e)),t.innerHTML=e,t}}class Et extends St{getHTML(){return`<svg>${super.getHTML()}</svg>`}getTemplateElement(){const t=super.getTemplateElement(),e=t.content,n=e.firstChild;return e.removeChild(n),ot(e,n.firstChild),t}}const xt=t=>null===t||!("object"==typeof t||"function"==typeof t),_t=t=>Array.isArray(t)||!(!t||!t[Symbol.iterator]);class Pt{constructor(t,e,n){this.dirty=!0,this.element=t,this.name=e,this.strings=n,this.parts=[];for(let t=0;t<n.length-1;t++)this.parts[t]=this._createPart()}_createPart(){return new kt(this)}_getValue(){const t=this.strings,e=t.length-1,n=this.parts;if(1===e&&""===t[0]&&""===t[1]){const t=n[0].value;if("symbol"==typeof t)return String(t);if("string"==typeof t||!_t(t))return t}let s="";for(let i=0;i<e;i++){s+=t[i];const e=n[i];if(void 0!==e){const t=e.value;if(xt(t)||!_t(t))s+="string"==typeof t?t:String(t);else for(const e of t)s+="string"==typeof e?e:String(e)}}return s+=t[e],s}commit(){this.dirty&&(this.dirty=!1,this.element.setAttribute(this.name,this._getValue()))}}class kt{constructor(t){this.value=void 0,this.committer=t}setValue(t){t===at||xt(t)&&t===this.value||(this.value=t,st(t)||(this.committer.dirty=!0))}commit(){for(;st(this.value);){const t=this.value;this.value=at,t(this)}this.value!==at&&this.committer.commit()}}class Ot{constructor(t){this.value=void 0,this.__pendingValue=void 0,this.options=t}appendInto(t){this.startNode=t.appendChild(gt()),this.endNode=t.appendChild(gt())}insertAfterNode(t){this.startNode=t,this.endNode=t.nextSibling}appendIntoPart(t){t.__insert(this.startNode=gt()),t.__insert(this.endNode=gt())}insertAfterPart(t){t.__insert(this.startNode=gt()),this.endNode=t.endNode,t.endNode=this.startNode}setValue(t){this.__pendingValue=t}commit(){if(null===this.startNode.parentNode)return;for(;st(this.__pendingValue);){const t=this.__pendingValue;this.__pendingValue=at,t(this)}const t=this.__pendingValue;t!==at&&(xt(t)?t!==this.value&&this.__commitText(t):t instanceof St?this.__commitTemplateResult(t):t instanceof Node?this.__commitNode(t):_t(t)?this.__commitIterable(t):t===ct?(this.value=ct,this.clear()):this.__commitText(t))}__insert(t){this.endNode.parentNode.insertBefore(t,this.endNode)}__commitNode(t){this.value!==t&&(this.clear(),this.__insert(t),this.value=t)}__commitText(t){const e=this.startNode.nextSibling,n="string"==typeof(t=null==t?"":t)?t:String(t);e===this.endNode.previousSibling&&3===e.nodeType?e.data=n:this.__commitNode(document.createTextNode(n)),this.value=t}__commitTemplateResult(t){const e=this.options.templateFactory(t);if(this.value instanceof yt&&this.value.template===e)this.value.update(t.values);else{const n=new yt(e,t.processor,this.options),s=n._clone();n.update(t.values),this.__commitNode(s),this.value=n}}__commitIterable(t){Array.isArray(this.value)||(this.value=[],this.clear());const e=this.value;let n,s=0;for(const i of t)n=e[s],void 0===n&&(n=new Ot(this.options),e.push(n),0===s?n.appendIntoPart(this):n.insertAfterPart(e[s-1])),n.setValue(i),n.commit(),s++;s<e.length&&(e.length=s,this.clear(n&&n.endNode))}clear(t=this.startNode){rt(this.startNode.parentNode,t.nextSibling,this.endNode)}}class Tt{constructor(t,e,n){if(this.value=void 0,this.__pendingValue=void 0,2!==n.length||""!==n[0]||""!==n[1])throw new Error("Boolean attributes can only contain a single expression");this.element=t,this.name=e,this.strings=n}setValue(t){this.__pendingValue=t}commit(){for(;st(this.__pendingValue);){const t=this.__pendingValue;this.__pendingValue=at,t(this)}if(this.__pendingValue===at)return;const t=!!this.__pendingValue;this.value!==t&&(t?this.element.setAttribute(this.name,""):this.element.removeAttribute(this.name),this.value=t),this.__pendingValue=at}}class Ct extends Pt{constructor(t,e,n){super(t,e,n),this.single=2===n.length&&""===n[0]&&""===n[1]}_createPart(){return new $t(this)}_getValue(){return this.single?this.parts[0].value:super._getValue()}commit(){this.dirty&&(this.dirty=!1,this.element[this.name]=this._getValue())}}class $t extends kt{}let Mt=!1;(()=>{try{const t={get capture(){return Mt=!0,!1}};window.addEventListener("test",t,t),window.removeEventListener("test",t,t)}catch(t){}})();class Nt{constructor(t,e,n){this.value=void 0,this.__pendingValue=void 0,this.element=t,this.eventName=e,this.eventContext=n,this.__boundHandleEvent=t=>this.handleEvent(t)}setValue(t){this.__pendingValue=t}commit(){for(;st(this.__pendingValue);){const t=this.__pendingValue;this.__pendingValue=at,t(this)}if(this.__pendingValue===at)return;const t=this.__pendingValue,e=this.value,n=null==t||null!=e&&(t.capture!==e.capture||t.once!==e.once||t.passive!==e.passive),s=null!=t&&(null==e||n);n&&this.element.removeEventListener(this.eventName,this.__boundHandleEvent,this.__options),s&&(this.__options=Lt(t),this.element.addEventListener(this.eventName,this.__boundHandleEvent,this.__options)),this.value=t,this.__pendingValue=at}handleEvent(t){"function"==typeof this.value?this.value.call(this.eventContext||this.element,t):this.value.handleEvent(t)}}const Lt=t=>t&&(Mt?{capture:t.capture,passive:t.passive,once:t.once}:t.capture),jt=new class{handleAttributeExpressions(t,e,n,s){const i=e[0];return"."===i?new Ct(t,e.slice(1),n).parts:"@"===i?[new Nt(t,e.slice(1),s.eventContext)]:"?"===i?[new Tt(t,e.slice(1),n)]:new Pt(t,e,n).parts}handleTextExpression(t){return new Ot(t)}};function At(t){let e=Rt.get(t.type);void 0===e&&(e={stringsArray:new WeakMap,keyString:new Map},Rt.set(t.type,e));let n=e.stringsArray.get(t.strings);if(void 0!==n)return n;const s=t.strings.join(lt);return n=e.keyString.get(s),void 0===n&&(n=new pt(t,t.getTemplateElement()),e.keyString.set(s,n)),e.stringsArray.set(t.strings,n),n}const Rt=new Map,Ht=new WeakMap,Wt=(t,e,n)=>{let s=Ht.get(e);void 0===s&&(rt(e,e.firstChild),Ht.set(e,s=new Ot(Object.assign({templateFactory:At},n))),s.appendInto(e)),s.setValue(t),s.commit()};"undefined"!=typeof window&&(window.litHtmlVersions||(window.litHtmlVersions=[])).push("1.4.1");const It=(t,...e)=>new St(t,e,"html",jt),Vt=(t,...e)=>new Et(t,e,"svg",jt),Dt=(t,e)=>{const n=t.startNode.parentNode,s=void 0===e?t.endNode:e.startNode,i=n.insertBefore(gt(),s);n.insertBefore(gt(),s);const o=new Ot(t.options);return o.insertAfterNode(i),o},qt=(t,e)=>(t.setValue(e),t.commit(),t),Ut=(t,e,n)=>{const s=t.startNode.parentNode,i=n?n.startNode:t.endNode,o=e.endNode.nextSibling;o!==i&&ot(s,e.startNode,o,i)},Gt=t=>{rt(t.startNode.parentNode,t.startNode,t.endNode.nextSibling)},Bt=(t,e,n)=>{const s=new Map;for(let i=e;i<=n;i++)s.set(t[i],i);return s},Ft=new WeakMap,Kt=new WeakMap,zt=nt(((t,e,n)=>{let s;return void 0===n?n=e:void 0!==e&&(s=e),e=>{if(!(e instanceof Ot))throw new Error("repeat can only be used in text bindings");const i=Ft.get(e)||[],o=Kt.get(e)||[],r=[],a=[],c=[];let l,h,u=0;for(const e of t)c[u]=s?s(e,u):u,a[u]=n(e,u),u++;let d=0,p=i.length-1,f=0,m=a.length-1;for(;d<=p&&f<=m;)if(null===i[d])d++;else if(null===i[p])p--;else if(o[d]===c[f])r[f]=qt(i[d],a[f]),d++,f++;else if(o[p]===c[m])r[m]=qt(i[p],a[m]),p--,m--;else if(o[d]===c[m])r[m]=qt(i[d],a[m]),Ut(e,i[d],r[m+1]),d++,m--;else if(o[p]===c[f])r[f]=qt(i[p],a[f]),Ut(e,i[p],i[d]),p--,f++;else if(void 0===l&&(l=Bt(c,f,m),h=Bt(o,d,p)),l.has(o[d]))if(l.has(o[p])){const t=h.get(c[f]),n=void 0!==t?i[t]:null;if(null===n){const t=Dt(e,i[d]);qt(t,a[f]),r[f]=t}else r[f]=qt(n,a[f]),Ut(e,n,i[d]),i[t]=null;f++}else Gt(i[p]),p--;else Gt(i[d]),d++;for(;f<=m;){const t=Dt(e,r[m+1]);qt(t,a[f]),r[f++]=t}for(;d<=p;){const t=i[d++];null!==t&&Gt(t)}Ft.set(e,r),Kt.set(e,c)}})),Jt=new WeakMap,Qt=nt(((t,e)=>n=>{const s=Jt.get(n);if(Array.isArray(t)){if(Array.isArray(s)&&s.length===t.length&&t.every(((t,e)=>t===s[e])))return}else if(s===t&&(void 0!==t||Jt.has(n)))return;n.setValue(e()),Jt.set(n,Array.isArray(t)?Array.from(t):t)})),Zt=new WeakMap,Xt=nt((t=>e=>{const n=Zt.get(e);if(void 0===t&&e instanceof kt){if(void 0!==n||!Zt.has(e)){const t=e.committer.name;e.committer.element.removeAttribute(t)}}else t!==n&&e.setValue(t);Zt.set(e,t)}));var Yt,te,ee,ne,se,ie,oe,re,ae,ce,le,he,ue,de,pe,fe,me,ge=function(t,e,n,s){if("a"===n&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!s:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?s:"a"===n?s.call(t):s?s.value:e.get(t)},ve=function(t,e,n,s,i){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===s?i.call(t,n):i?i.value=n:e.set(t,n),n};function ye(){}function we(t){"function"==typeof t&&t()}const be=new d,Se=()=>{window.requestAnimationFrame((function t(e){if(performance.now()>e+16)return void Se();const n=be.get();n&&(n(),t(e))}))};be.addEventListener("start",Se);const Ee=Symbol("init"),xe=Symbol("update");class _e extends HTMLElement{constructor({isAsync:t,isLight:e,delegatesFocus:n}={}){super(),Yt.set(this,void 0),te.set(this,void 0),ee.set(this,void 0),ne.set(this,void 0),se.set(this,void 0),ie.set(this,void 0),oe.set(this,void 0),this.setState=t=>{if(!this.state)throw new k("`state` not initialized");Object.assign(this.state,t),a(ge(this,pe,"f"))},re.set(this,(t=>{null==t||t.forEach((t=>{const{callback:e,getDep:n,values:s,preCallback:i}=t,o=null==n?void 0:n();n&&!O(s,o)||(we(i),t.preCallback=e(o,s),t.values=o)}))})),ae.set(this,(()=>{ge(this,re,"f").call(this,ge(this,se,"f"))})),ce.set(this,(()=>{ge(this,re,"f").call(this,ge(this,ie,"f"))})),this.effect=(t,e)=>{ge(this,se,"f")||ve(this,se,[],"f");const n=null==e?void 0:e(),s={callback:t,getDep:e,values:n,initialized:!!this.isConnected};this.isConnected&&(s.preCallback=t(n)),ge(this,se,"f").push(s)},this.memo=(t,e)=>{ge(this,ie,"f")||ve(this,ie,[],"f"),ge(this,ie,"f").push({callback:t,getDep:e,values:[Symbol()],initialized:this.isConnected})},le.set(this,(()=>{var t;null===(t=ge(this,se,"f"))||void 0===t||t.forEach((t=>{const{callback:e,getDep:n,initialized:s}=t;s||(t.preCallback=e(null==n?void 0:n()),t.initialized=!0)}))})),he.set(this,(()=>(ge(this,ce,"f").call(this),this.render?this.render():ge(this,Yt,"f")===this?void 0:It`<slot></slot>`))),ue.set(this,(()=>!this.shouldUpdate||this.shouldUpdate())),de.set(this,(()=>{if(this.isConnected&&ge(this,ue,"f").call(this)){const t=ge(this,he,"f").call(this);void 0!==t&&Wt(t,ge(this,Yt,"f")),a(ge(this,fe,"f")),a(ge(this,ae,"f"))}})),pe.set(this,(()=>{ge(this,ne,"f")?be.add(ge(this,de,"f")):ge(this,de,"f").call(this)})),this.update=()=>{a(ge(this,pe,"f"))},fe.set(this,(()=>{var t;null===(t=this.updated)||void 0===t||t.call(this)})),me.set(this,(()=>{var t,e,n;if(ge(this,ee,"f"))return void ve(this,ee,!1,"f");null===(t=this.willMount)||void 0===t||t.call(this);const{observedStores:s,rootElement:i}=this.constructor;null==s||s.forEach((t=>{R(t,ge(this,pe,"f"))}));const o=ge(this,he,"f").call(this);if(void 0!==o&&Wt(o,ge(this,Yt,"f")),ve(this,oe,null===(e=this.mounted)||void 0===e?void 0:e.call(this),"f"),ge(this,le,"f").call(this),i&&(null===(n=this.getRootNode().host)||void 0===n?void 0:n.tagName)!==i.toUpperCase())throw new k("not allow current root type")})),a((()=>this[Ee]=!1)),this[Ee]=!0,this[xe]=()=>{this.isConnected&&a(ge(this,pe,"f"))},ve(this,ne,t,"f"),ve(this,Yt,e?this:this.attachShadow({mode:"open",delegatesFocus:n}),"f");const{adoptedStyleSheets:s}=new.target;if(s){const t=s.map((t=>t[v]||t));this.shadowRoot?this.shadowRoot.adoptedStyleSheets=t:this.effect((()=>{const e=this.getRootNode();return e.adoptedStyleSheets=[...e.adoptedStyleSheets,...t],()=>{e.adoptedStyleSheets=T(e.adoptedStyleSheets,t)}}),(()=>[]))}}get internals(){if(!ge(this,te,"f")){const t=()=>{const{classList:t}=this;return{has:e=>t.contains(e),add:e=>t.add(e),delete:e=>t.remove(e)}};this.attachInternals||(this.attachInternals=()=>({states:t()})),ve(this,te,this.attachInternals(),"f"),ge(this,te,"f").states||(ge(this,te,"f").states=t())}return ge(this,te,"f")}attributeChangedCallback(){this.isConnected&&a(ge(this,pe,"f"))}closestElement(t){const e="function"==typeof t,n="string"==typeof t&&t.toUpperCase(),s=i=>{const o=i.parentElement||i.getRootNode().host;if(!o)return null;if(e){if(o.constructor===t)return o}else if(o.tagName===n)return o;return s(o)};return s(this)}connectedCallback(){ge(this,ne,"f")?be.add(ge(this,me,"f")):ge(this,me,"f").call(this)}disconnectedCallback(){var t,e,n;if(this.isConnected)return void ve(this,ee,!0,"f");const{observedStores:s}=this.constructor;null==s||s.forEach((t=>{H(t,ge(this,pe,"f"))})),we(ge(this,oe,"f")),null===(t=this.unmounted)||void 0===t||t.call(this),null===(e=ge(this,se,"f"))||void 0===e||e.forEach((t=>{we(t.preCallback)})),ve(this,ie,null===(n=ge(this,ie,"f"))||void 0===n?void 0:n.filter((({initialized:t})=>!t)),"f")}}Yt=new WeakMap,te=new WeakMap,ee=new WeakMap,ne=new WeakMap,se=new WeakMap,ie=new WeakMap,oe=new WeakMap,re=new WeakMap,ae=new WeakMap,ce=new WeakMap,le=new WeakMap,he=new WeakMap,ue=new WeakMap,de=new WeakMap,pe=new WeakMap,fe=new WeakMap,me=new WeakMap;const Pe=new p;function ke(t,e,n){const{booleanAttributes:s,numberAttributes:i}=t.constructor;Object.defineProperty(t,e,{configurable:!0,get(){if(!(Ee in this))return;const t=this.getAttribute(n);return(null==s?void 0:s.has(n))?null!==t:(null==i?void 0:i.has(n))?Number(t):t||""},set(t){const i=this,o=Pe.get(this),r=o[e],a=i.getAttribute(n);if(this[Ee]&&null!==a&&!r)return;o[e]=!0;const c=null==s?void 0:s.has(n);null==t?i.removeAttribute(n):c?i.toggleAttribute(n,!!t):a!==String(t)&&i.setAttribute(n,String(t))}})}const Oe=Symbol("event handle");function Te(t,e,n,s){Object.defineProperty(t,e,{configurable:!0,get(){const t=Pe.get(this)[e];return t||!n?t:(this[e]=ye,this[e])},set(t){const i=this,o=Pe.get(i);t!==o[e]&&(n?(o[e]=(null==t?void 0:t[Oe])?t:(e,o)=>{const r=new CustomEvent(n,Object.assign(Object.assign(Object.assign({},o),s),{detail:e}));i.dispatchEvent(r),t(e,o)},o[e][Oe]=!0):(o[e]=t,this[xe]()))}})}function Ce(t,e,n){Object.defineProperty(t,e,{configurable:!0,get(){const t=Pe.get(this);let s=t[e];if(!s){const i=this,o=i.shadowRoot||i;s={get ref(){return n},get element(){const t=[...o.querySelectorAll("gem-reflect")].map((t=>t.target));for(const e of[o,...t]){const t=e.querySelector(`[ref=${n}]`);if(t)return t}}},t[e]=s}return s}})}function $e(t,e,n){Object.defineProperty(t,e,{configurable:!0,get(){var t;const{states:e}=this.internals;return null===(t=e.has)||void 0===t?void 0:t.call(e,n)},set(t){const{states:e}=this.internals;t?e.add(n):e.delete(n)}})}const Me=customElements.define.bind(customElements);function Ne(t,e,n,s=!1){const i=t.constructor,o=i[e];i.hasOwnProperty(e)||Object.defineProperty(i,e,{value:s?new Set(o):o?Array.from(o):[]}),i[e][s?"add":"push"](n)}function Le(t,e){const n=`${x(e)}-${w()}`;Ne(t,"defineRefs",n),Ce(t,e,n)}function je(t,e,n){Ne(t,"observedAttributes",n),ke(t,e,n)}function Ae(t,e){je(t,e,x(e))}function Re(t,e){const n=x(e);Ne(t,"booleanAttributes",n,!0),je(t,e,n)}function He(t,e){const n=x(e);Ne(t,"numberAttributes",n,!0),je(t,e,n)}function We(t,e){Ne(t,"observedPropertys",e),Te(t,e)}function Ie(t,e){const n=x(e);Ne(t,"defineCSSStates",n),$e(t,e,`--${n}`)}function Ve(t,e){const n=x(t[e]||e);t[e]=n,Ne(t instanceof _e?t:t.prototype,"defineSlots",n)}function De(t,e){const n=x(t[e]||e);t[e]=n,Ne(t instanceof _e?t:t.prototype,"defineParts",n)}function qe(t,e){Ge(t,e)}function Ue(t,e){Ge(t,e,{bubbles:!0,composed:!0})}function Ge(t,e,n){const s=x(e);Ne(t,"defineEvents",s),Te(t,e,s,n)}function Be(t){return function(e){Ne(e.prototype,"adoptedStyleSheets",t)}}function Fe(t){return function(e){Ne(e.prototype,"observedStores",t)}}function Ke(t){return function(e){e.rootElement=t}}function ze(t){return function(e){Me(t,e)}}customElements.define=(t,e,n)=>{if(e.prototype instanceof _e){const{observedAttributes:t,observedPropertys:n,defineEvents:s,defineCSSStates:i,defineRefs:o}=e;null==t||t.forEach((t=>ke(e.prototype,_(t),t))),null==n||n.forEach((t=>Te(e.prototype,t))),null==s||s.forEach((t=>Te(e.prototype,_(t),t))),null==i||i.forEach((t=>$e(e.prototype,_(t),`--${t}`))),null==o||o.forEach((t=>Ce(e.prototype,_(t),t)))}Me(t,e,n)};const Je="1.5.3";window.__GEM_DEVTOOLS__HOOK__&&Object.assign(window.__GEM_DEVTOOLS__HOOK__,Object.assign({},n));var Qe,Ze,Xe,Ye,tn=function(t,e,n,s){var i,o=arguments.length,r=o<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,n):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,n,s);else for(var a=t.length-1;a>=0;a--)(i=t[a])&&(r=(o<3?i(r):o>3?i(e,n,r):i(e,n))||r);return o>3&&r&&Object.defineProperty(e,n,r),r},en=function(t,e,n,s,i){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===s?i.call(t,n):i?i.value=n:e.set(t,n),n},nn=function(t,e,n,s){if("a"===n&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!s:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?s:"a"===n?s.call(t):s?s.value:e.get(t)};class sn extends RegExp{constructor(t){const e={};let n=0;super(`^${t.replace(/:([^/$]+)/g,((t,s)=>(e[s]=n++,"([^/]+)"))).replace("*",".*")}$`,"i"),this.namePosition=e}}function on(t,e){const n=new sn(t),s=e.match(n)||`${e}/`.match(n);if(!s)return null;const i={};return s&&Object.keys(n.namePosition).forEach((t=>{i[t]=s[n.namePosition[t]+1]})),i}function rn(t,e){let n=t.pattern;const s=null==e?void 0:e.params;return s&&Object.keys(s).forEach((t=>{n=n.replace(new RegExp(`:${t}`,"g"),s[t])})),n}function an(t,e){const n=rn(t,e);return Object.assign({path:n},e)}let cn=Ye=class extends _e{constructor({isLight:t,routes:e}={}){super({isLight:t}),this.currentParams={},Qe.set(this,void 0),this.state={content:void 0},Ze.set(this,(()=>{if(this.locationStore){const{path:t,query:e,data:n}=W.getParams();A(this.locationStore,{path:t,params:this.currentParams,query:e,data:n})}})),Xe.set(this,((t,e,n)=>{en(this,Qe,void 0,"f"),this.currentRoute=t,this.currentParams=e,this.setState({content:n}),this.change(this.currentRoute);const s=null==t?void 0:t.title;s&&A(Y,{title:s}),nn(this,Ze,"f").call(this)})),this.routes=e}mounted(){this.effect((([t,e])=>{const{route:n,params:s={}}=Ye.findRoute(this.routes,e),{redirect:i,content:o,getContent:r}=n||{};if(i)return void W.replace({path:i});const a=o||(null==r?void 0:r(s));if(a instanceof Promise){this.loading(n),en(this,Qe,a,"f");const t=()=>nn(this,Qe,"f")===a;a.then((e=>{t()&&nn(this,Xe,"f").call(this,n,s,e)})).catch((e=>{t()&&this.error(e)}))}else nn(this,Xe,"f").call(this,n,s,a)}),(()=>{const{path:t}=W.getParams();return[this.key,t]})),this.effect(nn(this,Ze,"f"),(()=>[location.search]))}shouldUpdate(){return!this.inert}render(){const{content:t}=this.state;return this.shadowRoot?It`
3
3
  <style>
4
4
  :host,
5
5
  :not(:defined) {
@@ -7,7 +7,7 @@
7
7
  }
8
8
  </style>
9
9
  ${t}
10
- `:At`${t}`}};Ge=new WeakMap,Be=new WeakMap,Fe=new WeakMap,en.createLocationStore=()=>{const{path:t,query:e,data:n}=R.getParams();return $({path:t,query:e,data:n,params:{}})},en.findRoute=(t=[],e)=>{let n,s=null;n=t instanceof Array?t:Object.values(t);for(const t of n)if("*"===t.pattern)s=t;else{const n=Xe(t.pattern,e);if(n)return{route:t,params:n}}return{route:s}},ze([Ne],en.prototype,"routes",void 0),ze([Ne],en.prototype,"locationStore",void 0),ze([Ne],en.prototype,"key",void 0),ze([Ae],en.prototype,"change",void 0),ze([Ae],en.prototype,"loading",void 0),ze([Ae],en.prototype,"error",void 0),en=Ke=ze([Ve(R.store),qe("gem-route")],en);let nn=class extends en{constructor(t={}){super(Object.assign(Object.assign({},t),{isLight:!0}))}};nn=ze([qe("gem-light-route")],nn);var sn=function(t,e,n,s){var o,i=arguments.length,r=i<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,n):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,n,s);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(i<3?o(r):i>3?o(e,n,r):o(e,n))||r);return i>3&&r&&Object.defineProperty(e,n,r),r};let on=class extends ye{constructor(){super(),this.clickHandle=t=>{return e=this,n=void 0,o=function*(){var e;const n=this.getPathInfo();if(!n)return;if(this.isExternal(n))switch(this.target){case"_self":return void(window.location.href=n);case"_parent":return void(window.parent.location.href=n);case"_top":return void(window.top.location.href=n);default:return void window.open(n)}const{path:s,query:o,hash:i}=R.getParams();if(s+o+i!==n)if(t.stopPropagation(),yield null===(e=this.prepare)||void 0===e?void 0:e.call(this),this.route)R.pushIgnoreCloseHandle(Object.assign(Object.assign({},tn(this.route,this.options)),{title:this.route.title||this.docTitle}));else if(this.href){const{pathname:t,search:e,hash:s}=new URL(n,location.origin);R.pushIgnoreCloseHandle({path:t,query:e,hash:decodeURIComponent(s),title:this.docTitle})}else R.pushIgnoreCloseHandle({path:this.path,query:this.query,hash:this.hash,title:this.docTitle})},new((s=void 0)||(s=Promise))((function(t,i){function r(t){try{c(o.next(t))}catch(t){i(t)}}function a(t){try{c(o.throw(t))}catch(t){i(t)}}function c(e){var n;e.done?t(e.value):(n=e.value,n instanceof s?n:new s((function(t){t(n)}))).then(r,a)}c((o=o.apply(e,n||[])).next())}));var e,n,s,o},this.preventDefault=t=>{t.preventDefault()},this.addEventListener("click",this.clickHandle)}getPathInfo(){var t,e;if(this.route){const n=(null===(t=this.options)||void 0===t?void 0:t.query)||"",s=(null===(e=this.options)||void 0===e?void 0:e.hash)||"";return Ye(this.route,this.options)+n+s}{const t=this.href||this.path+this.query+this.hash,{path:e,query:n}=R.getParams();return t.startsWith("#")?`${e}${n}${t}`:t.startsWith("?")?`${e}${t}`:t.startsWith(".")?c(e,t):t}}isExternal(t){return!t.startsWith("/")}render(t=this.getPathInfo()){return At`
10
+ `:It`${t}`}};Qe=new WeakMap,Ze=new WeakMap,Xe=new WeakMap,cn.createLocationStore=()=>{const{path:t,query:e,data:n}=W.getParams();return L({path:t,query:e,data:n,params:{}})},cn.findRoute=(t=[],e)=>{let n,s=null;n=t instanceof Array?t:Object.values(t);for(const t of n)if("*"===t.pattern)s=t;else{const n=on(t.pattern,e);if(n)return{route:t,params:n}}return{route:s}},tn([We],cn.prototype,"routes",void 0),tn([We],cn.prototype,"locationStore",void 0),tn([We],cn.prototype,"key",void 0),tn([qe],cn.prototype,"change",void 0),tn([qe],cn.prototype,"loading",void 0),tn([qe],cn.prototype,"error",void 0),cn=Ye=tn([Fe(W.store),ze("gem-route")],cn);let ln=class extends cn{constructor(t={}){super(Object.assign(Object.assign({},t),{isLight:!0}))}};ln=tn([ze("gem-light-route")],ln);var hn=function(t,e,n,s){var i,o=arguments.length,r=o<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,n):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,n,s);else for(var a=t.length-1;a>=0;a--)(i=t[a])&&(r=(o<3?i(r):o>3?i(e,n,r):i(e,n))||r);return o>3&&r&&Object.defineProperty(e,n,r),r};let un=class extends _e{constructor(){super(),this.clickHandle=t=>{return e=this,n=void 0,i=function*(){var e;const n=this.getPathInfo();if(!n)return;if(this.isExternal(n))switch(this.target){case"_self":return void(window.location.href=n);case"_parent":return void(window.parent.location.href=n);case"_top":return void(window.top.location.href=n);default:return void window.open(n)}const{path:s,query:i,hash:o}=W.getParams();if(s+i+o!==n)if(t.stopPropagation(),yield null===(e=this.prepare)||void 0===e?void 0:e.call(this),this.route)W.pushIgnoreCloseHandle(Object.assign(Object.assign({},an(this.route,this.options)),{title:this.route.title||this.docTitle}));else if(this.href){const{pathname:t,search:e,hash:s}=new URL(n,location.origin);W.pushIgnoreCloseHandle({path:t,query:e,hash:decodeURIComponent(s),title:this.docTitle})}else W.pushIgnoreCloseHandle({path:this.path,query:this.query,hash:this.hash,title:this.docTitle})},new((s=void 0)||(s=Promise))((function(t,o){function r(t){try{c(i.next(t))}catch(t){o(t)}}function a(t){try{c(i.throw(t))}catch(t){o(t)}}function c(e){var n;e.done?t(e.value):(n=e.value,n instanceof s?n:new s((function(t){t(n)}))).then(r,a)}c((i=i.apply(e,n||[])).next())}));var e,n,s,i},this.preventDefault=t=>{t.preventDefault()},this.addEventListener("click",this.clickHandle)}getPathInfo(){var t,e;if(this.route){const n=(null===(t=this.options)||void 0===t?void 0:t.query)||"",s=(null===(e=this.options)||void 0===e?void 0:e.hash)||"";return rn(this.route,this.options)+n+s}{const t=this.href||this.path+this.query+this.hash,{path:e,query:n}=W.getParams();return t.startsWith("#")?`${e}${n}${t}`:t.startsWith("?")?`${e}${t}`:t.startsWith(".")?u(e,t):t}}isExternal(t){return!t.startsWith("/")}render(t=this.getPathInfo()){return It`
11
11
  <style>
12
12
  :host {
13
13
  /* link default style */
@@ -26,11 +26,11 @@
26
26
  <a
27
27
  part=${this.link}
28
28
  @click=${this.preventDefault}
29
- href=${Jt("off"===this.hint?void 0:this.isExternal(t)?t:new URL(R.basePath+t,location.origin).toString())}
29
+ href=${Xt("off"===this.hint?void 0:this.isExternal(t)?t:new URL(W.basePath+t,location.origin).toString())}
30
30
  >
31
31
  <slot></slot>
32
32
  </a>
33
- `}};sn([Ce],on.prototype,"href",void 0),sn([Ce],on.prototype,"target",void 0),sn([Ce],on.prototype,"path",void 0),sn([Ce],on.prototype,"query",void 0),sn([Ce],on.prototype,"hash",void 0),sn([Ce],on.prototype,"docTitle",void 0),sn([Ce],on.prototype,"hint",void 0),sn([Ne],on.prototype,"route",void 0),sn([Ne],on.prototype,"options",void 0),sn([Ne],on.prototype,"prepare",void 0),sn([Re],on.prototype,"link",void 0),on=sn([qe("gem-link"),Ve(J)],on);let rn=class extends on{render(){const{path:t,query:e,hash:n}=R.getParams(),s=this.pattern&&Xe(this.pattern,t),o=this.getPathInfo();return this.active=!(!s&&t+e+n!==o),super.render(o)}};sn([Ce],rn.prototype,"pattern",void 0),sn([Me],rn.prototype,"active",void 0),rn=sn([qe("gem-active-link"),Ve(R.store)],rn);var an,cn=function(t,e,n,s){var o,i=arguments.length,r=i<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,n):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,n,s);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(i<3?o(r):i>3?o(e,n,r):o(e,n))||r);return i>3&&r&&Object.defineProperty(e,n,r),r};let ln=an=class extends ye{constructor(){super(),new MutationObserver((()=>this.update())).observe(this,{childList:!0,characterData:!0,subtree:!0})}static setTitle(t){N(Q,{title:t})}static updateTitle(t="",e=""){const{title:n}=Q;n&&n!==an.defaultTitle?(an.title=n,document.title=an.title+e):t?(an.title=t,document.title=an.title+e):(an.title=an.defaultTitle,document.title=an.title)}render(){return an.updateTitle(this.textContent||"",this.suffix),this.hidden?At``:At`${an.title}`}};ln.title=document.title,ln.defaultTitle=document.title,ln.defaultSuffix=` - ${document.title}`,cn([Ce],ln.prototype,"suffix",void 0),ln=an=cn([Ve(Q),qe("gem-title")],ln),M(Q,ln.updateTitle);var hn=function(t,e,n,s){var o,i=arguments.length,r=i<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,n):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,n,s);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(i<3?o(r):i>3?o(e,n,r):o(e,n))||r);return i>3&&r&&Object.defineProperty(e,n,r),r};const un=new Map;let dn=class extends ye{getContent(){const t=this.element||(this.selector?(this.root||document).querySelector(this.selector):null);if("string"==typeof t){let e=un.get(t);return e||(e=document.createElement("template"),e.innerHTML=t,un.set(t,e)),e.content.cloneNode(!0)}return t instanceof HTMLTemplateElement?t.content.cloneNode(!0):null==t?void 0:t.cloneNode(!0)}render(){return At`
33
+ `}};hn([Ae],un.prototype,"href",void 0),hn([Ae],un.prototype,"target",void 0),hn([Ae],un.prototype,"path",void 0),hn([Ae],un.prototype,"query",void 0),hn([Ae],un.prototype,"hash",void 0),hn([Ae],un.prototype,"docTitle",void 0),hn([Ae],un.prototype,"hint",void 0),hn([We],un.prototype,"route",void 0),hn([We],un.prototype,"options",void 0),hn([We],un.prototype,"prepare",void 0),hn([De],un.prototype,"link",void 0),un=hn([ze("gem-link"),Fe(X)],un);let dn=class extends un{render(){const{path:t,query:e,hash:n}=W.getParams(),s=this.pattern&&on(this.pattern,t),i=this.getPathInfo();return this.active=!(!s&&t+e+n!==i),super.render(i)}};hn([Ae],dn.prototype,"pattern",void 0),hn([Ie],dn.prototype,"active",void 0),dn=hn([ze("gem-active-link"),Fe(W.store)],dn);var pn,fn=function(t,e,n,s){var i,o=arguments.length,r=o<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,n):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,n,s);else for(var a=t.length-1;a>=0;a--)(i=t[a])&&(r=(o<3?i(r):o>3?i(e,n,r):i(e,n))||r);return o>3&&r&&Object.defineProperty(e,n,r),r};let mn=pn=class extends _e{constructor(){super(),new MutationObserver((()=>this.update())).observe(this,{childList:!0,characterData:!0,subtree:!0})}static setTitle(t){A(Y,{title:t})}static updateTitle(t="",e=""){const{title:n}=Y;n&&n!==pn.defaultTitle?(pn.title=n,document.title=pn.title+e):t?(pn.title=t,document.title=pn.title+e):(pn.title=pn.defaultTitle,document.title=pn.title)}render(){return pn.updateTitle(this.textContent||"",this.suffix),this.hidden?It``:It`${pn.title}`}};mn.title=document.title,mn.defaultTitle=document.title,mn.defaultSuffix=` - ${document.title}`,fn([Ae],mn.prototype,"suffix",void 0),mn=pn=fn([Fe(Y),ze("gem-title")],mn),R(Y,mn.updateTitle);var gn=function(t,e,n,s){var i,o=arguments.length,r=o<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,n):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,n,s);else for(var a=t.length-1;a>=0;a--)(i=t[a])&&(r=(o<3?i(r):o>3?i(e,n,r):i(e,n))||r);return o>3&&r&&Object.defineProperty(e,n,r),r};const vn=new Map;let yn=class extends _e{getContent(){const t=this.element||(this.selector?(this.root||document).querySelector(this.selector):null);if("string"==typeof t){let e=vn.get(t);return e||(e=document.createElement("template"),e.innerHTML=t,vn.set(t,e)),e.content.cloneNode(!0)}return t instanceof HTMLTemplateElement?t.content.cloneNode(!0):null==t?void 0:t.cloneNode(!0)}render(){return It`
34
34
  <style>
35
35
  :host {
36
36
  position: relative;
@@ -46,5 +46,5 @@
46
46
  </style>
47
47
  ${this.getContent()}
48
48
  <slot></slot>
49
- `}};hn([Ce],dn.prototype,"selector",void 0),hn([Ne],dn.prototype,"root",void 0),hn([Ne],dn.prototype,"element",void 0),dn=hn([qe("gem-use")],dn);var pn=function(t,e,n,s){var o,i=arguments.length,r=i<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,n):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,n,s);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(i<3?o(r):i>3?o(e,n,r):o(e,n))||r);return i>3&&r&&Object.defineProperty(e,n,r),r};let fn=class extends ye{constructor(){super(),this.effect((()=>{this.shadowRoot&&(this.shadowRoot.innerHTML=`\n <style>\n :host {\n display: contents;\n }\n ${this.contentcss}\n </style>\n ${this.content}\n `)}),(()=>[this.content,this.contentcss]))}render(){}};pn([Ce],fn.prototype,"content",void 0),pn([Ce],fn.prototype,"contentcss",void 0),fn=pn([qe("gem-unsafe")],fn);var mn=function(t,e,n,s){var o,i=arguments.length,r=i<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,n):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,n,s);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(i<3?o(r):i>3?o(e,n,r):o(e,n))||r);return i>3&&r&&Object.defineProperty(e,n,r),r};document.querySelectorAll("[data-reflect]").forEach((t=>t.remove()));let gn=class extends ye{constructor(){super({isLight:!0}),this.target=document.head,this.hidden=!0,this.effect((()=>{const t=[...this.childNodes];return t.forEach((t=>{t instanceof HTMLElement&&(t.dataset.reflect=""),this.target.append(t)})),()=>{t.forEach((t=>t.remove()))}}),(()=>[this.target]))}};mn([Ne],gn.prototype,"target",void 0),gn=mn([qe("gem-reflect")],gn);const vn=Symbol("open mark");function yn(t){var e;return(e=class extends ye{constructor(){super(),this.label="",this.internals.role="alertdialog",this.internals.ariaModal=!0}static get isOpen(){return this.store[vn]}static get observedStores(){return[R.store,this.store]}static open(t){const e=new this;this.instance=e,this.inertStore=[...document.body.children].filter((t=>!t.inert)),this.inertStore.forEach((t=>t.inert=!0)),document.body.append(e);const n=()=>N(this.store,Object.assign({[vn]:!0},t));setTimeout((()=>{n(),R.push({title:e.label,open:n,close:this.closeHandle.bind(this),shouldClose:this.shouldClose.bind(this)})}),100)}static close(){R.back()}static closeHandle(){var e;this.inertStore.forEach((t=>t.inert=!1)),null===(e=this.instance)||void 0===e||e.remove(),N(this.store,Object.assign({[vn]:!1},t))}static shouldClose(){return!0}}).inertStore=[],e.instance=null,e.store=$(Object.assign({[vn]:!1},t)),e}var wn,bn,Sn,En=function(t,e,n,s){var o,i=arguments.length,r=i<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,n):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,n,s);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(i<3?o(r):i>3?o(e,n,r):o(e,n))||r);return i>3&&r&&Object.defineProperty(e,n,r),r},xn=function(t,e,n,s){if("a"===n&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!s:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?s:"a"===n?s.call(t):s?s.value:e.get(t)},_n=function(t,e,n,s,o){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===s?o.call(t,n):o?o.value=n:e.set(t,n),n};let Pn=class extends ye{constructor(){super(),this.opened=!1,this.inert=!0,wn.set(this,void 0),bn.set(this,void 0),Sn.set(this,[]),this.label="",this.closeHandle=()=>{var t;this.inert=!0,xn(this,Sn,"f").forEach((t=>t.inert=!1)),xn(this,wn,"f")?xn(this,wn,"f").before(this):xn(this,bn,"f")&&(null===(t=xn(this,bn,"f"))||void 0===t||t.appendChild(this)),this.dispatchEvent(new CustomEvent("close")),this.opened=!1},this.openHandle=()=>{this.hidden=!1,this.inert=!1,_n(this,wn,this.nextSibling,"f"),_n(this,bn,this.parentElement||this.getRootNode(),"f"),_n(this,Sn,[...document.body.children].filter((t=>!t.inert)),"f"),xn(this,Sn,"f").forEach((t=>t.inert=!0)),document.body.append(this),this.dispatchEvent(new CustomEvent("open")),this.opened=!0},this.open=()=>{this.opened||(this.openHandle(),R.push({title:this.label,open:this.openHandle,close:this.closeHandle,shouldClose:this.shouldClose}))},this.close=()=>{R.back()},this.forceClose=()=>{this.opened=!1,setTimeout(this.close,100)},this.internals.role="dialog",this.internals.ariaModal=!0}shouldClose(){return!0}};wn=new WeakMap,bn=new WeakMap,Sn=new WeakMap,En([Me],Pn.prototype,"opened",void 0),En([Ce],Pn.prototype,"label",void 0),Pn=En([Ve(R.store)],Pn);const kn=new WeakMap;function On(t){return kn.get(t)}const Tn=new WeakMap;function Cn(t){return Tn.get(t)}function $n(t){const e=g(),n=document.createElement("style"),s=$(t),o={},i={};Tn.set(o,i),kn.set(o,s),Object.keys(s).forEach((t=>{i[t]=`--${b(t)}-${e}`,o[t]=`var(${i[t]})`}));const r=()=>function(t,e){const n=kn.get(e),s=Tn.get(e),o=Object.keys(n).reduce(((t,e)=>n[e]?t+`${s[e]}:${n[e]};`:t),"");t.textContent=`:root, :host {${o}}`}(n,o);return M(s,r),r(),(document.head||document.documentElement).append(n),o}function Ln(t,e){N(On(t),e)}var Nn=function(t,e,n,s){return new(n||(n=Promise))((function(o,i){function r(t){try{c(s.next(t))}catch(t){i(t)}}function a(t){try{c(s.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(r,a)}c((s=s.apply(t,e||[])).next())}))};const Mn=/\$\d(?:<[^>]*>)?/,jn=/\$(\d)(<([^>]*)>)?/g;class Rn{constructor(t){if(this.cachePrefix="gem-i18n",!t.resources[t.fallbackLanguage])throw new x("i18n: fallbackLanguage invalid");this.store=$(this),Object.assign(this,t);let e=this.urlParamsLang||this.currentLanguage||this.cacheLang;const n=document.querySelector(`[type*=${this.cachePrefix}]`);if(n)try{const t=JSON.parse(n.textContent||"");e=t.currentLanguage,this.resources[t.currentLanguage]=t.currentLanguagePack}catch(t){}e?(this.lang=e,this.setLanguage(e)):this.resetLanguage()}get cacheCurrentKey(){return`${this.cachePrefix}:current`}get urlParamsLang(){const{hostname:t,pathname:e,search:n}=location,s=t.split(".");switch(this.urlParamsType){case"ccTLD":return s.pop();case"gTLD":return s.shift();case"path":return e.split("/")[1];default:const t=this.urlParamsName&&new URLSearchParams(n).get(this.urlParamsName)||"";return t in this.resources?t:""}}get cacheLang(){return this.cache&&localStorage.getItem(this.cacheCurrentKey)||""}set lang(t){var e;this.currentLanguage=t,document.documentElement.lang=t,null===(e=this.onChange)||void 0===e||e.call(this,t)}get(t,...e){const n=this.resources[this.currentLanguage],s=this.resources[this.fallbackLanguage],o=n[t]||s[t],i=(null==o?void 0:o.message)||o||`[${t}]`;if(!e.length)return i;const r=i.split(Mn),a=[];let c;for(;c=jn.exec(i);){const t=c[3],n=e[Number(c[1])-1];a.push("string"==typeof n?n:n(t))}return At(r,...a)}detectLanguage(){const t=Object.keys(this.resources),e=navigator.languages.map((t=>t.replace(/-(.*)/,(t=>t.toUpperCase()))));for(const n of e){const e=t.find((t=>t===n||n.startsWith(`${t}-`)));if(e)return e}return this.fallbackLanguage}setLanguage(t){return Nn(this,void 0,void 0,(function*(){let e;const n=this.resources[t];if(!n)return console.warn(`i18n: not found \`${t}\``),this.resetLanguage();if("string"==typeof n){const t=`${this.cachePrefix}:`,s=`${t}${n}`,o=localStorage.getItem(s),i=()=>Nn(this,void 0,void 0,(function*(){const e=yield(yield fetch(n)).json();if(this.cache){for(let e=0;e<localStorage.length;e++){const n=localStorage.key(e);n.startsWith(t)&&localStorage.removeItem(n)}localStorage.setItem(s,JSON.stringify(e))}return e}));if(o)try{e=JSON.parse(o)}catch(t){e=yield i()}else e=yield i()}else e=n;return this.resources[t]=e,N(this.store,{}),t!==this.currentLanguage&&(this.lang=t),!0===this.cache&&this.setCache(),t}))}resetLanguage(){return this.lang=this.fallbackLanguage,this.cache&&localStorage.removeItem(this.cacheCurrentKey),this.setLanguage(this.detectLanguage())}setCache(){localStorage.setItem(this.cacheCurrentKey,this.currentLanguage)}toJSON(){return{currentLanguage:this.currentLanguage,currentLanguagePack:this.resources[this.currentLanguage]}}}const An={credentials:"include",mode:"cors"};function Hn(t,e={}){return n=this,s=void 0,i=function*(){const n=yield fetch(t,Object.assign(Object.assign({},An),e));if(0===n.status)throw new Error("Request fail");if(n.status>=500)throw new Error(n.statusText);if(n.status>=400)throw new Error((yield n.text())||n.statusText);return yield n.json()},new((o=void 0)||(o=Promise))((function(t,e){function r(t){try{c(i.next(t))}catch(t){e(t)}}function a(t){try{c(i.throw(t))}catch(t){e(t)}}function c(e){var n;e.done?t(e.value):(n=e.value,n instanceof o?n:new o((function(t){t(n)}))).then(r,a)}c((i=i.apply(n,s||[])).next())}));var n,s,o,i}const In=Object.getPrototypeOf(Object.getPrototypeOf(new Int8Array));function Wn(t){return t instanceof FormData||t instanceof Blob||t instanceof In||t instanceof URLSearchParams||t instanceof ReadableStream||t instanceof ArrayBuffer?t:"object"==typeof t?JSON.stringify(t):t}function Vn(t,e){const{origin:n,pathname:s,search:o}=new URL(t,location.origin),i=new URLSearchParams(e).toString();return Hn(`${n}${s}${o?`${o}&`:i?"?":""}${i}`,{method:"GET"})}function Dn(t){return Hn(t,{method:"DELETE"})}function qn(t,e){return Hn(t,{method:"PUT",body:Wn(e)})}function Un(t,e){return Hn(t,{method:"POST",body:Wn(e)})}const Gn={PRINT:"print",get isPrint(){return window.matchMedia(this.PRINT).matches},HOVER:"(hover: hover)",get isHover(){return window.matchMedia(this.HOVER).matches},PHONE:"(min-width: 319px) and (max-width: 480px)",get isPhone(){return window.matchMedia(this.PHONE).matches},LAPTOP:"(min-width: 1023px) and (max-width: 1280px) and (orientation: landscape)",get isLaptop(){return window.matchMedia(this.LAPTOP).matches},DESKTOP:"(min-width: 1279px) and (orientation: landscape)",get isDesktop(){return window.matchMedia(this.DESKTOP).matches},PHONE_LANDSCAPE:"(min-width: 479px) and (max-width: 767px) and (orientation: landscape)",get isPhoneLandscape(){return window.matchMedia(this.PHONE_LANDSCAPE).matches},TABLET:"(min-width: 768px) and (max-width: 1024px)",get isTablet(){return window.matchMedia(this.TABLET).matches},SMALL_PHONE:"(min-width: 319px) and (max-width: 480px) and (max-height: 640px)",get isSmallPhone(){return window.matchMedia(this.SMALL_PHONE).matches},WATCH:"(max-width: 319px)",get isWatch(){return window.matchMedia(this.WATCH).matches},SHORT:"(min-width: 479px) and (max-height: 320px)",get isShort(){return window.matchMedia(this.SHORT).matches},PWA:"(display-mode: standalone)",get isPWA(){return window.matchMedia(this.PWA).matches},MOTION_REDUCE:"(prefers-reduced-motion: reduce)",get isMotionReduce(){return window.matchMedia(this.MOTION_REDUCE).matches},DATA_REDUCE:"(prefers-reduced-data: reduce)",get isDataReduce(){return window.matchMedia(this.DATA_REDUCE).matches}};return e})()}));
49
+ `}};gn([Ae],yn.prototype,"selector",void 0),gn([We],yn.prototype,"root",void 0),gn([We],yn.prototype,"element",void 0),yn=gn([ze("gem-use")],yn);var wn=function(t,e,n,s){var i,o=arguments.length,r=o<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,n):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,n,s);else for(var a=t.length-1;a>=0;a--)(i=t[a])&&(r=(o<3?i(r):o>3?i(e,n,r):i(e,n))||r);return o>3&&r&&Object.defineProperty(e,n,r),r};let bn=class extends _e{constructor(){super(),this.effect((()=>{this.shadowRoot&&(this.shadowRoot.innerHTML=`\n <style>\n :host {\n display: contents;\n }\n ${this.contentcss}\n </style>\n ${this.content}\n `)}),(()=>[this.content,this.contentcss]))}render(){}};wn([Ae],bn.prototype,"content",void 0),wn([Ae],bn.prototype,"contentcss",void 0),bn=wn([ze("gem-unsafe")],bn);var Sn=function(t,e,n,s){var i,o=arguments.length,r=o<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,n):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,n,s);else for(var a=t.length-1;a>=0;a--)(i=t[a])&&(r=(o<3?i(r):o>3?i(e,n,r):i(e,n))||r);return o>3&&r&&Object.defineProperty(e,n,r),r};document.querySelectorAll("[data-reflect]").forEach((t=>t.remove()));let En=class extends _e{constructor(){super({isLight:!0}),this.target=document.head,this.hidden=!0,this.effect((()=>{const t=[...this.childNodes];return t.forEach((t=>{t instanceof HTMLElement&&(t.dataset.reflect=""),this.target.append(t)})),()=>{t.forEach((t=>t.remove()))}}),(()=>[this.target]))}};Sn([We],En.prototype,"target",void 0),En=Sn([ze("gem-reflect")],En);const xn=Symbol("open mark");function _n(t){var e;return(e=class extends _e{constructor(){super(),this.label="",this.internals.role="alertdialog",this.internals.ariaModal=!0}static get isOpen(){return this.store[xn]}static get observedStores(){return[W.store,this.store]}static open(t){const e=new this;this.instance=e,this.inertStore=[...document.body.children].filter((t=>!t.inert)),this.inertStore.forEach((t=>t.inert=!0)),document.body.append(e);const n=()=>A(this.store,Object.assign({[xn]:!0},t));setTimeout((()=>{n(),W.push({title:e.label,open:n,close:this.closeHandle.bind(this),shouldClose:this.shouldClose.bind(this)})}),100)}static close(){W.back()}static closeHandle(){var e;this.inertStore.forEach((t=>t.inert=!1)),null===(e=this.instance)||void 0===e||e.remove(),A(this.store,Object.assign({[xn]:!1},t))}static shouldClose(){return!0}}).inertStore=[],e.instance=null,e.store=L(Object.assign({[xn]:!1},t)),e}var Pn,kn,On,Tn=function(t,e,n,s){var i,o=arguments.length,r=o<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,n):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,n,s);else for(var a=t.length-1;a>=0;a--)(i=t[a])&&(r=(o<3?i(r):o>3?i(e,n,r):i(e,n))||r);return o>3&&r&&Object.defineProperty(e,n,r),r},Cn=function(t,e,n,s){if("a"===n&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!s:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?s:"a"===n?s.call(t):s?s.value:e.get(t)},$n=function(t,e,n,s,i){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===s?i.call(t,n):i?i.value=n:e.set(t,n),n};let Mn=class extends _e{constructor(){super(),this.opened=!1,this.inert=!0,Pn.set(this,void 0),kn.set(this,void 0),On.set(this,[]),this.label="",this.closeHandle=()=>{var t;this.inert=!0,Cn(this,On,"f").forEach((t=>t.inert=!1)),Cn(this,Pn,"f")?Cn(this,Pn,"f").before(this):Cn(this,kn,"f")&&(null===(t=Cn(this,kn,"f"))||void 0===t||t.appendChild(this)),this.dispatchEvent(new CustomEvent("close")),this.opened=!1},this.openHandle=()=>{this.hidden=!1,this.inert=!1,$n(this,Pn,this.nextSibling,"f"),$n(this,kn,this.parentElement||this.getRootNode(),"f"),$n(this,On,[...document.body.children].filter((t=>!t.inert)),"f"),Cn(this,On,"f").forEach((t=>t.inert=!0)),document.body.append(this),this.dispatchEvent(new CustomEvent("open")),this.opened=!0},this.open=()=>{this.opened||(this.openHandle(),W.push({title:this.label,open:this.openHandle,close:this.closeHandle,shouldClose:this.shouldClose}))},this.close=()=>{W.back()},this.forceClose=()=>{this.opened=!1,setTimeout(this.close,100)},this.internals.role="dialog",this.internals.ariaModal=!0}shouldClose(){return!0}};Pn=new WeakMap,kn=new WeakMap,On=new WeakMap,Tn([Ie],Mn.prototype,"opened",void 0),Tn([Ae],Mn.prototype,"label",void 0),Mn=Tn([Fe(W.store)],Mn);const Nn=new WeakMap;function Ln(t){return Nn.get(t)}const jn=new WeakMap;function An(t){return jn.get(t)}function Rn(t){const e=w(),n=document.createElement("style"),s=L(t),i={},o={};jn.set(i,o),Nn.set(i,s),Object.keys(s).forEach((t=>{o[t]=`--${x(t)}-${e}`,i[t]=`var(${o[t]})`}));const r=()=>function(t,e){const n=Nn.get(e),s=jn.get(e),i=Object.keys(n).reduce(((t,e)=>n[e]?t+`${s[e]}:${n[e]};`:t),"");t.textContent=`:root, :host {${i}}`}(n,i);return R(s,r),r(),(document.head||document.documentElement).append(n),i}function Hn(t,e){A(Ln(t),e)}var Wn=function(t,e,n,s){return new(n||(n=Promise))((function(i,o){function r(t){try{c(s.next(t))}catch(t){o(t)}}function a(t){try{c(s.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(r,a)}c((s=s.apply(t,e||[])).next())}))};const In=/\$\d(?:<[^>]*>)?/,Vn=/\$(\d)(<([^>]*)>)?/g;class Dn{constructor(t){if(this.cachePrefix="gem-i18n",!t.resources[t.fallbackLanguage])throw new k("i18n: fallbackLanguage invalid");this.store=L(this),Object.assign(this,t);let e=this.urlParamsLang||this.currentLanguage||this.cacheLang;const n=document.querySelector(`[type*=${this.cachePrefix}]`);if(n)try{const t=JSON.parse(n.textContent||"");e=t.currentLanguage,this.resources[t.currentLanguage]=t.currentLanguagePack}catch(t){}e?(this.lang=e,this.setLanguage(e)):this.resetLanguage()}get cacheCurrentKey(){return`${this.cachePrefix}:current`}get urlParamsLang(){const{hostname:t,pathname:e,search:n}=location,s=t.split(".");switch(this.urlParamsType){case"ccTLD":return s.pop();case"gTLD":return s.shift();case"path":return e.split("/")[1];default:const t=this.urlParamsName&&new URLSearchParams(n).get(this.urlParamsName)||"";return t in this.resources?t:""}}get cacheLang(){return this.cache&&localStorage.getItem(this.cacheCurrentKey)||""}set lang(t){var e;this.currentLanguage=t,document.documentElement.lang=t,null===(e=this.onChange)||void 0===e||e.call(this,t)}get(t,...e){const n=this.resources[this.currentLanguage],s=this.resources[this.fallbackLanguage],i=n[t]||s[t],o=(null==i?void 0:i.message)||i||`[${t}]`;if(!e.length)return o;const r=o.split(In),a=[];let c;for(;c=Vn.exec(o);){const t=c[3],n=e[Number(c[1])-1];a.push("string"==typeof n?n:n(t))}return It(r,...a)}detectLanguage(){const t=Object.keys(this.resources),e=navigator.languages.map((t=>t.replace(/-(.*)/,(t=>t.toUpperCase()))));for(const n of e){const e=t.find((t=>t===n||n.startsWith(`${t}-`)));if(e)return e}return this.fallbackLanguage}setLanguage(t){return Wn(this,void 0,void 0,(function*(){let e;const n=this.resources[t];if(!n)return console.warn(`i18n: not found \`${t}\``),this.resetLanguage();if("string"==typeof n){const t=`${this.cachePrefix}:`,s=`${t}${n}`,i=localStorage.getItem(s),o=()=>Wn(this,void 0,void 0,(function*(){const e=yield(yield fetch(n)).json();if(this.cache){for(let e=0;e<localStorage.length;e++){const n=localStorage.key(e);n.startsWith(t)&&localStorage.removeItem(n)}localStorage.setItem(s,JSON.stringify(e))}return e}));if(i)try{e=JSON.parse(i)}catch(t){e=yield o()}else e=yield o()}else e=n;return this.resources[t]=e,A(this.store,{}),t!==this.currentLanguage&&(this.lang=t),!0===this.cache&&this.setCache(),t}))}resetLanguage(){return this.lang=this.fallbackLanguage,this.cache&&localStorage.removeItem(this.cacheCurrentKey),this.setLanguage(this.detectLanguage())}setCache(){localStorage.setItem(this.cacheCurrentKey,this.currentLanguage)}toJSON(){return{currentLanguage:this.currentLanguage,currentLanguagePack:this.resources[this.currentLanguage]}}}const qn={credentials:"include",mode:"cors"};function Un(t,e={}){return n=this,s=void 0,o=function*(){const n=yield fetch(t,Object.assign(Object.assign({},qn),e));if(0===n.status)throw new Error("Request fail");if(n.status>=500)throw new Error(n.statusText);if(n.status>=400)throw new Error((yield n.text())||n.statusText);return yield n.json()},new((i=void 0)||(i=Promise))((function(t,e){function r(t){try{c(o.next(t))}catch(t){e(t)}}function a(t){try{c(o.throw(t))}catch(t){e(t)}}function c(e){var n;e.done?t(e.value):(n=e.value,n instanceof i?n:new i((function(t){t(n)}))).then(r,a)}c((o=o.apply(n,s||[])).next())}));var n,s,i,o}const Gn=Object.getPrototypeOf(Object.getPrototypeOf(new Int8Array));function Bn(t){return t instanceof FormData||t instanceof Blob||t instanceof Gn||t instanceof URLSearchParams||t instanceof ReadableStream||t instanceof ArrayBuffer?t:"object"==typeof t?JSON.stringify(t):t}function Fn(t,e){const{origin:n,pathname:s,search:i}=new URL(t,location.origin),o=new URLSearchParams(e).toString();return Un(`${n}${s}${i?`${i}&`:o?"?":""}${o}`,{method:"GET"})}function Kn(t){return Un(t,{method:"DELETE"})}function zn(t,e){return Un(t,{method:"PUT",body:Bn(e)})}function Jn(t,e){return Un(t,{method:"POST",body:Bn(e)})}const Qn={PRINT:"print",get isPrint(){return window.matchMedia(this.PRINT).matches},HOVER:"(hover: hover)",get isHover(){return window.matchMedia(this.HOVER).matches},PHONE:"(min-width: 319px) and (max-width: 480px)",get isPhone(){return window.matchMedia(this.PHONE).matches},LAPTOP:"(min-width: 1023px) and (max-width: 1280px) and (orientation: landscape)",get isLaptop(){return window.matchMedia(this.LAPTOP).matches},DESKTOP:"(min-width: 1279px) and (orientation: landscape)",get isDesktop(){return window.matchMedia(this.DESKTOP).matches},PHONE_LANDSCAPE:"(min-width: 479px) and (max-width: 767px) and (orientation: landscape)",get isPhoneLandscape(){return window.matchMedia(this.PHONE_LANDSCAPE).matches},TABLET:"(min-width: 768px) and (max-width: 1024px)",get isTablet(){return window.matchMedia(this.TABLET).matches},SMALL_PHONE:"(min-width: 319px) and (max-width: 480px) and (max-height: 640px)",get isSmallPhone(){return window.matchMedia(this.SMALL_PHONE).matches},WATCH:"(max-width: 319px)",get isWatch(){return window.matchMedia(this.WATCH).matches},SHORT:"(min-width: 479px) and (max-height: 320px)",get isShort(){return window.matchMedia(this.SHORT).matches},PWA:"(display-mode: standalone)",get isPWA(){return window.matchMedia(this.PWA).matches},MOTION_REDUCE:"(prefers-reduced-motion: reduce)",get isMotionReduce(){return window.matchMedia(this.MOTION_REDUCE).matches},DATA_REDUCE:"(prefers-reduced-data: reduce)",get isDataReduce(){return window.matchMedia(this.DATA_REDUCE).matches}};return e})()}));
50
50
  //# sourceMappingURL=umd.js.map