@mantou/gem 1.6.1 → 1.6.5

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.
Files changed (59) hide show
  1. package/elements/dialog-base.d.ts +1 -1
  2. package/elements/dialog-base.d.ts.map +1 -1
  3. package/elements/dialog-base.js +3 -1
  4. package/elements/dialog-base.js.map +1 -1
  5. package/elements/gesture.d.ts +2 -1
  6. package/elements/gesture.d.ts.map +1 -1
  7. package/elements/gesture.js +2 -1
  8. package/elements/gesture.js.map +1 -1
  9. package/elements/link.d.ts +1 -1
  10. package/elements/link.d.ts.map +1 -1
  11. package/elements/link.js +3 -1
  12. package/elements/link.js.map +1 -1
  13. package/elements/modal-base.d.ts +16 -7
  14. package/elements/modal-base.d.ts.map +1 -1
  15. package/elements/modal-base.js +3 -1
  16. package/elements/modal-base.js.map +1 -1
  17. package/elements/reflect.d.ts +1 -1
  18. package/elements/reflect.d.ts.map +1 -1
  19. package/elements/reflect.js +2 -1
  20. package/elements/reflect.js.map +1 -1
  21. package/elements/route.d.ts +7 -3
  22. package/elements/route.d.ts.map +1 -1
  23. package/elements/route.js +7 -4
  24. package/elements/route.js.map +1 -1
  25. package/elements/title.d.ts +1 -1
  26. package/elements/title.d.ts.map +1 -1
  27. package/elements/title.js +4 -1
  28. package/elements/title.js.map +1 -1
  29. package/elements/unsafe.d.ts +1 -1
  30. package/elements/unsafe.d.ts.map +1 -1
  31. package/elements/unsafe.js +2 -1
  32. package/elements/unsafe.js.map +1 -1
  33. package/elements/use.d.ts +1 -1
  34. package/elements/use.d.ts.map +1 -1
  35. package/elements/use.js +2 -1
  36. package/elements/use.js.map +1 -1
  37. package/lib/element.d.ts.map +1 -1
  38. package/lib/element.js +30 -4
  39. package/lib/element.js.map +1 -1
  40. package/lib/utils.d.ts.map +1 -1
  41. package/lib/utils.js +4 -1
  42. package/lib/utils.js.map +1 -1
  43. package/lib/version.d.ts +1 -1
  44. package/lib/version.js +1 -1
  45. package/package.json +2 -1
  46. package/src/elements/dialog-base.ts +3 -1
  47. package/src/elements/gesture.ts +2 -1
  48. package/src/elements/link.ts +3 -13
  49. package/src/elements/modal-base.ts +3 -1
  50. package/src/elements/reflect.ts +2 -1
  51. package/src/elements/route.ts +8 -20
  52. package/src/elements/title.ts +4 -1
  53. package/src/elements/unsafe.ts +2 -1
  54. package/src/elements/use.ts +2 -1
  55. package/src/lib/element.ts +29 -5
  56. package/src/lib/utils.ts +3 -1
  57. package/src/lib/version.ts +1 -1
  58. package/umd.js +7 -7
  59. package/umd.js.map +1 -1
package/umd.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"umd.js","mappings":";CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,GAAIH,GACe,iBAAZC,QACdA,QAAa,IAAID,IAEjBD,EAAU,IAAIC,IARhB,CASGK,MAAM,WACT,yBCTA,IAAIC,EAAsB,CCA1BA,EAAwB,CAACL,EAASM,KACjC,IAAI,IAAIC,KAAOD,EACXD,EAAoBG,EAAEF,EAAYC,KAASF,EAAoBG,EAAER,EAASO,IAC5EE,OAAOC,eAAeV,EAASO,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,MCJ3EF,EAAwB,CAACQ,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,GCClFT,EAAyBL,IACH,oBAAXkB,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAeV,EAASkB,OAAOC,YAAa,CAAEC,MAAO,WAE7DX,OAAOC,eAAeV,EAAS,aAAc,CAAEoB,OAAO,k1GCLvD,MAAMC,EAAe,IAAIC,IAClB,SAASC,EAAaC,GACP,mBAATA,IACNH,EAAaI,MAEhBC,WAAWC,gBAAe,KACxBN,EAAaO,SAASJ,GAASA,MAC/BH,EAAaQ,WAGjBR,EAAaS,OAAON,GACpBH,EAAaU,IAAIP,IAGn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C,GAAOnf,GACrB,OAAOqe,GAAWre,EAAK,CAAEkf,OAAQ,WAE5B,SAASE,GAAOpf,EAAa8Z,GAClC,OAAOuE,GAAWre,EAAK,CAAEkf,OAAQ,MAAOpF,KAAM+E,GAAkB/E,KAE3D,SAASuF,GAAQrf,EAAa8Z,GACnC,OAAOuE,GAAWre,EAAK,CAAEkf,OAAQ,OAAQpF,KAAM+E,GAAkB/E,KChDnE,MAAMwF,GAAUpnB,GAAkB2B,OAAO0lB,WAAWrnB,GAAOsnB,QAE9CplB,GAAa,CACxBqlB,MAAO,QACHC,cACF,OAAOJ,GAAO5oB,KAAK+oB,QAErBE,MAAO,iBACHC,cACF,OAAON,GAAO5oB,KAAKipB,QAGrBE,MAAO,4CACHC,cACF,OAAOR,GAAO5oB,KAAKmpB,QAGrBE,OAAQ,2EACJC,eACF,OAAOV,GAAO5oB,KAAKqpB,SAGrBE,QAAS,mDACLC,gBACF,OAAOZ,GAAO5oB,KAAKupB,UAGrBE,YAAa,mDACTC,oBACF,OAAOd,GAAO5oB,KAAKypB,cAGrBE,gBAAiB,yEAEbC,uBACF,OAAOhB,GAAO5oB,KAAK2pB,kBAGrBE,OAAQ,6CACJC,eACF,OAAOlB,GAAO5oB,KAAK6pB,SAGrBE,YAAa,oEACTC,mBACF,OAAOpB,GAAO5oB,KAAK+pB,cAGrBE,MAAO,qBACHC,cACF,OAAOtB,GAAO5oB,KAAKiqB,QAGrBE,MAAO,6CACHC,cACF,OAAOxB,GAAO5oB,KAAKmqB,QAGrBE,IAAK,6BAEDC,YACF,OAAO1B,GAAO5oB,KAAKqqB,MAGrBE,cAAe,mCACXC,qBACF,OAAO5B,GAAO5oB,KAAKuqB,gBAGrBE,YAAa,iCACTC,mBACF,OAAO9B,GAAO5oB,KAAKyqB","sources":["webpack://Gem/webpack/universalModuleDefinition","webpack://Gem/webpack/bootstrap","webpack://Gem/webpack/runtime/define property getters","webpack://Gem/webpack/runtime/hasOwnProperty shorthand","webpack://Gem/webpack/runtime/make namespace object","webpack://Gem/./src/lib/utils.ts","webpack://Gem/./src/lib/store.ts","webpack://Gem/./src/lib/history.ts","webpack://Gem/./node_modules/lit-html/lib/directive.js","webpack://Gem/./node_modules/lit-html/lib/dom.js","webpack://Gem/./node_modules/lit-html/lib/part.js","webpack://Gem/./node_modules/lit-html/lib/template.js","webpack://Gem/./node_modules/lit-html/lib/template-instance.js","webpack://Gem/./node_modules/lit-html/lib/template-result.js","webpack://Gem/./node_modules/lit-html/lib/parts.js","webpack://Gem/./node_modules/lit-html/lib/default-template-processor.js","webpack://Gem/./node_modules/lit-html/lib/template-factory.js","webpack://Gem/./node_modules/lit-html/lib/render.js","webpack://Gem/./node_modules/lit-html/lit-html.js","webpack://Gem/./node_modules/lit-html/directives/repeat.js","webpack://Gem/./node_modules/lit-html/directives/guard.js","webpack://Gem/./node_modules/lit-html/directives/if-defined.js","webpack://Gem/./src/lib/element.ts","webpack://Gem/./src/lib/decorators.ts","webpack://Gem/./src/lib/version.ts","webpack://Gem/./src/index.ts","webpack://Gem/./src/elements/route.ts","webpack://Gem/./src/elements/link.ts","webpack://Gem/./src/elements/title.ts","webpack://Gem/./src/elements/use.ts","webpack://Gem/./src/elements/unsafe.ts","webpack://Gem/./src/elements/reflect.ts","webpack://Gem/./src/elements/modal-base.ts","webpack://Gem/./src/elements/dialog-base.ts","webpack://Gem/./src/helper/theme.ts","webpack://Gem/./src/helper/i18n.ts","webpack://Gem/./src/helper/request.ts","webpack://Gem/./src/helper/mediaquery.ts"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"Gem\"] = factory();\n\telse\n\t\troot[\"Gem\"] = factory();\n})(self, function() {\nreturn ","// The require scope\nvar __webpack_require__ = {};\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const microtaskSet = new Set<() => void>();\nexport function addMicrotask(func: () => void) {\n if (typeof func !== 'function') return;\n if (!microtaskSet.size) {\n // delayed execution callback after updating store\n globalThis.queueMicrotask(() => {\n microtaskSet.forEach((func) => func());\n microtaskSet.clear();\n });\n }\n microtaskSet.delete(func);\n microtaskSet.add(func);\n}\n\nconst microtaskStack: (() => void)[] = [];\n\nfunction execMicrotaskStack() {\n for (let i = microtaskStack.length - 1; i >= 0; i--) {\n microtaskStack[i]();\n }\n microtaskStack.length = 0;\n}\n\n/**\n * 添加回调函数到微任务队列栈;\n * 先进后执行;\n */\nexport function addMicrotaskToStack(func: () => void) {\n if (!microtaskStack.length) {\n addMicrotask(execMicrotaskStack);\n }\n microtaskStack.push(func);\n}\n\nexport function absoluteLocation(currentPath = '', relativePath = '') {\n const { pathname, search, hash } = new URL(relativePath, location.origin + currentPath);\n return pathname + search + hash;\n}\n\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport type NonPrimitive = object;\n\ninterface LinkedListEventMap {\n start: Event;\n end: Event;\n}\ninterface LinkedListItem<T> {\n value: T;\n prev?: LinkedListItem<T>;\n next?: LinkedListItem<T>;\n}\n// work on nodejs\nexport class LinkedList<T = any> extends (globalThis.EventTarget || Object) {\n addEventListener: <K extends keyof LinkedListEventMap>(\n type: K,\n listener: (this: LinkedList<T>, ev: LinkedListEventMap[K]) => any,\n options?: boolean | AddEventListenerOptions,\n ) => void;\n\n #map = new Map<T, LinkedListItem<T>>();\n #firstItem?: LinkedListItem<T>;\n #lastItem?: LinkedListItem<T>;\n\n #delete(value: T) {\n const existItem = this.#map.get(value);\n if (existItem) {\n if (existItem.prev) {\n existItem.prev.next = existItem.next;\n } else {\n this.#firstItem = existItem.next;\n }\n if (existItem.next) {\n existItem.next.prev = existItem.prev;\n } else {\n this.#lastItem = existItem.prev;\n }\n this.#map.delete(value);\n }\n return existItem;\n }\n\n get size() {\n return this.#map.size;\n }\n\n // 添加到尾部,已存在时会删除老的项目\n // 如果是添加第一个,start 事件会在添加前触发,避免处理事件重复的逻辑\n add(value: T) {\n if (!this.#lastItem) {\n this.dispatchEvent(new CustomEvent('start'));\n }\n const item: LinkedListItem<T> = this.#delete(value) || { value };\n item.prev = this.#lastItem;\n if (item.prev) {\n item.prev.next = item;\n }\n item.next = undefined;\n this.#lastItem = item;\n if (!this.#firstItem) {\n this.#firstItem = item;\n }\n this.#map.set(value, item);\n }\n\n // 删除这个元素后没有其他元素时立即出发 end 事件\n delete(value: T) {\n const deleteItem = this.#delete(value);\n if (!this.#firstItem) {\n this.dispatchEvent(new CustomEvent('end'));\n }\n return deleteItem;\n }\n\n // 获取头部元素\n get(): T | undefined {\n const firstItem = this.#firstItem;\n if (!firstItem) return;\n this.#delete(firstItem.value);\n return firstItem.value;\n }\n}\n\nexport class PropProxyMap<T extends NonPrimitive, V = unknown> extends WeakMap<T, Record<string, V>> {\n get(ele: T) {\n let proxy = super.get(ele);\n if (!proxy) {\n proxy = {};\n this.set(ele, proxy);\n }\n return proxy;\n }\n}\n\ndeclare global {\n interface URLSearchParams {\n entries(): Iterable<readonly [string | number | symbol, any]>;\n }\n}\nexport class QueryString extends URLSearchParams {\n constructor(param?: any) {\n super(param);\n }\n\n // support `{ key: ObjectValue }`\n concat(param: any) {\n let query: any;\n if (typeof param === 'string') {\n query = Object.fromEntries(new URLSearchParams(param).entries());\n } else {\n query = param;\n }\n Object.entries(query).forEach(([key, value]) => {\n this.append(key, this.#stringify(value));\n });\n }\n\n #stringify = (value: any) => (typeof value === 'string' ? value : JSON.stringify(value));\n\n setAny(key: string, value: any) {\n if (Array.isArray(value)) {\n this.delete(key);\n value.forEach((e) => this.append(key, this.#stringify(e)));\n } else {\n const v = this.#stringify(value);\n v ? this.set(key, v) : this.delete(key);\n }\n }\n\n #parse = (value: any) => {\n if (!value) return null;\n try {\n return JSON.parse(value);\n } catch {\n return null;\n }\n };\n\n getAny(key: string) {\n return this.getAnyAll(key)[0];\n }\n\n getAnyAll(key: string) {\n return this.getAll(key)\n .filter((e) => e !== '')\n .map((e) => this.#parse(e));\n }\n\n toString() {\n const string = super.toString();\n return string ? `?${string}` : '';\n }\n\n toJSON() {\n return this.toString();\n }\n}\n\n/**\n * 写纯文本,仅用于 IDE HTML 高亮\n *\n * 不同于 lit-html 的 `html` 模版函数,写 attribute 时必须手动写引号并自行进行 html 编码\n */\nexport function raw(arr: TemplateStringsArray, ...args: any[]) {\n return arr.reduce((prev, current, index) => prev + (args[index - 1] ?? '') + current);\n}\n\n// 写 css 文本,在 CSSStyleSheet 中使用\nexport function css(arr: TemplateStringsArray, ...args: any[]) {\n return raw(arr, ...args);\n}\n\nexport const SheetToken = Symbol('sheet token');\n\nexport type Sheet<T> = {\n [P in keyof T]: P;\n} & { [SheetToken]: CSSStyleSheet };\n\ndeclare global {\n interface CSSStyleSheet {\n replaceSync: (str: string) => void;\n }\n\n interface CSSRuleList {\n item(index: number): CSSStyleRule;\n }\n interface ShadowRoot {\n adoptedStyleSheets: CSSStyleSheet[];\n }\n interface Document {\n adoptedStyleSheets: CSSStyleSheet[];\n }\n}\n\nexport type StyledType = 'id' | 'class' | 'keyframes';\nexport interface StyledValueObject {\n styledContent: string;\n type: StyledType;\n}\nexport interface StyledKeyValuePair {\n [key: string]: StyledValueObject;\n}\n\n// !!! 目前只有 Chrome/FirefoxNightly 支持\n// https://bugzilla.mozilla.org/show_bug.cgi?id=1520690\n// https://bugs.webkit.org/show_bug.cgi?id=228684\nexport let useNativeCSSStyleSheet = true;\ntry {\n new (CSSStyleSheet as any)();\n} catch {\n useNativeCSSStyleSheet = false;\n window.CSSStyleSheet = class {\n media = { mediaText: '' };\n style = '';\n replaceSync = (style: string) => (this.style = style);\n } as any;\n}\n\n/**\n *\n * 创建 style sheet 用于 `adoptedStyleSheets`,不支持样式更新\n * @param rules string | Record<string, string> 不能动态更新的 css\n * @param mediaQuery string 媒体查询 StyleSheet.media.mediaText\n */\nexport function createCSSSheet<T extends StyledKeyValuePair>(rules: T | string, mediaQuery = ''): Sheet<T> {\n const styleSheet = new CSSStyleSheet();\n const sheet: any = {};\n styleSheet.media.mediaText = mediaQuery;\n let style = '';\n if (typeof rules === 'string') {\n style = rules;\n } else {\n Object.keys(rules).forEach((key: keyof T) => {\n sheet[key] = `${key}-${randomStr()}`;\n style += rules[key].styledContent.replace(/&/g, sheet[key]);\n });\n }\n styleSheet.replaceSync(style);\n sheet[SheetToken] = styleSheet;\n return sheet as Sheet<T>;\n}\n\nexport function randomStr(number = 5, origin = '0123456789abcdefghijklmnopqrstuvwxyz') {\n const len = origin.length;\n let str = '';\n for (let i = 0; i < number; i++) {\n str += origin[Math.floor(Math.random() * len)];\n }\n return str;\n}\n\nconst nestingRuleRegExp = new RegExp('&.*{((.|\\n)*)}', 'g');\n// 只支持一层嵌套\n// https://drafts.csswg.org/css-nesting-1/\nfunction flatStyled(style: string, type: StyledType): StyledValueObject {\n const nestingRules: string[] = [];\n let styledContent =\n `& {${style.replace(nestingRuleRegExp, (substr) => {\n nestingRules.push(substr);\n return '';\n })}}` + nestingRules.join('');\n styledContent = styledContent.replace(/&/g, type === 'class' ? '.&' : '#&');\n return { styledContent, type };\n}\n\n// 写 css 文本,在 CSSStyleSheet 中使用,使用 styed-components 高亮\n// 暂时不支持 `at` 规则\n//\n// createCSSSheet({\n// red: styled.class`\n// background: red;\n// &:hover {\n// background: blue;\n// }\n// `,\n// });\nexport const styled = {\n class: (arr: TemplateStringsArray, ...args: any[]) => {\n const style = raw(arr, ...args);\n return flatStyled(style, 'class');\n },\n id: (arr: TemplateStringsArray, ...args: any[]) => {\n const style = raw(arr, ...args);\n return flatStyled(style, 'id');\n },\n keyframes: (arr: TemplateStringsArray, ...args: any[]): StyledValueObject => {\n const keyframesContent = raw(arr, ...args);\n const styledContent = `@keyframes & {${keyframesContent}}`;\n return { styledContent, type: 'keyframes' };\n },\n};\n\nexport function camelToKebabCase(str: string) {\n return str.replace(/[A-Z]/g, ($1: string) => '-' + $1.toLowerCase());\n}\n\nexport function kebabToCamelCase(str: string) {\n return str.replace(/-(.)/g, (_substr, $1: string) => $1.toUpperCase());\n}\n\nexport function cleanObject<T extends Record<string, unknown>>(o: T) {\n Object.keys(o).forEach((key: string) => {\n const k = key as keyof T;\n delete o[k];\n });\n return o;\n}\n\nexport class GemError extends Error {\n constructor(msg: string) {\n super(msg);\n this.message = `gem: ${this.message}`;\n }\n}\n\nexport function isArrayChange(newValues: any[], oldValues: any[]) {\n const length = newValues.length;\n for (let i = 0; i < length; i++) {\n if (newValues[i] !== oldValues[i]) return true;\n }\n return false;\n}\n\nexport function removeItems(target: any[], items: any[]) {\n const set = new Set(items);\n return target.filter((e) => {\n if (set.has(e)) {\n set.delete(e);\n return false;\n }\n return true;\n });\n}\n\nexport function styleMap(obj: Partial<CSSStyleDeclaration>) {\n let styleString = '';\n for (const key in obj) {\n if (obj[key]) {\n styleString += `${camelToKebabCase(key)}:${obj[key]};`;\n }\n }\n return styleString;\n}\n\nexport function classMap(obj: Record<string, boolean>) {\n let classList = ' ';\n for (const className in obj) {\n if (obj[className]) {\n classList += `${className} `;\n }\n }\n return classList;\n}\n\nexport const partMap = classMap;\n","import { addMicrotask, GemError, NonPrimitive } from './utils';\n\nexport const StoreListenerMap = new WeakMap<NonPrimitive, Set<() => void>>();\n\n// 限制 `updateStore` 的参数类型\nexport type Store<T> = T & { '': string };\n\nexport function createStore<T extends NonPrimitive>(originStore: T) {\n if (StoreListenerMap.has(originStore)) {\n throw new GemError('argument error');\n }\n StoreListenerMap.set(originStore, new Set<() => void>());\n return originStore as Store<T>;\n}\n\ninterface StoreObjectSet {\n [store: string]: NonPrimitive;\n}\nexport type StoreSet<T> = {\n [P in keyof T]: T[P] & Store<T[P]>;\n};\nexport function createStoreSet<T extends StoreObjectSet>(originStoreSet: T) {\n const keys = Object.keys(originStoreSet);\n keys.forEach((key) => {\n createStore(originStoreSet[key]);\n });\n\n return originStoreSet as StoreSet<T>;\n}\n\nexport function updateStore<T extends NonPrimitive>(store: Store<T>, value?: Partial<T>) {\n Object.assign(store, value);\n const listeners = StoreListenerMap.get(store);\n listeners?.forEach((func) => {\n addMicrotask(func);\n });\n}\n\nexport function connect<T extends NonPrimitive>(store: Store<T>, func: () => void) {\n const listeners = StoreListenerMap.get(store);\n listeners?.add(func);\n}\n\nexport function disconnect<T extends NonPrimitive>(store: Store<T>, func: () => void) {\n const listeners = StoreListenerMap.get(store);\n listeners?.delete(func);\n}\n","import { createStore, updateStore, Store, connect } from './store';\nimport { QueryString, cleanObject, GemError, absoluteLocation } from './utils';\n\nexport const history = window.history;\nconst location = window.location;\nconst pushState: typeof history.pushState = history.pushState.bind(history);\nconst replaceState: typeof history.replaceState = history.replaceState.bind(history);\n\nlet key = 0;\nconst getKey = () => `${performance.now()}-${++key}`;\n\n// history.state\nexport interface HistoryItem {\n $hasCloseHandle: boolean;\n $hasOpenHandle: boolean;\n $hasShouldCloseHandle: boolean;\n $key: string;\n [index: string]: any;\n}\n\nconst store = createStore<HistoryItem>({\n $hasCloseHandle: false,\n $hasOpenHandle: false,\n $hasShouldCloseHandle: false,\n $key: '',\n});\n\nexport interface UpdateHistoryParams {\n title?: string;\n path?: string; // 不包括 basePath,只有根目录储存末尾斜杠\n query?: string | QueryString; // 包含 `?`\n hash?: string; // 包含 `#`\n // 以下为看不见的状态\n open?: () => void; // 按下前进键时执行\n close?: () => void; // 按下返回键时执行\n shouldClose?: () => boolean; // 按下返回键时判断是否执行 close 函数,返回为 false 时不执行,并恢复 history\n data?: any;\n}\n\n// 实际应用值\ntype HistoryParams = UpdateHistoryParams & { title: string; path: string; query: QueryString; hash: string };\n\n// TODO: WeakRef\nconst paramsMap = new Map<string, HistoryParams>();\n\ndeclare global {\n interface History {\n store: Store<HistoryItem>;\n // 修改会更改 `history.getParams()` 的值\n basePath?: string;\n // 返回 `history` 当前储存的值, 是一个可变对象,当修改 `basePath` 时会改变\n getParams: () => HistoryParams;\n\n push: (params: UpdateHistoryParams) => void;\n replace: (params: UpdateHistoryParams) => void;\n // push 一条历史记录\n // 有 close 处理函数时先执行 closeHandle 在 replace\n // 比如在 modal 打开时跳转页面\n // 不完美:只支持在 1 级 modal 中切换页面\n pushIgnoreCloseHandle: (params: UpdateHistoryParams) => void;\n updateParams: (params: Omit<UpdateHistoryParams, 'path' | 'query' | 'hash' | 'state'>) => void;\n }\n}\n\ntype UpdateHistoryType = 'push' | 'replace';\n\nfunction validData({ $key, $hasCloseHandle, $hasOpenHandle, $hasShouldCloseHandle }: any = {}) {\n if (store.$key === $key) return;\n if ($key) throw new GemError('`$key` is not allowed');\n if ($hasCloseHandle) throw new GemError('`$hasCloseHandle` is not allowed');\n if ($hasOpenHandle) throw new GemError('`$hasOpenHandle` is not allowed');\n if ($hasShouldCloseHandle) throw new GemError('`$hasShouldCloseHandle` is not allowed');\n}\n\nfunction getUrlbarPath(internalPath: string) {\n return history.basePath ? history.basePath + internalPath : internalPath;\n}\n\nfunction getInternalPath(urlbarPath: string) {\n if (urlbarPath === history.basePath) return '/';\n return urlbarPath.replace(new RegExp(`^${history.basePath}/`), '/');\n}\n\nfunction initParams(params: UpdateHistoryParams): HistoryParams {\n const current = paramsMap.get(store.$key) || ({} as HistoryParams);\n // 没提供 path 使用当前 path\n const path = params.path ? absoluteLocation(current.path, params.path) : getInternalPath(location.pathname);\n // 没提供 query 又没有提供 path 时使用当前 search\n const query = new QueryString(params.query || (params.path ? '' : location.search));\n const pathChanged =\n (params.path && params.path !== current.path) || (params.query && String(params.query) !== String(current.query));\n const title = params.title || '';\n const statusChanged = params.close || params.data || params.open || params.shouldClose;\n // 没提供 hash 又没有改变路径又不是状态更新时使用当前 hash\n const hash = params.hash || (!pathChanged && statusChanged ? decodeURIComponent(location.hash) : '');\n return { ...params, title, path, query, hash };\n}\n\nfunction updateHistory(type: UpdateHistoryType, p: UpdateHistoryParams) {\n validData(p.data);\n const params = initParams(p);\n const { title, path, query, hash, close, open, shouldClose, data } = params;\n const state: HistoryItem = {\n $hasCloseHandle: !!close,\n $hasOpenHandle: !!open,\n $hasShouldCloseHandle: !!shouldClose,\n $key: getKey(),\n ...data,\n };\n paramsMap.set(state.$key, params);\n updateStore(cleanObject(store), state);\n const url = getUrlbarPath(path) + new QueryString(query) + hash;\n const prevHave = decodeURIComponent(location.hash);\n (type === 'push' ? pushState : replaceState)(state, title, url);\n if (prevHave !== hash) window.dispatchEvent(new CustomEvent('hashchange'));\n}\n\n// 跨框架时,调用者对 basePath 无感知\nfunction updateHistoryByNative(type: UpdateHistoryType, data: any, title: string, originUrl: string) {\n validData(data);\n const state = {\n $key: getKey(),\n ...(data || {}),\n };\n const { pathname, search, hash } = new URL(originUrl, location.origin + location.pathname);\n const params = initParams({ path: pathname, query: new QueryString(search), hash, title, data });\n paramsMap.set(state.$key, params);\n updateStore(cleanObject(store), state);\n const url = getUrlbarPath(pathname) + params.query + hash;\n const prevHash = location.hash;\n (type === 'push' ? pushState : replaceState)(state, title, url);\n // `location.hash` 和 `hash` 都已经进行了 url 编码,可以直接进行相等判断\n if (prevHash !== hash) window.dispatchEvent(new CustomEvent('hashchange'));\n}\n\nexport const basePathStore = createStore({\n basePath: '',\n});\n\nwindow.addEventListener('hashchange', ({ isTrusted }) => {\n if (isTrusted) {\n history.replace({ hash: decodeURIComponent(location.hash) });\n }\n});\n// 不允许其他框架重写\n// 保持原有功能\nObject.defineProperties(history, {\n basePath: {\n get() {\n return basePathStore.basePath;\n },\n set(basePath: string) {\n // 应用初始化的时候设置\n updateStore(basePathStore, { basePath });\n // paramsMap 更新后 ui 才会更新\n Object.assign(paramsMap.get(store.$key), { path: getInternalPath(location.pathname) });\n },\n },\n getParams: {\n value: function () {\n return paramsMap.get(store.$key);\n },\n },\n updateParams: {\n value: function (params: UpdateHistoryParams) {\n Object.assign(paramsMap.get(store.$key), params);\n updateStore(store, {});\n },\n },\n store: {\n value: store,\n },\n push: {\n value: function (params: UpdateHistoryParams) {\n history.pushState(params, '');\n },\n },\n pushIgnoreCloseHandle: {\n value: function (params: UpdateHistoryParams) {\n if (store.$hasCloseHandle) {\n paramsMap.get(store.$key)?.close?.();\n history.replace(params);\n } else {\n history.push(params);\n }\n },\n },\n replace: {\n value: function (params: UpdateHistoryParams) {\n updateHistory('replace', params);\n },\n },\n});\n\nhistory.pushState = function (data: any, title: string, path: string) {\n if (path) {\n updateHistoryByNative('push', data, title, path);\n } else {\n updateHistory('push', data);\n }\n};\n\nhistory.replaceState = function (data: any, title: string, path: string) {\n updateHistoryByNative('replace', data, title, path);\n};\n\nif (!history.state) {\n // 初始化 historyItem\n const { pathname, search, hash } = location;\n history.replace({ path: pathname, query: search, hash });\n} else if (history.state.$hasCloseHandle) {\n updateStore(store, history.state);\n const params = initParams({ title: document.title });\n paramsMap.set(store.$key, params);\n // 有 handle 返回键的页面刷新需要清除返回 handler\n history.back();\n} else {\n // 有 gem 历史的正常普通刷新, 储存 params\n const params = initParams({ title: document.title, hash: location.hash });\n updateStore(store, {\n $key: getKey(),\n ...(history.state || {}),\n });\n paramsMap.set(store.$key, params);\n}\n\nexport const titleStore = createStore({ title: '' });\n\nconnect(titleStore, () => {\n const params = paramsMap.get(store.$key);\n if (params) {\n params.title = titleStore.title;\n }\n});\n\nconnect(store, () => {\n const { title } = history.getParams();\n if (title !== titleStore.title) {\n updateStore(titleStore, { title });\n }\n});\n\n/**\n * 表示 popstate handler 中正在进行导航\n */\nlet navigating = false;\nwindow.addEventListener('popstate', (event) => {\n const newState = event.state as HistoryItem | null;\n if (!newState?.$key) {\n // 比如作为其他 app 的宿主 app\n return;\n }\n if (navigating) {\n navigating = false;\n return;\n }\n\n // 处理 forward or back\n // replace 不会触发\n\n // 刷新后再导航需要从当前 state 中构建 params\n // 理论上该条历史记录中不会出现事件处理器\n if (!paramsMap.has(newState.$key)) {\n const { pathname, search, hash } = location;\n paramsMap.set(newState.$key, {\n path: pathname,\n query: new QueryString(search),\n hash,\n title: document.title, // 浏览器缓存的 title\n data: newState,\n });\n }\n\n // url 变化前 historyItem\n const prevState = store;\n\n if (parseFloat(newState.$key) > parseFloat(prevState.$key) && newState.$hasOpenHandle) {\n // 返回键关闭的 modal 能前进键重新打开\n // 刷新后不能工作:刷新后 historyItem 中只有 url\n paramsMap.get(newState.$key)?.open?.();\n } else if (prevState.$hasCloseHandle) {\n const prevParams = paramsMap.get(prevState.$key);\n const closeHandle = prevParams?.close;\n const shouldCloseHandle = prevParams?.shouldClose;\n const notAllowClose = shouldCloseHandle && !shouldCloseHandle();\n if (notAllowClose) {\n navigating = true;\n history.forward(); // 将重新触发 popstate\n return; // 历史记录栈位置没有变化,不需要后面的 updateStore\n } else {\n // handle 返回键\n if (closeHandle) {\n closeHandle();\n } else if (newState.$hasCloseHandle) {\n // 有 modal 的页面刷新会执行 back 触发 popstate\n // 如果是二级 modal 页面刷新\n // 则还需要进行一次 back\n // !!! 不完美:三级 modal 页面刷新不支持返回到初始页面\n navigating = true;\n history.back();\n }\n }\n }\n\n updateStore(cleanObject(store), newState);\n});\n","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\nconst directives = new WeakMap();\n/**\n * Brands a function as a directive factory function so that lit-html will call\n * the function during template rendering, rather than passing as a value.\n *\n * A _directive_ is a function that takes a Part as an argument. It has the\n * signature: `(part: Part) => void`.\n *\n * A directive _factory_ is a function that takes arguments for data and\n * configuration and returns a directive. Users of directive usually refer to\n * the directive factory as the directive. For example, \"The repeat directive\".\n *\n * Usually a template author will invoke a directive factory in their template\n * with relevant arguments, which will then return a directive function.\n *\n * Here's an example of using the `repeat()` directive factory that takes an\n * array and a function to render an item:\n *\n * ```js\n * html`<ul><${repeat(items, (item) => html`<li>${item}</li>`)}</ul>`\n * ```\n *\n * When `repeat` is invoked, it returns a directive function that closes over\n * `items` and the template function. When the outer template is rendered, the\n * return directive function is called with the Part for the expression.\n * `repeat` then performs it's custom logic to render multiple items.\n *\n * @param f The directive factory function. Must be a function that returns a\n * function of the signature `(part: Part) => void`. The returned function will\n * be called with the part object.\n *\n * @example\n *\n * import {directive, html} from 'lit-html';\n *\n * const immutable = directive((v) => (part) => {\n * if (part.value !== v) {\n * part.setValue(v)\n * }\n * });\n */\nexport const directive = (f) => ((...args) => {\n const d = f(...args);\n directives.set(d, true);\n return d;\n});\nexport const isDirective = (o) => {\n return typeof o === 'function' && directives.has(o);\n};\n//# sourceMappingURL=directive.js.map","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n/**\n * True if the custom elements polyfill is in use.\n */\nexport const isCEPolyfill = typeof window !== 'undefined' &&\n window.customElements != null &&\n window.customElements.polyfillWrapFlushCallback !==\n undefined;\n/**\n * Reparents nodes, starting from `start` (inclusive) to `end` (exclusive),\n * into another container (could be the same container), before `before`. If\n * `before` is null, it appends the nodes to the container.\n */\nexport const reparentNodes = (container, start, end = null, before = null) => {\n while (start !== end) {\n const n = start.nextSibling;\n container.insertBefore(start, before);\n start = n;\n }\n};\n/**\n * Removes nodes, starting from `start` (inclusive) to `end` (exclusive), from\n * `container`.\n */\nexport const removeNodes = (container, start, end = null) => {\n while (start !== end) {\n const n = start.nextSibling;\n container.removeChild(start);\n start = n;\n }\n};\n//# sourceMappingURL=dom.js.map","/**\n * @license\n * Copyright (c) 2018 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n/**\n * A sentinel value that signals that a value was handled by a directive and\n * should not be written to the DOM.\n */\nexport const noChange = {};\n/**\n * A sentinel value that signals a NodePart to fully clear its content.\n */\nexport const nothing = {};\n//# sourceMappingURL=part.js.map","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n/**\n * An expression marker with embedded unique key to avoid collision with\n * possible text in templates.\n */\nexport const marker = `{{lit-${String(Math.random()).slice(2)}}}`;\n/**\n * An expression marker used text-positions, multi-binding attributes, and\n * attributes with markup-like text values.\n */\nexport const nodeMarker = `<!--${marker}-->`;\nexport const markerRegex = new RegExp(`${marker}|${nodeMarker}`);\n/**\n * Suffix appended to all bound attribute names.\n */\nexport const boundAttributeSuffix = '$lit$';\n/**\n * An updatable Template that tracks the location of dynamic parts.\n */\nexport class Template {\n constructor(result, element) {\n this.parts = [];\n this.element = element;\n const nodesToRemove = [];\n const stack = [];\n // Edge needs all 4 parameters present; IE11 needs 3rd parameter to be null\n const walker = document.createTreeWalker(element.content, 133 /* NodeFilter.SHOW_{ELEMENT|COMMENT|TEXT} */, null, false);\n // Keeps track of the last index associated with a part. We try to delete\n // unnecessary nodes, but we never want to associate two different parts\n // to the same index. They must have a constant node between.\n let lastPartIndex = 0;\n let index = -1;\n let partIndex = 0;\n const { strings, values: { length } } = result;\n while (partIndex < length) {\n const node = walker.nextNode();\n if (node === null) {\n // We've exhausted the content inside a nested template element.\n // Because we still have parts (the outer for-loop), we know:\n // - There is a template in the stack\n // - The walker will find a nextNode outside the template\n walker.currentNode = stack.pop();\n continue;\n }\n index++;\n if (node.nodeType === 1 /* Node.ELEMENT_NODE */) {\n if (node.hasAttributes()) {\n const attributes = node.attributes;\n const { length } = attributes;\n // Per\n // https://developer.mozilla.org/en-US/docs/Web/API/NamedNodeMap,\n // attributes are not guaranteed to be returned in document order.\n // In particular, Edge/IE can return them out of order, so we cannot\n // assume a correspondence between part index and attribute index.\n let count = 0;\n for (let i = 0; i < length; i++) {\n if (endsWith(attributes[i].name, boundAttributeSuffix)) {\n count++;\n }\n }\n while (count-- > 0) {\n // Get the template literal section leading up to the first\n // expression in this attribute\n const stringForPart = strings[partIndex];\n // Find the attribute name\n const name = lastAttributeNameRegex.exec(stringForPart)[2];\n // Find the corresponding attribute\n // All bound attributes have had a suffix added in\n // TemplateResult#getHTML to opt out of special attribute\n // handling. To look up the attribute value we also need to add\n // the suffix.\n const attributeLookupName = name.toLowerCase() + boundAttributeSuffix;\n const attributeValue = node.getAttribute(attributeLookupName);\n node.removeAttribute(attributeLookupName);\n const statics = attributeValue.split(markerRegex);\n this.parts.push({ type: 'attribute', index, name, strings: statics });\n partIndex += statics.length - 1;\n }\n }\n if (node.tagName === 'TEMPLATE') {\n stack.push(node);\n walker.currentNode = node.content;\n }\n }\n else if (node.nodeType === 3 /* Node.TEXT_NODE */) {\n const data = node.data;\n if (data.indexOf(marker) >= 0) {\n const parent = node.parentNode;\n const strings = data.split(markerRegex);\n const lastIndex = strings.length - 1;\n // Generate a new text node for each literal section\n // These nodes are also used as the markers for node parts\n for (let i = 0; i < lastIndex; i++) {\n let insert;\n let s = strings[i];\n if (s === '') {\n insert = createMarker();\n }\n else {\n const match = lastAttributeNameRegex.exec(s);\n if (match !== null && endsWith(match[2], boundAttributeSuffix)) {\n s = s.slice(0, match.index) + match[1] +\n match[2].slice(0, -boundAttributeSuffix.length) + match[3];\n }\n insert = document.createTextNode(s);\n }\n parent.insertBefore(insert, node);\n this.parts.push({ type: 'node', index: ++index });\n }\n // If there's no text, we must insert a comment to mark our place.\n // Else, we can trust it will stick around after cloning.\n if (strings[lastIndex] === '') {\n parent.insertBefore(createMarker(), node);\n nodesToRemove.push(node);\n }\n else {\n node.data = strings[lastIndex];\n }\n // We have a part for each match found\n partIndex += lastIndex;\n }\n }\n else if (node.nodeType === 8 /* Node.COMMENT_NODE */) {\n if (node.data === marker) {\n const parent = node.parentNode;\n // Add a new marker node to be the startNode of the Part if any of\n // the following are true:\n // * We don't have a previousSibling\n // * The previousSibling is already the start of a previous part\n if (node.previousSibling === null || index === lastPartIndex) {\n index++;\n parent.insertBefore(createMarker(), node);\n }\n lastPartIndex = index;\n this.parts.push({ type: 'node', index });\n // If we don't have a nextSibling, keep this node so we have an end.\n // Else, we can remove it to save future costs.\n if (node.nextSibling === null) {\n node.data = '';\n }\n else {\n nodesToRemove.push(node);\n index--;\n }\n partIndex++;\n }\n else {\n let i = -1;\n while ((i = node.data.indexOf(marker, i + 1)) !== -1) {\n // Comment node has a binding marker inside, make an inactive part\n // The binding won't work, but subsequent bindings will\n // TODO (justinfagnani): consider whether it's even worth it to\n // make bindings in comments work\n this.parts.push({ type: 'node', index: -1 });\n partIndex++;\n }\n }\n }\n }\n // Remove text binding nodes after the walk to not disturb the TreeWalker\n for (const n of nodesToRemove) {\n n.parentNode.removeChild(n);\n }\n }\n}\nconst endsWith = (str, suffix) => {\n const index = str.length - suffix.length;\n return index >= 0 && str.slice(index) === suffix;\n};\nexport const isTemplatePartActive = (part) => part.index !== -1;\n// Allows `document.createComment('')` to be renamed for a\n// small manual size-savings.\nexport const createMarker = () => document.createComment('');\n/**\n * This regex extracts the attribute name preceding an attribute-position\n * expression. It does this by matching the syntax allowed for attributes\n * against the string literal directly preceding the expression, assuming that\n * the expression is in an attribute-value position.\n *\n * See attributes in the HTML spec:\n * https://www.w3.org/TR/html5/syntax.html#elements-attributes\n *\n * \" \\x09\\x0a\\x0c\\x0d\" are HTML space characters:\n * https://www.w3.org/TR/html5/infrastructure.html#space-characters\n *\n * \"\\0-\\x1F\\x7F-\\x9F\" are Unicode control characters, which includes every\n * space character except \" \".\n *\n * So an attribute is:\n * * The name: any character except a control character, space character, ('),\n * (\"), \">\", \"=\", or \"/\"\n * * Followed by zero or more space characters\n * * Followed by \"=\"\n * * Followed by zero or more space characters\n * * Followed by:\n * * Any character except space, ('), (\"), \"<\", \">\", \"=\", (`), or\n * * (\") then any non-(\"), or\n * * (') then any non-(')\n */\nexport const lastAttributeNameRegex = \n// eslint-disable-next-line no-control-regex\n/([ \\x09\\x0a\\x0c\\x0d])([^\\0-\\x1F\\x7F-\\x9F \"'>=/]+)([ \\x09\\x0a\\x0c\\x0d]*=[ \\x09\\x0a\\x0c\\x0d]*(?:[^ \\x09\\x0a\\x0c\\x0d\"'`<>=]*|\"[^\"]*|'[^']*))$/;\n//# sourceMappingURL=template.js.map","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\nimport { isCEPolyfill } from './dom.js';\nimport { isTemplatePartActive } from './template.js';\n/**\n * An instance of a `Template` that can be attached to the DOM and updated\n * with new values.\n */\nexport class TemplateInstance {\n constructor(template, processor, options) {\n this.__parts = [];\n this.template = template;\n this.processor = processor;\n this.options = options;\n }\n update(values) {\n let i = 0;\n for (const part of this.__parts) {\n if (part !== undefined) {\n part.setValue(values[i]);\n }\n i++;\n }\n for (const part of this.__parts) {\n if (part !== undefined) {\n part.commit();\n }\n }\n }\n _clone() {\n // There are a number of steps in the lifecycle of a template instance's\n // DOM fragment:\n // 1. Clone - create the instance fragment\n // 2. Adopt - adopt into the main document\n // 3. Process - find part markers and create parts\n // 4. Upgrade - upgrade custom elements\n // 5. Update - set node, attribute, property, etc., values\n // 6. Connect - connect to the document. Optional and outside of this\n // method.\n //\n // We have a few constraints on the ordering of these steps:\n // * We need to upgrade before updating, so that property values will pass\n // through any property setters.\n // * We would like to process before upgrading so that we're sure that the\n // cloned fragment is inert and not disturbed by self-modifying DOM.\n // * We want custom elements to upgrade even in disconnected fragments.\n //\n // Given these constraints, with full custom elements support we would\n // prefer the order: Clone, Process, Adopt, Upgrade, Update, Connect\n //\n // But Safari does not implement CustomElementRegistry#upgrade, so we\n // can not implement that order and still have upgrade-before-update and\n // upgrade disconnected fragments. So we instead sacrifice the\n // process-before-upgrade constraint, since in Custom Elements v1 elements\n // must not modify their light DOM in the constructor. We still have issues\n // when co-existing with CEv0 elements like Polymer 1, and with polyfills\n // that don't strictly adhere to the no-modification rule because shadow\n // DOM, which may be created in the constructor, is emulated by being placed\n // in the light DOM.\n //\n // The resulting order is on native is: Clone, Adopt, Upgrade, Process,\n // Update, Connect. document.importNode() performs Clone, Adopt, and Upgrade\n // in one step.\n //\n // The Custom Elements v1 polyfill supports upgrade(), so the order when\n // polyfilled is the more ideal: Clone, Process, Adopt, Upgrade, Update,\n // Connect.\n const fragment = isCEPolyfill ?\n this.template.element.content.cloneNode(true) :\n document.importNode(this.template.element.content, true);\n const stack = [];\n const parts = this.template.parts;\n // Edge needs all 4 parameters present; IE11 needs 3rd parameter to be null\n const walker = document.createTreeWalker(fragment, 133 /* NodeFilter.SHOW_{ELEMENT|COMMENT|TEXT} */, null, false);\n let partIndex = 0;\n let nodeIndex = 0;\n let part;\n let node = walker.nextNode();\n // Loop through all the nodes and parts of a template\n while (partIndex < parts.length) {\n part = parts[partIndex];\n if (!isTemplatePartActive(part)) {\n this.__parts.push(undefined);\n partIndex++;\n continue;\n }\n // Progress the tree walker until we find our next part's node.\n // Note that multiple parts may share the same node (attribute parts\n // on a single element), so this loop may not run at all.\n while (nodeIndex < part.index) {\n nodeIndex++;\n if (node.nodeName === 'TEMPLATE') {\n stack.push(node);\n walker.currentNode = node.content;\n }\n if ((node = walker.nextNode()) === null) {\n // We've exhausted the content inside a nested template element.\n // Because we still have parts (the outer for-loop), we know:\n // - There is a template in the stack\n // - The walker will find a nextNode outside the template\n walker.currentNode = stack.pop();\n node = walker.nextNode();\n }\n }\n // We've arrived at our part's node.\n if (part.type === 'node') {\n const part = this.processor.handleTextExpression(this.options);\n part.insertAfterNode(node.previousSibling);\n this.__parts.push(part);\n }\n else {\n this.__parts.push(...this.processor.handleAttributeExpressions(node, part.name, part.strings, this.options));\n }\n partIndex++;\n }\n if (isCEPolyfill) {\n document.adoptNode(fragment);\n customElements.upgrade(fragment);\n }\n return fragment;\n }\n}\n//# sourceMappingURL=template-instance.js.map","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n/**\n * @module lit-html\n */\nimport { reparentNodes } from './dom.js';\nimport { boundAttributeSuffix, lastAttributeNameRegex, marker, nodeMarker } from './template.js';\n/**\n * Our TrustedTypePolicy for HTML which is declared using the html template\n * tag function.\n *\n * That HTML is a developer-authored constant, and is parsed with innerHTML\n * before any untrusted expressions have been mixed in. Therefor it is\n * considered safe by construction.\n */\nconst policy = window.trustedTypes &&\n trustedTypes.createPolicy('lit-html', { createHTML: (s) => s });\nconst commentMarker = ` ${marker} `;\n/**\n * The return type of `html`, which holds a Template and the values from\n * interpolated expressions.\n */\nexport class TemplateResult {\n constructor(strings, values, type, processor) {\n this.strings = strings;\n this.values = values;\n this.type = type;\n this.processor = processor;\n }\n /**\n * Returns a string of HTML used to create a `<template>` element.\n */\n getHTML() {\n const l = this.strings.length - 1;\n let html = '';\n let isCommentBinding = false;\n for (let i = 0; i < l; i++) {\n const s = this.strings[i];\n // For each binding we want to determine the kind of marker to insert\n // into the template source before it's parsed by the browser's HTML\n // parser. The marker type is based on whether the expression is in an\n // attribute, text, or comment position.\n // * For node-position bindings we insert a comment with the marker\n // sentinel as its text content, like <!--{{lit-guid}}-->.\n // * For attribute bindings we insert just the marker sentinel for the\n // first binding, so that we support unquoted attribute bindings.\n // Subsequent bindings can use a comment marker because multi-binding\n // attributes must be quoted.\n // * For comment bindings we insert just the marker sentinel so we don't\n // close the comment.\n //\n // The following code scans the template source, but is *not* an HTML\n // parser. We don't need to track the tree structure of the HTML, only\n // whether a binding is inside a comment, and if not, if it appears to be\n // the first binding in an attribute.\n const commentOpen = s.lastIndexOf('<!--');\n // We're in comment position if we have a comment open with no following\n // comment close. Because <-- can appear in an attribute value there can\n // be false positives.\n isCommentBinding = (commentOpen > -1 || isCommentBinding) &&\n s.indexOf('-->', commentOpen + 1) === -1;\n // Check to see if we have an attribute-like sequence preceding the\n // expression. This can match \"name=value\" like structures in text,\n // comments, and attribute values, so there can be false-positives.\n const attributeMatch = lastAttributeNameRegex.exec(s);\n if (attributeMatch === null) {\n // We're only in this branch if we don't have a attribute-like\n // preceding sequence. For comments, this guards against unusual\n // attribute values like <div foo=\"<!--${'bar'}\">. Cases like\n // <!-- foo=${'bar'}--> are handled correctly in the attribute branch\n // below.\n html += s + (isCommentBinding ? commentMarker : nodeMarker);\n }\n else {\n // For attributes we use just a marker sentinel, and also append a\n // $lit$ suffix to the name to opt-out of attribute-specific parsing\n // that IE and Edge do for style and certain SVG attributes.\n html += s.substr(0, attributeMatch.index) + attributeMatch[1] +\n attributeMatch[2] + boundAttributeSuffix + attributeMatch[3] +\n marker;\n }\n }\n html += this.strings[l];\n return html;\n }\n getTemplateElement() {\n const template = document.createElement('template');\n let value = this.getHTML();\n if (policy !== undefined) {\n // this is secure because `this.strings` is a TemplateStringsArray.\n // TODO: validate this when\n // https://github.com/tc39/proposal-array-is-template-object is\n // implemented.\n value = policy.createHTML(value);\n }\n template.innerHTML = value;\n return template;\n }\n}\n/**\n * A TemplateResult for SVG fragments.\n *\n * This class wraps HTML in an `<svg>` tag in order to parse its contents in the\n * SVG namespace, then modifies the template to remove the `<svg>` tag so that\n * clones only container the original fragment.\n */\nexport class SVGTemplateResult extends TemplateResult {\n getHTML() {\n return `<svg>${super.getHTML()}</svg>`;\n }\n getTemplateElement() {\n const template = super.getTemplateElement();\n const content = template.content;\n const svgElement = content.firstChild;\n content.removeChild(svgElement);\n reparentNodes(content, svgElement.firstChild);\n return template;\n }\n}\n//# sourceMappingURL=template-result.js.map","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\nimport { isDirective } from './directive.js';\nimport { removeNodes } from './dom.js';\nimport { noChange, nothing } from './part.js';\nimport { TemplateInstance } from './template-instance.js';\nimport { TemplateResult } from './template-result.js';\nimport { createMarker } from './template.js';\nexport const isPrimitive = (value) => {\n return (value === null ||\n !(typeof value === 'object' || typeof value === 'function'));\n};\nexport const isIterable = (value) => {\n return Array.isArray(value) ||\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n !!(value && value[Symbol.iterator]);\n};\n/**\n * Writes attribute values to the DOM for a group of AttributeParts bound to a\n * single attribute. The value is only set once even if there are multiple parts\n * for an attribute.\n */\nexport class AttributeCommitter {\n constructor(element, name, strings) {\n this.dirty = true;\n this.element = element;\n this.name = name;\n this.strings = strings;\n this.parts = [];\n for (let i = 0; i < strings.length - 1; i++) {\n this.parts[i] = this._createPart();\n }\n }\n /**\n * Creates a single part. Override this to create a differnt type of part.\n */\n _createPart() {\n return new AttributePart(this);\n }\n _getValue() {\n const strings = this.strings;\n const l = strings.length - 1;\n const parts = this.parts;\n // If we're assigning an attribute via syntax like:\n // attr=\"${foo}\" or attr=${foo}\n // but not\n // attr=\"${foo} ${bar}\" or attr=\"${foo} baz\"\n // then we don't want to coerce the attribute value into one long\n // string. Instead we want to just return the value itself directly,\n // so that sanitizeDOMValue can get the actual value rather than\n // String(value)\n // The exception is if v is an array, in which case we do want to smash\n // it together into a string without calling String() on the array.\n //\n // This also allows trusted values (when using TrustedTypes) being\n // assigned to DOM sinks without being stringified in the process.\n if (l === 1 && strings[0] === '' && strings[1] === '') {\n const v = parts[0].value;\n if (typeof v === 'symbol') {\n return String(v);\n }\n if (typeof v === 'string' || !isIterable(v)) {\n return v;\n }\n }\n let text = '';\n for (let i = 0; i < l; i++) {\n text += strings[i];\n const part = parts[i];\n if (part !== undefined) {\n const v = part.value;\n if (isPrimitive(v) || !isIterable(v)) {\n text += typeof v === 'string' ? v : String(v);\n }\n else {\n for (const t of v) {\n text += typeof t === 'string' ? t : String(t);\n }\n }\n }\n }\n text += strings[l];\n return text;\n }\n commit() {\n if (this.dirty) {\n this.dirty = false;\n this.element.setAttribute(this.name, this._getValue());\n }\n }\n}\n/**\n * A Part that controls all or part of an attribute value.\n */\nexport class AttributePart {\n constructor(committer) {\n this.value = undefined;\n this.committer = committer;\n }\n setValue(value) {\n if (value !== noChange && (!isPrimitive(value) || value !== this.value)) {\n this.value = value;\n // If the value is a not a directive, dirty the committer so that it'll\n // call setAttribute. If the value is a directive, it'll dirty the\n // committer if it calls setValue().\n if (!isDirective(value)) {\n this.committer.dirty = true;\n }\n }\n }\n commit() {\n while (isDirective(this.value)) {\n const directive = this.value;\n this.value = noChange;\n directive(this);\n }\n if (this.value === noChange) {\n return;\n }\n this.committer.commit();\n }\n}\n/**\n * A Part that controls a location within a Node tree. Like a Range, NodePart\n * has start and end locations and can set and update the Nodes between those\n * locations.\n *\n * NodeParts support several value types: primitives, Nodes, TemplateResults,\n * as well as arrays and iterables of those types.\n */\nexport class NodePart {\n constructor(options) {\n this.value = undefined;\n this.__pendingValue = undefined;\n this.options = options;\n }\n /**\n * Appends this part into a container.\n *\n * This part must be empty, as its contents are not automatically moved.\n */\n appendInto(container) {\n this.startNode = container.appendChild(createMarker());\n this.endNode = container.appendChild(createMarker());\n }\n /**\n * Inserts this part after the `ref` node (between `ref` and `ref`'s next\n * sibling). Both `ref` and its next sibling must be static, unchanging nodes\n * such as those that appear in a literal section of a template.\n *\n * This part must be empty, as its contents are not automatically moved.\n */\n insertAfterNode(ref) {\n this.startNode = ref;\n this.endNode = ref.nextSibling;\n }\n /**\n * Appends this part into a parent part.\n *\n * This part must be empty, as its contents are not automatically moved.\n */\n appendIntoPart(part) {\n part.__insert(this.startNode = createMarker());\n part.__insert(this.endNode = createMarker());\n }\n /**\n * Inserts this part after the `ref` part.\n *\n * This part must be empty, as its contents are not automatically moved.\n */\n insertAfterPart(ref) {\n ref.__insert(this.startNode = createMarker());\n this.endNode = ref.endNode;\n ref.endNode = this.startNode;\n }\n setValue(value) {\n this.__pendingValue = value;\n }\n commit() {\n if (this.startNode.parentNode === null) {\n return;\n }\n while (isDirective(this.__pendingValue)) {\n const directive = this.__pendingValue;\n this.__pendingValue = noChange;\n directive(this);\n }\n const value = this.__pendingValue;\n if (value === noChange) {\n return;\n }\n if (isPrimitive(value)) {\n if (value !== this.value) {\n this.__commitText(value);\n }\n }\n else if (value instanceof TemplateResult) {\n this.__commitTemplateResult(value);\n }\n else if (value instanceof Node) {\n this.__commitNode(value);\n }\n else if (isIterable(value)) {\n this.__commitIterable(value);\n }\n else if (value === nothing) {\n this.value = nothing;\n this.clear();\n }\n else {\n // Fallback, will render the string representation\n this.__commitText(value);\n }\n }\n __insert(node) {\n this.endNode.parentNode.insertBefore(node, this.endNode);\n }\n __commitNode(value) {\n if (this.value === value) {\n return;\n }\n this.clear();\n this.__insert(value);\n this.value = value;\n }\n __commitText(value) {\n const node = this.startNode.nextSibling;\n value = value == null ? '' : value;\n // If `value` isn't already a string, we explicitly convert it here in case\n // it can't be implicitly converted - i.e. it's a symbol.\n const valueAsString = typeof value === 'string' ? value : String(value);\n if (node === this.endNode.previousSibling &&\n node.nodeType === 3 /* Node.TEXT_NODE */) {\n // If we only have a single text node between the markers, we can just\n // set its value, rather than replacing it.\n // TODO(justinfagnani): Can we just check if this.value is primitive?\n node.data = valueAsString;\n }\n else {\n this.__commitNode(document.createTextNode(valueAsString));\n }\n this.value = value;\n }\n __commitTemplateResult(value) {\n const template = this.options.templateFactory(value);\n if (this.value instanceof TemplateInstance &&\n this.value.template === template) {\n this.value.update(value.values);\n }\n else {\n // Make sure we propagate the template processor from the TemplateResult\n // so that we use its syntax extension, etc. The template factory comes\n // from the render function options so that it can control template\n // caching and preprocessing.\n const instance = new TemplateInstance(template, value.processor, this.options);\n const fragment = instance._clone();\n instance.update(value.values);\n this.__commitNode(fragment);\n this.value = instance;\n }\n }\n __commitIterable(value) {\n // For an Iterable, we create a new InstancePart per item, then set its\n // value to the item. This is a little bit of overhead for every item in\n // an Iterable, but it lets us recurse easily and efficiently update Arrays\n // of TemplateResults that will be commonly returned from expressions like:\n // array.map((i) => html`${i}`), by reusing existing TemplateInstances.\n // If _value is an array, then the previous render was of an\n // iterable and _value will contain the NodeParts from the previous\n // render. If _value is not an array, clear this part and make a new\n // array for NodeParts.\n if (!Array.isArray(this.value)) {\n this.value = [];\n this.clear();\n }\n // Lets us keep track of how many items we stamped so we can clear leftover\n // items from a previous render\n const itemParts = this.value;\n let partIndex = 0;\n let itemPart;\n for (const item of value) {\n // Try to reuse an existing part\n itemPart = itemParts[partIndex];\n // If no existing part, create a new one\n if (itemPart === undefined) {\n itemPart = new NodePart(this.options);\n itemParts.push(itemPart);\n if (partIndex === 0) {\n itemPart.appendIntoPart(this);\n }\n else {\n itemPart.insertAfterPart(itemParts[partIndex - 1]);\n }\n }\n itemPart.setValue(item);\n itemPart.commit();\n partIndex++;\n }\n if (partIndex < itemParts.length) {\n // Truncate the parts array so _value reflects the current state\n itemParts.length = partIndex;\n this.clear(itemPart && itemPart.endNode);\n }\n }\n clear(startNode = this.startNode) {\n removeNodes(this.startNode.parentNode, startNode.nextSibling, this.endNode);\n }\n}\n/**\n * Implements a boolean attribute, roughly as defined in the HTML\n * specification.\n *\n * If the value is truthy, then the attribute is present with a value of\n * ''. If the value is falsey, the attribute is removed.\n */\nexport class BooleanAttributePart {\n constructor(element, name, strings) {\n this.value = undefined;\n this.__pendingValue = undefined;\n if (strings.length !== 2 || strings[0] !== '' || strings[1] !== '') {\n throw new Error('Boolean attributes can only contain a single expression');\n }\n this.element = element;\n this.name = name;\n this.strings = strings;\n }\n setValue(value) {\n this.__pendingValue = value;\n }\n commit() {\n while (isDirective(this.__pendingValue)) {\n const directive = this.__pendingValue;\n this.__pendingValue = noChange;\n directive(this);\n }\n if (this.__pendingValue === noChange) {\n return;\n }\n const value = !!this.__pendingValue;\n if (this.value !== value) {\n if (value) {\n this.element.setAttribute(this.name, '');\n }\n else {\n this.element.removeAttribute(this.name);\n }\n this.value = value;\n }\n this.__pendingValue = noChange;\n }\n}\n/**\n * Sets attribute values for PropertyParts, so that the value is only set once\n * even if there are multiple parts for a property.\n *\n * If an expression controls the whole property value, then the value is simply\n * assigned to the property under control. If there are string literals or\n * multiple expressions, then the strings are expressions are interpolated into\n * a string first.\n */\nexport class PropertyCommitter extends AttributeCommitter {\n constructor(element, name, strings) {\n super(element, name, strings);\n this.single =\n (strings.length === 2 && strings[0] === '' && strings[1] === '');\n }\n _createPart() {\n return new PropertyPart(this);\n }\n _getValue() {\n if (this.single) {\n return this.parts[0].value;\n }\n return super._getValue();\n }\n commit() {\n if (this.dirty) {\n this.dirty = false;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n this.element[this.name] = this._getValue();\n }\n }\n}\nexport class PropertyPart extends AttributePart {\n}\n// Detect event listener options support. If the `capture` property is read\n// from the options object, then options are supported. If not, then the third\n// argument to add/removeEventListener is interpreted as the boolean capture\n// value so we should only pass the `capture` property.\nlet eventOptionsSupported = false;\n// Wrap into an IIFE because MS Edge <= v41 does not support having try/catch\n// blocks right into the body of a module\n(() => {\n try {\n const options = {\n get capture() {\n eventOptionsSupported = true;\n return false;\n }\n };\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n window.addEventListener('test', options, options);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n window.removeEventListener('test', options, options);\n }\n catch (_e) {\n // event options not supported\n }\n})();\nexport class EventPart {\n constructor(element, eventName, eventContext) {\n this.value = undefined;\n this.__pendingValue = undefined;\n this.element = element;\n this.eventName = eventName;\n this.eventContext = eventContext;\n this.__boundHandleEvent = (e) => this.handleEvent(e);\n }\n setValue(value) {\n this.__pendingValue = value;\n }\n commit() {\n while (isDirective(this.__pendingValue)) {\n const directive = this.__pendingValue;\n this.__pendingValue = noChange;\n directive(this);\n }\n if (this.__pendingValue === noChange) {\n return;\n }\n const newListener = this.__pendingValue;\n const oldListener = this.value;\n const shouldRemoveListener = newListener == null ||\n oldListener != null &&\n (newListener.capture !== oldListener.capture ||\n newListener.once !== oldListener.once ||\n newListener.passive !== oldListener.passive);\n const shouldAddListener = newListener != null && (oldListener == null || shouldRemoveListener);\n if (shouldRemoveListener) {\n this.element.removeEventListener(this.eventName, this.__boundHandleEvent, this.__options);\n }\n if (shouldAddListener) {\n this.__options = getOptions(newListener);\n this.element.addEventListener(this.eventName, this.__boundHandleEvent, this.__options);\n }\n this.value = newListener;\n this.__pendingValue = noChange;\n }\n handleEvent(event) {\n if (typeof this.value === 'function') {\n this.value.call(this.eventContext || this.element, event);\n }\n else {\n this.value.handleEvent(event);\n }\n }\n}\n// We copy options because of the inconsistent behavior of browsers when reading\n// the third argument of add/removeEventListener. IE11 doesn't support options\n// at all. Chrome 41 only reads `capture` if the argument is an object.\nconst getOptions = (o) => o &&\n (eventOptionsSupported ?\n { capture: o.capture, passive: o.passive, once: o.once } :\n o.capture);\n//# sourceMappingURL=parts.js.map","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\nimport { AttributeCommitter, BooleanAttributePart, EventPart, NodePart, PropertyCommitter } from './parts.js';\n/**\n * Creates Parts when a template is instantiated.\n */\nexport class DefaultTemplateProcessor {\n /**\n * Create parts for an attribute-position binding, given the event, attribute\n * name, and string literals.\n *\n * @param element The element containing the binding\n * @param name The attribute name\n * @param strings The string literals. There are always at least two strings,\n * event for fully-controlled bindings with a single expression.\n */\n handleAttributeExpressions(element, name, strings, options) {\n const prefix = name[0];\n if (prefix === '.') {\n const committer = new PropertyCommitter(element, name.slice(1), strings);\n return committer.parts;\n }\n if (prefix === '@') {\n return [new EventPart(element, name.slice(1), options.eventContext)];\n }\n if (prefix === '?') {\n return [new BooleanAttributePart(element, name.slice(1), strings)];\n }\n const committer = new AttributeCommitter(element, name, strings);\n return committer.parts;\n }\n /**\n * Create parts for a text-position binding.\n * @param templateFactory\n */\n handleTextExpression(options) {\n return new NodePart(options);\n }\n}\nexport const defaultTemplateProcessor = new DefaultTemplateProcessor();\n//# sourceMappingURL=default-template-processor.js.map","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\nimport { marker, Template } from './template.js';\n/**\n * The default TemplateFactory which caches Templates keyed on\n * result.type and result.strings.\n */\nexport function templateFactory(result) {\n let templateCache = templateCaches.get(result.type);\n if (templateCache === undefined) {\n templateCache = {\n stringsArray: new WeakMap(),\n keyString: new Map()\n };\n templateCaches.set(result.type, templateCache);\n }\n let template = templateCache.stringsArray.get(result.strings);\n if (template !== undefined) {\n return template;\n }\n // If the TemplateStringsArray is new, generate a key from the strings\n // This key is shared between all templates with identical content\n const key = result.strings.join(marker);\n // Check if we already have a Template for this key\n template = templateCache.keyString.get(key);\n if (template === undefined) {\n // If we have not seen this key before, create a new Template\n template = new Template(result, result.getTemplateElement());\n // Cache the Template for this key\n templateCache.keyString.set(key, template);\n }\n // Cache all future queries for this TemplateStringsArray\n templateCache.stringsArray.set(result.strings, template);\n return template;\n}\nexport const templateCaches = new Map();\n//# sourceMappingURL=template-factory.js.map","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\nimport { removeNodes } from './dom.js';\nimport { NodePart } from './parts.js';\nimport { templateFactory } from './template-factory.js';\nexport const parts = new WeakMap();\n/**\n * Renders a template result or other value to a container.\n *\n * To update a container with new values, reevaluate the template literal and\n * call `render` with the new result.\n *\n * @param result Any value renderable by NodePart - typically a TemplateResult\n * created by evaluating a template tag like `html` or `svg`.\n * @param container A DOM parent to render to. The entire contents are either\n * replaced, or efficiently updated if the same result type was previous\n * rendered there.\n * @param options RenderOptions for the entire render tree rendered to this\n * container. Render options must *not* change between renders to the same\n * container, as those changes will not effect previously rendered DOM.\n */\nexport const render = (result, container, options) => {\n let part = parts.get(container);\n if (part === undefined) {\n removeNodes(container, container.firstChild);\n parts.set(container, part = new NodePart(Object.assign({ templateFactory }, options)));\n part.appendInto(container);\n }\n part.setValue(result);\n part.commit();\n};\n//# sourceMappingURL=render.js.map","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n/**\n *\n * Main lit-html module.\n *\n * Main exports:\n *\n * - [[html]]\n * - [[svg]]\n * - [[render]]\n *\n * @packageDocumentation\n */\n/**\n * Do not remove this comment; it keeps typedoc from misplacing the module\n * docs.\n */\nimport { defaultTemplateProcessor } from './lib/default-template-processor.js';\nimport { SVGTemplateResult, TemplateResult } from './lib/template-result.js';\nexport { DefaultTemplateProcessor, defaultTemplateProcessor } from './lib/default-template-processor.js';\nexport { directive, isDirective } from './lib/directive.js';\n// TODO(justinfagnani): remove line when we get NodePart moving methods\nexport { removeNodes, reparentNodes } from './lib/dom.js';\nexport { noChange, nothing } from './lib/part.js';\nexport { AttributeCommitter, AttributePart, BooleanAttributePart, EventPart, isIterable, isPrimitive, NodePart, PropertyCommitter, PropertyPart } from './lib/parts.js';\nexport { parts, render } from './lib/render.js';\nexport { templateCaches, templateFactory } from './lib/template-factory.js';\nexport { TemplateInstance } from './lib/template-instance.js';\nexport { SVGTemplateResult, TemplateResult } from './lib/template-result.js';\nexport { createMarker, isTemplatePartActive, Template } from './lib/template.js';\n// IMPORTANT: do not change the property name or the assignment expression.\n// This line will be used in regexes to search for lit-html usage.\n// TODO(justinfagnani): inject version number at build time\nif (typeof window !== 'undefined') {\n (window['litHtmlVersions'] || (window['litHtmlVersions'] = [])).push('1.4.1');\n}\n/**\n * Interprets a template literal as an HTML template that can efficiently\n * render to and update a container.\n */\nexport const html = (strings, ...values) => new TemplateResult(strings, values, 'html', defaultTemplateProcessor);\n/**\n * Interprets a template literal as an SVG template that can efficiently\n * render to and update a container.\n */\nexport const svg = (strings, ...values) => new SVGTemplateResult(strings, values, 'svg', defaultTemplateProcessor);\n//# sourceMappingURL=lit-html.js.map","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\nimport { createMarker, directive, NodePart, removeNodes, reparentNodes } from '../lit-html.js';\n// Helper functions for manipulating parts\n// TODO(kschaaf): Refactor into Part API?\nconst createAndInsertPart = (containerPart, beforePart) => {\n const container = containerPart.startNode.parentNode;\n const beforeNode = beforePart === undefined ? containerPart.endNode :\n beforePart.startNode;\n const startNode = container.insertBefore(createMarker(), beforeNode);\n container.insertBefore(createMarker(), beforeNode);\n const newPart = new NodePart(containerPart.options);\n newPart.insertAfterNode(startNode);\n return newPart;\n};\nconst updatePart = (part, value) => {\n part.setValue(value);\n part.commit();\n return part;\n};\nconst insertPartBefore = (containerPart, part, ref) => {\n const container = containerPart.startNode.parentNode;\n const beforeNode = ref ? ref.startNode : containerPart.endNode;\n const endNode = part.endNode.nextSibling;\n if (endNode !== beforeNode) {\n reparentNodes(container, part.startNode, endNode, beforeNode);\n }\n};\nconst removePart = (part) => {\n removeNodes(part.startNode.parentNode, part.startNode, part.endNode.nextSibling);\n};\n// Helper for generating a map of array item to its index over a subset\n// of an array (used to lazily generate `newKeyToIndexMap` and\n// `oldKeyToIndexMap`)\nconst generateMap = (list, start, end) => {\n const map = new Map();\n for (let i = start; i <= end; i++) {\n map.set(list[i], i);\n }\n return map;\n};\n// Stores previous ordered list of parts and map of key to index\nconst partListCache = new WeakMap();\nconst keyListCache = new WeakMap();\n/**\n * A directive that repeats a series of values (usually `TemplateResults`)\n * generated from an iterable, and updates those items efficiently when the\n * iterable changes based on user-provided `keys` associated with each item.\n *\n * Note that if a `keyFn` is provided, strict key-to-DOM mapping is maintained,\n * meaning previous DOM for a given key is moved into the new position if\n * needed, and DOM will never be reused with values for different keys (new DOM\n * will always be created for new keys). This is generally the most efficient\n * way to use `repeat` since it performs minimum unnecessary work for insertions\n * and removals.\n *\n * IMPORTANT: If providing a `keyFn`, keys *must* be unique for all items in a\n * given call to `repeat`. The behavior when two or more items have the same key\n * is undefined.\n *\n * If no `keyFn` is provided, this directive will perform similar to mapping\n * items to values, and DOM will be reused against potentially different items.\n */\nexport const repeat = directive((items, keyFnOrTemplate, template) => {\n let keyFn;\n if (template === undefined) {\n template = keyFnOrTemplate;\n }\n else if (keyFnOrTemplate !== undefined) {\n keyFn = keyFnOrTemplate;\n }\n return (containerPart) => {\n if (!(containerPart instanceof NodePart)) {\n throw new Error('repeat can only be used in text bindings');\n }\n // Old part & key lists are retrieved from the last update\n // (associated with the part for this instance of the directive)\n const oldParts = partListCache.get(containerPart) || [];\n const oldKeys = keyListCache.get(containerPart) || [];\n // New part list will be built up as we go (either reused from\n // old parts or created for new keys in this update). This is\n // saved in the above cache at the end of the update.\n const newParts = [];\n // New value list is eagerly generated from items along with a\n // parallel array indicating its key.\n const newValues = [];\n const newKeys = [];\n let index = 0;\n for (const item of items) {\n newKeys[index] = keyFn ? keyFn(item, index) : index;\n newValues[index] = template(item, index);\n index++;\n }\n // Maps from key to index for current and previous update; these\n // are generated lazily only when needed as a performance\n // optimization, since they are only required for multiple\n // non-contiguous changes in the list, which are less common.\n let newKeyToIndexMap;\n let oldKeyToIndexMap;\n // Head and tail pointers to old parts and new values\n let oldHead = 0;\n let oldTail = oldParts.length - 1;\n let newHead = 0;\n let newTail = newValues.length - 1;\n // Overview of O(n) reconciliation algorithm (general approach\n // based on ideas found in ivi, vue, snabbdom, etc.):\n //\n // * We start with the list of old parts and new values (and\n // arrays of their respective keys), head/tail pointers into\n // each, and we build up the new list of parts by updating\n // (and when needed, moving) old parts or creating new ones.\n // The initial scenario might look like this (for brevity of\n // the diagrams, the numbers in the array reflect keys\n // associated with the old parts or new values, although keys\n // and parts/values are actually stored in parallel arrays\n // indexed using the same head/tail pointers):\n //\n // oldHead v v oldTail\n // oldKeys: [0, 1, 2, 3, 4, 5, 6]\n // newParts: [ , , , , , , ]\n // newKeys: [0, 2, 1, 4, 3, 7, 6] <- reflects the user's new\n // item order\n // newHead ^ ^ newTail\n //\n // * Iterate old & new lists from both sides, updating,\n // swapping, or removing parts at the head/tail locations\n // until neither head nor tail can move.\n //\n // * Example below: keys at head pointers match, so update old\n // part 0 in-place (no need to move it) and record part 0 in\n // the `newParts` list. The last thing we do is advance the\n // `oldHead` and `newHead` pointers (will be reflected in the\n // next diagram).\n //\n // oldHead v v oldTail\n // oldKeys: [0, 1, 2, 3, 4, 5, 6]\n // newParts: [0, , , , , , ] <- heads matched: update 0\n // newKeys: [0, 2, 1, 4, 3, 7, 6] and advance both oldHead\n // & newHead\n // newHead ^ ^ newTail\n //\n // * Example below: head pointers don't match, but tail\n // pointers do, so update part 6 in place (no need to move\n // it), and record part 6 in the `newParts` list. Last,\n // advance the `oldTail` and `oldHead` pointers.\n //\n // oldHead v v oldTail\n // oldKeys: [0, 1, 2, 3, 4, 5, 6]\n // newParts: [0, , , , , , 6] <- tails matched: update 6\n // newKeys: [0, 2, 1, 4, 3, 7, 6] and advance both oldTail\n // & newTail\n // newHead ^ ^ newTail\n //\n // * If neither head nor tail match; next check if one of the\n // old head/tail items was removed. We first need to generate\n // the reverse map of new keys to index (`newKeyToIndexMap`),\n // which is done once lazily as a performance optimization,\n // since we only hit this case if multiple non-contiguous\n // changes were made. Note that for contiguous removal\n // anywhere in the list, the head and tails would advance\n // from either end and pass each other before we get to this\n // case and removals would be handled in the final while loop\n // without needing to generate the map.\n //\n // * Example below: The key at `oldTail` was removed (no longer\n // in the `newKeyToIndexMap`), so remove that part from the\n // DOM and advance just the `oldTail` pointer.\n //\n // oldHead v v oldTail\n // oldKeys: [0, 1, 2, 3, 4, 5, 6]\n // newParts: [0, , , , , , 6] <- 5 not in new map: remove\n // newKeys: [0, 2, 1, 4, 3, 7, 6] 5 and advance oldTail\n // newHead ^ ^ newTail\n //\n // * Once head and tail cannot move, any mismatches are due to\n // either new or moved items; if a new key is in the previous\n // \"old key to old index\" map, move the old part to the new\n // location, otherwise create and insert a new part. Note\n // that when moving an old part we null its position in the\n // oldParts array if it lies between the head and tail so we\n // know to skip it when the pointers get there.\n //\n // * Example below: neither head nor tail match, and neither\n // were removed; so find the `newHead` key in the\n // `oldKeyToIndexMap`, and move that old part's DOM into the\n // next head position (before `oldParts[oldHead]`). Last,\n // null the part in the `oldPart` array since it was\n // somewhere in the remaining oldParts still to be scanned\n // (between the head and tail pointers) so that we know to\n // skip that old part on future iterations.\n //\n // oldHead v v oldTail\n // oldKeys: [0, 1, -, 3, 4, 5, 6]\n // newParts: [0, 2, , , , , 6] <- stuck: update & move 2\n // newKeys: [0, 2, 1, 4, 3, 7, 6] into place and advance\n // newHead\n // newHead ^ ^ newTail\n //\n // * Note that for moves/insertions like the one above, a part\n // inserted at the head pointer is inserted before the\n // current `oldParts[oldHead]`, and a part inserted at the\n // tail pointer is inserted before `newParts[newTail+1]`. The\n // seeming asymmetry lies in the fact that new parts are\n // moved into place outside in, so to the right of the head\n // pointer are old parts, and to the right of the tail\n // pointer are new parts.\n //\n // * We always restart back from the top of the algorithm,\n // allowing matching and simple updates in place to\n // continue...\n //\n // * Example below: the head pointers once again match, so\n // simply update part 1 and record it in the `newParts`\n // array. Last, advance both head pointers.\n //\n // oldHead v v oldTail\n // oldKeys: [0, 1, -, 3, 4, 5, 6]\n // newParts: [0, 2, 1, , , , 6] <- heads matched: update 1\n // newKeys: [0, 2, 1, 4, 3, 7, 6] and advance both oldHead\n // & newHead\n // newHead ^ ^ newTail\n //\n // * As mentioned above, items that were moved as a result of\n // being stuck (the final else clause in the code below) are\n // marked with null, so we always advance old pointers over\n // these so we're comparing the next actual old value on\n // either end.\n //\n // * Example below: `oldHead` is null (already placed in\n // newParts), so advance `oldHead`.\n //\n // oldHead v v oldTail\n // oldKeys: [0, 1, -, 3, 4, 5, 6] <- old head already used:\n // newParts: [0, 2, 1, , , , 6] advance oldHead\n // newKeys: [0, 2, 1, 4, 3, 7, 6]\n // newHead ^ ^ newTail\n //\n // * Note it's not critical to mark old parts as null when they\n // are moved from head to tail or tail to head, since they\n // will be outside the pointer range and never visited again.\n //\n // * Example below: Here the old tail key matches the new head\n // key, so the part at the `oldTail` position and move its\n // DOM to the new head position (before `oldParts[oldHead]`).\n // Last, advance `oldTail` and `newHead` pointers.\n //\n // oldHead v v oldTail\n // oldKeys: [0, 1, -, 3, 4, 5, 6]\n // newParts: [0, 2, 1, 4, , , 6] <- old tail matches new\n // newKeys: [0, 2, 1, 4, 3, 7, 6] head: update & move 4,\n // advance oldTail & newHead\n // newHead ^ ^ newTail\n //\n // * Example below: Old and new head keys match, so update the\n // old head part in place, and advance the `oldHead` and\n // `newHead` pointers.\n //\n // oldHead v oldTail\n // oldKeys: [0, 1, -, 3, 4, 5, 6]\n // newParts: [0, 2, 1, 4, 3, ,6] <- heads match: update 3\n // newKeys: [0, 2, 1, 4, 3, 7, 6] and advance oldHead &\n // newHead\n // newHead ^ ^ newTail\n //\n // * Once the new or old pointers move past each other then all\n // we have left is additions (if old list exhausted) or\n // removals (if new list exhausted). Those are handled in the\n // final while loops at the end.\n //\n // * Example below: `oldHead` exceeded `oldTail`, so we're done\n // with the main loop. Create the remaining part and insert\n // it at the new head position, and the update is complete.\n //\n // (oldHead > oldTail)\n // oldKeys: [0, 1, -, 3, 4, 5, 6]\n // newParts: [0, 2, 1, 4, 3, 7 ,6] <- create and insert 7\n // newKeys: [0, 2, 1, 4, 3, 7, 6]\n // newHead ^ newTail\n //\n // * Note that the order of the if/else clauses is not\n // important to the algorithm, as long as the null checks\n // come first (to ensure we're always working on valid old\n // parts) and that the final else clause comes last (since\n // that's where the expensive moves occur). The order of\n // remaining clauses is is just a simple guess at which cases\n // will be most common.\n //\n // * TODO(kschaaf) Note, we could calculate the longest\n // increasing subsequence (LIS) of old items in new position,\n // and only move those not in the LIS set. However that costs\n // O(nlogn) time and adds a bit more code, and only helps\n // make rare types of mutations require fewer moves. The\n // above handles removes, adds, reversal, swaps, and single\n // moves of contiguous items in linear time, in the minimum\n // number of moves. As the number of multiple moves where LIS\n // might help approaches a random shuffle, the LIS\n // optimization becomes less helpful, so it seems not worth\n // the code at this point. Could reconsider if a compelling\n // case arises.\n while (oldHead <= oldTail && newHead <= newTail) {\n if (oldParts[oldHead] === null) {\n // `null` means old part at head has already been used\n // below; skip\n oldHead++;\n }\n else if (oldParts[oldTail] === null) {\n // `null` means old part at tail has already been used\n // below; skip\n oldTail--;\n }\n else if (oldKeys[oldHead] === newKeys[newHead]) {\n // Old head matches new head; update in place\n newParts[newHead] =\n updatePart(oldParts[oldHead], newValues[newHead]);\n oldHead++;\n newHead++;\n }\n else if (oldKeys[oldTail] === newKeys[newTail]) {\n // Old tail matches new tail; update in place\n newParts[newTail] =\n updatePart(oldParts[oldTail], newValues[newTail]);\n oldTail--;\n newTail--;\n }\n else if (oldKeys[oldHead] === newKeys[newTail]) {\n // Old head matches new tail; update and move to new tail\n newParts[newTail] =\n updatePart(oldParts[oldHead], newValues[newTail]);\n insertPartBefore(containerPart, oldParts[oldHead], newParts[newTail + 1]);\n oldHead++;\n newTail--;\n }\n else if (oldKeys[oldTail] === newKeys[newHead]) {\n // Old tail matches new head; update and move to new head\n newParts[newHead] =\n updatePart(oldParts[oldTail], newValues[newHead]);\n insertPartBefore(containerPart, oldParts[oldTail], oldParts[oldHead]);\n oldTail--;\n newHead++;\n }\n else {\n if (newKeyToIndexMap === undefined) {\n // Lazily generate key-to-index maps, used for removals &\n // moves below\n newKeyToIndexMap = generateMap(newKeys, newHead, newTail);\n oldKeyToIndexMap = generateMap(oldKeys, oldHead, oldTail);\n }\n if (!newKeyToIndexMap.has(oldKeys[oldHead])) {\n // Old head is no longer in new list; remove\n removePart(oldParts[oldHead]);\n oldHead++;\n }\n else if (!newKeyToIndexMap.has(oldKeys[oldTail])) {\n // Old tail is no longer in new list; remove\n removePart(oldParts[oldTail]);\n oldTail--;\n }\n else {\n // Any mismatches at this point are due to additions or\n // moves; see if we have an old part we can reuse and move\n // into place\n const oldIndex = oldKeyToIndexMap.get(newKeys[newHead]);\n const oldPart = oldIndex !== undefined ? oldParts[oldIndex] : null;\n if (oldPart === null) {\n // No old part for this value; create a new one and\n // insert it\n const newPart = createAndInsertPart(containerPart, oldParts[oldHead]);\n updatePart(newPart, newValues[newHead]);\n newParts[newHead] = newPart;\n }\n else {\n // Reuse old part\n newParts[newHead] =\n updatePart(oldPart, newValues[newHead]);\n insertPartBefore(containerPart, oldPart, oldParts[oldHead]);\n // This marks the old part as having been used, so that\n // it will be skipped in the first two checks above\n oldParts[oldIndex] = null;\n }\n newHead++;\n }\n }\n }\n // Add parts for any remaining new values\n while (newHead <= newTail) {\n // For all remaining additions, we insert before last new\n // tail, since old pointers are no longer valid\n const newPart = createAndInsertPart(containerPart, newParts[newTail + 1]);\n updatePart(newPart, newValues[newHead]);\n newParts[newHead++] = newPart;\n }\n // Remove any remaining unused old parts\n while (oldHead <= oldTail) {\n const oldPart = oldParts[oldHead++];\n if (oldPart !== null) {\n removePart(oldPart);\n }\n }\n // Save order of new parts for next round\n partListCache.set(containerPart, newParts);\n keyListCache.set(containerPart, newKeys);\n };\n});\n//# sourceMappingURL=repeat.js.map","/**\n * @license\n * Copyright (c) 2018 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\nimport { directive } from '../lit-html.js';\nconst previousValues = new WeakMap();\n/**\n * Prevents re-render of a template function until a single value or an array of\n * values changes.\n *\n * Example:\n *\n * ```js\n * html`\n * <div>\n * ${guard([user.id, company.id], () => html`...`)}\n * </div>\n * ```\n *\n * In this case, the template only renders if either `user.id` or `company.id`\n * changes.\n *\n * guard() is useful with immutable data patterns, by preventing expensive work\n * until data updates.\n *\n * Example:\n *\n * ```js\n * html`\n * <div>\n * ${guard([immutableItems], () => immutableItems.map(i => html`${i}`))}\n * </div>\n * ```\n *\n * In this case, items are mapped over only when the array reference changes.\n *\n * @param value the value to check before re-rendering\n * @param f the template function\n */\nexport const guard = directive((value, f) => (part) => {\n const previousValue = previousValues.get(part);\n if (Array.isArray(value)) {\n // Dirty-check arrays by item\n if (Array.isArray(previousValue) &&\n previousValue.length === value.length &&\n value.every((v, i) => v === previousValue[i])) {\n return;\n }\n }\n else if (previousValue === value &&\n (value !== undefined || previousValues.has(part))) {\n // Dirty-check non-arrays by identity\n return;\n }\n part.setValue(f());\n // Copy the value if it's an array so that if it's mutated we don't forget\n // what the previous values were.\n previousValues.set(part, Array.isArray(value) ? Array.from(value) : value);\n});\n//# sourceMappingURL=guard.js.map","/**\n * @license\n * Copyright (c) 2018 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\nimport { AttributePart, directive } from '../lit-html.js';\nconst previousValues = new WeakMap();\n/**\n * For AttributeParts, sets the attribute if the value is defined and removes\n * the attribute if the value is undefined.\n *\n * For other part types, this directive is a no-op.\n */\nexport const ifDefined = directive((value) => (part) => {\n const previousValue = previousValues.get(part);\n if (value === undefined && part instanceof AttributePart) {\n // If the value is undefined, remove the attribute, but only if the value\n // was previously defined.\n if (previousValue !== undefined || !previousValues.has(part)) {\n const name = part.committer.name;\n part.committer.element.removeAttribute(name);\n }\n }\n else if (value !== previousValue) {\n part.setValue(value);\n }\n previousValues.set(part, value);\n});\n//# sourceMappingURL=if-defined.js.map","import type { GemReflectElement } from '../elements/reflect';\n\nimport { html, render, TemplateResult } from 'lit-html';\nimport { connect, disconnect, Store } from './store';\nimport {\n LinkedList,\n addMicrotask,\n Sheet,\n SheetToken,\n isArrayChange,\n GemError,\n kebabToCamelCase,\n PropProxyMap,\n removeItems,\n useNativeCSSStyleSheet,\n} from './utils';\n\nexport { html, svg, render, directive, TemplateResult, SVGTemplateResult } from 'lit-html';\nexport { repeat } from 'lit-html/directives/repeat';\n\n// https://github.com/Polymer/lit-html/issues/1048\nexport { guard } from 'lit-html/directives/guard';\n\nexport { ifDefined } from 'lit-html/directives/if-defined';\n\ntype CustomStateSet = Set<string>;\n\ndeclare global {\n interface ElementInternals extends ARIAMixin {\n states: CustomStateSet;\n // https://w3c.github.io/aria/#role_definitions\n role?: string;\n }\n // 用于 css 选择器选择元素,使用 @refobject 自动选择获取\n // 必须使用 attr 赋值\n /**\n * @attr ref\n * @attr inert\n */\n interface HTMLElement {\n attachInternals: () => ElementInternals;\n inert: boolean;\n }\n}\n\nfunction emptyFunction() {\n // 用于占位的空函数\n}\n\nfunction execCallback(fun: any) {\n typeof fun === 'function' && fun();\n}\n\n// global render task pool\nconst asyncRenderTaskList = new LinkedList<() => void>();\nconst tick = (timeStamp = performance.now()) => {\n if (performance.now() > timeStamp + 16) return requestAnimationFrame(tick);\n const task = asyncRenderTaskList.get();\n if (task) {\n task();\n tick(timeStamp);\n }\n};\nasyncRenderTaskList.addEventListener('start', () => addMicrotask(tick));\n\ntype GetDepFun<T> = () => T;\ntype EffectCallback<T> = (depValues: T, oldDepValues?: T) => any;\ntype EffectItem<T> = {\n callback: EffectCallback<T>;\n initialized: boolean;\n values?: T;\n getDep?: GetDepFun<T>;\n preCallback?: () => void;\n};\n\nconst initSymbol = Symbol('init');\nconst updateSymbol = Symbol('update');\n\nexport interface GemElementOptions {\n isLight?: boolean;\n isAsync?: boolean;\n delegatesFocus?: boolean;\n}\n\nexport abstract class GemElement<T = Record<string, unknown>> extends HTMLElement {\n // 这里只是字段申明,不能赋值,否则子类会继承被共享该字段\n static observedAttributes?: string[]; // WebAPI 中是实时检查这个列表\n static booleanAttributes?: Set<string>;\n static numberAttributes?: Set<string>;\n static observedPropertys?: string[];\n static observedStores?: Store<unknown>[];\n static adoptedStyleSheets?: Sheet<unknown>[];\n static defineEvents?: string[];\n static defineCSSStates?: string[];\n static defineRefs?: string[];\n // 以下静态字段仅供外部读取,没有实际作用\n static defineParts?: string[];\n static defineSlots?: string[];\n // 指定 root 元素类型\n static rootElement?: string;\n\n // 定义当前元素的状态,和 attr/prop 的本质区别是不为外部输入\n readonly state?: T;\n\n #renderRoot: HTMLElement | ShadowRoot;\n #internals?: ElementInternals;\n #isAppendReason?: boolean;\n #isAsync?: boolean;\n #effectList?: EffectItem<any>[];\n #momeList?: EffectItem<any>[];\n #unmountCallback?: any;\n\n constructor({ isAsync, isLight, delegatesFocus }: GemElementOptions = {}) {\n super();\n\n // 外部不可见,但允许类外面使用\n addMicrotask(() => ((this as any)[initSymbol] = false));\n (this as any)[initSymbol] = true;\n (this as any)[updateSymbol] = () => {\n if (this.isConnected) {\n addMicrotask(this.#update);\n }\n };\n\n this.#isAsync = isAsync;\n this.#renderRoot = isLight ? this : this.attachShadow({ mode: 'open', delegatesFocus });\n\n const { adoptedStyleSheets } = new.target;\n if (adoptedStyleSheets) {\n const sheets = adoptedStyleSheets.map((item) => item[SheetToken] || item);\n if (this.shadowRoot) {\n this.shadowRoot.adoptedStyleSheets = sheets;\n } else {\n this.effect(\n () => {\n const root = this.getRootNode() as ShadowRoot;\n root.adoptedStyleSheets = [...root.adoptedStyleSheets, ...sheets];\n return () => {\n root.adoptedStyleSheets = removeItems(root.adoptedStyleSheets, sheets);\n };\n },\n () => [],\n );\n }\n }\n }\n\n get internals() {\n if (!this.#internals) {\n const getCustomStateSet = () => {\n // https://wicg.github.io/custom-state-pseudo-class/\n const getV = (v: string) => v.replace(/-/g, '');\n return {\n has: (v) => getV(v) in this.dataset,\n add: (v) => {\n this.dataset[getV(v)] = '';\n },\n delete: (v) => delete this.dataset[getV(v)],\n } as CustomStateSet;\n };\n if (!this.attachInternals) {\n // https://bugs.webkit.org/show_bug.cgi?id=197960\n this.attachInternals = () => {\n return { states: getCustomStateSet() } as any;\n };\n }\n this.#internals = this.attachInternals();\n if (!this.#internals.states) {\n // https://bugzilla.mozilla.org/show_bug.cgi?id=1588763\n this.#internals.states = getCustomStateSet();\n }\n }\n return this.#internals;\n }\n\n /**\n * @helper\n * 设置元素 state,会触发更新\n *\n * ```js\n * class App extends GemElement {\n * click() {\n * this.setState({});\n * }\n * }\n * ```\n * */\n setState = (payload: Partial<T>) => {\n if (!this.state) throw new GemError('`state` not initialized');\n Object.assign(this.state, payload);\n addMicrotask(this.#update);\n };\n\n #exec = (list?: EffectItem<any>[]) => {\n list?.forEach((effectItem) => {\n const { callback, getDep, values, preCallback } = effectItem;\n const newValues = getDep?.();\n if (!getDep || !values || isArrayChange(values, newValues)) {\n execCallback(preCallback);\n effectItem.preCallback = callback(newValues, values);\n effectItem.values = newValues;\n }\n });\n };\n\n /**\n * 每次更新完检查依赖,执行对应的副作用回调\n * */\n #execEffect = () => {\n this.#exec(this.#effectList);\n };\n\n #execMemo = () => {\n this.#exec(this.#momeList);\n };\n\n /**\n * @helper\n * 记录副作用回调和值,在 `constructor`/`mounted` 中使用\n * 回调到返回值如果是函数将再卸载时执行\n *\n * ```js\n * class App extends GemElement {\n * mounted() {\n * this.effect(callback, () => [this.attrName]);\n * }\n * }\n * ```\n * */\n effect = <T = any[] | undefined>(\n callback: EffectCallback<T>,\n getDep?: T extends any[] ? () => [...T] : undefined,\n ) => {\n if (!this.#effectList) this.#effectList = [];\n const effectItem: EffectItem<T> = {\n callback,\n getDep,\n values: undefined,\n initialized: !!this.isConnected,\n };\n // 以挂载时立即执行副作用,未挂载时等挂载后执行\n if (this.isConnected) {\n effectItem.values = getDep?.() as T;\n effectItem.preCallback = callback(effectItem.values);\n }\n this.#effectList.push(effectItem);\n };\n\n /**\n * @helper\n * 在 `render` 前执行回调,和 `effect` 一样接受依赖数组参数,在 `constructor`/`willMount` 中使用\n *\n * ```js\n * class App extends GemElement {\n * willMount() {\n * this.memo(() => {\n * this.a = exec(this.attrName);\n * }), () => [this.attrName]);\n * }\n * }\n * ```\n * */\n memo = <T = any[] | undefined>(callback: EffectCallback<T>, getDep?: T extends any[] ? () => [...T] : undefined) => {\n if (!this.#momeList) this.#momeList = [];\n this.#momeList.push({\n callback,\n getDep,\n values: [Symbol()],\n // 是否是 `willMount` 中定义\n initialized: this.isConnected,\n });\n };\n\n /**\n * 元素挂载后执行还未初始化的副作用\n * */\n #initEffect = () => {\n this.#effectList?.forEach((effectItem) => {\n const { callback, getDep, initialized } = effectItem;\n if (!initialized) {\n effectItem.values = getDep?.();\n effectItem.preCallback = callback(effectItem.values);\n effectItem.initialized = true;\n }\n });\n };\n\n /**@lifecycle */\n willMount?(): void | Promise<void>;\n\n /**\n * @lifecycle\n * 返回 null 时渲染 lit-html 定义的空内容\n * 返回 undefined 时不会调用 `render()`\n * */\n render?(): TemplateResult | null | undefined;\n\n #render = () => {\n this.#execMemo();\n const styles = useNativeCSSStyleSheet\n ? ''\n : html`${this.shadowRoot?.adoptedStyleSheets?.map(\n (e: any) =>\n html`\n <style media=${e.media.mediaText}>\n ${e.style}\n </style>\n `,\n )}`;\n if (this.render) return html`${this.render()}${styles}`;\n return this.#renderRoot === this ? undefined : html`<slot></slot>${styles}`;\n };\n\n /**@lifecycle */\n mounted?(): void | (() => void) | Promise<void>;\n\n /**@lifecycle */\n shouldUpdate?(): boolean;\n #shouldUpdate = () => {\n return this.shouldUpdate ? this.shouldUpdate() : true;\n };\n\n #updateCallback = () => {\n if (this.isConnected && this.#shouldUpdate()) {\n const temp = this.#render();\n temp !== undefined && render(temp, this.#renderRoot);\n addMicrotask(this.#updated);\n addMicrotask(this.#execEffect);\n }\n };\n\n #update = () => {\n if (this.#isAsync) {\n asyncRenderTaskList.add(this.#updateCallback);\n } else {\n this.#updateCallback();\n }\n };\n\n /**\n * @helper\n * async\n */\n update = () => {\n addMicrotask(this.#update);\n };\n\n /**@lifecycle */\n updated?(): void | Promise<void>;\n #updated = () => {\n this.updated?.();\n };\n\n /**\n * @lifecycle\n *\n * 卸载元素,但不一定会被垃圾回收,所以事件监听器需要手动清除,以免重复注册\n */\n unmounted?(): void | Promise<void>;\n\n /**\n * @private\n * @final\n * use `effect`\n */\n attributeChangedCallback() {\n if (this.isConnected) {\n addMicrotask(this.#update);\n }\n }\n\n #connectedCallback = () => {\n if (this.#isAppendReason) {\n this.#isAppendReason = false;\n return;\n }\n this.willMount?.();\n const { observedStores, rootElement } = this.constructor as typeof GemElement;\n observedStores?.forEach((store) => {\n connect(store, this.#update);\n });\n const temp = this.#render();\n temp !== undefined && render(temp, this.#renderRoot);\n this.#unmountCallback = this.mounted?.();\n this.#initEffect();\n if (rootElement && (this.getRootNode() as ShadowRoot).host?.tagName !== rootElement.toUpperCase()) {\n throw new GemError(`not allow current root type`);\n }\n };\n\n closestElement<K extends keyof HTMLElementTagNameMap>(tag: K): HTMLElementTagNameMap[K] | null;\n closestElement<K extends abstract new (...args: any) => any>(constructor: K): InstanceType<K> | null;\n closestElement<K extends abstract new (...args: any) => any>(constructorOrTag: K | string): Element | null {\n const isConstructor = typeof constructorOrTag === 'function';\n const tagName = typeof constructorOrTag === 'string' && constructorOrTag.toUpperCase();\n const getRootElement = (ele: Element): Element | null => {\n const rootEle = ele.parentElement || (ele.getRootNode() as ShadowRoot).host;\n if (!rootEle) return null;\n if (isConstructor) {\n if (rootEle.constructor === constructorOrTag) {\n return rootEle;\n }\n } else if (rootEle.tagName === tagName) {\n return rootEle;\n }\n return getRootElement(rootEle);\n };\n return getRootElement(this);\n }\n\n /**\n * @private\n * @final\n * use `mounted`\n */\n connectedCallback() {\n if (this.#isAsync) {\n asyncRenderTaskList.add(this.#connectedCallback);\n } else {\n this.#connectedCallback();\n }\n }\n\n /**\n * @private\n * @final\n */\n // adoptedCallback() {}\n\n /**\n * @private\n * @final\n * use `unmounted`\n */\n disconnectedCallback() {\n if (this.isConnected) {\n this.#isAppendReason = true;\n return;\n }\n const { observedStores } = this.constructor as typeof GemElement;\n observedStores?.forEach((store) => {\n disconnect(store, this.#update);\n });\n execCallback(this.#unmountCallback);\n this.unmounted?.();\n this.#effectList?.forEach((effectItem) => {\n execCallback(effectItem.preCallback);\n });\n this.#momeList = this.#momeList?.filter(({ initialized }) => !initialized);\n }\n}\n\nconst gemElementProxyMap = new PropProxyMap<GemElement>();\n\nexport function defineAttribute(target: GemElement, prop: string, attr: string) {\n const { booleanAttributes, numberAttributes } = target.constructor as typeof GemElement;\n Object.defineProperty(target, prop, {\n configurable: true,\n get() {\n // fix karma test\n // 判断是否是自定义元素实例\n if (!(initSymbol in this)) return;\n const that = this as GemElement;\n // 不能从 proxy 对象中读取值\n const value = that.getAttribute(attr);\n if (booleanAttributes?.has(attr)) {\n return value === null ? false : true;\n }\n if (numberAttributes?.has(attr)) {\n return Number(value);\n }\n return value || '';\n },\n set(v: string | null | undefined | number | boolean) {\n const that = this as GemElement;\n const proxy = gemElementProxyMap.get(this) as any;\n const hasSet = proxy[prop];\n const value = that.getAttribute(attr);\n // https://github.com/whatwg/dom/issues/922\n if (this[initSymbol] && value !== null && !hasSet) return;\n // 字段和构造函数中都有对 attr 设置时会执行多次\n // Firefox WebConsole 中不知道为什么在构造函数中 this[initSymbol] 已经为 false\n proxy[prop] = true;\n const isBool = booleanAttributes?.has(attr);\n if (v === null || v === undefined) {\n that.removeAttribute(attr);\n } else if (isBool) {\n // 当 attr 存在且 !!v 为 true 时,toggleAttribute 不会造成 Attribute 改变\n that.toggleAttribute(attr, !!v);\n } else {\n if (value !== String(v)) that.setAttribute(attr, String(v));\n }\n },\n });\n}\n\nconst isEventHandleSymbol = Symbol('event handle');\nexport function defineProperty(\n target: GemElement,\n prop: string,\n event?: string,\n eventOptions?: Omit<CustomEventInit<unknown>, 'detail'>,\n) {\n Object.defineProperty(target, prop, {\n configurable: true,\n get() {\n const value = gemElementProxyMap.get(this)[prop];\n if (value || !event) {\n return value;\n } else {\n this[prop] = emptyFunction;\n return this[prop];\n }\n },\n set(v) {\n const that = this as GemElement;\n const proxy = gemElementProxyMap.get(that) as any;\n if (v !== proxy[prop]) {\n if (event) {\n proxy[prop] = v?.[isEventHandleSymbol]\n ? v\n : (detail: any, options: any) => {\n const evt = new CustomEvent(event, { ...options, ...eventOptions, detail });\n that.dispatchEvent(evt);\n v(detail, options);\n };\n proxy[prop][isEventHandleSymbol] = true;\n // emitter 不触发元素更新\n } else {\n proxy[prop] = v;\n this[updateSymbol]();\n }\n }\n },\n });\n}\n\nexport function defineRef(target: GemElement, prop: string, ref: string) {\n Object.defineProperty(target, prop, {\n configurable: true,\n get() {\n const proxy = gemElementProxyMap.get(this);\n let refobject = proxy[prop];\n if (!refobject) {\n const that = this as GemElement;\n const ele = that.shadowRoot || that;\n refobject = {\n get ref() {\n return ref;\n },\n get element() {\n const gemReflects = ([...ele.querySelectorAll('gem-reflect')] as GemReflectElement[]).map((e) => e.target);\n for (const e of [ele, ...gemReflects]) {\n const result = e.querySelector(`[ref=${ref}]`);\n if (result) return result;\n }\n },\n };\n proxy[prop] = refobject;\n }\n return refobject;\n },\n });\n}\n\nexport function defineCSSState(target: GemElement, prop: string, state: string) {\n Object.defineProperty(target, prop, {\n configurable: true,\n get() {\n const that = this as GemElement;\n const { states } = that.internals;\n return states.has?.(state);\n },\n set(v: boolean) {\n const that = this as GemElement;\n const { states } = that.internals;\n if (v) {\n states.add(state);\n } else {\n states.delete(state);\n }\n },\n });\n}\n\nexport const nativeDefineElement = customElements.define.bind(customElements);\ncustomElements.define = (name: string, cls: CustomElementConstructor, options?: ElementDefinitionOptions) => {\n if (cls.prototype instanceof GemElement) {\n const { observedAttributes, observedPropertys, defineEvents, defineCSSStates, defineRefs } =\n cls as unknown as typeof GemElement;\n observedAttributes?.forEach((attr) => defineAttribute(cls.prototype, kebabToCamelCase(attr), attr));\n observedPropertys?.forEach((prop) => defineProperty(cls.prototype, prop));\n defineEvents?.forEach((event) => defineProperty(cls.prototype, kebabToCamelCase(event), event));\n defineCSSStates?.forEach((state) => defineCSSState(cls.prototype, kebabToCamelCase(state), `--${state}`));\n defineRefs?.forEach((ref) => defineRef(cls.prototype, kebabToCamelCase(ref), ref));\n }\n\n nativeDefineElement(name, cls as CustomElementConstructor, options);\n};\n","import { defineAttribute, defineCSSState, defineProperty, defineRef, GemElement, nativeDefineElement } from './element';\nimport { Store } from './store';\nimport { Sheet, camelToKebabCase, randomStr } from './utils';\n\ntype GemElementPrototype = GemElement<any>;\ntype GemElementConstructor = typeof GemElement;\ntype StaticField = Exclude<keyof GemElementConstructor, 'prototype' | 'rootElement'>;\ntype StaticFieldMember = string | Store<unknown> | Sheet<unknown>;\n\nfunction pushStaticField(target: GemElementPrototype, field: StaticField, member: StaticFieldMember, isSet = false) {\n const cls = target.constructor as GemElementConstructor;\n const current = cls[field];\n if (!cls.hasOwnProperty(field)) {\n Object.defineProperty(cls, field, {\n value: isSet ? new Set<unknown>(current) : current ? Array.from<any>(current) : [],\n });\n }\n\n (cls[field] as any)[isSet ? 'add' : 'push'](member);\n}\n\nexport type RefObject<T = HTMLElement> = { ref: string; element: T | undefined };\n\n/**\n * 引用元素,只有第一个标记 ref 的元素有效\n *\n * For example\n * ```ts\n * class App extends GemElement {\n * @refobject childRef: RefObject<Children>;\n * loadHandle = () => {\n * const { element } = this.childRef;\n * console.log(element);\n * };\n * render() {\n * render html`<div ref=${this.childRef.ref}><div>`;\n * }\n * }\n * ```\n */\nexport function refobject(target: GemElementPrototype, prop: string) {\n const ref = `${camelToKebabCase(prop)}-${randomStr()}`;\n pushStaticField(target, 'defineRefs', ref);\n defineRef(target, prop, ref);\n}\n\n/**\n * 定义一个响应式的 attribute,驼峰字段名将自动映射到烤串 attribute,默认值为空字符串\n *\n * For example\n * ```ts\n * class App extends GemElement {\n * @attribute attr: string;\n * }\n * ```\n */\nfunction defineAttr(target: GemElementPrototype, prop: string, attr: string) {\n pushStaticField(target, 'observedAttributes', attr);\n defineAttribute(target, prop, attr);\n}\nexport function attribute(target: GemElementPrototype, prop: string) {\n defineAttr(target, prop, camelToKebabCase(prop));\n}\nexport function boolattribute(target: GemElementPrototype, prop: string) {\n const attr = camelToKebabCase(prop);\n pushStaticField(target, 'booleanAttributes', attr, true);\n defineAttr(target, prop, attr);\n}\nexport function numattribute(target: GemElementPrototype, prop: string) {\n const attr = camelToKebabCase(prop);\n pushStaticField(target, 'numberAttributes', attr, true);\n defineAttr(target, prop, attr);\n}\n\n/**\n * 定义一个响应式的 property,注意值可能为 `undefined`\n *\n * For example\n * ```ts\n * class App extends GemElement {\n * @property prop: Data | undefined;\n * }\n * ```\n */\nexport function property(target: GemElementPrototype, prop: string) {\n pushStaticField(target, 'observedPropertys', prop);\n defineProperty(target, prop);\n}\n\n/**\n * 定义一个元素[内部](https://html.spec.whatwg.org/multipage/custom-elements.html#elementinternals) state,\n * 类似 `:checked`,用于自定义 css 伪类(:--xxx),默认值即为字段名。\n * 重新赋值转换 css 伪类\n * 将来也可能用于 IDE 识别\n *\n * For example\n * ```ts\n * class App extends GemElement {\n * @state state: boolean;\n * }\n * ```\n */\nexport function state(target: GemElementPrototype, prop: string) {\n const attr = camelToKebabCase(prop);\n pushStaticField(target, 'defineCSSStates', attr);\n defineCSSState(target, prop, `--${attr}`);\n}\n\n/**\n * 定义一个内部 slot,默认值即为字段名,不能使用全局属性 `slot`\n *\n * For example\n * ```ts\n * class App extends GemElement {\n * @slot slot: string;\n * @slot static slot: string;\n * }\n * ```\n */\nexport function slot(target: any, prop: string) {\n const attr = camelToKebabCase((target as any)[prop] || prop);\n (target as any)[prop] = attr;\n pushStaticField(target instanceof GemElement ? target : target.prototype, 'defineSlots', attr);\n}\n\n/**\n * 定义一个内部 part,默认值即为字段名,不能使用全局属性 `part`\n *\n * For example\n * ```ts\n * class App extends GemElement {\n * @part part: string;\n * @part static part: string;\n * }\n * ```\n */\nexport function part(target: any, prop: string) {\n const attr = camelToKebabCase((target as any)[prop] || prop);\n (target as any)[prop] = attr;\n pushStaticField(target instanceof GemElement ? target : target.prototype, 'defineParts', attr);\n}\n\nexport type Emitter<T = any> = (detail: T, options?: Omit<CustomEventInit<unknown>, 'detail'>) => void;\n\n/**\n * 定义一个事件发射器,类似 `HTMLElement.click`,\n * 调用时将同步发送一个和字段名称的烤串式格式的自定义事件\n *\n * For example\n * ```ts\n * class App extends GemElement {\n * @emitter load: Function;\n * }\n * ```\n */\nexport function emitter(target: GemElementPrototype, prop: string) {\n defineEmitter(target, prop);\n}\nexport function globalemitter(target: GemElementPrototype, prop: string) {\n defineEmitter(target, prop, { bubbles: true, composed: true });\n}\nfunction defineEmitter(target: GemElementPrototype, prop: string, options?: Omit<CustomEventInit<unknown>, 'detail'>) {\n const event = camelToKebabCase(prop);\n pushStaticField(target, 'defineEvents', event);\n defineProperty(target, prop, event, options);\n}\n\n/**\n * 分配一个构造的样式表,如果元素是 lightDOM,则将样式表挂载到 RootNode 上\n *\n * For example\n * ```ts\n * @adoptedStyle(stylesheet)\n * class App extends GemElement {}\n * ```\n */\nexport function adoptedStyle(style: Sheet<unknown>) {\n return function (cls: unknown) {\n const con = cls as GemElementConstructor;\n pushStaticField(con.prototype, 'adoptedStyleSheets', style);\n };\n}\n\n/**\n * 链接一个 store,当 store 更新时更新元素\n *\n * For example\n * ```ts\n * @connectStore(store)\n * class App extends GemElement {}\n * ```\n */\nexport function connectStore(store: Store<unknown>) {\n // 这里的签名该怎么写?\n return function (cls: unknown) {\n const con = cls as GemElementConstructor;\n pushStaticField(con.prototype, 'observedStores', store);\n };\n}\n\n/**\n * 限制元素的 root 节点类型\n *\n * For example\n * ```ts\n * @rootElement(MyElement)\n * class App extends GemElement {}\n * ```\n */\nexport function rootElement(rootType: string) {\n return function (cls: unknown) {\n const con = cls as GemElementConstructor;\n con.rootElement = rootType;\n };\n}\n\n/**\n * 定义自定义元素\n *\n * For example\n * ```ts\n * @customElement('my-element')\n * class App extends GemElement {}\n * ```\n */\nexport function customElement(name: string) {\n return function (cls: unknown) {\n nativeDefineElement(name, cls as CustomElementConstructor);\n };\n}\n","// Do not modify manually\nexport const version = '1.6.1';\n","import { updateStore } from './lib/store';\nimport * as Gem from './';\n\nexport interface DevToolsHook {\n updateStore: typeof updateStore;\n}\n\ndeclare global {\n interface Window {\n __GEM_DEVTOOLS__HOOK__?: DevToolsHook;\n }\n}\n\nif (window.__GEM_DEVTOOLS__HOOK__) {\n // 不支持多个 gem\n Object.assign(window.__GEM_DEVTOOLS__HOOK__, { ...Gem });\n}\n\nexport * from './lib/store';\nexport * from './lib/history';\nexport * from './lib/element';\nexport * from './lib/decorators';\nexport * from './lib/utils';\n\nexport * from './lib/version';\n","import {\n html,\n GemElement,\n customElement,\n connectStore,\n property,\n emitter,\n Emitter,\n history,\n TemplateResult,\n UpdateHistoryParams,\n titleStore,\n updateStore,\n Store,\n QueryString,\n createStore,\n} from '../';\n\ninterface NamePostition {\n [index: string]: number;\n}\n\n// TODO: use `URLPattern`\nclass ParamsRegExp extends RegExp {\n namePosition: NamePostition;\n constructor(pattern: string) {\n const namePosition: NamePostition = {};\n let i = 0;\n super(\n `^${pattern\n .replace(/:([^/$]+)/g, (_m, name: string) => {\n namePosition[name] = i++;\n return `([^/]+)`;\n })\n .replace('*', '.*')}$`,\n 'i',\n );\n this.namePosition = namePosition;\n }\n}\n\ntype Params = Record<string, string>;\n\n// `/a/b/:c/:d` `/a/b/1/2`\n// 匹配成功时返回 params\nexport function matchPath(pattern: string, path: string) {\n const reg = new ParamsRegExp(pattern);\n const matchResult = path.match(reg) || `${path}/`.match(reg);\n if (!matchResult) return null;\n const params: Params = {};\n if (matchResult) {\n Object.keys(reg.namePosition).forEach((name) => {\n params[name] = matchResult[reg.namePosition[name] + 1];\n });\n }\n return params;\n}\n\nexport interface RouteItem<T = unknown> {\n // 支持 *\n // 支持 /a/*\n // 不支持相对路径\n // 不能匹配查询字符串\n pattern: string;\n redirect?: string;\n content?: TemplateResult;\n getContent?: (params: Params) => TemplateResult | Promise<TemplateResult>;\n title?: string;\n // 用来传递数据\n data?: T;\n}\n\ntype RoutesObject = Record<string, RouteItem>;\n\n// params 中的成员不会验证\nexport interface RouteOptions extends Omit<UpdateHistoryParams, 'path'> {\n params?: Params;\n}\n\n// 从路由创建路径\n// 不包含 basePath\nexport function createPath(route: RouteItem, options?: RouteOptions) {\n let path = route.pattern;\n const params = options?.params;\n if (params) {\n Object.keys(params).forEach((key) => {\n path = path.replace(new RegExp(`:${key}`, 'g'), params[key]);\n });\n }\n return path;\n}\n\nexport function createHistoryParams(route: RouteItem, options?: RouteOptions): UpdateHistoryParams {\n const path = createPath(route, options);\n return {\n path,\n ...options,\n };\n}\n\ninterface ConstructorOptions {\n isLight?: boolean;\n routes?: RouteItem[] | RoutesObject;\n}\n\ntype State = {\n content?: TemplateResult;\n};\n\n/**\n * @customElement gem-route\n * @attr inert 暂停路由更新\n * @fires route-change\n * @fires error\n * @fires loading\n */\n@connectStore(history.store)\n@customElement('gem-route')\nexport class GemRouteElement extends GemElement<State> {\n @property routes?: RouteItem[] | RoutesObject;\n /**\n * @example\n * const locationStore = GemRouteElement.createLocationStore()\n * html`<gem-route .locationStore=${locationStore}>`\n */\n @property locationStore?: Store<{ path: string; params: Params; query: QueryString; data?: any }>;\n @property key: any; // 除了 href 提供另外一种方式来更新,比如语言更新也需要刷新 <gem-route>\n @emitter routeChange: Emitter<RouteItem | null>; // path 改变或者 key 改变,包含初始渲染\n @emitter loading: Emitter<RouteItem>;\n @emitter error: Emitter<any>;\n\n currentRoute: RouteItem | null;\n // 当前匹配的路由的 params\n currentParams: Params = {};\n\n #lastLoader?: Promise<TemplateResult>;\n\n static createLocationStore = () => {\n const { path, query, data } = history.getParams();\n return createStore({ path, query, data, params: {} as Record<string, string> });\n };\n\n static findRoute = (target: RouteItem[] | RoutesObject = [], path: string) => {\n let defaultRoute: RouteItem | null = null;\n let routes: RouteItem[];\n if (target instanceof Array) {\n routes = target;\n } else {\n routes = Object.values(target);\n }\n for (const route of routes) {\n if ('*' === route.pattern) {\n defaultRoute = route;\n } else {\n const params = matchPath(route.pattern, path);\n if (params) {\n return { route, params };\n }\n }\n }\n return { route: defaultRoute };\n };\n\n constructor({ isLight, routes }: ConstructorOptions = {}) {\n super({ isLight });\n this.routes = routes;\n }\n\n state: State = {\n content: undefined,\n };\n\n #updateLocationStore = () => {\n if (this.locationStore) {\n const { path, query, data } = history.getParams();\n updateStore(this.locationStore, {\n path,\n params: this.currentParams,\n query,\n data,\n });\n }\n };\n\n #setContent = (route: RouteItem | null, params: Params, content?: TemplateResult) => {\n this.#lastLoader = undefined;\n this.currentRoute = route;\n this.currentParams = params;\n this.setState({ content });\n this.routeChange(this.currentRoute);\n const title = route?.title;\n if (title) updateStore(titleStore, { title });\n this.#updateLocationStore();\n };\n\n mounted() {\n this.effect(\n ([key, path], old) => {\n // 只有查询参数改变\n if (old && key === old[0] && path === old[1]) {\n this.#updateLocationStore();\n return;\n }\n const { route, params = {} } = GemRouteElement.findRoute(this.routes, path);\n const { redirect, content, getContent } = route || {};\n if (redirect) {\n history.replace({ path: redirect });\n return;\n }\n const contentOrLoader = content || getContent?.(params);\n if (contentOrLoader instanceof Promise) {\n this.loading(route!);\n this.#lastLoader = contentOrLoader;\n const isSomeLoader = () => this.#lastLoader === contentOrLoader;\n contentOrLoader\n .then((content) => {\n if (isSomeLoader()) this.#setContent(route, params, content);\n })\n .catch((err) => {\n if (isSomeLoader()) this.error(err);\n });\n return;\n }\n this.#setContent(route, params, contentOrLoader);\n },\n () => {\n const { path } = history.getParams();\n return [this.key, path, location.search];\n },\n );\n }\n\n shouldUpdate() {\n if (this.inert) return false;\n return true;\n }\n\n render() {\n const { content } = this.state;\n if (!this.shadowRoot) return html`${content}`;\n\n return html`\n <style>\n :host,\n :not(:defined) {\n display: contents;\n }\n </style>\n ${content ?? html`<slot></slot>`}\n `;\n }\n}\n\n/**\n * @customElement gem-light-route\n */\n@customElement('gem-light-route')\nexport class GemLightRouteElement extends GemRouteElement {\n constructor(options: ConstructorOptions = {}) {\n super({ ...options, isLight: true });\n }\n}\n","import {\n GemElement,\n html,\n history,\n basePathStore,\n part,\n attribute,\n property,\n connectStore,\n customElement,\n state,\n ifDefined,\n} from '../';\nimport { absoluteLocation } from '../lib/utils';\nimport { matchPath, RouteItem, RouteOptions, createHistoryParams, createPath } from './route';\n\n/**\n * @customElement gem-link\n * @attr href\n * @attr target\n * @attr doc-title\n * @attr path\n * @attr query\n * @attr hash\n * @attr pattern\n * @attr hint\n * @part link\n *\n * print bug: https://github.com/mantou132/gem/issues/36\n */\n@customElement('gem-link')\n@connectStore(basePathStore)\nexport class GemLinkElement extends GemElement {\n @attribute href: string;\n @attribute target: string;\n @attribute path: string;\n @attribute query: string;\n @attribute hash: string;\n @attribute docTitle: string;\n @attribute hint: 'on' | 'off';\n\n // 动态路由,根据 route.pattern 和 options.params 计算出 path\n @property route: RouteItem | undefined;\n @property options: RouteOptions | undefined;\n @property prepare: (() => void | Promise<void>) | undefined;\n\n @part link: string;\n\n constructor() {\n super();\n this.addEventListener('click', this.clickHandle);\n }\n\n // 不包含 basePath\n getPathInfo() {\n if (this.route) {\n const queryProp = this.options?.query || '';\n const hashProp = this.options?.hash || '';\n return createPath(this.route, this.options) + queryProp + hashProp;\n } else {\n const url = this.href || this.path + this.query + this.hash;\n const { path, query } = history.getParams();\n if (url.startsWith('#')) {\n return `${path}${query}${url}`;\n } else if (url.startsWith('?')) {\n return `${path}${url}`;\n } else if (url.startsWith('.')) {\n return absoluteLocation(path, url);\n } else {\n return url;\n }\n }\n }\n\n isExternal(pathInfo: string) {\n return !pathInfo.startsWith('/');\n }\n\n clickHandle = async (e: MouseEvent) => {\n const pathInfo = this.getPathInfo();\n\n if (!pathInfo) return;\n\n // 外部链接使用 `window.open`\n if (this.isExternal(pathInfo)) {\n switch (this.target) {\n case '_self':\n window.location.href = pathInfo;\n return;\n case '_parent':\n window.parent.location.href = pathInfo;\n return;\n case '_top':\n window.top!.location.href = pathInfo;\n return;\n default:\n window.open(pathInfo);\n return;\n }\n }\n\n const { path, query, hash } = history.getParams();\n if (path + query + hash === pathInfo) {\n // 点击当前路由链接时,什么也没做\n return;\n }\n\n e.stopPropagation();\n\n await this.prepare?.();\n\n if (this.route) {\n history.pushIgnoreCloseHandle({\n ...createHistoryParams(this.route, this.options),\n title: this.route.title || this.docTitle,\n });\n } else if (this.href) {\n const { pathname, search, hash } = new URL(pathInfo, location.origin);\n history.pushIgnoreCloseHandle({\n path: pathname,\n query: search,\n // 解码,方便 `<gem-active-link>` CJK hash 比较\n hash: decodeURIComponent(hash),\n title: this.docTitle,\n });\n } else {\n history.pushIgnoreCloseHandle({ path: this.path, query: this.query, hash: this.hash, title: this.docTitle });\n }\n };\n\n preventDefault = (e: MouseEvent) => {\n e.preventDefault();\n };\n\n render(pathInfo = this.getPathInfo()) {\n return html`\n <style>\n :host {\n /* link default style */\n cursor: pointer;\n color: blue;\n text-decoration: underline;\n }\n a {\n all: unset;\n display: contents;\n }\n a:visited {\n color: unset;\n }\n </style>\n <a\n part=${this.link}\n @click=${this.preventDefault}\n href=${ifDefined(\n this.hint === 'off'\n ? undefined\n : this.isExternal(pathInfo)\n ? pathInfo\n : new URL(history.basePath + pathInfo, location.origin).toString(),\n )}\n >\n <slot></slot>\n </a>\n `;\n }\n}\n\n/**\n * @customElement gem-active-link\n * @attr pattern\n * @state active\n */\n@customElement('gem-active-link')\n@connectStore(history.store)\nexport class GemActiveLinkElement extends GemLinkElement {\n @attribute pattern: string; // 使用匹配模式设定 active\n @state active: boolean;\n\n render() {\n const { path, query, hash } = history.getParams();\n const isMatchPattern = this.pattern && matchPath(this.pattern, path);\n const pathInfo = this.getPathInfo();\n if (isMatchPattern || path + query + hash === pathInfo) {\n this.active = true;\n } else {\n this.active = false;\n }\n return super.render(pathInfo);\n }\n}\n","/**\n * 标题显示在:\n *\n * - 桌面端 Tab 的 title\n * - 移动端 Appbar 的 title\n *\n * 修改标题:\n *\n * - `<gem-route>` 匹配路由时自动设置 `route.title`\n * - `<gem-link>` 的 `doc-title` 属性和 `route.title`\n * - 修改路径时,`history` 默认设置 `title` 为空\n * - 数据获取后,手动调用 `Title.setTitle`\n * - `<gem-title>` 作为默认值设置\n */\n\nimport { html, GemElement, connectStore, updateStore, customElement, connect, attribute, titleStore } from '..';\n\n/**\n * 允许声明式设置 `document.title`\n * @customElement gem-title\n * @attr suffix\n */\n@connectStore(titleStore)\n@customElement('gem-title')\nexport class GemTitleElement extends GemElement {\n // 没有后缀的标题\n static title = document.title;\n static defaultTitle = document.title;\n static defaultSuffix = ` - ${document.title}`;\n\n static setTitle(title: string) {\n updateStore(titleStore, { title });\n }\n\n static updateTitle(str = '', suffix = '') {\n const { title } = titleStore;\n if (title && title !== GemTitleElement.defaultTitle) {\n GemTitleElement.title = title;\n document.title = GemTitleElement.title + suffix;\n } else if (str) {\n GemTitleElement.title = str;\n document.title = GemTitleElement.title + suffix;\n } else {\n GemTitleElement.title = GemTitleElement.defaultTitle;\n document.title = GemTitleElement.title;\n }\n }\n\n @attribute suffix: string;\n\n constructor() {\n super();\n new MutationObserver(() => this.update()).observe(this, { childList: true, characterData: true, subtree: true });\n }\n\n render() {\n // 多个 <gem-title> 时,最终 document.title 按执行顺序决定\n GemTitleElement.updateTitle(this.textContent || '', this.suffix);\n\n if (this.hidden) {\n return html``;\n }\n return html`${GemTitleElement.title}`;\n }\n}\n\nconnect(titleStore, GemTitleElement.updateTitle);\n","import { GemElement, html, attribute, property, customElement, state } from '../';\n\nconst eleCache = new Map<string, HTMLTemplateElement>();\n/**\n * svg 中的 `<use>` 不能穿透 ShadowDOM,\n * 此元素用来模拟 `<use>`,\n * 由于是复制元素,所以不能像 `<use>` 一样自动更新\n *\n * slot 支持为 icon 添加效果,如涟漪,徽章\n *\n * @customElement gem-use\n * @attr selector\n */\n@customElement('gem-use')\nexport class GemUseElement extends GemElement {\n @attribute selector: string; // CSS 选择器\n @property root?: HTMLElement | Document | ShadowRoot;\n @property element?: string | DocumentFragment | Element;\n\n @state active: boolean;\n\n private getContent() {\n const ele = this.element || (this.selector ? (this.root || document).querySelector(this.selector) : null);\n if (typeof ele === 'string') {\n let temp = eleCache.get(ele);\n if (!temp) {\n temp = document.createElement('template');\n temp.innerHTML = ele;\n eleCache.set(ele, temp);\n }\n return temp.content.cloneNode(true);\n } else if (ele instanceof HTMLTemplateElement) {\n return ele.content.cloneNode(true);\n } else {\n return ele?.cloneNode(true);\n }\n }\n\n render() {\n return html`\n <style>\n :host {\n position: relative;\n }\n :host(:not([hidden])) {\n display: inline-flex;\n align-items: center;\n }\n svg {\n width: 100%;\n height: 100%;\n }\n </style>\n ${this.getContent()}\n <slot></slot>\n `;\n }\n}\n","import { GemElement, attribute, customElement } from '../';\n\n/**\n * 直接写会被解释成固定属性,需要使用变量赋值\n *\n * @customElement gem-unsafe\n * @attr content\n * @attr contentcss\n */\n@customElement('gem-unsafe')\nexport class GemUnsafeElement extends GemElement {\n @attribute content: string;\n @attribute contentcss: string;\n\n constructor() {\n super();\n this.effect(\n () => {\n if (this.shadowRoot) {\n this.shadowRoot.innerHTML = `\n <style>\n :host {\n display: contents;\n }\n ${this.contentcss}\n </style>\n ${this.content}\n `;\n }\n },\n () => [this.content, this.contentcss],\n );\n }\n\n render() {\n return undefined;\n }\n}\n","import { GemElement, customElement, property } from '..';\n\n// support prerender\ndocument.querySelectorAll('[data-reflect]').forEach((e) => e.remove());\n\n/**\n * @customElement gem-reflect\n */\n@customElement('gem-reflect')\nexport class GemReflectElement extends GemElement {\n @property target: HTMLElement = document.head;\n\n constructor() {\n super({ isLight: true });\n this.hidden = true;\n this.effect(\n () => {\n const childNodes = [...this.childNodes];\n childNodes.forEach((node) => {\n if (node instanceof HTMLElement) {\n node.dataset.reflect = '';\n }\n this.target.append(node);\n });\n return () => {\n childNodes.forEach((node) => node.remove());\n };\n },\n () => [this.target],\n );\n }\n}\n","import { GemElement, createStore, updateStore, history } from '../';\n\nconst open = Symbol('open mark');\n\n/**\n * 需要使用范型,所以导出一个函数,用来*创建*类似 Confirm 元素的基类;\n * 需要使用 Confirm 的静态方式所以使用 Store 来管理组件状态;\n * 返回 *单实例* Confirm 类;\n * 关闭时将立即移除实例,所以不支持动画;\n * 使用 `mounted`/`unmounted` 定义 `open`/`close` 回调;\n * 模拟 top layer:https://github.com/whatwg/html/issues/4633.\n */\nexport function createModalClass<T extends Record<string, unknown>>(options: T) {\n return class extends GemElement {\n static inertStore: HTMLElement[] = [];\n static instance: GemElement | null = null;\n /**\n * @final\n * modal 状态,包括内容,是否已经确认关闭等属性\n */\n static store = createStore({\n [open]: false,\n ...options,\n });\n\n /**@final */\n static get isOpen() {\n return this.store[open];\n }\n\n /**@final */\n static get observedStores() {\n return [history.store, this.store];\n }\n\n /**\n * @final\n * 自带 100ms 延迟,以允许在其他 Dialog 的 `shouldClose` 中调用此方法;\n * 浏览器 history 为异步 API,需要设置较长延迟;\n */\n static open(opts: T) {\n const instance = new this();\n this.instance = instance;\n this.inertStore = ([...document.body.children] as HTMLElement[]).filter((e) => !e.inert);\n this.inertStore.forEach((e) => (e.inert = true));\n document.body.append(instance);\n const changeStore = () => updateStore(this.store, { [open]: true, ...opts });\n setTimeout(() => {\n changeStore();\n history.push({\n title: instance.label,\n open: changeStore,\n close: this.closeHandle.bind(this),\n shouldClose: this.shouldClose.bind(this),\n });\n }, 100);\n }\n\n /**\n * @final\n * UI 中执行关闭\n */\n static close() {\n history.back();\n }\n\n /**\n * @final\n * history 中自动调用\n */\n static closeHandle() {\n this.inertStore.forEach((e) => (e.inert = false));\n this.instance?.remove();\n updateStore(this.store, { [open]: false, ...options });\n }\n\n /**\n * 由于要操作浏览器历史记录,所以没有设计为 Promise;\n */\n static shouldClose() {\n return true;\n }\n\n constructor() {\n super();\n this.internals.role = 'alertdialog';\n this.internals.ariaModal = 'true';\n }\n\n label = '';\n };\n}\n","import { GemElement, connectStore, history, state, attribute } from '..';\n\n/**\n * 在模版中声明的 dialog,使用 `open` 方法 打开;\n * 如果要应用关闭动画,可以在动画执行完后设置 `hidden` 属性;\n * 模拟 top layer:https://github.com/whatwg/html/issues/4633.\n *\n * @attr label\n */\n@connectStore(history.store)\nexport abstract class DialogBaseElement extends GemElement {\n @state opened = false;\n\n inert = true;\n\n #nextSibling: ChildNode | null;\n #parentElement: Node | null;\n #inertStore: HTMLElement[] = [];\n\n @attribute label = '';\n\n constructor() {\n super();\n this.internals.role = 'dialog';\n this.internals.ariaModal = 'true';\n }\n\n /**\n * @final\n * 进入关闭状态\n */\n closeHandle = () => {\n this.inert = true;\n this.#inertStore.forEach((e) => (e.inert = false));\n if (this.#nextSibling) {\n this.#nextSibling.before(this);\n } else if (this.#parentElement) {\n this.#parentElement?.appendChild(this);\n }\n this.dispatchEvent(new CustomEvent('close'));\n this.opened = false;\n };\n\n /**\n * @final\n * 进入打开状态\n */\n openHandle = () => {\n this.hidden = false;\n this.inert = false;\n this.#nextSibling = this.nextSibling;\n this.#parentElement = this.parentElement || this.getRootNode();\n this.#inertStore = ([...document.body.children] as HTMLElement[]).filter((e) => !e.inert);\n this.#inertStore.forEach((e) => (e.inert = true));\n document.body.append(this);\n this.dispatchEvent(new CustomEvent('open'));\n this.opened = true;\n };\n\n /**@final */\n open = () => {\n if (this.opened) return;\n this.openHandle();\n history.push({\n title: this.label,\n open: this.openHandle,\n close: this.closeHandle,\n shouldClose: this.shouldClose,\n });\n };\n\n shouldClose() {\n return true;\n }\n\n /**@final */\n close = () => {\n history.back();\n };\n\n /**\n * @final\n * 跳过 `shouldClose` 强制关闭\n * 避免 `shouldClose` 中造成无限循环\n * 延时关闭避免同步操作 history\n */\n forceClose = () => {\n this.opened = false;\n setTimeout(this.close, 100);\n };\n}\n","import { connect, createStore, updateStore, Store } from '../lib/store';\nimport { camelToKebabCase, randomStr } from '../lib/utils';\n\ntype SomeType<T> = {\n [P in keyof T]: string;\n};\n\nconst themeStoreMap = new WeakMap();\n\nexport function getThemeStore<T>(theme: SomeType<T>) {\n return themeStoreMap.get(theme) as Store<T>;\n}\n\nconst themePropMap = new WeakMap();\n\nexport function getThemeProp<T>(theme: SomeType<T>) {\n return themePropMap.get(theme) as SomeType<T>;\n}\n\nfunction replaceStyle(style: HTMLStyleElement, theme: Record<string, unknown>) {\n const themeStore = themeStoreMap.get(theme);\n const themeProp = themePropMap.get(theme);\n const rules = Object.keys(themeStore).reduce((prev, key) => {\n if (!themeStore[key]) return prev;\n return prev + `${themeProp[key]}:${themeStore[key]};`;\n }, '');\n style.textContent = `:root, :host {${rules}}`;\n}\n\n/**\n * 创建主题,插入 `document.head`\n * https://github.com/mantou132/gem/issues/33\n *\n * @example\n * createTheme({\n * primaryColor: '#eee',\n * });\n */\nexport function createTheme<T extends Record<string, unknown>>(themeObj: T) {\n const salt = randomStr();\n const style = document.createElement('style');\n const themeStore = createStore<T>(themeObj);\n const theme: Record<string, string> = {};\n const themeProp: Record<string, string> = {};\n themePropMap.set(theme, themeProp);\n themeStoreMap.set(theme, themeStore);\n Object.keys(themeStore).forEach((key) => {\n themeProp[key] = `--${camelToKebabCase(key)}-${salt}`;\n theme[key] = `var(${themeProp[key]})`;\n });\n const replace = () => replaceStyle(style, theme);\n connect(themeStore, replace);\n replace();\n (document.head || document.documentElement).append(style);\n return theme as SomeType<T>;\n}\n\n/**\n * 更新主题\n * @param theme 主题\n * @param newThemeObj 新主题\n */\nexport function updateTheme<T = Record<string, unknown>>(theme: SomeType<T>, newThemeObj: Partial<T>) {\n const store = getThemeStore(theme);\n updateStore(store, newThemeObj);\n}\n","import { createStore, updateStore, Store } from '../lib/store';\nimport { html, TemplateResult } from '../lib/element';\nimport { GemError } from '../lib/utils';\n\n// Hello, $1\n// See $1<detail>\n// 嵌套模版中用到 $ < > 时使用 &dollar; &lt; &gt; 替代\nconst splitReg = /\\$\\d(?:<[^>]*>)?/;\nconst matchReg = /\\$(\\d)(<([^>]*)>)?/g;\nconst matchStrIndex = 3;\n\nexport function splice(rawValue: string, ...rest: (((s: string) => TemplateResult) | string)[]) {\n const templateArr = rawValue.split(splitReg) as unknown as TemplateStringsArray;\n const values: (TemplateResult | string)[] = [];\n let result: RegExpExecArray | null;\n while ((result = matchReg.exec(rawValue))) {\n const str = result[matchStrIndex];\n const index = Number(result[1]) - 1;\n const arg = rest[index];\n values.push(typeof arg === 'string' ? arg : arg(str));\n }\n return html(templateArr, ...values);\n}\n\nconst modules = new Set<I18n<any>>();\n\ntype Msg =\n | {\n message: string;\n description: string;\n }\n | string;\n\nexport type I18nJSON<T> = {\n currentLanguage: string;\n currentLanguagePack: Partial<T>;\n};\n\ninterface Resources<T> {\n [key: string]: Partial<T> | string;\n}\n\ninterface Options<T> {\n resources: Resources<T>;\n fallbackLanguage: string;\n // 可以在构造函数中指定,但会被 URL 中的语言参数覆盖\n currentLanguage?: string;\n /**\n * `true` 表示在修改语言时自动缓存。\n * 为了避免缓存超出 `localStorage` 限制,语言包 URL 应该带版本号查询参数\n */\n cache?: boolean | 'manual';\n // lib 需要设置,避免被应用中的 i18n 一起清理掉语言缓存\n // 也用来作为 prerender 的 script type\n cachePrefix?: string;\n // 为 `path` 时页面的路由不能和语言代码相同\n urlParamsType?: 'path' | 'querystring' | 'ccTLD' | 'gTLD';\n urlParamsName?: string;\n onChange?: (currentLanguage: string) => void;\n}\n\nexport class I18n<T = Record<string, Msg>> {\n resources: Resources<T>;\n fallbackLanguage: string;\n currentLanguage: string;\n cache?: boolean | 'manual';\n cachePrefix = 'gem-i18n';\n urlParamsType?: 'path' | 'querystring' | 'ccTLD' | 'gTLD';\n urlParamsName?: string;\n onChange?: (currentLanguage: string) => void;\n\n store: Store<any>;\n\n get #cacheCurrentKey() {\n return `${this.cachePrefix}:current`;\n }\n\n get #urlParamsLang() {\n const { hostname, pathname, search } = location;\n const parts = hostname.split('.');\n switch (this.urlParamsType) {\n case 'ccTLD':\n return parts.pop();\n case 'gTLD':\n return parts.shift();\n case 'path':\n return pathname.split('/')[1];\n default:\n const fragment = (this.urlParamsName && new URLSearchParams(search).get(this.urlParamsName)) || '';\n return fragment in this.resources ? fragment : '';\n }\n }\n\n get #cacheLang() {\n return (this.cache && localStorage.getItem(this.#cacheCurrentKey)) || '';\n }\n\n get #isMain(): boolean {\n return !modules.has(this);\n }\n\n set #lang(lang: string) {\n if (this.#isMain) {\n document.documentElement.lang = lang;\n }\n this.currentLanguage = lang;\n this.onChange?.(lang);\n }\n\n constructor(options: Options<T>) {\n if (!options.resources[options.fallbackLanguage]) {\n throw new GemError('i18n: fallbackLanguage invalid');\n }\n\n this.store = createStore(this as any);\n Object.assign<I18n<T>, Options<T>>(this as I18n<T>, options);\n\n let currentLanguage = this.#urlParamsLang || this.currentLanguage || this.#cacheLang;\n\n const ele = document.querySelector(`[type*=${this.cachePrefix}]`);\n if (ele) {\n try {\n const prerenderData = JSON.parse(ele.textContent || '') as I18nJSON<T>;\n currentLanguage = prerenderData.currentLanguage;\n this.resources[prerenderData.currentLanguage] = prerenderData.currentLanguagePack;\n } catch {\n //\n }\n }\n\n if (currentLanguage) {\n this.#lang = currentLanguage;\n this.setLanguage(currentLanguage);\n } else {\n this.resetLanguage();\n }\n }\n\n get(s: keyof T): string;\n get(s: keyof T, ...rest: (((s: string) => TemplateResult) | string)[]): TemplateResult;\n get(s: keyof T, ...rest: (((s: string) => TemplateResult) | string)[]) {\n const currentLanguagePack = this.resources[this.currentLanguage] as any;\n const fallbackLanguagePack = this.resources[this.fallbackLanguage] as any;\n const msg = currentLanguagePack[s] || fallbackLanguagePack[s];\n const rawValue: string = msg?.message || msg || `[${s}]`;\n if (!rest.length) return rawValue;\n return splice(rawValue, ...rest);\n }\n\n detectLanguage() {\n const availableLangs = Object.keys(this.resources);\n const uiLangs = navigator.languages.map((lang) => lang.replace(/-(.*)/, ($1) => $1.toUpperCase()));\n for (const lang of uiLangs) {\n const matched = availableLangs.find((e) => e === lang || lang.startsWith(`${e}-`));\n if (matched) return matched;\n }\n return this.fallbackLanguage;\n }\n\n async setLanguage(lang: string): Promise<string> {\n if (this.#isMain) {\n modules.forEach(async (i18n) => await i18n.setLanguage(lang));\n }\n let pack: Partial<T>;\n const data = this.resources[lang];\n if (!data) {\n // eslint-disable-next-line no-console\n console.warn(`${this.cachePrefix}: not found \\`${lang}\\``);\n return this.resetLanguage();\n }\n\n if (typeof data === 'string') {\n const prefix = `${this.cachePrefix}:`;\n const localKey = `${prefix}${data}`;\n const localPackString = localStorage.getItem(localKey);\n\n const fetchPack = async () => {\n const pack = await (await fetch(data)).json();\n if (this.cache) {\n // 移除之前的版本缓存\n for (let i = 0; i < localStorage.length; i++) {\n const key = localStorage.key(i) as string;\n if (key.startsWith(prefix)) {\n localStorage.removeItem(key);\n }\n }\n localStorage.setItem(localKey, JSON.stringify(pack));\n }\n return pack;\n };\n\n if (localPackString) {\n try {\n pack = JSON.parse(localPackString);\n } catch (e) {\n pack = await fetchPack();\n }\n } else {\n pack = await fetchPack();\n }\n } else {\n pack = data;\n }\n this.resources[lang] = pack;\n updateStore(this.store, {});\n if (lang !== this.currentLanguage) {\n this.#lang = lang;\n }\n // auto cache\n if (this.cache === true) {\n this.setCache();\n }\n return lang;\n }\n\n resetLanguage() {\n if (this.#isMain) {\n modules.forEach((i18n) => i18n.resetLanguage());\n }\n this.#lang = this.fallbackLanguage;\n if (this.cache) {\n localStorage.removeItem(this.#cacheCurrentKey);\n }\n return this.setLanguage(this.detectLanguage());\n }\n\n // 一般用在 `onChange` 中\n setCache() {\n if (this.#isMain) {\n modules.forEach((i18n) => i18n.setCache());\n }\n localStorage.setItem(this.#cacheCurrentKey, this.currentLanguage);\n }\n\n createSubModule<K = Record<string, Msg>>(name: string, resources: Resources<K>) {\n const module = new I18n<K>({\n resources,\n cachePrefix: `${this.cachePrefix}-${name}`,\n currentLanguage: this.currentLanguage,\n fallbackLanguage: this.fallbackLanguage,\n cache: this.cache,\n });\n modules.add(module);\n return module;\n }\n\n /**\n * prepare: @connectStore(i18n.store)\n *\n * @example\n *\n * html`\n * <gem-reflect>\n * <script type=\"${i18n.cachePrefix}\">${JSON.stringify(i18n)}</script>\n * </gem-reflect>\n * `\n */\n toJSON() {\n return {\n currentLanguage: this.currentLanguage,\n currentLanguagePack: this.resources[this.currentLanguage],\n };\n }\n}\n","// 带凭证 Rest API 请求\nconst defaultReq: RequestInit = {\n credentials: 'include',\n mode: 'cors',\n};\n\nexport async function request<T>(uri: string, options: RequestInit = {}): Promise<T> {\n const res = await fetch(uri, {\n ...defaultReq,\n ...options,\n });\n if (res.status === 0) throw new Error('Request fail');\n if (res.status >= 500) throw new Error(res.statusText);\n if (res.status >= 400) throw new Error((await res.text()) || res.statusText);\n return await res.json();\n}\n\ntype ReqBody = Record<string, unknown> | BodyInit;\nconst TypedArray = Object.getPrototypeOf(Object.getPrototypeOf(new Int8Array()));\n\nfunction serializationBody(body?: ReqBody): BodyInit | undefined {\n if (\n body instanceof FormData ||\n body instanceof Blob ||\n body instanceof TypedArray ||\n body instanceof URLSearchParams ||\n body instanceof ReadableStream ||\n body instanceof ArrayBuffer\n ) {\n return body as BodyInit;\n }\n if (typeof body === 'object') {\n return JSON.stringify(body);\n }\n return body;\n}\n\nexport function get<T>(url: string, params?: Record<string, string | number>) {\n const { origin, pathname, search } = new URL(url, location.origin);\n const query = new URLSearchParams(params as Record<string, string>).toString();\n return request<T>(`${origin}${pathname}${search ? `${search}&` : query ? '?' : ''}${query}`, {\n method: 'GET',\n });\n}\nexport function del<T>(url: string) {\n return request<T>(url, { method: 'DELETE' });\n}\nexport function put<T>(url: string, body?: ReqBody) {\n return request<T>(url, { method: 'PUT', body: serializationBody(body) });\n}\nexport function post<T>(url: string, body?: ReqBody) {\n return request<T>(url, { method: 'POST', body: serializationBody(body) });\n}\n","// https://gist.github.com/gokulkrishh/242e68d1ee94ad05f488\n// https://mediag.com/news/popular-screen-resolutions-designing-for-all/\n\nconst matche = (query: string) => window.matchMedia(query).matches;\n\nexport const mediaQuery = {\n PRINT: 'print',\n get isPrint() {\n return matche(this.PRINT);\n },\n HOVER: '(hover: hover)',\n get isHover() {\n return matche(this.HOVER);\n },\n\n PHONE: '(min-width: 319px) and (max-width: 480px)',\n get isPhone() {\n return matche(this.PHONE);\n },\n\n LAPTOP: '(min-width: 1023px) and (max-width: 1280px) and (orientation: landscape)',\n get isLaptop() {\n return matche(this.LAPTOP);\n },\n\n DESKTOP: '(min-width: 1279px) and (orientation: landscape)',\n get isDesktop() {\n return matche(this.DESKTOP);\n },\n\n WIDTHSCREEN: '(min-width: 1919px) and (orientation: landscape)',\n get isWidthScreen() {\n return matche(this.WIDTHSCREEN);\n },\n\n PHONE_LANDSCAPE: '(min-width: 479px) and (max-width: 767px) and (orientation: landscape)',\n // PHONE_LANDSCAPE: '(min-width: 481px) and (max-width: 767px)',\n get isPhoneLandscape() {\n return matche(this.PHONE_LANDSCAPE);\n },\n\n TABLET: '(min-width: 768px) and (max-width: 1024px)',\n get isTablet() {\n return matche(this.TABLET);\n },\n\n SMALL_PHONE: '(min-width: 319px) and (max-width: 480px) and (max-height: 640px)',\n get isSmallPhone() {\n return matche(this.SMALL_PHONE);\n },\n\n WATCH: '(max-width: 319px)',\n get isWatch() {\n return matche(this.WATCH);\n },\n\n SHORT: '(min-width: 479px) and (max-height: 320px)',\n get isShort() {\n return matche(this.SHORT);\n },\n\n PWA: '(display-mode: standalone)',\n // PWA: '(display-mode: browser)', // debugging\n get isPWA() {\n return matche(this.PWA);\n },\n\n MOTION_REDUCE: '(prefers-reduced-motion: reduce)',\n get isMotionReduce() {\n return matche(this.MOTION_REDUCE);\n },\n\n DATA_REDUCE: '(prefers-reduced-data: reduce)',\n get isDataReduce() {\n return matche(this.DATA_REDUCE);\n },\n};\n"],"names":["root","factory","exports","module","define","amd","self","__webpack_require__","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","microtaskSet","Set","addMicrotask","func","size","globalThis","queueMicrotask","forEach","clear","delete","add","microtaskStack","execMicrotaskStack","i","length","addMicrotaskToStack","push","absoluteLocation","currentPath","relativePath","pathname","search","hash","URL","location","origin","LinkedList","EventTarget","Map","this","dispatchEvent","CustomEvent","item","prev","next","undefined","set","deleteItem","firstItem","existItem","PropProxyMap","WeakMap","ele","proxy","super","QueryString","URLSearchParams","constructor","param","JSON","stringify","parse","concat","query","fromEntries","entries","append","setAny","Array","isArray","e","v","getAny","getAnyAll","getAll","filter","map","toString","string","toJSON","raw","arr","args","reduce","current","index","css","SheetToken","useNativeCSSStyleSheet","CSSStyleSheet","window","media","mediaText","style","replaceSync","createCSSSheet","rules","mediaQuery","styleSheet","sheet","keys","randomStr","styledContent","replace","number","len","str","Math","floor","random","nestingRuleRegExp","RegExp","flatStyled","type","nestingRules","substr","join","styled","class","id","keyframes","camelToKebabCase","$1","toLowerCase","kebabToCamelCase","_substr","toUpperCase","cleanObject","GemError","Error","msg","message","isArrayChange","newValues","oldValues","removeItems","target","items","has","styleMap","styleString","classMap","classList","className","partMap","StoreListenerMap","createStore","originStore","createStoreSet","originStoreSet","updateStore","store","assign","listeners","connect","disconnect","history","pushState","bind","replaceState","getKey","performance","now","$hasCloseHandle","$hasOpenHandle","$hasShouldCloseHandle","$key","paramsMap","validData","getUrlbarPath","internalPath","basePath","getInternalPath","urlbarPath","initParams","params","path","pathChanged","String","title","statusChanged","close","data","open","shouldClose","decodeURIComponent","updateHistory","p","state","url","prevHave","updateHistoryByNative","originUrl","prevHash","basePathStore","addEventListener","isTrusted","defineProperties","getParams","updateParams","pushIgnoreCloseHandle","document","back","titleStore","navigating","event","newState","prevState","parseFloat","prevParams","closeHandle","shouldCloseHandle","forward","directives","directive","f","d","isDirective","isCEPolyfill","customElements","polyfillWrapFlushCallback","reparentNodes","container","start","end","before","n","nextSibling","insertBefore","removeNodes","removeChild","noChange","nothing","marker","slice","nodeMarker","markerRegex","boundAttributeSuffix","Template","result","element","parts","nodesToRemove","stack","walker","createTreeWalker","content","lastPartIndex","partIndex","strings","values","node","nextNode","nodeType","hasAttributes","attributes","count","endsWith","name","stringForPart","lastAttributeNameRegex","exec","attributeLookupName","attributeValue","getAttribute","removeAttribute","statics","split","tagName","currentNode","indexOf","parent","parentNode","lastIndex","insert","s","createMarker","match","createTextNode","previousSibling","pop","suffix","isTemplatePartActive","part","createComment","TemplateInstance","template","processor","options","__parts","update","setValue","commit","_clone","fragment","cloneNode","importNode","nodeIndex","nodeName","handleTextExpression","insertAfterNode","handleAttributeExpressions","adoptNode","upgrade","policy","trustedTypes","createPolicy","createHTML","commentMarker","TemplateResult","getHTML","l","html","isCommentBinding","commentOpen","lastIndexOf","attributeMatch","getTemplateElement","createElement","innerHTML","SVGTemplateResult","svgElement","firstChild","isPrimitive","isIterable","iterator","AttributeCommitter","dirty","_createPart","AttributePart","_getValue","text","t","setAttribute","committer","NodePart","__pendingValue","appendInto","startNode","appendChild","endNode","ref","appendIntoPart","__insert","insertAfterPart","__commitText","__commitTemplateResult","Node","__commitNode","__commitIterable","valueAsString","templateFactory","instance","itemParts","itemPart","BooleanAttributePart","PropertyCommitter","single","PropertyPart","eventOptionsSupported","capture","removeEventListener","_e","EventPart","eventName","eventContext","__boundHandleEvent","handleEvent","newListener","oldListener","shouldRemoveListener","once","passive","shouldAddListener","__options","getOptions","defaultTemplateProcessor","prefix","templateCache","templateCaches","stringsArray","keyString","render","svg","createAndInsertPart","containerPart","beforePart","beforeNode","newPart","updatePart","insertPartBefore","removePart","generateMap","list","partListCache","keyListCache","repeat","keyFnOrTemplate","keyFn","oldParts","oldKeys","newParts","newKeys","newKeyToIndexMap","oldKeyToIndexMap","oldHead","oldTail","newHead","newTail","oldIndex","oldPart","previousValues","guard","previousValue","every","from","ifDefined","emptyFunction","execCallback","fun","asyncRenderTaskList","tick","timeStamp","requestAnimationFrame","task","initSymbol","updateSymbol","GemElement","HTMLElement","isAsync","isLight","delegatesFocus","setState","payload","effectItem","callback","getDep","preCallback","effect","initialized","isConnected","memo","styles","shadowRoot","adoptedStyleSheets","shouldUpdate","temp","updated","willMount","observedStores","rootElement","mounted","getRootNode","host","attachShadow","mode","sheets","internals","getCustomStateSet","getV","dataset","attachInternals","states","attributeChangedCallback","closestElement","constructorOrTag","isConstructor","getRootElement","rootEle","parentElement","connectedCallback","disconnectedCallback","unmounted","gemElementProxyMap","defineAttribute","attr","booleanAttributes","numberAttributes","configurable","Number","that","hasSet","isBool","toggleAttribute","isEventHandleSymbol","eventOptions","detail","evt","defineRef","refobject","gemReflects","querySelectorAll","querySelector","defineCSSState","nativeDefineElement","pushStaticField","field","member","isSet","cls","defineAttr","attribute","boolattribute","numattribute","property","slot","emitter","defineEmitter","globalemitter","bubbles","composed","adoptedStyle","connectStore","rootType","customElement","observedAttributes","observedPropertys","defineEvents","defineCSSStates","defineRefs","version","__GEM_DEVTOOLS__HOOK__","ParamsRegExp","pattern","namePosition","_m","matchPath","reg","matchResult","createPath","route","createHistoryParams","GemRouteElement","routes","currentParams","locationStore","currentRoute","routeChange","old","findRoute","redirect","getContent","contentOrLoader","Promise","loading","isSomeLoader","then","catch","err","error","inert","createLocationStore","defaultRoute","GemLightRouteElement","GemLinkElement","clickHandle","pathInfo","getPathInfo","isExternal","href","top","stopPropagation","prepare","docTitle","preventDefault","queryProp","hashProp","startsWith","link","hint","GemActiveLinkElement","isMatchPattern","active","GemTitleElement","MutationObserver","observe","childList","characterData","subtree","static","defaultTitle","updateTitle","textContent","hidden","defaultSuffix","eleCache","GemUseElement","selector","HTMLTemplateElement","GemUnsafeElement","contentcss","remove","GemReflectElement","head","childNodes","reflect","createModalClass","label","role","ariaModal","isOpen","opts","inertStore","body","children","changeStore","setTimeout","DialogBaseElement","opened","openHandle","forceClose","themeStoreMap","getThemeStore","theme","themePropMap","getThemeProp","createTheme","themeObj","salt","themeStore","themeProp","replaceStyle","documentElement","updateTheme","newThemeObj","splitReg","matchReg","splice","rawValue","rest","templateArr","arg","modules","I18n","cachePrefix","resources","fallbackLanguage","currentLanguage","prerenderData","currentLanguagePack","setLanguage","resetLanguage","fallbackLanguagePack","detectLanguage","availableLangs","uiLangs","navigator","languages","lang","matched","find","pack","i18n","console","warn","localKey","localPackString","localStorage","getItem","fetchPack","fetch","json","cache","removeItem","setItem","setCache","createSubModule","hostname","urlParamsType","shift","urlParamsName","onChange","defaultReq","credentials","request","uri","res","status","statusText","TypedArray","getPrototypeOf","Int8Array","serializationBody","FormData","Blob","ReadableStream","ArrayBuffer","method","del","put","post","matche","matchMedia","matches","PRINT","isPrint","HOVER","isHover","PHONE","isPhone","LAPTOP","isLaptop","DESKTOP","isDesktop","WIDTHSCREEN","isWidthScreen","PHONE_LANDSCAPE","isPhoneLandscape","TABLET","isTablet","SMALL_PHONE","isSmallPhone","WATCH","isWatch","SHORT","isShort","PWA","isPWA","MOTION_REDUCE","isMotionReduce","DATA_REDUCE","isDataReduce"],"sourceRoot":""}
1
+ {"version":3,"file":"umd.js","mappings":";CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,GAAIH,GACe,iBAAZC,QACdA,QAAa,IAAID,IAEjBD,EAAU,IAAIC,IARhB,CASGK,MAAM,WACT,yBCTA,IAAIC,EAAsB,CCA1BA,EAAwB,CAACL,EAASM,KAC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AAQtR,KAAMiR,GAAkBjR,KChDnE,MAAM0R,GAAUjb,GAAkB7O,OAAO+pB,WAAWlb,GAAOmb,QAE9CxZ,GAAa,CACxByZ,MAAO,QACHC,cACF,OAAOJ,GAAOjoB,KAAKooB,QAErBE,MAAO,iBACHC,cACF,OAAON,GAAOjoB,KAAKsoB,QAGrBE,MAAO,4CACHC,cACF,OAAOR,GAAOjoB,KAAKwoB,QAGrBE,OAAQ,2EACJC,eACF,OAAOV,GAAOjoB,KAAK0oB,SAGrBE,QAAS,mDACLC,gBACF,OAAOZ,GAAOjoB,KAAK4oB,UAGrBE,YAAa,mDACTC,oBACF,OAAOd,GAAOjoB,KAAK8oB,cAGrBE,gBAAiB,yEAEbC,uBACF,OAAOhB,GAAOjoB,KAAKgpB,kBAGrBE,OAAQ,6CACJC,eACF,OAAOlB,GAAOjoB,KAAKkpB,SAGrBE,YAAa,oEACTC,mBACF,OAAOpB,GAAOjoB,KAAKopB,cAGrBE,MAAO,qBACHC,cACF,OAAOtB,GAAOjoB,KAAKspB,QAGrBE,MAAO,6CACHC,cACF,OAAOxB,GAAOjoB,KAAKwpB,QAGrBE,IAAK,6BAEDC,YACF,OAAO1B,GAAOjoB,KAAK0pB,MAGrBE,cAAe,mCACXC,qBACF,OAAO5B,GAAOjoB,KAAK4pB,gBAGrBE,YAAa,iCACTC,mBACF,OAAO9B,GAAOjoB,KAAK8pB,eCzEVE,GAAU,eCYnB7rB,OAAO8rB,wBAETptB,OAAOwN,OAAOlM,OAAO8rB,uBAAwB,OAAF,UAAO","sources":["webpack://Gem/webpack/universalModuleDefinition","webpack://Gem/webpack/bootstrap","webpack://Gem/webpack/runtime/define property getters","webpack://Gem/webpack/runtime/hasOwnProperty shorthand","webpack://Gem/webpack/runtime/make namespace object","webpack://Gem/./node_modules/lit-html/lib/directive.js","webpack://Gem/./node_modules/lit-html/lib/dom.js","webpack://Gem/./node_modules/lit-html/lib/part.js","webpack://Gem/./node_modules/lit-html/lib/template.js","webpack://Gem/./node_modules/lit-html/lib/template-instance.js","webpack://Gem/./node_modules/lit-html/lib/template-result.js","webpack://Gem/./node_modules/lit-html/lib/parts.js","webpack://Gem/./node_modules/lit-html/lib/default-template-processor.js","webpack://Gem/./node_modules/lit-html/lib/template-factory.js","webpack://Gem/./node_modules/lit-html/lib/render.js","webpack://Gem/./node_modules/lit-html/lit-html.js","webpack://Gem/./src/lib/utils.ts","webpack://Gem/./src/lib/store.ts","webpack://Gem/./node_modules/lit-html/directives/repeat.js","webpack://Gem/./node_modules/lit-html/directives/guard.js","webpack://Gem/./node_modules/lit-html/directives/if-defined.js","webpack://Gem/./src/lib/element.ts","webpack://Gem/./src/lib/decorators.ts","webpack://Gem/./src/lib/history.ts","webpack://Gem/./src/elements/route.ts","webpack://Gem/./src/elements/link.ts","webpack://Gem/./src/elements/title.ts","webpack://Gem/./src/elements/use.ts","webpack://Gem/./src/elements/unsafe.ts","webpack://Gem/./src/elements/reflect.ts","webpack://Gem/./src/elements/modal-base.ts","webpack://Gem/./src/elements/dialog-base.ts","webpack://Gem/./src/helper/theme.ts","webpack://Gem/./src/helper/i18n.ts","webpack://Gem/./src/helper/request.ts","webpack://Gem/./src/helper/mediaquery.ts","webpack://Gem/./src/lib/version.ts","webpack://Gem/./src/index.ts"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"Gem\"] = factory();\n\telse\n\t\troot[\"Gem\"] = factory();\n})(self, function() {\nreturn ","// The require scope\nvar __webpack_require__ = {};\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\nconst directives = new WeakMap();\n/**\n * Brands a function as a directive factory function so that lit-html will call\n * the function during template rendering, rather than passing as a value.\n *\n * A _directive_ is a function that takes a Part as an argument. It has the\n * signature: `(part: Part) => void`.\n *\n * A directive _factory_ is a function that takes arguments for data and\n * configuration and returns a directive. Users of directive usually refer to\n * the directive factory as the directive. For example, \"The repeat directive\".\n *\n * Usually a template author will invoke a directive factory in their template\n * with relevant arguments, which will then return a directive function.\n *\n * Here's an example of using the `repeat()` directive factory that takes an\n * array and a function to render an item:\n *\n * ```js\n * html`<ul><${repeat(items, (item) => html`<li>${item}</li>`)}</ul>`\n * ```\n *\n * When `repeat` is invoked, it returns a directive function that closes over\n * `items` and the template function. When the outer template is rendered, the\n * return directive function is called with the Part for the expression.\n * `repeat` then performs it's custom logic to render multiple items.\n *\n * @param f The directive factory function. Must be a function that returns a\n * function of the signature `(part: Part) => void`. The returned function will\n * be called with the part object.\n *\n * @example\n *\n * import {directive, html} from 'lit-html';\n *\n * const immutable = directive((v) => (part) => {\n * if (part.value !== v) {\n * part.setValue(v)\n * }\n * });\n */\nexport const directive = (f) => ((...args) => {\n const d = f(...args);\n directives.set(d, true);\n return d;\n});\nexport const isDirective = (o) => {\n return typeof o === 'function' && directives.has(o);\n};\n//# sourceMappingURL=directive.js.map","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n/**\n * True if the custom elements polyfill is in use.\n */\nexport const isCEPolyfill = typeof window !== 'undefined' &&\n window.customElements != null &&\n window.customElements.polyfillWrapFlushCallback !==\n undefined;\n/**\n * Reparents nodes, starting from `start` (inclusive) to `end` (exclusive),\n * into another container (could be the same container), before `before`. If\n * `before` is null, it appends the nodes to the container.\n */\nexport const reparentNodes = (container, start, end = null, before = null) => {\n while (start !== end) {\n const n = start.nextSibling;\n container.insertBefore(start, before);\n start = n;\n }\n};\n/**\n * Removes nodes, starting from `start` (inclusive) to `end` (exclusive), from\n * `container`.\n */\nexport const removeNodes = (container, start, end = null) => {\n while (start !== end) {\n const n = start.nextSibling;\n container.removeChild(start);\n start = n;\n }\n};\n//# sourceMappingURL=dom.js.map","/**\n * @license\n * Copyright (c) 2018 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n/**\n * A sentinel value that signals that a value was handled by a directive and\n * should not be written to the DOM.\n */\nexport const noChange = {};\n/**\n * A sentinel value that signals a NodePart to fully clear its content.\n */\nexport const nothing = {};\n//# sourceMappingURL=part.js.map","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n/**\n * An expression marker with embedded unique key to avoid collision with\n * possible text in templates.\n */\nexport const marker = `{{lit-${String(Math.random()).slice(2)}}}`;\n/**\n * An expression marker used text-positions, multi-binding attributes, and\n * attributes with markup-like text values.\n */\nexport const nodeMarker = `<!--${marker}-->`;\nexport const markerRegex = new RegExp(`${marker}|${nodeMarker}`);\n/**\n * Suffix appended to all bound attribute names.\n */\nexport const boundAttributeSuffix = '$lit$';\n/**\n * An updatable Template that tracks the location of dynamic parts.\n */\nexport class Template {\n constructor(result, element) {\n this.parts = [];\n this.element = element;\n const nodesToRemove = [];\n const stack = [];\n // Edge needs all 4 parameters present; IE11 needs 3rd parameter to be null\n const walker = document.createTreeWalker(element.content, 133 /* NodeFilter.SHOW_{ELEMENT|COMMENT|TEXT} */, null, false);\n // Keeps track of the last index associated with a part. We try to delete\n // unnecessary nodes, but we never want to associate two different parts\n // to the same index. They must have a constant node between.\n let lastPartIndex = 0;\n let index = -1;\n let partIndex = 0;\n const { strings, values: { length } } = result;\n while (partIndex < length) {\n const node = walker.nextNode();\n if (node === null) {\n // We've exhausted the content inside a nested template element.\n // Because we still have parts (the outer for-loop), we know:\n // - There is a template in the stack\n // - The walker will find a nextNode outside the template\n walker.currentNode = stack.pop();\n continue;\n }\n index++;\n if (node.nodeType === 1 /* Node.ELEMENT_NODE */) {\n if (node.hasAttributes()) {\n const attributes = node.attributes;\n const { length } = attributes;\n // Per\n // https://developer.mozilla.org/en-US/docs/Web/API/NamedNodeMap,\n // attributes are not guaranteed to be returned in document order.\n // In particular, Edge/IE can return them out of order, so we cannot\n // assume a correspondence between part index and attribute index.\n let count = 0;\n for (let i = 0; i < length; i++) {\n if (endsWith(attributes[i].name, boundAttributeSuffix)) {\n count++;\n }\n }\n while (count-- > 0) {\n // Get the template literal section leading up to the first\n // expression in this attribute\n const stringForPart = strings[partIndex];\n // Find the attribute name\n const name = lastAttributeNameRegex.exec(stringForPart)[2];\n // Find the corresponding attribute\n // All bound attributes have had a suffix added in\n // TemplateResult#getHTML to opt out of special attribute\n // handling. To look up the attribute value we also need to add\n // the suffix.\n const attributeLookupName = name.toLowerCase() + boundAttributeSuffix;\n const attributeValue = node.getAttribute(attributeLookupName);\n node.removeAttribute(attributeLookupName);\n const statics = attributeValue.split(markerRegex);\n this.parts.push({ type: 'attribute', index, name, strings: statics });\n partIndex += statics.length - 1;\n }\n }\n if (node.tagName === 'TEMPLATE') {\n stack.push(node);\n walker.currentNode = node.content;\n }\n }\n else if (node.nodeType === 3 /* Node.TEXT_NODE */) {\n const data = node.data;\n if (data.indexOf(marker) >= 0) {\n const parent = node.parentNode;\n const strings = data.split(markerRegex);\n const lastIndex = strings.length - 1;\n // Generate a new text node for each literal section\n // These nodes are also used as the markers for node parts\n for (let i = 0; i < lastIndex; i++) {\n let insert;\n let s = strings[i];\n if (s === '') {\n insert = createMarker();\n }\n else {\n const match = lastAttributeNameRegex.exec(s);\n if (match !== null && endsWith(match[2], boundAttributeSuffix)) {\n s = s.slice(0, match.index) + match[1] +\n match[2].slice(0, -boundAttributeSuffix.length) + match[3];\n }\n insert = document.createTextNode(s);\n }\n parent.insertBefore(insert, node);\n this.parts.push({ type: 'node', index: ++index });\n }\n // If there's no text, we must insert a comment to mark our place.\n // Else, we can trust it will stick around after cloning.\n if (strings[lastIndex] === '') {\n parent.insertBefore(createMarker(), node);\n nodesToRemove.push(node);\n }\n else {\n node.data = strings[lastIndex];\n }\n // We have a part for each match found\n partIndex += lastIndex;\n }\n }\n else if (node.nodeType === 8 /* Node.COMMENT_NODE */) {\n if (node.data === marker) {\n const parent = node.parentNode;\n // Add a new marker node to be the startNode of the Part if any of\n // the following are true:\n // * We don't have a previousSibling\n // * The previousSibling is already the start of a previous part\n if (node.previousSibling === null || index === lastPartIndex) {\n index++;\n parent.insertBefore(createMarker(), node);\n }\n lastPartIndex = index;\n this.parts.push({ type: 'node', index });\n // If we don't have a nextSibling, keep this node so we have an end.\n // Else, we can remove it to save future costs.\n if (node.nextSibling === null) {\n node.data = '';\n }\n else {\n nodesToRemove.push(node);\n index--;\n }\n partIndex++;\n }\n else {\n let i = -1;\n while ((i = node.data.indexOf(marker, i + 1)) !== -1) {\n // Comment node has a binding marker inside, make an inactive part\n // The binding won't work, but subsequent bindings will\n // TODO (justinfagnani): consider whether it's even worth it to\n // make bindings in comments work\n this.parts.push({ type: 'node', index: -1 });\n partIndex++;\n }\n }\n }\n }\n // Remove text binding nodes after the walk to not disturb the TreeWalker\n for (const n of nodesToRemove) {\n n.parentNode.removeChild(n);\n }\n }\n}\nconst endsWith = (str, suffix) => {\n const index = str.length - suffix.length;\n return index >= 0 && str.slice(index) === suffix;\n};\nexport const isTemplatePartActive = (part) => part.index !== -1;\n// Allows `document.createComment('')` to be renamed for a\n// small manual size-savings.\nexport const createMarker = () => document.createComment('');\n/**\n * This regex extracts the attribute name preceding an attribute-position\n * expression. It does this by matching the syntax allowed for attributes\n * against the string literal directly preceding the expression, assuming that\n * the expression is in an attribute-value position.\n *\n * See attributes in the HTML spec:\n * https://www.w3.org/TR/html5/syntax.html#elements-attributes\n *\n * \" \\x09\\x0a\\x0c\\x0d\" are HTML space characters:\n * https://www.w3.org/TR/html5/infrastructure.html#space-characters\n *\n * \"\\0-\\x1F\\x7F-\\x9F\" are Unicode control characters, which includes every\n * space character except \" \".\n *\n * So an attribute is:\n * * The name: any character except a control character, space character, ('),\n * (\"), \">\", \"=\", or \"/\"\n * * Followed by zero or more space characters\n * * Followed by \"=\"\n * * Followed by zero or more space characters\n * * Followed by:\n * * Any character except space, ('), (\"), \"<\", \">\", \"=\", (`), or\n * * (\") then any non-(\"), or\n * * (') then any non-(')\n */\nexport const lastAttributeNameRegex = \n// eslint-disable-next-line no-control-regex\n/([ \\x09\\x0a\\x0c\\x0d])([^\\0-\\x1F\\x7F-\\x9F \"'>=/]+)([ \\x09\\x0a\\x0c\\x0d]*=[ \\x09\\x0a\\x0c\\x0d]*(?:[^ \\x09\\x0a\\x0c\\x0d\"'`<>=]*|\"[^\"]*|'[^']*))$/;\n//# sourceMappingURL=template.js.map","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\nimport { isCEPolyfill } from './dom.js';\nimport { isTemplatePartActive } from './template.js';\n/**\n * An instance of a `Template` that can be attached to the DOM and updated\n * with new values.\n */\nexport class TemplateInstance {\n constructor(template, processor, options) {\n this.__parts = [];\n this.template = template;\n this.processor = processor;\n this.options = options;\n }\n update(values) {\n let i = 0;\n for (const part of this.__parts) {\n if (part !== undefined) {\n part.setValue(values[i]);\n }\n i++;\n }\n for (const part of this.__parts) {\n if (part !== undefined) {\n part.commit();\n }\n }\n }\n _clone() {\n // There are a number of steps in the lifecycle of a template instance's\n // DOM fragment:\n // 1. Clone - create the instance fragment\n // 2. Adopt - adopt into the main document\n // 3. Process - find part markers and create parts\n // 4. Upgrade - upgrade custom elements\n // 5. Update - set node, attribute, property, etc., values\n // 6. Connect - connect to the document. Optional and outside of this\n // method.\n //\n // We have a few constraints on the ordering of these steps:\n // * We need to upgrade before updating, so that property values will pass\n // through any property setters.\n // * We would like to process before upgrading so that we're sure that the\n // cloned fragment is inert and not disturbed by self-modifying DOM.\n // * We want custom elements to upgrade even in disconnected fragments.\n //\n // Given these constraints, with full custom elements support we would\n // prefer the order: Clone, Process, Adopt, Upgrade, Update, Connect\n //\n // But Safari does not implement CustomElementRegistry#upgrade, so we\n // can not implement that order and still have upgrade-before-update and\n // upgrade disconnected fragments. So we instead sacrifice the\n // process-before-upgrade constraint, since in Custom Elements v1 elements\n // must not modify their light DOM in the constructor. We still have issues\n // when co-existing with CEv0 elements like Polymer 1, and with polyfills\n // that don't strictly adhere to the no-modification rule because shadow\n // DOM, which may be created in the constructor, is emulated by being placed\n // in the light DOM.\n //\n // The resulting order is on native is: Clone, Adopt, Upgrade, Process,\n // Update, Connect. document.importNode() performs Clone, Adopt, and Upgrade\n // in one step.\n //\n // The Custom Elements v1 polyfill supports upgrade(), so the order when\n // polyfilled is the more ideal: Clone, Process, Adopt, Upgrade, Update,\n // Connect.\n const fragment = isCEPolyfill ?\n this.template.element.content.cloneNode(true) :\n document.importNode(this.template.element.content, true);\n const stack = [];\n const parts = this.template.parts;\n // Edge needs all 4 parameters present; IE11 needs 3rd parameter to be null\n const walker = document.createTreeWalker(fragment, 133 /* NodeFilter.SHOW_{ELEMENT|COMMENT|TEXT} */, null, false);\n let partIndex = 0;\n let nodeIndex = 0;\n let part;\n let node = walker.nextNode();\n // Loop through all the nodes and parts of a template\n while (partIndex < parts.length) {\n part = parts[partIndex];\n if (!isTemplatePartActive(part)) {\n this.__parts.push(undefined);\n partIndex++;\n continue;\n }\n // Progress the tree walker until we find our next part's node.\n // Note that multiple parts may share the same node (attribute parts\n // on a single element), so this loop may not run at all.\n while (nodeIndex < part.index) {\n nodeIndex++;\n if (node.nodeName === 'TEMPLATE') {\n stack.push(node);\n walker.currentNode = node.content;\n }\n if ((node = walker.nextNode()) === null) {\n // We've exhausted the content inside a nested template element.\n // Because we still have parts (the outer for-loop), we know:\n // - There is a template in the stack\n // - The walker will find a nextNode outside the template\n walker.currentNode = stack.pop();\n node = walker.nextNode();\n }\n }\n // We've arrived at our part's node.\n if (part.type === 'node') {\n const part = this.processor.handleTextExpression(this.options);\n part.insertAfterNode(node.previousSibling);\n this.__parts.push(part);\n }\n else {\n this.__parts.push(...this.processor.handleAttributeExpressions(node, part.name, part.strings, this.options));\n }\n partIndex++;\n }\n if (isCEPolyfill) {\n document.adoptNode(fragment);\n customElements.upgrade(fragment);\n }\n return fragment;\n }\n}\n//# sourceMappingURL=template-instance.js.map","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n/**\n * @module lit-html\n */\nimport { reparentNodes } from './dom.js';\nimport { boundAttributeSuffix, lastAttributeNameRegex, marker, nodeMarker } from './template.js';\n/**\n * Our TrustedTypePolicy for HTML which is declared using the html template\n * tag function.\n *\n * That HTML is a developer-authored constant, and is parsed with innerHTML\n * before any untrusted expressions have been mixed in. Therefor it is\n * considered safe by construction.\n */\nconst policy = window.trustedTypes &&\n trustedTypes.createPolicy('lit-html', { createHTML: (s) => s });\nconst commentMarker = ` ${marker} `;\n/**\n * The return type of `html`, which holds a Template and the values from\n * interpolated expressions.\n */\nexport class TemplateResult {\n constructor(strings, values, type, processor) {\n this.strings = strings;\n this.values = values;\n this.type = type;\n this.processor = processor;\n }\n /**\n * Returns a string of HTML used to create a `<template>` element.\n */\n getHTML() {\n const l = this.strings.length - 1;\n let html = '';\n let isCommentBinding = false;\n for (let i = 0; i < l; i++) {\n const s = this.strings[i];\n // For each binding we want to determine the kind of marker to insert\n // into the template source before it's parsed by the browser's HTML\n // parser. The marker type is based on whether the expression is in an\n // attribute, text, or comment position.\n // * For node-position bindings we insert a comment with the marker\n // sentinel as its text content, like <!--{{lit-guid}}-->.\n // * For attribute bindings we insert just the marker sentinel for the\n // first binding, so that we support unquoted attribute bindings.\n // Subsequent bindings can use a comment marker because multi-binding\n // attributes must be quoted.\n // * For comment bindings we insert just the marker sentinel so we don't\n // close the comment.\n //\n // The following code scans the template source, but is *not* an HTML\n // parser. We don't need to track the tree structure of the HTML, only\n // whether a binding is inside a comment, and if not, if it appears to be\n // the first binding in an attribute.\n const commentOpen = s.lastIndexOf('<!--');\n // We're in comment position if we have a comment open with no following\n // comment close. Because <-- can appear in an attribute value there can\n // be false positives.\n isCommentBinding = (commentOpen > -1 || isCommentBinding) &&\n s.indexOf('-->', commentOpen + 1) === -1;\n // Check to see if we have an attribute-like sequence preceding the\n // expression. This can match \"name=value\" like structures in text,\n // comments, and attribute values, so there can be false-positives.\n const attributeMatch = lastAttributeNameRegex.exec(s);\n if (attributeMatch === null) {\n // We're only in this branch if we don't have a attribute-like\n // preceding sequence. For comments, this guards against unusual\n // attribute values like <div foo=\"<!--${'bar'}\">. Cases like\n // <!-- foo=${'bar'}--> are handled correctly in the attribute branch\n // below.\n html += s + (isCommentBinding ? commentMarker : nodeMarker);\n }\n else {\n // For attributes we use just a marker sentinel, and also append a\n // $lit$ suffix to the name to opt-out of attribute-specific parsing\n // that IE and Edge do for style and certain SVG attributes.\n html += s.substr(0, attributeMatch.index) + attributeMatch[1] +\n attributeMatch[2] + boundAttributeSuffix + attributeMatch[3] +\n marker;\n }\n }\n html += this.strings[l];\n return html;\n }\n getTemplateElement() {\n const template = document.createElement('template');\n let value = this.getHTML();\n if (policy !== undefined) {\n // this is secure because `this.strings` is a TemplateStringsArray.\n // TODO: validate this when\n // https://github.com/tc39/proposal-array-is-template-object is\n // implemented.\n value = policy.createHTML(value);\n }\n template.innerHTML = value;\n return template;\n }\n}\n/**\n * A TemplateResult for SVG fragments.\n *\n * This class wraps HTML in an `<svg>` tag in order to parse its contents in the\n * SVG namespace, then modifies the template to remove the `<svg>` tag so that\n * clones only container the original fragment.\n */\nexport class SVGTemplateResult extends TemplateResult {\n getHTML() {\n return `<svg>${super.getHTML()}</svg>`;\n }\n getTemplateElement() {\n const template = super.getTemplateElement();\n const content = template.content;\n const svgElement = content.firstChild;\n content.removeChild(svgElement);\n reparentNodes(content, svgElement.firstChild);\n return template;\n }\n}\n//# sourceMappingURL=template-result.js.map","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\nimport { isDirective } from './directive.js';\nimport { removeNodes } from './dom.js';\nimport { noChange, nothing } from './part.js';\nimport { TemplateInstance } from './template-instance.js';\nimport { TemplateResult } from './template-result.js';\nimport { createMarker } from './template.js';\nexport const isPrimitive = (value) => {\n return (value === null ||\n !(typeof value === 'object' || typeof value === 'function'));\n};\nexport const isIterable = (value) => {\n return Array.isArray(value) ||\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n !!(value && value[Symbol.iterator]);\n};\n/**\n * Writes attribute values to the DOM for a group of AttributeParts bound to a\n * single attribute. The value is only set once even if there are multiple parts\n * for an attribute.\n */\nexport class AttributeCommitter {\n constructor(element, name, strings) {\n this.dirty = true;\n this.element = element;\n this.name = name;\n this.strings = strings;\n this.parts = [];\n for (let i = 0; i < strings.length - 1; i++) {\n this.parts[i] = this._createPart();\n }\n }\n /**\n * Creates a single part. Override this to create a differnt type of part.\n */\n _createPart() {\n return new AttributePart(this);\n }\n _getValue() {\n const strings = this.strings;\n const l = strings.length - 1;\n const parts = this.parts;\n // If we're assigning an attribute via syntax like:\n // attr=\"${foo}\" or attr=${foo}\n // but not\n // attr=\"${foo} ${bar}\" or attr=\"${foo} baz\"\n // then we don't want to coerce the attribute value into one long\n // string. Instead we want to just return the value itself directly,\n // so that sanitizeDOMValue can get the actual value rather than\n // String(value)\n // The exception is if v is an array, in which case we do want to smash\n // it together into a string without calling String() on the array.\n //\n // This also allows trusted values (when using TrustedTypes) being\n // assigned to DOM sinks without being stringified in the process.\n if (l === 1 && strings[0] === '' && strings[1] === '') {\n const v = parts[0].value;\n if (typeof v === 'symbol') {\n return String(v);\n }\n if (typeof v === 'string' || !isIterable(v)) {\n return v;\n }\n }\n let text = '';\n for (let i = 0; i < l; i++) {\n text += strings[i];\n const part = parts[i];\n if (part !== undefined) {\n const v = part.value;\n if (isPrimitive(v) || !isIterable(v)) {\n text += typeof v === 'string' ? v : String(v);\n }\n else {\n for (const t of v) {\n text += typeof t === 'string' ? t : String(t);\n }\n }\n }\n }\n text += strings[l];\n return text;\n }\n commit() {\n if (this.dirty) {\n this.dirty = false;\n this.element.setAttribute(this.name, this._getValue());\n }\n }\n}\n/**\n * A Part that controls all or part of an attribute value.\n */\nexport class AttributePart {\n constructor(committer) {\n this.value = undefined;\n this.committer = committer;\n }\n setValue(value) {\n if (value !== noChange && (!isPrimitive(value) || value !== this.value)) {\n this.value = value;\n // If the value is a not a directive, dirty the committer so that it'll\n // call setAttribute. If the value is a directive, it'll dirty the\n // committer if it calls setValue().\n if (!isDirective(value)) {\n this.committer.dirty = true;\n }\n }\n }\n commit() {\n while (isDirective(this.value)) {\n const directive = this.value;\n this.value = noChange;\n directive(this);\n }\n if (this.value === noChange) {\n return;\n }\n this.committer.commit();\n }\n}\n/**\n * A Part that controls a location within a Node tree. Like a Range, NodePart\n * has start and end locations and can set and update the Nodes between those\n * locations.\n *\n * NodeParts support several value types: primitives, Nodes, TemplateResults,\n * as well as arrays and iterables of those types.\n */\nexport class NodePart {\n constructor(options) {\n this.value = undefined;\n this.__pendingValue = undefined;\n this.options = options;\n }\n /**\n * Appends this part into a container.\n *\n * This part must be empty, as its contents are not automatically moved.\n */\n appendInto(container) {\n this.startNode = container.appendChild(createMarker());\n this.endNode = container.appendChild(createMarker());\n }\n /**\n * Inserts this part after the `ref` node (between `ref` and `ref`'s next\n * sibling). Both `ref` and its next sibling must be static, unchanging nodes\n * such as those that appear in a literal section of a template.\n *\n * This part must be empty, as its contents are not automatically moved.\n */\n insertAfterNode(ref) {\n this.startNode = ref;\n this.endNode = ref.nextSibling;\n }\n /**\n * Appends this part into a parent part.\n *\n * This part must be empty, as its contents are not automatically moved.\n */\n appendIntoPart(part) {\n part.__insert(this.startNode = createMarker());\n part.__insert(this.endNode = createMarker());\n }\n /**\n * Inserts this part after the `ref` part.\n *\n * This part must be empty, as its contents are not automatically moved.\n */\n insertAfterPart(ref) {\n ref.__insert(this.startNode = createMarker());\n this.endNode = ref.endNode;\n ref.endNode = this.startNode;\n }\n setValue(value) {\n this.__pendingValue = value;\n }\n commit() {\n if (this.startNode.parentNode === null) {\n return;\n }\n while (isDirective(this.__pendingValue)) {\n const directive = this.__pendingValue;\n this.__pendingValue = noChange;\n directive(this);\n }\n const value = this.__pendingValue;\n if (value === noChange) {\n return;\n }\n if (isPrimitive(value)) {\n if (value !== this.value) {\n this.__commitText(value);\n }\n }\n else if (value instanceof TemplateResult) {\n this.__commitTemplateResult(value);\n }\n else if (value instanceof Node) {\n this.__commitNode(value);\n }\n else if (isIterable(value)) {\n this.__commitIterable(value);\n }\n else if (value === nothing) {\n this.value = nothing;\n this.clear();\n }\n else {\n // Fallback, will render the string representation\n this.__commitText(value);\n }\n }\n __insert(node) {\n this.endNode.parentNode.insertBefore(node, this.endNode);\n }\n __commitNode(value) {\n if (this.value === value) {\n return;\n }\n this.clear();\n this.__insert(value);\n this.value = value;\n }\n __commitText(value) {\n const node = this.startNode.nextSibling;\n value = value == null ? '' : value;\n // If `value` isn't already a string, we explicitly convert it here in case\n // it can't be implicitly converted - i.e. it's a symbol.\n const valueAsString = typeof value === 'string' ? value : String(value);\n if (node === this.endNode.previousSibling &&\n node.nodeType === 3 /* Node.TEXT_NODE */) {\n // If we only have a single text node between the markers, we can just\n // set its value, rather than replacing it.\n // TODO(justinfagnani): Can we just check if this.value is primitive?\n node.data = valueAsString;\n }\n else {\n this.__commitNode(document.createTextNode(valueAsString));\n }\n this.value = value;\n }\n __commitTemplateResult(value) {\n const template = this.options.templateFactory(value);\n if (this.value instanceof TemplateInstance &&\n this.value.template === template) {\n this.value.update(value.values);\n }\n else {\n // Make sure we propagate the template processor from the TemplateResult\n // so that we use its syntax extension, etc. The template factory comes\n // from the render function options so that it can control template\n // caching and preprocessing.\n const instance = new TemplateInstance(template, value.processor, this.options);\n const fragment = instance._clone();\n instance.update(value.values);\n this.__commitNode(fragment);\n this.value = instance;\n }\n }\n __commitIterable(value) {\n // For an Iterable, we create a new InstancePart per item, then set its\n // value to the item. This is a little bit of overhead for every item in\n // an Iterable, but it lets us recurse easily and efficiently update Arrays\n // of TemplateResults that will be commonly returned from expressions like:\n // array.map((i) => html`${i}`), by reusing existing TemplateInstances.\n // If _value is an array, then the previous render was of an\n // iterable and _value will contain the NodeParts from the previous\n // render. If _value is not an array, clear this part and make a new\n // array for NodeParts.\n if (!Array.isArray(this.value)) {\n this.value = [];\n this.clear();\n }\n // Lets us keep track of how many items we stamped so we can clear leftover\n // items from a previous render\n const itemParts = this.value;\n let partIndex = 0;\n let itemPart;\n for (const item of value) {\n // Try to reuse an existing part\n itemPart = itemParts[partIndex];\n // If no existing part, create a new one\n if (itemPart === undefined) {\n itemPart = new NodePart(this.options);\n itemParts.push(itemPart);\n if (partIndex === 0) {\n itemPart.appendIntoPart(this);\n }\n else {\n itemPart.insertAfterPart(itemParts[partIndex - 1]);\n }\n }\n itemPart.setValue(item);\n itemPart.commit();\n partIndex++;\n }\n if (partIndex < itemParts.length) {\n // Truncate the parts array so _value reflects the current state\n itemParts.length = partIndex;\n this.clear(itemPart && itemPart.endNode);\n }\n }\n clear(startNode = this.startNode) {\n removeNodes(this.startNode.parentNode, startNode.nextSibling, this.endNode);\n }\n}\n/**\n * Implements a boolean attribute, roughly as defined in the HTML\n * specification.\n *\n * If the value is truthy, then the attribute is present with a value of\n * ''. If the value is falsey, the attribute is removed.\n */\nexport class BooleanAttributePart {\n constructor(element, name, strings) {\n this.value = undefined;\n this.__pendingValue = undefined;\n if (strings.length !== 2 || strings[0] !== '' || strings[1] !== '') {\n throw new Error('Boolean attributes can only contain a single expression');\n }\n this.element = element;\n this.name = name;\n this.strings = strings;\n }\n setValue(value) {\n this.__pendingValue = value;\n }\n commit() {\n while (isDirective(this.__pendingValue)) {\n const directive = this.__pendingValue;\n this.__pendingValue = noChange;\n directive(this);\n }\n if (this.__pendingValue === noChange) {\n return;\n }\n const value = !!this.__pendingValue;\n if (this.value !== value) {\n if (value) {\n this.element.setAttribute(this.name, '');\n }\n else {\n this.element.removeAttribute(this.name);\n }\n this.value = value;\n }\n this.__pendingValue = noChange;\n }\n}\n/**\n * Sets attribute values for PropertyParts, so that the value is only set once\n * even if there are multiple parts for a property.\n *\n * If an expression controls the whole property value, then the value is simply\n * assigned to the property under control. If there are string literals or\n * multiple expressions, then the strings are expressions are interpolated into\n * a string first.\n */\nexport class PropertyCommitter extends AttributeCommitter {\n constructor(element, name, strings) {\n super(element, name, strings);\n this.single =\n (strings.length === 2 && strings[0] === '' && strings[1] === '');\n }\n _createPart() {\n return new PropertyPart(this);\n }\n _getValue() {\n if (this.single) {\n return this.parts[0].value;\n }\n return super._getValue();\n }\n commit() {\n if (this.dirty) {\n this.dirty = false;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n this.element[this.name] = this._getValue();\n }\n }\n}\nexport class PropertyPart extends AttributePart {\n}\n// Detect event listener options support. If the `capture` property is read\n// from the options object, then options are supported. If not, then the third\n// argument to add/removeEventListener is interpreted as the boolean capture\n// value so we should only pass the `capture` property.\nlet eventOptionsSupported = false;\n// Wrap into an IIFE because MS Edge <= v41 does not support having try/catch\n// blocks right into the body of a module\n(() => {\n try {\n const options = {\n get capture() {\n eventOptionsSupported = true;\n return false;\n }\n };\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n window.addEventListener('test', options, options);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n window.removeEventListener('test', options, options);\n }\n catch (_e) {\n // event options not supported\n }\n})();\nexport class EventPart {\n constructor(element, eventName, eventContext) {\n this.value = undefined;\n this.__pendingValue = undefined;\n this.element = element;\n this.eventName = eventName;\n this.eventContext = eventContext;\n this.__boundHandleEvent = (e) => this.handleEvent(e);\n }\n setValue(value) {\n this.__pendingValue = value;\n }\n commit() {\n while (isDirective(this.__pendingValue)) {\n const directive = this.__pendingValue;\n this.__pendingValue = noChange;\n directive(this);\n }\n if (this.__pendingValue === noChange) {\n return;\n }\n const newListener = this.__pendingValue;\n const oldListener = this.value;\n const shouldRemoveListener = newListener == null ||\n oldListener != null &&\n (newListener.capture !== oldListener.capture ||\n newListener.once !== oldListener.once ||\n newListener.passive !== oldListener.passive);\n const shouldAddListener = newListener != null && (oldListener == null || shouldRemoveListener);\n if (shouldRemoveListener) {\n this.element.removeEventListener(this.eventName, this.__boundHandleEvent, this.__options);\n }\n if (shouldAddListener) {\n this.__options = getOptions(newListener);\n this.element.addEventListener(this.eventName, this.__boundHandleEvent, this.__options);\n }\n this.value = newListener;\n this.__pendingValue = noChange;\n }\n handleEvent(event) {\n if (typeof this.value === 'function') {\n this.value.call(this.eventContext || this.element, event);\n }\n else {\n this.value.handleEvent(event);\n }\n }\n}\n// We copy options because of the inconsistent behavior of browsers when reading\n// the third argument of add/removeEventListener. IE11 doesn't support options\n// at all. Chrome 41 only reads `capture` if the argument is an object.\nconst getOptions = (o) => o &&\n (eventOptionsSupported ?\n { capture: o.capture, passive: o.passive, once: o.once } :\n o.capture);\n//# sourceMappingURL=parts.js.map","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\nimport { AttributeCommitter, BooleanAttributePart, EventPart, NodePart, PropertyCommitter } from './parts.js';\n/**\n * Creates Parts when a template is instantiated.\n */\nexport class DefaultTemplateProcessor {\n /**\n * Create parts for an attribute-position binding, given the event, attribute\n * name, and string literals.\n *\n * @param element The element containing the binding\n * @param name The attribute name\n * @param strings The string literals. There are always at least two strings,\n * event for fully-controlled bindings with a single expression.\n */\n handleAttributeExpressions(element, name, strings, options) {\n const prefix = name[0];\n if (prefix === '.') {\n const committer = new PropertyCommitter(element, name.slice(1), strings);\n return committer.parts;\n }\n if (prefix === '@') {\n return [new EventPart(element, name.slice(1), options.eventContext)];\n }\n if (prefix === '?') {\n return [new BooleanAttributePart(element, name.slice(1), strings)];\n }\n const committer = new AttributeCommitter(element, name, strings);\n return committer.parts;\n }\n /**\n * Create parts for a text-position binding.\n * @param templateFactory\n */\n handleTextExpression(options) {\n return new NodePart(options);\n }\n}\nexport const defaultTemplateProcessor = new DefaultTemplateProcessor();\n//# sourceMappingURL=default-template-processor.js.map","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\nimport { marker, Template } from './template.js';\n/**\n * The default TemplateFactory which caches Templates keyed on\n * result.type and result.strings.\n */\nexport function templateFactory(result) {\n let templateCache = templateCaches.get(result.type);\n if (templateCache === undefined) {\n templateCache = {\n stringsArray: new WeakMap(),\n keyString: new Map()\n };\n templateCaches.set(result.type, templateCache);\n }\n let template = templateCache.stringsArray.get(result.strings);\n if (template !== undefined) {\n return template;\n }\n // If the TemplateStringsArray is new, generate a key from the strings\n // This key is shared between all templates with identical content\n const key = result.strings.join(marker);\n // Check if we already have a Template for this key\n template = templateCache.keyString.get(key);\n if (template === undefined) {\n // If we have not seen this key before, create a new Template\n template = new Template(result, result.getTemplateElement());\n // Cache the Template for this key\n templateCache.keyString.set(key, template);\n }\n // Cache all future queries for this TemplateStringsArray\n templateCache.stringsArray.set(result.strings, template);\n return template;\n}\nexport const templateCaches = new Map();\n//# sourceMappingURL=template-factory.js.map","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\nimport { removeNodes } from './dom.js';\nimport { NodePart } from './parts.js';\nimport { templateFactory } from './template-factory.js';\nexport const parts = new WeakMap();\n/**\n * Renders a template result or other value to a container.\n *\n * To update a container with new values, reevaluate the template literal and\n * call `render` with the new result.\n *\n * @param result Any value renderable by NodePart - typically a TemplateResult\n * created by evaluating a template tag like `html` or `svg`.\n * @param container A DOM parent to render to. The entire contents are either\n * replaced, or efficiently updated if the same result type was previous\n * rendered there.\n * @param options RenderOptions for the entire render tree rendered to this\n * container. Render options must *not* change between renders to the same\n * container, as those changes will not effect previously rendered DOM.\n */\nexport const render = (result, container, options) => {\n let part = parts.get(container);\n if (part === undefined) {\n removeNodes(container, container.firstChild);\n parts.set(container, part = new NodePart(Object.assign({ templateFactory }, options)));\n part.appendInto(container);\n }\n part.setValue(result);\n part.commit();\n};\n//# sourceMappingURL=render.js.map","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n/**\n *\n * Main lit-html module.\n *\n * Main exports:\n *\n * - [[html]]\n * - [[svg]]\n * - [[render]]\n *\n * @packageDocumentation\n */\n/**\n * Do not remove this comment; it keeps typedoc from misplacing the module\n * docs.\n */\nimport { defaultTemplateProcessor } from './lib/default-template-processor.js';\nimport { SVGTemplateResult, TemplateResult } from './lib/template-result.js';\nexport { DefaultTemplateProcessor, defaultTemplateProcessor } from './lib/default-template-processor.js';\nexport { directive, isDirective } from './lib/directive.js';\n// TODO(justinfagnani): remove line when we get NodePart moving methods\nexport { removeNodes, reparentNodes } from './lib/dom.js';\nexport { noChange, nothing } from './lib/part.js';\nexport { AttributeCommitter, AttributePart, BooleanAttributePart, EventPart, isIterable, isPrimitive, NodePart, PropertyCommitter, PropertyPart } from './lib/parts.js';\nexport { parts, render } from './lib/render.js';\nexport { templateCaches, templateFactory } from './lib/template-factory.js';\nexport { TemplateInstance } from './lib/template-instance.js';\nexport { SVGTemplateResult, TemplateResult } from './lib/template-result.js';\nexport { createMarker, isTemplatePartActive, Template } from './lib/template.js';\n// IMPORTANT: do not change the property name or the assignment expression.\n// This line will be used in regexes to search for lit-html usage.\n// TODO(justinfagnani): inject version number at build time\nif (typeof window !== 'undefined') {\n (window['litHtmlVersions'] || (window['litHtmlVersions'] = [])).push('1.4.1');\n}\n/**\n * Interprets a template literal as an HTML template that can efficiently\n * render to and update a container.\n */\nexport const html = (strings, ...values) => new TemplateResult(strings, values, 'html', defaultTemplateProcessor);\n/**\n * Interprets a template literal as an SVG template that can efficiently\n * render to and update a container.\n */\nexport const svg = (strings, ...values) => new SVGTemplateResult(strings, values, 'svg', defaultTemplateProcessor);\n//# sourceMappingURL=lit-html.js.map","const microtaskSet = new Set<() => void>();\nexport function addMicrotask(func: () => void) {\n if (typeof func !== 'function') return;\n if (!microtaskSet.size) {\n // delayed execution callback after updating store\n globalThis.queueMicrotask(() => {\n microtaskSet.forEach((func) => func());\n microtaskSet.clear();\n });\n }\n microtaskSet.delete(func);\n microtaskSet.add(func);\n}\n\nconst microtaskStack: (() => void)[] = [];\n\nfunction execMicrotaskStack() {\n for (let i = microtaskStack.length - 1; i >= 0; i--) {\n microtaskStack[i]();\n }\n microtaskStack.length = 0;\n}\n\n/**\n * 添加回调函数到微任务队列栈;\n * 先进后执行;\n */\nexport function addMicrotaskToStack(func: () => void) {\n if (!microtaskStack.length) {\n addMicrotask(execMicrotaskStack);\n }\n microtaskStack.push(func);\n}\n\nexport function absoluteLocation(currentPath = '', relativePath = '') {\n const { pathname, search, hash } = new URL(relativePath, location.origin + currentPath);\n return pathname + search + hash;\n}\n\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport type NonPrimitive = object;\n\ninterface LinkedListEventMap {\n start: Event;\n end: Event;\n}\ninterface LinkedListItem<T> {\n value: T;\n prev?: LinkedListItem<T>;\n next?: LinkedListItem<T>;\n}\n// work on nodejs\nexport class LinkedList<T = any> extends (globalThis.EventTarget || Object) {\n addEventListener: <K extends keyof LinkedListEventMap>(\n type: K,\n listener: (this: LinkedList<T>, ev: LinkedListEventMap[K]) => any,\n options?: boolean | AddEventListenerOptions,\n ) => void;\n\n #map = new Map<T, LinkedListItem<T>>();\n #firstItem?: LinkedListItem<T>;\n #lastItem?: LinkedListItem<T>;\n\n #delete(value: T) {\n const existItem = this.#map.get(value);\n if (existItem) {\n if (existItem.prev) {\n existItem.prev.next = existItem.next;\n } else {\n this.#firstItem = existItem.next;\n }\n if (existItem.next) {\n existItem.next.prev = existItem.prev;\n } else {\n this.#lastItem = existItem.prev;\n }\n this.#map.delete(value);\n }\n return existItem;\n }\n\n get size() {\n return this.#map.size;\n }\n\n // 添加到尾部,已存在时会删除老的项目\n // 如果是添加第一个,start 事件会在添加前触发,避免处理事件重复的逻辑\n add(value: T) {\n if (!this.#lastItem) {\n this.dispatchEvent(new CustomEvent('start'));\n }\n const item: LinkedListItem<T> = this.#delete(value) || { value };\n item.prev = this.#lastItem;\n if (item.prev) {\n item.prev.next = item;\n }\n item.next = undefined;\n this.#lastItem = item;\n if (!this.#firstItem) {\n this.#firstItem = item;\n }\n this.#map.set(value, item);\n }\n\n // 删除这个元素后没有其他元素时立即出发 end 事件\n delete(value: T) {\n const deleteItem = this.#delete(value);\n if (!this.#firstItem) {\n this.dispatchEvent(new CustomEvent('end'));\n }\n return deleteItem;\n }\n\n // 获取头部元素\n get(): T | undefined {\n const firstItem = this.#firstItem;\n if (!firstItem) return;\n this.#delete(firstItem.value);\n return firstItem.value;\n }\n}\n\nexport class PropProxyMap<T extends NonPrimitive, V = unknown> extends WeakMap<T, Record<string, V>> {\n get(ele: T) {\n let proxy = super.get(ele);\n if (!proxy) {\n proxy = {};\n this.set(ele, proxy);\n }\n return proxy;\n }\n}\n\ndeclare global {\n interface URLSearchParams {\n entries(): Iterable<readonly [string | number | symbol, any]>;\n }\n}\nexport class QueryString extends URLSearchParams {\n constructor(param?: any) {\n super(param);\n }\n\n // support `{ key: ObjectValue }`\n concat(param: any) {\n let query: any;\n if (typeof param === 'string') {\n query = Object.fromEntries(new URLSearchParams(param).entries());\n } else {\n query = param;\n }\n Object.entries(query).forEach(([key, value]) => {\n this.append(key, this.#stringify(value));\n });\n }\n\n #stringify = (value: any) => (typeof value === 'string' ? value : JSON.stringify(value));\n\n setAny(key: string, value: any) {\n if (Array.isArray(value)) {\n this.delete(key);\n value.forEach((e) => this.append(key, this.#stringify(e)));\n } else {\n const v = this.#stringify(value);\n v ? this.set(key, v) : this.delete(key);\n }\n }\n\n #parse = (value: any) => {\n if (!value) return null;\n try {\n return JSON.parse(value);\n } catch {\n return null;\n }\n };\n\n getAny(key: string) {\n return this.getAnyAll(key)[0];\n }\n\n getAnyAll(key: string) {\n return this.getAll(key)\n .filter((e) => e !== '')\n .map((e) => this.#parse(e));\n }\n\n toString() {\n const string = super.toString();\n return string ? `?${string}` : '';\n }\n\n toJSON() {\n return this.toString();\n }\n}\n\n/**\n * 写纯文本,仅用于 IDE HTML 高亮\n *\n * 不同于 lit-html 的 `html` 模版函数,写 attribute 时必须手动写引号并自行进行 html 编码\n */\nexport function raw(arr: TemplateStringsArray, ...args: any[]) {\n return arr.reduce((prev, current, index) => prev + (args[index - 1] ?? '') + current);\n}\n\n// 写 css 文本,在 CSSStyleSheet 中使用\nexport function css(arr: TemplateStringsArray, ...args: any[]) {\n return raw(arr, ...args);\n}\n\nexport const SheetToken = Symbol('sheet token');\n\nexport type Sheet<T> = {\n [P in keyof T]: P;\n} & { [SheetToken]: CSSStyleSheet };\n\ndeclare global {\n interface CSSStyleSheet {\n replaceSync: (str: string) => void;\n }\n\n interface CSSRuleList {\n item(index: number): CSSStyleRule;\n }\n interface ShadowRoot {\n adoptedStyleSheets: CSSStyleSheet[];\n }\n interface Document {\n adoptedStyleSheets: CSSStyleSheet[];\n }\n}\n\nexport type StyledType = 'id' | 'class' | 'keyframes';\nexport interface StyledValueObject {\n styledContent: string;\n type: StyledType;\n}\nexport interface StyledKeyValuePair {\n [key: string]: StyledValueObject;\n}\n\n// !!! 目前只有 Chrome/FirefoxNightly 支持\n// https://bugzilla.mozilla.org/show_bug.cgi?id=1520690\n// https://bugs.webkit.org/show_bug.cgi?id=228684\nexport let useNativeCSSStyleSheet = true;\nlet CSSStyleSheet = window.CSSStyleSheet;\ntry {\n new (CSSStyleSheet as any)();\n} catch {\n useNativeCSSStyleSheet = false;\n CSSStyleSheet = class {\n media = { mediaText: '' };\n style = '';\n replaceSync = (style: string) => (this.style = style);\n } as any;\n}\n\n/**\n *\n * 创建 style sheet 用于 `adoptedStyleSheets`,不支持样式更新\n * @param rules string | Record<string, string> 不能动态更新的 css\n * @param mediaQuery string 媒体查询 StyleSheet.media.mediaText\n */\nexport function createCSSSheet<T extends StyledKeyValuePair>(rules: T | string, mediaQuery = ''): Sheet<T> {\n const styleSheet = new CSSStyleSheet();\n const sheet: any = {};\n styleSheet.media.mediaText = mediaQuery;\n let style = '';\n if (typeof rules === 'string') {\n style = rules;\n } else {\n Object.keys(rules).forEach((key: keyof T) => {\n sheet[key] = `${key}-${randomStr()}`;\n style += rules[key].styledContent.replace(/&/g, sheet[key]);\n });\n }\n styleSheet.replaceSync(style);\n sheet[SheetToken] = styleSheet;\n return sheet as Sheet<T>;\n}\n\nexport function randomStr(number = 5, origin = '0123456789abcdefghijklmnopqrstuvwxyz') {\n const len = origin.length;\n let str = '';\n for (let i = 0; i < number; i++) {\n str += origin[Math.floor(Math.random() * len)];\n }\n return str;\n}\n\nconst nestingRuleRegExp = new RegExp('&.*{((.|\\n)*)}', 'g');\n// 只支持一层嵌套\n// https://drafts.csswg.org/css-nesting-1/\nfunction flatStyled(style: string, type: StyledType): StyledValueObject {\n const nestingRules: string[] = [];\n let styledContent =\n `& {${style.replace(nestingRuleRegExp, (substr) => {\n nestingRules.push(substr);\n return '';\n })}}` + nestingRules.join('');\n styledContent = styledContent.replace(/&/g, type === 'class' ? '.&' : '#&');\n return { styledContent, type };\n}\n\n// 写 css 文本,在 CSSStyleSheet 中使用,使用 styed-components 高亮\n// 暂时不支持 `at` 规则\n//\n// createCSSSheet({\n// red: styled.class`\n// background: red;\n// &:hover {\n// background: blue;\n// }\n// `,\n// });\nexport const styled = {\n class: (arr: TemplateStringsArray, ...args: any[]) => {\n const style = raw(arr, ...args);\n return flatStyled(style, 'class');\n },\n id: (arr: TemplateStringsArray, ...args: any[]) => {\n const style = raw(arr, ...args);\n return flatStyled(style, 'id');\n },\n keyframes: (arr: TemplateStringsArray, ...args: any[]): StyledValueObject => {\n const keyframesContent = raw(arr, ...args);\n const styledContent = `@keyframes & {${keyframesContent}}`;\n return { styledContent, type: 'keyframes' };\n },\n};\n\nexport function camelToKebabCase(str: string) {\n return str.replace(/[A-Z]/g, ($1: string) => '-' + $1.toLowerCase());\n}\n\nexport function kebabToCamelCase(str: string) {\n return str.replace(/-(.)/g, (_substr, $1: string) => $1.toUpperCase());\n}\n\nexport function cleanObject<T extends Record<string, unknown>>(o: T) {\n Object.keys(o).forEach((key: string) => {\n const k = key as keyof T;\n delete o[k];\n });\n return o;\n}\n\nexport class GemError extends Error {\n constructor(msg: string) {\n super(msg);\n this.message = `gem: ${this.message}`;\n }\n}\n\nexport function isArrayChange(newValues: any[], oldValues: any[]) {\n const length = newValues.length;\n if (oldValues.length !== length) return true;\n for (let i = 0; i < length; i++) {\n if (newValues[i] !== oldValues[i]) return true;\n }\n return false;\n}\n\nexport function removeItems(target: any[], items: any[]) {\n const set = new Set(items);\n return target.filter((e) => {\n if (set.has(e)) {\n set.delete(e);\n return false;\n }\n return true;\n });\n}\n\nexport function styleMap(obj: Partial<CSSStyleDeclaration>) {\n let styleString = '';\n for (const key in obj) {\n if (obj[key]) {\n styleString += `${camelToKebabCase(key)}:${obj[key]};`;\n }\n }\n return styleString;\n}\n\nexport function classMap(obj: Record<string, boolean>) {\n let classList = ' ';\n for (const className in obj) {\n if (obj[className]) {\n classList += `${className} `;\n }\n }\n return classList;\n}\n\nexport const partMap = classMap;\n","import { addMicrotask, GemError, NonPrimitive } from './utils';\n\nexport const StoreListenerMap = new WeakMap<NonPrimitive, Set<() => void>>();\n\n// 限制 `updateStore` 的参数类型\nexport type Store<T> = T & { '': string };\n\nexport function createStore<T extends NonPrimitive>(originStore: T) {\n if (StoreListenerMap.has(originStore)) {\n throw new GemError('argument error');\n }\n StoreListenerMap.set(originStore, new Set<() => void>());\n return originStore as Store<T>;\n}\n\ninterface StoreObjectSet {\n [store: string]: NonPrimitive;\n}\nexport type StoreSet<T> = {\n [P in keyof T]: T[P] & Store<T[P]>;\n};\nexport function createStoreSet<T extends StoreObjectSet>(originStoreSet: T) {\n const keys = Object.keys(originStoreSet);\n keys.forEach((key) => {\n createStore(originStoreSet[key]);\n });\n\n return originStoreSet as StoreSet<T>;\n}\n\nexport function updateStore<T extends NonPrimitive>(store: Store<T>, value?: Partial<T>) {\n Object.assign(store, value);\n const listeners = StoreListenerMap.get(store);\n listeners?.forEach((func) => {\n addMicrotask(func);\n });\n}\n\nexport function connect<T extends NonPrimitive>(store: Store<T>, func: () => void) {\n const listeners = StoreListenerMap.get(store);\n listeners?.add(func);\n}\n\nexport function disconnect<T extends NonPrimitive>(store: Store<T>, func: () => void) {\n const listeners = StoreListenerMap.get(store);\n listeners?.delete(func);\n}\n","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\nimport { createMarker, directive, NodePart, removeNodes, reparentNodes } from '../lit-html.js';\n// Helper functions for manipulating parts\n// TODO(kschaaf): Refactor into Part API?\nconst createAndInsertPart = (containerPart, beforePart) => {\n const container = containerPart.startNode.parentNode;\n const beforeNode = beforePart === undefined ? containerPart.endNode :\n beforePart.startNode;\n const startNode = container.insertBefore(createMarker(), beforeNode);\n container.insertBefore(createMarker(), beforeNode);\n const newPart = new NodePart(containerPart.options);\n newPart.insertAfterNode(startNode);\n return newPart;\n};\nconst updatePart = (part, value) => {\n part.setValue(value);\n part.commit();\n return part;\n};\nconst insertPartBefore = (containerPart, part, ref) => {\n const container = containerPart.startNode.parentNode;\n const beforeNode = ref ? ref.startNode : containerPart.endNode;\n const endNode = part.endNode.nextSibling;\n if (endNode !== beforeNode) {\n reparentNodes(container, part.startNode, endNode, beforeNode);\n }\n};\nconst removePart = (part) => {\n removeNodes(part.startNode.parentNode, part.startNode, part.endNode.nextSibling);\n};\n// Helper for generating a map of array item to its index over a subset\n// of an array (used to lazily generate `newKeyToIndexMap` and\n// `oldKeyToIndexMap`)\nconst generateMap = (list, start, end) => {\n const map = new Map();\n for (let i = start; i <= end; i++) {\n map.set(list[i], i);\n }\n return map;\n};\n// Stores previous ordered list of parts and map of key to index\nconst partListCache = new WeakMap();\nconst keyListCache = new WeakMap();\n/**\n * A directive that repeats a series of values (usually `TemplateResults`)\n * generated from an iterable, and updates those items efficiently when the\n * iterable changes based on user-provided `keys` associated with each item.\n *\n * Note that if a `keyFn` is provided, strict key-to-DOM mapping is maintained,\n * meaning previous DOM for a given key is moved into the new position if\n * needed, and DOM will never be reused with values for different keys (new DOM\n * will always be created for new keys). This is generally the most efficient\n * way to use `repeat` since it performs minimum unnecessary work for insertions\n * and removals.\n *\n * IMPORTANT: If providing a `keyFn`, keys *must* be unique for all items in a\n * given call to `repeat`. The behavior when two or more items have the same key\n * is undefined.\n *\n * If no `keyFn` is provided, this directive will perform similar to mapping\n * items to values, and DOM will be reused against potentially different items.\n */\nexport const repeat = directive((items, keyFnOrTemplate, template) => {\n let keyFn;\n if (template === undefined) {\n template = keyFnOrTemplate;\n }\n else if (keyFnOrTemplate !== undefined) {\n keyFn = keyFnOrTemplate;\n }\n return (containerPart) => {\n if (!(containerPart instanceof NodePart)) {\n throw new Error('repeat can only be used in text bindings');\n }\n // Old part & key lists are retrieved from the last update\n // (associated with the part for this instance of the directive)\n const oldParts = partListCache.get(containerPart) || [];\n const oldKeys = keyListCache.get(containerPart) || [];\n // New part list will be built up as we go (either reused from\n // old parts or created for new keys in this update). This is\n // saved in the above cache at the end of the update.\n const newParts = [];\n // New value list is eagerly generated from items along with a\n // parallel array indicating its key.\n const newValues = [];\n const newKeys = [];\n let index = 0;\n for (const item of items) {\n newKeys[index] = keyFn ? keyFn(item, index) : index;\n newValues[index] = template(item, index);\n index++;\n }\n // Maps from key to index for current and previous update; these\n // are generated lazily only when needed as a performance\n // optimization, since they are only required for multiple\n // non-contiguous changes in the list, which are less common.\n let newKeyToIndexMap;\n let oldKeyToIndexMap;\n // Head and tail pointers to old parts and new values\n let oldHead = 0;\n let oldTail = oldParts.length - 1;\n let newHead = 0;\n let newTail = newValues.length - 1;\n // Overview of O(n) reconciliation algorithm (general approach\n // based on ideas found in ivi, vue, snabbdom, etc.):\n //\n // * We start with the list of old parts and new values (and\n // arrays of their respective keys), head/tail pointers into\n // each, and we build up the new list of parts by updating\n // (and when needed, moving) old parts or creating new ones.\n // The initial scenario might look like this (for brevity of\n // the diagrams, the numbers in the array reflect keys\n // associated with the old parts or new values, although keys\n // and parts/values are actually stored in parallel arrays\n // indexed using the same head/tail pointers):\n //\n // oldHead v v oldTail\n // oldKeys: [0, 1, 2, 3, 4, 5, 6]\n // newParts: [ , , , , , , ]\n // newKeys: [0, 2, 1, 4, 3, 7, 6] <- reflects the user's new\n // item order\n // newHead ^ ^ newTail\n //\n // * Iterate old & new lists from both sides, updating,\n // swapping, or removing parts at the head/tail locations\n // until neither head nor tail can move.\n //\n // * Example below: keys at head pointers match, so update old\n // part 0 in-place (no need to move it) and record part 0 in\n // the `newParts` list. The last thing we do is advance the\n // `oldHead` and `newHead` pointers (will be reflected in the\n // next diagram).\n //\n // oldHead v v oldTail\n // oldKeys: [0, 1, 2, 3, 4, 5, 6]\n // newParts: [0, , , , , , ] <- heads matched: update 0\n // newKeys: [0, 2, 1, 4, 3, 7, 6] and advance both oldHead\n // & newHead\n // newHead ^ ^ newTail\n //\n // * Example below: head pointers don't match, but tail\n // pointers do, so update part 6 in place (no need to move\n // it), and record part 6 in the `newParts` list. Last,\n // advance the `oldTail` and `oldHead` pointers.\n //\n // oldHead v v oldTail\n // oldKeys: [0, 1, 2, 3, 4, 5, 6]\n // newParts: [0, , , , , , 6] <- tails matched: update 6\n // newKeys: [0, 2, 1, 4, 3, 7, 6] and advance both oldTail\n // & newTail\n // newHead ^ ^ newTail\n //\n // * If neither head nor tail match; next check if one of the\n // old head/tail items was removed. We first need to generate\n // the reverse map of new keys to index (`newKeyToIndexMap`),\n // which is done once lazily as a performance optimization,\n // since we only hit this case if multiple non-contiguous\n // changes were made. Note that for contiguous removal\n // anywhere in the list, the head and tails would advance\n // from either end and pass each other before we get to this\n // case and removals would be handled in the final while loop\n // without needing to generate the map.\n //\n // * Example below: The key at `oldTail` was removed (no longer\n // in the `newKeyToIndexMap`), so remove that part from the\n // DOM and advance just the `oldTail` pointer.\n //\n // oldHead v v oldTail\n // oldKeys: [0, 1, 2, 3, 4, 5, 6]\n // newParts: [0, , , , , , 6] <- 5 not in new map: remove\n // newKeys: [0, 2, 1, 4, 3, 7, 6] 5 and advance oldTail\n // newHead ^ ^ newTail\n //\n // * Once head and tail cannot move, any mismatches are due to\n // either new or moved items; if a new key is in the previous\n // \"old key to old index\" map, move the old part to the new\n // location, otherwise create and insert a new part. Note\n // that when moving an old part we null its position in the\n // oldParts array if it lies between the head and tail so we\n // know to skip it when the pointers get there.\n //\n // * Example below: neither head nor tail match, and neither\n // were removed; so find the `newHead` key in the\n // `oldKeyToIndexMap`, and move that old part's DOM into the\n // next head position (before `oldParts[oldHead]`). Last,\n // null the part in the `oldPart` array since it was\n // somewhere in the remaining oldParts still to be scanned\n // (between the head and tail pointers) so that we know to\n // skip that old part on future iterations.\n //\n // oldHead v v oldTail\n // oldKeys: [0, 1, -, 3, 4, 5, 6]\n // newParts: [0, 2, , , , , 6] <- stuck: update & move 2\n // newKeys: [0, 2, 1, 4, 3, 7, 6] into place and advance\n // newHead\n // newHead ^ ^ newTail\n //\n // * Note that for moves/insertions like the one above, a part\n // inserted at the head pointer is inserted before the\n // current `oldParts[oldHead]`, and a part inserted at the\n // tail pointer is inserted before `newParts[newTail+1]`. The\n // seeming asymmetry lies in the fact that new parts are\n // moved into place outside in, so to the right of the head\n // pointer are old parts, and to the right of the tail\n // pointer are new parts.\n //\n // * We always restart back from the top of the algorithm,\n // allowing matching and simple updates in place to\n // continue...\n //\n // * Example below: the head pointers once again match, so\n // simply update part 1 and record it in the `newParts`\n // array. Last, advance both head pointers.\n //\n // oldHead v v oldTail\n // oldKeys: [0, 1, -, 3, 4, 5, 6]\n // newParts: [0, 2, 1, , , , 6] <- heads matched: update 1\n // newKeys: [0, 2, 1, 4, 3, 7, 6] and advance both oldHead\n // & newHead\n // newHead ^ ^ newTail\n //\n // * As mentioned above, items that were moved as a result of\n // being stuck (the final else clause in the code below) are\n // marked with null, so we always advance old pointers over\n // these so we're comparing the next actual old value on\n // either end.\n //\n // * Example below: `oldHead` is null (already placed in\n // newParts), so advance `oldHead`.\n //\n // oldHead v v oldTail\n // oldKeys: [0, 1, -, 3, 4, 5, 6] <- old head already used:\n // newParts: [0, 2, 1, , , , 6] advance oldHead\n // newKeys: [0, 2, 1, 4, 3, 7, 6]\n // newHead ^ ^ newTail\n //\n // * Note it's not critical to mark old parts as null when they\n // are moved from head to tail or tail to head, since they\n // will be outside the pointer range and never visited again.\n //\n // * Example below: Here the old tail key matches the new head\n // key, so the part at the `oldTail` position and move its\n // DOM to the new head position (before `oldParts[oldHead]`).\n // Last, advance `oldTail` and `newHead` pointers.\n //\n // oldHead v v oldTail\n // oldKeys: [0, 1, -, 3, 4, 5, 6]\n // newParts: [0, 2, 1, 4, , , 6] <- old tail matches new\n // newKeys: [0, 2, 1, 4, 3, 7, 6] head: update & move 4,\n // advance oldTail & newHead\n // newHead ^ ^ newTail\n //\n // * Example below: Old and new head keys match, so update the\n // old head part in place, and advance the `oldHead` and\n // `newHead` pointers.\n //\n // oldHead v oldTail\n // oldKeys: [0, 1, -, 3, 4, 5, 6]\n // newParts: [0, 2, 1, 4, 3, ,6] <- heads match: update 3\n // newKeys: [0, 2, 1, 4, 3, 7, 6] and advance oldHead &\n // newHead\n // newHead ^ ^ newTail\n //\n // * Once the new or old pointers move past each other then all\n // we have left is additions (if old list exhausted) or\n // removals (if new list exhausted). Those are handled in the\n // final while loops at the end.\n //\n // * Example below: `oldHead` exceeded `oldTail`, so we're done\n // with the main loop. Create the remaining part and insert\n // it at the new head position, and the update is complete.\n //\n // (oldHead > oldTail)\n // oldKeys: [0, 1, -, 3, 4, 5, 6]\n // newParts: [0, 2, 1, 4, 3, 7 ,6] <- create and insert 7\n // newKeys: [0, 2, 1, 4, 3, 7, 6]\n // newHead ^ newTail\n //\n // * Note that the order of the if/else clauses is not\n // important to the algorithm, as long as the null checks\n // come first (to ensure we're always working on valid old\n // parts) and that the final else clause comes last (since\n // that's where the expensive moves occur). The order of\n // remaining clauses is is just a simple guess at which cases\n // will be most common.\n //\n // * TODO(kschaaf) Note, we could calculate the longest\n // increasing subsequence (LIS) of old items in new position,\n // and only move those not in the LIS set. However that costs\n // O(nlogn) time and adds a bit more code, and only helps\n // make rare types of mutations require fewer moves. The\n // above handles removes, adds, reversal, swaps, and single\n // moves of contiguous items in linear time, in the minimum\n // number of moves. As the number of multiple moves where LIS\n // might help approaches a random shuffle, the LIS\n // optimization becomes less helpful, so it seems not worth\n // the code at this point. Could reconsider if a compelling\n // case arises.\n while (oldHead <= oldTail && newHead <= newTail) {\n if (oldParts[oldHead] === null) {\n // `null` means old part at head has already been used\n // below; skip\n oldHead++;\n }\n else if (oldParts[oldTail] === null) {\n // `null` means old part at tail has already been used\n // below; skip\n oldTail--;\n }\n else if (oldKeys[oldHead] === newKeys[newHead]) {\n // Old head matches new head; update in place\n newParts[newHead] =\n updatePart(oldParts[oldHead], newValues[newHead]);\n oldHead++;\n newHead++;\n }\n else if (oldKeys[oldTail] === newKeys[newTail]) {\n // Old tail matches new tail; update in place\n newParts[newTail] =\n updatePart(oldParts[oldTail], newValues[newTail]);\n oldTail--;\n newTail--;\n }\n else if (oldKeys[oldHead] === newKeys[newTail]) {\n // Old head matches new tail; update and move to new tail\n newParts[newTail] =\n updatePart(oldParts[oldHead], newValues[newTail]);\n insertPartBefore(containerPart, oldParts[oldHead], newParts[newTail + 1]);\n oldHead++;\n newTail--;\n }\n else if (oldKeys[oldTail] === newKeys[newHead]) {\n // Old tail matches new head; update and move to new head\n newParts[newHead] =\n updatePart(oldParts[oldTail], newValues[newHead]);\n insertPartBefore(containerPart, oldParts[oldTail], oldParts[oldHead]);\n oldTail--;\n newHead++;\n }\n else {\n if (newKeyToIndexMap === undefined) {\n // Lazily generate key-to-index maps, used for removals &\n // moves below\n newKeyToIndexMap = generateMap(newKeys, newHead, newTail);\n oldKeyToIndexMap = generateMap(oldKeys, oldHead, oldTail);\n }\n if (!newKeyToIndexMap.has(oldKeys[oldHead])) {\n // Old head is no longer in new list; remove\n removePart(oldParts[oldHead]);\n oldHead++;\n }\n else if (!newKeyToIndexMap.has(oldKeys[oldTail])) {\n // Old tail is no longer in new list; remove\n removePart(oldParts[oldTail]);\n oldTail--;\n }\n else {\n // Any mismatches at this point are due to additions or\n // moves; see if we have an old part we can reuse and move\n // into place\n const oldIndex = oldKeyToIndexMap.get(newKeys[newHead]);\n const oldPart = oldIndex !== undefined ? oldParts[oldIndex] : null;\n if (oldPart === null) {\n // No old part for this value; create a new one and\n // insert it\n const newPart = createAndInsertPart(containerPart, oldParts[oldHead]);\n updatePart(newPart, newValues[newHead]);\n newParts[newHead] = newPart;\n }\n else {\n // Reuse old part\n newParts[newHead] =\n updatePart(oldPart, newValues[newHead]);\n insertPartBefore(containerPart, oldPart, oldParts[oldHead]);\n // This marks the old part as having been used, so that\n // it will be skipped in the first two checks above\n oldParts[oldIndex] = null;\n }\n newHead++;\n }\n }\n }\n // Add parts for any remaining new values\n while (newHead <= newTail) {\n // For all remaining additions, we insert before last new\n // tail, since old pointers are no longer valid\n const newPart = createAndInsertPart(containerPart, newParts[newTail + 1]);\n updatePart(newPart, newValues[newHead]);\n newParts[newHead++] = newPart;\n }\n // Remove any remaining unused old parts\n while (oldHead <= oldTail) {\n const oldPart = oldParts[oldHead++];\n if (oldPart !== null) {\n removePart(oldPart);\n }\n }\n // Save order of new parts for next round\n partListCache.set(containerPart, newParts);\n keyListCache.set(containerPart, newKeys);\n };\n});\n//# sourceMappingURL=repeat.js.map","/**\n * @license\n * Copyright (c) 2018 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\nimport { directive } from '../lit-html.js';\nconst previousValues = new WeakMap();\n/**\n * Prevents re-render of a template function until a single value or an array of\n * values changes.\n *\n * Example:\n *\n * ```js\n * html`\n * <div>\n * ${guard([user.id, company.id], () => html`...`)}\n * </div>\n * ```\n *\n * In this case, the template only renders if either `user.id` or `company.id`\n * changes.\n *\n * guard() is useful with immutable data patterns, by preventing expensive work\n * until data updates.\n *\n * Example:\n *\n * ```js\n * html`\n * <div>\n * ${guard([immutableItems], () => immutableItems.map(i => html`${i}`))}\n * </div>\n * ```\n *\n * In this case, items are mapped over only when the array reference changes.\n *\n * @param value the value to check before re-rendering\n * @param f the template function\n */\nexport const guard = directive((value, f) => (part) => {\n const previousValue = previousValues.get(part);\n if (Array.isArray(value)) {\n // Dirty-check arrays by item\n if (Array.isArray(previousValue) &&\n previousValue.length === value.length &&\n value.every((v, i) => v === previousValue[i])) {\n return;\n }\n }\n else if (previousValue === value &&\n (value !== undefined || previousValues.has(part))) {\n // Dirty-check non-arrays by identity\n return;\n }\n part.setValue(f());\n // Copy the value if it's an array so that if it's mutated we don't forget\n // what the previous values were.\n previousValues.set(part, Array.isArray(value) ? Array.from(value) : value);\n});\n//# sourceMappingURL=guard.js.map","/**\n * @license\n * Copyright (c) 2018 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\nimport { AttributePart, directive } from '../lit-html.js';\nconst previousValues = new WeakMap();\n/**\n * For AttributeParts, sets the attribute if the value is defined and removes\n * the attribute if the value is undefined.\n *\n * For other part types, this directive is a no-op.\n */\nexport const ifDefined = directive((value) => (part) => {\n const previousValue = previousValues.get(part);\n if (value === undefined && part instanceof AttributePart) {\n // If the value is undefined, remove the attribute, but only if the value\n // was previously defined.\n if (previousValue !== undefined || !previousValues.has(part)) {\n const name = part.committer.name;\n part.committer.element.removeAttribute(name);\n }\n }\n else if (value !== previousValue) {\n part.setValue(value);\n }\n previousValues.set(part, value);\n});\n//# sourceMappingURL=if-defined.js.map","import type { GemReflectElement } from '../elements/reflect';\n\nimport { html, render, TemplateResult } from 'lit-html';\nimport { connect, disconnect, Store } from './store';\nimport {\n LinkedList,\n addMicrotask,\n Sheet,\n SheetToken,\n isArrayChange,\n GemError,\n kebabToCamelCase,\n PropProxyMap,\n removeItems,\n useNativeCSSStyleSheet,\n} from './utils';\n\nexport { html, svg, render, directive, TemplateResult, SVGTemplateResult } from 'lit-html';\nexport { repeat } from 'lit-html/directives/repeat';\n\n// https://github.com/Polymer/lit-html/issues/1048\nexport { guard } from 'lit-html/directives/guard';\n\nexport { ifDefined } from 'lit-html/directives/if-defined';\n\ntype CustomStateSet = Set<string>;\n\ndeclare global {\n interface ElementInternals extends ARIAMixin {\n states: CustomStateSet;\n // https://w3c.github.io/aria/#role_definitions\n role?: string;\n }\n // 用于 css 选择器选择元素,使用 @refobject 自动选择获取\n // 必须使用 attr 赋值\n /**\n * @attr ref\n * @attr inert\n */\n interface HTMLElement {\n attachInternals: () => ElementInternals;\n inert: boolean;\n }\n}\n\nfunction emptyFunction() {\n // 用于占位的空函数\n}\n\nfunction execCallback(fun: any) {\n typeof fun === 'function' && fun();\n}\n\n// global render task pool\nconst asyncRenderTaskList = new LinkedList<() => void>();\nconst tick = (timeStamp = performance.now()) => {\n if (performance.now() > timeStamp + 16) return requestAnimationFrame(tick);\n const task = asyncRenderTaskList.get();\n if (task) {\n task();\n tick(timeStamp);\n }\n};\nasyncRenderTaskList.addEventListener('start', () => addMicrotask(tick));\n\ntype GetDepFun<T> = () => T;\ntype EffectCallback<T> = (depValues: T, oldDepValues?: T) => any;\ntype EffectItem<T> = {\n callback: EffectCallback<T>;\n initialized: boolean;\n values?: T;\n getDep?: GetDepFun<T>;\n preCallback?: () => void;\n};\n\nconst initSymbol = Symbol('init');\nconst updateSymbol = Symbol('update');\n\nexport interface GemElementOptions {\n isLight?: boolean;\n isAsync?: boolean;\n delegatesFocus?: boolean;\n}\n\nexport abstract class GemElement<T = Record<string, unknown>> extends HTMLElement {\n // 这里只是字段申明,不能赋值,否则子类会继承被共享该字段\n static observedAttributes?: string[]; // WebAPI 中是实时检查这个列表\n static booleanAttributes?: Set<string>;\n static numberAttributes?: Set<string>;\n static observedPropertys?: string[];\n static observedStores?: Store<unknown>[];\n static adoptedStyleSheets?: Sheet<unknown>[];\n static defineEvents?: string[];\n static defineCSSStates?: string[];\n static defineRefs?: string[];\n // 以下静态字段仅供外部读取,没有实际作用\n static defineParts?: string[];\n static defineSlots?: string[];\n // 指定 root 元素类型\n static rootElement?: string;\n\n // 定义当前元素的状态,和 attr/prop 的本质区别是不为外部输入\n readonly state?: T;\n\n #renderRoot: HTMLElement | ShadowRoot;\n #internals?: ElementInternals;\n #isAppendReason?: boolean;\n #isAsync?: boolean;\n #effectList?: EffectItem<any>[];\n #momeList?: EffectItem<any>[];\n #unmountCallback?: any;\n\n constructor({ isAsync, isLight, delegatesFocus }: GemElementOptions = {}) {\n super();\n\n // 外部不可见,但允许类外面使用\n addMicrotask(() => ((this as any)[initSymbol] = false));\n (this as any)[initSymbol] = true;\n (this as any)[updateSymbol] = () => {\n if (this.isConnected) {\n addMicrotask(this.#update);\n }\n };\n\n this.#isAsync = isAsync;\n this.#renderRoot = isLight ? this : this.attachShadow({ mode: 'open', delegatesFocus });\n\n const { adoptedStyleSheets } = new.target;\n if (adoptedStyleSheets) {\n const sheets = adoptedStyleSheets.map((item) => item[SheetToken] || item);\n if (this.shadowRoot) {\n this.shadowRoot.adoptedStyleSheets = sheets;\n } else {\n this.effect(\n () => {\n const root = this.getRootNode() as ShadowRoot | Document;\n if (!useNativeCSSStyleSheet) {\n const ele: any = root === document ? document.body : root;\n ele._sheets = ele._sheets || {};\n sheets.forEach(({ style, media }: any) => {\n if (ele._sheets[style]) {\n ele._sheets[style].count++;\n } else {\n const s = document.createElement('style');\n s.innerHTML = style;\n s.media = media.mediaText;\n ele.append(s);\n ele._sheets[style] = { ele: s, count: 1 };\n }\n });\n return () => {\n sheets.forEach(({ style }: any) => {\n ele._sheets[style].count--;\n if (!ele._sheets[style].count) {\n delete ele._sheets[style];\n }\n });\n };\n } else {\n root.adoptedStyleSheets = [...root.adoptedStyleSheets, ...sheets];\n return () => {\n root.adoptedStyleSheets = removeItems(root.adoptedStyleSheets, sheets);\n };\n }\n },\n () => [],\n );\n }\n }\n }\n\n get internals() {\n if (!this.#internals) {\n const getCustomStateSet = () => {\n // https://wicg.github.io/custom-state-pseudo-class/\n const getV = (v: string) => v.replace(/-/g, '');\n return {\n has: (v) => getV(v) in this.dataset,\n add: (v) => {\n this.dataset[getV(v)] = '';\n },\n delete: (v) => delete this.dataset[getV(v)],\n } as CustomStateSet;\n };\n if (!this.attachInternals) {\n // https://bugs.webkit.org/show_bug.cgi?id=197960\n this.attachInternals = () => {\n return { states: getCustomStateSet() } as any;\n };\n }\n this.#internals = this.attachInternals();\n if (!this.#internals.states) {\n // https://bugzilla.mozilla.org/show_bug.cgi?id=1588763\n this.#internals.states = getCustomStateSet();\n }\n }\n return this.#internals;\n }\n\n /**\n * @helper\n * 设置元素 state,会触发更新\n *\n * ```js\n * class App extends GemElement {\n * click() {\n * this.setState({});\n * }\n * }\n * ```\n * */\n setState = (payload: Partial<T>) => {\n if (!this.state) throw new GemError('`state` not initialized');\n Object.assign(this.state, payload);\n addMicrotask(this.#update);\n };\n\n #exec = (list?: EffectItem<any>[]) => {\n list?.forEach((effectItem) => {\n const { callback, getDep, values, preCallback } = effectItem;\n const newValues = getDep?.();\n if (!getDep || !values || isArrayChange(values, newValues)) {\n execCallback(preCallback);\n effectItem.preCallback = callback(newValues, values);\n effectItem.values = newValues;\n }\n });\n };\n\n /**\n * 每次更新完检查依赖,执行对应的副作用回调\n * */\n #execEffect = () => {\n this.#exec(this.#effectList);\n };\n\n #execMemo = () => {\n this.#exec(this.#momeList);\n };\n\n /**\n * @helper\n * 记录副作用回调和值,在 `constructor`/`mounted` 中使用\n * 回调到返回值如果是函数将再卸载时执行\n *\n * ```js\n * class App extends GemElement {\n * mounted() {\n * this.effect(callback, () => [this.attrName]);\n * }\n * }\n * ```\n * */\n effect = <T = any[] | undefined>(\n callback: EffectCallback<T>,\n getDep?: T extends any[] ? () => [...T] : undefined,\n ) => {\n if (!this.#effectList) this.#effectList = [];\n const effectItem: EffectItem<T> = {\n callback,\n getDep,\n values: undefined,\n initialized: !!this.isConnected,\n };\n // 以挂载时立即执行副作用,未挂载时等挂载后执行\n if (this.isConnected) {\n effectItem.values = getDep?.() as T;\n effectItem.preCallback = callback(effectItem.values);\n }\n this.#effectList.push(effectItem);\n };\n\n /**\n * @helper\n * 在 `render` 前执行回调,和 `effect` 一样接受依赖数组参数,在 `constructor`/`willMount` 中使用\n *\n * ```js\n * class App extends GemElement {\n * willMount() {\n * this.memo(() => {\n * this.a = exec(this.attrName);\n * }), () => [this.attrName]);\n * }\n * }\n * ```\n * */\n memo = <T = any[] | undefined>(callback: EffectCallback<T>, getDep?: T extends any[] ? () => [...T] : undefined) => {\n if (!this.#momeList) this.#momeList = [];\n this.#momeList.push({\n callback,\n getDep,\n values: [Symbol()],\n // 是否是 `willMount` 中定义\n initialized: this.isConnected,\n });\n };\n\n /**\n * 元素挂载后执行还未初始化的副作用\n * */\n #initEffect = () => {\n this.#effectList?.forEach((effectItem) => {\n const { callback, getDep, initialized } = effectItem;\n if (!initialized) {\n effectItem.values = getDep?.();\n effectItem.preCallback = callback(effectItem.values);\n effectItem.initialized = true;\n }\n });\n };\n\n /**@lifecycle */\n willMount?(): void | Promise<void>;\n\n /**\n * @lifecycle\n * 返回 null 时渲染 lit-html 定义的空内容\n * 返回 undefined 时不会调用 `render()`\n * */\n render?(): TemplateResult | null | undefined;\n\n #render = () => {\n this.#execMemo();\n const styles = useNativeCSSStyleSheet\n ? ''\n : html`${this.shadowRoot?.adoptedStyleSheets?.map(\n (e: any) =>\n html`\n <style media=${e.media.mediaText}>\n ${e.style}\n </style>\n `,\n )}`;\n if (this.render) return html`${this.render()}${styles}`;\n return this.#renderRoot === this ? undefined : html`<slot></slot>${styles}`;\n };\n\n /**@lifecycle */\n mounted?(): void | (() => void) | Promise<void>;\n\n /**@lifecycle */\n shouldUpdate?(): boolean;\n #shouldUpdate = () => {\n return this.shouldUpdate ? this.shouldUpdate() : true;\n };\n\n #updateCallback = () => {\n if (this.isConnected && this.#shouldUpdate()) {\n const temp = this.#render();\n temp !== undefined && render(temp, this.#renderRoot);\n addMicrotask(this.#updated);\n addMicrotask(this.#execEffect);\n }\n };\n\n #update = () => {\n if (this.#isAsync) {\n asyncRenderTaskList.add(this.#updateCallback);\n } else {\n this.#updateCallback();\n }\n };\n\n /**\n * @helper\n * async\n */\n update = () => {\n addMicrotask(this.#update);\n };\n\n /**@lifecycle */\n updated?(): void | Promise<void>;\n #updated = () => {\n this.updated?.();\n };\n\n /**\n * @lifecycle\n *\n * 卸载元素,但不一定会被垃圾回收,所以事件监听器需要手动清除,以免重复注册\n */\n unmounted?(): void | Promise<void>;\n\n /**\n * @private\n * @final\n * use `effect`\n */\n attributeChangedCallback() {\n if (this.isConnected) {\n addMicrotask(this.#update);\n }\n }\n\n #connectedCallback = () => {\n if (this.#isAppendReason) {\n this.#isAppendReason = false;\n return;\n }\n this.willMount?.();\n const { observedStores, rootElement } = this.constructor as typeof GemElement;\n observedStores?.forEach((store) => {\n connect(store, this.#update);\n });\n const temp = this.#render();\n temp !== undefined && render(temp, this.#renderRoot);\n this.#unmountCallback = this.mounted?.();\n this.#initEffect();\n if (rootElement && (this.getRootNode() as ShadowRoot).host?.tagName !== rootElement.toUpperCase()) {\n throw new GemError(`not allow current root type`);\n }\n };\n\n closestElement<K extends keyof HTMLElementTagNameMap>(tag: K): HTMLElementTagNameMap[K] | null;\n closestElement<K extends abstract new (...args: any) => any>(constructor: K): InstanceType<K> | null;\n closestElement<K extends abstract new (...args: any) => any>(constructorOrTag: K | string): Element | null {\n const isConstructor = typeof constructorOrTag === 'function';\n const tagName = typeof constructorOrTag === 'string' && constructorOrTag.toUpperCase();\n const getRootElement = (ele: Element): Element | null => {\n const rootEle = ele.parentElement || (ele.getRootNode() as ShadowRoot).host;\n if (!rootEle) return null;\n if (isConstructor) {\n if (rootEle.constructor === constructorOrTag) {\n return rootEle;\n }\n } else if (rootEle.tagName === tagName) {\n return rootEle;\n }\n return getRootElement(rootEle);\n };\n return getRootElement(this);\n }\n\n /**\n * @private\n * @final\n * use `mounted`\n */\n connectedCallback() {\n if (this.#isAsync) {\n asyncRenderTaskList.add(this.#connectedCallback);\n } else {\n this.#connectedCallback();\n }\n }\n\n /**\n * @private\n * @final\n */\n // adoptedCallback() {}\n\n /**\n * @private\n * @final\n * use `unmounted`\n */\n disconnectedCallback() {\n if (this.isConnected) {\n this.#isAppendReason = true;\n return;\n }\n const { observedStores } = this.constructor as typeof GemElement;\n observedStores?.forEach((store) => {\n disconnect(store, this.#update);\n });\n execCallback(this.#unmountCallback);\n this.unmounted?.();\n this.#effectList?.forEach((effectItem) => {\n execCallback(effectItem.preCallback);\n });\n this.#momeList = this.#momeList?.filter(({ initialized }) => !initialized);\n }\n}\n\nconst gemElementProxyMap = new PropProxyMap<GemElement>();\n\nexport function defineAttribute(target: GemElement, prop: string, attr: string) {\n const { booleanAttributes, numberAttributes } = target.constructor as typeof GemElement;\n Object.defineProperty(target, prop, {\n configurable: true,\n get() {\n // fix karma test\n // 判断是否是自定义元素实例\n if (!(initSymbol in this)) return;\n const that = this as GemElement;\n // 不能从 proxy 对象中读取值\n const value = that.getAttribute(attr);\n if (booleanAttributes?.has(attr)) {\n return value === null ? false : true;\n }\n if (numberAttributes?.has(attr)) {\n return Number(value);\n }\n return value || '';\n },\n set(v: string | null | undefined | number | boolean) {\n const that = this as GemElement;\n const proxy = gemElementProxyMap.get(this) as any;\n const hasSet = proxy[prop];\n const value = that.getAttribute(attr);\n // https://github.com/whatwg/dom/issues/922\n if (this[initSymbol] && value !== null && !hasSet) return;\n // 字段和构造函数中都有对 attr 设置时会执行多次\n // Firefox WebConsole 中不知道为什么在构造函数中 this[initSymbol] 已经为 false\n proxy[prop] = true;\n const isBool = booleanAttributes?.has(attr);\n if (v === null || v === undefined) {\n that.removeAttribute(attr);\n } else if (isBool) {\n // 当 attr 存在且 !!v 为 true 时,toggleAttribute 不会造成 Attribute 改变\n that.toggleAttribute(attr, !!v);\n } else {\n if (value !== String(v)) that.setAttribute(attr, String(v));\n }\n },\n });\n}\n\nconst isEventHandleSymbol = Symbol('event handle');\nexport function defineProperty(\n target: GemElement,\n prop: string,\n event?: string,\n eventOptions?: Omit<CustomEventInit<unknown>, 'detail'>,\n) {\n Object.defineProperty(target, prop, {\n configurable: true,\n get() {\n const value = gemElementProxyMap.get(this)[prop];\n if (value || !event) {\n return value;\n } else {\n this[prop] = emptyFunction;\n return this[prop];\n }\n },\n set(v) {\n const that = this as GemElement;\n const proxy = gemElementProxyMap.get(that) as any;\n if (v !== proxy[prop]) {\n if (event) {\n proxy[prop] = v?.[isEventHandleSymbol]\n ? v\n : (detail: any, options: any) => {\n const evt = new CustomEvent(event, { ...options, ...eventOptions, detail });\n that.dispatchEvent(evt);\n v(detail, options);\n };\n proxy[prop][isEventHandleSymbol] = true;\n // emitter 不触发元素更新\n } else {\n proxy[prop] = v;\n this[updateSymbol]();\n }\n }\n },\n });\n}\n\nexport function defineRef(target: GemElement, prop: string, ref: string) {\n Object.defineProperty(target, prop, {\n configurable: true,\n get() {\n const proxy = gemElementProxyMap.get(this);\n let refobject = proxy[prop];\n if (!refobject) {\n const that = this as GemElement;\n const ele = that.shadowRoot || that;\n refobject = {\n get ref() {\n return ref;\n },\n get element() {\n const gemReflects = ([...ele.querySelectorAll('gem-reflect')] as GemReflectElement[]).map((e) => e.target);\n for (const e of [ele, ...gemReflects]) {\n const result = e.querySelector(`[ref=${ref}]`);\n if (result) return result;\n }\n },\n };\n proxy[prop] = refobject;\n }\n return refobject;\n },\n });\n}\n\nexport function defineCSSState(target: GemElement, prop: string, state: string) {\n Object.defineProperty(target, prop, {\n configurable: true,\n get() {\n const that = this as GemElement;\n const { states } = that.internals;\n return states.has?.(state);\n },\n set(v: boolean) {\n const that = this as GemElement;\n const { states } = that.internals;\n if (v) {\n states.add(state);\n } else {\n states.delete(state);\n }\n },\n });\n}\n\nexport const nativeDefineElement = customElements.define.bind(customElements);\ncustomElements.define = (name: string, cls: CustomElementConstructor, options?: ElementDefinitionOptions) => {\n if (cls.prototype instanceof GemElement) {\n const { observedAttributes, observedPropertys, defineEvents, defineCSSStates, defineRefs } =\n cls as unknown as typeof GemElement;\n observedAttributes?.forEach((attr) => defineAttribute(cls.prototype, kebabToCamelCase(attr), attr));\n observedPropertys?.forEach((prop) => defineProperty(cls.prototype, prop));\n defineEvents?.forEach((event) => defineProperty(cls.prototype, kebabToCamelCase(event), event));\n defineCSSStates?.forEach((state) => defineCSSState(cls.prototype, kebabToCamelCase(state), `--${state}`));\n defineRefs?.forEach((ref) => defineRef(cls.prototype, kebabToCamelCase(ref), ref));\n }\n\n nativeDefineElement(name, cls as CustomElementConstructor, options);\n};\n","import { defineAttribute, defineCSSState, defineProperty, defineRef, GemElement, nativeDefineElement } from './element';\nimport { Store } from './store';\nimport { Sheet, camelToKebabCase, randomStr } from './utils';\n\ntype GemElementPrototype = GemElement<any>;\ntype GemElementConstructor = typeof GemElement;\ntype StaticField = Exclude<keyof GemElementConstructor, 'prototype' | 'rootElement'>;\ntype StaticFieldMember = string | Store<unknown> | Sheet<unknown>;\n\nfunction pushStaticField(target: GemElementPrototype, field: StaticField, member: StaticFieldMember, isSet = false) {\n const cls = target.constructor as GemElementConstructor;\n const current = cls[field];\n if (!cls.hasOwnProperty(field)) {\n Object.defineProperty(cls, field, {\n value: isSet ? new Set<unknown>(current) : current ? Array.from<any>(current) : [],\n });\n }\n\n (cls[field] as any)[isSet ? 'add' : 'push'](member);\n}\n\nexport type RefObject<T = HTMLElement> = { ref: string; element: T | undefined };\n\n/**\n * 引用元素,只有第一个标记 ref 的元素有效\n *\n * For example\n * ```ts\n * class App extends GemElement {\n * @refobject childRef: RefObject<Children>;\n * loadHandle = () => {\n * const { element } = this.childRef;\n * console.log(element);\n * };\n * render() {\n * render html`<div ref=${this.childRef.ref}><div>`;\n * }\n * }\n * ```\n */\nexport function refobject(target: GemElementPrototype, prop: string) {\n const ref = `${camelToKebabCase(prop)}-${randomStr()}`;\n pushStaticField(target, 'defineRefs', ref);\n defineRef(target, prop, ref);\n}\n\n/**\n * 定义一个响应式的 attribute,驼峰字段名将自动映射到烤串 attribute,默认值为空字符串\n *\n * For example\n * ```ts\n * class App extends GemElement {\n * @attribute attr: string;\n * }\n * ```\n */\nfunction defineAttr(target: GemElementPrototype, prop: string, attr: string) {\n pushStaticField(target, 'observedAttributes', attr);\n defineAttribute(target, prop, attr);\n}\nexport function attribute(target: GemElementPrototype, prop: string) {\n defineAttr(target, prop, camelToKebabCase(prop));\n}\nexport function boolattribute(target: GemElementPrototype, prop: string) {\n const attr = camelToKebabCase(prop);\n pushStaticField(target, 'booleanAttributes', attr, true);\n defineAttr(target, prop, attr);\n}\nexport function numattribute(target: GemElementPrototype, prop: string) {\n const attr = camelToKebabCase(prop);\n pushStaticField(target, 'numberAttributes', attr, true);\n defineAttr(target, prop, attr);\n}\n\n/**\n * 定义一个响应式的 property,注意值可能为 `undefined`\n *\n * For example\n * ```ts\n * class App extends GemElement {\n * @property prop: Data | undefined;\n * }\n * ```\n */\nexport function property(target: GemElementPrototype, prop: string) {\n pushStaticField(target, 'observedPropertys', prop);\n defineProperty(target, prop);\n}\n\n/**\n * 定义一个元素[内部](https://html.spec.whatwg.org/multipage/custom-elements.html#elementinternals) state,\n * 类似 `:checked`,用于自定义 css 伪类(:--xxx),默认值即为字段名。\n * 重新赋值转换 css 伪类\n * 将来也可能用于 IDE 识别\n *\n * For example\n * ```ts\n * class App extends GemElement {\n * @state state: boolean;\n * }\n * ```\n */\nexport function state(target: GemElementPrototype, prop: string) {\n const attr = camelToKebabCase(prop);\n pushStaticField(target, 'defineCSSStates', attr);\n defineCSSState(target, prop, `--${attr}`);\n}\n\n/**\n * 定义一个内部 slot,默认值即为字段名,不能使用全局属性 `slot`\n *\n * For example\n * ```ts\n * class App extends GemElement {\n * @slot slot: string;\n * @slot static slot: string;\n * }\n * ```\n */\nexport function slot(target: any, prop: string) {\n const attr = camelToKebabCase((target as any)[prop] || prop);\n (target as any)[prop] = attr;\n pushStaticField(target instanceof GemElement ? target : target.prototype, 'defineSlots', attr);\n}\n\n/**\n * 定义一个内部 part,默认值即为字段名,不能使用全局属性 `part`\n *\n * For example\n * ```ts\n * class App extends GemElement {\n * @part part: string;\n * @part static part: string;\n * }\n * ```\n */\nexport function part(target: any, prop: string) {\n const attr = camelToKebabCase((target as any)[prop] || prop);\n (target as any)[prop] = attr;\n pushStaticField(target instanceof GemElement ? target : target.prototype, 'defineParts', attr);\n}\n\nexport type Emitter<T = any> = (detail: T, options?: Omit<CustomEventInit<unknown>, 'detail'>) => void;\n\n/**\n * 定义一个事件发射器,类似 `HTMLElement.click`,\n * 调用时将同步发送一个和字段名称的烤串式格式的自定义事件\n *\n * For example\n * ```ts\n * class App extends GemElement {\n * @emitter load: Function;\n * }\n * ```\n */\nexport function emitter(target: GemElementPrototype, prop: string) {\n defineEmitter(target, prop);\n}\nexport function globalemitter(target: GemElementPrototype, prop: string) {\n defineEmitter(target, prop, { bubbles: true, composed: true });\n}\nfunction defineEmitter(target: GemElementPrototype, prop: string, options?: Omit<CustomEventInit<unknown>, 'detail'>) {\n const event = camelToKebabCase(prop);\n pushStaticField(target, 'defineEvents', event);\n defineProperty(target, prop, event, options);\n}\n\n/**\n * 分配一个构造的样式表,如果元素是 lightDOM,则将样式表挂载到 RootNode 上\n *\n * For example\n * ```ts\n * @adoptedStyle(stylesheet)\n * class App extends GemElement {}\n * ```\n */\nexport function adoptedStyle(style: Sheet<unknown>) {\n return function (cls: unknown) {\n const con = cls as GemElementConstructor;\n pushStaticField(con.prototype, 'adoptedStyleSheets', style);\n };\n}\n\n/**\n * 链接一个 store,当 store 更新时更新元素\n *\n * For example\n * ```ts\n * @connectStore(store)\n * class App extends GemElement {}\n * ```\n */\nexport function connectStore(store: Store<unknown>) {\n // 这里的签名该怎么写?\n return function (cls: unknown) {\n const con = cls as GemElementConstructor;\n pushStaticField(con.prototype, 'observedStores', store);\n };\n}\n\n/**\n * 限制元素的 root 节点类型\n *\n * For example\n * ```ts\n * @rootElement(MyElement)\n * class App extends GemElement {}\n * ```\n */\nexport function rootElement(rootType: string) {\n return function (cls: unknown) {\n const con = cls as GemElementConstructor;\n con.rootElement = rootType;\n };\n}\n\n/**\n * 定义自定义元素\n *\n * For example\n * ```ts\n * @customElement('my-element')\n * class App extends GemElement {}\n * ```\n */\nexport function customElement(name: string) {\n return function (cls: unknown) {\n nativeDefineElement(name, cls as CustomElementConstructor);\n };\n}\n","import { createStore, updateStore, Store, connect } from './store';\nimport { QueryString, cleanObject, GemError, absoluteLocation } from './utils';\n\nexport const history = window.history;\nconst location = window.location;\nconst pushState: typeof history.pushState = history.pushState.bind(history);\nconst replaceState: typeof history.replaceState = history.replaceState.bind(history);\n\nlet key = 0;\nconst getKey = () => `${performance.now()}-${++key}`;\n\n// history.state\nexport interface HistoryItem {\n $hasCloseHandle: boolean;\n $hasOpenHandle: boolean;\n $hasShouldCloseHandle: boolean;\n $key: string;\n [index: string]: any;\n}\n\nconst store = createStore<HistoryItem>({\n $hasCloseHandle: false,\n $hasOpenHandle: false,\n $hasShouldCloseHandle: false,\n $key: '',\n});\n\nexport interface UpdateHistoryParams {\n title?: string;\n path?: string; // 不包括 basePath,只有根目录储存末尾斜杠\n query?: string | QueryString; // 包含 `?`\n hash?: string; // 包含 `#`\n // 以下为看不见的状态\n open?: () => void; // 按下前进键时执行\n close?: () => void; // 按下返回键时执行\n shouldClose?: () => boolean; // 按下返回键时判断是否执行 close 函数,返回为 false 时不执行,并恢复 history\n data?: any;\n}\n\n// 实际应用值\ntype HistoryParams = UpdateHistoryParams & { title: string; path: string; query: QueryString; hash: string };\n\n// TODO: WeakRef\nconst paramsMap = new Map<string, HistoryParams>();\n\ndeclare global {\n interface History {\n store: Store<HistoryItem>;\n // 修改会更改 `history.getParams()` 的值\n basePath?: string;\n // 返回 `history` 当前储存的值, 是一个可变对象,当修改 `basePath` 时会改变\n getParams: () => HistoryParams;\n\n push: (params: UpdateHistoryParams) => void;\n replace: (params: UpdateHistoryParams) => void;\n // push 一条历史记录\n // 有 close 处理函数时先执行 closeHandle 在 replace\n // 比如在 modal 打开时跳转页面\n // 不完美:只支持在 1 级 modal 中切换页面\n pushIgnoreCloseHandle: (params: UpdateHistoryParams) => void;\n updateParams: (params: Omit<UpdateHistoryParams, 'path' | 'query' | 'hash' | 'state'>) => void;\n }\n}\n\ntype UpdateHistoryType = 'push' | 'replace';\n\nfunction validData({ $key, $hasCloseHandle, $hasOpenHandle, $hasShouldCloseHandle }: any = {}) {\n if (store.$key === $key) return;\n if ($key) throw new GemError('`$key` is not allowed');\n if ($hasCloseHandle) throw new GemError('`$hasCloseHandle` is not allowed');\n if ($hasOpenHandle) throw new GemError('`$hasOpenHandle` is not allowed');\n if ($hasShouldCloseHandle) throw new GemError('`$hasShouldCloseHandle` is not allowed');\n}\n\nfunction getUrlbarPath(internalPath: string) {\n return history.basePath ? history.basePath + internalPath : internalPath;\n}\n\nfunction getInternalPath(urlbarPath: string) {\n if (urlbarPath === history.basePath) return '/';\n return urlbarPath.replace(new RegExp(`^${history.basePath}/`), '/');\n}\n\nfunction initParams(params: UpdateHistoryParams): HistoryParams {\n const current = paramsMap.get(store.$key) || ({} as HistoryParams);\n // 没提供 path 使用当前 path\n const path = params.path ? absoluteLocation(current.path, params.path) : getInternalPath(location.pathname);\n // 没提供 query 又没有提供 path 时使用当前 search\n const query = new QueryString(params.query || (params.path ? '' : location.search));\n const pathChanged =\n (params.path && params.path !== current.path) || (params.query && String(params.query) !== String(current.query));\n const title = params.title || '';\n const statusChanged = params.close || params.data || params.open || params.shouldClose;\n // 没提供 hash 又没有改变路径又不是状态更新时使用当前 hash\n const hash = params.hash || (!pathChanged && statusChanged ? decodeURIComponent(location.hash) : '');\n return { ...params, title, path, query, hash };\n}\n\nfunction updateHistory(type: UpdateHistoryType, p: UpdateHistoryParams) {\n validData(p.data);\n const params = initParams(p);\n const { title, path, query, hash, close, open, shouldClose, data } = params;\n const state: HistoryItem = {\n $hasCloseHandle: !!close,\n $hasOpenHandle: !!open,\n $hasShouldCloseHandle: !!shouldClose,\n $key: getKey(),\n ...data,\n };\n paramsMap.set(state.$key, params);\n updateStore(cleanObject(store), state);\n const url = getUrlbarPath(path) + new QueryString(query) + hash;\n const prevHave = decodeURIComponent(location.hash);\n (type === 'push' ? pushState : replaceState)(state, title, url);\n if (prevHave !== hash) window.dispatchEvent(new CustomEvent('hashchange'));\n}\n\n// 跨框架时,调用者对 basePath 无感知\nfunction updateHistoryByNative(type: UpdateHistoryType, data: any, title: string, originUrl: string) {\n validData(data);\n const state = {\n $key: getKey(),\n ...(data || {}),\n };\n const { pathname, search, hash } = new URL(originUrl, location.origin + location.pathname);\n const params = initParams({ path: pathname, query: new QueryString(search), hash, title, data });\n paramsMap.set(state.$key, params);\n updateStore(cleanObject(store), state);\n const url = getUrlbarPath(pathname) + params.query + hash;\n const prevHash = location.hash;\n (type === 'push' ? pushState : replaceState)(state, title, url);\n // `location.hash` 和 `hash` 都已经进行了 url 编码,可以直接进行相等判断\n if (prevHash !== hash) window.dispatchEvent(new CustomEvent('hashchange'));\n}\n\nexport const basePathStore = createStore({\n basePath: '',\n});\n\nwindow.addEventListener('hashchange', ({ isTrusted }) => {\n if (isTrusted) {\n history.replace({ hash: decodeURIComponent(location.hash) });\n }\n});\n// 不允许其他框架重写\n// 保持原有功能\nObject.defineProperties(history, {\n basePath: {\n get() {\n return basePathStore.basePath;\n },\n set(basePath: string) {\n // 应用初始化的时候设置\n updateStore(basePathStore, { basePath });\n // paramsMap 更新后 ui 才会更新\n Object.assign(paramsMap.get(store.$key), { path: getInternalPath(location.pathname) });\n },\n },\n getParams: {\n value: function () {\n return paramsMap.get(store.$key);\n },\n },\n updateParams: {\n value: function (params: UpdateHistoryParams) {\n Object.assign(paramsMap.get(store.$key), params);\n updateStore(store, {});\n },\n },\n store: {\n value: store,\n },\n push: {\n value: function (params: UpdateHistoryParams) {\n history.pushState(params, '');\n },\n },\n pushIgnoreCloseHandle: {\n value: function (params: UpdateHistoryParams) {\n if (store.$hasCloseHandle) {\n paramsMap.get(store.$key)?.close?.();\n history.replace(params);\n } else {\n history.push(params);\n }\n },\n },\n replace: {\n value: function (params: UpdateHistoryParams) {\n updateHistory('replace', params);\n },\n },\n});\n\nhistory.pushState = function (data: any, title: string, path: string) {\n if (path) {\n updateHistoryByNative('push', data, title, path);\n } else {\n updateHistory('push', data);\n }\n};\n\nhistory.replaceState = function (data: any, title: string, path: string) {\n updateHistoryByNative('replace', data, title, path);\n};\n\nif (!history.state) {\n // 初始化 historyItem\n const { pathname, search, hash } = location;\n history.replace({ path: pathname, query: search, hash });\n} else if (history.state.$hasCloseHandle) {\n updateStore(store, history.state);\n const params = initParams({ title: document.title });\n paramsMap.set(store.$key, params);\n // 有 handle 返回键的页面刷新需要清除返回 handler\n history.back();\n} else {\n // 有 gem 历史的正常普通刷新, 储存 params\n const params = initParams({ title: document.title, hash: location.hash });\n updateStore(store, {\n $key: getKey(),\n ...(history.state || {}),\n });\n paramsMap.set(store.$key, params);\n}\n\nexport const titleStore = createStore({ title: '' });\n\nconnect(titleStore, () => {\n const params = paramsMap.get(store.$key);\n if (params) {\n params.title = titleStore.title;\n }\n});\n\nconnect(store, () => {\n const { title } = history.getParams();\n if (title !== titleStore.title) {\n updateStore(titleStore, { title });\n }\n});\n\n/**\n * 表示 popstate handler 中正在进行导航\n */\nlet navigating = false;\nwindow.addEventListener('popstate', (event) => {\n const newState = event.state as HistoryItem | null;\n if (!newState?.$key) {\n // 比如作为其他 app 的宿主 app\n return;\n }\n if (navigating) {\n navigating = false;\n return;\n }\n\n // 处理 forward or back\n // replace 不会触发\n\n // 刷新后再导航需要从当前 state 中构建 params\n // 理论上该条历史记录中不会出现事件处理器\n if (!paramsMap.has(newState.$key)) {\n const { pathname, search, hash } = location;\n paramsMap.set(newState.$key, {\n path: pathname,\n query: new QueryString(search),\n hash,\n title: document.title, // 浏览器缓存的 title\n data: newState,\n });\n }\n\n // url 变化前 historyItem\n const prevState = store;\n\n if (parseFloat(newState.$key) > parseFloat(prevState.$key) && newState.$hasOpenHandle) {\n // 返回键关闭的 modal 能前进键重新打开\n // 刷新后不能工作:刷新后 historyItem 中只有 url\n paramsMap.get(newState.$key)?.open?.();\n } else if (prevState.$hasCloseHandle) {\n const prevParams = paramsMap.get(prevState.$key);\n const closeHandle = prevParams?.close;\n const shouldCloseHandle = prevParams?.shouldClose;\n const notAllowClose = shouldCloseHandle && !shouldCloseHandle();\n if (notAllowClose) {\n navigating = true;\n history.forward(); // 将重新触发 popstate\n return; // 历史记录栈位置没有变化,不需要后面的 updateStore\n } else {\n // handle 返回键\n if (closeHandle) {\n closeHandle();\n } else if (newState.$hasCloseHandle) {\n // 有 modal 的页面刷新会执行 back 触发 popstate\n // 如果是二级 modal 页面刷新\n // 则还需要进行一次 back\n // !!! 不完美:三级 modal 页面刷新不支持返回到初始页面\n navigating = true;\n history.back();\n }\n }\n }\n\n updateStore(cleanObject(store), newState);\n});\n","import { GemElement, html, TemplateResult } from '../lib/element';\nimport { property, customElement, connectStore, emitter, Emitter } from '../lib/decorators';\nimport { createStore, updateStore, Store } from '../lib/store';\nimport { titleStore, history, UpdateHistoryParams } from '../lib/history';\nimport { QueryString } from '../lib/utils';\n\ninterface NamePostition {\n [index: string]: number;\n}\n\n// TODO: use `URLPattern`\nclass ParamsRegExp extends RegExp {\n namePosition: NamePostition;\n constructor(pattern: string) {\n const namePosition: NamePostition = {};\n let i = 0;\n super(\n `^${pattern\n .replace(/:([^/$]+)/g, (_m, name: string) => {\n namePosition[name] = i++;\n return `([^/]+)`;\n })\n .replace('*', '.*')}$`,\n 'i',\n );\n this.namePosition = namePosition;\n }\n}\n\ntype Params = Record<string, string>;\n\n// `/a/b/:c/:d` `/a/b/1/2`\n// 匹配成功时返回 params\nexport function matchPath(pattern: string, path: string) {\n const reg = new ParamsRegExp(pattern);\n const matchResult = path.match(reg) || `${path}/`.match(reg);\n if (!matchResult) return null;\n const params: Params = {};\n if (matchResult) {\n Object.keys(reg.namePosition).forEach((name) => {\n params[name] = matchResult[reg.namePosition[name] + 1];\n });\n }\n return params;\n}\n\nexport interface RouteItem<T = unknown> {\n // 支持 *\n // 支持 /a/*\n // 不支持相对路径\n // 不能匹配查询字符串\n pattern: string;\n redirect?: string;\n content?: TemplateResult;\n getContent?: (params: Params) => TemplateResult | Promise<TemplateResult>;\n title?: string;\n // 用来传递数据\n data?: T;\n}\n\ntype RoutesObject = Record<string, RouteItem>;\n\n// params 中的成员不会验证\nexport interface RouteOptions extends Omit<UpdateHistoryParams, 'path'> {\n params?: Params;\n}\n\n// 从路由创建路径\n// 不包含 basePath\nexport function createPath(route: RouteItem, options?: RouteOptions) {\n let path = route.pattern;\n const params = options?.params;\n if (params) {\n Object.keys(params).forEach((key) => {\n path = path.replace(new RegExp(`:${key}`, 'g'), params[key]);\n });\n }\n return path;\n}\n\nexport function createHistoryParams(route: RouteItem, options?: RouteOptions): UpdateHistoryParams {\n const path = createPath(route, options);\n return {\n path,\n ...options,\n };\n}\n\ninterface ConstructorOptions {\n isLight?: boolean;\n routes?: RouteItem[] | RoutesObject;\n}\n\ntype State = {\n content?: TemplateResult;\n};\n\n/**\n * @customElement gem-route\n * @attr inert 暂停路由更新\n * @fires routechange\n * @fires error\n * @fires loading\n */\n@connectStore(history.store)\n@customElement('gem-route')\nexport class GemRouteElement extends GemElement<State> {\n @property routes?: RouteItem[] | RoutesObject;\n /**\n * @example\n * const locationStore = GemRouteElement.createLocationStore()\n * html`<gem-route .locationStore=${locationStore}>`\n */\n @property locationStore?: Store<{ path: string; params: Params; query: QueryString; data?: any }>;\n @property key: any; // 除了 href 提供另外一种方式来更新,比如语言更新也需要刷新 <gem-route>\n @emitter routechange: Emitter<RouteItem | null>; // path 改变或者 key 改变,包含初始渲染\n @emitter loading: Emitter<RouteItem>;\n @emitter error: Emitter<any>;\n\n currentRoute: RouteItem | null;\n // 当前匹配的路由的 params\n currentParams: Params = {};\n\n #lastLoader?: Promise<TemplateResult>;\n\n static createLocationStore = () => {\n const { path, query, data } = history.getParams();\n return createStore({ path, query, data, params: {} as Record<string, string> });\n };\n\n static findRoute = (target: RouteItem[] | RoutesObject = [], path: string) => {\n let defaultRoute: RouteItem | null = null;\n let routes: RouteItem[];\n if (target instanceof Array) {\n routes = target;\n } else {\n routes = Object.values(target);\n }\n for (const route of routes) {\n if ('*' === route.pattern) {\n defaultRoute = route;\n } else {\n const params = matchPath(route.pattern, path);\n if (params) {\n return { route, params };\n }\n }\n }\n return { route: defaultRoute };\n };\n\n constructor({ isLight, routes }: ConstructorOptions = {}) {\n super({ isLight });\n this.routes = routes;\n }\n\n state: State = {\n content: undefined,\n };\n\n #updateLocationStore = () => {\n if (this.locationStore) {\n const { path, query, data } = history.getParams();\n updateStore(this.locationStore, {\n path,\n params: this.currentParams,\n query,\n data,\n });\n }\n };\n\n #setContent = (route: RouteItem | null, params: Params, content?: TemplateResult) => {\n this.#lastLoader = undefined;\n this.currentRoute = route;\n this.currentParams = params;\n this.setState({ content });\n this.routechange(this.currentRoute);\n const title = route?.title;\n if (title) updateStore(titleStore, { title });\n this.#updateLocationStore();\n };\n\n mounted() {\n this.effect(\n ([key, path], old) => {\n // 只有查询参数改变\n if (old && key === old[0] && path === old[1]) {\n this.#updateLocationStore();\n return;\n }\n const { route, params = {} } = GemRouteElement.findRoute(this.routes, path);\n const { redirect, content, getContent } = route || {};\n if (redirect) {\n history.replace({ path: redirect });\n return;\n }\n const contentOrLoader = content || getContent?.(params);\n if (contentOrLoader instanceof Promise) {\n this.loading(route!);\n this.#lastLoader = contentOrLoader;\n const isSomeLoader = () => this.#lastLoader === contentOrLoader;\n contentOrLoader\n .then((content) => {\n if (isSomeLoader()) this.#setContent(route, params, content);\n })\n .catch((err) => {\n if (isSomeLoader()) this.error(err);\n });\n return;\n }\n this.#setContent(route, params, contentOrLoader);\n },\n () => {\n const { path } = history.getParams();\n return [this.key, path, location.search];\n },\n );\n }\n\n shouldUpdate() {\n if (this.inert) return false;\n return true;\n }\n\n render() {\n const { content } = this.state;\n if (!this.shadowRoot) return html`${content}`;\n\n return html`\n <style>\n :host,\n :not(:defined) {\n display: contents;\n }\n </style>\n ${content ?? html`<slot></slot>`}\n `;\n }\n}\n\n/**\n * @customElement gem-light-route\n */\n@customElement('gem-light-route')\nexport class GemLightRouteElement extends GemRouteElement {\n constructor(options: ConstructorOptions = {}) {\n super({ ...options, isLight: true });\n }\n}\n","import { GemElement, html, ifDefined } from '../lib/element';\nimport { attribute, property, customElement, state, part, connectStore } from '../lib/decorators';\nimport { history, basePathStore } from '../lib/history';\nimport { absoluteLocation } from '../lib/utils';\nimport { matchPath, RouteItem, RouteOptions, createHistoryParams, createPath } from './route';\n\n/**\n * @customElement gem-link\n * @attr href\n * @attr target\n * @attr doc-title\n * @attr path\n * @attr query\n * @attr hash\n * @attr pattern\n * @attr hint\n * @part link\n *\n * print bug: https://github.com/mantou132/gem/issues/36\n */\n@customElement('gem-link')\n@connectStore(basePathStore)\nexport class GemLinkElement extends GemElement {\n @attribute href: string;\n @attribute target: string;\n @attribute path: string;\n @attribute query: string;\n @attribute hash: string;\n @attribute docTitle: string;\n @attribute hint: 'on' | 'off';\n\n // 动态路由,根据 route.pattern 和 options.params 计算出 path\n @property route: RouteItem | undefined;\n @property options: RouteOptions | undefined;\n @property prepare: (() => void | Promise<void>) | undefined;\n\n @part link: string;\n\n constructor() {\n super();\n this.addEventListener('click', this.clickHandle);\n }\n\n // 不包含 basePath\n getPathInfo() {\n if (this.route) {\n const queryProp = this.options?.query || '';\n const hashProp = this.options?.hash || '';\n return createPath(this.route, this.options) + queryProp + hashProp;\n } else {\n const url = this.href || this.path + this.query + this.hash;\n const { path, query } = history.getParams();\n if (url.startsWith('#')) {\n return `${path}${query}${url}`;\n } else if (url.startsWith('?')) {\n return `${path}${url}`;\n } else if (url.startsWith('.')) {\n return absoluteLocation(path, url);\n } else {\n return url;\n }\n }\n }\n\n isExternal(pathInfo: string) {\n return !pathInfo.startsWith('/');\n }\n\n clickHandle = async (e: MouseEvent) => {\n const pathInfo = this.getPathInfo();\n\n if (!pathInfo) return;\n\n // 外部链接使用 `window.open`\n if (this.isExternal(pathInfo)) {\n switch (this.target) {\n case '_self':\n window.location.href = pathInfo;\n return;\n case '_parent':\n window.parent.location.href = pathInfo;\n return;\n case '_top':\n window.top!.location.href = pathInfo;\n return;\n default:\n window.open(pathInfo);\n return;\n }\n }\n\n const { path, query, hash } = history.getParams();\n if (path + query + hash === pathInfo) {\n // 点击当前路由链接时,什么也没做\n return;\n }\n\n e.stopPropagation();\n\n await this.prepare?.();\n\n if (this.route) {\n history.pushIgnoreCloseHandle({\n ...createHistoryParams(this.route, this.options),\n title: this.route.title || this.docTitle,\n });\n } else if (this.href) {\n const { pathname, search, hash } = new URL(pathInfo, location.origin);\n history.pushIgnoreCloseHandle({\n path: pathname,\n query: search,\n // 解码,方便 `<gem-active-link>` CJK hash 比较\n hash: decodeURIComponent(hash),\n title: this.docTitle,\n });\n } else {\n history.pushIgnoreCloseHandle({ path: this.path, query: this.query, hash: this.hash, title: this.docTitle });\n }\n };\n\n preventDefault = (e: MouseEvent) => {\n e.preventDefault();\n };\n\n render(pathInfo = this.getPathInfo()) {\n return html`\n <style>\n :host {\n /* link default style */\n cursor: pointer;\n color: blue;\n text-decoration: underline;\n }\n a {\n all: unset;\n display: contents;\n }\n a:visited {\n color: unset;\n }\n </style>\n <a\n part=${this.link}\n @click=${this.preventDefault}\n href=${ifDefined(\n this.hint === 'off'\n ? undefined\n : this.isExternal(pathInfo)\n ? pathInfo\n : new URL(history.basePath + pathInfo, location.origin).toString(),\n )}\n >\n <slot></slot>\n </a>\n `;\n }\n}\n\n/**\n * @customElement gem-active-link\n * @attr pattern\n * @state active\n */\n@customElement('gem-active-link')\n@connectStore(history.store)\nexport class GemActiveLinkElement extends GemLinkElement {\n @attribute pattern: string; // 使用匹配模式设定 active\n @state active: boolean;\n\n render() {\n const { path, query, hash } = history.getParams();\n const isMatchPattern = this.pattern && matchPath(this.pattern, path);\n const pathInfo = this.getPathInfo();\n if (isMatchPattern || path + query + hash === pathInfo) {\n this.active = true;\n } else {\n this.active = false;\n }\n return super.render(pathInfo);\n }\n}\n","/**\n * 标题显示在:\n *\n * - 桌面端 Tab 的 title\n * - 移动端 Appbar 的 title\n *\n * 修改标题:\n *\n * - `<gem-route>` 匹配路由时自动设置 `route.title`\n * - `<gem-link>` 的 `doc-title` 属性和 `route.title`\n * - 修改路径时,`history` 默认设置 `title` 为空\n * - 数据获取后,手动调用 `Title.setTitle`\n * - `<gem-title>` 作为默认值设置\n */\n\nimport { GemElement, html } from '../lib/element';\nimport { attribute, customElement, connectStore } from '../lib/decorators';\nimport { updateStore, connect } from '../lib/store';\nimport { titleStore } from '../lib/history';\n\n/**\n * 允许声明式设置 `document.title`\n * @customElement gem-title\n * @attr suffix\n */\n@connectStore(titleStore)\n@customElement('gem-title')\nexport class GemTitleElement extends GemElement {\n // 没有后缀的标题\n static title = document.title;\n static defaultTitle = document.title;\n static defaultSuffix = ` - ${document.title}`;\n\n static setTitle(title: string) {\n updateStore(titleStore, { title });\n }\n\n static updateTitle(str = '', suffix = '') {\n const { title } = titleStore;\n if (title && title !== GemTitleElement.defaultTitle) {\n GemTitleElement.title = title;\n document.title = GemTitleElement.title + suffix;\n } else if (str) {\n GemTitleElement.title = str;\n document.title = GemTitleElement.title + suffix;\n } else {\n GemTitleElement.title = GemTitleElement.defaultTitle;\n document.title = GemTitleElement.title;\n }\n }\n\n @attribute suffix: string;\n\n constructor() {\n super();\n new MutationObserver(() => this.update()).observe(this, { childList: true, characterData: true, subtree: true });\n }\n\n render() {\n // 多个 <gem-title> 时,最终 document.title 按执行顺序决定\n GemTitleElement.updateTitle(this.textContent || '', this.suffix);\n\n if (this.hidden) {\n return html``;\n }\n return html`${GemTitleElement.title}`;\n }\n}\n\nconnect(titleStore, GemTitleElement.updateTitle);\n","import { GemElement, html } from '../lib/element';\nimport { attribute, property, customElement, state } from '../lib/decorators';\n\nconst eleCache = new Map<string, HTMLTemplateElement>();\n/**\n * svg 中的 `<use>` 不能穿透 ShadowDOM,\n * 此元素用来模拟 `<use>`,\n * 由于是复制元素,所以不能像 `<use>` 一样自动更新\n *\n * slot 支持为 icon 添加效果,如涟漪,徽章\n *\n * @customElement gem-use\n * @attr selector\n */\n@customElement('gem-use')\nexport class GemUseElement extends GemElement {\n @attribute selector: string; // CSS 选择器\n @property root?: HTMLElement | Document | ShadowRoot;\n @property element?: string | DocumentFragment | Element;\n\n @state active: boolean;\n\n private getContent() {\n const ele = this.element || (this.selector ? (this.root || document).querySelector(this.selector) : null);\n if (typeof ele === 'string') {\n let temp = eleCache.get(ele);\n if (!temp) {\n temp = document.createElement('template');\n temp.innerHTML = ele;\n eleCache.set(ele, temp);\n }\n return temp.content.cloneNode(true);\n } else if (ele instanceof HTMLTemplateElement) {\n return ele.content.cloneNode(true);\n } else {\n return ele?.cloneNode(true);\n }\n }\n\n render() {\n return html`\n <style>\n :host {\n position: relative;\n }\n :host(:not([hidden])) {\n display: inline-flex;\n align-items: center;\n }\n svg {\n width: 100%;\n height: 100%;\n }\n </style>\n ${this.getContent()}\n <slot></slot>\n `;\n }\n}\n","import { GemElement } from '../lib/element';\nimport { attribute, customElement } from '../lib/decorators';\n\n/**\n * 直接写会被解释成固定属性,需要使用变量赋值\n *\n * @customElement gem-unsafe\n * @attr content\n * @attr contentcss\n */\n@customElement('gem-unsafe')\nexport class GemUnsafeElement extends GemElement {\n @attribute content: string;\n @attribute contentcss: string;\n\n constructor() {\n super();\n this.effect(\n () => {\n if (this.shadowRoot) {\n this.shadowRoot.innerHTML = `\n <style>\n :host {\n display: contents;\n }\n ${this.contentcss}\n </style>\n ${this.content}\n `;\n }\n },\n () => [this.content, this.contentcss],\n );\n }\n\n render() {\n return undefined;\n }\n}\n","import { GemElement } from '../lib/element';\nimport { property, customElement } from '../lib/decorators';\n\n// support prerender\ndocument.querySelectorAll('[data-reflect]').forEach((e) => e.remove());\n\n/**\n * @customElement gem-reflect\n */\n@customElement('gem-reflect')\nexport class GemReflectElement extends GemElement {\n @property target: HTMLElement = document.head;\n\n constructor() {\n super({ isLight: true });\n this.hidden = true;\n this.effect(\n () => {\n const childNodes = [...this.childNodes];\n childNodes.forEach((node) => {\n if (node instanceof HTMLElement) {\n node.dataset.reflect = '';\n }\n this.target.append(node);\n });\n return () => {\n childNodes.forEach((node) => node.remove());\n };\n },\n () => [this.target],\n );\n }\n}\n","import { GemElement } from '../lib/element';\nimport { createStore, updateStore } from '../lib/store';\nimport { history } from '../lib/history';\n\nconst open = Symbol('open mark');\n\n/**\n * 需要使用范型,所以导出一个函数,用来*创建*类似 Confirm 元素的基类;\n * 需要使用 Confirm 的静态方式所以使用 Store 来管理组件状态;\n * 返回 *单实例* Confirm 类;\n * 关闭时将立即移除实例,所以不支持动画;\n * 使用 `mounted`/`unmounted` 定义 `open`/`close` 回调;\n * 模拟 top layer:https://github.com/whatwg/html/issues/4633.\n */\nexport function createModalClass<T extends Record<string, unknown>>(options: T) {\n return class extends GemElement {\n static inertStore: HTMLElement[] = [];\n static instance: GemElement | null = null;\n /**\n * @final\n * modal 状态,包括内容,是否已经确认关闭等属性\n */\n static store = createStore({\n [open]: false,\n ...options,\n });\n\n /**@final */\n static get isOpen() {\n return this.store[open];\n }\n\n /**@final */\n static get observedStores() {\n return [history.store, this.store];\n }\n\n /**\n * @final\n * 自带 100ms 延迟,以允许在其他 Dialog 的 `shouldClose` 中调用此方法;\n * 浏览器 history 为异步 API,需要设置较长延迟;\n */\n static open(opts: T) {\n const instance = new this();\n this.instance = instance;\n this.inertStore = ([...document.body.children] as HTMLElement[]).filter((e) => !e.inert);\n this.inertStore.forEach((e) => (e.inert = true));\n document.body.append(instance);\n const changeStore = () => updateStore(this.store, { [open]: true, ...opts });\n setTimeout(() => {\n changeStore();\n history.push({\n title: instance.label,\n open: changeStore,\n close: this.closeHandle.bind(this),\n shouldClose: this.shouldClose.bind(this),\n });\n }, 100);\n }\n\n /**\n * @final\n * UI 中执行关闭\n */\n static close() {\n history.back();\n }\n\n /**\n * @final\n * history 中自动调用\n */\n static closeHandle() {\n this.inertStore.forEach((e) => (e.inert = false));\n this.instance?.remove();\n updateStore(this.store, { [open]: false, ...options });\n }\n\n /**\n * 由于要操作浏览器历史记录,所以没有设计为 Promise;\n */\n static shouldClose() {\n return true;\n }\n\n constructor() {\n super();\n this.internals.role = 'alertdialog';\n this.internals.ariaModal = 'true';\n }\n\n label = '';\n };\n}\n","import { GemElement } from '../lib/element';\nimport { attribute, state, connectStore } from '../lib/decorators';\nimport { history } from '../lib/history';\n\n/**\n * 在模版中声明的 dialog,使用 `open` 方法 打开;\n * 如果要应用关闭动画,可以在动画执行完后设置 `hidden` 属性;\n * 模拟 top layer:https://github.com/whatwg/html/issues/4633.\n *\n * @attr label\n */\n@connectStore(history.store)\nexport abstract class DialogBaseElement extends GemElement {\n @state opened = false;\n\n inert = true;\n\n #nextSibling: ChildNode | null;\n #parentElement: Node | null;\n #inertStore: HTMLElement[] = [];\n\n @attribute label = '';\n\n constructor() {\n super();\n this.internals.role = 'dialog';\n this.internals.ariaModal = 'true';\n }\n\n /**\n * @final\n * 进入关闭状态\n */\n closeHandle = () => {\n this.inert = true;\n this.#inertStore.forEach((e) => (e.inert = false));\n if (this.#nextSibling) {\n this.#nextSibling.before(this);\n } else if (this.#parentElement) {\n this.#parentElement?.appendChild(this);\n }\n this.dispatchEvent(new CustomEvent('close'));\n this.opened = false;\n };\n\n /**\n * @final\n * 进入打开状态\n */\n openHandle = () => {\n this.hidden = false;\n this.inert = false;\n this.#nextSibling = this.nextSibling;\n this.#parentElement = this.parentElement || this.getRootNode();\n this.#inertStore = ([...document.body.children] as HTMLElement[]).filter((e) => !e.inert);\n this.#inertStore.forEach((e) => (e.inert = true));\n document.body.append(this);\n this.dispatchEvent(new CustomEvent('open'));\n this.opened = true;\n };\n\n /**@final */\n open = () => {\n if (this.opened) return;\n this.openHandle();\n history.push({\n title: this.label,\n open: this.openHandle,\n close: this.closeHandle,\n shouldClose: this.shouldClose,\n });\n };\n\n shouldClose() {\n return true;\n }\n\n /**@final */\n close = () => {\n history.back();\n };\n\n /**\n * @final\n * 跳过 `shouldClose` 强制关闭\n * 避免 `shouldClose` 中造成无限循环\n * 延时关闭避免同步操作 history\n */\n forceClose = () => {\n this.opened = false;\n setTimeout(this.close, 100);\n };\n}\n","import { connect, createStore, updateStore, Store } from '../lib/store';\nimport { camelToKebabCase, randomStr } from '../lib/utils';\n\ntype SomeType<T> = {\n [P in keyof T]: string;\n};\n\nconst themeStoreMap = new WeakMap();\n\nexport function getThemeStore<T>(theme: SomeType<T>) {\n return themeStoreMap.get(theme) as Store<T>;\n}\n\nconst themePropMap = new WeakMap();\n\nexport function getThemeProp<T>(theme: SomeType<T>) {\n return themePropMap.get(theme) as SomeType<T>;\n}\n\nfunction replaceStyle(style: HTMLStyleElement, theme: Record<string, unknown>) {\n const themeStore = themeStoreMap.get(theme);\n const themeProp = themePropMap.get(theme);\n const rules = Object.keys(themeStore).reduce((prev, key) => {\n if (!themeStore[key]) return prev;\n return prev + `${themeProp[key]}:${themeStore[key]};`;\n }, '');\n style.textContent = `:root, :host {${rules}}`;\n}\n\n/**\n * 创建主题,插入 `document.head`\n * https://github.com/mantou132/gem/issues/33\n *\n * @example\n * createTheme({\n * primaryColor: '#eee',\n * });\n */\nexport function createTheme<T extends Record<string, unknown>>(themeObj: T) {\n const salt = randomStr();\n const style = document.createElement('style');\n const themeStore = createStore<T>(themeObj);\n const theme: Record<string, string> = {};\n const themeProp: Record<string, string> = {};\n themePropMap.set(theme, themeProp);\n themeStoreMap.set(theme, themeStore);\n Object.keys(themeStore).forEach((key) => {\n themeProp[key] = `--${camelToKebabCase(key)}-${salt}`;\n theme[key] = `var(${themeProp[key]})`;\n });\n const replace = () => replaceStyle(style, theme);\n connect(themeStore, replace);\n replace();\n (document.head || document.documentElement).append(style);\n return theme as SomeType<T>;\n}\n\n/**\n * 更新主题\n * @param theme 主题\n * @param newThemeObj 新主题\n */\nexport function updateTheme<T = Record<string, unknown>>(theme: SomeType<T>, newThemeObj: Partial<T>) {\n const store = getThemeStore(theme);\n updateStore(store, newThemeObj);\n}\n","import { createStore, updateStore, Store } from '../lib/store';\nimport { html, TemplateResult } from '../lib/element';\nimport { GemError } from '../lib/utils';\n\n// Hello, $1\n// See $1<detail>\n// 嵌套模版中用到 $ < > 时使用 &dollar; &lt; &gt; 替代\nconst splitReg = /\\$\\d(?:<[^>]*>)?/;\nconst matchReg = /\\$(\\d)(<([^>]*)>)?/g;\nconst matchStrIndex = 3;\n\nexport function splice(rawValue: string, ...rest: (((s: string) => TemplateResult) | string)[]) {\n const templateArr = rawValue.split(splitReg) as unknown as TemplateStringsArray;\n const values: (TemplateResult | string)[] = [];\n let result: RegExpExecArray | null;\n while ((result = matchReg.exec(rawValue))) {\n const str = result[matchStrIndex];\n const index = Number(result[1]) - 1;\n const arg = rest[index];\n values.push(typeof arg === 'string' ? arg : arg(str));\n }\n return html(templateArr, ...values);\n}\n\nconst modules = new Set<I18n<any>>();\n\ntype Msg =\n | {\n message: string;\n description: string;\n }\n | string;\n\nexport type I18nJSON<T> = {\n currentLanguage: string;\n currentLanguagePack: Partial<T>;\n};\n\ninterface Resources<T> {\n [key: string]: Partial<T> | string;\n}\n\ninterface Options<T> {\n resources: Resources<T>;\n fallbackLanguage: string;\n // 可以在构造函数中指定,但会被 URL 中的语言参数覆盖\n currentLanguage?: string;\n /**\n * `true` 表示在修改语言时自动缓存。\n * 为了避免缓存超出 `localStorage` 限制,语言包 URL 应该带版本号查询参数\n */\n cache?: boolean | 'manual';\n // lib 需要设置,避免被应用中的 i18n 一起清理掉语言缓存\n // 也用来作为 prerender 的 script type\n cachePrefix?: string;\n // 为 `path` 时页面的路由不能和语言代码相同\n urlParamsType?: 'path' | 'querystring' | 'ccTLD' | 'gTLD';\n urlParamsName?: string;\n onChange?: (currentLanguage: string) => void;\n}\n\nexport class I18n<T = Record<string, Msg>> {\n resources: Resources<T>;\n fallbackLanguage: string;\n currentLanguage: string;\n cache?: boolean | 'manual';\n cachePrefix = 'gem-i18n';\n urlParamsType?: 'path' | 'querystring' | 'ccTLD' | 'gTLD';\n urlParamsName?: string;\n onChange?: (currentLanguage: string) => void;\n\n store: Store<any>;\n\n get #cacheCurrentKey() {\n return `${this.cachePrefix}:current`;\n }\n\n get #urlParamsLang() {\n const { hostname, pathname, search } = location;\n const parts = hostname.split('.');\n switch (this.urlParamsType) {\n case 'ccTLD':\n return parts.pop();\n case 'gTLD':\n return parts.shift();\n case 'path':\n return pathname.split('/')[1];\n default:\n const fragment = (this.urlParamsName && new URLSearchParams(search).get(this.urlParamsName)) || '';\n return fragment in this.resources ? fragment : '';\n }\n }\n\n get #cacheLang() {\n return (this.cache && localStorage.getItem(this.#cacheCurrentKey)) || '';\n }\n\n get #isMain(): boolean {\n return !modules.has(this);\n }\n\n set #lang(lang: string) {\n if (this.#isMain) {\n document.documentElement.lang = lang;\n }\n this.currentLanguage = lang;\n this.onChange?.(lang);\n }\n\n constructor(options: Options<T>) {\n if (!options.resources[options.fallbackLanguage]) {\n throw new GemError('i18n: fallbackLanguage invalid');\n }\n\n this.store = createStore(this as any);\n Object.assign<I18n<T>, Options<T>>(this as I18n<T>, options);\n\n let currentLanguage = this.#urlParamsLang || this.currentLanguage || this.#cacheLang;\n\n const ele = document.querySelector(`[type*=${this.cachePrefix}]`);\n if (ele) {\n try {\n const prerenderData = JSON.parse(ele.textContent || '') as I18nJSON<T>;\n currentLanguage = prerenderData.currentLanguage;\n this.resources[prerenderData.currentLanguage] = prerenderData.currentLanguagePack;\n } catch {\n //\n }\n }\n\n if (currentLanguage) {\n this.#lang = currentLanguage;\n this.setLanguage(currentLanguage);\n } else {\n this.resetLanguage();\n }\n }\n\n get(s: keyof T): string;\n get(s: keyof T, ...rest: (((s: string) => TemplateResult) | string)[]): TemplateResult;\n get(s: keyof T, ...rest: (((s: string) => TemplateResult) | string)[]) {\n const currentLanguagePack = this.resources[this.currentLanguage] as any;\n const fallbackLanguagePack = this.resources[this.fallbackLanguage] as any;\n const msg = currentLanguagePack[s] || fallbackLanguagePack[s];\n const rawValue: string = msg?.message || msg || `[${s}]`;\n if (!rest.length) return rawValue;\n return splice(rawValue, ...rest);\n }\n\n detectLanguage() {\n const availableLangs = Object.keys(this.resources);\n const uiLangs = navigator.languages.map((lang) => lang.replace(/-(.*)/, ($1) => $1.toUpperCase()));\n for (const lang of uiLangs) {\n const matched = availableLangs.find((e) => e === lang || lang.startsWith(`${e}-`));\n if (matched) return matched;\n }\n return this.fallbackLanguage;\n }\n\n async setLanguage(lang: string): Promise<string> {\n if (this.#isMain) {\n modules.forEach(async (i18n) => await i18n.setLanguage(lang));\n }\n let pack: Partial<T>;\n const data = this.resources[lang];\n if (!data) {\n // eslint-disable-next-line no-console\n console.warn(`${this.cachePrefix}: not found \\`${lang}\\``);\n return this.resetLanguage();\n }\n\n if (typeof data === 'string') {\n const prefix = `${this.cachePrefix}:`;\n const localKey = `${prefix}${data}`;\n const localPackString = localStorage.getItem(localKey);\n\n const fetchPack = async () => {\n const pack = await (await fetch(data)).json();\n if (this.cache) {\n // 移除之前的版本缓存\n for (let i = 0; i < localStorage.length; i++) {\n const key = localStorage.key(i) as string;\n if (key.startsWith(prefix)) {\n localStorage.removeItem(key);\n }\n }\n localStorage.setItem(localKey, JSON.stringify(pack));\n }\n return pack;\n };\n\n if (localPackString) {\n try {\n pack = JSON.parse(localPackString);\n } catch (e) {\n pack = await fetchPack();\n }\n } else {\n pack = await fetchPack();\n }\n } else {\n pack = data;\n }\n this.resources[lang] = pack;\n updateStore(this.store, {});\n if (lang !== this.currentLanguage) {\n this.#lang = lang;\n }\n // auto cache\n if (this.cache === true) {\n this.setCache();\n }\n return lang;\n }\n\n resetLanguage() {\n if (this.#isMain) {\n modules.forEach((i18n) => i18n.resetLanguage());\n }\n this.#lang = this.fallbackLanguage;\n if (this.cache) {\n localStorage.removeItem(this.#cacheCurrentKey);\n }\n return this.setLanguage(this.detectLanguage());\n }\n\n // 一般用在 `onChange` 中\n setCache() {\n if (this.#isMain) {\n modules.forEach((i18n) => i18n.setCache());\n }\n localStorage.setItem(this.#cacheCurrentKey, this.currentLanguage);\n }\n\n createSubModule<K = Record<string, Msg>>(name: string, resources: Resources<K>) {\n const module = new I18n<K>({\n resources,\n cachePrefix: `${this.cachePrefix}-${name}`,\n currentLanguage: this.currentLanguage,\n fallbackLanguage: this.fallbackLanguage,\n cache: this.cache,\n });\n modules.add(module);\n return module;\n }\n\n /**\n * prepare: @connectStore(i18n.store)\n *\n * @example\n *\n * html`\n * <gem-reflect>\n * <script type=\"${i18n.cachePrefix}\">${JSON.stringify(i18n)}</script>\n * </gem-reflect>\n * `\n */\n toJSON() {\n return {\n currentLanguage: this.currentLanguage,\n currentLanguagePack: this.resources[this.currentLanguage],\n };\n }\n}\n","// 带凭证 Rest API 请求\nconst defaultReq: RequestInit = {\n credentials: 'include',\n mode: 'cors',\n};\n\nexport async function request<T>(uri: string, options: RequestInit = {}): Promise<T> {\n const res = await fetch(uri, {\n ...defaultReq,\n ...options,\n });\n if (res.status === 0) throw new Error('Request fail');\n if (res.status >= 500) throw new Error(res.statusText);\n if (res.status >= 400) throw new Error((await res.text()) || res.statusText);\n return await res.json();\n}\n\ntype ReqBody = Record<string, unknown> | BodyInit;\nconst TypedArray = Object.getPrototypeOf(Object.getPrototypeOf(new Int8Array()));\n\nfunction serializationBody(body?: ReqBody): BodyInit | undefined {\n if (\n body instanceof FormData ||\n body instanceof Blob ||\n body instanceof TypedArray ||\n body instanceof URLSearchParams ||\n body instanceof ReadableStream ||\n body instanceof ArrayBuffer\n ) {\n return body as BodyInit;\n }\n if (typeof body === 'object') {\n return JSON.stringify(body);\n }\n return body;\n}\n\nexport function get<T>(url: string, params?: Record<string, string | number>) {\n const { origin, pathname, search } = new URL(url, location.origin);\n const query = new URLSearchParams(params as Record<string, string>).toString();\n return request<T>(`${origin}${pathname}${search ? `${search}&` : query ? '?' : ''}${query}`, {\n method: 'GET',\n });\n}\nexport function del<T>(url: string) {\n return request<T>(url, { method: 'DELETE' });\n}\nexport function put<T>(url: string, body?: ReqBody) {\n return request<T>(url, { method: 'PUT', body: serializationBody(body) });\n}\nexport function post<T>(url: string, body?: ReqBody) {\n return request<T>(url, { method: 'POST', body: serializationBody(body) });\n}\n","// https://gist.github.com/gokulkrishh/242e68d1ee94ad05f488\n// https://mediag.com/news/popular-screen-resolutions-designing-for-all/\n\nconst matche = (query: string) => window.matchMedia(query).matches;\n\nexport const mediaQuery = {\n PRINT: 'print',\n get isPrint() {\n return matche(this.PRINT);\n },\n HOVER: '(hover: hover)',\n get isHover() {\n return matche(this.HOVER);\n },\n\n PHONE: '(min-width: 319px) and (max-width: 480px)',\n get isPhone() {\n return matche(this.PHONE);\n },\n\n LAPTOP: '(min-width: 1023px) and (max-width: 1280px) and (orientation: landscape)',\n get isLaptop() {\n return matche(this.LAPTOP);\n },\n\n DESKTOP: '(min-width: 1279px) and (orientation: landscape)',\n get isDesktop() {\n return matche(this.DESKTOP);\n },\n\n WIDTHSCREEN: '(min-width: 1919px) and (orientation: landscape)',\n get isWidthScreen() {\n return matche(this.WIDTHSCREEN);\n },\n\n PHONE_LANDSCAPE: '(min-width: 479px) and (max-width: 767px) and (orientation: landscape)',\n // PHONE_LANDSCAPE: '(min-width: 481px) and (max-width: 767px)',\n get isPhoneLandscape() {\n return matche(this.PHONE_LANDSCAPE);\n },\n\n TABLET: '(min-width: 768px) and (max-width: 1024px)',\n get isTablet() {\n return matche(this.TABLET);\n },\n\n SMALL_PHONE: '(min-width: 319px) and (max-width: 480px) and (max-height: 640px)',\n get isSmallPhone() {\n return matche(this.SMALL_PHONE);\n },\n\n WATCH: '(max-width: 319px)',\n get isWatch() {\n return matche(this.WATCH);\n },\n\n SHORT: '(min-width: 479px) and (max-height: 320px)',\n get isShort() {\n return matche(this.SHORT);\n },\n\n PWA: '(display-mode: standalone)',\n // PWA: '(display-mode: browser)', // debugging\n get isPWA() {\n return matche(this.PWA);\n },\n\n MOTION_REDUCE: '(prefers-reduced-motion: reduce)',\n get isMotionReduce() {\n return matche(this.MOTION_REDUCE);\n },\n\n DATA_REDUCE: '(prefers-reduced-data: reduce)',\n get isDataReduce() {\n return matche(this.DATA_REDUCE);\n },\n};\n","// Do not modify manually\nexport const version = '1.6.5';\n","import { updateStore } from './lib/store';\nimport * as Gem from './';\n\nexport interface DevToolsHook {\n updateStore: typeof updateStore;\n}\n\ndeclare global {\n interface Window {\n __GEM_DEVTOOLS__HOOK__?: DevToolsHook;\n }\n}\n\nif (window.__GEM_DEVTOOLS__HOOK__) {\n // 不支持多个 gem\n Object.assign(window.__GEM_DEVTOOLS__HOOK__, { ...Gem });\n}\n\nexport * from './lib/store';\nexport * from './lib/history';\nexport * from './lib/element';\nexport * from './lib/decorators';\nexport * from './lib/utils';\n\nexport * from './lib/version';\n"],"names":["root","factory","exports","module","define","amd","self","__webpack_require__","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","directives","WeakMap","directive","f","args","d","set","isDirective","has","isCEPolyfill","window","customElements","undefined","polyfillWrapFlushCallback","reparentNodes","container","start","end","before","n","nextSibling","insertBefore","removeNodes","removeChild","noChange","nothing","marker","String","Math","random","slice","nodeMarker","markerRegex","RegExp","boundAttributeSuffix","Template","constructor","result","element","this","parts","nodesToRemove","stack","walker","document","createTreeWalker","content","lastPartIndex","index","partIndex","strings","values","length","node","nextNode","nodeType","hasAttributes","attributes","count","i","endsWith","name","stringForPart","lastAttributeNameRegex","exec","attributeLookupName","toLowerCase","attributeValue","getAttribute","removeAttribute","statics","split","push","type","tagName","currentNode","data","indexOf","parent","parentNode","lastIndex","insert","s","createMarker","match","createTextNode","previousSibling","pop","str","suffix","isTemplatePartActive","part","createComment","TemplateInstance","template","processor","options","__parts","update","setValue","commit","_clone","fragment","cloneNode","importNode","nodeIndex","nodeName","handleTextExpression","insertAfterNode","handleAttributeExpressions","adoptNode","upgrade","policy","trustedTypes","createPolicy","createHTML","commentMarker","TemplateResult","getHTML","l","html","isCommentBinding","commentOpen","lastIndexOf","attributeMatch","substr","getTemplateElement","createElement","innerHTML","SVGTemplateResult","super","svgElement","firstChild","isPrimitive","isIterable","Array","isArray","iterator","AttributeCommitter","dirty","_createPart","AttributePart","_getValue","v","text","t","setAttribute","committer","NodePart","__pendingValue","appendInto","startNode","appendChild","endNode","ref","appendIntoPart","__insert","insertAfterPart","__commitText","__commitTemplateResult","Node","__commitNode","__commitIterable","clear","valueAsString","templateFactory","instance","itemParts","itemPart","item","BooleanAttributePart","Error","PropertyCommitter","single","PropertyPart","eventOptionsSupported","capture","addEventListener","removeEventListener","_e","EventPart","eventName","eventContext","__boundHandleEvent","e","handleEvent","newListener","oldListener","shouldRemoveListener","once","passive","shouldAddListener","__options","getOptions","event","defaultTemplateProcessor","prefix","templateCache","templateCaches","stringsArray","keyString","Map","join","render","assign","svg","microtaskSet","Set","addMicrotask","func","size","globalThis","queueMicrotask","forEach","delete","add","microtaskStack","execMicrotaskStack","addMicrotaskToStack","absoluteLocation","currentPath","relativePath","pathname","search","hash","URL","location","origin","LinkedList","EventTarget","dispatchEvent","CustomEvent","prev","next","deleteItem","firstItem","existItem","PropProxyMap","ele","proxy","QueryString","URLSearchParams","param","JSON","stringify","parse","concat","query","fromEntries","entries","append","setAny","getAny","getAnyAll","getAll","filter","map","toString","string","toJSON","raw","arr","reduce","current","css","SheetToken","useNativeCSSStyleSheet","CSSStyleSheet","media","mediaText","style","replaceSync","createCSSSheet","rules","mediaQuery","styleSheet","sheet","keys","randomStr","styledContent","replace","number","len","floor","nestingRuleRegExp","flatStyled","nestingRules","styled","class","id","keyframes","camelToKebabCase","$1","kebabToCamelCase","_substr","toUpperCase","cleanObject","GemError","msg","message","isArrayChange","newValues","oldValues","removeItems","target","items","styleMap","styleString","classMap","classList","className","partMap","StoreListenerMap","createStore","originStore","createStoreSet","originStoreSet","updateStore","store","listeners","connect","disconnect","createAndInsertPart","containerPart","beforePart","beforeNode","newPart","updatePart","insertPartBefore","removePart","generateMap","list","partListCache","keyListCache","repeat","keyFnOrTemplate","keyFn","oldParts","oldKeys","newParts","newKeys","newKeyToIndexMap","oldKeyToIndexMap","oldHead","oldTail","newHead","newTail","oldIndex","oldPart","previousValues","guard","previousValue","every","from","ifDefined","emptyFunction","execCallback","fun","asyncRenderTaskList","tick","timeStamp","performance","now","requestAnimationFrame","task","initSymbol","updateSymbol","GemElement","HTMLElement","isAsync","isLight","delegatesFocus","setState","payload","state","effectItem","callback","getDep","preCallback","effect","initialized","isConnected","memo","styles","shadowRoot","adoptedStyleSheets","shouldUpdate","temp","updated","willMount","observedStores","rootElement","mounted","getRootNode","host","attachShadow","mode","sheets","body","_sheets","internals","getCustomStateSet","getV","dataset","attachInternals","states","attributeChangedCallback","closestElement","constructorOrTag","isConstructor","getRootElement","rootEle","parentElement","connectedCallback","disconnectedCallback","unmounted","gemElementProxyMap","defineAttribute","attr","booleanAttributes","numberAttributes","configurable","Number","that","hasSet","isBool","toggleAttribute","isEventHandleSymbol","eventOptions","detail","evt","defineRef","refobject","gemReflects","querySelectorAll","querySelector","defineCSSState","nativeDefineElement","bind","pushStaticField","field","member","isSet","cls","defineAttr","attribute","boolattribute","numattribute","property","slot","emitter","defineEmitter","globalemitter","bubbles","composed","adoptedStyle","connectStore","rootType","customElement","observedAttributes","observedPropertys","defineEvents","defineCSSStates","defineRefs","history","pushState","replaceState","getKey","$hasCloseHandle","$hasOpenHandle","$hasShouldCloseHandle","$key","paramsMap","validData","getUrlbarPath","internalPath","basePath","getInternalPath","urlbarPath","initParams","params","path","pathChanged","title","statusChanged","close","open","shouldClose","decodeURIComponent","updateHistory","p","url","prevHave","updateHistoryByNative","originUrl","prevHash","basePathStore","isTrusted","defineProperties","getParams","updateParams","pushIgnoreCloseHandle","back","titleStore","navigating","newState","prevState","parseFloat","prevParams","closeHandle","shouldCloseHandle","forward","ParamsRegExp","pattern","namePosition","_m","matchPath","reg","matchResult","createPath","route","createHistoryParams","GemRouteElement","routes","currentParams","locationStore","currentRoute","routechange","old","findRoute","redirect","getContent","contentOrLoader","Promise","loading","isSomeLoader","then","catch","err","error","inert","createLocationStore","defaultRoute","GemLightRouteElement","GemLinkElement","clickHandle","pathInfo","getPathInfo","isExternal","href","top","stopPropagation","prepare","docTitle","preventDefault","queryProp","hashProp","startsWith","link","hint","GemActiveLinkElement","isMatchPattern","active","GemTitleElement","MutationObserver","observe","childList","characterData","subtree","static","defaultTitle","updateTitle","textContent","hidden","defaultSuffix","eleCache","GemUseElement","selector","HTMLTemplateElement","GemUnsafeElement","contentcss","remove","GemReflectElement","head","childNodes","reflect","createModalClass","label","role","ariaModal","isOpen","opts","inertStore","children","changeStore","setTimeout","DialogBaseElement","opened","openHandle","forceClose","themeStoreMap","getThemeStore","theme","themePropMap","getThemeProp","createTheme","themeObj","salt","themeStore","themeProp","replaceStyle","documentElement","updateTheme","newThemeObj","splitReg","matchReg","splice","rawValue","rest","templateArr","arg","modules","I18n","cachePrefix","resources","fallbackLanguage","currentLanguage","prerenderData","currentLanguagePack","setLanguage","resetLanguage","fallbackLanguagePack","detectLanguage","availableLangs","uiLangs","navigator","languages","lang","matched","find","pack","i18n","console","warn","localKey","localPackString","localStorage","getItem","fetchPack","fetch","json","cache","removeItem","setItem","setCache","createSubModule","hostname","urlParamsType","shift","urlParamsName","onChange","defaultReq","credentials","request","uri","res","status","statusText","TypedArray","getPrototypeOf","Int8Array","serializationBody","FormData","Blob","ReadableStream","ArrayBuffer","method","del","put","post","matche","matchMedia","matches","PRINT","isPrint","HOVER","isHover","PHONE","isPhone","LAPTOP","isLaptop","DESKTOP","isDesktop","WIDTHSCREEN","isWidthScreen","PHONE_LANDSCAPE","isPhoneLandscape","TABLET","isTablet","SMALL_PHONE","isSmallPhone","WATCH","isWatch","SHORT","isShort","PWA","isPWA","MOTION_REDUCE","isMotionReduce","DATA_REDUCE","isDataReduce","version","__GEM_DEVTOOLS__HOOK__"],"sourceRoot":""}