@epa-wg/custom-element-dist 0.0.29 → 0.0.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (134) hide show
  1. package/.idea/custom-element-dist.iml +11 -0
  2. package/.idea/inspectionProfiles/Project_Default.xml +24 -0
  3. package/.idea/misc.xml +6 -0
  4. package/.idea/modules.xml +8 -0
  5. package/.idea/vcs.xml +6 -0
  6. package/.storybook/main.ts +21 -19
  7. package/.storybook/preview.ts +25 -25
  8. package/README.md +4 -4
  9. package/coverage/coverage-final.json +21 -21
  10. package/coverage/index.html +24 -24
  11. package/coverage/src/custom-element/coverage.svg +1 -1
  12. package/coverage/src/custom-element/custom-element.js/coverage.svg +1 -1
  13. package/coverage/src/custom-element/custom-element.js.html +247 -241
  14. package/coverage/src/custom-element/http-request.js.html +3 -3
  15. package/coverage/src/custom-element/index.html +14 -14
  16. package/coverage/src/custom-element/local-storage.js.html +52 -52
  17. package/coverage/src/custom-element/location-element.js.html +4 -4
  18. package/coverage/src/custom-element/module-url.js.html +1 -1
  19. package/coverage/src/index.html +1 -1
  20. package/coverage/src/mocks/handlers.ts.html +1 -1
  21. package/coverage/src/mocks/index.html +1 -1
  22. package/coverage/src/stories/attributes.test.stories.ts.html +28 -28
  23. package/coverage/src/stories/coverage.svg +1 -1
  24. package/coverage/src/stories/css.test.stories.ts.html +1 -1
  25. package/coverage/src/stories/dom-merge.test.stories.ts.html +1 -1
  26. package/coverage/src/stories/external-template.test.stories.ts.html +1 -1
  27. package/coverage/src/stories/form.test.stories.ts.html +1 -1
  28. package/coverage/src/stories/http-request.stories.ts.html +1 -1
  29. package/coverage/src/stories/index.html +19 -19
  30. package/coverage/src/stories/local-storage.test.stories.ts.html +17 -17
  31. package/coverage/src/stories/location-element.test.stories.ts.html +3 -6
  32. package/coverage/src/stories/module-url.test.stories.ts.html +1 -1
  33. package/coverage/src/stories/set-url.test.stories.ts.html +1 -1
  34. package/coverage/src/stories/slice-events.test.stories.ts/coverage.svg +1 -1
  35. package/coverage/src/stories/slice-events.test.stories.ts.html +284 -23
  36. package/coverage/src/stories/slots.test.stories.ts.html +1 -1
  37. package/coverage/src/stories/testStoryBook.ts.html +7 -7
  38. package/coverage/src/stories/version-select.test.stories.ts.html +1 -1
  39. package/coverage/src/sum.ts.html +1 -1
  40. package/dist/custom-element-BbJMY20-.cjs +97 -0
  41. package/dist/{custom-element-BOIPgtxz.js → custom-element-CoRNKeEP.js} +122 -120
  42. package/dist/custom-element-bundle.cjs +1 -1
  43. package/dist/custom-element-bundle.js +2 -2
  44. package/dist/demo/a.svg +26 -26
  45. package/dist/demo/data-slices.html +37 -0
  46. package/package.json +13 -13
  47. package/public/demo/a.svg +26 -26
  48. package/public/demo/data-slices.html +37 -0
  49. package/src/custom-element/custom-element.js +4 -2
  50. package/src/custom-element/demo/a.svg +26 -26
  51. package/src/custom-element/demo/data-slices.html +37 -0
  52. package/src/custom-element/ide/web-types-dce.json +1 -1
  53. package/src/custom-element/ide/web-types-xsl.json +1 -1
  54. package/src/material/angular.css +987 -987
  55. package/src/material/components/autocomplete.html +239 -240
  56. package/src/material/components/dropdown.html +92 -45
  57. package/src/material/components/icon-link.html +160 -160
  58. package/src/material/components/menu.html +234 -234
  59. package/src/material/components.html +121 -120
  60. package/src/material/demo.css +36 -31
  61. package/src/material/index.html +110 -110
  62. package/src/material/material.css +356 -356
  63. package/src/material/theme/README.md +17 -17
  64. package/src/material/theme/semantic.css +113 -112
  65. package/src/mocks/versions.mock.ts +8 -8
  66. package/src/stories/attributes.test.stories.ts +20 -20
  67. package/src/stories/location-element.test.stories.ts +1 -2
  68. package/src/stories/slice-events.test.stories.ts +87 -0
  69. package/storybook-static/assets/Color-F6OSRLHC-CFyd3TND.js +1 -0
  70. package/storybook-static/assets/{Configure-DOhzHFEs.js → Configure-UGTbPRKK.js} +1 -1
  71. package/storybook-static/assets/{DocsRenderer-CFRXHY34-BSJkbsd6.js → DocsRenderer-CFRXHY34-Dpr5iB0o.js} +2 -2
  72. package/storybook-static/assets/{attributes.test.stories-BJBuuXgZ.js → attributes.test.stories-DSOLHHOW.js} +38 -36
  73. package/storybook-static/assets/{css.test.stories-pgbBc17d.js → css.test.stories-Cgn6ICr0.js} +1 -1
  74. package/storybook-static/assets/custom-element-D59Fok1f.js +97 -0
  75. package/storybook-static/assets/{dom-merge.test.stories-CXcYP_-J.js → dom-merge.test.stories-CBObfPWg.js} +1 -1
  76. package/storybook-static/assets/entry-preview-DHVXbf3x.js +26 -0
  77. package/storybook-static/assets/entry-preview-docs-BbcIMweR.js +2 -0
  78. package/storybook-static/assets/{external-template.test.stories-CpJ68Ghy.js → external-template.test.stories-VfKUQ8eu.js} +1 -1
  79. package/storybook-static/assets/{form.test.stories-D35lyqd8.js → form.test.stories-CnuGN7Zw.js} +1 -1
  80. package/storybook-static/assets/{handlers-CW9pDZnt.js → handlers-V_T7WjNK.js} +21 -21
  81. package/storybook-static/assets/{http-request.stories-CBbknCOO.js → http-request.stories-8NN1Coqm.js} +1 -1
  82. package/storybook-static/assets/iframe-DnhkgdtG.js +2 -0
  83. package/storybook-static/assets/index-3Sfy-t3H.js +769 -0
  84. package/storybook-static/assets/index-BcZLpTeD.js +8 -0
  85. package/storybook-static/assets/index-CIBI7sCB.js +1 -0
  86. package/storybook-static/assets/{index-BSz1w4Gl.js → index-CxRwF5Or.js} +130 -130
  87. package/storybook-static/assets/{index-YxUFxnQR.js → index-DN1RoK17.js} +1 -1
  88. package/storybook-static/assets/{index-B3QjF0Ed.js → index-DjJD7gkO.js} +1 -1
  89. package/storybook-static/assets/{local-storage.test.stories-BY-PWhuk.js → local-storage.test.stories-Dk5Yqc7m.js} +1 -1
  90. package/storybook-static/assets/{location-element.test.stories-3auBYEaU.js → location-element.test.stories-56um6s5L.js} +1 -1
  91. package/storybook-static/assets/{module-url.test.stories-B7L9cL60.js → module-url.test.stories-DEponQ7l.js} +1 -1
  92. package/storybook-static/assets/{preview-BRPR-UXC.js → preview-CNKoaWES.js} +1 -1
  93. package/storybook-static/assets/preview-Czc-sw5H.js +2 -0
  94. package/storybook-static/assets/preview-DAeyCMnM.js +1 -0
  95. package/storybook-static/assets/{preview-CfWMRsRq.js → preview-vbpHsp94.js} +2 -2
  96. package/storybook-static/assets/{set-url.test.stories-CuSuDLIx.js → set-url.test.stories-B4E6hIe-.js} +1 -1
  97. package/storybook-static/assets/{slice-events.test.stories-BkRKsKem.js → slice-events.test.stories-BR0F-B6I.js} +138 -13
  98. package/storybook-static/assets/{slots.test.stories-BJCUWFkE.js → slots.test.stories-CgfJIyCr.js} +1 -1
  99. package/storybook-static/assets/tiny-invariant-CopsF_GD.js +1 -0
  100. package/storybook-static/assets/{version-select.test.stories-B3ybJn_Z.js → version-select.test.stories-nmxATIwv.js} +1 -1
  101. package/storybook-static/demo/a.svg +26 -26
  102. package/storybook-static/demo/data-slices.html +37 -0
  103. package/storybook-static/iframe.html +2 -2
  104. package/storybook-static/index.html +4 -0
  105. package/storybook-static/index.json +1 -1
  106. package/storybook-static/project.json +1 -1
  107. package/storybook-static/sb-addons/chromatic-com-storybook-10/manager-bundle.js +333 -0
  108. package/storybook-static/sb-addons/chromatic-com-storybook-10/manager-bundle.js.LEGAL.txt +40 -0
  109. package/storybook-static/sb-addons/essentials-actions-3/manager-bundle.js +1 -1
  110. package/storybook-static/sb-addons/essentials-backgrounds-4/manager-bundle.js +8 -8
  111. package/storybook-static/sb-addons/essentials-controls-2/manager-bundle.js +82 -85
  112. package/storybook-static/sb-addons/essentials-measure-7/manager-bundle.js +1 -1
  113. package/storybook-static/sb-addons/essentials-outline-8/manager-bundle.js +1 -1
  114. package/storybook-static/sb-addons/essentials-viewport-5/manager-bundle.js +1 -1
  115. package/storybook-static/sb-addons/interactions-9/manager-bundle.js +66 -67
  116. package/storybook-static/sb-addons/storybook-core-core-server-presets-0/common-manager-bundle.js +1 -1
  117. package/storybook-static/sb-manager/globals-module-info.js +25 -3
  118. package/storybook-static/sb-manager/globals-runtime.js +29585 -43124
  119. package/storybook-static/sb-manager/runtime.js +10647 -9399
  120. package/storybook-static/sb-preview/runtime.js +3536 -5860
  121. package/test-runner-jest.config.js +15 -0
  122. package/dist/custom-element-CUsSENWc.cjs +0 -97
  123. package/src/stories/__screenshots__/http-request.test.ts/http-request-url-change-1.png +0 -0
  124. package/storybook-static/assets/Color-ERTF36HU-CQkSD2nd.js +0 -1
  125. package/storybook-static/assets/custom-element-BDGsYgbP.js +0 -97
  126. package/storybook-static/assets/entry-preview-C313OLrj.js +0 -26
  127. package/storybook-static/assets/entry-preview-docs-B7ORr9w5.js +0 -2
  128. package/storybook-static/assets/iframe-DOi4N7qI.js +0 -2
  129. package/storybook-static/assets/index-BdcJ-iJ7.js +0 -8
  130. package/storybook-static/assets/index-CaL3Qp7t.js +0 -634
  131. package/storybook-static/assets/index-DgFM0Ce3.js +0 -1
  132. package/storybook-static/assets/preview-C992A1Y-.js +0 -2
  133. package/storybook-static/assets/preview-CcS4DQh8.js +0 -1
  134. package/storybook-static/assets/tiny-invariant-BxWVcicq.js +0 -1
@@ -0,0 +1,97 @@
1
+ "use strict";const Y="http://www.w3.org/1999/XSL/Transform",H="http://www.w3.org/1999/xhtml",Ne="http://exslt.org/common",f=(e,l)=>e.getAttribute?.(l),te=e=>e.nodeType===3,Ae=e=>typeof e=="string",Te=e=>e&&typeof e.nodeType=="number",$=(e,l)=>(e.ownerDocument||e).createTextNode(l),ne=e=>{for(;e.firstChild;)e.firstChild.remove();return e},V=e=>(e.getAttributeNames().map(l=>e.removeAttribute(l)),ne(e)),ae=e=>(e?.setAttribute("xmlns:xsl",Y),e),ie=e=>(e?.setAttribute("xmlns:xhtml",H),ae(e)),oe=e=>/^[_a-zA-Z][-_:a-zA-Z0-9]*$/.test(e),w=(e,l="",t=document)=>{const s=i=>(r=>(l&&r.append($(t.ownerDocument||t,l)),r))((t.ownerDocument||t).createElement(i));if(oe(e))return s(e);const n=s("dce-object");return n.setAttribute("dce-object-name",e),n},se=(e,l)=>{const t=e.ownerDocument.createElementNS(e.namespaceURI,l);for(let s of e.attributes)t.setAttribute(s.name,s.value);for(;e.firstChild;)t.append(e.firstChild);return t};function j(e){return new DOMParser().parseFromString(e,"application/xml")}function P(e){return new XMLSerializer().serializeToString(e)}function k(e,l,t,s){const n=x=>e.ownerDocument.createElement(x),r=((x,p,N)=>(p.append(N=n(x)),N))(l,e);return[...t].forEach(x=>r.append(s(x))),r}function we(e){return e.slot||(e.setAttribute||(e=w("span",e.textContent.replaceAll(`
2
+ `,""))),e.setAttribute("slot","")),e}function le(e,l){e.getAttributeNames().forEach(t=>l.includes(t)||e.removeAttribute(t))}const G=e=>[...e].filter(l=>!(l.nodeType===3&&l.data.trim()===""));function z(e,l,t){const s=typeof e;if(s==="string")return w(l,e,t);if(s==="number")return w(l,""+e,t);if(e instanceof Array){const i=w("array","",t);return e.map(r=>i.append(z(r,l,t))),i}if(e instanceof FormData){const i=w("form-data","",t);for(const r of e)i.append(z(r[1],r[0],t));return i}const n=w(l,"",t);for(let i in e)Te(e[i])||typeof e[i]=="function"||e[i]instanceof Window||(typeof e[i]!="object"&&oe(i)?n.setAttribute(i,e[i]):n.append(z(e[i],i,t)));return n}function Z(e){if(L(e,"*",l=>[...l.childNodes].filter(t=>t.nodeType===3&&t.parentNode.localName!=="style"&&t.data).forEach(t=>{const s=t.data,n=s.matchAll(/{([^}]*)}/g);if(n){let i=0,r=p=>$(t,p),x=[];if([...n].forEach(p=>{p.index>i&&x.push(r(p.input.substring(i,p.index)));const N=e.querySelector("value-of").cloneNode();N.setAttribute("select",p[1]),x.push(N),i=p.index+p[0].length}),i<s.length&&x.push(r(s.substring(i,s.length))),x.length){for(let p of x)l.insertBefore(p,t);l.removeChild(t)}}})),"all"in e){let l=1;for(let t of e.all)t.setAttribute&&!t.tagName.startsWith("xsl:")&&t.setAttribute("data-dce-id",""+l++)}return e}function re(e,l="xsl:stylesheet"){if(e.tagName===l||e.documentElement?.tagName===l)return Z(e);const t=j(`<xsl:stylesheet version="1.0" xmlns:xsl="${Y}" xmlns:xhtml="${H}" xmlns:exsl="${Ne}" exclude-result-prefixes="exsl" >
3
+ <xsl:output method="xml"/>
4
+ <xsl:template match="/"><dce-root xmlns="${H}"><xsl:apply-templates select="*" /></dce-root></xsl:template>
5
+ <xsl:template match="*[name()='template']">
6
+ <xsl:apply-templates mode="sanitize" select="*|text()"/>
7
+ </xsl:template>
8
+ <xsl:template match="*">
9
+ <xsl:apply-templates mode="sanitize" select="*|text()"/>
10
+ </xsl:template>
11
+ <xsl:template match="*[name()='svg']|*[name()='math']">
12
+ <xsl:apply-templates mode="sanitize" select="."/>
13
+ </xsl:template>
14
+ <xsl:template mode="sanitize" match="*[count(text())=1 and count(*)=0]">
15
+ <xsl:copy>
16
+ <xsl:apply-templates mode="sanitize" select="@*"/>
17
+ <xsl:value-of select="text()"></xsl:value-of>
18
+ </xsl:copy>
19
+ </xsl:template>
20
+ <xsl:template mode="sanitize" match="xhtml:*[count(text())=1 and count(*)=0]">
21
+ <xsl:element name="{local-name()}">
22
+ <xsl:apply-templates mode="sanitize" select="@*"/>
23
+ <xsl:value-of select="text()"></xsl:value-of>
24
+ </xsl:element>
25
+ </xsl:template>
26
+ <xsl:template mode="sanitize" match="*|@*">
27
+ <xsl:copy>
28
+ <xsl:apply-templates mode="sanitize" select="*|@*|text()"/>
29
+ </xsl:copy>
30
+ </xsl:template>
31
+ <xsl:template mode="sanitize" match="text()[normalize-space(.) = '']"/>
32
+ <xsl:template mode="sanitize" match="text()">
33
+ <dce-text>
34
+ <xsl:copy/>
35
+ </dce-text>
36
+ </xsl:template>
37
+ <xsl:template mode="sanitize" match="xsl:value-of|*[name()='slot']">
38
+ <xsl:copy>
39
+ <xsl:apply-templates mode="sanitize" select="*|@*|text()"/>
40
+ </xsl:copy>
41
+ </xsl:template>
42
+ <xsl:template mode="sanitize" match="xhtml:*">
43
+ <xsl:element name="{local-name()}">
44
+ <xsl:apply-templates mode="sanitize" select="*|@*|text()"/>
45
+ </xsl:element>
46
+ </xsl:template>
47
+ <xsl:template mode="sanitize" match="xhtml:input">
48
+ <xsl:element name="{local-name()}">
49
+ <xsl:apply-templates mode="sanitize" select="*|@*|text()"/>
50
+ </xsl:element>
51
+ <xsl:for-each select="*">
52
+ <xsl:copy>
53
+ <xsl:attribute name="for" >^</xsl:attribute>
54
+ <xsl:apply-templates mode="sanitize" select="*|@*|text()"/>
55
+ </xsl:copy>
56
+ </xsl:for-each>
57
+ </xsl:template>
58
+ </xsl:stylesheet>`),s=new XSLTProcessor,n=(a=>{L(a,"custom-element",y=>{y.firstElementChild.localName==="template"&&([...y.firstElementChild.content.childNodes].forEach(b=>y.append(b)),y.firstElementChild.remove())}),L(a,"script",y=>y.remove());const c=a.content??a.firstElementChild?.content??a.body??a;ye.forEach(y=>L(c,y,b=>be(b,c)));const A=a.firstElementChild?.content||a.content,E=y=>{const b=j("<xhtml/>"),I=b.importNode(y,!0);return b.replaceChild(I,b.documentElement),ie(I)};if(A){const y=w("div");return[...A.childNodes].map(b=>y.append(b.cloneNode(!0))),E(y)}return E(a.documentElement||a.body||a)})(e),i=j(`<xsl:stylesheet version="1.0"
59
+ xmlns:xsl="${Y}"
60
+ xmlns:xhtml="${H}"
61
+ xmlns:dce="urn:schemas-epa-wg:dce"
62
+ xmlns:exsl="http://exslt.org/common"
63
+ exclude-result-prefixes="exsl"
64
+ >
65
+ <xsl:template match="ignore">
66
+ <xsl:choose>
67
+ <xsl:when test="//attr">{//attr}</xsl:when>
68
+ <xsl:otherwise>{def}</xsl:otherwise>
69
+ </xsl:choose><xsl:value-of select="."></xsl:value-of></xsl:template>
70
+ <xsl:template mode="payload" match="attributes"></xsl:template>
71
+ <xsl:template match="/">
72
+ <xsl:apply-templates mode="payload" select="/datadom/attributes"/>
73
+ </xsl:template>
74
+ <xsl:template name="slot" >
75
+ <xsl:param name="slotname" />
76
+ <xsl:param name="defaultvalue" />
77
+ <xsl:choose>
78
+ <xsl:when test="//payload/*[@slot=$slotname]">
79
+ <xsl:copy-of select="//payload/*[@slot=$slotname]"/>
80
+ </xsl:when>
81
+ <xsl:otherwise>
82
+ <xsl:copy-of select="$defaultvalue"/>
83
+ </xsl:otherwise>
84
+ </xsl:choose>
85
+ </xsl:template>
86
+ <xsl:variable name="js-injected-body">
87
+ <xsl:call-template name="slot" >
88
+ <xsl:with-param name="slotname" select="''"/>
89
+ <xsl:with-param name="defaultvalue"/>
90
+ </xsl:call-template>
91
+ </xsl:variable>
92
+ </xsl:stylesheet>`);s.importStylesheet(t);const r=s.transformToFragment(n,document),x=(a,c)=>a.querySelector(c),p=x(i,'template[mode="payload"]');if(!r)return console.error("transformation error",{xml:n.outerHTML,xsl:P(t)});if(r.firstElementChild.localName!=="dce-root"){const a=r.ownerDocument.createElement("dce-root");[...r.childNodes].forEach(c=>a.append(c)),r.append(a)}const N=[];[...r.querySelectorAll("dce-root>attribute")].forEach(a=>{le(a,"namespace,name,select");const c=se(a,"xsl:param"),A=f(a,"name");p.append(c),le(c,"select,name");let E=f(c,"select")?.split("??");E||(E=["//"+A,`'${c.textContent}'`],V(c),c.setAttribute("name",A));let y;if(E?.length>1){c.removeAttribute("select");const b=x(i,'template[match="ignore"]>choose').cloneNode(!0);V(b.firstElementChild).append($(b,"{"+E[0]+"}")),V(b.lastElementChild).append($(b,"{"+E[1]+"}")),b.firstElementChild.setAttribute("test",E[0]),c.append(b),y=b.cloneNode(!0)}else y=se(a,"xsl:value-of");y.removeAttribute("name"),a.append(y),a.removeAttribute("select"),N.push(c)}),[...r.querySelectorAll("[value]")].filter(a=>a.getAttribute("value").match(/\{(.*)\?\?(.*)\}/g)).forEach(a=>{const c=f(a,"value");c&&a.setAttribute("value",xe(c))});for(const a of r.childNodes)p.append(i.importNode(a,!0));[...p.getElementsByTagName("xsl:template")].forEach(a=>p.ownerDocument.documentElement.append(a));const C=x(i,'call-template[name="slot"]'),u=a=>{const c=C.cloneNode(!0),A=f(a,"name");A&&c.firstElementChild.setAttribute("select",`'${A}'`);for(let E of a.childNodes)c.lastElementChild.append(E);return c};L(p,"slot",a=>a.parentNode.replaceChild(u(a),a));const m=Z(i);return m.params=N,m}async function ce(e){return await new Promise((t,s)=>{const n=new XMLHttpRequest;n.open("GET",e),n.responseType="document",n.onload=()=>{n.readyState===n.DONE&&n.status===200?t(n.responseXML?.body||n.responseXML||w("div",n.responseText)):s(`${n.statusText} - ${e}`)},n.addEventListener("error",i=>s(i)),n.send()})}function me(e,l,t=!1){if(e===l)return!0;if(typeof e!="object"||e===null||typeof l!="object"||l===null||Object.keys(e).length!==Object.keys(l).length)return t;for(let s in e)if(!(s in l)||!me(e[s],l[s]))return t;return!0}const ue=e=>e.split("|").map(l=>l.trim()).filter(l=>l),de=(e,l)=>ue(l).map(t=>{let s=e.ownerDocument,n=i=>(e.append(i),i);if(t.includes("/")){const i=[],r=s.evaluate(t,e);for(let x;x=r.iterateNext();)i.push(x);return i}return[...e.childNodes].find(i=>i.localName===t)||n(w(t,"",s))}).flat();function J(e,l,t,s){if(!t.sliceProcessed)return t.sliceProcessed=1,de(e,l??"").map(n=>{const i=e.ownerDocument,r=t.sliceEventSource,x=t.sliceElement,p=()=>[...n.childNodes].filter(d=>d.nodeType===3||d.localName==="value"||d.localName==="form-data").map(d=>d.remove());r.getAttributeNames().map(d=>n.setAttribute(d,f(r,d))),[...n.childNodes].filter(d=>d.localName==="event").map(d=>d.remove()),"validationMessage"in r&&n.setAttribute("validation-message",r.validationMessage),t.type==="init"&&p(),n.append(z(t,"event",i));const N=(r.type==="checkbox"||r.type==="radio")&&!r.checked;if(x.hasAttribute("slice-value")){r.value===void 0?n.removeAttribute("value"):n.setAttribute("value",r.value);const d=N?"":M(f(x,"slice-value"),n);p(),n.append($(i,d))}else{if("elements"in r)return p(),n.append(z(new FormData(r),"value",n.ownerDocument)),n;const d=N?"":r.value??f(r,"value");p(),d==null?[...n.childNodes].filter(C=>C.localName!=="event").map(C=>C.remove()):Ae(d)?n.append($(i,d)):n.append(z(d,"value",n.ownerDocument))}return n})}function L(e,l,t){e.querySelectorAll&&[...e.querySelectorAll(l)].forEach(t)}const Se=async(e,l)=>{if(!e||!e.trim())return[l];if(e.startsWith("#"))return(t=>{const s=t.querySelectorAll(e);return[...s.length?s:t.getRootNode().querySelectorAll(e)]})(l.parentElement);try{const[t,s]=e.split("#");if(e.charAt(0)===".")e=new URL(t,l.closest("[base]")?.getAttribute("base")||location).href;else try{e=(void 0)(t),s&&(e+="#"+s)}catch(i){console.error(i.message)}const n=await ce(e);if(l.setAttributeNS("xml","base",e),s){const i=n.querySelectorAll("#"+s);return i.length?[...i]:(console.error("template not found",e+"#"+s),[l])}return[n]}catch{return[l]}};function pe(e,l){for(let t of e.attributes)t.namespaceURI?l.setAttributeNS(t.namespaceURI,t.name,t.value):l.setAttribute(t.name,t.value),t.name==="value"&&(l.value=t.value)}function K(e,l=0){const t={};for(const s of e.childNodes){const n=f(s,"data-dce-id")||s.dceId||0;if(!t[n])n?t[n]=1:(t[n]=s.dceId=++l,s.setAttribute&&s.setAttribute("data-dce-id",s.dceId));else{const i=s.dceId=n+"-"+t[n]++;s.setAttribute&&s.setAttribute("data-dce-id",i)}s.childNodes.length&&K(s)}}function fe(e,l,t){t=1*t;for(let s of e.childNodes)if((s.dceId??s.getAttribute("data-dce-id")*1)>t)return e.insertBefore(l,s);e.append(l)}function Q(e,l){if(e.firstElementChild?.localName==="dce-root"&&l[0].localName!=="dce-root")return;if(!l.length)return e.firstElementChild?.localName!=="dce-root"&&ne(e);const t={};for(let s of e.childNodes)t[s.dceId],te(s)?(s.data.trim(),t[s.dceId||0]=s):t[f(s,"data-dce-id")||0]=s;for(let s of[...l]){const n=f(s,"data-dce-id")||s.dceId,i=t[n];i?(te(s)?i.nodeValue!==s.nodeValue&&(i.nodeValue=s.nodeValue):(pe(s,i),(i.childNodes.length||s.childNodes.length)&&Q(i,s.childNodes)),delete t[n]):fe(e,s,n)}for(let s of Object.values(t))s.localName!=="dce-root"&&s.remove()}function he(e,l){return e.hasAttribute(l)||e.setAttribute(l,crypto.randomUUID()),e.getAttribute(l)}const xe=e=>[...e?.matchAll(/([^{}]*)(\{)([^}]+)}([^{}]*)/g)].map(t=>`${t[1]}{${O(t[3])}}${t[4]}`).join(""),O=e=>{if(!e.trim())return e;const l=e.split("??"),t=l.shift(),s=O(l.join("??"));return l.length?`concat( ${t} , substring( ${s} , (1+string-length( ${s} )) * string-length( ${t} ) ) )`:e},M=(e,l)=>{const t=e.split("??");if(t.length>1)return M(t[0],l)||M(t[1],l);e=O(e);const s=l.ownerDocument.evaluate(e,l);switch(s.resultType){case XPathResult.NUMBER_TYPE:return s.numberValue;case XPathResult.STRING_TYPE:return s.stringValue;case XPathResult.BOOLEAN_TYPE:return s.booleanValue}let n="";for(let i;i=s.iterateNext();)n+=i.textContent;return n},ye="stylesheet,transform,import,include,strip-space,preserve-space,output,key,decimal-format,namespace-alias,value-of,copy-of,number,apply-templates,apply-imports,for-each,sort,if,choose,when,otherwise,attribute-set,call-template,with-param,variable,param,text,processing-instruction,element,attribute,comment,copy,message,fallback".split(","),be=(e,l)=>{const t=w("xsl:"+e.localName);for(let s of e.attributes)t.setAttribute(s.name,s.value);for(;e.firstChild;)t.append(e.firstChild);if(e.parentElement)e.parentElement.replaceChild(t,e);else{const s=e.parentElement||l,n=[...s.childNodes];n.forEach((i,r)=>{i===e&&(n[r]=t)}),s.replaceChildren(...n)}};class ge extends HTMLElement{static observedAttributes=["src","tag","hidden"];async connectedCallback(){this.firstElementChild&&this.firstElementChild.localName!=="template"&&console.warn(`custom-element used without template wrapping content
93
+ `,this.outerHTML);const l=await Se(f(this,"src"),this),t=f(this,"tag"),s=t||"dce-"+crypto.randomUUID();for(const u of l)L(u.templateNode||u.content||u,"style",m=>{const a=m.closest("slot"),c=a?`slot[name="${a.name}"]`:"";m.innerHTML=`${s} ${c}{${m.innerHTML}}`,this.append(m)});const n=l.map(u=>re(u)),i=n.map((u,m)=>{m=new XSLTProcessor;try{m.importStylesheet(u)}catch(a){console.error(a,P(u))}return m});Object.defineProperty(this,"xsltString",{get:()=>n.map(u=>P(u)).join(`
94
+ `)});const r=this,x=[...this.templateNode.querySelectorAll("[slice]")],p=x.map(u=>f(u,"slice")).filter(u=>!u.includes("/")).filter((u,m,a)=>a.indexOf(u)===m).map(ue).flat(),N=n.reduce((u,m)=>(m.params&&u.push(...m.params),u),[]);class d extends HTMLElement{static get observedAttributes(){return N.map(m=>f(m,"name"))}#e=0;connectedCallback(){let m=G(this.childNodes);if(this.firstElementChild?.tagName==="TEMPLATE"){this.firstElementChild!==this.lastElementChild&&console.error("payload should have TEMPLATE as only child",this.outerHTML);const h=this.firstElementChild;h.remove(),m=G(h.content.childNodes);for(const g of m)if(g.localName==="style"){const o=he(this,"data-dce-style");g.innerHTML=`${s}[data-dce-style="${o}"]{${g.innerHTML}}`,h.insertAdjacentElement("beforebegin",g)}else g.nodeType===1?h.insertAdjacentElement("beforebegin",g):g.nodeType===3&&h.insertAdjacentText("beforebegin",g.data)}const a=j("<datadom/>").documentElement,c=(h,g="")=>(o=>(g&&o.append($(a,g)),o))(a.ownerDocument.createElement(h)),A=k(a,"payload",m,we);ae(A),ie(A),this.innerHTML="";const E=k(a,"attributes",this.attributes,h=>c(h.nodeName,h.value));k(a,"dataset",Object.keys(this.dataset),h=>c(h,this.dataset[h]));const y=k(a,"slice",p,h=>c(h,"")),b=h=>M(h,y);this.xml=a;const I=[],ee=()=>{const h={};for(let g;g=I.pop();){const o=f(g.sliceElement,"slice");h[o]||(J(y,o,g),h[o]=g)}Object.keys(h).length!==0&&U()};let _;this.onSlice=h=>{I.push(h),_||(_=setTimeout(()=>{ee(),_=0},1))};const U=this.transform=()=>{if(this.#e)debugger;this.#e=1,i.map((o,v)=>{const S=o.transformToFragment(a.ownerDocument,document);return S||console.error(`XSLT transformation error. xsl:
95
+ `,P(n[v]),`
96
+ xml:
97
+ `,P(a)),S}).map(o=>{o&&(K(o),Q(this,o.childNodes))}),d.observedAttributes.map(o=>{let v=f(this.firstElementChild,o);v!==f(this,o)&&(this.setAttribute(o,v),this.#t(o,v))});function g(o){let v=o;if(o.localName==="slice"){const S=f(o,"for");if(S||(v=o.parentElement),S==="^")do v=v.previousElementSibling;while(v.localName==="slice");else v=this.querySelector(S);if(!v)return console.warn(`can not find selector in "slice for=${S}" `,o.outerHTML);f(o,"slice")||o.setAttribute("slice",f(o,"name"))}return v}L(this,"[slice],[slice-event]",o=>{let v=f(o,"slice-event");const S=o.hasAttribute("slice-value")||o.hasAttribute("value")||o.value,X=g(o);o.dceInitialized||(o.dceInitialized=1,X.hasAttribute("custom-validity")&&(v+=" change submit"),[...new Set((v||"change").split(" "))].forEach(ve=>X.addEventListener(ve,T=>{T.sliceElement=o,T.sliceEventSource=T.currentTarget||T.target,T.sliceProcessed=0;const Ee=J(y,f(T.sliceElement,"slice"),T);L(this,"[custom-validity]",R=>{if(!R.setCustomValidity)return;const W=f(R,"custom-validity");try{const q=W&&M(W,E);R.setCustomValidity(q===!0?"":q===!1?"invalid":q)}catch(q){console.error(q,"xPath",W)}});const B=f(X,"custom-validity"),D=B&&M(B,E),F=D===!0?"":D;if(B){if(o.setCustomValidity?o.setCustomValidity(F):o.validationMessage=F,Ee.map(R=>R.setAttribute("validation-message",F)),T.type==="submit")return D===!0?void 0:(setTimeout(U,1),!!D===D?(D||T.preventDefault(),D):D?(T.preventDefault(),!1):void 0);setTimeout(U,1)}this.onSlice(T)})),(!v||v.includes("init"))&&(S?this.onSlice({type:"init",target:X,sliceElement:o,sliceEventSource:X}):o.value=b(f(o,"slice"))))}),this.#e=0};U(),ee()}#t(m,a){m==="value"&&(this.value=a);let c=this.xml.querySelector(`attributes>${m}`);c?V(c).append($(c,a)):(c=w(m,a,this.xml),this.xml.querySelector("attributes").append(c)),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,detail:{[m]:a}}))}attributeChangedCallback(m,a,c){!this.xml||this.#e||(this.#t(m,c),this.transform())}get dce(){return r}}const C=u=>{window.customElements.get(u)!==d&&window.customElements.define(u,d)};if(t)C(t);else{const u=s;this.setAttribute("tag",u),C(u);const m=document.createElement(u);this.getAttributeNames().forEach(a=>m.setAttribute(a,this.getAttribute(a))),m.append(...[...this.childNodes].filter(a=>a.localName!=="style")),this.append(m)}}get templateNode(){return this.firstElementChild?.tagName==="TEMPLATE"?this.firstElementChild.content:this}get dce(){return this}get xslt(){return j(this.xsltString)}}window.customElements.define("custom-element",ge);exports.CustomElement=ge;exports.appendByDceId=fe;exports.assureSlices=de;exports.assureUID=he;exports.assureUnique=K;exports.createXsltFromDom=re;exports.deepEqual=me;exports.evalCurly=xe;exports.event2slice=J;exports.merge=Q;exports.mergeAttr=pe;exports.obj2node=z;exports.sanitizeBlankText=G;exports.tagUid=Z;exports.toXsl=be;exports.xPath=M;exports.xPathDefaults=O;exports.xhrTemplate=ce;exports.xml2dom=j;exports.xmlString=P;exports.xslTags=ye;
@@ -1,8 +1,8 @@
1
- const W = "http://www.w3.org/1999/XSL/Transform", k = "http://www.w3.org/1999/xhtml", ue = "http://exslt.org/common", f = (e, l) => e.getAttribute?.(l), Z = (e) => e.nodeType === 3, de = (e) => typeof e == "string", pe = (e) => e && typeof e.nodeType == "number", $ = (e, l) => (e.ownerDocument || e).createTextNode(l), se = (e) => {
1
+ const W = "http://www.w3.org/1999/XSL/Transform", H = "http://www.w3.org/1999/xhtml", ue = "http://exslt.org/common", f = (e, l) => e.getAttribute?.(l), Z = (e) => e.nodeType === 3, de = (e) => typeof e == "string", pe = (e) => e && typeof e.nodeType == "number", D = (e, l) => (e.ownerDocument || e).createTextNode(l), se = (e) => {
2
2
  for (; e.firstChild; ) e.firstChild.remove();
3
3
  return e;
4
- }, V = (e) => (e.getAttributeNames().map((l) => e.removeAttribute(l)), se(e)), le = (e) => (e?.setAttribute("xmlns:xsl", W), e), ae = (e) => (e?.setAttribute("xmlns:xhtml", k), le(e)), ne = (e) => /^[_a-zA-Z][-_:a-zA-Z0-9]*$/.test(e), w = (e, l = "", t = document) => {
5
- const s = (i) => ((r) => (l && r.append($(t.ownerDocument || t, l)), r))((t.ownerDocument || t).createElement(i));
4
+ }, V = (e) => (e.getAttributeNames().map((l) => e.removeAttribute(l)), se(e)), le = (e) => (e?.setAttribute("xmlns:xsl", W), e), ae = (e) => (e?.setAttribute("xmlns:xhtml", H), le(e)), ne = (e) => /^[_a-zA-Z][-_:a-zA-Z0-9]*$/.test(e), T = (e, l = "", t = document) => {
5
+ const s = (i) => ((r) => (l && r.append(D(t.ownerDocument || t, l)), r))((t.ownerDocument || t).createElement(i));
6
6
  if (ne(e))
7
7
  return s(e);
8
8
  const a = s("dce-object");
@@ -15,54 +15,54 @@ const W = "http://www.w3.org/1999/XSL/Transform", k = "http://www.w3.org/1999/xh
15
15
  t.append(e.firstChild);
16
16
  return t;
17
17
  };
18
- function X(e) {
18
+ function q(e) {
19
19
  return new DOMParser().parseFromString(e, "application/xml");
20
20
  }
21
- function I(e) {
21
+ function X(e) {
22
22
  return new XMLSerializer().serializeToString(e);
23
23
  }
24
- function H(e, l, t, s) {
25
- const a = (x) => e.ownerDocument.createElement(x), r = ((x, p, u) => (p.append(u = a(x)), u))(l, e);
24
+ function U(e, l, t, s) {
25
+ const a = (x) => e.ownerDocument.createElement(x), r = ((x, p, N) => (p.append(N = a(x)), N))(l, e);
26
26
  return [...t].forEach((x) => r.append(s(x))), r;
27
27
  }
28
28
  function fe(e) {
29
- return e.slot || (e.setAttribute || (e = w("span", e.textContent.replaceAll(`
29
+ return e.slot || (e.setAttribute || (e = T("span", e.textContent.replaceAll(`
30
30
  `, ""))), e.setAttribute("slot", "")), e;
31
31
  }
32
32
  function K(e, l) {
33
33
  e.getAttributeNames().forEach((t) => l.includes(t) || e.removeAttribute(t));
34
34
  }
35
35
  const Q = (e) => [...e].filter((l) => !(l.nodeType === 3 && l.data.trim() === ""));
36
- function D(e, l, t) {
36
+ function z(e, l, t) {
37
37
  const s = typeof e;
38
38
  if (s === "string")
39
- return w(l, e, t);
39
+ return T(l, e, t);
40
40
  if (s === "number")
41
- return w(l, "" + e, t);
41
+ return T(l, "" + e, t);
42
42
  if (e instanceof Array) {
43
- const i = w("array", "", t);
44
- return e.map((r) => i.append(D(r, l, t))), i;
43
+ const i = T("array", "", t);
44
+ return e.map((r) => i.append(z(r, l, t))), i;
45
45
  }
46
46
  if (e instanceof FormData) {
47
- const i = w("form-data", "", t);
47
+ const i = T("form-data", "", t);
48
48
  for (const r of e)
49
- i.append(D(r[1], r[0], t));
49
+ i.append(z(r[1], r[0], t));
50
50
  return i;
51
51
  }
52
- const a = w(l, "", t);
52
+ const a = T(l, "", t);
53
53
  for (let i in e)
54
- pe(e[i]) || typeof e[i] == "function" || e[i] instanceof Window || (typeof e[i] != "object" && ne(i) ? a.setAttribute(i, e[i]) : a.append(D(e[i], i, t)));
54
+ pe(e[i]) || typeof e[i] == "function" || e[i] instanceof Window || (typeof e[i] != "object" && ne(i) ? a.setAttribute(i, e[i]) : a.append(z(e[i], i, t)));
55
55
  return a;
56
56
  }
57
57
  function ee(e) {
58
- if (L(e, "*", (l) => [...l.childNodes].filter((t) => t.nodeType === 3 && t.parentNode.localName !== "style" && t.data).forEach((t) => {
58
+ if ($(e, "*", (l) => [...l.childNodes].filter((t) => t.nodeType === 3 && t.parentNode.localName !== "style" && t.data).forEach((t) => {
59
59
  const s = t.data, a = s.matchAll(/{([^}]*)}/g);
60
60
  if (a) {
61
- let i = 0, r = (p) => $(t, p), x = [];
61
+ let i = 0, r = (p) => D(t, p), x = [];
62
62
  if ([...a].forEach((p) => {
63
63
  p.index > i && x.push(r(p.input.substring(i, p.index)));
64
- const u = e.querySelector("value-of").cloneNode();
65
- u.setAttribute("select", p[1]), x.push(u), i = p.index + p[0].length;
64
+ const N = e.querySelector("value-of").cloneNode();
65
+ N.setAttribute("select", p[1]), x.push(N), i = p.index + p[0].length;
66
66
  }), i < s.length && x.push(r(s.substring(i, s.length))), x.length) {
67
67
  for (let p of x)
68
68
  l.insertBefore(p, t);
@@ -79,9 +79,9 @@ function ee(e) {
79
79
  function he(e, l = "xsl:stylesheet") {
80
80
  if (e.tagName === l || e.documentElement?.tagName === l)
81
81
  return ee(e);
82
- const t = X(`<xsl:stylesheet version="1.0" xmlns:xsl="${W}" xmlns:xhtml="${k}" xmlns:exsl="${ue}" exclude-result-prefixes="exsl" >
82
+ const t = q(`<xsl:stylesheet version="1.0" xmlns:xsl="${W}" xmlns:xhtml="${H}" xmlns:exsl="${ue}" exclude-result-prefixes="exsl" >
83
83
  <xsl:output method="xml"/>
84
- <xsl:template match="/"><dce-root xmlns="${k}"><xsl:apply-templates select="*" /></dce-root></xsl:template>
84
+ <xsl:template match="/"><dce-root xmlns="${H}"><xsl:apply-templates select="*" /></dce-root></xsl:template>
85
85
  <xsl:template match="*[name()='template']">
86
86
  <xsl:apply-templates mode="sanitize" select="*|text()"/>
87
87
  </xsl:template>
@@ -136,24 +136,24 @@ function he(e, l = "xsl:stylesheet") {
136
136
  </xsl:for-each>
137
137
  </xsl:template>
138
138
  </xsl:stylesheet>`), s = new XSLTProcessor(), a = ((n) => {
139
- L(n, "custom-element", (b) => {
139
+ $(n, "custom-element", (b) => {
140
140
  b.firstElementChild.localName === "template" && ([...b.firstElementChild.content.childNodes].forEach((y) => b.append(y)), b.firstElementChild.remove());
141
- }), L(n, "script", (b) => b.remove());
141
+ }), $(n, "script", (b) => b.remove());
142
142
  const c = n.content ?? n.firstElementChild?.content ?? n.body ?? n;
143
- we.forEach((b) => L(c, b, (y) => Te(y, c)));
144
- const N = n.firstElementChild?.content || n.content, E = (b) => {
145
- const y = X("<xhtml/>"), M = y.importNode(b, !0);
146
- return y.replaceChild(M, y.documentElement), ae(M);
143
+ we.forEach((b) => $(c, b, (y) => Te(y, c)));
144
+ const A = n.firstElementChild?.content || n.content, E = (b) => {
145
+ const y = q("<xhtml/>"), j = y.importNode(b, !0);
146
+ return y.replaceChild(j, y.documentElement), ae(j);
147
147
  };
148
- if (N) {
149
- const b = w("div");
150
- return [...N.childNodes].map((y) => b.append(y.cloneNode(!0))), E(b);
148
+ if (A) {
149
+ const b = T("div");
150
+ return [...A.childNodes].map((y) => b.append(y.cloneNode(!0))), E(b);
151
151
  }
152
152
  return E(n.documentElement || n.body || n);
153
- })(e), i = X(
153
+ })(e), i = q(
154
154
  `<xsl:stylesheet version="1.0"
155
155
  xmlns:xsl="${W}"
156
- xmlns:xhtml="${k}"
156
+ xmlns:xhtml="${H}"
157
157
  xmlns:dce="urn:schemas-epa-wg:dce"
158
158
  xmlns:exsl="http://exslt.org/common"
159
159
  exclude-result-prefixes="exsl"
@@ -190,26 +190,26 @@ function he(e, l = "xsl:stylesheet") {
190
190
  s.importStylesheet(t);
191
191
  const r = s.transformToFragment(a, document), x = (n, c) => n.querySelector(c), p = x(i, 'template[mode="payload"]');
192
192
  if (!r)
193
- return console.error("transformation error", { xml: a.outerHTML, xsl: I(t) });
193
+ return console.error("transformation error", { xml: a.outerHTML, xsl: X(t) });
194
194
  if (r.firstElementChild.localName !== "dce-root") {
195
195
  const n = r.ownerDocument.createElement("dce-root");
196
196
  [...r.childNodes].forEach((c) => n.append(c)), r.append(n);
197
197
  }
198
- const u = [];
198
+ const N = [];
199
199
  [...r.querySelectorAll("dce-root>attribute")].forEach((n) => {
200
200
  K(n, "namespace,name,select");
201
- const c = J(n, "xsl:param"), N = f(n, "name");
201
+ const c = J(n, "xsl:param"), A = f(n, "name");
202
202
  p.append(c), K(c, "select,name");
203
203
  let E = f(c, "select")?.split("??");
204
- E || (E = ["//" + N, `'${c.textContent}'`], V(c), c.setAttribute("name", N));
204
+ E || (E = ["//" + A, `'${c.textContent}'`], V(c), c.setAttribute("name", A));
205
205
  let b;
206
206
  if (E?.length > 1) {
207
207
  c.removeAttribute("select");
208
208
  const y = x(i, 'template[match="ignore"]>choose').cloneNode(!0);
209
- V(y.firstElementChild).append($(y, "{" + E[0] + "}")), V(y.lastElementChild).append($(y, "{" + E[1] + "}")), y.firstElementChild.setAttribute("test", E[0]), c.append(y), b = y.cloneNode(!0);
209
+ V(y.firstElementChild).append(D(y, "{" + E[0] + "}")), V(y.lastElementChild).append(D(y, "{" + E[1] + "}")), y.firstElementChild.setAttribute("test", E[0]), c.append(y), b = y.cloneNode(!0);
210
210
  } else
211
211
  b = J(n, "xsl:value-of");
212
- b.removeAttribute("name"), n.append(b), n.removeAttribute("select"), u.push(c);
212
+ b.removeAttribute("name"), n.append(b), n.removeAttribute("select"), N.push(c);
213
213
  }), [...r.querySelectorAll("[value]")].filter((n) => n.getAttribute("value").match(/\{(.*)\?\?(.*)\}/g)).forEach((n) => {
214
214
  const c = f(n, "value");
215
215
  c && n.setAttribute("value", Ae(c));
@@ -217,22 +217,22 @@ function he(e, l = "xsl:stylesheet") {
217
217
  for (const n of r.childNodes)
218
218
  p.append(i.importNode(n, !0));
219
219
  [...p.getElementsByTagName("xsl:template")].forEach((n) => p.ownerDocument.documentElement.append(n));
220
- const q = x(i, 'call-template[name="slot"]'), d = (n) => {
221
- const c = q.cloneNode(!0), N = f(n, "name");
222
- N && c.firstElementChild.setAttribute("select", `'${N}'`);
220
+ const S = x(i, 'call-template[name="slot"]'), u = (n) => {
221
+ const c = S.cloneNode(!0), A = f(n, "name");
222
+ A && c.firstElementChild.setAttribute("select", `'${A}'`);
223
223
  for (let E of n.childNodes)
224
224
  c.lastElementChild.append(E);
225
225
  return c;
226
226
  };
227
- L(p, "slot", (n) => n.parentNode.replaceChild(d(n), n));
227
+ $(p, "slot", (n) => n.parentNode.replaceChild(u(n), n));
228
228
  const m = ee(i);
229
- return m.params = u, m;
229
+ return m.params = N, m;
230
230
  }
231
231
  async function xe(e) {
232
232
  return await new Promise((t, s) => {
233
233
  const a = new XMLHttpRequest();
234
234
  a.open("GET", e), a.responseType = "document", a.onload = () => {
235
- a.readyState === a.DONE && a.status === 200 ? t(a.responseXML?.body || a.responseXML || w("div", a.responseText)) : s(`${a.statusText} - ${e}`);
235
+ a.readyState === a.DONE && a.status === 200 ? t(a.responseXML?.body || a.responseXML || T("div", a.responseText)) : s(`${a.statusText} - ${e}`);
236
236
  }, a.addEventListener("error", (i) => s(i)), a.send();
237
237
  });
238
238
  }
@@ -254,26 +254,28 @@ const ie = (e) => e.split("|").map((l) => l.trim()).filter((l) => l), ye = (e, l
254
254
  i.push(x);
255
255
  return i;
256
256
  }
257
- return [...e.childNodes].find((i) => i.localName === t) || a(w(t, "", s));
257
+ return [...e.childNodes].find((i) => i.localName === t) || a(T(t, "", s));
258
258
  }).flat();
259
259
  function te(e, l, t, s) {
260
260
  if (!t.sliceProcessed)
261
261
  return t.sliceProcessed = 1, ye(e, l ?? "").map((a) => {
262
- const i = e.ownerDocument, r = t.sliceEventSource, x = t.sliceElement, p = () => [...a.childNodes].filter((u) => u.nodeType === 3 || u.localName === "value" || u.localName === "form-data").map((u) => u.remove());
263
- if (r.getAttributeNames().map((u) => a.setAttribute(u, f(r, u))), [...a.childNodes].filter((u) => u.localName === "event").map((u) => u.remove()), "validationMessage" in r && a.setAttribute("validation-message", r.validationMessage), t.type === "init" && p(), a.append(D(t, "event", i)), x.hasAttribute("slice-value")) {
262
+ const i = e.ownerDocument, r = t.sliceEventSource, x = t.sliceElement, p = () => [...a.childNodes].filter((d) => d.nodeType === 3 || d.localName === "value" || d.localName === "form-data").map((d) => d.remove());
263
+ r.getAttributeNames().map((d) => a.setAttribute(d, f(r, d))), [...a.childNodes].filter((d) => d.localName === "event").map((d) => d.remove()), "validationMessage" in r && a.setAttribute("validation-message", r.validationMessage), t.type === "init" && p(), a.append(z(t, "event", i));
264
+ const N = (r.type === "checkbox" || r.type === "radio") && !r.checked;
265
+ if (x.hasAttribute("slice-value")) {
264
266
  r.value === void 0 ? a.removeAttribute("value") : a.setAttribute("value", r.value);
265
- const u = z(f(x, "slice-value"), a);
266
- p(), a.append($(i, u));
267
+ const d = N ? "" : M(f(x, "slice-value"), a);
268
+ p(), a.append(D(i, d));
267
269
  } else {
268
270
  if ("elements" in r)
269
- return p(), a.append(D(new FormData(r), "value", a.ownerDocument)), a;
270
- const u = r.value ?? f(r, "value");
271
- p(), u == null ? [...a.childNodes].filter((T) => T.localName !== "event").map((T) => T.remove()) : de(u) ? a.append($(i, u)) : a.append(D(u, "value", a.ownerDocument));
271
+ return p(), a.append(z(new FormData(r), "value", a.ownerDocument)), a;
272
+ const d = N ? "" : r.value ?? f(r, "value");
273
+ p(), d == null ? [...a.childNodes].filter((S) => S.localName !== "event").map((S) => S.remove()) : de(d) ? a.append(D(i, d)) : a.append(z(d, "value", a.ownerDocument));
272
274
  }
273
275
  return a;
274
276
  });
275
277
  }
276
- function L(e, l, t) {
278
+ function $(e, l, t) {
277
279
  e.querySelectorAll && [...e.querySelectorAll(l)].forEach(t);
278
280
  }
279
281
  const ge = async (e, l) => {
@@ -351,10 +353,10 @@ const Ae = (e) => [...e?.matchAll(/([^{}]*)(\{)([^}]+)}([^{}]*)/g)].map((t) => `
351
353
  return e;
352
354
  const l = e.split("??"), t = l.shift(), s = Y(l.join("??"));
353
355
  return l.length ? `concat( ${t} , substring( ${s} , (1+string-length( ${s} )) * string-length( ${t} ) ) )` : e;
354
- }, z = (e, l) => {
356
+ }, M = (e, l) => {
355
357
  const t = e.split("??");
356
358
  if (t.length > 1)
357
- return z(t[0], l) || z(t[1], l);
359
+ return M(t[0], l) || M(t[1], l);
358
360
  e = Y(e);
359
361
  const s = l.ownerDocument.evaluate(e, l);
360
362
  switch (s.resultType) {
@@ -370,7 +372,7 @@ const Ae = (e) => [...e?.matchAll(/([^{}]*)(\{)([^}]+)}([^{}]*)/g)].map((t) => `
370
372
  a += i.textContent;
371
373
  return a;
372
374
  }, we = "stylesheet,transform,import,include,strip-space,preserve-space,output,key,decimal-format,namespace-alias,value-of,copy-of,number,apply-templates,apply-imports,for-each,sort,if,choose,when,otherwise,attribute-set,call-template,with-param,variable,param,text,processing-instruction,element,attribute,comment,copy,message,fallback".split(","), Te = (e, l) => {
373
- const t = w("xsl:" + e.localName);
375
+ const t = T("xsl:" + e.localName);
374
376
  for (let s of e.attributes)
375
377
  t.setAttribute(s.name, s.value);
376
378
  for (; e.firstChild; )
@@ -384,32 +386,32 @@ const Ae = (e) => [...e?.matchAll(/([^{}]*)(\{)([^}]+)}([^{}]*)/g)].map((t) => `
384
386
  }), s.replaceChildren(...a);
385
387
  }
386
388
  };
387
- class Se extends HTMLElement {
389
+ class Ce extends HTMLElement {
388
390
  static observedAttributes = ["src", "tag", "hidden"];
389
391
  async connectedCallback() {
390
392
  this.firstElementChild && this.firstElementChild.localName !== "template" && console.warn(`custom-element used without template wrapping content
391
393
  `, this.outerHTML);
392
394
  const l = await ge(f(this, "src"), this), t = f(this, "tag"), s = t || "dce-" + crypto.randomUUID();
393
- for (const d of l)
394
- L(d.templateNode || d.content || d, "style", (m) => {
395
+ for (const u of l)
396
+ $(u.templateNode || u.content || u, "style", (m) => {
395
397
  const n = m.closest("slot"), c = n ? `slot[name="${n.name}"]` : "";
396
398
  m.innerHTML = `${s} ${c}{${m.innerHTML}}`, this.append(m);
397
399
  });
398
- const a = l.map((d) => he(d)), i = a.map((d, m) => {
400
+ const a = l.map((u) => he(u)), i = a.map((u, m) => {
399
401
  m = new XSLTProcessor();
400
402
  try {
401
- m.importStylesheet(d);
403
+ m.importStylesheet(u);
402
404
  } catch (n) {
403
- console.error(n, I(d));
405
+ console.error(n, X(u));
404
406
  }
405
407
  return m;
406
408
  });
407
- Object.defineProperty(this, "xsltString", { get: () => a.map((d) => I(d)).join(`
409
+ Object.defineProperty(this, "xsltString", { get: () => a.map((u) => X(u)).join(`
408
410
  `) });
409
- const r = this, x = [...this.templateNode.querySelectorAll("[slice]")], p = x.map((d) => f(d, "slice")).filter((d) => !d.includes("/")).filter((d, m, n) => n.indexOf(d) === m).map(ie).flat(), u = a.reduce((d, m) => (m.params && d.push(...m.params), d), []);
410
- class T extends HTMLElement {
411
+ const r = this, x = [...this.templateNode.querySelectorAll("[slice]")], p = x.map((u) => f(u, "slice")).filter((u) => !u.includes("/")).filter((u, m, n) => n.indexOf(u) === m).map(ie).flat(), N = a.reduce((u, m) => (m.params && u.push(...m.params), u), []);
412
+ class d extends HTMLElement {
411
413
  static get observedAttributes() {
412
- return u.map((m) => f(m, "name"));
414
+ return N.map((m) => f(m, "name"));
413
415
  }
414
416
  #e = 0;
415
417
  connectedCallback() {
@@ -425,90 +427,90 @@ class Se extends HTMLElement {
425
427
  } else
426
428
  g.nodeType === 1 ? h.insertAdjacentElement("beforebegin", g) : g.nodeType === 3 && h.insertAdjacentText("beforebegin", g.data);
427
429
  }
428
- const n = X("<datadom/>").documentElement, c = (h, g = "") => ((o) => (g && o.append($(n, g)), o))(n.ownerDocument.createElement(h)), N = H(n, "payload", m, fe);
429
- le(N), ae(N), this.innerHTML = "";
430
- const E = H(n, "attributes", this.attributes, (h) => c(h.nodeName, h.value));
431
- H(n, "dataset", Object.keys(this.dataset), (h) => c(h, this.dataset[h]));
432
- const b = H(n, "slice", p, (h) => c(h, "")), y = (h) => z(h, b);
430
+ const n = q("<datadom/>").documentElement, c = (h, g = "") => ((o) => (g && o.append(D(n, g)), o))(n.ownerDocument.createElement(h)), A = U(n, "payload", m, fe);
431
+ le(A), ae(A), this.innerHTML = "";
432
+ const E = U(n, "attributes", this.attributes, (h) => c(h.nodeName, h.value));
433
+ U(n, "dataset", Object.keys(this.dataset), (h) => c(h, this.dataset[h]));
434
+ const b = U(n, "slice", p, (h) => c(h, "")), y = (h) => M(h, b);
433
435
  this.xml = n;
434
- const M = [], G = () => {
436
+ const j = [], G = () => {
435
437
  const h = {};
436
- for (let g; g = M.pop(); ) {
438
+ for (let g; g = j.pop(); ) {
437
439
  const o = f(g.sliceElement, "slice");
438
440
  h[o] || (te(b, o, g), h[o] = g);
439
441
  }
440
- Object.keys(h).length !== 0 && U();
442
+ Object.keys(h).length !== 0 && k();
441
443
  };
442
444
  let O;
443
445
  this.onSlice = (h) => {
444
- M.push(h), O || (O = setTimeout(() => {
446
+ j.push(h), O || (O = setTimeout(() => {
445
447
  G(), O = 0;
446
448
  }, 1));
447
449
  };
448
- const U = this.transform = () => {
450
+ const k = this.transform = () => {
449
451
  if (this.#e)
450
452
  debugger;
451
453
  this.#e = 1, i.map((o, v) => {
452
- const S = o.transformToFragment(n.ownerDocument, document);
453
- return S || console.error(`XSLT transformation error. xsl:
454
- `, I(a[v]), `
454
+ const C = o.transformToFragment(n.ownerDocument, document);
455
+ return C || console.error(`XSLT transformation error. xsl:
456
+ `, X(a[v]), `
455
457
  xml:
456
- `, I(n)), S;
458
+ `, X(n)), C;
457
459
  }).map((o) => {
458
460
  o && (oe(o), re(this, o.childNodes));
459
- }), T.observedAttributes.map((o) => {
461
+ }), d.observedAttributes.map((o) => {
460
462
  let v = f(this.firstElementChild, o);
461
463
  v !== f(this, o) && (this.setAttribute(o, v), this.#t(o, v));
462
464
  });
463
465
  function g(o) {
464
466
  let v = o;
465
467
  if (o.localName === "slice") {
466
- const S = f(o, "for");
467
- if (S || (v = o.parentElement), S === "^")
468
+ const C = f(o, "for");
469
+ if (C || (v = o.parentElement), C === "^")
468
470
  do
469
471
  v = v.previousElementSibling;
470
472
  while (v.localName === "slice");
471
473
  else
472
- v = this.querySelector(S);
474
+ v = this.querySelector(C);
473
475
  if (!v)
474
- return console.warn(`can not find selector in "slice for=${S}" `, o.outerHTML);
476
+ return console.warn(`can not find selector in "slice for=${C}" `, o.outerHTML);
475
477
  f(o, "slice") || o.setAttribute("slice", f(o, "name"));
476
478
  }
477
479
  return v;
478
480
  }
479
- L(this, "[slice],[slice-event]", (o) => {
481
+ $(this, "[slice],[slice-event]", (o) => {
480
482
  let v = f(o, "slice-event");
481
- const S = o.hasAttribute("slice-value") || o.hasAttribute("value") || o.value, j = g(o);
482
- o.dceInitialized || (o.dceInitialized = 1, j.hasAttribute("custom-validity") && (v += " change submit"), [...new Set((v || "change").split(" "))].forEach((ce) => j.addEventListener(ce, (A) => {
483
- A.sliceElement = o, A.sliceEventSource = A.currentTarget || A.target, A.sliceProcessed = 0;
484
- const me = te(b, f(A.sliceElement, "slice"), A);
485
- L(this, "[custom-validity]", (P) => {
486
- if (!P.setCustomValidity)
483
+ const C = o.hasAttribute("slice-value") || o.hasAttribute("value") || o.value, P = g(o);
484
+ o.dceInitialized || (o.dceInitialized = 1, P.hasAttribute("custom-validity") && (v += " change submit"), [...new Set((v || "change").split(" "))].forEach((ce) => P.addEventListener(ce, (w) => {
485
+ w.sliceElement = o, w.sliceEventSource = w.currentTarget || w.target, w.sliceProcessed = 0;
486
+ const me = te(b, f(w.sliceElement, "slice"), w);
487
+ $(this, "[custom-validity]", (R) => {
488
+ if (!R.setCustomValidity)
487
489
  return;
488
- const F = f(P, "custom-validity");
490
+ const F = f(R, "custom-validity");
489
491
  try {
490
- const R = F && z(F, E);
491
- P.setCustomValidity(R === !0 ? "" : R === !1 ? "invalid" : R);
492
- } catch (R) {
493
- console.error(R, "xPath", F);
492
+ const I = F && M(F, E);
493
+ R.setCustomValidity(I === !0 ? "" : I === !1 ? "invalid" : I);
494
+ } catch (I) {
495
+ console.error(I, "xPath", F);
494
496
  }
495
497
  });
496
- const _ = f(j, "custom-validity"), C = _ && z(_, E), B = C === !0 ? "" : C;
498
+ const _ = f(P, "custom-validity"), L = _ && M(_, E), B = L === !0 ? "" : L;
497
499
  if (_) {
498
- if (o.setCustomValidity ? o.setCustomValidity(B) : o.validationMessage = B, me.map((P) => P.setAttribute("validation-message", B)), A.type === "submit")
499
- return C === !0 ? void 0 : (setTimeout(U, 1), !!C === C ? (C || A.preventDefault(), C) : C ? (A.preventDefault(), !1) : void 0);
500
- setTimeout(U, 1);
500
+ if (o.setCustomValidity ? o.setCustomValidity(B) : o.validationMessage = B, me.map((R) => R.setAttribute("validation-message", B)), w.type === "submit")
501
+ return L === !0 ? void 0 : (setTimeout(k, 1), !!L === L ? (L || w.preventDefault(), L) : L ? (w.preventDefault(), !1) : void 0);
502
+ setTimeout(k, 1);
501
503
  }
502
- this.onSlice(A);
503
- })), (!v || v.includes("init")) && (S ? this.onSlice({ type: "init", target: j, sliceElement: o, sliceEventSource: j }) : o.value = y(f(o, "slice"))));
504
+ this.onSlice(w);
505
+ })), (!v || v.includes("init")) && (C ? this.onSlice({ type: "init", target: P, sliceElement: o, sliceEventSource: P }) : o.value = y(f(o, "slice"))));
504
506
  }), this.#e = 0;
505
507
  };
506
- U(), G();
508
+ k(), G();
507
509
  }
508
510
  #t(m, n) {
509
511
  m === "value" && (this.value = n);
510
512
  let c = this.xml.querySelector(`attributes>${m}`);
511
- c ? V(c).append($(c, n)) : (c = w(m, n, this.xml), this.xml.querySelector("attributes").append(c)), this.dispatchEvent(new CustomEvent("change", { bubbles: !0, detail: { [m]: n } }));
513
+ c ? V(c).append(D(c, n)) : (c = T(m, n, this.xml), this.xml.querySelector("attributes").append(c)), this.dispatchEvent(new CustomEvent("change", { bubbles: !0, detail: { [m]: n } }));
512
514
  }
513
515
  attributeChangedCallback(m, n, c) {
514
516
  !this.xml || this.#e || (this.#t(m, c), this.transform());
@@ -517,15 +519,15 @@ xml:
517
519
  return r;
518
520
  }
519
521
  }
520
- const q = (d) => {
521
- window.customElements.get(d) !== T && window.customElements.define(d, T);
522
+ const S = (u) => {
523
+ window.customElements.get(u) !== d && window.customElements.define(u, d);
522
524
  };
523
525
  if (t)
524
- q(t);
526
+ S(t);
525
527
  else {
526
- const d = s;
527
- this.setAttribute("tag", d), q(d);
528
- const m = document.createElement(d);
528
+ const u = s;
529
+ this.setAttribute("tag", u), S(u);
530
+ const m = document.createElement(u);
529
531
  this.getAttributeNames().forEach((n) => m.setAttribute(n, this.getAttribute(n))), m.append(...[...this.childNodes].filter((n) => n.localName !== "style")), this.append(m);
530
532
  }
531
533
  }
@@ -536,13 +538,13 @@ xml:
536
538
  return this;
537
539
  }
538
540
  get xslt() {
539
- return X(this.xsltString);
541
+ return q(this.xsltString);
540
542
  }
541
543
  }
542
- window.customElements.define("custom-element", Se);
544
+ window.customElements.define("custom-element", Ce);
543
545
  export {
544
- Se as C,
545
- I as a,
546
+ Ce as C,
547
+ X as a,
546
548
  xe as b,
547
549
  he as c,
548
550
  be as d,
@@ -555,11 +557,11 @@ export {
555
557
  Ae as k,
556
558
  Y as l,
557
559
  ve as m,
558
- z as n,
559
- D as o,
560
+ M as n,
561
+ z as o,
560
562
  we as p,
561
563
  Te as q,
562
564
  Q as s,
563
565
  ee as t,
564
- X as x
566
+ q as x
565
567
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./custom-element-CUsSENWc.cjs"),l=require("./http-request-DPrY7mGh.cjs"),t=require("./local-storage-78EivJ_B.cjs"),a=require("./location-element-DRB7hCwA.cjs");exports.CustomElement=e.CustomElement;exports.appendByDceId=e.appendByDceId;exports.assureSlices=e.assureSlices;exports.assureUID=e.assureUID;exports.assureUnique=e.assureUnique;exports.createXsltFromDom=e.createXsltFromDom;exports.deepEqual=e.deepEqual;exports.default=e.CustomElement;exports.evalCurly=e.evalCurly;exports.event2slice=e.event2slice;exports.merge=e.merge;exports.mergeAttr=e.mergeAttr;exports.obj2node=e.obj2node;exports.sanitizeBlankText=e.sanitizeBlankText;exports.tagUid=e.tagUid;exports.toXsl=e.toXsl;exports.xPath=e.xPath;exports.xPathDefaults=e.xPathDefaults;exports.xhrTemplate=e.xhrTemplate;exports.xml2dom=e.xml2dom;exports.xmlString=e.xmlString;exports.xslTags=e.xslTags;exports.HttpRequestElement=l.HttpRequestElement;exports.LocalStorageElement=t.LocalStorageElement;exports.localStorageSetItem=t.localStorageSetItem;exports.localStorage_clear=t.localStorage_clear;exports.localStorage_removeItem=t.localStorage_removeItem;exports.localStorage_setItem=t.localStorage_setItem;exports.LocationElement=a.LocationElement;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./custom-element-BbJMY20-.cjs"),l=require("./http-request-DPrY7mGh.cjs"),t=require("./local-storage-78EivJ_B.cjs"),a=require("./location-element-DRB7hCwA.cjs");exports.CustomElement=e.CustomElement;exports.appendByDceId=e.appendByDceId;exports.assureSlices=e.assureSlices;exports.assureUID=e.assureUID;exports.assureUnique=e.assureUnique;exports.createXsltFromDom=e.createXsltFromDom;exports.deepEqual=e.deepEqual;exports.default=e.CustomElement;exports.evalCurly=e.evalCurly;exports.event2slice=e.event2slice;exports.merge=e.merge;exports.mergeAttr=e.mergeAttr;exports.obj2node=e.obj2node;exports.sanitizeBlankText=e.sanitizeBlankText;exports.tagUid=e.tagUid;exports.toXsl=e.toXsl;exports.xPath=e.xPath;exports.xPathDefaults=e.xPathDefaults;exports.xhrTemplate=e.xhrTemplate;exports.xml2dom=e.xml2dom;exports.xmlString=e.xmlString;exports.xslTags=e.xslTags;exports.HttpRequestElement=l.HttpRequestElement;exports.LocalStorageElement=t.LocalStorageElement;exports.localStorageSetItem=t.localStorageSetItem;exports.localStorage_clear=t.localStorage_clear;exports.localStorage_removeItem=t.localStorage_removeItem;exports.localStorage_setItem=t.localStorage_setItem;exports.LocationElement=a.LocationElement;