zerocodejs 1.0.1-beta.2 → 1.0.1-beta.21

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 (131) hide show
  1. package/README.ja.md +199 -0
  2. package/README.md +128 -102
  3. package/dist/components/ZeroCodeCMS.vue.d.ts +7 -0
  4. package/dist/components/ZeroCodeCMS.vue.d.ts.map +1 -1
  5. package/dist/components/ZeroCodeEditor.vue.d.ts +60 -1
  6. package/dist/components/ZeroCodeEditor.vue.d.ts.map +1 -1
  7. package/dist/components/ZeroCodeStudio.vue.d.ts +398 -0
  8. package/dist/components/ZeroCodeStudio.vue.d.ts.map +1 -0
  9. package/dist/core/composables/useZeroCodeData.d.ts +3 -0
  10. package/dist/core/composables/useZeroCodeData.d.ts.map +1 -1
  11. package/dist/core/composables/useZeroCodeRenderer.d.ts.map +1 -1
  12. package/dist/core/renderer/renderer.d.ts +30 -1
  13. package/dist/core/renderer/renderer.d.ts.map +1 -1
  14. package/dist/core/utils/css-manager.d.ts.map +1 -1
  15. package/dist/core/utils/dom-utils.d.ts +3 -0
  16. package/dist/core/utils/dom-utils.d.ts.map +1 -1
  17. package/dist/core/utils/edit-panel-fields.d.ts +17 -0
  18. package/dist/core/utils/edit-panel-fields.d.ts.map +1 -0
  19. package/dist/core/utils/field-extractor.d.ts.map +1 -1
  20. package/dist/core/utils/i18n-setup.d.ts.map +1 -1
  21. package/dist/core/utils/image-utils.d.ts.map +1 -1
  22. package/dist/core/utils/logger.d.ts +5 -0
  23. package/dist/core/utils/logger.d.ts.map +1 -0
  24. package/dist/core/utils/path-utils.d.ts +5 -1
  25. package/dist/core/utils/path-utils.d.ts.map +1 -1
  26. package/dist/core/utils/sanitize.d.ts +6 -0
  27. package/dist/core/utils/sanitize.d.ts.map +1 -1
  28. package/dist/core/utils/storage.d.ts +0 -1
  29. package/dist/core/utils/storage.d.ts.map +1 -1
  30. package/dist/core/utils/template-processor.d.ts +6 -1
  31. package/dist/core/utils/template-processor.d.ts.map +1 -1
  32. package/dist/core/utils/template-regex.d.ts +0 -1
  33. package/dist/core/utils/template-regex.d.ts.map +1 -1
  34. package/dist/core/utils/template-utils.d.ts +3 -1
  35. package/dist/core/utils/template-utils.d.ts.map +1 -1
  36. package/dist/features/add/components/AddPanel.vue.d.ts.map +1 -1
  37. package/dist/features/add/composables/useAddMode.d.ts +7 -1
  38. package/dist/features/add/composables/useAddMode.d.ts.map +1 -1
  39. package/dist/features/data-viewer/components/DataViewer.vue.d.ts +1 -0
  40. package/dist/features/data-viewer/components/DataViewer.vue.d.ts.map +1 -1
  41. package/dist/features/delete/components/DeletePanel.vue.d.ts.map +1 -1
  42. package/dist/features/delete/composables/useDeleteMode.d.ts.map +1 -1
  43. package/dist/features/editor/components/ContextMenu.vue.d.ts.map +1 -1
  44. package/dist/features/editor/components/EditPanel.vue.d.ts +1 -4
  45. package/dist/features/editor/components/EditPanel.vue.d.ts.map +1 -1
  46. package/dist/features/editor/components/ImageSelectModal.vue.d.ts +1 -7
  47. package/dist/features/editor/components/ImageSelectModal.vue.d.ts.map +1 -1
  48. package/dist/features/editor/components/RichTextEditor.vue.d.ts.map +1 -1
  49. package/dist/features/editor/components/SettingsPanel.vue.d.ts.map +1 -1
  50. package/dist/features/editor/components/Toolbar.vue.d.ts.map +1 -1
  51. package/dist/features/editor/composables/useClickHandlers.d.ts.map +1 -1
  52. package/dist/features/editor/composables/useEditMode.d.ts +4 -16
  53. package/dist/features/editor/composables/useEditMode.d.ts.map +1 -1
  54. package/dist/features/editor/composables/useOutlineManager.d.ts.map +1 -1
  55. package/dist/features/images-manager/components/ImagesManagerPanel.vue.d.ts +2 -0
  56. package/dist/features/images-manager/components/ImagesManagerPanel.vue.d.ts.map +1 -1
  57. package/dist/features/parts-manager/components/MonacoEditor.vue.d.ts +3 -1
  58. package/dist/features/parts-manager/components/MonacoEditor.vue.d.ts.map +1 -1
  59. package/dist/features/parts-manager/components/PartsManagerPanel.vue.d.ts +44 -1
  60. package/dist/features/parts-manager/components/PartsManagerPanel.vue.d.ts.map +1 -1
  61. package/dist/features/parts-manager/composables/usePartsManager.d.ts +15 -1
  62. package/dist/features/parts-manager/composables/usePartsManager.d.ts.map +1 -1
  63. package/dist/features/preview/PreviewArea.vue.d.ts.map +1 -1
  64. package/dist/features/reorder/components/ReorderPanel.vue.d.ts.map +1 -1
  65. package/dist/features/reorder/composables/useReorderMode.d.ts +3 -1
  66. package/dist/features/reorder/composables/useReorderMode.d.ts.map +1 -1
  67. package/dist/i18n/index.d.ts +36 -2
  68. package/dist/i18n/index.d.ts.map +1 -1
  69. package/dist/i18n/locales/en.d.ts +18 -1
  70. package/dist/i18n/locales/en.d.ts.map +1 -1
  71. package/dist/i18n/locales/ja.d.ts +18 -1
  72. package/dist/i18n/locales/ja.d.ts.map +1 -1
  73. package/dist/index.d.ts +3 -1
  74. package/dist/index.d.ts.map +1 -1
  75. package/dist/ssr-entry.d.ts +6 -0
  76. package/dist/ssr-entry.d.ts.map +1 -0
  77. package/dist/types/index.d.ts +7 -5
  78. package/dist/types/index.d.ts.map +1 -1
  79. package/dist/web-components/zcode-cms.d.ts.map +1 -1
  80. package/dist/web-components/zcode-editor.d.ts.map +1 -1
  81. package/dist/web-components/zcode-studio.d.ts +28 -0
  82. package/dist/web-components/zcode-studio.d.ts.map +1 -0
  83. package/dist/zerocode-ssr.es.js +1414 -0
  84. package/dist/zerocode.es.js +15769 -15347
  85. package/dist/zerocode.umd.js +68 -72
  86. package/dist/zerocodejs.css +1 -1
  87. package/package.json +27 -7
  88. package/dist/__tests__/fixtures/sample-data.d.ts +0 -23
  89. package/dist/__tests__/fixtures/sample-data.d.ts.map +0 -1
  90. package/dist/__tests__/fixtures/sample-templates.d.ts +0 -25
  91. package/dist/__tests__/fixtures/sample-templates.d.ts.map +0 -1
  92. package/dist/core/utils/component-initializer.test.d.ts +0 -2
  93. package/dist/core/utils/component-initializer.test.d.ts.map +0 -1
  94. package/dist/core/utils/field-extractor.test.d.ts +0 -2
  95. package/dist/core/utils/field-extractor.test.d.ts.map +0 -1
  96. package/dist/core/utils/image-utils.test.d.ts +0 -2
  97. package/dist/core/utils/image-utils.test.d.ts.map +0 -1
  98. package/dist/core/utils/path-utils.test.d.ts +0 -2
  99. package/dist/core/utils/path-utils.test.d.ts.map +0 -1
  100. package/dist/core/utils/storage.test.d.ts +0 -2
  101. package/dist/core/utils/storage.test.d.ts.map +0 -1
  102. package/dist/core/utils/template-processor.test.d.ts +0 -2
  103. package/dist/core/utils/template-processor.test.d.ts.map +0 -1
  104. package/dist/core/utils/template-utils.test.d.ts +0 -2
  105. package/dist/core/utils/template-utils.test.d.ts.map +0 -1
  106. package/dist/core/utils/validation.test.d.ts +0 -2
  107. package/dist/core/utils/validation.test.d.ts.map +0 -1
  108. package/dist/css/common.css +0 -677
  109. package/dist/css/docs.css +0 -396
  110. package/dist/css/index.css +0 -1039
  111. package/dist/css/page.css +0 -290
  112. package/dist/css/sample.css +0 -26
  113. package/dist/css/site-common.css +0 -218
  114. package/dist/footer.html +0 -10
  115. package/dist/header.html +0 -10
  116. package/dist/images/customer-avatar.jpg +0 -0
  117. package/dist/images/default-avatar.jpg +0 -0
  118. package/dist/images/default.jpg +0 -0
  119. package/dist/images/hero-bg.jpg +0 -0
  120. package/dist/images/kv_image.jpg +0 -0
  121. package/dist/images/page-specific-hero.jpg +0 -0
  122. package/dist/images/sample-1.jpg +0 -0
  123. package/dist/images/sample-2.jpg +0 -0
  124. package/dist/images/sample-3.jpg +0 -0
  125. package/dist/images/zcode_top_01.png +0 -0
  126. package/dist/js/accordion.js +0 -24
  127. package/dist/js/common.js +0 -1093
  128. package/dist/web-component.d.ts +0 -14
  129. package/dist/web-component.d.ts.map +0 -1
  130. package/dist/zerocode.es.js.map +0 -1
  131. package/dist/zerocode.umd.js.map +0 -1
@@ -0,0 +1,1414 @@
1
+ const Mt = "[ZeroCode]", de = {
2
+ warn(r, ...t) {
3
+ console.warn(`${Mt} ${r}`, ...t);
4
+ },
5
+ error(r, ...t) {
6
+ console.error(`${Mt} ${r}`, ...t);
7
+ }
8
+ }, at = 1, st = 3;
9
+ let Ge;
10
+ function or() {
11
+ if (Ge)
12
+ return Ge;
13
+ if (typeof require > "u")
14
+ throw new Error("DOMParser is not available in this environment");
15
+ try {
16
+ const { JSDOM: r } = require("jsdom");
17
+ return Ge = new r("").window.DOMParser, Ge;
18
+ } catch {
19
+ throw new Error(
20
+ "jsdom is required for server-side rendering. Please install it: npm install jsdom"
21
+ );
22
+ }
23
+ }
24
+ function Vt() {
25
+ if (typeof DOMParser < "u")
26
+ return DOMParser;
27
+ const r = globalThis;
28
+ return r.window?.DOMParser ? r.window.DOMParser : or();
29
+ }
30
+ const {
31
+ entries: Xt,
32
+ setPrototypeOf: Pt,
33
+ isFrozen: ar,
34
+ getPrototypeOf: sr,
35
+ getOwnPropertyDescriptor: lr
36
+ } = Object;
37
+ let {
38
+ freeze: J,
39
+ seal: oe,
40
+ create: dt
41
+ } = Object, {
42
+ apply: gt,
43
+ construct: Tt
44
+ } = typeof Reflect < "u" && Reflect;
45
+ J || (J = function(t) {
46
+ return t;
47
+ });
48
+ oe || (oe = function(t) {
49
+ return t;
50
+ });
51
+ gt || (gt = function(t, i) {
52
+ for (var o = arguments.length, m = new Array(o > 2 ? o - 2 : 0), R = 2; R < o; R++)
53
+ m[R - 2] = arguments[R];
54
+ return t.apply(i, m);
55
+ });
56
+ Tt || (Tt = function(t) {
57
+ for (var i = arguments.length, o = new Array(i > 1 ? i - 1 : 0), m = 1; m < i; m++)
58
+ o[m - 1] = arguments[m];
59
+ return new t(...o);
60
+ });
61
+ const We = Q(Array.prototype.forEach), cr = Q(Array.prototype.lastIndexOf), Ft = Q(Array.prototype.pop), Oe = Q(Array.prototype.push), ur = Q(Array.prototype.splice), Xe = Q(String.prototype.toLowerCase), lt = Q(String.prototype.toString), ct = Q(String.prototype.match), xe = Q(String.prototype.replace), fr = Q(String.prototype.indexOf), pr = Q(String.prototype.trim), ae = Q(Object.prototype.hasOwnProperty), K = Q(RegExp.prototype.test), Ne = mr(TypeError);
62
+ function Q(r) {
63
+ return function(t) {
64
+ t instanceof RegExp && (t.lastIndex = 0);
65
+ for (var i = arguments.length, o = new Array(i > 1 ? i - 1 : 0), m = 1; m < i; m++)
66
+ o[m - 1] = arguments[m];
67
+ return gt(r, t, o);
68
+ };
69
+ }
70
+ function mr(r) {
71
+ return function() {
72
+ for (var t = arguments.length, i = new Array(t), o = 0; o < t; o++)
73
+ i[o] = arguments[o];
74
+ return Tt(r, i);
75
+ };
76
+ }
77
+ function L(r, t) {
78
+ let i = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : Xe;
79
+ Pt && Pt(r, null);
80
+ let o = t.length;
81
+ for (; o--; ) {
82
+ let m = t[o];
83
+ if (typeof m == "string") {
84
+ const R = i(m);
85
+ R !== m && (ar(t) || (t[o] = R), m = R);
86
+ }
87
+ r[m] = !0;
88
+ }
89
+ return r;
90
+ }
91
+ function dr(r) {
92
+ for (let t = 0; t < r.length; t++)
93
+ ae(r, t) || (r[t] = null);
94
+ return r;
95
+ }
96
+ function ce(r) {
97
+ const t = dt(null);
98
+ for (const [i, o] of Xt(r))
99
+ ae(r, i) && (Array.isArray(o) ? t[i] = dr(o) : o && typeof o == "object" && o.constructor === Object ? t[i] = ce(o) : t[i] = o);
100
+ return t;
101
+ }
102
+ function Ce(r, t) {
103
+ for (; r !== null; ) {
104
+ const o = lr(r, t);
105
+ if (o) {
106
+ if (o.get)
107
+ return Q(o.get);
108
+ if (typeof o.value == "function")
109
+ return Q(o.value);
110
+ }
111
+ r = sr(r);
112
+ }
113
+ function i() {
114
+ return null;
115
+ }
116
+ return i;
117
+ }
118
+ const Ut = J(["a", "abbr", "acronym", "address", "area", "article", "aside", "audio", "b", "bdi", "bdo", "big", "blink", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "content", "data", "datalist", "dd", "decorator", "del", "details", "dfn", "dialog", "dir", "div", "dl", "dt", "element", "em", "fieldset", "figcaption", "figure", "font", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "img", "input", "ins", "kbd", "label", "legend", "li", "main", "map", "mark", "marquee", "menu", "menuitem", "meter", "nav", "nobr", "ol", "optgroup", "option", "output", "p", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "search", "section", "select", "shadow", "slot", "small", "source", "spacer", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "tr", "track", "tt", "u", "ul", "var", "video", "wbr"]), ut = J(["svg", "a", "altglyph", "altglyphdef", "altglyphitem", "animatecolor", "animatemotion", "animatetransform", "circle", "clippath", "defs", "desc", "ellipse", "enterkeyhint", "exportparts", "filter", "font", "g", "glyph", "glyphref", "hkern", "image", "inputmode", "line", "lineargradient", "marker", "mask", "metadata", "mpath", "part", "path", "pattern", "polygon", "polyline", "radialgradient", "rect", "stop", "style", "switch", "symbol", "text", "textpath", "title", "tref", "tspan", "view", "vkern"]), ft = J(["feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feDropShadow", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence"]), gr = J(["animate", "color-profile", "cursor", "discard", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "foreignobject", "hatch", "hatchpath", "mesh", "meshgradient", "meshpatch", "meshrow", "missing-glyph", "script", "set", "solidcolor", "unknown", "use"]), pt = J(["math", "menclose", "merror", "mfenced", "mfrac", "mglyph", "mi", "mlabeledtr", "mmultiscripts", "mn", "mo", "mover", "mpadded", "mphantom", "mroot", "mrow", "ms", "mspace", "msqrt", "mstyle", "msub", "msup", "msubsup", "mtable", "mtd", "mtext", "mtr", "munder", "munderover", "mprescripts"]), Tr = J(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]), Ht = J(["#text"]), zt = J(["accept", "action", "align", "alt", "autocapitalize", "autocomplete", "autopictureinpicture", "autoplay", "background", "bgcolor", "border", "capture", "cellpadding", "cellspacing", "checked", "cite", "class", "clear", "color", "cols", "colspan", "controls", "controlslist", "coords", "crossorigin", "datetime", "decoding", "default", "dir", "disabled", "disablepictureinpicture", "disableremoteplayback", "download", "draggable", "enctype", "enterkeyhint", "exportparts", "face", "for", "headers", "height", "hidden", "high", "href", "hreflang", "id", "inert", "inputmode", "integrity", "ismap", "kind", "label", "lang", "list", "loading", "loop", "low", "max", "maxlength", "media", "method", "min", "minlength", "multiple", "muted", "name", "nonce", "noshade", "novalidate", "nowrap", "open", "optimum", "part", "pattern", "placeholder", "playsinline", "popover", "popovertarget", "popovertargetaction", "poster", "preload", "pubdate", "radiogroup", "readonly", "rel", "required", "rev", "reversed", "role", "rows", "rowspan", "spellcheck", "scope", "selected", "shape", "size", "sizes", "slot", "span", "srclang", "start", "src", "srcset", "step", "style", "summary", "tabindex", "title", "translate", "type", "usemap", "valign", "value", "width", "wrap", "xmlns", "slot"]), mt = J(["accent-height", "accumulate", "additive", "alignment-baseline", "amplitude", "ascent", "attributename", "attributetype", "azimuth", "basefrequency", "baseline-shift", "begin", "bias", "by", "class", "clip", "clippathunits", "clip-path", "clip-rule", "color", "color-interpolation", "color-interpolation-filters", "color-profile", "color-rendering", "cx", "cy", "d", "dx", "dy", "diffuseconstant", "direction", "display", "divisor", "dur", "edgemode", "elevation", "end", "exponent", "fill", "fill-opacity", "fill-rule", "filter", "filterunits", "flood-color", "flood-opacity", "font-family", "font-size", "font-size-adjust", "font-stretch", "font-style", "font-variant", "font-weight", "fx", "fy", "g1", "g2", "glyph-name", "glyphref", "gradientunits", "gradienttransform", "height", "href", "id", "image-rendering", "in", "in2", "intercept", "k", "k1", "k2", "k3", "k4", "kerning", "keypoints", "keysplines", "keytimes", "lang", "lengthadjust", "letter-spacing", "kernelmatrix", "kernelunitlength", "lighting-color", "local", "marker-end", "marker-mid", "marker-start", "markerheight", "markerunits", "markerwidth", "maskcontentunits", "maskunits", "max", "mask", "mask-type", "media", "method", "mode", "min", "name", "numoctaves", "offset", "operator", "opacity", "order", "orient", "orientation", "origin", "overflow", "paint-order", "path", "pathlength", "patterncontentunits", "patterntransform", "patternunits", "points", "preservealpha", "preserveaspectratio", "primitiveunits", "r", "rx", "ry", "radius", "refx", "refy", "repeatcount", "repeatdur", "restart", "result", "rotate", "scale", "seed", "shape-rendering", "slope", "specularconstant", "specularexponent", "spreadmethod", "startoffset", "stddeviation", "stitchtiles", "stop-color", "stop-opacity", "stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin", "stroke-miterlimit", "stroke-opacity", "stroke", "stroke-width", "style", "surfacescale", "systemlanguage", "tabindex", "tablevalues", "targetx", "targety", "transform", "transform-origin", "text-anchor", "text-decoration", "text-rendering", "textlength", "type", "u1", "u2", "unicode", "values", "viewbox", "visibility", "version", "vert-adv-y", "vert-origin-x", "vert-origin-y", "width", "word-spacing", "wrap", "writing-mode", "xchannelselector", "ychannelselector", "x", "x1", "x2", "xmlns", "y", "y1", "y2", "z", "zoomandpan"]), kt = J(["accent", "accentunder", "align", "bevelled", "close", "columnsalign", "columnlines", "columnspan", "denomalign", "depth", "dir", "display", "displaystyle", "encoding", "fence", "frame", "height", "href", "id", "largeop", "length", "linethickness", "lspace", "lquote", "mathbackground", "mathcolor", "mathsize", "mathvariant", "maxsize", "minsize", "movablelimits", "notation", "numalign", "open", "rowalign", "rowlines", "rowspacing", "rowspan", "rspace", "rquote", "scriptlevel", "scriptminsize", "scriptsizemultiplier", "selection", "separator", "separators", "stretchy", "subscriptshift", "supscriptshift", "symmetric", "voffset", "width", "xmlns"]), Be = J(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]), hr = oe(/\{\{[\w\W]*|[\w\W]*\}\}/gm), Er = oe(/<%[\w\W]*|[\w\W]*%>/gm), _r = oe(/\$\{[\w\W]*/gm), Ar = oe(/^data-[\-\w.\u00B7-\uFFFF]+$/), yr = oe(/^aria-[\-\w]+$/), jt = oe(
119
+ /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i
120
+ // eslint-disable-line no-useless-escape
121
+ ), Sr = oe(/^(?:\w+script|data):/i), Rr = oe(
122
+ /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g
123
+ // eslint-disable-line no-control-regex
124
+ ), Yt = oe(/^html$/i), Ir = oe(/^[a-z][.\w]*(-[.\w]+)+$/i);
125
+ var $t = /* @__PURE__ */ Object.freeze({
126
+ __proto__: null,
127
+ ARIA_ATTR: yr,
128
+ ATTR_WHITESPACE: Rr,
129
+ CUSTOM_ELEMENT: Ir,
130
+ DATA_ATTR: Ar,
131
+ DOCTYPE_NAME: Yt,
132
+ ERB_EXPR: Er,
133
+ IS_ALLOWED_URI: jt,
134
+ IS_SCRIPT_OR_DATA: Sr,
135
+ MUSTACHE_EXPR: hr,
136
+ TMPLIT_EXPR: _r
137
+ });
138
+ const ve = {
139
+ element: 1,
140
+ text: 3,
141
+ // Deprecated
142
+ progressingInstruction: 7,
143
+ comment: 8,
144
+ document: 9
145
+ }, wr = function() {
146
+ return typeof window > "u" ? null : window;
147
+ }, Dr = function(t, i) {
148
+ if (typeof t != "object" || typeof t.createPolicy != "function")
149
+ return null;
150
+ let o = null;
151
+ const m = "data-tt-policy-suffix";
152
+ i && i.hasAttribute(m) && (o = i.getAttribute(m));
153
+ const R = "dompurify" + (o ? "#" + o : "");
154
+ try {
155
+ return t.createPolicy(R, {
156
+ createHTML(I) {
157
+ return I;
158
+ },
159
+ createScriptURL(I) {
160
+ return I;
161
+ }
162
+ });
163
+ } catch {
164
+ return console.warn("TrustedTypes policy " + R + " could not be created."), null;
165
+ }
166
+ }, Gt = function() {
167
+ return {
168
+ afterSanitizeAttributes: [],
169
+ afterSanitizeElements: [],
170
+ afterSanitizeShadowDOM: [],
171
+ beforeSanitizeAttributes: [],
172
+ beforeSanitizeElements: [],
173
+ beforeSanitizeShadowDOM: [],
174
+ uponSanitizeAttribute: [],
175
+ uponSanitizeElement: [],
176
+ uponSanitizeShadowNode: []
177
+ };
178
+ };
179
+ function qt() {
180
+ let r = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : wr();
181
+ const t = (A) => qt(A);
182
+ if (t.version = "3.3.1", t.removed = [], !r || !r.document || r.document.nodeType !== ve.document || !r.Element)
183
+ return t.isSupported = !1, t;
184
+ let {
185
+ document: i
186
+ } = r;
187
+ const o = i, m = o.currentScript, {
188
+ DocumentFragment: R,
189
+ HTMLTemplateElement: I,
190
+ Node: C,
191
+ Element: k,
192
+ NodeFilter: P,
193
+ NamedNodeMap: re = r.NamedNodeMap || r.MozNamedAttrMap,
194
+ HTMLFormElement: ne,
195
+ DOMParser: ie,
196
+ trustedTypes: v
197
+ } = r, W = k.prototype, he = Ce(W, "cloneNode"), Me = Ce(W, "remove"), Ye = Ce(W, "nextSibling"), qe = Ce(W, "childNodes"), Ee = Ce(W, "parentNode");
198
+ if (typeof I == "function") {
199
+ const A = i.createElement("template");
200
+ A.content && A.content.ownerDocument && (i = A.content.ownerDocument);
201
+ }
202
+ let B, c = "";
203
+ const {
204
+ implementation: l,
205
+ createNodeIterator: x,
206
+ createDocumentFragment: h,
207
+ getElementsByTagName: w
208
+ } = i, {
209
+ importNode: d
210
+ } = o;
211
+ let n = Gt();
212
+ t.isSupported = typeof Xt == "function" && typeof Ee == "function" && l && l.createHTMLDocument !== void 0;
213
+ const {
214
+ MUSTACHE_EXPR: S,
215
+ ERB_EXPR: f,
216
+ TMPLIT_EXPR: s,
217
+ DATA_ATTR: u,
218
+ ARIA_ATTR: p,
219
+ IS_SCRIPT_OR_DATA: g,
220
+ ATTR_WHITESPACE: D,
221
+ CUSTOM_ELEMENT: y
222
+ } = $t;
223
+ let {
224
+ IS_ALLOWED_URI: b
225
+ } = $t, E = null;
226
+ const O = L({}, [...Ut, ...ut, ...ft, ...pt, ...Ht]);
227
+ let _ = null;
228
+ const F = L({}, [...zt, ...mt, ...kt, ...Be]);
229
+ let N = Object.seal(dt(null, {
230
+ tagNameCheck: {
231
+ writable: !0,
232
+ configurable: !1,
233
+ enumerable: !0,
234
+ value: null
235
+ },
236
+ attributeNameCheck: {
237
+ writable: !0,
238
+ configurable: !1,
239
+ enumerable: !0,
240
+ value: null
241
+ },
242
+ allowCustomizedBuiltInElements: {
243
+ writable: !0,
244
+ configurable: !1,
245
+ enumerable: !0,
246
+ value: !1
247
+ }
248
+ })), V = null, Y = null;
249
+ const H = Object.seal(dt(null, {
250
+ tagCheck: {
251
+ writable: !0,
252
+ configurable: !1,
253
+ enumerable: !0,
254
+ value: null
255
+ },
256
+ attributeCheck: {
257
+ writable: !0,
258
+ configurable: !1,
259
+ enumerable: !0,
260
+ value: null
261
+ }
262
+ }));
263
+ let q = !0, me = !0, we = !1, De = !0, _e = !1, Pe = !0, ge = !1, Ke = !1, Ze = !1, Ae = !1, Fe = !1, Ue = !1, ht = !0, Et = !1;
264
+ const Zt = "user-content-";
265
+ let Je = !0, Le = !1, ye = {}, se = null;
266
+ const Qe = L({}, ["annotation-xml", "audio", "colgroup", "desc", "foreignobject", "head", "iframe", "math", "mi", "mn", "mo", "ms", "mtext", "noembed", "noframes", "noscript", "plaintext", "script", "style", "svg", "template", "thead", "title", "video", "xmp"]);
267
+ let _t = null;
268
+ const At = L({}, ["audio", "video", "img", "source", "image", "track"]);
269
+ let et = null;
270
+ const yt = L({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]), He = "http://www.w3.org/1998/Math/MathML", ze = "http://www.w3.org/2000/svg", ue = "http://www.w3.org/1999/xhtml";
271
+ let Se = ue, tt = !1, rt = null;
272
+ const Jt = L({}, [He, ze, ue], lt);
273
+ let ke = L({}, ["mi", "mo", "mn", "ms", "mtext"]), $e = L({}, ["annotation-xml"]);
274
+ const Qt = L({}, ["title", "style", "font", "a", "script"]);
275
+ let be = null;
276
+ const er = ["application/xhtml+xml", "text/html"], tr = "text/html";
277
+ let $ = null, Re = null;
278
+ const rr = i.createElement("form"), St = function(e) {
279
+ return e instanceof RegExp || e instanceof Function;
280
+ }, nt = function() {
281
+ let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
282
+ if (!(Re && Re === e)) {
283
+ if ((!e || typeof e != "object") && (e = {}), e = ce(e), be = // eslint-disable-next-line unicorn/prefer-includes
284
+ er.indexOf(e.PARSER_MEDIA_TYPE) === -1 ? tr : e.PARSER_MEDIA_TYPE, $ = be === "application/xhtml+xml" ? lt : Xe, E = ae(e, "ALLOWED_TAGS") ? L({}, e.ALLOWED_TAGS, $) : O, _ = ae(e, "ALLOWED_ATTR") ? L({}, e.ALLOWED_ATTR, $) : F, rt = ae(e, "ALLOWED_NAMESPACES") ? L({}, e.ALLOWED_NAMESPACES, lt) : Jt, et = ae(e, "ADD_URI_SAFE_ATTR") ? L(ce(yt), e.ADD_URI_SAFE_ATTR, $) : yt, _t = ae(e, "ADD_DATA_URI_TAGS") ? L(ce(At), e.ADD_DATA_URI_TAGS, $) : At, se = ae(e, "FORBID_CONTENTS") ? L({}, e.FORBID_CONTENTS, $) : Qe, V = ae(e, "FORBID_TAGS") ? L({}, e.FORBID_TAGS, $) : ce({}), Y = ae(e, "FORBID_ATTR") ? L({}, e.FORBID_ATTR, $) : ce({}), ye = ae(e, "USE_PROFILES") ? e.USE_PROFILES : !1, q = e.ALLOW_ARIA_ATTR !== !1, me = e.ALLOW_DATA_ATTR !== !1, we = e.ALLOW_UNKNOWN_PROTOCOLS || !1, De = e.ALLOW_SELF_CLOSE_IN_ATTR !== !1, _e = e.SAFE_FOR_TEMPLATES || !1, Pe = e.SAFE_FOR_XML !== !1, ge = e.WHOLE_DOCUMENT || !1, Ae = e.RETURN_DOM || !1, Fe = e.RETURN_DOM_FRAGMENT || !1, Ue = e.RETURN_TRUSTED_TYPE || !1, Ze = e.FORCE_BODY || !1, ht = e.SANITIZE_DOM !== !1, Et = e.SANITIZE_NAMED_PROPS || !1, Je = e.KEEP_CONTENT !== !1, Le = e.IN_PLACE || !1, b = e.ALLOWED_URI_REGEXP || jt, Se = e.NAMESPACE || ue, ke = e.MATHML_TEXT_INTEGRATION_POINTS || ke, $e = e.HTML_INTEGRATION_POINTS || $e, N = e.CUSTOM_ELEMENT_HANDLING || {}, e.CUSTOM_ELEMENT_HANDLING && St(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck) && (N.tagNameCheck = e.CUSTOM_ELEMENT_HANDLING.tagNameCheck), e.CUSTOM_ELEMENT_HANDLING && St(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck) && (N.attributeNameCheck = e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck), e.CUSTOM_ELEMENT_HANDLING && typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements == "boolean" && (N.allowCustomizedBuiltInElements = e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements), _e && (me = !1), Fe && (Ae = !0), ye && (E = L({}, Ht), _ = [], ye.html === !0 && (L(E, Ut), L(_, zt)), ye.svg === !0 && (L(E, ut), L(_, mt), L(_, Be)), ye.svgFilters === !0 && (L(E, ft), L(_, mt), L(_, Be)), ye.mathMl === !0 && (L(E, pt), L(_, kt), L(_, Be))), e.ADD_TAGS && (typeof e.ADD_TAGS == "function" ? H.tagCheck = e.ADD_TAGS : (E === O && (E = ce(E)), L(E, e.ADD_TAGS, $))), e.ADD_ATTR && (typeof e.ADD_ATTR == "function" ? H.attributeCheck = e.ADD_ATTR : (_ === F && (_ = ce(_)), L(_, e.ADD_ATTR, $))), e.ADD_URI_SAFE_ATTR && L(et, e.ADD_URI_SAFE_ATTR, $), e.FORBID_CONTENTS && (se === Qe && (se = ce(se)), L(se, e.FORBID_CONTENTS, $)), e.ADD_FORBID_CONTENTS && (se === Qe && (se = ce(se)), L(se, e.ADD_FORBID_CONTENTS, $)), Je && (E["#text"] = !0), ge && L(E, ["html", "head", "body"]), E.table && (L(E, ["tbody"]), delete V.tbody), e.TRUSTED_TYPES_POLICY) {
285
+ if (typeof e.TRUSTED_TYPES_POLICY.createHTML != "function")
286
+ throw Ne('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
287
+ if (typeof e.TRUSTED_TYPES_POLICY.createScriptURL != "function")
288
+ throw Ne('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
289
+ B = e.TRUSTED_TYPES_POLICY, c = B.createHTML("");
290
+ } else
291
+ B === void 0 && (B = Dr(v, m)), B !== null && typeof c == "string" && (c = B.createHTML(""));
292
+ J && J(e), Re = e;
293
+ }
294
+ }, Rt = L({}, [...ut, ...ft, ...gr]), It = L({}, [...pt, ...Tr]), nr = function(e) {
295
+ let a = Ee(e);
296
+ (!a || !a.tagName) && (a = {
297
+ namespaceURI: Se,
298
+ tagName: "template"
299
+ });
300
+ const T = Xe(e.tagName), U = Xe(a.tagName);
301
+ return rt[e.namespaceURI] ? e.namespaceURI === ze ? a.namespaceURI === ue ? T === "svg" : a.namespaceURI === He ? T === "svg" && (U === "annotation-xml" || ke[U]) : !!Rt[T] : e.namespaceURI === He ? a.namespaceURI === ue ? T === "math" : a.namespaceURI === ze ? T === "math" && $e[U] : !!It[T] : e.namespaceURI === ue ? a.namespaceURI === ze && !$e[U] || a.namespaceURI === He && !ke[U] ? !1 : !It[T] && (Qt[T] || !Rt[T]) : !!(be === "application/xhtml+xml" && rt[e.namespaceURI]) : !1;
302
+ }, le = function(e) {
303
+ Oe(t.removed, {
304
+ element: e
305
+ });
306
+ try {
307
+ Ee(e).removeChild(e);
308
+ } catch {
309
+ Me(e);
310
+ }
311
+ }, Te = function(e, a) {
312
+ try {
313
+ Oe(t.removed, {
314
+ attribute: a.getAttributeNode(e),
315
+ from: a
316
+ });
317
+ } catch {
318
+ Oe(t.removed, {
319
+ attribute: null,
320
+ from: a
321
+ });
322
+ }
323
+ if (a.removeAttribute(e), e === "is")
324
+ if (Ae || Fe)
325
+ try {
326
+ le(a);
327
+ } catch {
328
+ }
329
+ else
330
+ try {
331
+ a.setAttribute(e, "");
332
+ } catch {
333
+ }
334
+ }, wt = function(e) {
335
+ let a = null, T = null;
336
+ if (Ze)
337
+ e = "<remove></remove>" + e;
338
+ else {
339
+ const z = ct(e, /^[\r\n\t ]+/);
340
+ T = z && z[0];
341
+ }
342
+ be === "application/xhtml+xml" && Se === ue && (e = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + e + "</body></html>");
343
+ const U = B ? B.createHTML(e) : e;
344
+ if (Se === ue)
345
+ try {
346
+ a = new ie().parseFromString(U, be);
347
+ } catch {
348
+ }
349
+ if (!a || !a.documentElement) {
350
+ a = l.createDocument(Se, "template", null);
351
+ try {
352
+ a.documentElement.innerHTML = tt ? c : U;
353
+ } catch {
354
+ }
355
+ }
356
+ const j = a.body || a.documentElement;
357
+ return e && T && j.insertBefore(i.createTextNode(T), j.childNodes[0] || null), Se === ue ? w.call(a, ge ? "html" : "body")[0] : ge ? a.documentElement : j;
358
+ }, Dt = function(e) {
359
+ return x.call(
360
+ e.ownerDocument || e,
361
+ e,
362
+ // eslint-disable-next-line no-bitwise
363
+ P.SHOW_ELEMENT | P.SHOW_COMMENT | P.SHOW_TEXT | P.SHOW_PROCESSING_INSTRUCTION | P.SHOW_CDATA_SECTION,
364
+ null
365
+ );
366
+ }, it = function(e) {
367
+ return e instanceof ne && (typeof e.nodeName != "string" || typeof e.textContent != "string" || typeof e.removeChild != "function" || !(e.attributes instanceof re) || typeof e.removeAttribute != "function" || typeof e.setAttribute != "function" || typeof e.namespaceURI != "string" || typeof e.insertBefore != "function" || typeof e.hasChildNodes != "function");
368
+ }, Lt = function(e) {
369
+ return typeof C == "function" && e instanceof C;
370
+ };
371
+ function fe(A, e, a) {
372
+ We(A, (T) => {
373
+ T.call(t, e, a, Re);
374
+ });
375
+ }
376
+ const bt = function(e) {
377
+ let a = null;
378
+ if (fe(n.beforeSanitizeElements, e, null), it(e))
379
+ return le(e), !0;
380
+ const T = $(e.nodeName);
381
+ if (fe(n.uponSanitizeElement, e, {
382
+ tagName: T,
383
+ allowedTags: E
384
+ }), Pe && e.hasChildNodes() && !Lt(e.firstElementChild) && K(/<[/\w!]/g, e.innerHTML) && K(/<[/\w!]/g, e.textContent) || e.nodeType === ve.progressingInstruction || Pe && e.nodeType === ve.comment && K(/<[/\w]/g, e.data))
385
+ return le(e), !0;
386
+ if (!(H.tagCheck instanceof Function && H.tagCheck(T)) && (!E[T] || V[T])) {
387
+ if (!V[T] && xt(T) && (N.tagNameCheck instanceof RegExp && K(N.tagNameCheck, T) || N.tagNameCheck instanceof Function && N.tagNameCheck(T)))
388
+ return !1;
389
+ if (Je && !se[T]) {
390
+ const U = Ee(e) || e.parentNode, j = qe(e) || e.childNodes;
391
+ if (j && U) {
392
+ const z = j.length;
393
+ for (let ee = z - 1; ee >= 0; --ee) {
394
+ const pe = he(j[ee], !0);
395
+ pe.__removalCount = (e.__removalCount || 0) + 1, U.insertBefore(pe, Ye(e));
396
+ }
397
+ }
398
+ }
399
+ return le(e), !0;
400
+ }
401
+ return e instanceof k && !nr(e) || (T === "noscript" || T === "noembed" || T === "noframes") && K(/<\/no(script|embed|frames)/i, e.innerHTML) ? (le(e), !0) : (_e && e.nodeType === ve.text && (a = e.textContent, We([S, f, s], (U) => {
402
+ a = xe(a, U, " ");
403
+ }), e.textContent !== a && (Oe(t.removed, {
404
+ element: e.cloneNode()
405
+ }), e.textContent = a)), fe(n.afterSanitizeElements, e, null), !1);
406
+ }, Ot = function(e, a, T) {
407
+ if (ht && (a === "id" || a === "name") && (T in i || T in rr))
408
+ return !1;
409
+ if (!(me && !Y[a] && K(u, a))) {
410
+ if (!(q && K(p, a))) {
411
+ if (!(H.attributeCheck instanceof Function && H.attributeCheck(a, e))) {
412
+ if (!_[a] || Y[a]) {
413
+ if (
414
+ // First condition does a very basic check if a) it's basically a valid custom element tagname AND
415
+ // b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
416
+ // and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
417
+ !(xt(e) && (N.tagNameCheck instanceof RegExp && K(N.tagNameCheck, e) || N.tagNameCheck instanceof Function && N.tagNameCheck(e)) && (N.attributeNameCheck instanceof RegExp && K(N.attributeNameCheck, a) || N.attributeNameCheck instanceof Function && N.attributeNameCheck(a, e)) || // Alternative, second condition checks if it's an `is`-attribute, AND
418
+ // the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
419
+ a === "is" && N.allowCustomizedBuiltInElements && (N.tagNameCheck instanceof RegExp && K(N.tagNameCheck, T) || N.tagNameCheck instanceof Function && N.tagNameCheck(T)))
420
+ ) return !1;
421
+ } else if (!et[a]) {
422
+ if (!K(b, xe(T, D, ""))) {
423
+ if (!((a === "src" || a === "xlink:href" || a === "href") && e !== "script" && fr(T, "data:") === 0 && _t[e])) {
424
+ if (!(we && !K(g, xe(T, D, "")))) {
425
+ if (T)
426
+ return !1;
427
+ }
428
+ }
429
+ }
430
+ }
431
+ }
432
+ }
433
+ }
434
+ return !0;
435
+ }, xt = function(e) {
436
+ return e !== "annotation-xml" && ct(e, y);
437
+ }, Nt = function(e) {
438
+ fe(n.beforeSanitizeAttributes, e, null);
439
+ const {
440
+ attributes: a
441
+ } = e;
442
+ if (!a || it(e))
443
+ return;
444
+ const T = {
445
+ attrName: "",
446
+ attrValue: "",
447
+ keepAttr: !0,
448
+ allowedAttributes: _,
449
+ forceKeepAttr: void 0
450
+ };
451
+ let U = a.length;
452
+ for (; U--; ) {
453
+ const j = a[U], {
454
+ name: z,
455
+ namespaceURI: ee,
456
+ value: pe
457
+ } = j, Ie = $(z), ot = pe;
458
+ let X = z === "value" ? ot : pr(ot);
459
+ if (T.attrName = Ie, T.attrValue = X, T.keepAttr = !0, T.forceKeepAttr = void 0, fe(n.uponSanitizeAttribute, e, T), X = T.attrValue, Et && (Ie === "id" || Ie === "name") && (Te(z, e), X = Zt + X), Pe && K(/((--!?|])>)|<\/(style|title|textarea)/i, X)) {
460
+ Te(z, e);
461
+ continue;
462
+ }
463
+ if (Ie === "attributename" && ct(X, "href")) {
464
+ Te(z, e);
465
+ continue;
466
+ }
467
+ if (T.forceKeepAttr)
468
+ continue;
469
+ if (!T.keepAttr) {
470
+ Te(z, e);
471
+ continue;
472
+ }
473
+ if (!De && K(/\/>/i, X)) {
474
+ Te(z, e);
475
+ continue;
476
+ }
477
+ _e && We([S, f, s], (vt) => {
478
+ X = xe(X, vt, " ");
479
+ });
480
+ const Ct = $(e.nodeName);
481
+ if (!Ot(Ct, Ie, X)) {
482
+ Te(z, e);
483
+ continue;
484
+ }
485
+ if (B && typeof v == "object" && typeof v.getAttributeType == "function" && !ee)
486
+ switch (v.getAttributeType(Ct, Ie)) {
487
+ case "TrustedHTML": {
488
+ X = B.createHTML(X);
489
+ break;
490
+ }
491
+ case "TrustedScriptURL": {
492
+ X = B.createScriptURL(X);
493
+ break;
494
+ }
495
+ }
496
+ if (X !== ot)
497
+ try {
498
+ ee ? e.setAttributeNS(ee, z, X) : e.setAttribute(z, X), it(e) ? le(e) : Ft(t.removed);
499
+ } catch {
500
+ Te(z, e);
501
+ }
502
+ }
503
+ fe(n.afterSanitizeAttributes, e, null);
504
+ }, ir = function A(e) {
505
+ let a = null;
506
+ const T = Dt(e);
507
+ for (fe(n.beforeSanitizeShadowDOM, e, null); a = T.nextNode(); )
508
+ fe(n.uponSanitizeShadowNode, a, null), bt(a), Nt(a), a.content instanceof R && A(a.content);
509
+ fe(n.afterSanitizeShadowDOM, e, null);
510
+ };
511
+ return t.sanitize = function(A) {
512
+ let e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, a = null, T = null, U = null, j = null;
513
+ if (tt = !A, tt && (A = "<!-->"), typeof A != "string" && !Lt(A))
514
+ if (typeof A.toString == "function") {
515
+ if (A = A.toString(), typeof A != "string")
516
+ throw Ne("dirty is not a string, aborting");
517
+ } else
518
+ throw Ne("toString is not a function");
519
+ if (!t.isSupported)
520
+ return A;
521
+ if (Ke || nt(e), t.removed = [], typeof A == "string" && (Le = !1), Le) {
522
+ if (A.nodeName) {
523
+ const pe = $(A.nodeName);
524
+ if (!E[pe] || V[pe])
525
+ throw Ne("root node is forbidden and cannot be sanitized in-place");
526
+ }
527
+ } else if (A instanceof C)
528
+ a = wt("<!---->"), T = a.ownerDocument.importNode(A, !0), T.nodeType === ve.element && T.nodeName === "BODY" || T.nodeName === "HTML" ? a = T : a.appendChild(T);
529
+ else {
530
+ if (!Ae && !_e && !ge && // eslint-disable-next-line unicorn/prefer-includes
531
+ A.indexOf("<") === -1)
532
+ return B && Ue ? B.createHTML(A) : A;
533
+ if (a = wt(A), !a)
534
+ return Ae ? null : Ue ? c : "";
535
+ }
536
+ a && Ze && le(a.firstChild);
537
+ const z = Dt(Le ? A : a);
538
+ for (; U = z.nextNode(); )
539
+ bt(U), Nt(U), U.content instanceof R && ir(U.content);
540
+ if (Le)
541
+ return A;
542
+ if (Ae) {
543
+ if (Fe)
544
+ for (j = h.call(a.ownerDocument); a.firstChild; )
545
+ j.appendChild(a.firstChild);
546
+ else
547
+ j = a;
548
+ return (_.shadowroot || _.shadowrootmode) && (j = d.call(o, j, !0)), j;
549
+ }
550
+ let ee = ge ? a.outerHTML : a.innerHTML;
551
+ return ge && E["!doctype"] && a.ownerDocument && a.ownerDocument.doctype && a.ownerDocument.doctype.name && K(Yt, a.ownerDocument.doctype.name) && (ee = "<!DOCTYPE " + a.ownerDocument.doctype.name + `>
552
+ ` + ee), _e && We([S, f, s], (pe) => {
553
+ ee = xe(ee, pe, " ");
554
+ }), B && Ue ? B.createHTML(ee) : ee;
555
+ }, t.setConfig = function() {
556
+ let A = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
557
+ nt(A), Ke = !0;
558
+ }, t.clearConfig = function() {
559
+ Re = null, Ke = !1;
560
+ }, t.isValidAttribute = function(A, e, a) {
561
+ Re || nt({});
562
+ const T = $(A), U = $(e);
563
+ return Ot(T, U, a);
564
+ }, t.addHook = function(A, e) {
565
+ typeof e == "function" && Oe(n[A], e);
566
+ }, t.removeHook = function(A, e) {
567
+ if (e !== void 0) {
568
+ const a = cr(n[A], e);
569
+ return a === -1 ? void 0 : ur(n[A], a, 1)[0];
570
+ }
571
+ return Ft(n[A]);
572
+ }, t.removeHooks = function(A) {
573
+ n[A] = [];
574
+ }, t.removeAllHooks = function() {
575
+ n = Gt();
576
+ }, t;
577
+ }
578
+ var Lr = qt();
579
+ function Wt(r) {
580
+ return Lr.sanitize(r, {
581
+ ALLOWED_TAGS: ["p", "br", "strong", "em", "s", "u", "ul", "ol", "li", "a", "hr"],
582
+ ALLOWED_ATTR: ["href", "target", "rel"],
583
+ ALLOW_DATA_ATTR: !1,
584
+ FORBID_TAGS: ["script", "iframe", "object", "embed", "form", "input", "button", "style"],
585
+ FORBID_ATTR: ["onerror", "onload", "onclick", "onmouseover", "onfocus", "onblur"]
586
+ });
587
+ }
588
+ function G(r) {
589
+ return typeof r != "string" ? "" : r.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/'/g, "&#x27;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
590
+ }
591
+ function Z(r) {
592
+ if (!r || typeof r != "string")
593
+ return "";
594
+ const t = r.trim(), i = t.toLowerCase();
595
+ return i.startsWith("javascript:") || i.startsWith("vbscript:") || i.startsWith("file:") ? "" : i.startsWith("data:") ? i.startsWith("data:image/") ? t : "" : t;
596
+ }
597
+ const M = {
598
+ // グループ付きテキストフィールド: {$field.group:default}
599
+ TEXT_FIELD_WITH_GROUP: /\{\$(\w+)\.(\w+):([^}]+)\}/g,
600
+ // テキストフィールド: {$field:default}
601
+ TEXT_FIELD: /\{\$(\w+):([^}]+)\}/g,
602
+ // グループ付きリッチテキストフィールド: {$field.group:default:rich(:required:max=100...)}
603
+ RICH_TEXT_FIELD_WITH_GROUP: /\{\$(\w+)\.(\w+):(.+?):rich(?::[^}]+)?\}/g,
604
+ // リッチテキストフィールド: {$field:default:rich(:required:max=100...)}
605
+ RICH_TEXT_FIELD: /\{\$(\w+):(.+?):rich(?::[^}]+)?\}/g,
606
+ // グループ付きテキストエリアフィールド: {$field.group:default:textarea(:required:max=100...)}
607
+ TEXTAREA_FIELD_WITH_GROUP: /\{\$(\w+)\.(\w+):(.+?):textarea(?::[^}]+)?\}/g,
608
+ // テキストエリアフィールド: {$field:default:textarea(:required:max=100...)}
609
+ TEXTAREA_FIELD: /\{\$(\w+):(.+?):textarea(?::[^}]+)?\}/g,
610
+ // グループ付き画像フィールド: {$field.group:default:image(:required:max=100...)}
611
+ IMAGE_FIELD_WITH_GROUP: /\{\$(\w+)\.(\w+):(.+?):image(?::[^}]+)?\}/g,
612
+ // 画像フィールド: {$field:default:image(:required:max=100...)}
613
+ IMAGE_FIELD: /\{\$(\w+):(.+?):image(?::[^}]+)?\}/g,
614
+ // グループ付きセレクトボックス: ($field.group@:option1|option2) または ($field.group@:option1,option2)
615
+ SELECT_FIELD_WITH_GROUP: /\(\$(\w+)\.(\w+)@:([^)]+)\)/g,
616
+ // セレクトボックス: ($field@:option1|option2) または ($field@:option1,option2)
617
+ SELECT_FIELD: /\(\$(\w+)@:([^)]+)\)/g,
618
+ // グループ付きラジオボタン/チェックボックス: ($field.group:option1|option2) または ($field.group:option1,option2)
619
+ RADIO_CHECKBOX_FIELD_WITH_GROUP: /\(\$(\w+)\.(\w+):([^)]+)\)/g,
620
+ // ラジオボタン: ($field:option1|option2) / チェックボックス: ($field:option1,option2)
621
+ RADIO_FIELD: /\(\$(\w+):([^)]+)\)/g,
622
+ // バックエンドデータ参照: {@fieldName}, {@items[0]}, {@items[0].name}
623
+ BACKEND_DATA: /\{@([\w.[\]]+)\}/g
624
+ };
625
+ function br(r) {
626
+ const t = {};
627
+ for (const i of r) {
628
+ if (i === "required") {
629
+ t.required = !0;
630
+ continue;
631
+ }
632
+ if (i === "readonly") {
633
+ t.readonly = !0;
634
+ continue;
635
+ }
636
+ if (i === "disabled") {
637
+ t.disabled = !0;
638
+ continue;
639
+ }
640
+ if (i.startsWith("max=")) {
641
+ const o = Number(i.slice(4));
642
+ Number.isFinite(o) && (t.maxLength = o);
643
+ }
644
+ }
645
+ return t;
646
+ }
647
+ function te(r) {
648
+ const t = r.split(":"), i = [], o = (m) => m === "required" || m === "readonly" || m === "disabled" || /^max=\d+$/.test(m);
649
+ for (; t.length > 0 && o(t[t.length - 1]); )
650
+ i.unshift(t.pop());
651
+ return {
652
+ defaultValue: t.join(":"),
653
+ validation: br(i)
654
+ };
655
+ }
656
+ function Or(r, t, i) {
657
+ const o = Vt(), I = new o().parseFromString(`<template>${r}</template>`, "text/html").querySelector("template");
658
+ if (!I || !I.content.firstElementChild)
659
+ return de.warn("Failed to parse HTML:", r), r;
660
+ const C = I.content.firstElementChild;
661
+ if (Object.entries(t).forEach(([k, P]) => {
662
+ C.setAttribute(k, P);
663
+ }), i?.addClass) {
664
+ const k = C.getAttribute("class")?.trim() || "", P = k ? `${k} ${i.addClass}` : i.addClass;
665
+ C.setAttribute("class", P);
666
+ }
667
+ return C.outerHTML;
668
+ }
669
+ function Ve(r, t, i, o, m = []) {
670
+ const R = [...i, ...o, ...m];
671
+ if (r) {
672
+ const I = R.find((C) => C.id === r);
673
+ if (I)
674
+ return I.url;
675
+ }
676
+ if (t) {
677
+ const I = R.find((C) => C.id === t);
678
+ if (I)
679
+ return de.warn(`Image not found: ${r}, using default: ${t}`), I.url;
680
+ }
681
+ return de.warn(`Image not found: ${r}, default: ${t}`), "";
682
+ }
683
+ function xr(r) {
684
+ return typeof r == "object" && r !== null;
685
+ }
686
+ function Bt(r, t) {
687
+ if (!r || !t) return "";
688
+ try {
689
+ const i = [];
690
+ let o = "";
691
+ for (let R = 0; R < t.length; R++) {
692
+ const I = t[R];
693
+ I === "[" || I === "]" || I === "." ? o && (i.push(o), o = "") : o += I;
694
+ }
695
+ o && i.push(o);
696
+ let m = r;
697
+ for (let R = 0; R < i.length; R++) {
698
+ const I = i[R];
699
+ if (I.match(/^\d+$/)) {
700
+ const C = parseInt(I, 10);
701
+ if (Array.isArray(m) && C >= 0 && C < m.length)
702
+ m = m[C];
703
+ else
704
+ return "";
705
+ } else if (xr(m) && I in m)
706
+ m = m[I];
707
+ else
708
+ return "";
709
+ }
710
+ return m == null ? "" : String(m);
711
+ } catch (i) {
712
+ return de.warn(`Failed to resolve backend data path: ${t}`, i), "";
713
+ }
714
+ }
715
+ function Nr(r, t) {
716
+ return !r || !t ? r : r.replace(/\{(\w+)\}/g, (i, o) => {
717
+ const m = t[o];
718
+ return m == null ? i : String(m);
719
+ });
720
+ }
721
+ const Cr = [
722
+ "h1",
723
+ "h2",
724
+ "h3",
725
+ "h4",
726
+ "h5",
727
+ "h6",
728
+ "div",
729
+ "p",
730
+ "span",
731
+ "li",
732
+ "ul",
733
+ "ol",
734
+ "section",
735
+ "article",
736
+ "aside",
737
+ "nav",
738
+ "header",
739
+ "footer",
740
+ "main",
741
+ "figure",
742
+ "figcaption",
743
+ "blockquote",
744
+ "pre",
745
+ "code",
746
+ "table",
747
+ "thead",
748
+ "tbody",
749
+ "tr",
750
+ "th",
751
+ "td"
752
+ ];
753
+ function vr(r, t) {
754
+ r.querySelectorAll("[z-if]").forEach((i) => {
755
+ const o = i.getAttribute("z-if");
756
+ o ? (t[o] !== void 0 ? t[o] : !0) ? i.removeAttribute("z-if") : i.remove() : i.removeAttribute("z-if");
757
+ });
758
+ }
759
+ function Mr(r, t, i) {
760
+ r.querySelectorAll("[z-tag]").forEach((o) => {
761
+ const m = o.getAttribute("z-tag");
762
+ if (m) {
763
+ const R = m.match(/^\$(\w+)(?::(.+))?$/);
764
+ if (R) {
765
+ const I = R[1], C = t[I], k = typeof C == "string" ? C : o.tagName.toLowerCase(), P = typeof k == "string" ? k.toLowerCase() : k;
766
+ if (typeof P == "string" && Cr.includes(P)) {
767
+ const re = i.createElement(P);
768
+ Array.from(o.attributes).forEach((ne) => {
769
+ ne.name !== "z-tag" && re.setAttribute(ne.name, ne.value);
770
+ }), Array.from(o.childNodes).forEach((ne) => {
771
+ re.appendChild(ne.cloneNode(!0));
772
+ }), o.parentNode?.replaceChild(re, o);
773
+ }
774
+ }
775
+ }
776
+ });
777
+ }
778
+ function Pr(r) {
779
+ if (r == null || r === "")
780
+ return !0;
781
+ if (typeof r == "string") {
782
+ const t = r.trim();
783
+ if (t === "" || t === "<p></p>" || t === "<p> </p>" || /^<p>\s*<\/p>$/i.test(t) || /^<p>\s*<br\s*\/?>\s*<\/p>$/i.test(t))
784
+ return !0;
785
+ }
786
+ return !1;
787
+ }
788
+ function Fr(r, t) {
789
+ r.querySelectorAll("[z-empty]").forEach((i) => {
790
+ const o = i.getAttribute("z-empty");
791
+ if (o) {
792
+ const m = o.match(/^\$(\w+)$/);
793
+ if (m) {
794
+ const R = m[1], I = t[R];
795
+ Pr(I) ? i.remove() : i.removeAttribute("z-empty");
796
+ } else
797
+ i.removeAttribute("z-empty");
798
+ } else
799
+ i.removeAttribute("z-empty");
800
+ });
801
+ }
802
+ function Kt(r, t, i, o, m, R = !0, I = [], C = [], k = [], P, re) {
803
+ const ne = Vt(), ie = new ne(), v = ie.parseFromString(`<template>${r}</template>`, "text/html"), W = v.querySelector("template");
804
+ if (!W || !W.content)
805
+ return de.error("Failed to parse template HTML"), r;
806
+ const he = (c) => {
807
+ if (c.nodeType === st) {
808
+ let l = c.textContent || "";
809
+ P && (l = l.replace(M.BACKEND_DATA, (y, b) => Bt(P, b)));
810
+ let h = /\{\$(\w+)\.(\w+)\?:(.+?):rich(?::[^}]+)?\}/.exec(l), w = !1;
811
+ if (h && c.parentNode ? w = !0 : h = /\{\$(\w+)\?:(.+?):rich(?::[^}]+)?\}/.exec(l), h && c.parentNode) {
812
+ const y = h[1], b = w ? h[3] : h[2], { defaultValue: E } = te(b), O = t[y];
813
+ if (typeof O == "boolean") {
814
+ const q = c.parentNode, me = h.index || 0, we = l.substring(0, me), De = l.substring(me + h[0].length);
815
+ we && q.insertBefore(v.createTextNode(we), c), De && q.insertBefore(v.createTextNode(De), c), c.parentNode && c.parentNode.removeChild(c);
816
+ return;
817
+ }
818
+ let _ = O === void 0 ? "" : typeof O == "string" ? O : String(O || E);
819
+ R || (_ = Wt(_));
820
+ const F = c.parentNode, N = h.index || 0, V = l.substring(0, N), Y = l.substring(N + h[0].length);
821
+ _ ? _.trim().startsWith("<p") || (_ = `<p>${_}</p>`) : _ = "";
822
+ const H = v.createElement("div");
823
+ H.innerHTML = _, V && F.insertBefore(v.createTextNode(V), c), Array.from(H.childNodes).forEach((q) => {
824
+ F.insertBefore(q.cloneNode(!0), c);
825
+ }), Y && F.insertBefore(v.createTextNode(Y), c), c.parentNode && c.parentNode.removeChild(c);
826
+ return;
827
+ }
828
+ let n = new RegExp(
829
+ M.RICH_TEXT_FIELD_WITH_GROUP.source,
830
+ M.RICH_TEXT_FIELD_WITH_GROUP.flags
831
+ ).exec(l), S = !1;
832
+ if (n && c.parentNode ? S = !0 : n = new RegExp(
833
+ M.RICH_TEXT_FIELD.source,
834
+ M.RICH_TEXT_FIELD.flags
835
+ ).exec(l), n && c.parentNode) {
836
+ const y = n[1], b = S ? n[3] : n[2], E = t[y];
837
+ let O = E === void 0 ? "" : typeof E == "string" ? E : String(E || b);
838
+ R || (O = Wt(O));
839
+ const _ = c.parentNode, F = n.index || 0, N = l.substring(0, F), V = l.substring(F + n[0].length);
840
+ O ? O.trim().startsWith("<p") || (O = `<p>${O}</p>`) : O = "<p></p>";
841
+ const Y = v.createElement("div");
842
+ Y.innerHTML = O, N && _.insertBefore(v.createTextNode(N), c), Array.from(Y.childNodes).forEach((H) => {
843
+ _.insertBefore(H.cloneNode(!0), c);
844
+ }), V && _.insertBefore(v.createTextNode(V), c), c.parentNode && c.parentNode.removeChild(c);
845
+ return;
846
+ }
847
+ let s = /\{\$(\w+)\.(\w+)\?:(.+?):textarea(?::[^}]+)?\}/.exec(l), u = !1;
848
+ if (s && c.parentNode ? u = !0 : s = /\{\$(\w+)\?:(.+?):textarea(?::[^}]+)?\}/.exec(l), s && c.parentNode) {
849
+ const y = s[1], b = u ? s[3] : s[2], { defaultValue: E } = te(b), O = t[y], _ = O === void 0 ? "" : String(O || E), F = c.parentNode, N = s.index || 0, V = l.substring(0, N), Y = l.substring(N + s[0].length);
850
+ V && F.insertBefore(v.createTextNode(V), c);
851
+ const H = _.split(`
852
+ `);
853
+ if (H.forEach((q, me) => {
854
+ q && F.insertBefore(v.createTextNode(q), c), me < H.length - 1 && F.insertBefore(v.createElement("br"), c);
855
+ }), Y) {
856
+ const q = v.createTextNode(Y);
857
+ F.insertBefore(q, c), he(q);
858
+ }
859
+ c.parentNode && c.parentNode.removeChild(c);
860
+ return;
861
+ }
862
+ let g = new RegExp(
863
+ M.TEXTAREA_FIELD_WITH_GROUP.source,
864
+ M.TEXTAREA_FIELD_WITH_GROUP.flags
865
+ ).exec(l), D = !1;
866
+ if (g && c.parentNode ? D = !0 : g = new RegExp(
867
+ M.TEXTAREA_FIELD.source,
868
+ M.TEXTAREA_FIELD.flags
869
+ ).exec(l), g && c.parentNode) {
870
+ const y = g[1], b = D ? g[3] : g[2], E = t[y] ?? b ?? "", O = String(E), _ = c.parentNode, F = g.index || 0, N = l.substring(0, F), V = l.substring(F + g[0].length);
871
+ N && _.insertBefore(v.createTextNode(N), c);
872
+ const Y = O.split(`
873
+ `);
874
+ if (Y.forEach((H, q) => {
875
+ H && _.insertBefore(v.createTextNode(H), c), q < Y.length - 1 && _.insertBefore(v.createElement("br"), c);
876
+ }), V) {
877
+ const H = v.createTextNode(V);
878
+ _.insertBefore(H, c), he(H);
879
+ }
880
+ c.parentNode && c.parentNode.removeChild(c);
881
+ return;
882
+ }
883
+ l = l.replace(/\{\$(\w+)\?:([^}]+)\}/g, (y, b, E) => {
884
+ if (/:textarea(?::[^}]*)?$/.test(y))
885
+ return y;
886
+ const O = t[b];
887
+ if (O === void 0 || typeof O == "boolean")
888
+ return "";
889
+ const { defaultValue: _ } = te(E);
890
+ return String(O || _);
891
+ }), l = l.replace(
892
+ /\{\$(\w+)\.(\w+)\?:([^}]+)\}/g,
893
+ (y, b, E, O) => {
894
+ if (/:textarea(?::[^}]*)?$/.test(y))
895
+ return y;
896
+ const _ = t[b];
897
+ if (_ === void 0 || typeof _ == "boolean")
898
+ return "";
899
+ const { defaultValue: F } = te(O);
900
+ return String(_ || F);
901
+ }
902
+ ), l = l.replace(
903
+ M.TEXT_FIELD_WITH_GROUP,
904
+ (y, b, E, O) => {
905
+ const _ = t[b];
906
+ if (_ === void 0)
907
+ return "";
908
+ const { defaultValue: F } = te(O);
909
+ return String(_ || F);
910
+ }
911
+ ), l = l.replace(M.TEXT_FIELD, (y, b, E) => {
912
+ const O = t[b];
913
+ if (O === void 0)
914
+ return "";
915
+ const { defaultValue: _ } = te(E);
916
+ return String(O || _);
917
+ }), c.textContent = l;
918
+ } else if (c.nodeType === at) {
919
+ const l = c, x = [];
920
+ Array.from(l.attributes).forEach((h) => {
921
+ const w = h.value;
922
+ let d = h.value;
923
+ const n = h.name.toLowerCase();
924
+ if (n === "z-if" || n === "z-for" || n === "z-slot" || n === "z-empty" || n === "z-tag" || n.startsWith("data-zcode-"))
925
+ return;
926
+ const S = /^\{\$[\w.]+?\?:[^}]+\}(?::(rich|image|textarea))?$/.test(
927
+ w.trim()
928
+ );
929
+ P && ((n === "href" || n === "src" || n === "action") && (d = Nr(d, P)), d = d.replace(M.BACKEND_DATA, (f, s) => {
930
+ const u = Bt(P, s);
931
+ return n === "href" || n === "src" || n === "action" ? Z(u) : G(u);
932
+ })), d = d.replace(
933
+ /\{\$(\w+)\?:(.+?):rich(?::[^}]+)?\}/g,
934
+ (f, s, u) => {
935
+ const p = t[s];
936
+ if (p === void 0 || typeof p == "boolean")
937
+ return "";
938
+ const { defaultValue: g } = te(u);
939
+ return G(String(p || g));
940
+ }
941
+ ), d = d.replace(
942
+ /\{\$(\w+)\.(\w+)\?:(.+?):rich(?::[^}]+)?\}/g,
943
+ (f, s, u, p) => {
944
+ const g = t[s];
945
+ if (g === void 0 || typeof g == "boolean")
946
+ return "";
947
+ const { defaultValue: D } = te(p);
948
+ return G(String(g || D));
949
+ }
950
+ ), d = d.replace(
951
+ /\{\$(\w+)\?:(.+?):image(?::[^}]+)?\}/g,
952
+ (f, s, u) => {
953
+ const p = t[s];
954
+ if (p === void 0)
955
+ return "";
956
+ const { defaultValue: g } = te(u), D = typeof p == "string" ? p : String(p || g), y = Ve(
957
+ D,
958
+ g,
959
+ I,
960
+ C,
961
+ k
962
+ ), b = typeof y == "string" ? y : String(y || g);
963
+ return n === "href" || n === "src" ? Z(b) : G(b);
964
+ }
965
+ ), d = d.replace(
966
+ /\{\$(\w+)\.(\w+)\?:(.+?):image(?::[^}]+)?\}/g,
967
+ (f, s, u, p) => {
968
+ const g = t[s];
969
+ if (g === void 0)
970
+ return "";
971
+ const { defaultValue: D } = te(p), y = typeof g == "string" ? g : String(g || D), b = Ve(
972
+ y,
973
+ D,
974
+ I,
975
+ C,
976
+ k
977
+ ), E = typeof b == "string" ? b : String(b || D);
978
+ return n === "href" || n === "src" ? Z(E) : G(E);
979
+ }
980
+ ), d = d.replace(
981
+ M.RICH_TEXT_FIELD_WITH_GROUP,
982
+ (f, s, u, p) => {
983
+ const g = t[s];
984
+ return g === void 0 ? "" : G(String(g || p));
985
+ }
986
+ ), d = d.replace(M.RICH_TEXT_FIELD, (f, s, u) => {
987
+ const p = t[s];
988
+ return p === void 0 ? "" : G(String(p || u));
989
+ }), d = d.replace(
990
+ M.IMAGE_FIELD_WITH_GROUP,
991
+ (f, s, u, p) => {
992
+ const g = t[s];
993
+ if (g === void 0)
994
+ return "";
995
+ const D = Ve(
996
+ g || p,
997
+ p,
998
+ I,
999
+ C,
1000
+ k
1001
+ );
1002
+ return n === "href" || n === "src" ? Z(D || p) : G(D || p);
1003
+ }
1004
+ ), d = d.replace(M.IMAGE_FIELD, (f, s, u) => {
1005
+ const p = t[s];
1006
+ if (p === void 0)
1007
+ return "";
1008
+ const g = Ve(
1009
+ p || u,
1010
+ u,
1011
+ I,
1012
+ C,
1013
+ k
1014
+ );
1015
+ return n === "href" || n === "src" ? Z(g || u) : G(g || u);
1016
+ }), d = d.replace(/\{\$(\w+)\?:([^}]+)\}/g, (f, s, u) => {
1017
+ const p = t[s];
1018
+ if (p === void 0 || typeof p == "boolean")
1019
+ return "";
1020
+ const { defaultValue: g } = te(u), D = String(p || g);
1021
+ return n === "href" || n === "src" || n === "action" ? Z(D) : G(D);
1022
+ }), d = d.replace(
1023
+ /\{\$(\w+)\.(\w+)\?:([^}]+)\}/g,
1024
+ (f, s, u, p) => {
1025
+ const g = t[s];
1026
+ if (g === void 0 || typeof g == "boolean")
1027
+ return "";
1028
+ const { defaultValue: D } = te(p), y = String(g || D);
1029
+ return n === "href" || n === "src" || n === "action" ? Z(y) : G(y);
1030
+ }
1031
+ ), d = d.replace(
1032
+ M.TEXT_FIELD_WITH_GROUP,
1033
+ (f, s, u, p) => {
1034
+ const g = t[s];
1035
+ if (g === void 0)
1036
+ return "";
1037
+ const { defaultValue: D } = te(p), y = String(g || D);
1038
+ return n === "href" || n === "src" || n === "action" ? Z(y) : G(y);
1039
+ }
1040
+ ), d = d.replace(M.TEXT_FIELD, (f, s, u) => {
1041
+ const p = t[s];
1042
+ if (p === void 0)
1043
+ return "";
1044
+ const { defaultValue: g } = te(u), D = String(p || g);
1045
+ return n === "href" || n === "src" || n === "action" ? Z(D) : G(D);
1046
+ }), S && d.trim() === "" ? x.push(h.name) : h.value = d;
1047
+ }), x.forEach((h) => {
1048
+ l.removeAttribute(h);
1049
+ });
1050
+ }
1051
+ Array.from(c.childNodes).forEach((l) => he(l));
1052
+ };
1053
+ he(W.content);
1054
+ const Me = (c) => {
1055
+ if (c.nodeType === st) {
1056
+ let l = c.textContent || "";
1057
+ l = l.replace(
1058
+ M.SELECT_FIELD_WITH_GROUP,
1059
+ (x, h, w, d) => {
1060
+ if (d.includes("|"))
1061
+ return t[h] || d.split("|")[0];
1062
+ if (d.includes(",")) {
1063
+ const n = t[h], S = Array.isArray(n) ? n : [], f = d.split(",");
1064
+ return S.filter((s) => typeof s == "string" && f.includes(s)).join(" ");
1065
+ }
1066
+ return t[h] || d;
1067
+ }
1068
+ ), l = l.replace(M.SELECT_FIELD, (x, h, w) => {
1069
+ if (w.includes("|")) {
1070
+ const n = t[h];
1071
+ return typeof n == "string" ? n : w.split("|")[0];
1072
+ } else if (w.includes(",")) {
1073
+ const n = t[h], S = Array.isArray(n) ? n : [], f = w.split(",");
1074
+ return S.filter((s) => typeof s == "string" && f.includes(s)).join(" ");
1075
+ }
1076
+ const d = t[h];
1077
+ return typeof d == "string" ? d : w;
1078
+ }), l = l.replace(
1079
+ M.RADIO_CHECKBOX_FIELD_WITH_GROUP,
1080
+ (x, h, w, d) => {
1081
+ if (d.includes("|")) {
1082
+ const S = t[h];
1083
+ return typeof S == "string" ? S : d.split("|")[0];
1084
+ } else if (d.includes(",")) {
1085
+ const S = t[h], f = Array.isArray(S) ? S : [], s = d.split(",");
1086
+ return f.filter((u) => typeof u == "string" && s.includes(u)).join(" ");
1087
+ }
1088
+ const n = t[h];
1089
+ return typeof n == "string" ? n : d;
1090
+ }
1091
+ ), l = l.replace(M.RADIO_FIELD, (x, h, w) => {
1092
+ if (w.includes("|")) {
1093
+ const n = t[h];
1094
+ return typeof n == "string" ? n : w.split("|")[0];
1095
+ } else if (w.includes(",")) {
1096
+ const n = t[h], S = Array.isArray(n) ? n : [], f = w.split(",");
1097
+ return S.filter((s) => typeof s == "string" && f.includes(s)).join(" ");
1098
+ }
1099
+ const d = t[h];
1100
+ return typeof d == "string" ? d : w;
1101
+ }), c.textContent = l;
1102
+ } else c.nodeType === at && Array.from(c.attributes).forEach((x) => {
1103
+ let h = x.value;
1104
+ const w = x.name.toLowerCase();
1105
+ h = h.replace(
1106
+ M.SELECT_FIELD_WITH_GROUP,
1107
+ (d, n, S, f) => {
1108
+ let s;
1109
+ if (f.includes("|"))
1110
+ s = t[n] || f.split("|")[0];
1111
+ else if (f.includes(",")) {
1112
+ const u = t[n], p = Array.isArray(u) ? u : [], g = f.split(",");
1113
+ s = p.filter((D) => typeof D == "string" && g.includes(D)).join(" ");
1114
+ } else {
1115
+ const u = t[n];
1116
+ s = typeof u == "string" ? u : f;
1117
+ }
1118
+ return w === "href" || w === "src" || w === "action" ? Z(String(s)) : G(String(s));
1119
+ }
1120
+ ), h = h.replace(M.SELECT_FIELD, (d, n, S) => {
1121
+ let f;
1122
+ if (S.includes("|"))
1123
+ f = t[n] || S.split("|")[0];
1124
+ else if (S.includes(",")) {
1125
+ const s = t[n], u = Array.isArray(s) ? s : [], p = S.split(",");
1126
+ f = u.filter((g) => typeof g == "string" && p.includes(g)).join(" ");
1127
+ } else {
1128
+ const s = t[n];
1129
+ f = typeof s == "string" ? s : S;
1130
+ }
1131
+ return w === "href" || w === "src" || w === "action" ? Z(String(f)) : G(String(f));
1132
+ }), h = h.replace(
1133
+ M.RADIO_CHECKBOX_FIELD_WITH_GROUP,
1134
+ (d, n, S, f) => {
1135
+ let s;
1136
+ if (f.includes("|"))
1137
+ s = t[n] || f.split("|")[0];
1138
+ else if (f.includes(",")) {
1139
+ const u = t[n], p = Array.isArray(u) ? u : [], g = f.split(",");
1140
+ s = p.filter((D) => typeof D == "string" && g.includes(D)).join(" ");
1141
+ } else {
1142
+ const u = t[n];
1143
+ s = typeof u == "string" ? u : f;
1144
+ }
1145
+ return w === "href" || w === "src" || w === "action" ? Z(String(s)) : G(String(s));
1146
+ }
1147
+ ), h = h.replace(M.RADIO_FIELD, (d, n, S) => {
1148
+ let f;
1149
+ if (S.includes("|"))
1150
+ f = t[n] || S.split("|")[0];
1151
+ else if (S.includes(",")) {
1152
+ const s = t[n], u = Array.isArray(s) ? s : [], p = S.split(",");
1153
+ f = u.filter((g) => typeof g == "string" && p.includes(g)).join(" ");
1154
+ } else {
1155
+ const s = t[n];
1156
+ f = typeof s == "string" ? s : S;
1157
+ }
1158
+ return w === "href" || w === "src" || w === "action" ? Z(String(f)) : G(String(f));
1159
+ }), x.value = h;
1160
+ });
1161
+ c.childNodes.forEach((l) => Me(l));
1162
+ };
1163
+ Me(W.content), vr(W.content, t), Mr(W.content, t, v), Fr(W.content, t);
1164
+ const Ye = () => {
1165
+ Array.from(W.content.querySelectorAll("[z-for]")).forEach((l) => {
1166
+ const x = l.getAttribute("z-for");
1167
+ if (!x) {
1168
+ l.removeAttribute("z-for");
1169
+ return;
1170
+ }
1171
+ const h = x.match(/^(\w+)\s+in\s+(.+)$/);
1172
+ if (!h) {
1173
+ de.warn(`Invalid z-for syntax: ${x}`), l.removeAttribute("z-for");
1174
+ return;
1175
+ }
1176
+ const [, w, d] = h;
1177
+ if (!d.startsWith("{@") || !d.endsWith("}")) {
1178
+ de.warn(`z-for only supports backend data: ${d}`), l.removeAttribute("z-for");
1179
+ return;
1180
+ }
1181
+ const n = d.slice(2, -1);
1182
+ if (!P) {
1183
+ l.remove();
1184
+ return;
1185
+ }
1186
+ let S;
1187
+ try {
1188
+ const u = n.split(".");
1189
+ let p = P;
1190
+ for (const g of u)
1191
+ if (p && typeof p == "object" && g in p)
1192
+ p = p[g];
1193
+ else {
1194
+ p = null;
1195
+ break;
1196
+ }
1197
+ S = p;
1198
+ } catch (u) {
1199
+ de.warn(`Failed to resolve data source: ${n}`, u), l.remove();
1200
+ return;
1201
+ }
1202
+ if (!Array.isArray(S) || S.length === 0) {
1203
+ l.remove();
1204
+ return;
1205
+ }
1206
+ const f = l.ownerDocument ?? v;
1207
+ if (!f) throw new Error("Document not available for createDocumentFragment");
1208
+ const s = f.createDocumentFragment();
1209
+ S.forEach((u) => {
1210
+ const p = l.cloneNode(!0);
1211
+ p.removeAttribute("z-for"), qe(p, w, u, t, P), s.appendChild(p);
1212
+ }), l.parentNode && l.parentNode.replaceChild(s, l);
1213
+ });
1214
+ }, qe = (c, l, x, h, w, d) => {
1215
+ const n = (f) => {
1216
+ if (f.nodeType === st) {
1217
+ let s = f.textContent || "";
1218
+ const u = new RegExp(`\\{${l}\\.([\\w\\.\\[\\]]+)\\}`, "g");
1219
+ s = s.replace(u, (p, g) => {
1220
+ try {
1221
+ const D = g.split(/[.[\]]/).filter((b) => b);
1222
+ let y = x;
1223
+ for (const b of D)
1224
+ if (b.match(/^\d+$/)) {
1225
+ const E = parseInt(b, 10);
1226
+ if (Array.isArray(y) && E >= 0 && E < y.length)
1227
+ y = y[E];
1228
+ else
1229
+ return "";
1230
+ } else if (y && typeof y == "object" && b in y)
1231
+ y = y[b];
1232
+ else
1233
+ return "";
1234
+ return y == null ? "" : String(y);
1235
+ } catch {
1236
+ return "";
1237
+ }
1238
+ }), s = s.replace(new RegExp(`\\{${l}\\}`, "g"), () => typeof x == "object" && x !== null ? JSON.stringify(x) : String(x)), f.textContent = s;
1239
+ } else if (f.nodeType === at) {
1240
+ const s = f;
1241
+ Array.from(s.attributes).forEach((u) => {
1242
+ let p = u.value;
1243
+ const g = new RegExp(`\\{${l}\\.([\\w\\.\\[\\]]+)\\}`, "g");
1244
+ p = p.replace(g, (D, y) => {
1245
+ try {
1246
+ const b = y.split(/[.[\]]/).filter((_) => _);
1247
+ let E = x;
1248
+ for (const _ of b)
1249
+ if (_.match(/^\d+$/)) {
1250
+ const F = parseInt(_, 10);
1251
+ if (Array.isArray(E) && F >= 0 && F < E.length)
1252
+ E = E[F];
1253
+ else
1254
+ return "";
1255
+ } else if (E && typeof E == "object" && _ in E)
1256
+ E = E[_];
1257
+ else
1258
+ return "";
1259
+ const O = E == null ? "" : String(E);
1260
+ return u.name === "href" || u.name === "src" || u.name === "action" ? Z(O) : G(O);
1261
+ } catch {
1262
+ return "";
1263
+ }
1264
+ }), p = p.replace(new RegExp(`\\{${l}\\}`, "g"), () => {
1265
+ const D = typeof x == "object" && x !== null ? JSON.stringify(x) : String(x);
1266
+ return u.name === "href" || u.name === "src" || u.name === "action" ? Z(D) : G(D);
1267
+ }), u.value = p;
1268
+ }), Array.from(s.childNodes).forEach((u) => n(u));
1269
+ }
1270
+ };
1271
+ Array.from(c.childNodes).forEach((f) => n(f));
1272
+ const S = c.innerHTML;
1273
+ if (S) {
1274
+ const f = Kt(
1275
+ S,
1276
+ h,
1277
+ i,
1278
+ o,
1279
+ m,
1280
+ R,
1281
+ I,
1282
+ C,
1283
+ k,
1284
+ w
1285
+ );
1286
+ c.innerHTML = f;
1287
+ }
1288
+ };
1289
+ Ye();
1290
+ const Ee = (c) => {
1291
+ c.forEach((l) => {
1292
+ const x = l.getAttribute("z-slot") || "default", h = t.slots?.[x];
1293
+ let w = [];
1294
+ if (Array.isArray(h) ? w = h : h && typeof h == "object" && h.children && (w = h.children || []), w.length === 0) {
1295
+ if (l.removeAttribute("z-slot"), R) {
1296
+ l.setAttribute("data-zcode-empty-slot", x), l.setAttribute(
1297
+ "data-zcode-slot-path",
1298
+ i ? `${i}.slots.${x}` : `slots.${x}`
1299
+ );
1300
+ const f = re?.translations?.addSlotButton ?? "+ Add Part";
1301
+ l.innerHTML = `<div class="zcode-empty-slot" data-zcode-empty-slot-content>
1302
+ <button class="zcode-add-slot-btn" data-zcode-add-slot>${f}</button>
1303
+ </div>`;
1304
+ } else
1305
+ l.innerHTML = "";
1306
+ return;
1307
+ }
1308
+ const d = w.map((f, s) => {
1309
+ const u = i ? `${i}.slots.${x}.${s}` : `slots.${x}.${s}`;
1310
+ return m(f, u);
1311
+ }).join("");
1312
+ l.removeAttribute("z-slot");
1313
+ const S = ie.parseFromString(`<template>${d}</template>`, "text/html").querySelector("template");
1314
+ if (S && S.content)
1315
+ for (l.innerHTML = ""; S.content.firstChild; )
1316
+ l.appendChild(S.content.firstChild);
1317
+ else
1318
+ l.innerHTML = d;
1319
+ });
1320
+ }, B = Array.from(W.content.querySelectorAll("[z-slot]"));
1321
+ return Ee(B), W.innerHTML;
1322
+ }
1323
+ function Ur(r, t) {
1324
+ const i = [...t.common, ...t.individual, ...t.special];
1325
+ for (const o of i) {
1326
+ const m = o.parts.find((R) => R.id === r);
1327
+ if (m)
1328
+ return m;
1329
+ }
1330
+ return null;
1331
+ }
1332
+ class je extends Error {
1333
+ constructor(t, i, o) {
1334
+ super(o), this.code = t, this.path = i, this.name = "RenderError";
1335
+ }
1336
+ }
1337
+ function Hr(r, t, i, o, m) {
1338
+ if (i.has(t))
1339
+ throw new je("CIRCULAR_REFERENCE", t, `循環参照が検出されました: ${t}`);
1340
+ i.add(t);
1341
+ const R = r.part_id, I = o.findPart(R);
1342
+ if (!I)
1343
+ throw new je("PART_NOT_FOUND", t, `パーツが見つかりません: ${R}`);
1344
+ const C = Kt(
1345
+ I.body,
1346
+ r,
1347
+ t,
1348
+ o.findPart,
1349
+ m,
1350
+ o.enableEditorAttributes,
1351
+ o.imagesCommon,
1352
+ o.imagesIndividual,
1353
+ o.imagesSpecial,
1354
+ o.backendData,
1355
+ o.options
1356
+ );
1357
+ return o.enableEditorAttributes ? Or(
1358
+ C,
1359
+ {
1360
+ "data-zcode-id": r.id,
1361
+ "data-zcode-path": t,
1362
+ "data-zcode-part": R
1363
+ },
1364
+ I.outlinePosition === "inner" ? { addClass: "zcode-outline-inner" } : void 0
1365
+ ) : C;
1366
+ }
1367
+ const zr = ["common", "individual", "special"];
1368
+ function kr(r) {
1369
+ return r ? zr.filter((t) => r[t]?.trim()).map((t) => {
1370
+ const i = r[t].replace(/<\/style/gi, "<\\/style");
1371
+ return `<style id="zcode-css-style-${t}" data-zcode-css="true" data-zcode-css-category="${t}">${i}</style>`;
1372
+ }).join(`
1373
+ `) : "";
1374
+ }
1375
+ function $r(r, t = {}) {
1376
+ const { enableEditorAttributes: i = !1 } = t, o = r.backendData;
1377
+ if (!r)
1378
+ throw new je("PARSE_ERROR", "", "データが提供されていません");
1379
+ const m = r.parts || { common: [], individual: [], special: [] }, R = r.images || { common: [], individual: [], special: [] }, I = r.page || [];
1380
+ function C(re) {
1381
+ return Ur(re, m);
1382
+ }
1383
+ const k = {
1384
+ findPart: C,
1385
+ enableEditorAttributes: i,
1386
+ imagesCommon: R.common,
1387
+ imagesIndividual: R.individual,
1388
+ imagesSpecial: R.special,
1389
+ backendData: o
1390
+ };
1391
+ function P(re, ne, ie) {
1392
+ return Hr(
1393
+ re,
1394
+ ne,
1395
+ ie,
1396
+ k,
1397
+ (v, W) => P(v, W, ie)
1398
+ );
1399
+ }
1400
+ return I.map((re, ne) => {
1401
+ try {
1402
+ return P(re, `page.${ne}`, /* @__PURE__ */ new Set());
1403
+ } catch (ie) {
1404
+ if (ie instanceof je)
1405
+ return `<div class="zcode-error-message" data-error-code="${ie.code}">${ie.message}</div>`;
1406
+ throw ie;
1407
+ }
1408
+ }).join("");
1409
+ }
1410
+ export {
1411
+ je as RenderError,
1412
+ kr as renderCssToHtml,
1413
+ $r as renderToHtml
1414
+ };