{"version":3,"sources":["jsdelivr-header.js","/npm/lighterhtml@4.2.0/esm/tagger.js","/npm/lighterhtml@4.2.0/esm/index.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,iiBCIA,MAkBM,EAAW,mBAGX,EAAO,CAAC,EAAM,IAAS,EAAK,cAAc,eAAe,GAExD,SAAS,EAAO,GAErB,OADA,KAAK,KAAO,EACL,EAAU,KACnB,CAsMA,SAAS,EAAO,GACd,OAAO,EAAS,KAClB,CAtMA,EAAO,UAAY,CASjB,SAAA,CAAU,EAAM,EAAM,GACpB,MAAM,EAAsB,QAAd,KAAK,KACnB,OAAQ,GACN,IAAK,QACH,GAAI,EACF,OAAO,EAAU,EAAM,EAAM,GAC/B,EAAO,YACT,IAAK,QACH,OAAO,EAAO,EAAM,GACtB,IAAK,OACH,OAAO,EAAK,GACd,IAAK,QACH,OAAO,EAAW,EAAM,EAAU,GACpC,IAAK,MACH,OAAO,EAAI,GACb,IAAK,WACH,OAAO,EAAK,GACd,QACE,MAAyB,MAArB,EAAK,MAAM,EAAG,GACT,EAAO,EAAM,EAAK,MAAM,IACR,MAArB,EAAK,MAAM,EAAG,GACT,EAAQ,EAAM,EAAK,MAAM,IACT,OAArB,EAAK,MAAM,EAAG,GACT,EAAM,EAAM,KACjB,KAAQ,IAAU,GAAS,EAAS,KAAK,GAEtC,EAAU,EAAM,EAAM,GA/Df,EAAC,EAAM,KAC3B,IAAI,EACJ,OAAO,IACD,IAAa,IACf,EAAW,EACP,EAAK,KAAU,IACD,MAAZ,GAEF,EAAK,GAAQ,GACb,EAAK,gBAAgB,IAErB,EAAK,GAAQ,GAEvB,CACG,EAgDc,CAAc,EAAM,GAIrC,EAUE,GAAA,CAAI,EAAM,GACR,MAAM,KAAC,GAAQ,KACf,IACI,EADA,GAAW,EAEf,MAAM,EAAa,IACjB,cAAe,GACb,IAAK,SACL,IAAK,SACL,IAAK,UACC,EACE,IAAa,IACf,EAAW,EACX,EAAW,GAAG,YAAc,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EAAQ,CACpB,OACA,WACA,MACA,KAAM,EAAW,EAAI,KAAa,IAExC,CAGE,OAAO,EAAM,IAAI,EAGb,EAAe,CAAC,GAAS,SAAQ,EAAQ,KAC7C,IAAK,IAAI,EAAI,EAAG,EAAI,EAAQ,IAAK,CAC/B,MAAM,EAAO,EAAO,GAChB,aAAgB,EAClB,EAAO,GAAK,EACV,EACA,EAAM,KAAO,EAAM,GAAK,KACxB,GAEK,EAAQ,GACf,EACE,EACA,EAAM,KAAO,EAAM,GAAK,KACxB,EACA,EAAK,QAGP,EAAM,GAAK,IACjB,CACM,EAAS,EAAM,QACjB,EAAM,OAAO,EAAO,EAIxB,SAAS,EAAY,EAAM,GACzB,KAAK,KAAO,EACZ,KAAK,SAAW,EAAK,QACrB,KAAK,OAAS,CAChB,CALA,EAAO,GAMK,MAAC,EAAO,EAEP,EAAS,IACpB,MAAM,EAAY,EAAO,GAQzB,OAPA,EAAK,GAAW,SAAQ,IACtB,EAAU,GAAO,EAAU,GACzB,EAAU,KACD,YAAR,EAAoB,EAAe,QACrC,IAEH,EAAa,UAAY,EAClB,EAAa,GACpB,SAAS,IACP,OAAO,EAAO,MAAM,KAAM,UAC9B,IAGM,OAAC,EAAM,KAAE,EAAI,IAAE,GAAO,EAAa,GAGzC,SAAS,IACP,IAAI,EAAM,GAAI,EAAI,GAAG,OAAC,GAAU,UAChC,KAAO,EAAI,GACT,EAAI,KAAK,UAAU,MACrB,OAAO,CACT,Q","file":"/npm/lighterhtml@4.2.0/esm/index.js/+esm","sourceRoot":"","sourcesContent":["/**\n * Bundled by jsDelivr using Rollup v2.79.2 and Terser v5.39.0.\n * Original file: /npm/lighterhtml@4.2.0/esm/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","import createContent from '@ungap/create-content';\nimport udomdiff from 'udomdiff';\nimport domtagger from 'domtagger';\nimport hyperStyle from 'hyperhtml-style';\nimport {aria, attribute, boolean, data, event, ref, setter} from 'uhandlers';\nimport {diffable} from 'uwire';\n\nimport {isArray, slice} from 'uarray';\n\n// special attributes helpers\nconst hyperProperty = (node, name) => {\n  let oldValue;\n  return newValue => {\n    if (oldValue !== newValue) {\n      oldValue = newValue;\n      if (node[name] !== newValue) {\n        if (newValue == null) {\n          // cleanup before dropping the attribute to fix IE/Edge gotcha\n          node[name] = '';\n          node.removeAttribute(name);\n        } else\n          node[name] = newValue;\n      }\n    }\n  };\n};\n\n// list of attributes that should not be directly assigned\nconst readOnly = /^(?:form|list)$/i;\n\n// simplifies text node creation\nconst text = (node, text) => node.ownerDocument.createTextNode(text);\n\nexport function Tagger(type) {\n  this.type = type;\n  return domtagger(this);\n};\n\nTagger.prototype = {\n\n  // there are four kind of attributes, and related behavior:\n  //  * events, with a name starting with `on`, to add/remove event listeners\n  //  * special, with a name present in their inherited prototype, accessed directly\n  //  * regular, accessed through get/setAttribute standard DOM methods\n  //  * style, the only regular attribute that also accepts an object as value\n  //    so that you can style=${{width: 120}}. In this case, the behavior has been\n  //    fully inspired by Preact library and its simplicity.\n  attribute(node, name, original) {\n    const isSVG = this.type === 'svg';\n    switch (name) {\n      case 'class':\n        if (isSVG)\n          return attribute(node, name, isSVG);\n        name = 'className';\n      case 'props':\n        return setter(node, name);\n      case 'aria':\n        return aria(node);\n      case 'style':\n        return hyperStyle(node, original, isSVG);\n      case 'ref':\n        return ref(node);\n      case '.dataset':\n        return data(node);\n      default:\n        if (name.slice(0, 1) === '.')\n          return setter(node, name.slice(1));\n        if (name.slice(0, 1) === '?')\n          return boolean(node, name.slice(1));\n        if (name.slice(0, 2) === 'on')\n          return event(node, name);\n        if (name in node && !(isSVG || readOnly.test(name)))\n          return hyperProperty(node, name);\n        return attribute(node, name, isSVG);\n\n    }\n  },\n\n  // in a hyper(node)`<div>${content}</div>` case\n  // everything could happen:\n  //  * it's a JS primitive, stored as text\n  //  * it's null or undefined, the node should be cleaned\n  //  * it's a promise, update the content once resolved\n  //  * it's an explicit intent, perform the desired operation\n  //  * it's an Array, resolve all values if Promises and/or\n  //    update the node with the resulting list of content\n  any(node, childNodes) {\n    const {type} = this;\n    let fastPath = false;\n    let oldValue;\n    const anyContent = value => {\n      switch (typeof value) {\n        case 'string':\n        case 'number':\n        case 'boolean':\n          if (fastPath) {\n            if (oldValue !== value) {\n              oldValue = value;\n              childNodes[0].textContent = value;\n            }\n          } else {\n            fastPath = true;\n            oldValue = value;\n            childNodes = udomdiff(\n              node.parentNode,\n              childNodes,\n              [text(node, value)],\n              diffable,\n              node\n            );\n          }\n          break;\n        case 'function':\n          anyContent(value(node));\n          break;\n        case 'object':\n        case 'undefined':\n          if (value == null) {\n            fastPath = false;\n            childNodes = udomdiff(\n              node.parentNode,\n              childNodes,\n              [],\n              diffable,\n              node\n            );\n            break;\n          }\n        default:\n          fastPath = false;\n          oldValue = value;\n          if (isArray(value)) {\n            if (value.length === 0) {\n              if (childNodes.length) {\n                childNodes = udomdiff(\n                  node.parentNode,\n                  childNodes,\n                  [],\n                  diffable,\n                  node\n                );\n              }\n            } else {\n              switch (typeof value[0]) {\n                case 'string':\n                case 'number':\n                case 'boolean':\n                  anyContent(String(value));\n                  break;\n                case 'function':\n                  anyContent(value.map(invoke, node));\n                  break;\n                case 'object':\n                  if (isArray(value[0])) {\n                    value = value.concat.apply([], value);\n                  }\n                default:\n                  childNodes = udomdiff(\n                    node.parentNode,\n                    childNodes,\n                    value,\n                    diffable,\n                    node\n                  );\n                  break;\n              }\n            }\n          } else if ('ELEMENT_NODE' in value) {\n            childNodes = udomdiff(\n              node.parentNode,\n              childNodes,\n              value.nodeType === 11 ?\n                slice.call(value.childNodes) :\n                [value],\n                diffable,\n                node\n            );\n          } else if ('text' in value) {\n            anyContent(String(value.text));\n          } else if ('any' in value) {\n            anyContent(value.any);\n          } else if ('html' in value) {\n            childNodes = udomdiff(\n              node.parentNode,\n              childNodes,\n              slice.call(\n                createContent(\n                  [].concat(value.html).join(''),\n                  type\n                ).childNodes\n              ),\n              diffable,\n              node\n            );\n          } else if ('length' in value) {\n            anyContent(slice.call(value));\n          }\n          break;\n      }\n    };\n    return anyContent;\n  },\n\n  // style or textareas don't accept HTML as content\n  // it's pointless to transform or analyze anything\n  // different from text there but it's worth checking\n  // for possible defined intents.\n  text(node) {\n    let oldValue;\n    const textContent = value => {\n      if (oldValue !== value) {\n        oldValue = value;\n        const type = typeof value;\n        if (type === 'object' && value) {\n          if ('text' in value) {\n            textContent(String(value.text));\n          } else if ('any' in value) {\n            textContent(value.any);\n          } else if ('html' in value) {\n            textContent([].concat(value.html).join(''));\n          } else if ('length' in value) {\n            textContent(slice.call(value).join(''));\n          }\n        } else if (type === 'function') {\n          textContent(value(node));\n        } else {\n          node.textContent = value == null ? '' : value;\n        }\n      }\n    };\n    return textContent;\n  }\n};\n\nfunction invoke(callback) {\n  return callback(this);\n}\n","import WeakMap from '@ungap/weakmap';\nimport domsanitizer from 'domsanitizer';\nimport {isArray} from 'uarray';\nimport umap from 'umap';\nimport {persistent} from 'uwire';\n\nimport {Tagger} from './tagger.js';\n\nconst {create, freeze, keys} = Object;\n\nconst tProto = Tagger.prototype;\n\nconst cache = umap(new WeakMap);\n\nconst createRender = Tagger => ({\n  html: outer('html', Tagger),\n  svg: outer('svg', Tagger),\n  render(where, what) {\n    const hole = typeof what === 'function' ? what() : what;\n    const info = cache.get(where) || cache.set(where, createCache());\n    const wire = hole instanceof LighterHole ?\n                  unroll(Tagger, info, hole) : hole;\n    if (wire !== info.wire) {\n      info.wire = wire;\n      where.textContent = '';\n      where.appendChild(wire.valueOf());\n    }\n    return where;\n  }\n});\n\nconst createCache = () => ({stack: [], entry: null, wire: null});\n\nconst outer = (type, Tagger) => {\n  const cache = umap(new WeakMap);\n  const fixed = info => function () {\n    return unroll(Tagger, info, hole.apply(null, arguments));\n  };\n  hole.for = (ref, id) => {\n    const memo = cache.get(ref) || cache.set(ref, create(null));\n    return memo[id] || (memo[id] = fixed(createCache()));\n  };\n  hole.node = function () {\n    return unroll(\n      Tagger,\n      createCache(),\n      hole.apply(null, arguments)\n    ).valueOf();\n  };\n  return hole;\n  function hole() {\n    return new LighterHole(type, tta.apply(null, arguments));\n  }\n};\n\nconst unroll = (Tagger, info, {type, template, values}) => {\n  const {length} = values;\n  unrollValues(Tagger, info, values, length);\n  let {entry} = info;\n  if (!entry || (entry.template !== template || entry.type !== type)) {\n    const tag = new Tagger(type);\n    info.entry = (entry = {\n      type,\n      template,\n      tag,\n      wire: persistent(tag(template, ...values))\n    });\n  }\n  else\n    entry.tag(template, ...values);\n  return entry.wire;\n};\n\nconst unrollValues = (Tagger, {stack}, values, length) => {\n  for (let i = 0; i < length; i++) {\n    const hole = values[i];\n    if (hole instanceof Hole)\n      values[i] = unroll(\n        Tagger,\n        stack[i] || (stack[i] = createCache()),\n        hole\n      );\n    else if (isArray(hole))\n      unrollValues(\n        Tagger,\n        stack[i] || (stack[i] = createCache()),\n        hole,\n        hole.length\n      );\n    else\n      stack[i] = null;\n  }\n  if (length < stack.length)\n    stack.splice(length);\n};\n\nfreeze(LighterHole);\nfunction LighterHole(type, args) {\n  this.type = type;\n  this.template = args.shift();\n  this.values = args;\n};\nexport const Hole = LighterHole;\n\nexport const custom = overrides => {\n  const prototype = create(tProto);\n  keys(overrides).forEach(key => {\n    prototype[key] = overrides[key](\n      prototype[key] ||\n      (key === 'convert' ? domsanitizer : String)\n    );\n  });\n  CustomTagger.prototype = prototype;\n  return createRender(CustomTagger);\n  function CustomTagger() {\n    return Tagger.apply(this, arguments);\n  }\n};\n\nconst {render, html, svg} = createRender(Tagger);\nexport {render, html, svg};\n\nfunction tta() {\n  let out = [], i = 0, {length} = arguments;\n  while (i < length)\n    out.push(arguments[i++]);\n  return out;\n}\n"]}