peryl 1.4.49 → 1.4.52

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.
@@ -1 +1 @@
1
- {"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap","webpack:///./src/hsml.ts","webpack:///external \"IncrementalDOM\"","webpack:///./src/hsml-app.ts","webpack:///./src/hsml-idom.ts"],"names":["root","factory","exports","module","require","define","amd","a","i","window","__WEBPACK_EXTERNAL_MODULE__1__","installedModules","__webpack_require__","moduleId","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","NBSP","hsml","hml","handler","ctx","constructor","Array","hmlTag","console","error","head","attrsObj","hasAttrs","hFnc","hObj","children","htc","Function","String","Boolean","Number","Date","refSplit","split","ref","dotSplit","hashSplit","tag","id","classes","slice","attrs","_id","length","_classes","_ref","_hObj","skip","open","fnc","forEach","jml","close","hsmlTag","text","toLocaleString","toString","ds","obj","hsmls","sep","reduce","push","splice","log","err","HAppAction","schedule","requestAnimationFrame","callback","setTimeout","unschedule","cancelAnimationFrame","handle","clearTimeout","HApp","state","view","dispatcher","e","document","body","refs","dispatch","type","data","event","debug","t0","performance","now","this","update","t1","render","actionCb","action","undefined","el","target","nodeName","preventDefault","els","elements","formInputData","names","keys","concat","filter","formData","mount","getElementById","app","umount","dom","updateDom","_onUpdate","_mount","_umount","hasAttribute","removeAttribute","aNodes","querySelectorAll","firstChild","removeChild","_updateSched","onUpdate","cb","toHsml","_skip","toHtml","outerHTML","_init","then","hsmls2idomPatch","iel","checked","sel","multiple","values","from","selectedOptions","map","tel","bel","HsmlIDomHandler","props","attrClasses","attrData","JSON","stringify","attrOn","attr","unshift","join","idom","elementOpen","_key","currentElement","elementClose","hsml2idom","node","hsmlEl","patch","hsmlFr","hmls","hsmls2idom"],"mappings":"CAAA,SAA2CA,EAAMC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IzJ,QAGJ,GAAIA,EAAIG,cAAgBa,OACpB+H,EAAKrG,KAAK1C,QACP,GAAI,WAAaA,EAAa,CACjC,MAAM8C,EAAM9C,EACZ8C,EAAIsE,QAAUgC,EAAUtG,EAAIsE,SAAUtE,QAEtCsG,EAAUpJ,EAAiBE,GAYAwJ,CAAWjF,EAAMvE,GAAOsJ","file":"hsml-app.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"IncrementalDOM\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"IncrementalDOM\"], factory);\n\telse {\n\t\tvar a = typeof exports === 'object' ? factory(require(\"IncrementalDOM\")) : factory(root[\"IncrementalDOM\"]);\n\t\tfor(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];\n\t}\n})(window, function(__WEBPACK_EXTERNAL_MODULE__1__) {\nreturn "," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 12);\n","\nexport type HHead = keyof HTMLElementTagNameMap | string; // \"tag#id.class1.class2~handler\"\n\nexport type HAttrClasses = Array<string | [string, boolean]>;\n\nexport type HAttrStyles = { [key: string]: string };\n\nexport type HAttrData = {\n [key: string]:\n | string\n | String\n | number\n | Number\n | boolean\n | Boolean\n | Date\n | Array<any>\n | Object;\n};\n\nexport type HAttrOnAction = string;\n\nexport type HAttrOnDataFnc = (e: Event) => any;\n\nexport type HAttrOnData =\n | string\n | String\n | number\n | Number\n | boolean\n | Boolean\n | Date\n | Array<any>\n | Object\n | HAttrOnDataFnc\n | null;\n\nexport type HAttrOnCb = [keyof HTMLElementEventMap, EventListener];\n\nexport type HAttrOnAct = [\n keyof HTMLElementEventMap,\n HAttrOnAction,\n HAttrOnData?\n];\n\nexport type HAttrOn = HAttrOnCb | HAttrOnAct | Array<HAttrOnCb | HAttrOnAct>;\n\nexport interface HAttrs {\n readonly _id?: string;\n readonly _classes?: string[];\n readonly _ref?: string;\n readonly _key?: string;\n readonly _skip?: boolean;\n readonly _hObj?: HObj;\n readonly classes?: HAttrClasses;\n readonly styles?: HAttrStyles;\n readonly data?: HAttrData;\n readonly on?: HAttrOn;\n readonly [key: string]:\n | string\n | String\n | string[]\n | String[]\n | number\n | Number\n | boolean\n | Boolean\n | Date\n | HAttrClasses\n | HAttrStyles\n // | HsmlAttrData\n | HAttrOn\n | EventListener\n | HObj\n | undefined;\n}\n\nexport type HFnc = (e: Element) => boolean | void;\n\nexport interface HObj {\n toHsml?(): HElement;\n}\n\nexport interface HElements extends Array<HElement> {}\n\nexport type HChildren =\n | HElements\n | HFnc\n | HObj\n | string\n | String\n | boolean\n | Boolean\n | number\n | Number\n | Date\n | undefined\n | null;\n\nexport type HTagNoAttr = [HHead, HChildren?];\nexport type HTagAttr = [HHead, HAttrs, HChildren?];\n\nexport type HTag = HTagNoAttr | HTagAttr;\n\nexport type HElement =\n | HFnc\n | HObj\n | HTag\n | string\n | String\n | boolean\n | Boolean\n | number\n | Number\n | Date\n | undefined\n | null;\n\nexport interface HHandlerCtx extends HObj {\n refs: { [name: string]: Element };\n actionCb(action: HAttrOnAction, data: HAttrOnData, e: Event): void;\n}\n\nexport interface HHandler<C extends HHandlerCtx> {\n open(tag: HHead, attrs: HAttrs, children: HElements, ctx?: C): boolean;\n close(tag: HHead, children: HElements, ctx?: C): void;\n text(text: string, ctx?: C): void;\n fnc(fnc: HFnc, ctx?: C): void;\n obj(obj: HObj, ctx?: C): void;\n}\n\nexport const NBSP = \"\\u00a0 \";\n\nexport function hsml<C extends HHandlerCtx>(hml: HElement,\n handler: HHandler<C>,\n ctx?: C): void {\n // console.log(\"hsml\", hsml);\n if (hml === undefined || hml === null) {\n return;\n }\n switch (hml.constructor) {\n case Array:\n // const tag = hml as HTag;\n // if (\n // (\n // tag.length === 1 &&\n // tag[0].constructor === String\n // ) ||\n // (\n // tag.length === 2 &&\n // (\n // tag[0].constructor === String &&\n // (tag[1]!.constructor === Array || tag[1]!.constructor === Function)\n // ) ||\n // (\n // tag[0].constructor === String &&\n // tag[1]!.constructor === Object\n // )\n // ) ||\n // (\n // tag.length === 3 &&\n // tag[0].constructor === String &&\n // tag[1].constructor === Object &&\n // tag[2]!.constructor === Array\n // )\n // ) {\n // hsmlTag(hml as HTag, handler, ctx);\n // } else {\n // console.error(\"hsml parse error:\", hml);\n // // console.error(\"hsml parse error:\", JSON.stringify(hml, null, 4));\n // // throw Error(`hsml parse error: ${JSON.stringify(hml)}`);\n // }\n hsmlTag(hml as HTag, handler, ctx);\n break;\n case Function:\n handler.fnc(hml as HFnc, ctx);\n break;\n case String:\n handler.text(hml as string, ctx);\n break;\n case Boolean:\n handler.text(\"\" + hml, ctx);\n break;\n case Number:\n const n = hml as number;\n const ns = n.toLocaleString ? n.toLocaleString() : n.toString();\n handler.text(ns, ctx);\n break;\n case Date:\n const d = hml as Date;\n const ds = d.toLocaleString ? d.toLocaleString() : d.toString();\n handler.text(ds, ctx);\n break;\n default: // HObj\n handler.obj(hml as HObj, ctx);\n }\n\n function hsmlTag(hmlTag: HTag, handler: HHandler<C>, ctx?: C): void {\n // console.log(\"hsml tag\", hmlTag);\n\n if (typeof hmlTag[0] !== \"string\") {\n console.error(\"HSML tag head not string:\", hmlTag);\n return;\n }\n\n const head = hmlTag[0] as HHead;\n const attrsObj = hmlTag[1] as any;\n const hasAttrs = attrsObj && attrsObj.constructor === Object;\n const childIdx = hasAttrs ? 2 : 1;\n\n let children: HElements = [];\n let hFnc: HFnc | undefined;\n let hObj: HObj | undefined;\n\n const htc = hmlTag[childIdx];\n switch (htc != null && htc.constructor) { // switch ((typeof htc !== \"undefined\" || htc !== null) && htc.constructor) {\n case Array:\n children = htc as HElements;\n break;\n case Function:\n hFnc = htc as HFnc;\n break;\n case String:\n case Boolean:\n case Number:\n case Date:\n children = [htc as string | boolean | number | Date];\n break;\n default: // HObj\n hObj = htc as HObj;\n break;\n }\n\n const refSplit = head.split(\"~\");\n const ref = refSplit[1];\n const dotSplit = refSplit[0].split(\".\");\n const hashSplit = dotSplit[0].split(\"#\");\n const tag = hashSplit[0] || \"div\";\n const id = hashSplit[1];\n const classes = dotSplit.slice(1);\n\n let attrs: HAttrs;\n if (hasAttrs) {\n attrs = attrsObj as HAttrs;\n } else {\n attrs = {} as HAttrs;\n }\n\n if (id) {\n (attrs as any)._id = id;\n }\n if (classes.length) {\n (attrs as any)._classes = classes;\n }\n if (ref) {\n (attrs as any)._ref = ref;\n }\n if (hObj) {\n (attrs as any)._hObj = hObj;\n }\n\n const skip = handler.open(tag, attrs, children, ctx);\n\n if (hFnc) {\n handler.fnc(hFnc, ctx);\n }\n\n if (!skip) {\n children.forEach(jml => hsml(jml, handler, ctx));\n }\n\n handler.close(tag, children, ctx);\n }\n}\n\nexport function hjoin(hsmls: HElements, sep: string | HElement): HElements {\n const r = hsmls.reduce<HElements>(\n (p, c) => (p.push(c, sep), p),\n [] as HElements\n );\n r.splice(-1);\n return r;\n}\n\n// Test\n\n// const hsmls: Hsmls = [\n// \"text\",\n// [\"tag\", [\n// \"d\",\n// [\"\"]\n// ]],\n// [\"taga\", { attr: \"attr\", classes: [\"class\"] }, [\n// \"text\",\n// 123,\n// true\n// ]]\n// ];\n\n// const hml: Hsml = [\"xxx\", {}, [\n// \"types\", \" \", 1235.456, \" \", new Date(), \" \",\n// ...hsmls,\n// [\"t\", [\"t\", \"a\", \"\"]],\n// [\"t\", {}, [\"t\", \"a\", \"\"]],\n// [\"t\"]\n// ]];\n\n// console.log(hsmls, hml);\n\n// const hml1: Hsml = [\"div\", null, [\n// [\"span\", null, [\n// [\"a\",\n// {\n// href: \"https://gitlab.com/peter-rybar/diasheet\",\n// title: \"GitLab\",\n// target: \"_blank\"\n// },\n// [[\"i.fa.fa-gitlab\"]]\n// ]\n// ]],\n// [\"span\"]\n// ]];\n// console.log(hml1);\n\n// const hml2: Hsml = [\"div\", [\n// [\"h2\", [\"title\"]],\n// [\"div.w3-card-12\", [\n// [\"header.w3-container w3-light-grey\", [\n// [\"h3\", [\"Account: \", \"User\"]]\n// ]],\n// [\"div.w3-container.w3-light-grey\", [\n// [\"p\", [\"Balance: 4 DCT\"]],\n// [\"br\"]\n// ]],\n// [\"h4\", [\"Your account spending\"]],\n// [\"div#piechart\"],\n// [\"h4\", [\"Your account balance\"]],\n// [\"div#linechart\"],\n// [\"button.w3-button.w3-block.w3-dark-grey\", [\"Refresh\"]]\n// ]],\n// [\"br\"]\n// ]];\n// console.log(hml2);\n\n// TEST\n\n// import { hsmls2htmls } from \"./hsml-html\";\n// import { HDispatch } from \"./hsml-app\";\n\n// const dispatch: HDispatch = (type: string, data?: any, event?: Event): void => {\n// console.log(\"action:\", type, data, event);\n// };\n\n// const data = { attr: \"action-data\" };\n\n// const hmls: HElements = [\n// [\"button\", { on: [\"click\", \"action\", data] }, \"send\"],\n// [\"h1\", \"aaa\"],\n// [\"input\",\n// {\n// type: \"text\",\n// on: [\n// [\"mouseover\", \"hover-action\", data],\n// [\"change\", \"click-action\", e => (e.target as HTMLInputElement).value],\n// [\"click\", e => dispatch(\"action\", data, e)],\n// ],\n// click: e => dispatch(\"action\", data, e)\n// }\n// ],\n// [\"button\",\n// {\n// on: [\"click\", e => dispatch(\"action\", data, e)],\n// click: e => dispatch(\"action\", data, e)\n// },\n// [\"Send\"]\n// ]\n// ];\n\n// console.log(hsmls2htmls(hmls, true).join(\"\"));\n","module.exports = __WEBPACK_EXTERNAL_MODULE__1__;","import { HElement, HElements, HAttrOnData, HAttrOnDataFnc, HHandlerCtx } from \"./hsml\";\nimport { hsmls2idomPatch } from \"./hsml-idom\";\n\nconst log = console.log;\nconst err = console.error;\n\nexport type HView<STATE> = (state: STATE) => HElements;\nexport type HView1<STATE> = (state: STATE) => HElement;\n\nexport interface HAction {\n type: string;\n data?: any;\n event?: Event;\n}\n\nexport type HDispatch = (type: HAction[\"type\"],\n data?: HAction[\"data\"],\n event?: HAction[\"event\"]) => Promise<void>;\n\nexport type HUpdate = () => void;\n\nexport type HDispatcher<STATE> = (action: HAction, state: STATE, dispatch: HDispatch) => Promise<void>;\n\n// export type Class<T = object> = new (...args: any[]) => T;\n\n// export function happ<STATE>(state: STATE,\n// view: HView<STATE>,\n// dispatcher?: HDispatcher<STATE>,\n// element: Element | string | null = document.body) {\n// return new HApp<STATE>(state, view, dispatcher, element);\n// }\n\nexport enum HAppAction {\n _init = \"_init\",\n _mount = \"_mount\",\n _umount = \"_umount\",\n}\n\nconst schedule = window.requestAnimationFrame ||\n // window.webkitRequestAnimationFrame ||\n // (window as any).mozRequestAnimationFrame ||\n // (window as any).oRequestAnimationFrame ||\n // (window as any).msRequestAnimationFrame ||\n function (callback: Function) { window.setTimeout(callback, 1000 / 60); };\n\nconst unschedule = window.cancelAnimationFrame ||\n // window.webkitCancelAnimationFrame ||\n // (window as any).mozCancelAnimationFrame ||\n // (window as any).oCancelAnimationFrame ||\n // (window as any).msCancelAnimationFrame ||\n function (handle: number) { window.clearTimeout(handle); };\n\nconst msgAction = \"HApp action:\";\nconst msgDispatch = \"HApp dispatch:\";\nconst msgRender = \"HApp render:\";\nconst msgUpdate = \"HApp update:\";\n\nexport class HApp<STATE> implements HHandlerCtx {\n\n static debug = false;\n\n readonly state: STATE;\n readonly view: HView<STATE>;\n readonly dispatcher: HDispatcher<STATE>;\n\n readonly dom?: Element;\n readonly refs: { [key: string]: HTMLElement } = {};\n\n private _updateSched?: number;\n\n private _onUpdate?: (app: HApp<STATE>) => void;\n\n constructor(state: STATE, view: HView<STATE>, dispatcher?: HDispatcher<STATE>, e: Element | string | null = document.body) {\n this.state = state;\n this.view = view;\n this.dispatcher = dispatcher || (async (a) => log(msgAction, a.type, a.data));\n this.dispatch(HAppAction._init).then(() => this.mount(e));\n }\n\n dispatch: HDispatch = async (type: string, data?: any, event?: Event): Promise<void> => {\n if (HApp.debug) {\n log(msgAction, { type, data, event });\n const t0 = performance.now();\n try {\n await this.dispatcher({ type, data, event }, this.state, this.dispatch);\n this.update();\n } catch (e) {\n err(msgDispatch, e);\n }\n const t1 = performance.now();\n log(msgDispatch, `${t1 - t0} ms`, this.state);\n } else {\n try {\n await this.dispatcher({ type, data, event }, this.state, this.dispatch);\n this.update();\n } catch (e) {\n err(msgDispatch, e);\n }\n }\n }\n\n render = (): HElements => {\n if (HApp.debug) {\n const t0 = performance.now();\n let hsmls;\n try {\n hsmls = this.view(this.state);\n } catch (e) {\n err(msgRender, e);\n }\n const t1 = performance.now();\n log(msgRender, `${t1 - t0} ms`, hsmls);\n return hsmls || [];\n } else {\n let hsmls;\n try {\n hsmls = this.view(this.state);\n } catch (e) {\n err(msgRender, e);\n }\n return hsmls || [];\n }\n }\n\n actionCb = (action: string, data: HAttrOnData, event: Event): void => {\n data = (data && data.constructor === Function)\n ? (data as HAttrOnDataFnc)(event)\n : data;\n if (data === undefined && event) {\n data = formData(event);\n }\n this.dispatch(action, data, event);\n }\n\n mount = (e: Element | string | null = document.body): this => {\n const el = (typeof e === \"string\")\n ? document.getElementById(e) || document.body\n : e || document.body;\n if ((el as any).app) {\n const a = (el as any).app as HApp<STATE>;\n a.umount();\n }\n if (!this.dom) {\n (this as any).dom = el;\n (el as any).app = this;\n const hsmls = (this as any).render();\n updateDom(el, hsmls, this);\n this._onUpdate && this._onUpdate(this);\n this.dispatch(HAppAction._mount, this.dom);\n }\n return this;\n }\n\n umount = (): this => {\n if (this.dom) {\n this.dispatch(HAppAction._umount, this.dom);\n if (this.dom.hasAttribute(\"app\")) {\n this.dom.removeAttribute(\"app\");\n }\n const aNodes = this.dom.querySelectorAll(\"[app]\");\n for (let i = 0; i < aNodes.length; i++) {\n const a = (aNodes[i] as any).app as HApp<STATE>;\n a && a.umount();\n }\n while (this.dom.firstChild /*.hasChildNodes()*/) {\n this.dom.removeChild(this.dom.firstChild);\n }\n delete (this.dom as any).app;\n (this as any).dom = undefined;\n }\n return this;\n }\n\n update = (): this => {\n if (this.dom && !this._updateSched) {\n this._updateSched = schedule(() => {\n if (this.dom) {\n const hsmls = this.render();\n updateDom(this.dom, hsmls, this);\n }\n this._updateSched = undefined;\n this._onUpdate && this._onUpdate(this);\n });\n }\n return this;\n }\n\n onUpdate = (cb: (app: HApp<STATE>) => void): this => {\n this._onUpdate = cb;\n return this;\n }\n\n toHsml = (): HElement => {\n if (this.dom) {\n if (this._updateSched) {\n unschedule(this._updateSched);\n this._updateSched = undefined;\n } else {\n return [\"div\", { _skip: true }];\n }\n }\n const hsmls = this.render();\n hsmls.push(\n (e: Element) => {\n if (!this.dom) {\n (this as any).dom = e;\n (e as any).app = this;\n this.dispatch(HAppAction._mount, this.dom);\n }\n });\n return [\"div\", hsmls];\n }\n\n toHtml = (): string => {\n return this.dom ? this.dom.outerHTML : \"\";\n }\n\n}\n\nfunction updateDom(el: Element, hsml: HElements, ctx: HHandlerCtx): void {\n if (HApp.debug) {\n const t0 = performance.now();\n hsmls2idomPatch(el, hsml, ctx);\n const t1 = performance.now();\n log(msgUpdate, `${t1 - t0} ms`, el);\n } else {\n hsmls2idomPatch(el, hsml, ctx);\n }\n}\n\nfunction formData(e: Event): { [k: string]: string | number | boolean | null | Array<string | null> } | string | number | boolean | null | Array<string | null> {\n const el = e.target as HTMLElement;\n switch (el.nodeName) {\n case \"FORM\":\n (e as Event).preventDefault();\n const els = (el as HTMLFormElement).elements;\n const data = {} as { [k: string]: string | null | Array<string | null> };\n for (let i = 0; i < els.length; i++) {\n const d = formInputData(els[i]);\n if (typeof d === \"object\") {\n const names = Object.keys(d as object);\n if (names.length) {\n const name = names[0];\n const value = (d as any)[name];\n if (data[name] === undefined) {\n data[name] = value;\n } else if (typeof data[name] === \"string\" || data[name] instanceof String) {\n if (value instanceof Array) {\n data[name] = [data[name] as string, ...value];\n } else {\n data[name] = [data[name] as string, value as string];\n }\n } else if (data[name] instanceof Array) {\n if (value instanceof Array) {\n data[name] = (data[name] as Array<string | null>).concat(value);\n } else {\n (data[name] as Array<string | null>).push(value);\n }\n } else {\n if (value instanceof Array) {\n data[name] = [data[name] as string, ...value];\n } else {\n data[name] = [data[name] as string, value];\n }\n }\n if (data[name] instanceof Array) {\n data[name] = (data[name] as Array<string | null>)\n .filter(d => d !== null);\n if ((els[i] as HTMLInputElement).type === \"radio\") {\n data[name] = (data[name] as Array<string | null>).length\n ? (data[name] as Array<string | null>)[0]\n : null;\n }\n }\n }\n }\n }\n return data;\n default:\n return formInputData(el);\n }\n}\n\nfunction formInputData(el: Element): { [k: string]: string | string[] | null } | string | string[] | number | boolean | null {\n let data: { [k: string]: string | string[] | null } | string | string[] | number | boolean | null = null;\n switch (el.nodeName) {\n case \"INPUT\":\n const iel = el as HTMLInputElement;\n switch (iel.type) {\n case \"text\":\n case \"hidden\":\n case \"password\":\n case \"email\":\n case \"number\":\n case \"search\":\n case \"url\":\n case \"tel\":\n case \"color\":\n case \"date\":\n case \"datetime-local\":\n case \"month\":\n case \"range\":\n case \"time\":\n case \"week\":\n case \"submit\":\n case \"button\":\n if (iel.name) {\n data = { [iel.name]: iel.value };\n } else {\n data = iel.value;\n }\n break;\n case \"radio\":\n if (iel.name) {\n data = { [iel.name]: iel.checked ? iel.value : null };\n } else {\n data = iel.checked ? iel.value : null;\n }\n break;\n case \"checkbox\":\n if (iel.value === \"on\") { // value not set in element\n if (iel.name) {\n data = { [iel.name]: String(iel.checked) };\n } else {\n data = String(iel.checked);\n }\n } else {\n if (iel.name) {\n data = { [iel.name]: iel.checked\n ? String(iel.value)\n : null };\n } else {\n data = iel.checked\n ? String(iel.value)\n : null;\n }\n }\n break;\n }\n break;\n case \"SELECT\":\n const sel = el as HTMLSelectElement;\n if (sel.multiple) {\n const values = Array.from(sel.selectedOptions).map(o => o.value);\n if (sel.name) {\n data = { [sel.name]: values };\n } else {\n data = values;\n }\n } else {\n if (sel.name) {\n data = { [sel.name]: sel.value };\n } else {\n data = sel.value;\n }\n }\n break;\n case \"TEXTAREA\":\n const tel = el as HTMLTextAreaElement;\n if (tel.name) {\n data = { [tel.name]: tel.value };\n } else {\n data = tel.value;\n }\n break;\n case \"BUTTON\":\n const bel = el as HTMLButtonElement;\n if (bel.name) {\n data = { [bel.name]: bel.value };\n } else {\n data = bel.value;\n }\n break;\n }\n return data;\n}\n\n// export const formInputData = <STATE>(dispatcher: Actions<STATE>): Actions<STATE> =>\n// (app: App<STATE>, action: string | number, data?: any, event?: Event): void => {\n// if (data === undefined && event) {\n// data = inputEventData(event);\n// }\n// dispatcher(app, action, data, event);\n// };\n\n// // Decorator\n// export function FormInputData() {\n// return function (target: any, propertyKey: string, descriptor: PropertyDescriptor) {\n// const method = descriptor.value;\n// descriptor.value = formInputData(method);\n// return descriptor;\n// };\n// }\n","import {\n hsml,\n HElement,\n HElements,\n HHead,\n HAttrs,\n HAttrClasses,\n HAttrData,\n HAttrStyles,\n HAttrOn,\n HAttrOnCb,\n HAttrOnAct,\n HAttrOnAction,\n HAttrOnData,\n HFnc,\n HObj,\n HHandler,\n HHandlerCtx\n} from \"./hsml\";\nimport * as idom from \"incremental-dom\";\n\n// function setBoolAttrProp(el: any, attr: string, value: any) {\n// // console.log(\"idom.attributes\", attr, value, typeof value, el);\n// if (typeof value === \"string\") {\n// let b;\n// switch (value) {\n// case \"true\":\n// case \"1\":\n// case \"on\":\n// case \"yes\":\n// b = true;\n// break;\n// default:\n// b = false;\n// }\n// if (b) {\n// el.setAttribute(attr, value);\n// } else {\n// el.removeAttribute(attr);\n// }\n// el[attr] = b;\n// } else if (typeof value === \"boolean\") {\n// if (value) {\n// el.setAttribute(attr, \"\");\n// } else {\n// el.removeAttribute(attr);\n// }\n// el[attr] = value;\n// } else {\n// if (value) {\n// el.setAttribute(attr, value ? value : \"\");\n// } else {\n// el.removeAttribute(attr);\n// }\n// }\n// }\n\n// const boolAttrProps = [\n// \"readonly\",\n// \"disabled\",\n// \"checked\",\n// \"value\"\n// ];\n\n// boolAttrProps.forEach(a => idom.attributes[a] = setBoolAttrProp);\n\nclass HsmlIDomHandler implements HHandler<HHandlerCtx> {\n\n open(tag: HHead, attrs: HAttrs, children: HElements, ctx?: HHandlerCtx): boolean {\n const props: any[] = [];\n let id = attrs._id;\n let classes: string[] = attrs._classes ? attrs._classes : [];\n let ref = attrs._ref;\n let hObj: any = attrs._hObj;\n for (const a in attrs) {\n if (attrs.hasOwnProperty(a)) {\n switch (a) {\n case \"_id\":\n case \"_classes\":\n case \"_ref\":\n case \"_key\":\n case \"_skip\":\n case \"_hObj\":\n break;\n case \"id\":\n id = attrs[a] as string;\n break;\n case \"classes\":\n const attrClasses = attrs[a] as HAttrClasses;\n classes = classes.concat(attrClasses\n ? attrClasses\n .map(c =>\n c.constructor === String\n ? c as string\n : (c[1] ? c[0] as string : undefined))\n .filter((c): c is string => c !== undefined)\n : [] as string[]);\n break;\n case \"class\":\n classes = classes.concat((attrs[a] as string).split(\" \"));\n break;\n case \"data\":\n const attrData = attrs[a] as HAttrData;\n for (const d in attrData) {\n if (attrData.hasOwnProperty(d)) {\n if (attrData[d].constructor === String) {\n props.push(\"data-\" + d, attrData[d]);\n } else {\n props.push(\"data-\" + d, JSON.stringify(attrData[d]));\n }\n }\n }\n break;\n case \"styles\":\n props.push(\"style\", attrs[a] as HAttrStyles);\n break;\n case \"on\":\n const attrOn = attrs[a] as HAttrOn;\n if (typeof attrOn[0] === \"string\") {\n if (typeof attrOn[1] === \"function\") {\n props.push(\"on\" + attrOn[0], attrOn[1]);\n } else {\n props.push(\"on\" + attrOn[0], (e: Event) => {\n ctx && ctx.actionCb &&\n typeof ctx.actionCb === \"function\" &&\n ctx.actionCb(attrOn[1] as HAttrOnAction,\n attrOn[2] as HAttrOnData,\n e);\n });\n }\n } else {\n (attrOn as Array<HAttrOnCb | HAttrOnAct>)\n .forEach(attr => {\n if (typeof attr[1] === \"function\") {\n props.push(\"on\" + attr[0], attr[1]);\n } else {\n props.push(\"on\" + attr[0], (e: Event) => {\n ctx && ctx.actionCb &&\n typeof ctx.actionCb === \"function\" &&\n ctx.actionCb(attr[1] as HAttrOnAction,\n attr[2] as HAttrOnData,\n e);\n });\n }\n });\n }\n break;\n default:\n // http://google.github.io/incremental-dom/#attributes-and-properties\n switch (typeof attrs[a]) {\n case \"function\":\n props.push(\"on\" + a, attrs[a]);\n break;\n case \"object\":\n // console.log(\"---\", a, typeof attrs[a], attrs[a]);\n // console.log(\"---String \", attrs[a] instanceof String);\n // console.log(\"---Boolean\", attrs[a] instanceof Boolean);\n // console.log(\"---Number \", attrs[a] instanceof Number);\n props.push(a, attrs[a]);\n break;\n // case \"boolean\":\n // if (boolAttrProps.includes(a)) {\n // props.push(a, attrs[a]);\n // } else {\n // attrs[a] && props.push(a, a);\n // }\n // break;\n case \"boolean\":\n attrs[a] && props.push(a, a);\n break;\n default:\n props.push(a, attrs[a]);\n break;\n }\n }\n }\n }\n if (classes.length) {\n props.unshift(\"class\", classes.join(\" \"));\n }\n if (id) {\n props.unshift(\"id\", id);\n }\n idom.elementOpen(tag, attrs._key, undefined, ...props);\n if (attrs._skip) {\n idom.skip();\n }\n if (ctx && ref) {\n ctx.refs[ref] = idom.currentElement();\n }\n if (hObj && hObj.mount && hObj.mount.constructor === Function) {\n hObj.mount(idom.currentElement());\n idom.skip();\n }\n return attrs._skip ? true : false;\n }\n\n close(tag: HHead, children: HElements, ctx?: HHandlerCtx): void {\n idom.elementClose(tag);\n }\n\n text(text: string, ctx?: HHandlerCtx): void {\n idom.text(text);\n }\n\n fnc(fnc: HFnc, ctx?: HHandlerCtx): void {\n const skip = fnc(idom.currentElement());\n skip && idom.skip();\n }\n\n obj(obj: HObj, ctx?: HHandlerCtx): void {\n if (\"toHsml\" in obj) {\n obj.toHsml && hsml(obj.toHsml(), this, obj as HHandlerCtx);\n } else {\n this.text(\"\" + obj, ctx);\n }\n }\n\n}\n\nfunction hsml2idom(hml: HElement, ctx?: HHandlerCtx): void {\n hsml(hml, new HsmlIDomHandler(), ctx);\n}\n\nfunction hsmls2idom(hmls: HElements, ctx?: HHandlerCtx): void {\n for (const hml of hmls) {\n if (hml === undefined || hml === null) {\n continue;\n }\n if (hml.constructor === String) {\n idom.text(hml as string);\n } else if (\"toHsml\" in (hml as any)) {\n const obj = hml as HHandlerCtx;\n obj.toHsml && hsml2idom(obj.toHsml(), obj);\n } else {\n hsml2idom(hml as HElement, ctx);\n }\n }\n}\n\nexport function hsml2idomPatch(node: Element, hsmlEl: HElement, ctx?: HHandlerCtx): void {\n idom.patch(node,\n (data?: HElement) => (data && hsml2idom(data, ctx)), hsmlEl);\n}\n\nexport function hsmls2idomPatch(node: Element, hsmlFr: HElements, ctx?: HHandlerCtx): void {\n idom.patch(node,\n (data?: HElements) => (data && hsmls2idom(data, ctx)), hsmlFr);\n}\n"],"sourceRoot":""}
1
+ {"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap","webpack:///./src/hsml.ts","webpack:///external \"IncrementalDOM\"","webpack:///./src/hsml-app.ts","webpack:///./src/hsml-idom.ts"],"names":["root","factory","exports","module","require","define","amd","a","i","window","__WEBPACK_EXTERNAL_MODULE__1__","installedModules","__webpack_require__","moduleId","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","NBSP","hsml","hml","handler","ctx","constructor","Array","hmlTag","console","error","head","attrsObj","hasAttrs","hFnc","hObj","children","htc","Function","String","Boolean","Number","Date","refSplit","split","ref","dotSplit","hashSplit","tag","id","classes","slice","attrs","_id","length","_classes","_ref","_hObj","skip","open","fnc","forEach","jml","close","hsmlTag","text","toLocaleString","toString","ds","obj","hsmls","sep","reduce","push","splice","log","err","HAppAction","schedule","requestAnimationFrame","callback","setTimeout","unschedule","cancelAnimationFrame","handle","clearTimeout","HApp","state","view","dispatcher","e","document","body","refs","dispatch","type","data","event","debug","t0","performance","now","this","update","t1","render","actionCb","action","undefined","el","target","nodeName","preventDefault","els","elements","formInputData","names","keys","concat","filter","formData","mount","getElementById","app","umount","dom","updateDom","_onUpdate","_mount","_umount","hasAttribute","removeAttribute","aNodes","querySelectorAll","firstChild","removeChild","_updateSched","onUpdate","cb","toHsml","_skip","toHtml","outerHTML","_init","then","hsmls2idomPatch","iel","checked","sel","multiple","values","from","selectedOptions","map","tel","bel","HsmlIDomHandler","props","attrClasses","attrData","JSON","stringify","attrOn","attr","unshift","join","idom","elementOpen","_key","currentElement","elementClose","hsml2idom","node","hsmlEl","patch","hsmlFr","hmls","hsmls2idom"],"mappings":"CAAA,SAA2CA,EAAMC,GAChD,GAAsB,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,EAAQG,QAAQ,wBAC7B,GAAqB,mBAAXC,QAAyBA,OAAOC,IAC9CD,OAAO,CAAC,kBAAmBJ,OACvB,CACJ,IAAIM,EAAuB,iBAAZL,QAAuBD,EAAQG,QAAQ,mBAAqBH,EAAQD,EAAqB,gBACxG,IAAI,IAAIQ,KAAKD,GAAuB,iBAAZL,QAAuBA,QAAUF,GAAMQ,GAAKD,EAAEC,IAPxE,CASGC,QAAQ,SAASC,GACpB,O,YCTE,IAAIC,EAAmB,GAGvB,SAASC,EAAoBC,GAG5B,GAAGF,EAAiBE,GACnB,OAAOF,EAAiBE,GAAUX,QAGnC,IAAIC,EAASQ,EAAiBE,GAAY,CACzCL,EAAGK,EACHC,GAAG,EACHZ,QAAS,IAUV,OANAa,EAAQF,GAAUG,KAAKb,EAAOD,QAASC,EAAQA,EAAOD,QAASU,GAG/DT,EAAOW,GAAI,EAGJX,EAAOD,QA0Df,OArDAU,EAAoBK,EAAIF,EAGxBH,EAAoBM,EAAIP,EAGxBC,E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aAAa1H,GAGtB,KAAKiB,EAAcxC,GACf6I,EAAKrG,KAAKA,GAGd,IAAIL,EAAWnC,GACEmC,EAAI0G,EAAKG,mBACdH,EAAK5G,OAGjB,IAAIW,EAAW5C,GACP,WAAY4C,EACZA,EAAIsE,QAAU,EAAArH,KAAK+C,EAAIsE,SAAUrC,KAAMjC,GAEvCiC,KAAKrC,KAAK,GAAKI,EAAK5C,IAMhC,SAASkJ,EAAUpJ,EAAeE,GAC9B,EAAAH,KAAKC,EAAK,IAAIqI,EAAmBnI,GAmBrC,0BAA+BmJ,EAAeC,EAAkBpJ,GAC5D6I,EAAKQ,MAAMF,EACN5E,GAAqBA,GAAQ2E,EAAU3E,EAAMvE,GAAOoJ,IAG7D,2BAAgCD,EAAeG,EAAmBtJ,GAC9D6I,EAAKQ,MAAMF,EACN5E,GAAsBA,GAvB/B,SAAoBgF,EAAiBvJ,GACjC,IAAK,MAAMF,KAAOyJ,EACd,GAAIzJ,QAGJ,GAAIA,EAAIG,cAAgBa,OACpB+H,EAAKrG,KAAK1C,QACP,GAAI,WAAaA,EAAa,CACjC,MAAM8C,EAAM9C,EACZ8C,EAAIsE,QAAUgC,EAAUtG,EAAIsE,SAAUtE,QAEtCsG,EAAUpJ,EAAiBE,GAYAwJ,CAAWjF,EAAMvE,GAAOsJ","file":"hsml-app.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"IncrementalDOM\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"IncrementalDOM\"], factory);\n\telse {\n\t\tvar a = typeof exports === 'object' ? factory(require(\"IncrementalDOM\")) : factory(root[\"IncrementalDOM\"]);\n\t\tfor(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];\n\t}\n})(window, function(__WEBPACK_EXTERNAL_MODULE__1__) {\nreturn "," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 12);\n","\nexport type HHead = keyof HTMLElementTagNameMap | string; // \"tag#id.class1.class2~handler\"\n\nexport type HAttrClasses = Array<string | [string, boolean]>;\n\nexport type HAttrStyles = { [key: string]: string };\n\nexport type HAttrData = {\n [key: string]:\n | string\n | String\n | number\n | Number\n | boolean\n | Boolean\n | Date\n | Array<any>\n | Object;\n};\n\nexport type HAttrOnAction = string;\n\nexport type HAttrOnDataFnc = (e: Event) => any;\n\nexport type HAttrOnData =\n | string\n | String\n | number\n | Number\n | boolean\n | Boolean\n | Date\n | Array<any>\n | Object\n | HAttrOnDataFnc\n | null;\n\nexport type HAttrOnCb = [keyof HTMLElementEventMap, EventListener];\n\nexport type HAttrOnAct = [\n keyof HTMLElementEventMap,\n HAttrOnAction,\n HAttrOnData?\n];\n\nexport type HAttrOn = HAttrOnCb | HAttrOnAct | Array<HAttrOnCb | HAttrOnAct>;\n\nexport interface HAttrs {\n readonly _id?: string;\n readonly _classes?: string[];\n readonly _ref?: string;\n readonly _key?: string;\n readonly _skip?: boolean;\n readonly _hObj?: HObj;\n readonly classes?: HAttrClasses;\n readonly styles?: HAttrStyles;\n readonly data?: HAttrData;\n readonly on?: HAttrOn;\n readonly [key: string]:\n | string\n | String\n | string[]\n | String[]\n | number\n | Number\n | boolean\n | Boolean\n | Date\n | HAttrClasses\n | HAttrStyles\n // | HsmlAttrData\n | HAttrOn\n | EventListener\n | HObj\n | undefined;\n}\n\nexport type HFnc = (e: Element) => boolean | void;\n\nexport interface HObj {\n toHsml?(): HElement;\n}\n\nexport interface HElements extends Array<HElement> {}\n\nexport type HChildren =\n | HElements\n | HFnc\n | HObj\n | string\n | String\n | boolean\n | Boolean\n | number\n | Number\n | Date\n | undefined\n | null;\n\nexport type HTagNoAttr = [HHead, HChildren?];\nexport type HTagAttr = [HHead, HAttrs, HChildren?];\n\nexport type HTag = HTagNoAttr | HTagAttr;\n\nexport type HElement =\n | HFnc\n | HObj\n | HTag\n | string\n | String\n | boolean\n | Boolean\n | number\n | Number\n | Date\n | undefined\n | null;\n\nexport interface HHandlerCtx extends HObj {\n refs: { [name: string]: Element };\n actionCb(action: HAttrOnAction, data: HAttrOnData, e: Event): void;\n}\n\nexport interface HHandler<C extends HHandlerCtx> {\n open(tag: HHead, attrs: HAttrs, children: HElements, ctx?: C): boolean;\n close(tag: HHead, children: HElements, ctx?: C): void;\n text(text: string, ctx?: C): void;\n fnc(fnc: HFnc, ctx?: C): void;\n obj(obj: HObj, ctx?: C): void;\n}\n\nexport const NBSP = \"\\u00a0 \";\n\nexport function hsml<C extends HHandlerCtx>(hml: HElement,\n handler: HHandler<C>,\n ctx?: C): void {\n // console.log(\"hsml\", hsml);\n if (hml === undefined || hml === null) {\n return;\n }\n switch (hml.constructor) {\n case Array:\n // const tag = hml as HTag;\n // if (\n // (\n // tag.length === 1 &&\n // tag[0].constructor === String\n // ) ||\n // (\n // tag.length === 2 &&\n // (\n // tag[0].constructor === String &&\n // (tag[1]!.constructor === Array || tag[1]!.constructor === Function)\n // ) ||\n // (\n // tag[0].constructor === String &&\n // tag[1]!.constructor === Object\n // )\n // ) ||\n // (\n // tag.length === 3 &&\n // tag[0].constructor === String &&\n // tag[1].constructor === Object &&\n // tag[2]!.constructor === Array\n // )\n // ) {\n // hsmlTag(hml as HTag, handler, ctx);\n // } else {\n // console.error(\"hsml parse error:\", hml);\n // // console.error(\"hsml parse error:\", JSON.stringify(hml, null, 4));\n // // throw Error(`hsml parse error: ${JSON.stringify(hml)}`);\n // }\n hsmlTag(hml as HTag, handler, ctx);\n break;\n case Function:\n handler.fnc(hml as HFnc, ctx);\n break;\n case String:\n handler.text(hml as string, ctx);\n break;\n case Boolean:\n handler.text(\"\" + hml, ctx);\n break;\n case Number:\n const n = hml as number;\n const ns = n.toLocaleString ? n.toLocaleString() : n.toString();\n handler.text(ns, ctx);\n break;\n case Date:\n const d = hml as Date;\n const ds = d.toLocaleString ? d.toLocaleString() : d.toString();\n handler.text(ds, ctx);\n break;\n default: // HObj\n handler.obj(hml as HObj, ctx);\n }\n\n function hsmlTag(hmlTag: HTag, handler: HHandler<C>, ctx?: C): void {\n // console.log(\"hsml tag\", hmlTag);\n\n if (typeof hmlTag[0] !== \"string\") {\n console.error(\"HSML tag head not string:\", hmlTag);\n return;\n }\n\n const head = hmlTag[0] as HHead;\n const attrsObj = hmlTag[1] as any;\n const hasAttrs = attrsObj && attrsObj.constructor === Object;\n const childIdx = hasAttrs ? 2 : 1;\n\n let children: HElements = [];\n let hFnc: HFnc | undefined;\n let hObj: HObj | undefined;\n\n const htc = hmlTag[childIdx];\n switch (htc != null && htc.constructor) { // switch ((typeof htc !== \"undefined\" || htc !== null) && htc.constructor) {\n case Array:\n children = htc as HElements;\n break;\n case Function:\n hFnc = htc as HFnc;\n break;\n case String:\n case Boolean:\n case Number:\n case Date:\n children = [htc as string | boolean | number | Date];\n break;\n default: // HObj\n hObj = htc as HObj;\n break;\n }\n\n const refSplit = head.split(\"~\");\n const ref = refSplit[1];\n const dotSplit = refSplit[0].split(\".\");\n const hashSplit = dotSplit[0].split(\"#\");\n const tag = hashSplit[0] || \"div\";\n const id = hashSplit[1];\n const classes = dotSplit.slice(1);\n\n let attrs: HAttrs;\n if (hasAttrs) {\n attrs = attrsObj as HAttrs;\n } else {\n attrs = {} as HAttrs;\n }\n\n if (id) {\n (attrs as any)._id = id;\n }\n if (classes.length) {\n (attrs as any)._classes = classes;\n }\n if (ref) {\n (attrs as any)._ref = ref;\n }\n if (hObj) {\n (attrs as any)._hObj = hObj;\n }\n\n const skip = handler.open(tag, attrs, children, ctx);\n\n if (hFnc) {\n handler.fnc(hFnc, ctx);\n }\n\n if (!skip) {\n children.forEach(jml => hsml(jml, handler, ctx));\n }\n\n handler.close(tag, children, ctx);\n }\n}\n\nexport function hjoin(hsmls: HElements, sep: string | HElement): HElements {\n const r = hsmls.reduce<HElements>(\n (p, c) => (p.push(c, sep), p),\n [] as HElements\n );\n r.splice(-1);\n return r;\n}\n\n// Test\n\n// const hsmls: Hsmls = [\n// \"text\",\n// [\"tag\", [\n// \"d\",\n// [\"\"]\n// ]],\n// [\"taga\", { attr: \"attr\", classes: [\"class\"] }, [\n// \"text\",\n// 123,\n// true\n// ]]\n// ];\n\n// const hml: Hsml = [\"xxx\", {}, [\n// \"types\", \" \", 1235.456, \" \", new Date(), \" \",\n// ...hsmls,\n// [\"t\", [\"t\", \"a\", \"\"]],\n// [\"t\", {}, [\"t\", \"a\", \"\"]],\n// [\"t\"]\n// ]];\n\n// console.log(hsmls, hml);\n\n// const hml1: Hsml = [\"div\", null, [\n// [\"span\", null, [\n// [\"a\",\n// {\n// href: \"https://gitlab.com/peter-rybar/diasheet\",\n// title: \"GitLab\",\n// target: \"_blank\"\n// },\n// [[\"i.fa.fa-gitlab\"]]\n// ]\n// ]],\n// [\"span\"]\n// ]];\n// console.log(hml1);\n\n// const hml2: Hsml = [\"div\", [\n// [\"h2\", [\"title\"]],\n// [\"div.w3-card-12\", [\n// [\"header.w3-container w3-light-grey\", [\n// [\"h3\", [\"Account: \", \"User\"]]\n// ]],\n// [\"div.w3-container.w3-light-grey\", [\n// [\"p\", [\"Balance: 4 DCT\"]],\n// [\"br\"]\n// ]],\n// [\"h4\", [\"Your account spending\"]],\n// [\"div#piechart\"],\n// [\"h4\", [\"Your account balance\"]],\n// [\"div#linechart\"],\n// [\"button.w3-button.w3-block.w3-dark-grey\", [\"Refresh\"]]\n// ]],\n// [\"br\"]\n// ]];\n// console.log(hml2);\n\n// TEST\n\n// import { hsmls2htmls } from \"./hsml-html\";\n// import { HDispatch } from \"./hsml-app\";\n\n// const dispatch: HDispatch = (type: string, data?: any, event?: Event): void => {\n// console.log(\"action:\", type, data, event);\n// };\n\n// const data = { attr: \"action-data\" };\n\n// const hmls: HElements = [\n// [\"button\", { on: [\"click\", \"action\", data] }, \"send\"],\n// [\"h1\", \"aaa\"],\n// [\"input\",\n// {\n// type: \"text\",\n// on: [\n// [\"mouseover\", \"hover-action\", data],\n// [\"change\", \"click-action\", e => (e.target as HTMLInputElement).value],\n// [\"click\", e => dispatch(\"action\", data, e)],\n// ],\n// click: e => dispatch(\"action\", data, e)\n// }\n// ],\n// [\"button\",\n// {\n// on: [\"click\", e => dispatch(\"action\", data, e)],\n// click: e => dispatch(\"action\", data, e)\n// },\n// [\"Send\"]\n// ]\n// ];\n\n// console.log(hsmls2htmls(hmls, true).join(\"\"));\n","module.exports = __WEBPACK_EXTERNAL_MODULE__1__;","import { HElement, HElements, HAttrOnData, HAttrOnDataFnc, HHandlerCtx } from \"./hsml\";\nimport { hsmls2idomPatch } from \"./hsml-idom\";\n\nconst log = console.log;\nconst err = console.error;\n\nexport type HView<STATE> = (state: STATE) => HElements;\nexport type HView1<STATE> = (state: STATE) => HElement;\n\nexport interface HAction {\n type: string;\n data?: any;\n event?: Event;\n}\n\nexport type HDispatch = (type: HAction[\"type\"],\n data?: HAction[\"data\"],\n event?: HAction[\"event\"]) => Promise<void>;\n\nexport type HUpdate = () => void;\n\nexport type HRefs<STATE> = HApp<STATE>[\"refs\"];\n\nexport type HDispatcher<STATE> = (this: HApp<any>, action: HAction, state: STATE, dispatch: HDispatch, refs: HRefs<STATE>) => Promise<void>;\n\n// export type Class<T = object> = new (...args: any[]) => T;\n\n// export function happ<STATE>(state: STATE,\n// view: HView<STATE>,\n// dispatcher?: HDispatcher<STATE>,\n// element: Element | string | null = document.body) {\n// return new HApp<STATE>(state, view, dispatcher, element);\n// }\n\nexport enum HAppAction {\n _init = \"_init\",\n _mount = \"_mount\",\n _umount = \"_umount\",\n}\n\nconst schedule = window.requestAnimationFrame ||\n // window.webkitRequestAnimationFrame ||\n // (window as any).mozRequestAnimationFrame ||\n // (window as any).oRequestAnimationFrame ||\n // (window as any).msRequestAnimationFrame ||\n function (callback: Function) { window.setTimeout(callback, 1000 / 60); };\n\nconst unschedule = window.cancelAnimationFrame ||\n // window.webkitCancelAnimationFrame ||\n // (window as any).mozCancelAnimationFrame ||\n // (window as any).oCancelAnimationFrame ||\n // (window as any).msCancelAnimationFrame ||\n function (handle: number) { window.clearTimeout(handle); };\n\nconst msgAction = \"HApp action:\";\nconst msgDispatch = \"HApp dispatch:\";\nconst msgRender = \"HApp render:\";\nconst msgUpdate = \"HApp update:\";\n\nexport class HApp<STATE> implements HHandlerCtx {\n\n static debug = false;\n\n readonly state: STATE;\n readonly view: HView<STATE>;\n readonly dispatcher: HDispatcher<STATE>;\n\n readonly dom?: Element;\n readonly refs: { [key: string]: HTMLElement } = {};\n\n private _updateSched?: number;\n\n private _onUpdate?: (app: HApp<STATE>) => void;\n\n constructor(state: STATE, view: HView<STATE>, dispatcher?: HDispatcher<STATE>, e: Element | string | null = document.body) {\n this.state = state;\n this.view = view;\n this.dispatcher = dispatcher || (async (a) => log(msgAction, a.type, a.data));\n this.dispatch(HAppAction._init, this).then(() => this.mount(e));\n }\n\n dispatch: HDispatch = async (type: string, data?: any, event?: Event): Promise<void> => {\n if (HApp.debug) {\n log(msgAction, { type, data, event });\n const t0 = performance.now();\n try {\n await this.dispatcher({ type, data, event }, this.state, this.dispatch, this.refs);\n this.update();\n } catch (e) {\n err(msgDispatch, e);\n }\n const t1 = performance.now();\n log(msgDispatch, `${t1 - t0} ms`, this.state);\n } else {\n try {\n await this.dispatcher({ type, data, event }, this.state, this.dispatch, this.refs);\n this.update();\n } catch (e) {\n err(msgDispatch, e);\n }\n }\n }\n\n render = (): HElements => {\n if (HApp.debug) {\n const t0 = performance.now();\n let hsmls;\n try {\n hsmls = this.view(this.state);\n } catch (e) {\n err(msgRender, e);\n }\n const t1 = performance.now();\n log(msgRender, `${t1 - t0} ms`, hsmls);\n return hsmls || [];\n } else {\n let hsmls;\n try {\n hsmls = this.view(this.state);\n } catch (e) {\n err(msgRender, e);\n }\n return hsmls || [];\n }\n }\n\n actionCb = (action: string, data: HAttrOnData, event: Event): void => {\n data = (data && data.constructor === Function)\n ? (data as HAttrOnDataFnc)(event)\n : data;\n if (data === undefined && event) {\n data = formData(event);\n }\n this.dispatch(action, data, event);\n }\n\n mount = (e: Element | string | null = document.body): this => {\n const el = (typeof e === \"string\")\n ? document.getElementById(e) || document.body\n : e || document.body;\n if ((el as any).app) {\n const a = (el as any).app as HApp<STATE>;\n a.umount();\n }\n if (!this.dom) {\n (this as any).dom = el;\n (el as any).app = this;\n const hsmls = (this as any).render();\n updateDom(el, hsmls, this);\n this._onUpdate && this._onUpdate(this);\n this.dispatch(HAppAction._mount, this.dom);\n }\n return this;\n }\n\n umount = (): this => {\n if (this.dom) {\n this.dispatch(HAppAction._umount, this.dom);\n if (this.dom.hasAttribute(\"app\")) {\n this.dom.removeAttribute(\"app\");\n }\n const aNodes = this.dom.querySelectorAll(\"[app]\");\n for (let i = 0; i < aNodes.length; i++) {\n const a = (aNodes[i] as any).app as HApp<STATE>;\n a && a.umount();\n }\n while (this.dom.firstChild /*.hasChildNodes()*/) {\n this.dom.removeChild(this.dom.firstChild);\n }\n delete (this.dom as any).app;\n (this as any).dom = undefined;\n }\n return this;\n }\n\n update = (): this => {\n if (this.dom && !this._updateSched) {\n this._updateSched = schedule(() => {\n if (this.dom) {\n const hsmls = this.render();\n updateDom(this.dom, hsmls, this);\n }\n this._updateSched = undefined;\n this._onUpdate && this._onUpdate(this);\n });\n }\n return this;\n }\n\n onUpdate = (cb: (app: HApp<STATE>) => void): this => {\n this._onUpdate = cb;\n return this;\n }\n\n toHsml = (): HElement => {\n if (this.dom) {\n if (this._updateSched) {\n unschedule(this._updateSched);\n this._updateSched = undefined;\n } else {\n return [\"div\", { _skip: true }];\n }\n }\n const hsmls = this.render();\n hsmls.push(\n (e: Element) => {\n if (!this.dom) {\n (this as any).dom = e;\n (e as any).app = this;\n this.dispatch(HAppAction._mount, this.dom);\n }\n });\n return [\"div\", hsmls];\n }\n\n toHtml = (): string => {\n return this.dom ? this.dom.outerHTML : \"\";\n }\n\n}\n\nfunction updateDom(el: Element, hsml: HElements, ctx: HHandlerCtx): void {\n if (HApp.debug) {\n const t0 = performance.now();\n hsmls2idomPatch(el, hsml, ctx);\n const t1 = performance.now();\n log(msgUpdate, `${t1 - t0} ms`, el);\n } else {\n hsmls2idomPatch(el, hsml, ctx);\n }\n}\n\nfunction formData(e: Event): { [k: string]: string | number | boolean | null | Array<string | null> } | string | number | boolean | null | Array<string | null> {\n const el = e.target as HTMLElement;\n switch (el.nodeName) {\n case \"FORM\":\n (e as Event).preventDefault();\n const els = (el as HTMLFormElement).elements;\n const data = {} as { [k: string]: string | null | Array<string | null> };\n for (let i = 0; i < els.length; i++) {\n const d = formInputData(els[i]);\n if (typeof d === \"object\") {\n const names = Object.keys(d as object);\n if (names.length) {\n const name = names[0];\n const value = (d as any)[name];\n if (data[name] === undefined) {\n data[name] = value;\n } else if (typeof data[name] === \"string\" || data[name] instanceof String) {\n if (value instanceof Array) {\n data[name] = [data[name] as string, ...value];\n } else {\n data[name] = [data[name] as string, value as string];\n }\n } else if (data[name] instanceof Array) {\n if (value instanceof Array) {\n data[name] = (data[name] as Array<string | null>).concat(value);\n } else {\n (data[name] as Array<string | null>).push(value);\n }\n } else {\n if (value instanceof Array) {\n data[name] = [data[name] as string, ...value];\n } else {\n data[name] = [data[name] as string, value];\n }\n }\n if (data[name] instanceof Array) {\n data[name] = (data[name] as Array<string | null>)\n .filter(d => d !== null);\n if ((els[i] as HTMLInputElement).type === \"radio\") {\n data[name] = (data[name] as Array<string | null>).length\n ? (data[name] as Array<string | null>)[0]\n : null;\n }\n }\n }\n }\n }\n return data;\n default:\n return formInputData(el);\n }\n}\n\nfunction formInputData(el: Element): { [k: string]: string | string[] | null } | string | string[] | number | boolean | null {\n let data: { [k: string]: string | string[] | null } | string | string[] | number | boolean | null = null;\n switch (el.nodeName) {\n case \"INPUT\":\n const iel = el as HTMLInputElement;\n switch (iel.type) {\n case \"text\":\n case \"hidden\":\n case \"password\":\n case \"email\":\n case \"number\":\n case \"search\":\n case \"url\":\n case \"tel\":\n case \"color\":\n case \"date\":\n case \"datetime-local\":\n case \"month\":\n case \"range\":\n case \"time\":\n case \"week\":\n case \"submit\":\n case \"button\":\n if (iel.name) {\n data = { [iel.name]: iel.value };\n } else {\n data = iel.value;\n }\n break;\n case \"radio\":\n if (iel.name) {\n data = { [iel.name]: iel.checked ? iel.value : null };\n } else {\n data = iel.checked ? iel.value : null;\n }\n break;\n case \"checkbox\":\n if (iel.value === \"on\") { // value not set in element\n if (iel.name) {\n data = { [iel.name]: String(iel.checked) };\n } else {\n data = String(iel.checked);\n }\n } else {\n if (iel.name) {\n data = { [iel.name]: iel.checked\n ? String(iel.value)\n : null };\n } else {\n data = iel.checked\n ? String(iel.value)\n : null;\n }\n }\n break;\n }\n break;\n case \"SELECT\":\n const sel = el as HTMLSelectElement;\n if (sel.multiple) {\n const values = Array.from(sel.selectedOptions).map(o => o.value);\n if (sel.name) {\n data = { [sel.name]: values };\n } else {\n data = values;\n }\n } else {\n if (sel.name) {\n data = { [sel.name]: sel.value };\n } else {\n data = sel.value;\n }\n }\n break;\n case \"TEXTAREA\":\n const tel = el as HTMLTextAreaElement;\n if (tel.name) {\n data = { [tel.name]: tel.value };\n } else {\n data = tel.value;\n }\n break;\n case \"BUTTON\":\n const bel = el as HTMLButtonElement;\n if (bel.name) {\n data = { [bel.name]: bel.value };\n } else {\n data = bel.value;\n }\n break;\n }\n return data;\n}\n\n// export const formInputData = <STATE>(dispatcher: Actions<STATE>): Actions<STATE> =>\n// (app: App<STATE>, action: string | number, data?: any, event?: Event): void => {\n// if (data === undefined && event) {\n// data = inputEventData(event);\n// }\n// dispatcher(app, action, data, event);\n// };\n\n// // Decorator\n// export function FormInputData() {\n// return function (target: any, propertyKey: string, descriptor: PropertyDescriptor) {\n// const method = descriptor.value;\n// descriptor.value = formInputData(method);\n// return descriptor;\n// };\n// }\n","import {\n hsml,\n HElement,\n HElements,\n HHead,\n HAttrs,\n HAttrClasses,\n HAttrData,\n HAttrStyles,\n HAttrOn,\n HAttrOnCb,\n HAttrOnAct,\n HAttrOnAction,\n HAttrOnData,\n HFnc,\n HObj,\n HHandler,\n HHandlerCtx\n} from \"./hsml\";\nimport * as idom from \"incremental-dom\";\n\n// function setBoolAttrProp(el: any, attr: string, value: any) {\n// // console.log(\"idom.attributes\", attr, value, typeof value, el);\n// if (typeof value === \"string\") {\n// let b;\n// switch (value) {\n// case \"true\":\n// case \"1\":\n// case \"on\":\n// case \"yes\":\n// b = true;\n// break;\n// default:\n// b = false;\n// }\n// if (b) {\n// el.setAttribute(attr, value);\n// } else {\n// el.removeAttribute(attr);\n// }\n// el[attr] = b;\n// } else if (typeof value === \"boolean\") {\n// if (value) {\n// el.setAttribute(attr, \"\");\n// } else {\n// el.removeAttribute(attr);\n// }\n// el[attr] = value;\n// } else {\n// if (value) {\n// el.setAttribute(attr, value ? value : \"\");\n// } else {\n// el.removeAttribute(attr);\n// }\n// }\n// }\n\n// const boolAttrProps = [\n// \"readonly\",\n// \"disabled\",\n// \"checked\",\n// \"value\"\n// ];\n\n// boolAttrProps.forEach(a => idom.attributes[a] = setBoolAttrProp);\n\nclass HsmlIDomHandler implements HHandler<HHandlerCtx> {\n\n open(tag: HHead, attrs: HAttrs, children: HElements, ctx?: HHandlerCtx): boolean {\n const props: any[] = [];\n let id = attrs._id;\n let classes: string[] = attrs._classes ? attrs._classes : [];\n let ref = attrs._ref;\n let hObj: any = attrs._hObj;\n for (const a in attrs) {\n if (attrs.hasOwnProperty(a)) {\n switch (a) {\n case \"_id\":\n case \"_classes\":\n case \"_ref\":\n case \"_key\":\n case \"_skip\":\n case \"_hObj\":\n break;\n case \"id\":\n id = attrs[a] as string;\n break;\n case \"classes\":\n const attrClasses = attrs[a] as HAttrClasses;\n classes = classes.concat(attrClasses\n ? attrClasses\n .map(c =>\n c.constructor === String\n ? c as string\n : (c[1] ? c[0] as string : undefined))\n .filter((c): c is string => c !== undefined)\n : [] as string[]);\n break;\n case \"class\":\n classes = classes.concat((attrs[a] as string).split(\" \"));\n break;\n case \"data\":\n const attrData = attrs[a] as HAttrData;\n for (const d in attrData) {\n if (attrData.hasOwnProperty(d)) {\n if (attrData[d].constructor === String) {\n props.push(\"data-\" + d, attrData[d]);\n } else {\n props.push(\"data-\" + d, JSON.stringify(attrData[d]));\n }\n }\n }\n break;\n case \"styles\":\n props.push(\"style\", attrs[a] as HAttrStyles);\n break;\n case \"on\":\n const attrOn = attrs[a] as HAttrOn;\n if (typeof attrOn[0] === \"string\") {\n if (typeof attrOn[1] === \"function\") {\n props.push(\"on\" + attrOn[0], attrOn[1]);\n } else {\n props.push(\"on\" + attrOn[0], (e: Event) => {\n ctx && ctx.actionCb &&\n typeof ctx.actionCb === \"function\" &&\n ctx.actionCb(attrOn[1] as HAttrOnAction,\n attrOn[2] as HAttrOnData,\n e);\n });\n }\n } else {\n (attrOn as Array<HAttrOnCb | HAttrOnAct>)\n .forEach(attr => {\n if (typeof attr[1] === \"function\") {\n props.push(\"on\" + attr[0], attr[1]);\n } else {\n props.push(\"on\" + attr[0], (e: Event) => {\n ctx && ctx.actionCb &&\n typeof ctx.actionCb === \"function\" &&\n ctx.actionCb(attr[1] as HAttrOnAction,\n attr[2] as HAttrOnData,\n e);\n });\n }\n });\n }\n break;\n default:\n // http://google.github.io/incremental-dom/#attributes-and-properties\n switch (typeof attrs[a]) {\n case \"function\":\n props.push(\"on\" + a, attrs[a]);\n break;\n case \"object\":\n // console.log(\"---\", a, typeof attrs[a], attrs[a]);\n // console.log(\"---String \", attrs[a] instanceof String);\n // console.log(\"---Boolean\", attrs[a] instanceof Boolean);\n // console.log(\"---Number \", attrs[a] instanceof Number);\n props.push(a, attrs[a]);\n break;\n // case \"boolean\":\n // if (boolAttrProps.includes(a)) {\n // props.push(a, attrs[a]);\n // } else {\n // attrs[a] && props.push(a, a);\n // }\n // break;\n case \"boolean\":\n attrs[a] && props.push(a, a);\n break;\n default:\n props.push(a, attrs[a]);\n break;\n }\n }\n }\n }\n if (classes.length) {\n props.unshift(\"class\", classes.join(\" \"));\n }\n if (id) {\n props.unshift(\"id\", id);\n }\n idom.elementOpen(tag, attrs._key, undefined, ...props);\n if (attrs._skip) {\n idom.skip();\n }\n if (ctx && ref) {\n ctx.refs[ref] = idom.currentElement();\n }\n if (hObj && hObj.mount && hObj.mount.constructor === Function) {\n hObj.mount(idom.currentElement());\n idom.skip();\n }\n return attrs._skip ? true : false;\n }\n\n close(tag: HHead, children: HElements, ctx?: HHandlerCtx): void {\n idom.elementClose(tag);\n }\n\n text(text: string, ctx?: HHandlerCtx): void {\n idom.text(text);\n }\n\n fnc(fnc: HFnc, ctx?: HHandlerCtx): void {\n const skip = fnc(idom.currentElement());\n skip && idom.skip();\n }\n\n obj(obj: HObj, ctx?: HHandlerCtx): void {\n if (\"toHsml\" in obj) {\n obj.toHsml && hsml(obj.toHsml(), this, obj as HHandlerCtx);\n } else {\n this.text(\"\" + obj, ctx);\n }\n }\n\n}\n\nfunction hsml2idom(hml: HElement, ctx?: HHandlerCtx): void {\n hsml(hml, new HsmlIDomHandler(), ctx);\n}\n\nfunction hsmls2idom(hmls: HElements, ctx?: HHandlerCtx): void {\n for (const hml of hmls) {\n if (hml === undefined || hml === null) {\n continue;\n }\n if (hml.constructor === String) {\n idom.text(hml as string);\n } else if (\"toHsml\" in (hml as any)) {\n const obj = hml as HHandlerCtx;\n obj.toHsml && hsml2idom(obj.toHsml(), obj);\n } else {\n hsml2idom(hml as HElement, ctx);\n }\n }\n}\n\nexport function hsml2idomPatch(node: Element, hsmlEl: HElement, ctx?: HHandlerCtx): void {\n idom.patch(node,\n (data?: HElement) => (data && hsml2idom(data, ctx)), hsmlEl);\n}\n\nexport function hsmls2idomPatch(node: Element, hsmlFr: HElements, ctx?: HHandlerCtx): void {\n idom.patch(node,\n (data?: HElements) => (data && hsmls2idom(data, ctx)), hsmlFr);\n}\n"],"sourceRoot":""}
package/dist/umd/index.js CHANGED
@@ -1,2 +1,2 @@
1
- !function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e(require("IncrementalDOM"));else if("function"==typeof define&&define.amd)define(["IncrementalDOM"],e);else{var s="object"==typeof exports?e(require("IncrementalDOM")):e(t.IncrementalDOM);for(var n in s)("object"==typeof exports?exports:t)[n]=s[n]}}(window,(function(t){return function(t){var e={};function s(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,s),i.l=!0,i.exports}return s.m=t,s.c=e,s.d=function(t,e,n){s.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},s.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},s.t=function(t,e){if(1&e&&(t=s(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(s.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)s.d(n,i,function(e){return t[e]}.bind(null,i));return n},s.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return s.d(e,"a",e),e},s.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},s.p="",s(s.s=30)}([function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.hjoin=e.hsml=e.NBSP=void 0,e.NBSP="  ",e.hsml=function t(e,s,n){if(null!=e)switch(e.constructor){case Array:!function(e,s,n){if("string"!=typeof e[0])return void console.error("HSML tag head not string:",e);const i=e[0],o=e[1],r=o&&o.constructor===Object;let a,c,h=[];const l=e[r?2:1];switch(null!=l&&l.constructor){case Array:h=l;break;case Function:a=l;break;case String:case Boolean:case Number:case Date:h=[l];break;default:c=l}const u=i.split("~"),d=u[1],m=u[0].split("."),p=m[0].split("#"),f=p[0]||"div",_=p[1],g=m.slice(1);let b;b=r?o:{};_&&(b._id=_);g.length&&(b._classes=g);d&&(b._ref=d);c&&(b._hObj=c);const y=s.open(f,b,h,n);a&&s.fnc(a,n);y||h.forEach(e=>t(e,s,n));s.close(f,h,n)}(e,s,n);break;case Function:s.fnc(e,n);break;case String:s.text(e,n);break;case Boolean:s.text(""+e,n);break;case Number:const i=e,o=i.toLocaleString?i.toLocaleString():i.toString();s.text(o,n);break;case Date:const r=e,a=r.toLocaleString?r.toLocaleString():r.toString();s.text(a,n);break;default:s.obj(e,n)}},e.hjoin=function(t,e){const s=t.reduce((t,s)=>(t.push(s,e),t),[]);return s.splice(-1),s}},function(e,s){e.exports=t},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.hsmls2idomPatch=e.hsml2idomPatch=void 0;const n=s(0),i=s(1);class o{open(t,e,s,n){const o=[];let r=e._id,a=e._classes?e._classes:[],c=e._ref,h=e._hObj;for(const t in e)if(e.hasOwnProperty(t))switch(t){case"_id":case"_classes":case"_ref":case"_key":case"_skip":case"_hObj":break;case"id":r=e[t];break;case"classes":const s=e[t];a=a.concat(s?s.map(t=>t.constructor===String?t:t[1]?t[0]:void 0).filter(t=>void 0!==t):[]);break;case"class":a=a.concat(e[t].split(" "));break;case"data":const i=e[t];for(const t in i)i.hasOwnProperty(t)&&(i[t].constructor===String?o.push("data-"+t,i[t]):o.push("data-"+t,JSON.stringify(i[t])));break;case"styles":o.push("style",e[t]);break;case"on":const c=e[t];"string"==typeof c[0]?"function"==typeof c[1]?o.push("on"+c[0],c[1]):o.push("on"+c[0],t=>{n&&n.actionCb&&"function"==typeof n.actionCb&&n.actionCb(c[1],c[2],t)}):c.forEach(t=>{"function"==typeof t[1]?o.push("on"+t[0],t[1]):o.push("on"+t[0],e=>{n&&n.actionCb&&"function"==typeof n.actionCb&&n.actionCb(t[1],t[2],e)})});break;default:switch(typeof e[t]){case"function":o.push("on"+t,e[t]);break;case"object":o.push(t,e[t]);break;case"boolean":e[t]&&o.push(t,t);break;default:o.push(t,e[t])}}return a.length&&o.unshift("class",a.join(" ")),r&&o.unshift("id",r),i.elementOpen(t,e._key,void 0,...o),e._skip&&i.skip(),n&&c&&(n.refs[c]=i.currentElement()),h&&h.mount&&h.mount.constructor===Function&&(h.mount(i.currentElement()),i.skip()),!!e._skip}close(t,e,s){i.elementClose(t)}text(t,e){i.text(t)}fnc(t,e){t(i.currentElement())&&i.skip()}obj(t,e){"toHsml"in t?t.toHsml&&n.hsml(t.toHsml(),this,t):this.text(""+t,e)}}function r(t,e){n.hsml(t,new o,e)}e.hsml2idomPatch=function(t,e,s){i.patch(t,t=>t&&r(t,s),e)},e.hsmls2idomPatch=function(t,e,s){i.patch(t,t=>t&&function(t,e){for(const s of t)if(null!=s)if(s.constructor===String)i.text(s);else if("toHsml"in s){const t=s;t.toHsml&&r(t.toHsml(),t)}else r(s,e)}(t,s),e)}},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.FormValidator=e.BooleanValidator=e.DateValidator=e.NumberValidator=e.StringValidator=e.SelectValidator=e.tpl=e.Validator=e.rodneCisloRgex=e.pscRgex=e.phoneRgex=e.emailRegex=void 0;e.emailRegex=/[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?/,e.phoneRgex=/^(((00)([- ]?)|\+)(\d{1,3})([- ]?))?((\d{3})([- ]?))((\d{3})([- ]?))(\d{3})$/,e.pscRgex=/^\d{3} ?\d{2}$/,e.rodneCisloRgex=/^\s*(\d\d)(\d\d)(\d\d)[ /]*(\d\d\d)(\d?)\s*$/;class n{constructor(t,e){this.str=null,this.err=null,this.obj=null,this.opts=t||{},this.msgs=e||{}}validate(t){if("string"==typeof t||null==t){const e=t;this.str=e;const s=this.strToObj(e);if(this.obj=s.obj,s.err)return this.err=s.err,{str:null==e?"":e,obj:s.obj,err:s.err};const n=this.objCheck(s.obj);return this.err=n,{str:null==e?"":e,obj:s.obj,err:n}}{this.str=null==t?null:""+t;const e=this.objCheck(t);return this.err=e,{str:this.str,obj:t,err:e}}}format(t,e){const s=this.objToStr(t,e);return{str:void 0===s.str||null===s.str?"":s.str,err:s.err}}}function i(t,e){return Object.keys(e).map(t=>[t,e[t]]).reduce((t,e)=>t.replace(new RegExp(`\\{\\{${e[0]}\\}\\}`,"g"),String(e[1])),t)}e.Validator=n,e.tpl=i;e.SelectValidator=class extends n{constructor(t,e){super(t,e)}strToObj(t){const e=this.opts,s=this.msgs;return"required"in e&&e.required&&!t?{obj:null,err:s.required?i(s.required,Object.assign(Object.assign({},e.data),{options:"options"in e?e.options.join(", "):""})):"required"}:{obj:void 0===t?null:t,err:""}}objCheck(t){if(null==t)return"";const e=this.opts,s=this.msgs;return"options"in e&&t&&-1===e.options.indexOf(t)?s.invalid_option?i(s.invalid_option,Object.assign(Object.assign({},e.data),{option:null===t?"":t,options:"options"in e?e.options.join(", "):""})):"invalid_option":""}objToStr(t,e){return{str:t||"",err:""}}};e.StringValidator=class extends n{constructor(t,e){super(t,e)}strToObj(t){const e=this.opts,s=this.msgs;return"required"in e&&e.required&&!t?{obj:null,err:s.required?i(s.required,Object.assign(Object.assign({},e.data),{min:"min"in e?""+(e.min||""):"",max:"max"in e?""+(e.max||""):"",regexp:"regexp"in e?""+(e.regexp||""):""})):"required"}:t?"regexp"in e&&!e.regexp.test(t)?{obj:null,err:s.invalid_format?i(s.invalid_format,Object.assign(Object.assign({},e.data),{regexp:"regexp"in e?""+(e.regexp||""):""})):"invalid_format"}:{obj:t,err:""}:{obj:null,err:""}}objCheck(t){if(null==t)return"";const e=this.opts,s=this.msgs;let n=!1;return"max"in e&&t.length>e.max&&(n=!0),"min"in e&&t.length<e.min&&(n=!0),"min"in e&&"max"in e&&t.length>e.max&&t.length<e.min&&(n=!0),n?s.not_in_range?i(s.not_in_range,Object.assign(Object.assign({},e.data),{min:"min"in e?""+(e.min||""):"",max:"max"in e?""+(e.max||""):""})):"not_in_range":""}objToStr(t,e){return{str:t||"",err:""}}};e.NumberValidator=class extends n{constructor(t,e){super(t,e)}strToObj(t){const e=this.opts,s=this.msgs;if("required"in e&&e.required&&!t)return{obj:null,err:s.required?i(s.required,Object.assign(Object.assign({},e.data),{min:"min"in e?""+(e.min||""):"",max:"max"in e?""+(e.max||""):""})):"required"};if(t){const n=Number(t);let o=!1;if(isNaN(n)&&(o=!0),e.strict&&t!==this.objToStr(n).str&&(o=!0),o){const t=isNaN(n)?1234.45:n;return{obj:isNaN(n)?null:n,err:s.invalid_format?i(s.invalid_format,Object.assign(Object.assign({},e.data),{num:this.objToStr(t).str||""})):"invalid_format"}}return{obj:n,err:""}}return{obj:null,err:""}}objCheck(t){if(null==t)return"";const e=this.opts,s=this.msgs;let n=!1;return"max"in e&&t>e.max&&(n=!0),"min"in e&&t<e.min&&(n=!0),n?s.not_in_range?i(s.not_in_range,Object.assign(Object.assign({},e.data),{min:"min"in e?""+(e.min||""):"",max:"max"in e?""+(e.max||""):""})):"not_in_range":""}objToStr(t,e){let s;return s=null==t?"":"decimals"in this.opts?t.toFixed(this.opts.decimals):String(t),{str:s,err:""}}};const o=t=>t.toLocaleString(),r=t=>t.toLocaleDateString(),a=t=>t.toISOString(),c=t=>new Date(t.toDateString()).toISOString();e.DateValidator=class extends n{constructor(t,e){super(t,e),(null==t?void 0:t.iso)?this.dateToStr=(null==t?void 0:t.dateOnly)?c:a:this.dateToStr=(null==t?void 0:t.dateOnly)?r:o,(null==t?void 0:t.dateOnly)&&(null==t?void 0:t.min)&&(t.min=new Date(t.min.getFullYear(),t.min.getMonth(),t.min.getDate())),(null==t?void 0:t.dateOnly)&&(null==t?void 0:t.max)&&(t.max=new Date(t.max.getFullYear(),t.max.getMonth(),t.max.getDate()+1))}strToObj(t){const e=this.opts,s=this.msgs;if("required"in e&&e.required&&!t)return{obj:null,err:s.required?i(s.required,Object.assign(Object.assign({},e.data),{min:"min"in e&&e.min?this.dateToStr(e.min):"",max:"max"in e&&e.max?this.dateToStr(e.max):""})):"required"};if(t){const n=Date.parse(t);let o=new Date(n);e.dateOnly&&(o=new Date(o.getFullYear(),o.getMonth(),o.getDate()));let r=!1;if(isNaN(n)&&(r=!0),r){const t=isNaN(n)?new Date:o;return{obj:isNaN(n)?null:o,err:s.invalid_format?i(s.invalid_format,Object.assign(Object.assign({},e.data),{date:this.objToStr(t).str||""})):"invalid_format"}}return{obj:o,err:""}}return{obj:null,err:""}}objCheck(t){if(null==t)return"";const e=this.opts,s=this.msgs;let n=!1;return"max"in e&&e.max&&t.getTime()>e.max.getTime()&&(n=!0),"min"in e&&e.min&&t<e.min&&(n=!0),n?s.not_in_range?i(s.not_in_range,Object.assign(Object.assign({},e.data),{min:"min"in e&&e.min?this.dateToStr(e.min):"",max:"max"in e&&e.max?this.dateToStr(e.max):""})):"not_in_range":""}objToStr(t,e){return{str:null==t?"":this.dateToStr(t),err:""}}};e.BooleanValidator=class extends n{constructor(t,e){super(t,e)}strToObj(t){const e=this.opts,s=this.msgs;if("required"in e&&e.required&&!t)return{obj:null,err:s.required?i(s.required,Object.assign({},e.data)):"required"};let n;switch(t){case"true":case"1":case"on":case"yes":n=!0;break;default:n=!1}return{obj:n,err:""}}objCheck(t){if(null==t)return"";const e=this.opts,s=this.msgs;let n=!1;return"value"in e&&t!==e.value&&(n=!0),n?s.invalid_value?i(s.invalid_value,Object.assign(Object.assign({},e.data),{value:"value"in e?""+(e.value||""):""})):"invalid_value":""}objToStr(t,e){return{str:null==t?"":""+t,err:""}}};e.FormValidator=class{constructor(){this.validators={}}addValidator(t,e){return this.validators[t]=e,this}validate(t){const e=Object.keys(this.validators).reduce((e,s)=>{const n=t[s],i=this.validators[s].validate(n);return e.str[s]=i.str,e.obj[s]=i.obj,e.err[s]=i.err,i.err&&(e.valid=!1),e},{str:{},obj:{},err:{},valid:!0});return this.str=e.str,this.obj=e.obj,this.err=e.err,this.valid=e.valid,this}format(t){const e=Object.keys(this.validators).reduce((e,s)=>{const n=t[s],i=this.validators[s].format(n);return e.str[s]=i.str,e.obj[s]=n,e.err[s]=i.err,i.err&&(e.valid=!1),e},{str:{},obj:{},err:{},valid:!0});return this.str=e.str,this.obj=e.obj,this.err=e.err,this.valid=e.valid,this}data(){return{str:this.str,obj:this.obj,err:this.err,valid:this.valid}}}},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Events=void 0;e.Events=class{constructor(t){this._cb=[],this._cbs={},t&&(this._ctx=t)}emit(t,e){if(t in this._cbs)for(let s=0,n=this._cbs[t].length;s<n;s++)this._cbs[t][s](e,t,this._ctx);for(let s=0,n=this._cb.length;s<n;s++)this._cb[s](e,t,this._ctx);return this}on(t,e){const s=t;return s in this._cbs||(this._cbs[s]=[]),-1===this._cbs[s].indexOf(e)&&this._cbs[s].push(e),this}any(t){return this._cb.push(t),this}once(t,e){const s=t,n=(t,i,o)=>{this.off(s,n),e(t,i,o)};return this.on(t,n),this}off(t,e){return void 0===t&&(e?this._cb=this._cb.filter(t=>t!==e):this._cb.length=0),t&&t in this._cbs&&(e?this._cbs[t].splice(this._cbs[t].indexOf(e),1):(this._cbs[t].length=0,delete this._cbs[t])),this}}},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.hsmls2htmls=e.hsml2htmls=e.hsmls2html=e.hsml2html=void 0;const n=s(0);class i{constructor(t,e=!1,s=" "){this._depth=0,this._onHtml=t,this._pretty=e,this._indent=s}open(t,e,s,o){const r=[];let a=e._id,h=e._classes?e._classes:[],l=e._hObj;for(const t in e)if(e.hasOwnProperty(t))switch(t){case"_id":case"_classes":case"_ref":case"_key":case"_skip":case"_hObj":break;case"id":a=e[t];break;case"classes":const s=e[t];h=h.concat(s?s.map(t=>t.constructor===String?t:t[1]?t[0]:void 0).filter(t=>void 0!==t):[]);break;case"class":h=h.concat(e[t].split(" "));break;case"data":const n=e[t];for(const t in n)n.hasOwnProperty(t)&&(n[t].constructor===String?r.push(["data-"+t,n[t]]):r.push(["data-"+t,JSON.stringify(n[t])]));break;case"styles":const i=e[t];let o="";for(const t in i)if(i.hasOwnProperty(t)){o+=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()+":"+i[t]+";"}r.push(["style",o]);break;case"styles":case"on":break;default:"function"==typeof e[t]||("boolean"==typeof e[t]?e[t]&&r.push([t,""]):r.push([t,e[t]]))}h.length&&r.unshift(["class",h.join(" ")]),a&&r.unshift(["id",a]),l&&"type"in l&&r.unshift(["hObj",l.type]);const u=r.map(t=>`${t[0]}="${c(t[1])}"`).join(" ");let d="";this._pretty&&(d+=this._mkIndent(this._depth),this._depth++);if(d+="<"+t+(u?" "+u:"")+(s.length||-1!==i._pairTags.indexOf(t)?">":"/>"),this._pretty&&(d+="\n"),this._onHtml(d),l&&"render"in l&&l.render.constructor===Function){const t=l.render();for(const e of t)if(null!=e)if(e.constructor===String)this._onHtml(e+(this._pretty?"\n":""));else if("toHsml"in e){const t=e;t.toHsml&&n.hsml(t.toHsml(),this)}else n.hsml(e,this)}return!1}close(t,e,s){let n="";const o=e.length||-1!==i._pairTags.indexOf(t);this._pretty&&(this._depth--,o&&(n+=this._mkIndent(this._depth))),o&&(n+="</"+t+">",this._pretty&&(n+="\n"),this._onHtml(n))}text(t,e){let s="";this._pretty&&(s+=this._mkIndent(this._depth)),s+=t instanceof String?t:c(t),this._pretty&&(s+="\n"),this._onHtml(s)}fnc(t,e){}obj(t,e){"toHsml"in t?t.toHsml&&n.hsml(t.toHsml(),this,t):this.text(""+t,e)}_mkIndent(t){let e="";for(let s=0;s<t;s++)e+=this._indent;return e}}function o(t,e,s=!1){const o=new i(e,s);n.hsml(t,o)}function r(t,e,s=!1){for(const n of t)if(null!=n)if(n.constructor===String)e(n+(s?"\n":""));else if("toHsml"in n){const t=n;t.toHsml&&o(t.toHsml(),e,s)}else o(n,e,s)}i._pairTags=["script","iframe","html","head","body","title","div","h1","h2","h3","h4","h5","h6","p","a","pre","blockquote","i","b","em","strong","tt","cite","ol","ul","li","dl","dt","dd","table","tr","td","textarea","select","option"],e.hsml2html=o,e.hsmls2html=r,e.hsml2htmls=function(t,e=!1){const s=[];return o(t,t=>s.push(t),e),s},e.hsmls2htmls=function(t,e=!1){const s=[];return r(t,t=>s.push(t),e),s};const a=/["'&<>]/;function c(t){const e=""+t,s=a.exec(e);if(!s)return e;let n,i="",o=0,r=0;for(o=s.index;o<e.length;o++){switch(e.charCodeAt(o)){case 34:n="&quot;";break;case 38:n="&amp;";break;case 39:n="&#39;";break;case 60:n="&lt;";break;case 62:n="&gt;";break;default:continue}r!==o&&(i+=e.substring(r,o)),r=o+1,i+=n}return r!==o?i+e.substring(r,o):i}},function(t,e,s){"use strict";function n(t,e=300){let s;return function(...n){clearTimeout(s),s=setTimeout(()=>{t.apply(this,n)},e)}}Object.defineProperty(e,"__esModule",{value:!0}),e.Debounce=e.debounce=void 0,e.debounce=n,e.Debounce=function(t=300){return function(e,s,i){const o=i.value;return i.value=n(o,t),i}}},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.removeEventListener=e.addEventListener=e.html=e.empty=e.remove=e.replace=e.append=e.select=e.selectAll=void 0,e.selectAll=function(t,e){const s=(e||document).querySelectorAll(t),n=[];for(let t=0;t<s.length;t++)n.push(s[t]);return n},e.select=function(t,e){return(e||document).querySelector(t)},e.append=function(t,...e){e.forEach(e=>t.appendChild(e))},e.replace=function(t,e){t.parentElement&&t.parentElement.replaceChild(e,t)},e.remove=function(t){t.parentElement&&t.parentElement.removeChild(t)},e.empty=function(t){for(;t.firstChild;)t.removeChild(t.firstChild)},e.html=function(t){t=t.trim();let e={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],area:[1,"<map>","</map>"],param:[1,"<object>","</object>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],body:[0,"",""],_default:[1,"<div>","</div>"]};e.optgroup=e.option,e.tbody=e.tfoot=e.colgroup=e.caption=e.thead,e.th=e.td;const s=/<\s*\w.*?>/g.exec(t);let n=document.createElement("div");if(null!=s){const i=s[0].replace(/</g,"").replace(/>/g,"").split(" ")[0];if("body"===i.toLowerCase()){const e=document.createElement("body");n.innerHTML=t.replace(/<body/g,"<div").replace(/<\/body>/g,"</div>");const s=n.firstChild.attributes;e.innerHTML=t;for(let t=0;t<s.length;t++)e.setAttribute(s[t].name,s[t].value);return e}{const s=e[i]||e._default;t=s[1]+t+s[2],n.innerHTML=t;let o=s[0]+1;for(;o--;)n=n.lastChild}}else n.innerHTML=t,n=n.lastChild;return n},Element.prototype.matches||(Element.prototype.matches=Element.prototype.matchesSelector||Element.prototype.mozMatchesSelector||Element.prototype.msMatchesSelector||Element.prototype.oMatchesSelector||Element.prototype.webkitMatchesSelector||function(t){const e=(this.document||this.ownerDocument).querySelectorAll(t);let s=e.length;for(;--s>=0&&e.item(s)!==this;);return s>-1}),e.addEventListener=function(t,e,s,n,i=!1){t.addEventListener(s,(function(t){const s=t||window.event,i=s.target||t.srcElement;i&&i.matches(e)&&n(i,s)}),i)},e.removeEventListener=function(t,e,s,n=!1){t.removeEventListener(e,s,n)}},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Base64=e.UrlEncodedData=void 0;e.UrlEncodedData=class{static encode(t,e=""){let s;if("object"!=typeof t)s=t;else{const n=[];let i=0;for(let s in t)if(t.hasOwnProperty(s)){let o=t[s];o instanceof Array||(o=[o]);const r=o.length;for(let t=0;t<r;t++){const r=o[t];"object"==typeof r&&null!=r?n[i++]=arguments.callee(r,e+s+"."):(n[i]=encodeURIComponent(e+s),null!=r&&(n[i]+="="+encodeURIComponent(r)),i++)}}s=n.join("&")}return s}static decode(t){const e={};if(t){const s=t.split("&"),n=s.length;for(let t=0;t<n;t++){const n=s[t].split("="),i=decodeURIComponent(n[0]);if(n.length>1){const t=decodeURIComponent(n[1]),s=i.split("."),o=s.length;let r=e;for(let e=0;e<o;e++){const n=s[e],i=r[n];e===o-1?i?i instanceof Array?r[n].push(t):(r[n]=[i],r[n][1]=t):r[n]=t:(i||(r[n]={}),r=r[n])}}else e[i]=null}}return e}};class n{static encode(t){let e,s,i,o,r,a,c,h="",l=0;for(t=n._utf8_encode(t);l<t.length;)e=t.charCodeAt(l++),s=t.charCodeAt(l++),i=t.charCodeAt(l++),o=e>>2,r=(3&e)<<4|s>>4,a=(15&s)<<2|i>>6,c=63&i,isNaN(s)?a=c=64:isNaN(i)&&(c=64),h=h+n._keyStr.charAt(o)+n._keyStr.charAt(r)+n._keyStr.charAt(a)+n._keyStr.charAt(c);return h}static decode(t){let e,s,i,o,r,a,c,h="",l=0;for(t=t.replace(/[^A-Za-z0-9\+\/\=]/g,"");l<t.length;)o=this._keyStr.indexOf(t.charAt(l++)),r=this._keyStr.indexOf(t.charAt(l++)),a=this._keyStr.indexOf(t.charAt(l++)),c=this._keyStr.indexOf(t.charAt(l++)),e=o<<2|r>>4,s=(15&r)<<4|a>>2,i=(3&a)<<6|c,h+=String.fromCharCode(e),64!==a&&(h+=String.fromCharCode(s)),64!==c&&(h+=String.fromCharCode(i));return h=n._utf8_decode(h),h}static _utf8_encode(t){t=t.replace(/\r\n/g,"\n");let e="";for(let s=0;s<t.length;s++){const n=t.charCodeAt(s);n<128?e+=String.fromCharCode(n):n>127&&n<2048?(e+=String.fromCharCode(n>>6|192),e+=String.fromCharCode(63&n|128)):(e+=String.fromCharCode(n>>12|224),e+=String.fromCharCode(n>>6&63|128),e+=String.fromCharCode(63&n|128))}return e}static _utf8_decode(t){let e="",s=0,n=0,i=0,o=0;for(;s<t.length;)n=t.charCodeAt(s),n<128?(e+=String.fromCharCode(n),s++):n>191&&n<224?(i=t.charCodeAt(s+1),e+=String.fromCharCode((31&n)<<6|63&i),s+=2):(i=t.charCodeAt(s+1),o=t.charCodeAt(s+2),e+=String.fromCharCode((15&n)<<12|(63&i)<<6|63&o),s+=3);return e}}e.Base64=n,n._keyStr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Form=e.FileEntry=e.RadioEntry=e.SelectEntry=e.CheckboxEntry=e.NumberInputEntry=e.TextInputEntry=e.TextAreaEntry=void 0;e.TextAreaEntry=class{constructor(t){this._element="string"==typeof t?document.getElementById(t):t,this._element.addEventListener("change",()=>{this._onChange&&this._onChange(this,!0)}),this._element.addEventListener("input",()=>{this._onChange&&this._onChange(this,!1)})}getName(){return this._element.name}getValue(){return this._element.value}setValue(t){return this._element.value=t,this}validate(t=""){return this._validator?this._validator(this,t):""}setValidator(t){return this._validator=t,this}onChange(t){return this._onChange=t,this}};e.TextInputEntry=class{constructor(t){this._element="string"==typeof t?document.getElementById(t):t,this._element.addEventListener("change",()=>{this._onChange&&this._onChange(this,!0)}),this._element.addEventListener("input",()=>{this._onChange&&this._onChange(this,!1)})}getName(){return this._element.name}getValue(){return this._element.value}setValue(t){return this._element.value=t,this}validate(t=""){return this._validator?this._validator(this,t):""}setValidator(t){return this._validator=t,this}onChange(t){return this._onChange=t,this}};e.NumberInputEntry=class{constructor(t){this._decimals=0,this._dragSensitivity=1,this._element="string"==typeof t?document.getElementById(t):t,this._element.addEventListener("change",()=>{this._onChange&&this._onChange(this,!0)}),this.setDecimals(2)}getName(){return this._element.name}getValue(){return this._element.value}setValue(t){return isNaN(+t)||(this._element.value=(+t).toFixed(this._decimals)),this}setStep(t){return isNaN(t)||(this._element.step=""+t),this}setMin(t){return isNaN(t)||(this._element.min=""+t),this}setMax(t){return isNaN(t)||(this._element.max=""+t),this}setDecimals(t){return isNaN(t)||(this._decimals=t),this}setDragSensitivity(t){return isNaN(t)||(this._dragSensitivity=t),this}enableMouseWheel(){const t=()=>{this._onChange&&setTimeout(()=>{this._onChange&&this._onChange(this,!1)},0)};return this._element.addEventListener("focus",()=>{this._element.addEventListener("mousewheel",t)}),this._element.addEventListener("blur",()=>{this._element.removeEventListener("mousewheel",t)}),this}enableMouseDrag(){return this._element.addEventListener("mousedown",t=>{document.body.style.cursor="row-resize",this._element.style.cursor="row-resize";const e=t.pageY,s=Number(this.getValue()),n=""===this._element.min?null:Number(this._element.min),i=""===this._element.max?null:Number(this._element.max),o=""===this._element.step?1:Number(this._element.step),r=isNaN(s)?null===n?0:n:s,a=t=>{const s=(t.pageY-e)*this._dragSensitivity,a=r-s*o;null!==n&&a<n?this.setValue(n.toFixed(this._decimals)):null!==i&&a>i?this.setValue(i.toFixed(this._decimals)):this.setValue(a.toFixed(this._decimals)),this._onChange&&this._onChange(this,!1)},c=()=>{document.body.style.cursor="",this._element.style.cursor="",document.removeEventListener("mousemove",a),document.removeEventListener("mouseup",c),this._onChange&&this._onChange(this,!0)};document.addEventListener("mousemove",a),document.addEventListener("mouseup",c)}),this}validate(t=""){return this._validator?this._validator(this,t):""}setValidator(t){return this._validator=t,this}onChange(t){return this._onChange=t,this}};e.CheckboxEntry=class{constructor(t){this._element="string"==typeof t?document.getElementById(t):t,this._element.addEventListener("change",()=>{this._onChange&&this._onChange(this)})}getName(){return this._element.name}getValue(){return""+this._element.checked}setValue(t){return this._element.checked=!(!t||"false"===t),this}validate(t=""){return this._validator?this._validator(this,t):""}setValidator(t){return this._validator=t,this}onChange(t){return this._onChange=t,this}};e.SelectEntry=class{constructor(t){this._element="string"==typeof t?document.getElementById(t):t,this._element.addEventListener("change",()=>{this._onChange&&this._onChange(this)})}getName(){return this._element.name}getValue(){return this._element.value}setValue(t){return this._element.value=t,this}setOptions(t){const e=this._element;for(;e.options.length>0;)e.remove(0);return t.forEach(t=>{const s=document.createElement("option");s.text=t.text,s.value=t.value,e.add(s)}),this}validate(t=""){return this._validator?this._validator(this,t):""}setValidator(t){return this._validator=t,this}onChange(t){return this._onChange=t,this}};e.RadioEntry=class{constructor(t){this._elements=[],t.forEach(t=>{"string"==typeof t?this._elements.push(document.getElementById(t)):this._elements.push(t)}),this._elements.forEach(t=>{t.addEventListener("change",()=>{this._onChange&&t.checked&&this._onChange(this)})})}getName(){return this._elements[0].name}getValue(){for(let t of this._elements)if(t.checked)return t.value}setValue(t){for(let e of this._elements)e.value===t&&(e.checked=!0);return this}validate(t=""){return this._validator?this._validator(this,t):""}setValidator(t){return this._validator=t,this}onChange(t){return this._onChange=t,this}};e.FileEntry=class{constructor(t){this._element="string"==typeof t?document.getElementById(t):t,this._element.addEventListener("change",()=>{this._onChange&&this._onChange(this)})}getName(){return this._element.name}getValue(){const t=this._element.files;return t&&t.length?t[0].name+" ("+t[0].type+", "+t[0].size+")":void 0}getFile(){return this._element.files&&this._element.files.length?this._element.files[0]:null}setValue(t){return this}validate(t=""){return this._validator?this._validator(this,t):""}setValidator(t){return this._validator=t,this}onChange(t){return this._onChange=t,this}};e.Form=class{constructor(t){this._formEntries=[],this._element="string"==typeof t?document.getElementById(t):t,this._element.onsubmit=t=>(t.preventDefault(),this._onSubmit&&this._onSubmit(this),!1)}addEntry(t){return this._formEntries.push(t),this}setEntries(t){return this._formEntries=t,this}getEntries(){return this._formEntries}getEntry(t){for(let e of this._formEntries)if(e.getName()===t)return e}validate(t){const e={};for(let s of this._formEntries)e[s.getName()]=s.validate(t);return e}isValid(t){t||(t=this.validate());for(let e in t)if(t.hasOwnProperty(e)&&t[e])return!1;return!0}getValues(){const t={};for(let e of this._formEntries)t[e.getName()]=e.getValue();return t}submit(){this._element.submit()}onSubmit(t){return this._onSubmit=t,this}}},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Hash=e.hashUrlDecoder=e.hashUrlEncoder=e.hashJsonDecoder=e.hashJsonEncoder=void 0,e.hashJsonEncoder=t=>t?JSON.stringify(t):"",e.hashJsonDecoder=t=>t?JSON.parse(t):void 0,e.hashUrlEncoder=t=>{const s="string"==typeof t?e.hashUrlDecoder(t):t,n=s.path||[],i=s.query||{};return`${n.join("/")}?${Object.entries(i).reduce((t,e)=>("string"==typeof e[1]?t.append(e[0],e[1]):e[1].forEach(s=>t.append(e[0],s)),t),new URLSearchParams).toString()}`},e.hashUrlDecoder=t=>{const[e,s]=t.split("?"),n=e.split("/"),i={};for(const t of new URLSearchParams(s).entries()){const[e,s]=t;e in i?"string"==typeof i[e]?i[e]=[i[e],s]:i[e].push(s):i[e]=s}return{path:n,query:i}};e.Hash=class{constructor(t=!0){this._encode=t=>String(t),this._decode=t=>t,this._emitWritten=t}onChange(t){return this._cb=t,this}coders(t,e){return this._encode=t,this._decode=e,this}listen(){return this._cb&&this._cb(this.read()),"onhashchange"in window?onhashchange=()=>{const t=this.read();if(this._emitWritten)this._cb&&this._cb(t);else{const e=this._writtenDataJson===JSON.stringify(t);this._writtenDataJson=void 0,e||this._cb&&this._cb(t)}}:alert('Browser "window.onhashchange" not implemented'),this}read(){return this._decode(decodeURIComponent(location.hash.slice(1)))}write(t){return location.hash="#"+encodeURI(this._encode(t)),this._emitWritten||(this._writtenDataJson=JSON.stringify(t),this._cb&&this._cb(t)),this}}},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.History=void 0;e.History=class{back(){window.history.back()}forward(){window.history.forward()}go(t){window.history.go(t)}length(){return window.history.length}state(){return window.history.state}pushState(t,e,s){window.history.pushState(t,e,s)}replaceState(t,e,s){window.history.replaceState(t,e,s)}onChange(t){return window.addEventListener("popstate",(function(e){t(e.state)})),this}}},function(t,e,s){"use strict";var n=this&&this.__awaiter||function(t,e,s,n){return new(s||(s=Promise))((function(i,o){function r(t){try{c(n.next(t))}catch(t){o(t)}}function a(t){try{c(n.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof s?e:new s((function(t){t(e)}))).then(r,a)}c((n=n.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.HApp=e.HAppAction=void 0;const i=s(2),o=console.log,r=console.error;var a;!function(t){t._init="_init",t._mount="_mount",t._umount="_umount"}(a=e.HAppAction||(e.HAppAction={}));const c=window.requestAnimationFrame||function(t){window.setTimeout(t,1e3/60)},h=window.cancelAnimationFrame||function(t){window.clearTimeout(t)};class l{constructor(t,e,s,i=document.body){this.refs={},this.dispatch=(t,e,s)=>n(this,void 0,void 0,(function*(){if(l.debug){o("HApp action:",{type:t,data:e,event:s});const n=performance.now();try{yield this.dispatcher({type:t,data:e,event:s},this.state,this.dispatch),this.update()}catch(t){r("HApp dispatch:",t)}const i=performance.now();o("HApp dispatch:",i-n+" ms",this.state)}else try{yield this.dispatcher({type:t,data:e,event:s},this.state,this.dispatch),this.update()}catch(t){r("HApp dispatch:",t)}})),this.render=()=>{if(l.debug){const t=performance.now();let e;try{e=this.view(this.state)}catch(t){r("HApp render:",t)}const s=performance.now();return o("HApp render:",s-t+" ms",e),e||[]}{let t;try{t=this.view(this.state)}catch(t){r("HApp render:",t)}return t||[]}},this.actionCb=(t,e,s)=>{void 0===(e=e&&e.constructor===Function?e(s):e)&&s&&(e=function(t){const e=t.target;switch(e.nodeName){case"FORM":t.preventDefault();const s=e.elements,n={};for(let t=0;t<s.length;t++){const e=d(s[t]);if("object"==typeof e){const i=Object.keys(e);if(i.length){const o=i[0],r=e[o];void 0===n[o]?n[o]=r:"string"==typeof n[o]||n[o]instanceof String?n[o]=r instanceof Array?[n[o],...r]:[n[o],r]:n[o]instanceof Array?r instanceof Array?n[o]=n[o].concat(r):n[o].push(r):n[o]=r instanceof Array?[n[o],...r]:[n[o],r],n[o]instanceof Array&&(n[o]=n[o].filter(t=>null!==t),"radio"===s[t].type&&(n[o]=n[o].length?n[o][0]:null))}}}return n;default:return d(e)}}(s)),this.dispatch(t,e,s)},this.mount=(t=document.body)=>{const e="string"==typeof t?document.getElementById(t)||document.body:t||document.body;if(e.app){e.app.umount()}if(!this.dom){this.dom=e,e.app=this;u(e,this.render(),this),this._onUpdate&&this._onUpdate(this),this.dispatch(a._mount,this.dom)}return this},this.umount=()=>{if(this.dom){this.dispatch(a._umount,this.dom),this.dom.hasAttribute("app")&&this.dom.removeAttribute("app");const t=this.dom.querySelectorAll("[app]");for(let e=0;e<t.length;e++){const s=t[e].app;s&&s.umount()}for(;this.dom.firstChild;)this.dom.removeChild(this.dom.firstChild);delete this.dom.app,this.dom=void 0}return this},this.update=()=>(this.dom&&!this._updateSched&&(this._updateSched=c(()=>{if(this.dom){const t=this.render();u(this.dom,t,this)}this._updateSched=void 0,this._onUpdate&&this._onUpdate(this)})),this),this.onUpdate=t=>(this._onUpdate=t,this),this.toHsml=()=>{if(this.dom){if(!this._updateSched)return["div",{_skip:!0}];h(this._updateSched),this._updateSched=void 0}const t=this.render();return t.push(t=>{this.dom||(this.dom=t,t.app=this,this.dispatch(a._mount,this.dom))}),["div",t]},this.toHtml=()=>this.dom?this.dom.outerHTML:"",this.state=t,this.view=e,this.dispatcher=s||(t=>n(this,void 0,void 0,(function*(){return o("HApp action:",t.type,t.data)}))),this.dispatch(a._init).then(()=>this.mount(i))}}function u(t,e,s){if(l.debug){const n=performance.now();i.hsmls2idomPatch(t,e,s);const r=performance.now();o("HApp update:",r-n+" ms",t)}else i.hsmls2idomPatch(t,e,s)}function d(t){let e=null;switch(t.nodeName){case"INPUT":const s=t;switch(s.type){case"text":case"hidden":case"password":case"email":case"number":case"search":case"url":case"tel":case"color":case"date":case"datetime-local":case"month":case"range":case"time":case"week":case"submit":case"button":e=s.name?{[s.name]:s.value}:s.value;break;case"radio":e=s.name?{[s.name]:s.checked?s.value:null}:s.checked?s.value:null;break;case"checkbox":e="on"===s.value?s.name?{[s.name]:String(s.checked)}:String(s.checked):s.name?{[s.name]:s.checked?String(s.value):null}:s.checked?String(s.value):null}break;case"SELECT":const n=t;if(n.multiple){const t=Array.from(n.selectedOptions).map(t=>t.value);e=n.name?{[n.name]:t}:t}else e=n.name?{[n.name]:n.value}:n.value;break;case"TEXTAREA":const i=t;e=i.name?{[i.name]:i.value}:i.value;break;case"BUTTON":const o=t;e=o.name?{[o.name]:o.value}:o.value}return e}e.HApp=l,l.debug=!1},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.hsmls2dom=e.hsml2dom=void 0;const n=s(0);class i{open(t,e,s,n){const i=document.createElement(t);let o=e._id,r=e._classes?e._classes:[],a=e._ref,c=e._hObj;for(const t in e)if(e.hasOwnProperty(t))switch(t){case"_id":case"_classes":case"_ref":case"_key":case"_skip":case"_hObj":break;case"id":o=e[t];break;case"classes":const s=e[t];r=r.concat(s?s.map(t=>t.constructor===String?t:t[1]?t[0]:void 0).filter(t=>void 0!==t):[]);break;case"class":r=r.concat(e[t].split(" "));break;case"data":const a=e[t];for(const t in a)a.hasOwnProperty(t)&&(a[t].constructor===String?i.dataset[t]=a[t]:i.dataset[t]=JSON.stringify(a[t]));break;case"styles":const c=e[t];for(const t in c)c.hasOwnProperty(t)&&(i.style[t]=c[t]);break;case"on":const h=e[t];"string"==typeof h[0]?"function"==typeof h[1]?i.addEventListener(h[0],h[1]):i.addEventListener(h[0],t=>{n&&n.actionCb&&"function"==typeof n.actionCb&&n.actionCb(h[1],h[2],t)}):h.forEach(t=>{"function"==typeof h[1]?i.addEventListener(h[0],h[1]):i.addEventListener(h[0],t=>{n&&n.actionCb&&"function"==typeof n.actionCb&&n.actionCb(h[1],h[2],t)})});break;default:"function"==typeof e[t]?i.addEventListener(t,e[t]):"boolean"==typeof e[t]?e[t]&&i.setAttribute(t,""):i.setAttribute(t,e[t])}return o&&i.setAttribute("id",o),r.length&&i.classList.add(...r),this._current?(this._current.appendChild(i),this._current=i):(this.element=i,this._current=i),n&&a&&(n.refs[a]=this._current),c&&c.mount&&c.mount.constructor===Function&&c.mount(i),!!e._skip}close(t,e,s){this._current!==this.element&&this._current&&(this._current=this._current.parentElement||void 0)}text(t,e){this._current&&this._current.appendChild(document.createTextNode(t))}fnc(t,e){this._current&&t(this._current)}obj(t,e){"toHsml"in t?t.toHsml&&n.hsml(t.toHsml(),this,t):this.text(""+t,e)}}function o(t,e){const s=new i;return n.hsml(t,s,e),s.element}e.hsml2dom=o,e.hsmls2dom=function(t,e){const s=[];for(const n of t)if(null!=n)if(n.constructor===String)s.push(document.createTextNode(n));else if("toHsml"in n){const t=n;t.toHsml&&s.push(o(t.toHsml(),t))}else s.push(o(n,e));return s}},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.h=void 0,e.h=function(t,e,s){const n=[t];return e&&("string"==typeof e||"number"==typeof e?n.push([e]):(Array.isArray(e),n.push(e))),s&&("string"==typeof s||"number"==typeof s?n.push([s]):(Array.isArray(s)||"function"==typeof s)&&n.push(s)),n}},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.HCtrl=void 0;const n=s(2),i=s(1),o=(t,e,s)=>n=>{if(n.ctrl){const i=n.ctrl;if(i.view===t.view)void 0!==e&&(i.state=e),i.update();else{i.umount();const o=new c(t,s);void 0!==e&&(o.state=e),o.mount(n)}}else{const i=new c(t,s);void 0!==e&&(i.state=e),i.mount(n)}return!0},r=window.requestAnimationFrame||function(t){window.setTimeout(t,1e3/60)},a=window.cancelAnimationFrame||function(t){window.clearTimeout(t)};class c{constructor(t,e){this.type="Ctrl",this.id=this.type+"-"+c._count++,this.refs={},this.appAction=(t,e,s)=>{c.debug&&console.log("appAction",this.type,t,e,s),c.appActions&&c.appActions(this,t,e,s)},this.extAction=(t,e,s)=>{c.debug&&console.log("extAction",this.type,t,e,s),this._extAction&&this._extAction(t,e,s)},this.action=(t,e,s)=>{c.debug&&console.log("action",this.type,t,e,s),this._actions&&this._actions(this,t,e,s)},this.render=()=>this.view(this.state,this.action,o),this.actionCb=(t,e,s)=>{void 0===(e=e&&e.constructor===Function?e(s):e)&&s&&(e=function(t){const e={},s=t.target;switch(s.nodeName){case"INPUT":const t=s;switch(t.type){case"text":case"hidden":case"password":case"email":case"number":case"search":case"url":case"tel":case"color":case"date":case"datetime-local":case"month":case"range":case"time":case"week":case"submit":case"button":case"radio":case"number":e[t.name]=t.value;break;case"checkbox":e[t.name]=""+t.checked}break;case"SELECT":const n=s;e[n.name]=n.value;break;case"TEXTAREA":const i=s;e[i.name]=i.innerText;break;case"BUTTON":const o=s;e[o.name]=o.value}return e}(s)),this.action(t,e,s)},this.mount=t=>{const e="string"==typeof t?document.getElementById(t)||document.body:t||document.body;if(e.ctrl){const t=e.ctrl;t&&t.umount()}if(!this.dom){c._ctrls[this.id]=this,this.dom=e,e.ctrl=this;const t=this.render();n.hsmls2idomPatch(e,t,this),e.setAttribute("ctrl",this.type),this.action("_mount",this.dom)}return this},this.umount=()=>{if(this.dom){delete c._ctrls[this.id],this.action("_umount",this.dom),this.dom.hasAttribute("ctrl")&&this.dom.removeAttribute("ctrl");const t=this.dom.querySelectorAll("[ctrl]");for(let e=0;e<t.length;e++){const s=t[e].ctrl;s&&s.umount()}for(;this.dom.firstChild;)this.dom.removeChild(this.dom.firstChild);delete this.dom.ctrl,this.dom=void 0}return this},this.update=()=>(this.dom&&!this._updateSched&&(this._updateSched=r(()=>{this.dom&&n.hsmls2idomPatch(this.dom,this.render(),this),this._updateSched=void 0})),this),this.toHsml=()=>{if(this.dom){if(!this._updateSched)return["div",{_skip:!0,_id:this.id,_key:this.id,ctrl:this.type}];a(this._updateSched),this._updateSched=void 0}const t=this.render();return t.push(t=>{this.dom||(this.dom=t,t.ctrl=this,c._ctrls[this.id]=this,this.action("_mount",this.dom))}),["div",{_id:this.id,_key:this.id,ctrl:this.type},t]},this.toHtml=()=>this.dom?this.dom.outerHTML:"",this.view=t.view,this.type=t.type,this.state=t.state,this._actions=t.actions,this._extAction=e||this.appAction,this.action("_init")}appActions(t){return c.appActions=t,this}appCtrls(){return Object.values(c._ctrls)}}e.HCtrl=c,c.debug=!1,c._count=0,c._ctrls={},i.notifications.nodesDeleted=t=>{t.forEach(t=>{if(1===t.nodeType&&t.ctrl){const e=t.ctrl;e&&e.umount()}})}},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.htmls=e.html=void 0;const n=s(5),i=(t,e,s)=>{},o=(t,e)=>t.view(e||t.state,i,o);e.html=function(t,e,s,r=!1){n.hsmls2html(t.view(e,i,o),s,r)},e.htmls=function(t,e,s=!1){return n.hsmls2htmls(t.view(e,i,o),s).join("")}},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.HWidget=void 0;const n=s(2),i=s(1),o=window.requestAnimationFrame||function(t){window.setTimeout(t,1e3/60)},r=window.cancelAnimationFrame||function(t){window.clearTimeout(t)};class a{constructor(t){this.type=this.constructor.name,this.id=this.type+"-"+a._count++,this.refs={},this.toHtml=()=>this.dom?this.dom.outerHTML:"",t&&(this.type=t)}onMount(){console.log("mount")}onUmount(){console.log("umount")}actions(t,e){console.log(t,e)}action(t,e){this.actions(t,e)}actionCb(t,e,s){e=e&&e.constructor===Function?e(s):void 0===e?s:e,this.action(t,e)}mount(t){const e="string"==typeof t?document.getElementById(t)||document.body:t||document.body;if("widget"in e){const t=e.widget;t&&t.umount()}if(!this.dom){a.mounted[this.id]=this,this.dom=e,e.widget=this;const t=this.render();n.hsmls2idomPatch(e,t,this),e.setAttribute("widget",this.type),this.onMount&&this.onMount()}return this}umount(){if(this.dom){delete a.mounted[this.id],this.onUmount&&this.onUmount(),this.dom.hasAttribute("widget")&&this.dom.removeAttribute("widget");const t=this.dom.querySelectorAll("[widget]");for(let e=0;e<t.length;e++){const s=t[e].widget;s&&s.umount()}for(;this.dom.firstChild;)this.dom.removeChild(this.dom.firstChild);delete this.dom.widget,this.dom=void 0}return this}update(){return this.dom&&!this._updateSched&&(this._updateSched=o(()=>{this.dom&&n.hsmls2idomPatch(this.dom,this.render(),this),this._updateSched=void 0})),this}toHsml(){if(this.dom){if(!this._updateSched)return["div",{_skip:!0,_id:this.id,_key:this.id,widget:this.type}];r(this._updateSched),this._updateSched=void 0}const t=this.render();return t.push(t=>{this.dom||(this.dom=t,t.widget=this,this.onMount&&this.onMount())}),["div",{_id:this.id,_key:this.id,widget:this.type},t]}}e.HWidget=a,a._count=0,a.mounted={},i.notifications.nodesDeleted=t=>{t.forEach(t=>{if(1===t.nodeType&&"widget"in t){const e=t.widget;e&&e.umount()}})}},function(t,e,s){"use strict";function n(t){return Array.isArray?Array.isArray(t):null!=t&&void 0!==t&&-1==="boolean|number|string|function|xml".indexOf(typeof t)&&("number"==typeof t.length&&!t.propertyIsEnumerable("length"))}function i(t){const e=[];for(const s in t)if(t.hasOwnProperty(s)){const i=t[s];if("object"==typeof i)if(n(i))for(const t of i)e.push([s,"object"==typeof t?JSON.stringify(t):t]);else e.push([s,JSON.stringify(i)]);else e.push([s,i])}for(let t,s=0;t=e[s++];)e[s-1]=`${encodeURIComponent(t[0])}=${encodeURIComponent(t[1])}`;return e.join("&")}Object.defineProperty(e,"__esModule",{value:!0}),e.http=e.onError=e.onResponse=e.onRequest=e.del=e.patch=e.put=e.post=e.get=e.HttpRequest=e.authBasic=e.HttpResponse=e.encodeUrlQuery=e.decodeUrlQuery=e.isArray=void 0,e.isArray=n,e.decodeUrlQuery=function(t){const e={};if(t){const s=t.substr(1).split("&");for(const t of s){const s=t.split("=");e[decodeURIComponent(s[0])]=decodeURIComponent(s[1]||"")}}return e},e.encodeUrlQuery=i;class o{constructor(t){this._xhr=t}getHeaders(){return this._xhr.getAllResponseHeaders()}getHeader(t){return this._xhr.getResponseHeader(t)}getBody(){return this._xhr.response}getType(){return this._xhr.responseType}getContentType(){return this.getHeader("Content-Type")}getText(){return this._xhr.responseText}getJson(){return JSON.parse(this._xhr.responseText)}getXml(){return this._xhr.responseXML}}e.HttpResponse=o,e.authBasic=(t,e)=>s=>{s.headers({Authorization:"Basic "+btoa(t+":"+e)})};class r{constructor(){this._method="GET",this._headers={},this._async=!0,this._noCache=!1}static abortAll(){r.xhrs.forEach(t=>t.abort()),r.xhrs.length=0}get(t,e){return this.method("GET"),this.url(t,e),this}post(t,e){return this.method("POST"),this.url(t,e),this}put(t,e){return this.method("PUT"),this.url(t,e),this}patch(t,e){return this.method("PATCH"),this.url(t,e),this}del(t,e){return this.method("DELETE"),this.url(t,e),this}url(t,e){return this._url=t,this._query=e,this}method(t){return this._method=t,this}headers(t){for(const e in t)t.hasOwnProperty(e)&&(this._headers[e]=t[e]);return this}use(t){return t(this),this}timeout(t){return this._timeout=t,this}responseType(t){return this._responseType=t,this}onProgress(t){return this._onProgress=t,this}onResponse(t){return this._onResponse=t,this}onError(t){return this._onError=t,this}async(t=!0){return this._async=t,this}noCache(t=!0){return this._noCache=t,this}abort(){return this._xhr&&this._xhr.abort(),this}send(t,e){e&&(this._headers["Content-Type"]=e),this._send(t,this._headers)}sendPromise(t,e){return new Promise((s,n)=>{this._onResponse=s,this._onError=n,e&&(this._headers["Content-Type"]=e),this._send(t,this._headers)})}_send(t,e){const s=new XMLHttpRequest;this._xhr=s;let n=this._url||"";if(this._query){const t=i(this._query);n=t?`${n}?${t}`:n}if(this._noCache&&(n+=(/\?/.test(n)?"&":"?")+(new Date).getTime()),this._responseType&&(this._xhr.responseType=this._responseType),"onprogress"in s&&this._onProgress){const t=t=>{this._onProgress({loaded:t.loaded,total:t.lengthComputable?t.total:void 0})};s.upload.onprogress=t,s.onprogress=t}r.xhrs.push(this),s.open(this._method,n,this._async);for(const t in e)e.hasOwnProperty(t)&&s.setRequestHeader(t,e[t]);if(this._timeout&&(s.timeout=this._timeout),"ontimeout"in s&&(this._onError||r.onError)&&(s.ontimeout=t=>{r.onError&&r.onError(t),this._onError&&this._onError(t)}),"onabort"in s&&(this._onError||r.onError)&&(s.onabort=t=>{r.onError&&r.onError(t),this._onError&&this._onError(t)}),(this._onError||r.onError)&&(s.onerror=t=>{r.onError&&r.onError(t),this._onError&&this._onError(t)}),!this._async){if(t){const e="string"==typeof t?t:JSON.stringify(t);s.send(e)}else s.send();return JSON.parse(s.responseText)}"onload"in s?s.onload=t=>{if(r.xhrs=r.xhrs.filter(t=>this!==t),s.status>=200&&s.status<300){const t=new o(s);r.onResponse&&r.onResponse(t),this._onResponse&&this._onResponse(t)}else r.onError&&r.onError(t),this._onError&&this._onError(t)}:s.onreadystatechange=t=>{switch(s.readyState){case 4:if(r.xhrs=r.xhrs.filter(t=>this!==t),s.status>=200&&s.status<300){const t=new o(s);r.onResponse&&r.onResponse(t),this._onResponse&&this._onResponse(t)}else r.onError&&r.onError(t),this._onError&&this._onError(t)}},void 0!==t?"string"==typeof t||t instanceof FormData||t instanceof Blob?s.send(t):(this._headers["Content-Type"]||s.setRequestHeader("Content-Type","application/json"),s.send(JSON.stringify(t))):s.send()}}function a(t,e){return(new r).method("GET").url(t,e)}function c(t,e){return(new r).method("POST").url(t,e)}function h(t,e){return(new r).method("PUT").url(t,e)}function l(t,e){return(new r).method("DELETE").url(t,e)}function u(t){r.onRequest=t}function d(t){r.onResponse=t}function m(t){r.onError=t}e.HttpRequest=r,r.xhrs=[],e.get=a,e.post=c,e.put=h,e.patch=function(t,e){return(new r).method("PATCH").url(t,e)},e.del=l,e.onRequest=u,e.onResponse=d,e.onError=m,e.http={get:a,post:c,put:h,delete:l,onRequest:u,onResponse:d,onError:m}},function(t,e,s){"use strict";function n(t,e){const s=document.createElement("script");s.type="text/javascript",s.charset="utf-8",s.src=t,s.readyState?s.onreadystatechange=()=>{const t="loaded"===s.readyState,n="complete"===s.readyState;(t||n)&&(s.onreadystatechange=null,"function"==typeof e&&e())}:s.onload=()=>{"function"==typeof e&&e()},document.getElementsByTagName("head")[0].appendChild(s)}Object.defineProperty(e,"__esModule",{value:!0}),e.css=e.image=e.scripts=e.script=e.scriptLib=void 0,e.scriptLib=function(t,e,s){n(t,()=>{const t=window[e];window[e]={},delete window[e],s&&s(t)})},e.script=n,e.scripts=function(t,e){t.reverse();let s=e;for(let e=0;e<t.length;e++){s=((t,e)=>()=>n(t,()=>e&&e()))(t[e],s)}s&&s()},e.image=function(t,e){const s=new Image;s.src=t,s.readyState?s.onreadystatechange=()=>{"function"==typeof e&&e()}:s.onload=()=>{"function"==typeof e&&e()}},e.css=function(t,e){const s=document.createElement("link");s.type="text/css",s.rel="stylesheet",s.href=t,s.readyState?s.onreadystatechange=()=>{"function"==typeof e&&e()}:s.onload=()=>{"function"==typeof e&&e()},document.getElementsByTagName("head")[0].appendChild(s)}},function(t,e,s){"use strict";function n(t,e=[],s={}){return Object.keys(t).reduce((s,i)=>{const o=e.concat(i);return"object"==typeof t[i]&&null!==t[i]?n(t[i],o,s):0===s[t[i]]||s[t[i]]?s[t[i]].push(o):s[t[i]]=[o],s},s)}Object.defineProperty(e,"__esModule",{value:!0}),e.objValuePaths=e.objPaths=void 0,e.objPaths=function(t){const e=n(t);return Object.keys(e).map(t=>e[t]).reduce((t,e)=>t.concat(e))},e.objValuePaths=n},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.route=e.Router=e.Route=e.Emitter=void 0;class n{constructor(){this._callbacks={}}on(t,e){return t in this._callbacks||(this._callbacks[t]=[]),this._callbacks[t].push(e),this}emit(t,...e){return t in this._callbacks&&this._callbacks[t].forEach(t=>t.apply(this,e)),this}off(t,e){if(!this._callbacks||0===arguments.length)return this._callbacks={},this;const s=this._callbacks[t];if(!s)return this;if(1===arguments.length)return delete this._callbacks[t],this;for(let t=0;t<s.length;t++){if(s[t]===e){s.splice(t,1);break}}return this}}e.Emitter=n;class i{constructor(t){this._params={},this.keys=[],this.path=t,this._pathParse(t,!1,!1)}match(t,e){const s=this._regex.exec(t);if(!s)return!1;for(let t=1;t<s.length;++t){const n=this.keys[t-1],i="string"==typeof s[t]?decodeURIComponent(s[t]):s[t];n&&(this._params[n.name]=i),e.push(i)}return!0}_pathParse(t,e,s){t instanceof RegExp?this._regex=t:(t instanceof Array&&(t="("+t.join("|")+")"),t=t.concat(s?"":"/?").replace(/\/\(/g,"(?:/").replace(/\+/g,"__plus__").replace(/(\/)?(\.)?:(\w+)(?:(\(.*?\)))?(\?)?/g,(t,e,s,n,i,o)=>(this.keys.push({name:n,optional:!!o}),e=e||"",(o?"":e)+"(?:"+(o?e:"")+(s||"")+(i||(s?"([^/.]+?)":"([^/]+?)"))+")"+(o||""))).replace(/([\/.])/g,"\\$1").replace(/__plus__/g,"(.+)").replace(/\*/g,"(.*)"),this._regex=new RegExp("^"+t+"$",e?"":"i"))}}e.Route=i;class o extends n{constructor(){super(),this._routes=[],this._onHashChange=()=>{this.handle(this.hash())},window.addEventListener?window.addEventListener("hashchange",this._onHashChange,!1):window.attachEvent("onhashchange",this._onHashChange)}static route(t,e){return o.default.route(t,e),o.default}static navigate(t,e=!1){return o.default.navigate(t,e),o.default}static start(){return o.default.start(),o.default}static hash(){return o.default.hash()}static handle(t){return o.default.handle(t)}route(t,e){const s=new i(t);return this._routes.push(s),this.on(t,(t,s)=>e.apply(s,t)),this}navigate(t,e=!1){const s=this.hash();return window.location.hash=t,e&&s===t&&this.handle(t),this}start(){return this._onHashChange(),this}hash(){return window.location.hash.substring(1)}handle(t){for(const e of this._routes){const s=[];if(e.match(t,s)){this.emit(e.path,s,e);break}}return this}}e.Router=o,o.default=new o,e.route=function(t,e){return o.route(t,e)}},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Settings=void 0;const n=s(4);e.Settings=class{constructor(t,e="settings"){this.events=new n.Events,this.props=t,this.name=e}getProps(){return this.props}setProps(t){return Object.keys(t).forEach(e=>this.props[e]=t[e]),this.events.emit("",t),this}getProp(t){return this.props[t]}setProp(t,e){this.props[t]=e;return this.events.emit(t,e),this}}},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Signal=void 0;e.Signal=class{constructor(){this._slots=[],this._emit=!0}onConnect(t){this._onConnect=t}onDisconnect(t){this._onDisconnect=t}connNo(){return this._slots.length}connect(t,e){"function"==typeof t&&(e?this._slots.push({callback:t,object:e}):this._slots.push({callback:t}),this._onConnect&&this._onConnect(this._slots.length))}disconnect(t,e){"function"==typeof t&&(this._slots=this._slots.filter(s=>void 0===e?s.callback!==t:s.callback!==t&&s.object!==e),this._onDisconnect&&this._onDisconnect(this._slots.length))}disconnectAll(){this._slots=[],this._onDisconnect&&this._onDisconnect(this._slots.length)}freeze(){this._emit=!1}unfreeze(){this._emit=!0}emit(t){return this._emit&&this._slots.length?this._slots.map(e=>{const s=e.object;return s?e.callback.call(s,t):e.callback(t)}):[]}}},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.template=e.tmpl=void 0,e.tmpl=function(t,e){const s=/[^a-zA-Z0-9_-]+/.test(t)?t:document.getElementById(t).innerHTML;let n,i,o=JSON.stringify,r=/\$\{([\S\s]*?)\}/g,a=[],c=0;for(;i=r.exec(s);)n=s.slice(c,i.index),a.push(o(n),"("+i[1]+")"),c=r.lastIndex;n=s.slice(c),a.push(o(n));const h=new Function("obj","with(obj)return "+a.join("+"));return e?h(e):h};const n={};e.template=function t(e,s){const i=/[^a-zA-Z0-9_-]+/.test(e)?new Function("obj","var p=[],print=function(){p.push.apply(p,arguments);};with(obj){p.push('"+e.replace(/[\r\t\n]/g," ").split("<%").join("\t").replace(/((^|%>)[^\t]*)'/g,"$1\r").replace(/\t=(.*?)%\>/g,"',$1,'").split("\t").join("');").split("%>").join("\np.push('").split("\r").join("\\'")+"');}return p.join('');"):n[e]=n[e]||t(document.getElementById(e).innerHTML);return s?i(s):i}},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.tmpl=e.tmplo=e.tmpla=e.tmpls=void 0,e.tmpls=function(t,e){return Object.keys(e).map(t=>[t,e[t]]).reduce((t,e)=>t.replace(new RegExp(`\\{\\{${e[0]}\\}\\}`,"g"),String(e[1])),t)},e.tmpla=function(t,e){return e.reduce((t,e,s)=>t.replace(new RegExp(`\\$\\{${s}\\}`,"g"),e),t)},e.tmplo=function(t,e){return Object.keys(e).map(t=>[t,e[t]]).reduce((t,e)=>t.replace(new RegExp(`\\$\\{${e[0]}\\}`,"g"),e[1]),t)},e.tmpl=function(t){const e=JSON.stringify,s=/\$\{([\S\s]*?)\}/g,n=[];let i,o,r=0;for(;i=s.exec(t);)o=t.slice(r,i.index),n.push(e(o),"("+i[1]+")"),r=s.lastIndex;return o=t.slice(r),n.push(e(o)),new Function("obj","with(obj)return "+n.join("+"))}},,,,function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.validators=e.tmpl=e.template=e.signal=e.settings=e.router=e.objpaths=e.load=e.http=e.hsml=e.hsmlwidget=e.hsmlsvac=e.hsmlsvachtml=e.hsmlsvacctrl=e.hsmlidom=e.hsmlhtml=e.hsmlh=e.hsmldom=e.hsmlapp=e.history=e.hash=e.form=e.events=e.encode=e.dom=e.debounce=void 0;const n=s(6);e.debounce=n;const i=s(7);e.dom=i;const o=s(8);e.encode=o;const r=s(4);e.events=r;const a=s(9);e.form=a;const c=s(10);e.hash=c;const h=s(11);e.history=h;const l=s(12);e.hsmlapp=l;const u=s(13);e.hsmldom=u;const d=s(14);e.hsmlh=d;const m=s(5);e.hsmlhtml=m;const p=s(2);e.hsmlidom=p;const f=s(15);e.hsmlsvacctrl=f;const _=s(16);e.hsmlsvachtml=_;const g=s(17);e.hsmlsvac=g;const b=s(18);e.hsmlwidget=b;const y=s(0);e.hsml=y;const v=s(19);e.http=v;const j=s(20);e.load=j;const w=s(21);e.objpaths=w;const E=s(22);e.router=E;const x=s(23);e.settings=x;const C=s(24);e.signal=C;const S=s(25);e.template=S;const O=s(26);e.tmpl=O;const k=s(3);e.validators=k}])}));
1
+ !function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e(require("IncrementalDOM"));else if("function"==typeof define&&define.amd)define(["IncrementalDOM"],e);else{var s="object"==typeof exports?e(require("IncrementalDOM")):e(t.IncrementalDOM);for(var n in s)("object"==typeof exports?exports:t)[n]=s[n]}}(window,(function(t){return function(t){var e={};function s(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,s),i.l=!0,i.exports}return s.m=t,s.c=e,s.d=function(t,e,n){s.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},s.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},s.t=function(t,e){if(1&e&&(t=s(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(s.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)s.d(n,i,function(e){return t[e]}.bind(null,i));return n},s.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return s.d(e,"a",e),e},s.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},s.p="",s(s.s=30)}([function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.hjoin=e.hsml=e.NBSP=void 0,e.NBSP="  ",e.hsml=function t(e,s,n){if(null!=e)switch(e.constructor){case Array:!function(e,s,n){if("string"!=typeof e[0])return void console.error("HSML tag head not string:",e);const i=e[0],o=e[1],r=o&&o.constructor===Object;let a,c,h=[];const l=e[r?2:1];switch(null!=l&&l.constructor){case Array:h=l;break;case Function:a=l;break;case String:case Boolean:case Number:case Date:h=[l];break;default:c=l}const u=i.split("~"),d=u[1],m=u[0].split("."),p=m[0].split("#"),f=p[0]||"div",_=p[1],g=m.slice(1);let b;b=r?o:{};_&&(b._id=_);g.length&&(b._classes=g);d&&(b._ref=d);c&&(b._hObj=c);const y=s.open(f,b,h,n);a&&s.fnc(a,n);y||h.forEach(e=>t(e,s,n));s.close(f,h,n)}(e,s,n);break;case Function:s.fnc(e,n);break;case String:s.text(e,n);break;case Boolean:s.text(""+e,n);break;case Number:const i=e,o=i.toLocaleString?i.toLocaleString():i.toString();s.text(o,n);break;case Date:const r=e,a=r.toLocaleString?r.toLocaleString():r.toString();s.text(a,n);break;default:s.obj(e,n)}},e.hjoin=function(t,e){const s=t.reduce((t,s)=>(t.push(s,e),t),[]);return s.splice(-1),s}},function(e,s){e.exports=t},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.hsmls2idomPatch=e.hsml2idomPatch=void 0;const n=s(0),i=s(1);class o{open(t,e,s,n){const o=[];let r=e._id,a=e._classes?e._classes:[],c=e._ref,h=e._hObj;for(const t in e)if(e.hasOwnProperty(t))switch(t){case"_id":case"_classes":case"_ref":case"_key":case"_skip":case"_hObj":break;case"id":r=e[t];break;case"classes":const s=e[t];a=a.concat(s?s.map(t=>t.constructor===String?t:t[1]?t[0]:void 0).filter(t=>void 0!==t):[]);break;case"class":a=a.concat(e[t].split(" "));break;case"data":const i=e[t];for(const t in i)i.hasOwnProperty(t)&&(i[t].constructor===String?o.push("data-"+t,i[t]):o.push("data-"+t,JSON.stringify(i[t])));break;case"styles":o.push("style",e[t]);break;case"on":const c=e[t];"string"==typeof c[0]?"function"==typeof c[1]?o.push("on"+c[0],c[1]):o.push("on"+c[0],t=>{n&&n.actionCb&&"function"==typeof n.actionCb&&n.actionCb(c[1],c[2],t)}):c.forEach(t=>{"function"==typeof t[1]?o.push("on"+t[0],t[1]):o.push("on"+t[0],e=>{n&&n.actionCb&&"function"==typeof n.actionCb&&n.actionCb(t[1],t[2],e)})});break;default:switch(typeof e[t]){case"function":o.push("on"+t,e[t]);break;case"object":o.push(t,e[t]);break;case"boolean":e[t]&&o.push(t,t);break;default:o.push(t,e[t])}}return a.length&&o.unshift("class",a.join(" ")),r&&o.unshift("id",r),i.elementOpen(t,e._key,void 0,...o),e._skip&&i.skip(),n&&c&&(n.refs[c]=i.currentElement()),h&&h.mount&&h.mount.constructor===Function&&(h.mount(i.currentElement()),i.skip()),!!e._skip}close(t,e,s){i.elementClose(t)}text(t,e){i.text(t)}fnc(t,e){t(i.currentElement())&&i.skip()}obj(t,e){"toHsml"in t?t.toHsml&&n.hsml(t.toHsml(),this,t):this.text(""+t,e)}}function r(t,e){n.hsml(t,new o,e)}e.hsml2idomPatch=function(t,e,s){i.patch(t,t=>t&&r(t,s),e)},e.hsmls2idomPatch=function(t,e,s){i.patch(t,t=>t&&function(t,e){for(const s of t)if(null!=s)if(s.constructor===String)i.text(s);else if("toHsml"in s){const t=s;t.toHsml&&r(t.toHsml(),t)}else r(s,e)}(t,s),e)}},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.FormValidator=e.BooleanValidator=e.DateValidator=e.NumberValidator=e.StringValidator=e.SelectValidator=e.tpl=e.Validator=e.rodneCisloRgex=e.pscRgex=e.phoneRgex=e.emailRegex=void 0;e.emailRegex=/[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?/,e.phoneRgex=/^(((00)([- ]?)|\+)(\d{1,3})([- ]?))?((\d{3})([- ]?))((\d{3})([- ]?))(\d{3})$/,e.pscRgex=/^\d{3} ?\d{2}$/,e.rodneCisloRgex=/^\s*(\d\d)(\d\d)(\d\d)[ /]*(\d\d\d)(\d?)\s*$/;class n{constructor(t,e){this.str=null,this.err=null,this.obj=null,this.opts=t||{},this.msgs=e||{}}validate(t){if("string"==typeof t||null==t){const e=t;this.str=e;const s=this.strToObj(e);if(this.obj=s.obj,s.err)return this.err=s.err,{str:null==e?"":e,obj:s.obj,err:s.err};const n=this.objCheck(s.obj);return this.err=n,{str:null==e?"":e,obj:s.obj,err:n}}{this.str=null==t?null:""+t;const e=this.objCheck(t);return this.err=e,{str:this.str,obj:t,err:e}}}format(t,e){const s=this.objToStr(t,e);return{str:void 0===s.str||null===s.str?"":s.str,err:s.err}}}function i(t,e){return Object.keys(e).map(t=>[t,e[t]]).reduce((t,e)=>t.replace(new RegExp(`\\{\\{${e[0]}\\}\\}`,"g"),String(e[1])),t)}e.Validator=n,e.tpl=i;e.SelectValidator=class extends n{constructor(t,e){super(t,e)}strToObj(t){const e=this.opts,s=this.msgs;return"required"in e&&e.required&&!t?{obj:null,err:s.required?i(s.required,Object.assign(Object.assign({},e.data),{options:"options"in e?e.options.join(", "):""})):"required"}:{obj:void 0===t?null:t,err:""}}objCheck(t){if(null==t)return"";const e=this.opts,s=this.msgs;return"options"in e&&t&&-1===e.options.indexOf(t)?s.invalid_option?i(s.invalid_option,Object.assign(Object.assign({},e.data),{option:null===t?"":t,options:"options"in e?e.options.join(", "):""})):"invalid_option":""}objToStr(t,e){return{str:t||"",err:""}}};e.StringValidator=class extends n{constructor(t,e){super(t,e)}strToObj(t){const e=this.opts,s=this.msgs;return"required"in e&&e.required&&!t?{obj:null,err:s.required?i(s.required,Object.assign(Object.assign({},e.data),{min:"min"in e?""+(e.min||""):"",max:"max"in e?""+(e.max||""):"",regexp:"regexp"in e?""+(e.regexp||""):""})):"required"}:t?"regexp"in e&&!e.regexp.test(t)?{obj:null,err:s.invalid_format?i(s.invalid_format,Object.assign(Object.assign({},e.data),{regexp:"regexp"in e?""+(e.regexp||""):""})):"invalid_format"}:{obj:t,err:""}:{obj:null,err:""}}objCheck(t){if(null==t)return"";const e=this.opts,s=this.msgs;let n=!1;return"max"in e&&t.length>e.max&&(n=!0),"min"in e&&t.length<e.min&&(n=!0),"min"in e&&"max"in e&&t.length>e.max&&t.length<e.min&&(n=!0),n?s.not_in_range?i(s.not_in_range,Object.assign(Object.assign({},e.data),{min:"min"in e?""+(e.min||""):"",max:"max"in e?""+(e.max||""):""})):"not_in_range":""}objToStr(t,e){return{str:t||"",err:""}}};e.NumberValidator=class extends n{constructor(t,e){super(t,e)}strToObj(t){const e=this.opts,s=this.msgs;if("required"in e&&e.required&&!t)return{obj:null,err:s.required?i(s.required,Object.assign(Object.assign({},e.data),{min:"min"in e?""+(e.min||""):"",max:"max"in e?""+(e.max||""):""})):"required"};if(t){const n=Number(t);let o=!1;if(isNaN(n)&&(o=!0),e.strict&&t!==this.objToStr(n).str&&(o=!0),o){const t=isNaN(n)?1234.45:n;return{obj:isNaN(n)?null:n,err:s.invalid_format?i(s.invalid_format,Object.assign(Object.assign({},e.data),{num:this.objToStr(t).str||""})):"invalid_format"}}return{obj:n,err:""}}return{obj:null,err:""}}objCheck(t){if(null==t)return"";const e=this.opts,s=this.msgs;let n=!1;return"max"in e&&t>e.max&&(n=!0),"min"in e&&t<e.min&&(n=!0),n?s.not_in_range?i(s.not_in_range,Object.assign(Object.assign({},e.data),{min:"min"in e?""+(e.min||""):"",max:"max"in e?""+(e.max||""):""})):"not_in_range":""}objToStr(t,e){let s;return s=null==t?"":"decimals"in this.opts?t.toFixed(this.opts.decimals):String(t),{str:s,err:""}}};const o=t=>t.toLocaleString(),r=t=>t.toLocaleDateString(),a=t=>t.toISOString(),c=t=>new Date(t.toDateString()).toISOString();e.DateValidator=class extends n{constructor(t,e){super(t,e),(null==t?void 0:t.iso)?this.dateToStr=(null==t?void 0:t.dateOnly)?c:a:this.dateToStr=(null==t?void 0:t.dateOnly)?r:o,(null==t?void 0:t.dateOnly)&&(null==t?void 0:t.min)&&(t.min=new Date(t.min.getFullYear(),t.min.getMonth(),t.min.getDate())),(null==t?void 0:t.dateOnly)&&(null==t?void 0:t.max)&&(t.max=new Date(t.max.getFullYear(),t.max.getMonth(),t.max.getDate()+1))}strToObj(t){const e=this.opts,s=this.msgs;if("required"in e&&e.required&&!t)return{obj:null,err:s.required?i(s.required,Object.assign(Object.assign({},e.data),{min:"min"in e&&e.min?this.dateToStr(e.min):"",max:"max"in e&&e.max?this.dateToStr(e.max):""})):"required"};if(t){const n=Date.parse(t);let o=new Date(n);e.dateOnly&&(o=new Date(o.getFullYear(),o.getMonth(),o.getDate()));let r=!1;if(isNaN(n)&&(r=!0),r){const t=isNaN(n)?new Date:o;return{obj:isNaN(n)?null:o,err:s.invalid_format?i(s.invalid_format,Object.assign(Object.assign({},e.data),{date:this.objToStr(t).str||""})):"invalid_format"}}return{obj:o,err:""}}return{obj:null,err:""}}objCheck(t){if(null==t)return"";const e=this.opts,s=this.msgs;let n=!1;return"max"in e&&e.max&&t.getTime()>e.max.getTime()&&(n=!0),"min"in e&&e.min&&t<e.min&&(n=!0),n?s.not_in_range?i(s.not_in_range,Object.assign(Object.assign({},e.data),{min:"min"in e&&e.min?this.dateToStr(e.min):"",max:"max"in e&&e.max?this.dateToStr(e.max):""})):"not_in_range":""}objToStr(t,e){return{str:null==t?"":this.dateToStr(t),err:""}}};e.BooleanValidator=class extends n{constructor(t,e){super(t,e)}strToObj(t){const e=this.opts,s=this.msgs;if("required"in e&&e.required&&!t)return{obj:null,err:s.required?i(s.required,Object.assign({},e.data)):"required"};let n;switch(t){case"true":case"1":case"on":case"yes":n=!0;break;default:n=!1}return{obj:n,err:""}}objCheck(t){if(null==t)return"";const e=this.opts,s=this.msgs;let n=!1;return"value"in e&&t!==e.value&&(n=!0),n?s.invalid_value?i(s.invalid_value,Object.assign(Object.assign({},e.data),{value:"value"in e?""+(e.value||""):""})):"invalid_value":""}objToStr(t,e){return{str:null==t?"":""+t,err:""}}};e.FormValidator=class{constructor(){this.validators={}}addValidator(t,e){return this.validators[t]=e,this}validate(t){const e=Object.keys(this.validators).reduce((e,s)=>{const n=t[s],i=this.validators[s].validate(n);return e.str[s]=i.str,e.obj[s]=i.obj,e.err[s]=i.err,i.err&&(e.valid=!1),e},{str:{},obj:{},err:{},valid:!0});return this.str=e.str,this.obj=e.obj,this.err=e.err,this.valid=e.valid,this}format(t){const e=Object.keys(this.validators).reduce((e,s)=>{const n=t[s],i=this.validators[s].format(n);return e.str[s]=i.str,e.obj[s]=n,e.err[s]=i.err,i.err&&(e.valid=!1),e},{str:{},obj:{},err:{},valid:!0});return this.str=e.str,this.obj=e.obj,this.err=e.err,this.valid=e.valid,this}data(){return{str:this.str,obj:this.obj,err:this.err,valid:this.valid}}}},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Events=void 0;e.Events=class{constructor(t){this._cb=[],this._cbs={},t&&(this._ctx=t)}emit(t,e){if(t in this._cbs)for(let s=0,n=this._cbs[t].length;s<n;s++)this._cbs[t][s](e,t,this._ctx);for(let s=0,n=this._cb.length;s<n;s++)this._cb[s](e,t,this._ctx);return this}on(t,e){const s=t;return s in this._cbs||(this._cbs[s]=[]),-1===this._cbs[s].indexOf(e)&&this._cbs[s].push(e),this}any(t){return this._cb.push(t),this}once(t,e){const s=t,n=(t,i,o)=>{this.off(s,n),e(t,i,o)};return this.on(t,n),this}off(t,e){return void 0===t&&(e?this._cb=this._cb.filter(t=>t!==e):this._cb.length=0),t&&t in this._cbs&&(e?this._cbs[t].splice(this._cbs[t].indexOf(e),1):(this._cbs[t].length=0,delete this._cbs[t])),this}}},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.hsmls2htmls=e.hsml2htmls=e.hsmls2html=e.hsml2html=void 0;const n=s(0);class i{constructor(t,e=!1,s=" "){this._depth=0,this._onHtml=t,this._pretty=e,this._indent=s}open(t,e,s,o){const r=[];let a=e._id,h=e._classes?e._classes:[],l=e._hObj;for(const t in e)if(e.hasOwnProperty(t))switch(t){case"_id":case"_classes":case"_ref":case"_key":case"_skip":case"_hObj":break;case"id":a=e[t];break;case"classes":const s=e[t];h=h.concat(s?s.map(t=>t.constructor===String?t:t[1]?t[0]:void 0).filter(t=>void 0!==t):[]);break;case"class":h=h.concat(e[t].split(" "));break;case"data":const n=e[t];for(const t in n)n.hasOwnProperty(t)&&(n[t].constructor===String?r.push(["data-"+t,n[t]]):r.push(["data-"+t,JSON.stringify(n[t])]));break;case"styles":const i=e[t];let o="";for(const t in i)if(i.hasOwnProperty(t)){o+=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()+":"+i[t]+";"}r.push(["style",o]);break;case"styles":case"on":break;default:"function"==typeof e[t]||("boolean"==typeof e[t]?e[t]&&r.push([t,""]):r.push([t,e[t]]))}h.length&&r.unshift(["class",h.join(" ")]),a&&r.unshift(["id",a]),l&&"type"in l&&r.unshift(["hObj",l.type]);const u=r.map(t=>`${t[0]}="${c(t[1])}"`).join(" ");let d="";this._pretty&&(d+=this._mkIndent(this._depth),this._depth++);if(d+="<"+t+(u?" "+u:"")+(s.length||-1!==i._pairTags.indexOf(t)?">":"/>"),this._pretty&&(d+="\n"),this._onHtml(d),l&&"render"in l&&l.render.constructor===Function){const t=l.render();for(const e of t)if(null!=e)if(e.constructor===String)this._onHtml(e+(this._pretty?"\n":""));else if("toHsml"in e){const t=e;t.toHsml&&n.hsml(t.toHsml(),this)}else n.hsml(e,this)}return!1}close(t,e,s){let n="";const o=e.length||-1!==i._pairTags.indexOf(t);this._pretty&&(this._depth--,o&&(n+=this._mkIndent(this._depth))),o&&(n+="</"+t+">",this._pretty&&(n+="\n"),this._onHtml(n))}text(t,e){let s="";this._pretty&&(s+=this._mkIndent(this._depth)),s+=t instanceof String?t:c(t),this._pretty&&(s+="\n"),this._onHtml(s)}fnc(t,e){}obj(t,e){"toHsml"in t?t.toHsml&&n.hsml(t.toHsml(),this,t):this.text(""+t,e)}_mkIndent(t){let e="";for(let s=0;s<t;s++)e+=this._indent;return e}}function o(t,e,s=!1){const o=new i(e,s);n.hsml(t,o)}function r(t,e,s=!1){for(const n of t)if(null!=n)if(n.constructor===String)e(n+(s?"\n":""));else if("toHsml"in n){const t=n;t.toHsml&&o(t.toHsml(),e,s)}else o(n,e,s)}i._pairTags=["script","iframe","html","head","body","title","div","h1","h2","h3","h4","h5","h6","p","a","pre","blockquote","i","b","em","strong","tt","cite","ol","ul","li","dl","dt","dd","table","tr","td","textarea","select","option"],e.hsml2html=o,e.hsmls2html=r,e.hsml2htmls=function(t,e=!1){const s=[];return o(t,t=>s.push(t),e),s},e.hsmls2htmls=function(t,e=!1){const s=[];return r(t,t=>s.push(t),e),s};const a=/["'&<>]/;function c(t){const e=""+t,s=a.exec(e);if(!s)return e;let n,i="",o=0,r=0;for(o=s.index;o<e.length;o++){switch(e.charCodeAt(o)){case 34:n="&quot;";break;case 38:n="&amp;";break;case 39:n="&#39;";break;case 60:n="&lt;";break;case 62:n="&gt;";break;default:continue}r!==o&&(i+=e.substring(r,o)),r=o+1,i+=n}return r!==o?i+e.substring(r,o):i}},function(t,e,s){"use strict";function n(t,e=300){let s;return function(...n){clearTimeout(s),s=setTimeout(()=>{t.apply(this,n)},e)}}Object.defineProperty(e,"__esModule",{value:!0}),e.Debounce=e.debounce=void 0,e.debounce=n,e.Debounce=function(t=300){return function(e,s,i){const o=i.value;return i.value=n(o,t),i}}},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.removeEventListener=e.addEventListener=e.html=e.empty=e.remove=e.replace=e.append=e.select=e.selectAll=void 0,e.selectAll=function(t,e){const s=(e||document).querySelectorAll(t),n=[];for(let t=0;t<s.length;t++)n.push(s[t]);return n},e.select=function(t,e){return(e||document).querySelector(t)},e.append=function(t,...e){e.forEach(e=>t.appendChild(e))},e.replace=function(t,e){t.parentElement&&t.parentElement.replaceChild(e,t)},e.remove=function(t){t.parentElement&&t.parentElement.removeChild(t)},e.empty=function(t){for(;t.firstChild;)t.removeChild(t.firstChild)},e.html=function(t){t=t.trim();let e={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],area:[1,"<map>","</map>"],param:[1,"<object>","</object>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],body:[0,"",""],_default:[1,"<div>","</div>"]};e.optgroup=e.option,e.tbody=e.tfoot=e.colgroup=e.caption=e.thead,e.th=e.td;const s=/<\s*\w.*?>/g.exec(t);let n=document.createElement("div");if(null!=s){const i=s[0].replace(/</g,"").replace(/>/g,"").split(" ")[0];if("body"===i.toLowerCase()){const e=document.createElement("body");n.innerHTML=t.replace(/<body/g,"<div").replace(/<\/body>/g,"</div>");const s=n.firstChild.attributes;e.innerHTML=t;for(let t=0;t<s.length;t++)e.setAttribute(s[t].name,s[t].value);return e}{const s=e[i]||e._default;t=s[1]+t+s[2],n.innerHTML=t;let o=s[0]+1;for(;o--;)n=n.lastChild}}else n.innerHTML=t,n=n.lastChild;return n},Element.prototype.matches||(Element.prototype.matches=Element.prototype.matchesSelector||Element.prototype.mozMatchesSelector||Element.prototype.msMatchesSelector||Element.prototype.oMatchesSelector||Element.prototype.webkitMatchesSelector||function(t){const e=(this.document||this.ownerDocument).querySelectorAll(t);let s=e.length;for(;--s>=0&&e.item(s)!==this;);return s>-1}),e.addEventListener=function(t,e,s,n,i=!1){t.addEventListener(s,(function(t){const s=t||window.event,i=s.target||t.srcElement;i&&i.matches(e)&&n(i,s)}),i)},e.removeEventListener=function(t,e,s,n=!1){t.removeEventListener(e,s,n)}},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Base64=e.UrlEncodedData=void 0;e.UrlEncodedData=class{static encode(t,e=""){let s;if("object"!=typeof t)s=t;else{const n=[];let i=0;for(let s in t)if(t.hasOwnProperty(s)){let o=t[s];o instanceof Array||(o=[o]);const r=o.length;for(let t=0;t<r;t++){const r=o[t];"object"==typeof r&&null!=r?n[i++]=arguments.callee(r,e+s+"."):(n[i]=encodeURIComponent(e+s),null!=r&&(n[i]+="="+encodeURIComponent(r)),i++)}}s=n.join("&")}return s}static decode(t){const e={};if(t){const s=t.split("&"),n=s.length;for(let t=0;t<n;t++){const n=s[t].split("="),i=decodeURIComponent(n[0]);if(n.length>1){const t=decodeURIComponent(n[1]),s=i.split("."),o=s.length;let r=e;for(let e=0;e<o;e++){const n=s[e],i=r[n];e===o-1?i?i instanceof Array?r[n].push(t):(r[n]=[i],r[n][1]=t):r[n]=t:(i||(r[n]={}),r=r[n])}}else e[i]=null}}return e}};class n{static encode(t){let e,s,i,o,r,a,c,h="",l=0;for(t=n._utf8_encode(t);l<t.length;)e=t.charCodeAt(l++),s=t.charCodeAt(l++),i=t.charCodeAt(l++),o=e>>2,r=(3&e)<<4|s>>4,a=(15&s)<<2|i>>6,c=63&i,isNaN(s)?a=c=64:isNaN(i)&&(c=64),h=h+n._keyStr.charAt(o)+n._keyStr.charAt(r)+n._keyStr.charAt(a)+n._keyStr.charAt(c);return h}static decode(t){let e,s,i,o,r,a,c,h="",l=0;for(t=t.replace(/[^A-Za-z0-9\+\/\=]/g,"");l<t.length;)o=this._keyStr.indexOf(t.charAt(l++)),r=this._keyStr.indexOf(t.charAt(l++)),a=this._keyStr.indexOf(t.charAt(l++)),c=this._keyStr.indexOf(t.charAt(l++)),e=o<<2|r>>4,s=(15&r)<<4|a>>2,i=(3&a)<<6|c,h+=String.fromCharCode(e),64!==a&&(h+=String.fromCharCode(s)),64!==c&&(h+=String.fromCharCode(i));return h=n._utf8_decode(h),h}static _utf8_encode(t){t=t.replace(/\r\n/g,"\n");let e="";for(let s=0;s<t.length;s++){const n=t.charCodeAt(s);n<128?e+=String.fromCharCode(n):n>127&&n<2048?(e+=String.fromCharCode(n>>6|192),e+=String.fromCharCode(63&n|128)):(e+=String.fromCharCode(n>>12|224),e+=String.fromCharCode(n>>6&63|128),e+=String.fromCharCode(63&n|128))}return e}static _utf8_decode(t){let e="",s=0,n=0,i=0,o=0;for(;s<t.length;)n=t.charCodeAt(s),n<128?(e+=String.fromCharCode(n),s++):n>191&&n<224?(i=t.charCodeAt(s+1),e+=String.fromCharCode((31&n)<<6|63&i),s+=2):(i=t.charCodeAt(s+1),o=t.charCodeAt(s+2),e+=String.fromCharCode((15&n)<<12|(63&i)<<6|63&o),s+=3);return e}}e.Base64=n,n._keyStr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Form=e.FileEntry=e.RadioEntry=e.SelectEntry=e.CheckboxEntry=e.NumberInputEntry=e.TextInputEntry=e.TextAreaEntry=void 0;e.TextAreaEntry=class{constructor(t){this._element="string"==typeof t?document.getElementById(t):t,this._element.addEventListener("change",()=>{this._onChange&&this._onChange(this,!0)}),this._element.addEventListener("input",()=>{this._onChange&&this._onChange(this,!1)})}getName(){return this._element.name}getValue(){return this._element.value}setValue(t){return this._element.value=t,this}validate(t=""){return this._validator?this._validator(this,t):""}setValidator(t){return this._validator=t,this}onChange(t){return this._onChange=t,this}};e.TextInputEntry=class{constructor(t){this._element="string"==typeof t?document.getElementById(t):t,this._element.addEventListener("change",()=>{this._onChange&&this._onChange(this,!0)}),this._element.addEventListener("input",()=>{this._onChange&&this._onChange(this,!1)})}getName(){return this._element.name}getValue(){return this._element.value}setValue(t){return this._element.value=t,this}validate(t=""){return this._validator?this._validator(this,t):""}setValidator(t){return this._validator=t,this}onChange(t){return this._onChange=t,this}};e.NumberInputEntry=class{constructor(t){this._decimals=0,this._dragSensitivity=1,this._element="string"==typeof t?document.getElementById(t):t,this._element.addEventListener("change",()=>{this._onChange&&this._onChange(this,!0)}),this.setDecimals(2)}getName(){return this._element.name}getValue(){return this._element.value}setValue(t){return isNaN(+t)||(this._element.value=(+t).toFixed(this._decimals)),this}setStep(t){return isNaN(t)||(this._element.step=""+t),this}setMin(t){return isNaN(t)||(this._element.min=""+t),this}setMax(t){return isNaN(t)||(this._element.max=""+t),this}setDecimals(t){return isNaN(t)||(this._decimals=t),this}setDragSensitivity(t){return isNaN(t)||(this._dragSensitivity=t),this}enableMouseWheel(){const t=()=>{this._onChange&&setTimeout(()=>{this._onChange&&this._onChange(this,!1)},0)};return this._element.addEventListener("focus",()=>{this._element.addEventListener("mousewheel",t)}),this._element.addEventListener("blur",()=>{this._element.removeEventListener("mousewheel",t)}),this}enableMouseDrag(){return this._element.addEventListener("mousedown",t=>{document.body.style.cursor="row-resize",this._element.style.cursor="row-resize";const e=t.pageY,s=Number(this.getValue()),n=""===this._element.min?null:Number(this._element.min),i=""===this._element.max?null:Number(this._element.max),o=""===this._element.step?1:Number(this._element.step),r=isNaN(s)?null===n?0:n:s,a=t=>{const s=(t.pageY-e)*this._dragSensitivity,a=r-s*o;null!==n&&a<n?this.setValue(n.toFixed(this._decimals)):null!==i&&a>i?this.setValue(i.toFixed(this._decimals)):this.setValue(a.toFixed(this._decimals)),this._onChange&&this._onChange(this,!1)},c=()=>{document.body.style.cursor="",this._element.style.cursor="",document.removeEventListener("mousemove",a),document.removeEventListener("mouseup",c),this._onChange&&this._onChange(this,!0)};document.addEventListener("mousemove",a),document.addEventListener("mouseup",c)}),this}validate(t=""){return this._validator?this._validator(this,t):""}setValidator(t){return this._validator=t,this}onChange(t){return this._onChange=t,this}};e.CheckboxEntry=class{constructor(t){this._element="string"==typeof t?document.getElementById(t):t,this._element.addEventListener("change",()=>{this._onChange&&this._onChange(this)})}getName(){return this._element.name}getValue(){return""+this._element.checked}setValue(t){return this._element.checked=!(!t||"false"===t),this}validate(t=""){return this._validator?this._validator(this,t):""}setValidator(t){return this._validator=t,this}onChange(t){return this._onChange=t,this}};e.SelectEntry=class{constructor(t){this._element="string"==typeof t?document.getElementById(t):t,this._element.addEventListener("change",()=>{this._onChange&&this._onChange(this)})}getName(){return this._element.name}getValue(){return this._element.value}setValue(t){return this._element.value=t,this}setOptions(t){const e=this._element;for(;e.options.length>0;)e.remove(0);return t.forEach(t=>{const s=document.createElement("option");s.text=t.text,s.value=t.value,e.add(s)}),this}validate(t=""){return this._validator?this._validator(this,t):""}setValidator(t){return this._validator=t,this}onChange(t){return this._onChange=t,this}};e.RadioEntry=class{constructor(t){this._elements=[],t.forEach(t=>{"string"==typeof t?this._elements.push(document.getElementById(t)):this._elements.push(t)}),this._elements.forEach(t=>{t.addEventListener("change",()=>{this._onChange&&t.checked&&this._onChange(this)})})}getName(){return this._elements[0].name}getValue(){for(let t of this._elements)if(t.checked)return t.value}setValue(t){for(let e of this._elements)e.value===t&&(e.checked=!0);return this}validate(t=""){return this._validator?this._validator(this,t):""}setValidator(t){return this._validator=t,this}onChange(t){return this._onChange=t,this}};e.FileEntry=class{constructor(t){this._element="string"==typeof t?document.getElementById(t):t,this._element.addEventListener("change",()=>{this._onChange&&this._onChange(this)})}getName(){return this._element.name}getValue(){const t=this._element.files;return t&&t.length?t[0].name+" ("+t[0].type+", "+t[0].size+")":void 0}getFile(){return this._element.files&&this._element.files.length?this._element.files[0]:null}setValue(t){return this}validate(t=""){return this._validator?this._validator(this,t):""}setValidator(t){return this._validator=t,this}onChange(t){return this._onChange=t,this}};e.Form=class{constructor(t){this._formEntries=[],this._element="string"==typeof t?document.getElementById(t):t,this._element.onsubmit=t=>(t.preventDefault(),this._onSubmit&&this._onSubmit(this),!1)}addEntry(t){return this._formEntries.push(t),this}setEntries(t){return this._formEntries=t,this}getEntries(){return this._formEntries}getEntry(t){for(let e of this._formEntries)if(e.getName()===t)return e}validate(t){const e={};for(let s of this._formEntries)e[s.getName()]=s.validate(t);return e}isValid(t){t||(t=this.validate());for(let e in t)if(t.hasOwnProperty(e)&&t[e])return!1;return!0}getValues(){const t={};for(let e of this._formEntries)t[e.getName()]=e.getValue();return t}submit(){this._element.submit()}onSubmit(t){return this._onSubmit=t,this}}},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Hash=e.hashUrlDecode=e.hashUrlEncode=e.hashJsonDecode=e.hashJsonEncode=void 0,e.hashJsonEncode=t=>t?encodeURIComponent(JSON.stringify(t)):"",e.hashJsonDecode=t=>t?JSON.parse(decodeURIComponent(t)):void 0,e.hashUrlEncode=t=>{const s="string"==typeof t?e.hashUrlDecode(t):t,n=s.path||[],i=s.query||{},o=n.map(t=>encodeURIComponent(t)).join("/"),r=Object.entries(i).reduce((t,e)=>("string"==typeof e[1]?t.append(e[0],e[1]):e[1].forEach(s=>t.append(e[0],s)),t),new URLSearchParams).toString();return`${o}${r?"?":""}${r}`},e.hashUrlDecode=t=>{const[e,s]=t.split("?"),n=e.split("/").map(t=>decodeURIComponent(t)),i={};for(const t of new URLSearchParams(s).entries()){const[e,s]=t;e in i?"string"==typeof i[e]?i[e]=[i[e],s]:i[e].push(s):i[e]=s}return{path:n,query:i}};e.Hash=class{constructor(t=!0){this._encode=t=>String(t),this._decode=t=>t,this._emitWritten=t}onChange(t){return this._cb=t,this}coders(t,e){return this._encode=t,this._decode=e,this}listen(){return this._cb&&this._cb(this.read()),"onhashchange"in window?onhashchange=()=>{const t=this.read();if(this._emitWritten)this._cb&&this._cb(t);else{const e=this._writtenDataJson===JSON.stringify(t);this._writtenDataJson=void 0,e||this._cb&&this._cb(t)}}:alert('Browser "window.onhashchange" not implemented'),this}read(){return this._decode(location.hash.slice(1))}write(t){return location.hash="#"+this._encode(t),this._emitWritten||(this._writtenDataJson=JSON.stringify(t),this._cb&&this._cb(t)),this}}},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.History=void 0;e.History=class{back(){window.history.back()}forward(){window.history.forward()}go(t){window.history.go(t)}length(){return window.history.length}state(){return window.history.state}pushState(t,e,s){window.history.pushState(t,e,s)}replaceState(t,e,s){window.history.replaceState(t,e,s)}onChange(t){return window.addEventListener("popstate",(function(e){t(e.state)})),this}}},function(t,e,s){"use strict";var n=this&&this.__awaiter||function(t,e,s,n){return new(s||(s=Promise))((function(i,o){function r(t){try{c(n.next(t))}catch(t){o(t)}}function a(t){try{c(n.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof s?e:new s((function(t){t(e)}))).then(r,a)}c((n=n.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.HApp=e.HAppAction=void 0;const i=s(2),o=console.log,r=console.error;var a;!function(t){t._init="_init",t._mount="_mount",t._umount="_umount"}(a=e.HAppAction||(e.HAppAction={}));const c=window.requestAnimationFrame||function(t){window.setTimeout(t,1e3/60)},h=window.cancelAnimationFrame||function(t){window.clearTimeout(t)};class l{constructor(t,e,s,i=document.body){this.refs={},this.dispatch=(t,e,s)=>n(this,void 0,void 0,(function*(){if(l.debug){o("HApp action:",{type:t,data:e,event:s});const n=performance.now();try{yield this.dispatcher({type:t,data:e,event:s},this.state,this.dispatch,this.refs),this.update()}catch(t){r("HApp dispatch:",t)}const i=performance.now();o("HApp dispatch:",i-n+" ms",this.state)}else try{yield this.dispatcher({type:t,data:e,event:s},this.state,this.dispatch,this.refs),this.update()}catch(t){r("HApp dispatch:",t)}})),this.render=()=>{if(l.debug){const t=performance.now();let e;try{e=this.view(this.state)}catch(t){r("HApp render:",t)}const s=performance.now();return o("HApp render:",s-t+" ms",e),e||[]}{let t;try{t=this.view(this.state)}catch(t){r("HApp render:",t)}return t||[]}},this.actionCb=(t,e,s)=>{void 0===(e=e&&e.constructor===Function?e(s):e)&&s&&(e=function(t){const e=t.target;switch(e.nodeName){case"FORM":t.preventDefault();const s=e.elements,n={};for(let t=0;t<s.length;t++){const e=d(s[t]);if("object"==typeof e){const i=Object.keys(e);if(i.length){const o=i[0],r=e[o];void 0===n[o]?n[o]=r:"string"==typeof n[o]||n[o]instanceof String?n[o]=r instanceof Array?[n[o],...r]:[n[o],r]:n[o]instanceof Array?r instanceof Array?n[o]=n[o].concat(r):n[o].push(r):n[o]=r instanceof Array?[n[o],...r]:[n[o],r],n[o]instanceof Array&&(n[o]=n[o].filter(t=>null!==t),"radio"===s[t].type&&(n[o]=n[o].length?n[o][0]:null))}}}return n;default:return d(e)}}(s)),this.dispatch(t,e,s)},this.mount=(t=document.body)=>{const e="string"==typeof t?document.getElementById(t)||document.body:t||document.body;if(e.app){e.app.umount()}if(!this.dom){this.dom=e,e.app=this;u(e,this.render(),this),this._onUpdate&&this._onUpdate(this),this.dispatch(a._mount,this.dom)}return this},this.umount=()=>{if(this.dom){this.dispatch(a._umount,this.dom),this.dom.hasAttribute("app")&&this.dom.removeAttribute("app");const t=this.dom.querySelectorAll("[app]");for(let e=0;e<t.length;e++){const s=t[e].app;s&&s.umount()}for(;this.dom.firstChild;)this.dom.removeChild(this.dom.firstChild);delete this.dom.app,this.dom=void 0}return this},this.update=()=>(this.dom&&!this._updateSched&&(this._updateSched=c(()=>{if(this.dom){const t=this.render();u(this.dom,t,this)}this._updateSched=void 0,this._onUpdate&&this._onUpdate(this)})),this),this.onUpdate=t=>(this._onUpdate=t,this),this.toHsml=()=>{if(this.dom){if(!this._updateSched)return["div",{_skip:!0}];h(this._updateSched),this._updateSched=void 0}const t=this.render();return t.push(t=>{this.dom||(this.dom=t,t.app=this,this.dispatch(a._mount,this.dom))}),["div",t]},this.toHtml=()=>this.dom?this.dom.outerHTML:"",this.state=t,this.view=e,this.dispatcher=s||(t=>n(this,void 0,void 0,(function*(){return o("HApp action:",t.type,t.data)}))),this.dispatch(a._init,this).then(()=>this.mount(i))}}function u(t,e,s){if(l.debug){const n=performance.now();i.hsmls2idomPatch(t,e,s);const r=performance.now();o("HApp update:",r-n+" ms",t)}else i.hsmls2idomPatch(t,e,s)}function d(t){let e=null;switch(t.nodeName){case"INPUT":const s=t;switch(s.type){case"text":case"hidden":case"password":case"email":case"number":case"search":case"url":case"tel":case"color":case"date":case"datetime-local":case"month":case"range":case"time":case"week":case"submit":case"button":e=s.name?{[s.name]:s.value}:s.value;break;case"radio":e=s.name?{[s.name]:s.checked?s.value:null}:s.checked?s.value:null;break;case"checkbox":e="on"===s.value?s.name?{[s.name]:String(s.checked)}:String(s.checked):s.name?{[s.name]:s.checked?String(s.value):null}:s.checked?String(s.value):null}break;case"SELECT":const n=t;if(n.multiple){const t=Array.from(n.selectedOptions).map(t=>t.value);e=n.name?{[n.name]:t}:t}else e=n.name?{[n.name]:n.value}:n.value;break;case"TEXTAREA":const i=t;e=i.name?{[i.name]:i.value}:i.value;break;case"BUTTON":const o=t;e=o.name?{[o.name]:o.value}:o.value}return e}e.HApp=l,l.debug=!1},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.hsmls2dom=e.hsml2dom=void 0;const n=s(0);class i{open(t,e,s,n){const i=document.createElement(t);let o=e._id,r=e._classes?e._classes:[],a=e._ref,c=e._hObj;for(const t in e)if(e.hasOwnProperty(t))switch(t){case"_id":case"_classes":case"_ref":case"_key":case"_skip":case"_hObj":break;case"id":o=e[t];break;case"classes":const s=e[t];r=r.concat(s?s.map(t=>t.constructor===String?t:t[1]?t[0]:void 0).filter(t=>void 0!==t):[]);break;case"class":r=r.concat(e[t].split(" "));break;case"data":const a=e[t];for(const t in a)a.hasOwnProperty(t)&&(a[t].constructor===String?i.dataset[t]=a[t]:i.dataset[t]=JSON.stringify(a[t]));break;case"styles":const c=e[t];for(const t in c)c.hasOwnProperty(t)&&(i.style[t]=c[t]);break;case"on":const h=e[t];"string"==typeof h[0]?"function"==typeof h[1]?i.addEventListener(h[0],h[1]):i.addEventListener(h[0],t=>{n&&n.actionCb&&"function"==typeof n.actionCb&&n.actionCb(h[1],h[2],t)}):h.forEach(t=>{"function"==typeof h[1]?i.addEventListener(h[0],h[1]):i.addEventListener(h[0],t=>{n&&n.actionCb&&"function"==typeof n.actionCb&&n.actionCb(h[1],h[2],t)})});break;default:"function"==typeof e[t]?i.addEventListener(t,e[t]):"boolean"==typeof e[t]?e[t]&&i.setAttribute(t,""):i.setAttribute(t,e[t])}return o&&i.setAttribute("id",o),r.length&&i.classList.add(...r),this._current?(this._current.appendChild(i),this._current=i):(this.element=i,this._current=i),n&&a&&(n.refs[a]=this._current),c&&c.mount&&c.mount.constructor===Function&&c.mount(i),!!e._skip}close(t,e,s){this._current!==this.element&&this._current&&(this._current=this._current.parentElement||void 0)}text(t,e){this._current&&this._current.appendChild(document.createTextNode(t))}fnc(t,e){this._current&&t(this._current)}obj(t,e){"toHsml"in t?t.toHsml&&n.hsml(t.toHsml(),this,t):this.text(""+t,e)}}function o(t,e){const s=new i;return n.hsml(t,s,e),s.element}e.hsml2dom=o,e.hsmls2dom=function(t,e){const s=[];for(const n of t)if(null!=n)if(n.constructor===String)s.push(document.createTextNode(n));else if("toHsml"in n){const t=n;t.toHsml&&s.push(o(t.toHsml(),t))}else s.push(o(n,e));return s}},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.h=void 0,e.h=function(t,e,s){const n=[t];return e&&("string"==typeof e||"number"==typeof e?n.push([e]):(Array.isArray(e),n.push(e))),s&&("string"==typeof s||"number"==typeof s?n.push([s]):(Array.isArray(s)||"function"==typeof s)&&n.push(s)),n}},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.HCtrl=void 0;const n=s(2),i=s(1),o=(t,e,s)=>n=>{if(n.ctrl){const i=n.ctrl;if(i.view===t.view)void 0!==e&&(i.state=e),i.update();else{i.umount();const o=new c(t,s);void 0!==e&&(o.state=e),o.mount(n)}}else{const i=new c(t,s);void 0!==e&&(i.state=e),i.mount(n)}return!0},r=window.requestAnimationFrame||function(t){window.setTimeout(t,1e3/60)},a=window.cancelAnimationFrame||function(t){window.clearTimeout(t)};class c{constructor(t,e){this.type="Ctrl",this.id=this.type+"-"+c._count++,this.refs={},this.appAction=(t,e,s)=>{c.debug&&console.log("appAction",this.type,t,e,s),c.appActions&&c.appActions(this,t,e,s)},this.extAction=(t,e,s)=>{c.debug&&console.log("extAction",this.type,t,e,s),this._extAction&&this._extAction(t,e,s)},this.action=(t,e,s)=>{c.debug&&console.log("action",this.type,t,e,s),this._actions&&this._actions(this,t,e,s)},this.render=()=>this.view(this.state,this.action,o),this.actionCb=(t,e,s)=>{void 0===(e=e&&e.constructor===Function?e(s):e)&&s&&(e=function(t){const e={},s=t.target;switch(s.nodeName){case"INPUT":const t=s;switch(t.type){case"text":case"hidden":case"password":case"email":case"number":case"search":case"url":case"tel":case"color":case"date":case"datetime-local":case"month":case"range":case"time":case"week":case"submit":case"button":case"radio":case"number":e[t.name]=t.value;break;case"checkbox":e[t.name]=""+t.checked}break;case"SELECT":const n=s;e[n.name]=n.value;break;case"TEXTAREA":const i=s;e[i.name]=i.innerText;break;case"BUTTON":const o=s;e[o.name]=o.value}return e}(s)),this.action(t,e,s)},this.mount=t=>{const e="string"==typeof t?document.getElementById(t)||document.body:t||document.body;if(e.ctrl){const t=e.ctrl;t&&t.umount()}if(!this.dom){c._ctrls[this.id]=this,this.dom=e,e.ctrl=this;const t=this.render();n.hsmls2idomPatch(e,t,this),e.setAttribute("ctrl",this.type),this.action("_mount",this.dom)}return this},this.umount=()=>{if(this.dom){delete c._ctrls[this.id],this.action("_umount",this.dom),this.dom.hasAttribute("ctrl")&&this.dom.removeAttribute("ctrl");const t=this.dom.querySelectorAll("[ctrl]");for(let e=0;e<t.length;e++){const s=t[e].ctrl;s&&s.umount()}for(;this.dom.firstChild;)this.dom.removeChild(this.dom.firstChild);delete this.dom.ctrl,this.dom=void 0}return this},this.update=()=>(this.dom&&!this._updateSched&&(this._updateSched=r(()=>{this.dom&&n.hsmls2idomPatch(this.dom,this.render(),this),this._updateSched=void 0})),this),this.toHsml=()=>{if(this.dom){if(!this._updateSched)return["div",{_skip:!0,_id:this.id,_key:this.id,ctrl:this.type}];a(this._updateSched),this._updateSched=void 0}const t=this.render();return t.push(t=>{this.dom||(this.dom=t,t.ctrl=this,c._ctrls[this.id]=this,this.action("_mount",this.dom))}),["div",{_id:this.id,_key:this.id,ctrl:this.type},t]},this.toHtml=()=>this.dom?this.dom.outerHTML:"",this.view=t.view,this.type=t.type,this.state=t.state,this._actions=t.actions,this._extAction=e||this.appAction,this.action("_init")}appActions(t){return c.appActions=t,this}appCtrls(){return Object.values(c._ctrls)}}e.HCtrl=c,c.debug=!1,c._count=0,c._ctrls={},i.notifications.nodesDeleted=t=>{t.forEach(t=>{if(1===t.nodeType&&t.ctrl){const e=t.ctrl;e&&e.umount()}})}},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.htmls=e.html=void 0;const n=s(5),i=(t,e,s)=>{},o=(t,e)=>t.view(e||t.state,i,o);e.html=function(t,e,s,r=!1){n.hsmls2html(t.view(e,i,o),s,r)},e.htmls=function(t,e,s=!1){return n.hsmls2htmls(t.view(e,i,o),s).join("")}},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.HWidget=void 0;const n=s(2),i=s(1),o=window.requestAnimationFrame||function(t){window.setTimeout(t,1e3/60)},r=window.cancelAnimationFrame||function(t){window.clearTimeout(t)};class a{constructor(t){this.type=this.constructor.name,this.id=this.type+"-"+a._count++,this.refs={},this.toHtml=()=>this.dom?this.dom.outerHTML:"",t&&(this.type=t)}onMount(){console.log("mount")}onUmount(){console.log("umount")}actions(t,e){console.log(t,e)}action(t,e){this.actions(t,e)}actionCb(t,e,s){e=e&&e.constructor===Function?e(s):void 0===e?s:e,this.action(t,e)}mount(t){const e="string"==typeof t?document.getElementById(t)||document.body:t||document.body;if("widget"in e){const t=e.widget;t&&t.umount()}if(!this.dom){a.mounted[this.id]=this,this.dom=e,e.widget=this;const t=this.render();n.hsmls2idomPatch(e,t,this),e.setAttribute("widget",this.type),this.onMount&&this.onMount()}return this}umount(){if(this.dom){delete a.mounted[this.id],this.onUmount&&this.onUmount(),this.dom.hasAttribute("widget")&&this.dom.removeAttribute("widget");const t=this.dom.querySelectorAll("[widget]");for(let e=0;e<t.length;e++){const s=t[e].widget;s&&s.umount()}for(;this.dom.firstChild;)this.dom.removeChild(this.dom.firstChild);delete this.dom.widget,this.dom=void 0}return this}update(){return this.dom&&!this._updateSched&&(this._updateSched=o(()=>{this.dom&&n.hsmls2idomPatch(this.dom,this.render(),this),this._updateSched=void 0})),this}toHsml(){if(this.dom){if(!this._updateSched)return["div",{_skip:!0,_id:this.id,_key:this.id,widget:this.type}];r(this._updateSched),this._updateSched=void 0}const t=this.render();return t.push(t=>{this.dom||(this.dom=t,t.widget=this,this.onMount&&this.onMount())}),["div",{_id:this.id,_key:this.id,widget:this.type},t]}}e.HWidget=a,a._count=0,a.mounted={},i.notifications.nodesDeleted=t=>{t.forEach(t=>{if(1===t.nodeType&&"widget"in t){const e=t.widget;e&&e.umount()}})}},function(t,e,s){"use strict";function n(t){return Array.isArray?Array.isArray(t):null!=t&&void 0!==t&&-1==="boolean|number|string|function|xml".indexOf(typeof t)&&("number"==typeof t.length&&!t.propertyIsEnumerable("length"))}function i(t){const e=[];for(const s in t)if(t.hasOwnProperty(s)){const i=t[s];if("object"==typeof i)if(n(i))for(const t of i)e.push([s,"object"==typeof t?JSON.stringify(t):t]);else e.push([s,JSON.stringify(i)]);else e.push([s,i])}for(let t,s=0;t=e[s++];)e[s-1]=`${encodeURIComponent(t[0])}=${encodeURIComponent(t[1])}`;return e.join("&")}Object.defineProperty(e,"__esModule",{value:!0}),e.http=e.onError=e.onResponse=e.onRequest=e.del=e.patch=e.put=e.post=e.get=e.HttpRequest=e.authBasic=e.HttpResponse=e.encodeUrlQuery=e.decodeUrlQuery=e.isArray=void 0,e.isArray=n,e.decodeUrlQuery=function(t){const e={};if(t){const s=t.substr(1).split("&");for(const t of s){const s=t.split("=");e[decodeURIComponent(s[0])]=decodeURIComponent(s[1]||"")}}return e},e.encodeUrlQuery=i;class o{constructor(t){this._xhr=t}getHeaders(){return this._xhr.getAllResponseHeaders()}getHeader(t){return this._xhr.getResponseHeader(t)}getBody(){return this._xhr.response}getType(){return this._xhr.responseType}getContentType(){return this.getHeader("Content-Type")}getText(){return this._xhr.responseText}getJson(){return JSON.parse(this._xhr.responseText)}getXml(){return this._xhr.responseXML}}e.HttpResponse=o,e.authBasic=(t,e)=>s=>{s.headers({Authorization:"Basic "+btoa(t+":"+e)})};class r{constructor(){this._method="GET",this._headers={},this._async=!0,this._noCache=!1}static abortAll(){r.xhrs.forEach(t=>t.abort()),r.xhrs.length=0}get(t,e){return this.method("GET"),this.url(t,e),this}post(t,e){return this.method("POST"),this.url(t,e),this}put(t,e){return this.method("PUT"),this.url(t,e),this}patch(t,e){return this.method("PATCH"),this.url(t,e),this}del(t,e){return this.method("DELETE"),this.url(t,e),this}url(t,e){return this._url=t,this._query=e,this}method(t){return this._method=t,this}headers(t){for(const e in t)t.hasOwnProperty(e)&&(this._headers[e]=t[e]);return this}use(t){return t(this),this}timeout(t){return this._timeout=t,this}responseType(t){return this._responseType=t,this}onProgress(t){return this._onProgress=t,this}onResponse(t){return this._onResponse=t,this}onError(t){return this._onError=t,this}async(t=!0){return this._async=t,this}noCache(t=!0){return this._noCache=t,this}abort(){return this._xhr&&this._xhr.abort(),this}send(t,e){e&&(this._headers["Content-Type"]=e),this._send(t,this._headers)}sendPromise(t,e){return new Promise((s,n)=>{this._onResponse=s,this._onError=n,e&&(this._headers["Content-Type"]=e),this._send(t,this._headers)})}_send(t,e){const s=new XMLHttpRequest;this._xhr=s;let n=this._url||"";if(this._query){const t=i(this._query);n=t?`${n}?${t}`:n}if(this._noCache&&(n+=(/\?/.test(n)?"&":"?")+(new Date).getTime()),this._responseType&&(this._xhr.responseType=this._responseType),"onprogress"in s&&this._onProgress){const t=t=>{this._onProgress({loaded:t.loaded,total:t.lengthComputable?t.total:void 0})};s.upload.onprogress=t,s.onprogress=t}r.xhrs.push(this),s.open(this._method,n,this._async);for(const t in e)e.hasOwnProperty(t)&&s.setRequestHeader(t,e[t]);if(this._timeout&&(s.timeout=this._timeout),"ontimeout"in s&&(this._onError||r.onError)&&(s.ontimeout=t=>{r.onError&&r.onError(t),this._onError&&this._onError(t)}),"onabort"in s&&(this._onError||r.onError)&&(s.onabort=t=>{r.onError&&r.onError(t),this._onError&&this._onError(t)}),(this._onError||r.onError)&&(s.onerror=t=>{r.onError&&r.onError(t),this._onError&&this._onError(t)}),!this._async){if(t){const e="string"==typeof t?t:JSON.stringify(t);s.send(e)}else s.send();return JSON.parse(s.responseText)}"onload"in s?s.onload=t=>{if(r.xhrs=r.xhrs.filter(t=>this!==t),s.status>=200&&s.status<300){const t=new o(s);r.onResponse&&r.onResponse(t),this._onResponse&&this._onResponse(t)}else r.onError&&r.onError(t),this._onError&&this._onError(t)}:s.onreadystatechange=t=>{switch(s.readyState){case 4:if(r.xhrs=r.xhrs.filter(t=>this!==t),s.status>=200&&s.status<300){const t=new o(s);r.onResponse&&r.onResponse(t),this._onResponse&&this._onResponse(t)}else r.onError&&r.onError(t),this._onError&&this._onError(t)}},void 0!==t?"string"==typeof t||t instanceof FormData||t instanceof Blob?s.send(t):(this._headers["Content-Type"]||s.setRequestHeader("Content-Type","application/json"),s.send(JSON.stringify(t))):s.send()}}function a(t,e){return(new r).method("GET").url(t,e)}function c(t,e){return(new r).method("POST").url(t,e)}function h(t,e){return(new r).method("PUT").url(t,e)}function l(t,e){return(new r).method("DELETE").url(t,e)}function u(t){r.onRequest=t}function d(t){r.onResponse=t}function m(t){r.onError=t}e.HttpRequest=r,r.xhrs=[],e.get=a,e.post=c,e.put=h,e.patch=function(t,e){return(new r).method("PATCH").url(t,e)},e.del=l,e.onRequest=u,e.onResponse=d,e.onError=m,e.http={get:a,post:c,put:h,delete:l,onRequest:u,onResponse:d,onError:m}},function(t,e,s){"use strict";function n(t,e){const s=document.createElement("script");s.type="text/javascript",s.charset="utf-8",s.src=t,s.readyState?s.onreadystatechange=()=>{const t="loaded"===s.readyState,n="complete"===s.readyState;(t||n)&&(s.onreadystatechange=null,"function"==typeof e&&e())}:s.onload=()=>{"function"==typeof e&&e()},document.getElementsByTagName("head")[0].appendChild(s)}Object.defineProperty(e,"__esModule",{value:!0}),e.css=e.image=e.scripts=e.script=e.scriptLib=void 0,e.scriptLib=function(t,e,s){n(t,()=>{const t=window[e];window[e]={},delete window[e],s&&s(t)})},e.script=n,e.scripts=function(t,e){t.reverse();let s=e;for(let e=0;e<t.length;e++){s=((t,e)=>()=>n(t,()=>e&&e()))(t[e],s)}s&&s()},e.image=function(t,e){const s=new Image;s.src=t,s.readyState?s.onreadystatechange=()=>{"function"==typeof e&&e()}:s.onload=()=>{"function"==typeof e&&e()}},e.css=function(t,e){const s=document.createElement("link");s.type="text/css",s.rel="stylesheet",s.href=t,s.readyState?s.onreadystatechange=()=>{"function"==typeof e&&e()}:s.onload=()=>{"function"==typeof e&&e()},document.getElementsByTagName("head")[0].appendChild(s)}},function(t,e,s){"use strict";function n(t,e=[],s={}){return Object.keys(t).reduce((s,i)=>{const o=e.concat(i);return"object"==typeof t[i]&&null!==t[i]?n(t[i],o,s):0===s[t[i]]||s[t[i]]?s[t[i]].push(o):s[t[i]]=[o],s},s)}Object.defineProperty(e,"__esModule",{value:!0}),e.objValuePaths=e.objPaths=void 0,e.objPaths=function(t){const e=n(t);return Object.keys(e).map(t=>e[t]).reduce((t,e)=>t.concat(e))},e.objValuePaths=n},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.route=e.Router=e.Route=e.Emitter=void 0;class n{constructor(){this._callbacks={}}on(t,e){return t in this._callbacks||(this._callbacks[t]=[]),this._callbacks[t].push(e),this}emit(t,...e){return t in this._callbacks&&this._callbacks[t].forEach(t=>t.apply(this,e)),this}off(t,e){if(!this._callbacks||0===arguments.length)return this._callbacks={},this;const s=this._callbacks[t];if(!s)return this;if(1===arguments.length)return delete this._callbacks[t],this;for(let t=0;t<s.length;t++){if(s[t]===e){s.splice(t,1);break}}return this}}e.Emitter=n;class i{constructor(t){this._params={},this.keys=[],this.path=t,this._pathParse(t,!1,!1)}match(t,e){const s=this._regex.exec(t);if(!s)return!1;for(let t=1;t<s.length;++t){const n=this.keys[t-1],i="string"==typeof s[t]?decodeURIComponent(s[t]):s[t];n&&(this._params[n.name]=i),e.push(i)}return!0}_pathParse(t,e,s){t instanceof RegExp?this._regex=t:(t instanceof Array&&(t="("+t.join("|")+")"),t=t.concat(s?"":"/?").replace(/\/\(/g,"(?:/").replace(/\+/g,"__plus__").replace(/(\/)?(\.)?:(\w+)(?:(\(.*?\)))?(\?)?/g,(t,e,s,n,i,o)=>(this.keys.push({name:n,optional:!!o}),e=e||"",(o?"":e)+"(?:"+(o?e:"")+(s||"")+(i||(s?"([^/.]+?)":"([^/]+?)"))+")"+(o||""))).replace(/([\/.])/g,"\\$1").replace(/__plus__/g,"(.+)").replace(/\*/g,"(.*)"),this._regex=new RegExp("^"+t+"$",e?"":"i"))}}e.Route=i;class o extends n{constructor(){super(),this._routes=[],this._onHashChange=()=>{this.handle(this.hash())},window.addEventListener?window.addEventListener("hashchange",this._onHashChange,!1):window.attachEvent("onhashchange",this._onHashChange)}static route(t,e){return o.default.route(t,e),o.default}static navigate(t,e=!1){return o.default.navigate(t,e),o.default}static start(){return o.default.start(),o.default}static hash(){return o.default.hash()}static handle(t){return o.default.handle(t)}route(t,e){const s=new i(t);return this._routes.push(s),this.on(t,(t,s)=>e.apply(s,t)),this}navigate(t,e=!1){const s=this.hash();return window.location.hash=t,e&&s===t&&this.handle(t),this}start(){return this._onHashChange(),this}hash(){return window.location.hash.substring(1)}handle(t){for(const e of this._routes){const s=[];if(e.match(t,s)){this.emit(e.path,s,e);break}}return this}}e.Router=o,o.default=new o,e.route=function(t,e){return o.route(t,e)}},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Settings=void 0;const n=s(4);e.Settings=class{constructor(t,e="settings"){this.events=new n.Events,this.props=t,this.name=e}getProps(){return this.props}setProps(t){return Object.keys(t).forEach(e=>this.props[e]=t[e]),this.events.emit("",t),this}getProp(t){return this.props[t]}setProp(t,e){this.props[t]=e;return this.events.emit(t,e),this}}},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Signal=void 0;e.Signal=class{constructor(){this._slots=[],this._emit=!0}onConnect(t){this._onConnect=t}onDisconnect(t){this._onDisconnect=t}connNo(){return this._slots.length}connect(t,e){"function"==typeof t&&(e?this._slots.push({callback:t,object:e}):this._slots.push({callback:t}),this._onConnect&&this._onConnect(this._slots.length))}disconnect(t,e){"function"==typeof t&&(this._slots=this._slots.filter(s=>void 0===e?s.callback!==t:s.callback!==t&&s.object!==e),this._onDisconnect&&this._onDisconnect(this._slots.length))}disconnectAll(){this._slots=[],this._onDisconnect&&this._onDisconnect(this._slots.length)}freeze(){this._emit=!1}unfreeze(){this._emit=!0}emit(t){return this._emit&&this._slots.length?this._slots.map(e=>{const s=e.object;return s?e.callback.call(s,t):e.callback(t)}):[]}}},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.template=e.tmpl=void 0,e.tmpl=function(t,e){const s=/[^a-zA-Z0-9_-]+/.test(t)?t:document.getElementById(t).innerHTML;let n,i,o=JSON.stringify,r=/\$\{([\S\s]*?)\}/g,a=[],c=0;for(;i=r.exec(s);)n=s.slice(c,i.index),a.push(o(n),"("+i[1]+")"),c=r.lastIndex;n=s.slice(c),a.push(o(n));const h=new Function("obj","with(obj)return "+a.join("+"));return e?h(e):h};const n={};e.template=function t(e,s){const i=/[^a-zA-Z0-9_-]+/.test(e)?new Function("obj","var p=[],print=function(){p.push.apply(p,arguments);};with(obj){p.push('"+e.replace(/[\r\t\n]/g," ").split("<%").join("\t").replace(/((^|%>)[^\t]*)'/g,"$1\r").replace(/\t=(.*?)%\>/g,"',$1,'").split("\t").join("');").split("%>").join("\np.push('").split("\r").join("\\'")+"');}return p.join('');"):n[e]=n[e]||t(document.getElementById(e).innerHTML);return s?i(s):i}},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.tmpl=e.tmplo=e.tmpla=e.tmpls=void 0,e.tmpls=function(t,e){return Object.keys(e).map(t=>[t,e[t]]).reduce((t,e)=>t.replace(new RegExp(`\\{\\{${e[0]}\\}\\}`,"g"),String(e[1])),t)},e.tmpla=function(t,e){return e.reduce((t,e,s)=>t.replace(new RegExp(`\\$\\{${s}\\}`,"g"),e),t)},e.tmplo=function(t,e){return Object.keys(e).map(t=>[t,e[t]]).reduce((t,e)=>t.replace(new RegExp(`\\$\\{${e[0]}\\}`,"g"),e[1]),t)},e.tmpl=function(t){const e=JSON.stringify,s=/\$\{([\S\s]*?)\}/g,n=[];let i,o,r=0;for(;i=s.exec(t);)o=t.slice(r,i.index),n.push(e(o),"("+i[1]+")"),r=s.lastIndex;return o=t.slice(r),n.push(e(o)),new Function("obj","with(obj)return "+n.join("+"))}},,,,function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.validators=e.tmpl=e.template=e.signal=e.settings=e.router=e.objpaths=e.load=e.http=e.hsml=e.hsmlwidget=e.hsmlsvac=e.hsmlsvachtml=e.hsmlsvacctrl=e.hsmlidom=e.hsmlhtml=e.hsmlh=e.hsmldom=e.hsmlapp=e.history=e.hash=e.form=e.events=e.encode=e.dom=e.debounce=void 0;const n=s(6);e.debounce=n;const i=s(7);e.dom=i;const o=s(8);e.encode=o;const r=s(4);e.events=r;const a=s(9);e.form=a;const c=s(10);e.hash=c;const h=s(11);e.history=h;const l=s(12);e.hsmlapp=l;const u=s(13);e.hsmldom=u;const d=s(14);e.hsmlh=d;const m=s(5);e.hsmlhtml=m;const p=s(2);e.hsmlidom=p;const f=s(15);e.hsmlsvacctrl=f;const _=s(16);e.hsmlsvachtml=_;const g=s(17);e.hsmlsvac=g;const b=s(18);e.hsmlwidget=b;const y=s(0);e.hsml=y;const v=s(19);e.http=v;const j=s(20);e.load=j;const w=s(21);e.objpaths=w;const E=s(22);e.router=E;const x=s(23);e.settings=x;const C=s(24);e.signal=C;const S=s(25);e.template=S;const O=s(26);e.tmpl=O;const k=s(3);e.validators=k}])}));
2
2
  //# sourceMappingURL=index.js.map