@famibee/skynovel 1.65.0 → 2.0.0

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 (176) hide show
  1. package/README.md +3 -3
  2. package/dist/Button.js +131 -163
  3. package/dist/Button.js.map +1 -1
  4. package/dist/CallStack.js +19 -22
  5. package/dist/CallStack.js.map +1 -1
  6. package/dist/CmnInterface.js +91 -0
  7. package/dist/CmnInterface.js.map +1 -0
  8. package/dist/CmnLib.js +94 -0
  9. package/dist/CmnLib.js.map +1 -0
  10. package/dist/Config.js +26 -0
  11. package/dist/Config.js.map +1 -0
  12. package/dist/ConfigBase.js +152 -0
  13. package/dist/ConfigBase.js.map +1 -0
  14. package/dist/DebugMng.js +89 -102
  15. package/dist/DebugMng.js.map +1 -1
  16. package/dist/EventListenerCtn.js +21 -0
  17. package/dist/EventListenerCtn.js.map +1 -0
  18. package/dist/EventMng.js +1435 -1577
  19. package/dist/EventMng.js.map +1 -1
  20. package/dist/Grammar.js +194 -0
  21. package/dist/Grammar.js.map +1 -0
  22. package/dist/GrpLayer.js +163 -195
  23. package/dist/GrpLayer.js.map +1 -1
  24. package/dist/Layer.js +260 -0
  25. package/dist/Layer.js.map +1 -0
  26. package/dist/LayerMng.js +810 -991
  27. package/dist/LayerMng.js.map +1 -1
  28. package/dist/Main.js +144 -393
  29. package/dist/Main.js.map +1 -1
  30. package/dist/PropParser.js +936 -834
  31. package/dist/PropParser.js.map +1 -1
  32. package/dist/Reading.js +918 -786
  33. package/dist/Reading.js.map +1 -1
  34. package/dist/RubySpliter.js +59 -92
  35. package/dist/RubySpliter.js.map +1 -1
  36. package/dist/ScriptIterator.js +805 -1034
  37. package/dist/ScriptIterator.js.map +1 -1
  38. package/dist/SndBuf.js +1097 -1332
  39. package/dist/SndBuf.js.map +1 -1
  40. package/dist/SoundMng.js +124 -135
  41. package/dist/SoundMng.js.map +1 -1
  42. package/dist/SpritesMng.js +220 -232
  43. package/dist/SpritesMng.js.map +1 -1
  44. package/dist/SysBase.js +1729 -0
  45. package/dist/SysBase.js.map +1 -0
  46. package/dist/TxtLayer.js +1212 -1397
  47. package/dist/TxtLayer.js.map +1 -1
  48. package/dist/Variable.js +398 -466
  49. package/dist/Variable.js.map +1 -1
  50. package/dist/chunk.js +18 -0
  51. package/dist/gamepad.js +723 -511
  52. package/dist/gamepad.js.map +1 -1
  53. package/dist/pixi.js +13422 -0
  54. package/dist/pixi.js.map +1 -0
  55. package/dist/platform.js +424 -369
  56. package/dist/platform.js.map +1 -1
  57. package/dist/sn/AnalyzeTagArg.d.ts +1 -1
  58. package/dist/sn/AnalyzeTagArg.d.ts.map +1 -1
  59. package/dist/sn/CmnInterface.d.ts +3 -1
  60. package/dist/sn/CmnInterface.d.ts.map +1 -1
  61. package/dist/sn/CmnLib.d.ts.map +1 -1
  62. package/dist/sn/CmnTween.d.ts +3 -3
  63. package/dist/sn/CmnTween.d.ts.map +1 -1
  64. package/dist/sn/EventMng.d.ts.map +1 -1
  65. package/dist/sn/Grammar.d.ts +1 -1
  66. package/dist/sn/Grammar.d.ts.map +1 -1
  67. package/dist/sn/PropParser.d.ts +2 -2
  68. package/dist/sn/PropParser.d.ts.map +1 -1
  69. package/dist/sn/Reading.d.ts +6 -0
  70. package/dist/sn/Reading.d.ts.map +1 -1
  71. package/dist/sn/ScriptIterator.d.ts.map +1 -1
  72. package/dist/sn/SndBuf.d.ts +27 -16
  73. package/dist/sn/SndBuf.d.ts.map +1 -1
  74. package/dist/sn/SoundMng.d.ts +4 -1
  75. package/dist/sn/SoundMng.d.ts.map +1 -1
  76. package/dist/sn/SysBase.d.ts.map +1 -1
  77. package/dist/sn/TxtStage.d.ts +2 -1
  78. package/dist/sn/TxtStage.d.ts.map +1 -1
  79. package/dist/test/ValTest.d.ts +1 -1
  80. package/dist/test/ValTest.d.ts.map +1 -1
  81. package/dist/web.js +653 -8
  82. package/dist/web.js.map +1 -1
  83. package/dist_app/Button.js +131 -163
  84. package/dist_app/Button.js.map +1 -1
  85. package/dist_app/CallStack.js +19 -22
  86. package/dist_app/CallStack.js.map +1 -1
  87. package/dist_app/CmnInterface.js +91 -0
  88. package/dist_app/CmnInterface.js.map +1 -0
  89. package/dist_app/CmnLib.js +94 -0
  90. package/dist_app/CmnLib.js.map +1 -0
  91. package/dist_app/Config.js +26 -0
  92. package/dist_app/Config.js.map +1 -0
  93. package/dist_app/ConfigBase.js +152 -0
  94. package/dist_app/ConfigBase.js.map +1 -0
  95. package/dist_app/DebugMng.js +92 -0
  96. package/dist_app/DebugMng.js.map +1 -0
  97. package/dist_app/EventListenerCtn.js +21 -0
  98. package/dist_app/EventListenerCtn.js.map +1 -0
  99. package/dist_app/EventMng.js +1435 -1577
  100. package/dist_app/EventMng.js.map +1 -1
  101. package/dist_app/Grammar.js +194 -0
  102. package/dist_app/Grammar.js.map +1 -0
  103. package/dist_app/GrpLayer.js +163 -195
  104. package/dist_app/GrpLayer.js.map +1 -1
  105. package/dist_app/Layer.js +260 -0
  106. package/dist_app/Layer.js.map +1 -0
  107. package/dist_app/LayerMng.js +810 -991
  108. package/dist_app/LayerMng.js.map +1 -1
  109. package/dist_app/Main.js +144 -392
  110. package/dist_app/Main.js.map +1 -1
  111. package/dist_app/PropParser.js +936 -834
  112. package/dist_app/PropParser.js.map +1 -1
  113. package/dist_app/Reading.js +918 -786
  114. package/dist_app/Reading.js.map +1 -1
  115. package/dist_app/RubySpliter.js +59 -92
  116. package/dist_app/RubySpliter.js.map +1 -1
  117. package/dist_app/ScriptIterator.js +805 -1033
  118. package/dist_app/ScriptIterator.js.map +1 -1
  119. package/dist_app/SndBuf.js +1097 -1332
  120. package/dist_app/SndBuf.js.map +1 -1
  121. package/dist_app/SoundMng.js +124 -135
  122. package/dist_app/SoundMng.js.map +1 -1
  123. package/dist_app/SpritesMng.js +220 -231
  124. package/dist_app/SpritesMng.js.map +1 -1
  125. package/dist_app/SysBase.js +1729 -0
  126. package/dist_app/SysBase.js.map +1 -0
  127. package/dist_app/TxtLayer.js +1212 -1396
  128. package/dist_app/TxtLayer.js.map +1 -1
  129. package/dist_app/Variable.js +398 -466
  130. package/dist_app/Variable.js.map +1 -1
  131. package/dist_app/app.js +211 -8
  132. package/dist_app/app.js.map +1 -1
  133. package/dist_app/appMain.js +20 -21
  134. package/dist_app/appMain.js.map +1 -1
  135. package/dist_app/chunk.js +18 -0
  136. package/dist_app/gamepad.js +723 -511
  137. package/dist_app/gamepad.js.map +1 -1
  138. package/dist_app/pixi.js +11181 -0
  139. package/dist_app/pixi.js.map +1 -0
  140. package/dist_app/platform.js +424 -369
  141. package/dist_app/platform.js.map +1 -1
  142. package/dist_app/preload.js +2 -2
  143. package/dist_app/preload.js.map +1 -1
  144. package/dist_app/sn/AnalyzeTagArg.d.ts +1 -1
  145. package/dist_app/sn/AnalyzeTagArg.d.ts.map +1 -1
  146. package/dist_app/sn/CmnInterface.d.ts +3 -1
  147. package/dist_app/sn/CmnInterface.d.ts.map +1 -1
  148. package/dist_app/sn/CmnLib.d.ts.map +1 -1
  149. package/dist_app/sn/CmnTween.d.ts +3 -3
  150. package/dist_app/sn/CmnTween.d.ts.map +1 -1
  151. package/dist_app/sn/EventMng.d.ts.map +1 -1
  152. package/dist_app/sn/Grammar.d.ts +1 -1
  153. package/dist_app/sn/Grammar.d.ts.map +1 -1
  154. package/dist_app/sn/PropParser.d.ts +2 -2
  155. package/dist_app/sn/PropParser.d.ts.map +1 -1
  156. package/dist_app/sn/Reading.d.ts +6 -0
  157. package/dist_app/sn/Reading.d.ts.map +1 -1
  158. package/dist_app/sn/ScriptIterator.d.ts.map +1 -1
  159. package/dist_app/sn/SndBuf.d.ts +27 -16
  160. package/dist_app/sn/SndBuf.d.ts.map +1 -1
  161. package/dist_app/sn/SoundMng.d.ts +4 -1
  162. package/dist_app/sn/SoundMng.d.ts.map +1 -1
  163. package/dist_app/sn/SysBase.d.ts.map +1 -1
  164. package/dist_app/sn/TxtStage.d.ts +2 -1
  165. package/dist_app/sn/TxtStage.d.ts.map +1 -1
  166. package/dist_app/test/ValTest.d.ts +1 -1
  167. package/dist_app/test/ValTest.d.ts.map +1 -1
  168. package/package.json +23 -13
  169. package/dist/CmnTween.js +0 -1005
  170. package/dist/CmnTween.js.map +0 -1
  171. package/dist/web2.js +0 -21644
  172. package/dist/web2.js.map +0 -1
  173. package/dist_app/CmnTween.js +0 -1005
  174. package/dist_app/CmnTween.js.map +0 -1
  175. package/dist_app/app2.js +0 -18547
  176. package/dist_app/app2.js.map +0 -1
package/dist/LayerMng.js CHANGED
@@ -1,993 +1,812 @@
1
- import { e as g, S as H, L as F, n as B, l as k, a as _, p as M, G, q as U, E as A, f as tt, r as et, t as st, v as W, w as it, x as q, y as at, F as nt, u as O, z as J } from "./web2.js";
2
- import { a as C, C as w, b as R } from "./CmnTween.js";
3
- import { G as X, D as Y } from "./GrpLayer.js";
4
- import { S as E } from "./SpritesMng.js";
5
- import { T as N, a as rt } from "./TxtLayer.js";
6
- import { R as ot } from "./RubySpliter.js";
7
- import { P as ct, b as K } from "./Main.js";
8
- import { Button as Q } from "./Button.js";
9
- class I {
10
- constructor(t, e, s, i, n, o, r, c) {
11
- this.cls = e, this.hArg = n, this.sys = o, this.val = r, this.ret = c;
12
- const h = o.hFactoryCls[e];
13
- if (!h) throw `属性 class【${e}】が不正です`;
14
- const f = h(), l = h();
15
- f.layname = l.layname = t;
16
- const d = n[":id_tag"] = `layer:${t} cls:${e} page:`;
17
- f.ctn.name = f.name = d + "A", l.ctn.name = l.name = d + "B", s.addChild(f.ctn), i.addChild(l.ctn), g(n, "visible", !0), g(n, "visible", !0), c.isWait = f.lay(n) || l.lay(n), this.#e = { fore: f, back: l }, i.visible = !1;
18
- const u = `const.sn.lay.${t}`;
19
- r.setVal_Nochk("tmp", u, !0), r.defTmp(u + ".fore.alpha", () => this.#e.fore.alpha), r.defTmp(u + ".back.alpha", () => this.#e.back.alpha), r.defTmp(u + ".fore.height", () => this.#e.fore.height), r.defTmp(u + ".back.height", () => this.#e.back.height), r.defTmp(u + ".fore.visible", () => this.#e.fore.ctn.visible), r.defTmp(u + ".back.visible", () => this.#e.back.ctn.visible), r.defTmp(u + ".fore.width", () => this.#e.fore.width), r.defTmp(u + ".back.width", () => this.#e.back.width), r.defTmp(u + ".fore.x", () => this.#e.fore.x), r.defTmp(u + ".back.x", () => this.#e.back.x), r.defTmp(u + ".fore.y", () => this.#e.fore.y), r.defTmp(u + ".back.y", () => this.#e.back.y);
20
- }
21
- #e;
22
- destroy() {
23
- this.#e.fore.destroy(), this.#e.back.destroy();
24
- }
25
- lay = (t) => this.getPage(t).lay(t);
26
- getPage = (t) => I.argChk_page(t, "fore") !== "back" ? this.#e.fore : this.#e.back;
27
- static argChk_page(t, e) {
28
- const s = t.page ?? e;
29
- if (s === "fore" || s === "back")
30
- return t.page = s, s;
31
- throw Error("属性 page【" + s + "】が不正です");
32
- }
33
- get fore() {
34
- return this.#e.fore;
35
- }
36
- get back() {
37
- return this.#e.back;
38
- }
39
- transPage(t) {
40
- [this.#e.back, this.#e.fore] = [this.#e.fore, this.#e.back], this.#e.back.copy(this.#e.fore, t);
41
- }
42
- }
43
- class p {
44
- constructor(t, e, s) {
45
- this.appPixi = e, this.val = s, t.add_frame = (i) => this.#x(i), t.let_frame = (i) => this.#d(i), t.set_frame = (i) => this.#N(i), t.frame = (i) => this.#$(i), t.tsy_frame = (i) => this.#w(i);
46
- }
47
- static #e;
48
- static #t;
49
- static #i;
50
- static init(t, e, s) {
51
- p.#e = t, p.#t = e, p.#i = s;
52
- }
53
- #o;
54
- setEvtMng(t) {
55
- this.#o = t;
56
- }
57
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
58
- #c = /* @__PURE__ */ Object.create(null);
59
- destroy() {
60
- for (const t of Object.values(this.#c)) t.parentElement.removeChild(t);
61
- this.#c = /* @__PURE__ */ Object.create(null);
62
- }
63
- hideAllFrame() {
64
- for (const [t, { style: e }] of Object.entries(this.#c))
65
- this.#l[t] = e.display !== "none", e.display = "none";
66
- }
67
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
68
- #l = /* @__PURE__ */ Object.create(null);
69
- restoreAllFrame() {
70
- for (const [t, e] of Object.entries(this.#l)) {
71
- const s = this.#c[t];
72
- s && (s.style.display = e ? "inline" : "none");
73
- }
74
- this.#l = /* @__PURE__ */ Object.create(null);
75
- }
76
- // HTMLフレーム
77
- // フレーム追加
78
- #x(t) {
79
- const { id: e, src: s, alpha: i = 1, scale_x: n = 1, scale_y: o = 1, rotate: r = 0 } = t;
80
- if (!e) throw "idは必須です";
81
- if (!s) throw "srcは必須です";
82
- const c = "const.sn.frm." + e;
83
- if (this.val.getVal(`tmp:${c}`)) throw `frame【${e}】はすでにあります`;
84
- const h = g(t, "visible", !0), f = t.b_color ? ` background-color: ${t.b_color};` : "", l = this.#b(t);
85
- p.#i.cvs.insertAdjacentHTML("beforebegin", `<iframe id="${e}" style="opacity: ${String(i)}; ${f} position: absolute; left:${String(p.#t.ofsLeft4elm + l.x * p.#t.cvsScale)}px; top: ${String(p.#t.ofsTop4elm + l.y * p.#t.cvsScale)}px; z-index: 1; border: 0px; overflow: hidden; display: ${h ? "inline" : "none"}; transform: scale(${String(n)}, ${String(o)}) rotate(${String(r)}deg);" width="${String(l.width * p.#t.cvsScale)}" height="${String(l.height * p.#t.cvsScale)}"></iframe>`);
86
- const d = C.procID + `add_frame id:${e}`;
87
- C.beginProc(d);
88
- const u = p.#e.searchPath(s, H.HTML), a = new F().add({ name: s, url: u, xhrType: B.XHR_RESPONSE_TYPE.TEXT });
89
- return p.#t.arg.crypto && a.use(
90
- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
91
- (b, x) => void p.#t.dec(b.extension, b.data).then((v) => {
92
- b.data = v, x();
93
- }).catch((v) => {
94
- p.#i.errScript(`[add_frame]Html ロード失敗です src:${b.name} ${String(v)}`, !1), x();
95
- })
96
- ), a.load((b, x) => {
97
- const v = document.getElementById(e);
98
- this.#c[e] = v, this.#y[e] = !1;
99
- const S = u.lastIndexOf("/") + 1, V = u.slice(0, S), m = V.slice(0, S);
100
- v.srcdoc = String(x[s]?.data).replace("sn_repRes();", "").replaceAll(
101
- /\s(?:src|href)=(["'])(\S+?)\1/g,
102
- // 【\s】が大事、data-src弾く
103
- (y, $, T) => T.startsWith("../") ? m + y.slice(3) : y.replace("./", "").replace($, $ + V)
104
- ), v.srcdoc.includes("true/*WEBP*/;") && (v.srcdoc = v.srcdoc.replaceAll(
105
- /data-src="(.+?\.)(?:jpe?g|png)/g,
106
- (y, $) => `data-src="${$}webp`
107
- )), v.onload = () => {
108
- C.endProc(d), this.val.setVal_Nochk("tmp", c, !0), this.val.setVal_Nochk("tmp", c + ".alpha", i), this.val.setVal_Nochk("tmp", c + ".x", l.x), this.val.setVal_Nochk("tmp", c + ".y", l.y), this.val.setVal_Nochk("tmp", c + ".scale_x", n), this.val.setVal_Nochk("tmp", c + ".scale_y", o), this.val.setVal_Nochk("tmp", c + ".rotate", r), this.val.setVal_Nochk("tmp", c + ".width", l.width), this.val.setVal_Nochk("tmp", c + ".height", l.height), this.val.setVal_Nochk("tmp", c + ".visible", h);
109
- const y = v.contentWindow;
110
- this.#o.resvFlameEvent(y.document.body), y.sn_repRes?.(($) => p.#_($.dataset.src ?? "", $));
111
- };
112
- }), !0;
113
- }
114
- #y = {};
115
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
116
- getFrmDisabled(t) {
117
- return this.#y[t];
118
- }
119
- #b(t) {
120
- const e = { ...t };
121
- return new DOMRect(
122
- k(e, "x", 0),
123
- k(e, "y", 0),
124
- k(e, "width", _.stageW),
125
- k(e, "height", _.stageH)
126
- );
127
- }
128
- static #_(t, e, s) {
129
- const i = this.#f[t];
130
- if (i) {
131
- e.src = i, s && (e.onload = () => s(e));
132
- return;
133
- }
134
- const n = this.#m[t];
135
- if (n) {
136
- n.push(e);
137
- return;
138
- }
139
- this.#m[t] = [e];
140
- const [o = "", r = ""] = t.split("?"), c = p.#e.searchPath(o, H.SP_GSM), h = new F().add({ name: t, url: c, xhrType: B.XHR_RESPONSE_TYPE.BUFFER });
141
- p.#t.use4ViteElectron(t, c, h, p.#i) || p.#t.arg.crypto && c.endsWith(".bin") && h.use((f, l) => {
142
- if (f.extension !== "bin") {
143
- l();
144
- return;
145
- }
146
- p.#t.decAB(f.data).then((d) => {
147
- f.data = d, d instanceof HTMLImageElement && (f.type = B.TYPE.IMAGE), l();
148
- }).catch((d) => {
149
- p.#i.errScript(`FrameMng loadPic ロード失敗です fn:${f.name} ${String(d)}`, !1), l();
150
- });
151
- }), h.load((f, l) => {
152
- for (const [d, { data: { src: u } }] of Object.entries(l)) {
153
- const a = this.#f[d] = u + // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access
154
- (u.startsWith("blob:") || u.startsWith("data:") ? "" : r ? "?" + r : ""), b = this.#m[d];
155
- if (b) for (const x of b)
156
- x.src = a, s && (x.onload = () => s(x));
157
- delete this.#m[d];
158
- }
159
- });
160
- }
161
- static #m = {};
162
- static #f = {};
163
- cvsResize() {
164
- for (const [t, e] of Object.entries(this.#c)) {
165
- const s = "const.sn.frm." + t, i = Number(this.val.getVal(s + ".x")), n = Number(this.val.getVal(s + ".y")), o = Number(this.val.getVal(s + ".width")), r = Number(this.val.getVal(s + ".height"));
166
- e.style.left = `${String(
167
- p.#t.ofsLeft4elm + i * p.#t.cvsScale
168
- )}px`, e.style.top = `${String(
169
- p.#t.ofsTop4elm + n * p.#t.cvsScale
170
- )}px`, e.width = String(o * p.#t.cvsScale), e.height = String(r * p.#t.cvsScale);
171
- }
172
- }
173
- // フレーム変数を取得
174
- #d(t) {
175
- const { id: e, var_name: s } = t;
176
- if (!e) throw "idは必須です";
177
- const i = document.getElementById(e);
178
- if (!i) throw `id【${e}】はフレームではありません`;
179
- const n = "const.sn.frm." + e;
180
- if (!this.val.getVal(`tmp:${n}`)) throw `frame【${e}】が読み込まれていません`;
181
- if (!s) throw "var_nameは必須です";
182
- const o = i.contentWindow;
183
- if (!Object.hasOwn(o, s)) throw `frame【${e}】に変数/関数【${s}】がありません。変数は var付きにして下さい`;
184
- const r = o[s];
185
- return this.val.setVal_Nochk(
186
- "tmp",
187
- n + "." + s,
188
- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call
189
- g(t, "function", !1) ? r() : r
190
- ), !1;
191
- }
192
- // フレーム変数に設定
193
- #N(t) {
194
- const { id: e, var_name: s, text: i } = t;
195
- if (!e) throw "idは必須です";
196
- const n = document.getElementById(e);
197
- if (!n) throw `id【${e}】はフレームではありません`;
198
- const o = "const.sn.frm." + e;
199
- if (!this.val.getVal(`tmp:${o}`)) throw `frame【${e}】が読み込まれていません`;
200
- if (!s) throw "var_nameは必須です";
201
- if (!i) throw "textは必須です";
202
- this.val.setVal_Nochk("tmp", o + "." + s, i);
203
- const r = n.contentWindow;
204
- return r[s] = i, !1;
205
- }
206
- // フレームに設定
207
- #n = 1;
208
- #$(t) {
209
- const { id: e } = t;
210
- if (!e) throw "idは必須です";
211
- const s = document.getElementById(e);
212
- if (!s) throw `id【${e}】はフレームではありません`;
213
- const i = "const.sn.frm." + e;
214
- if (!this.val.getVal("tmp:" + i)) throw `frame【${e}】が読み込まれていません`;
215
- const n = s.style;
216
- if (g(t, "float", !1) ? n.zIndex = String(++this.#n) : "index" in t ? n.zIndex = String(k(t, "index", 0)) : t.dive && (n.zIndex = String(-++this.#n)), "alpha" in t) {
217
- const r = n.opacity = String(t.alpha);
218
- this.val.setVal_Nochk("tmp", i + ".alpha", r);
219
- }
220
- const o = this.#b(t);
221
- if (("x" in t || "y" in t) && (n.left = `${String(
222
- p.#t.ofsLeft4elm + o.x * p.#t.cvsScale
223
- )}px`, n.top = `${String(
224
- p.#t.ofsTop4elm + o.y * p.#t.cvsScale
225
- )}px`, this.val.setVal_Nochk("tmp", i + ".x", o.x), this.val.setVal_Nochk("tmp", i + ".y", o.y)), "scale_x" in t || "scale_y" in t || "rotate" in t) {
226
- const r = k(t, "scale_x", 1), c = k(t, "scale_y", 1), h = k(t, "rotate", 0);
227
- n.transform = `scale(${String(r)}, ${String(c)}) rotate(${String(h)}deg)`, this.val.setVal_Nochk("tmp", i + ".scale_x", r), this.val.setVal_Nochk("tmp", i + ".scale_y", c), this.val.setVal_Nochk("tmp", i + ".rotate", h);
228
- }
229
- if ("width" in t && (s.width = String(o.width * p.#t.cvsScale), this.val.setVal_Nochk("tmp", i + ".width", o.width)), "height" in t && (s.height = String(o.height * p.#t.cvsScale), this.val.setVal_Nochk("tmp", i + ".height", o.height)), "visible" in t) {
230
- const r = g(t, "visible", !0);
231
- n.display = r ? "inline" : "none", this.val.setVal_Nochk("tmp", i + ".visible", r);
232
- }
233
- if ("b_color" in t && (n.backgroundColor = t.b_color), "disabled" in t) {
234
- const r = this.#y[e] = g(t, "disabled", !0), c = s.contentDocument.body;
235
- for (const h of [
236
- ...Array.from(c.getElementsByTagName("input")),
237
- ...Array.from(c.getElementsByTagName("select"))
238
- ]) h.disabled = r;
239
- }
240
- return !1;
241
- }
242
- // フレームをトゥイーン開始
243
- #w(t) {
244
- const { id: e, alpha: s, x: i, y: n, scale_x: o, scale_y: r, rotate: c, width: h, height: f } = t;
245
- if (!e) throw "idは必須です";
246
- const l = document.getElementById(e);
247
- if (!l) throw `id【${e}】はフレームではありません`;
248
- const d = "const.sn.frm." + e;
249
- if (!this.val.getVal(`tmp:${d}`, 0)) throw `frame【${e}】が読み込まれていません`;
250
- const u = {};
251
- s && (u.a = Number(l.style.opacity)), (i || n || o || r || c) && (u.x = Number(this.val.getVal(`tmp:${d}.x`)), u.y = Number(this.val.getVal(`tmp:${d}.y`)), u.sx = Number(this.val.getVal(`tmp:${d}.scale_x`)), u.sy = Number(this.val.getVal(`tmp:${d}.scale_y`)), u.r = Number(this.val.getVal(`tmp:${d}.rotate`))), h && (u.w = Number(this.val.getVal(`tmp:${d}.width`))), f && (u.h = Number(this.val.getVal(`tmp:${d}.height`)));
252
- const a = w.cnvTweenArg(t, u);
253
- let b = (m) => {
254
- };
255
- s && (k(a, "alpha", 0), b = (m) => {
256
- l.style.opacity = String(m.a), this.val.setVal_Nochk("tmp", "alpha", m.a);
257
- });
258
- let x = (m) => {
259
- };
260
- const v = this.#b(a);
261
- (i || n || o || r || c) && (v.x, v.y, k(a, "scale_x", 1), k(a, "scale_y", 1), k(a, "rotate", 0), x = (m) => {
262
- l.style.left = `${String(
263
- p.#t.ofsLeft4elm + m.x * p.#t.cvsScale
264
- )} px`, l.style.top = `${String(
265
- p.#t.ofsTop4elm + m.y * p.#t.cvsScale
266
- )} px`, l.style.transform = `scale(${String(m.sx)}, ${String(m.sy)}) rotate(${String(m.r)}deg)`, this.val.setVal_Nochk("tmp", d + ".x", m.x), this.val.setVal_Nochk("tmp", d + ".y", m.y), this.val.setVal_Nochk("tmp", d + ".scale_x", m.sx), this.val.setVal_Nochk("tmp", d + ".scale_y", m.sy), this.val.setVal_Nochk("tmp", d + ".rotate", m.r);
267
- });
268
- let S = (m) => {
269
- };
270
- h && (v.width, S = (m) => {
271
- l.width = `${String(m.w * p.#t.cvsScale)} px`, this.val.setVal_Nochk("tmp", d + ".width", m.w);
272
- });
273
- let V = (m) => {
274
- };
275
- return f && (v.height, V = (m) => {
276
- l.height = `${String(m.h * p.#t.cvsScale)} px`, this.val.setVal_Nochk("tmp", d + ".height", m.h);
277
- }), this.appPixi.stage.interactive = !1, w.tween(`frm
278
- ${e}`, t, u, w.cnvTweenArg(t, u), (m) => {
279
- b(m), x(m), S(m), V(m);
280
- }, () => {
281
- this.appPixi.stage.interactive = !0;
282
- }, () => {
283
- }), !1;
284
- }
285
- }
286
- class lt {
287
- // 🍚
288
- constructor(t, e, s) {
289
- this.oCfg = t, this.hTag = e, this.val = s, e.rec_ch = (i) => this.#i(i), e.rec_r = (i) => this.#o(i), e.reset_rec = (i) => this.#c(i), s.defTmp("const.sn.log.json", () => {
290
- this.#e.text = // 🌾
291
- this.#e.text.replaceAll("</span><span class='sn_ch'>", "");
292
- const i = [...this.#t, this.#e];
293
- return JSON.stringify(i);
294
- }), this.recText("");
295
- }
296
- #e = { text: "" };
297
- // 🌾
298
- #t = [];
299
- // [ch] からコールされる
300
- // [ch] // 文字を追加する
301
- // recText(text: string) コール
302
- // 🌾this.#LastLog = {text}; // 置換でよい
303
- // 🍊save:const.sn.sLog = 🦀const.sn.log.json // これを起動したい
304
- recText(t) {
305
- this.#e.text = t, this.val.setVal_Nochk(
306
- "save",
307
- "const.sn.sLog",
308
- // 🍊 リプレイ時の回復用
309
- String(this.val.getVal("const.sn.log.json"))
310
- // これを起動したい
311
- );
312
- }
313
- //MARK: 履歴書き込み
314
- // 🌾this.#LastLog = {...hArg, text: 🌾this.#LastLog.text};
315
- #i(t) {
316
- return this.#e = { ...t, text: this.#e.text }, t.text ? (t.record = !0, t.style ??= "", t.style += "display: none;", t.wait = 0, this.hTag.ch(t)) : (this.val.setVal_Nochk(
317
- "save",
318
- "const.sn.sLog",
319
- // 🍊 リプレイ時の回復用
320
- String(this.val.getVal("const.sn.log.json"))
321
- // これを起動したい
322
- ), !1);
323
- }
324
- //MARK: 履歴改行
325
- #o(t) {
326
- return this.#i({ ...t, text: "[r]" });
327
- }
328
- //MARK: 履歴リセット
329
- // 以下をクリア。text で置き換え値を設定できる
330
- // 🌾this.#LastLog = {text: hArg.text ?? ''};
331
- // 🍚this.#aLog = []
332
- // 🍊save:const.sn.sLog= hArg.text ?[{text:"${hArg.text}"}] : []
333
- #c(t) {
334
- return this.#t = [], t.text ??= "", this.#e = { text: t.text }, this.val.setVal_Nochk("save", "const.sn.sLog", JSON.stringify([this.#e])), !1;
335
- }
336
- //MARK: 履歴改ページ
337
- pagebreak() {
338
- this.#e.text = // 🌾
339
- this.#e.text.replaceAll("</span><span class='sn_ch'>", ""), this.#e.text && (this.#t.push(this.#e) > this.oCfg.log.max_len && (this.#t = this.#t.slice(-this.oCfg.log.max_len)), this.#e = { text: "" });
340
- }
341
- //MARK: 履歴回復
342
- // save:const.sn.sLog からの復帰
343
- playback() {
344
- this.#t = JSON.parse(String(this.val.getVal("save:const.sn.sLog"))), this.#e = { text: "" };
345
- }
346
- }
347
- function L(j) {
348
- return encodeURIComponent(JSON.stringify(j));
349
- }
350
- class Z {
351
- //MARK: コンストラクタ
352
- constructor(t, e, s, i, n, o, r, c, h) {
353
- this.cfg = t, this.hTag = e, this.appPixi = s, this.val = i, this.main = n, this.scrItr = o, this.sys = r;
354
- const f = () => {
355
- if (r.cvsResize(), this.cvsResizeDesign(), this.#_) for (const a of this.#r)
356
- this.#s[a].fore.cvsResizeChildren();
357
- else for (const a of this.#r)
358
- this.#s[a].fore.cvsResize();
359
- this.#o.cvsResize(), this.#d.cvsResize();
360
- };
361
- if (_.isMobile)
362
- this.#x.add(globalThis, "orientationchange", f, { passive: !0 });
363
- else {
364
- let a;
365
- this.#x.add(globalThis, "resize", () => {
366
- a || (a = setTimeout(() => {
367
- a = void 0, f();
368
- }, 1e3 / 60 * 10));
369
- }, { passive: !0 });
370
- }
371
- r.cvsResize(), this.#l = new lt(this.cfg.oCfg, e, i), N.init(t, e, i, this.#l, (a) => this.#s[a.layname].fore === a, s), X.init(n, t, s, r, c, i), p.init(t, r, n), this.#o = new p(e, s, i), e.loadplugin = (a) => this.#O(a), e.snapshot = (a) => this.#$(a), this.#w = this.sys.isApp ? (a, b, x, v, S) => this.#B(a, b, x, v, S) : (a, b, x, v, S) => this.#W(a, b, x, v, S), e.add_lay = (a) => this.#j(a), e.clear_lay = (a) => this.#H(a), e.finish_trans = () => !1, e.lay = (a) => this.#z(a), e.trans = (a) => this.#G(a), e.wt = (a) => w.wt(a), e.quake = (a) => this.#q(a), e.stop_quake = e.finish_trans, e.wq = e.wt, e.pause_tsy = (a) => w.pause_tsy(a), e.resume_tsy = (a) => w.resume_tsy(a), e.stop_tsy = (a) => w.stop_tsy(a), e.tsy = (a) => this.#J(a), e.wait_tsy = (a) => w.wait_tsy(a), e.add_filter = (a) => this.#X(a), e.clear_filter = (a) => this.#Y(a), e.enable_filter = (a) => this.#K(a), e.ch = (a) => this.#I(a), e.clear_text = (a) => this.#M(a), e.current = (a) => this.#D(a), e.endlink = (a) => this.#A(a), e.er = (a) => this.#tt(a), e.graph = (a) => this.#et(a), e.link = (a) => this.#st(a), e.r = (a) => this.#it(a), e.ruby2 = (a) => this.#at(a), e.span = (a) => this.#nt(a), e.tcy = (a) => this.#rt(a), e.add_face = (a) => E.add_face(a), e.wv = (a) => E.wv(a), e.dump_lay = (a) => this.#ot(a), e.enable_event = (a) => this.#ct(a), e.button = (a) => this.#lt(a), t.existsBreakline && (this.breakLine = (a) => {
372
- delete a.visible, a.id = "break", a.pic = "breakline", this.#n("grp|" + L(a));
373
- }), t.existsBreakpage && (this.breakPage = (a) => {
374
- delete a.visible, a.id = "break", a.pic = "breakpage", this.#n("grp|" + L(a));
375
- }), this.#c = M(String(t.oCfg.init.bg_color));
376
- const l = new G();
377
- l.beginFill(this.#c).lineStyle(0, this.#c).drawRect(0, 0, _.stageW, _.stageH).endFill(), this.#t.addChild(l.clone()), this.#i.addChild(l), this.#i.visible = !1, this.#t.name = "page:A", this.#i.name = "page:B", this.#e = s.stage, this.#e.addChild(this.#i), this.#e.addChild(this.#t), this.#e.addChild(this.#T), this.#e.addChild(this.#a), this.#e.name = "stage";
378
- const d = (a, b) => {
379
- this.#N(Number(b));
380
- };
381
- d("", i.getVal("sys:TextLayer.Back.Alpha", 1)), i.defValTrg("sys:TextLayer.Back.Alpha", d);
382
- const u = (a, b) => {
383
- Q.fontFamily = b;
384
- };
385
- u("", i.getVal("tmp:sn.button.fontFamily", Q.fontFamily)), i.defValTrg("tmp:sn.button.fontFamily", u), i.defTmp("const.sn.last_page_text", () => this.currentTxtlayFore?.pageText ?? ""), i.defTmp("const.sn.last_page_plain_text", () => this.currentTxtlayFore?.pagePlainText ?? ""), _.isDbg && (Y.init(s, r, o, h, t, this.#s), this.cvsResizeDesign = () => Y.cvsResizeDesign(), r.addHook((a, b) => {
386
- this.#y[a]?.(a, b) && delete this.#y[a];
387
- }));
388
- }
389
- #e;
390
- #t = new U();
391
- #i = new U();
392
- #o;
393
- #c;
394
- #l;
395
- #x = new A();
396
- cvsResizeDesign() {
397
- }
398
- #y = {
399
- attach: (t) => !1,
400
- continue: (t) => !1,
401
- disconnect: (t) => !1,
402
- _enterDesign: (t) => {
403
- for (const e of this.#r) {
404
- const s = this.#s[e].fore;
405
- s.makeDesignCastChildren((i) => i.make()), s.makeDesignCast((i) => i.make());
406
- }
407
- return this.#m(this.#v), !1;
408
- },
409
- _replaceToken: (t, e) => !1,
410
- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access
411
- _selectNode: (t, e) => (this.#m(e.node), !1)
412
- };
413
- #b = "";
414
- #_ = "";
415
- #m(t) {
416
- [this.#b = "", this.#_ = ""] = t.split("/");
417
- const e = this.#s[this.#b];
418
- e && (this.#_ ? e.fore.showDesignCastChildren() : e.fore.showDesignCast());
419
- }
420
- getFrmDisabled = (t) => this.#o.getFrmDisabled(t);
421
- #f = void 0;
422
- cover(t, e = 0) {
423
- this.#f && (this.#e.removeChild(this.#f), this.#f.destroy(), this.#f = void 0), t && this.#e.addChild(
424
- (this.#f = new G()).beginFill(e).lineStyle(0, e).drawRect(0, 0, _.stageW, _.stageH).endFill()
425
- );
426
- }
427
- #d;
428
- setEvtMng(t) {
429
- this.#d = t, this.#o.setEvtMng(t), E.setEvtMng(t), w.init(t);
430
- }
431
- destroy() {
432
- for (const t of Object.values(this.#s)) t.destroy();
433
- this.#x.clear(), X.destroy(), ot.destroy(), rt.destroy(), N.destroy(), this.#o.destroy(), w.destroy(), N.msecChWait = 10;
434
- }
435
- // 既存の全文字レイヤの実際のバック不透明度、を再計算
436
- #N(t) {
437
- for (const e of this.#r) {
438
- const { fore: s, back: i } = this.#s[e];
439
- s instanceof N && (s.chgBackAlpha(t), i.chgBackAlpha(t));
440
- }
441
- }
442
- #n = (t, e = this.currentTxtlayForeNeedErr, s = !0) => e.tagCh("|&emsp;《" + t + "》");
443
- goTxt = () => {
444
- };
445
- get needGoTxt() {
446
- return this.currentTxtlayFore?.needGoTxt ?? !1;
447
- }
448
- breakLine = (t) => {
449
- };
450
- breakPage = (t) => {
451
- };
452
- clearBreak() {
453
- this.currentTxtlayFore && (this.clearBreak = () => this.#n("del|break"), this.clearBreak());
454
- }
455
- clickTxtLay() {
456
- return this.currentTxtlayFore ? this.#r.map((t) => this.#s[t].fore).some((t) => t instanceof N && t.click()) : !1;
457
- }
458
- // // システム
459
- //MARK: スナップショット
460
- #$(t) {
461
- const e = tt("-", "_", "", "_"), s = t.fn ? t.fn.startsWith(ct) ? t.fn : `${K + t.fn + e}.png` : `${K}snapshot${e}.png`, i = this.cfg.searchPath(s), n = k(t, "width", _.stageW), o = k(t, "height", _.stageH);
462
- return this.#w(t, i, n, o, `snapshot dt:${e}`);
463
- }
464
- #w = () => !1;
465
- #B({ layer: t }, e, s, i, n) {
466
- if (this.#o.hideAllFrame(), C.beginProc(n), !t)
467
- return this.sys.capturePage(e, s, i, () => {
468
- this.#o.restoreAllFrame(), C.endProc(n);
469
- }), !0;
470
- const o = this.#r.map((r) => {
471
- const { ctn: c } = this.#s[r].fore, h = [c, c.visible];
472
- return c.visible = !1, h;
473
- });
474
- for (const r of this.#p(t)) this.#s[r].fore.ctn.visible = !0;
475
- return this.sys.capturePage(e, s, i, () => {
476
- for (const [r, c] of o) r.visible = c;
477
- this.#o.restoreAllFrame(), C.endProc(n);
478
- }), !0;
479
- }
480
- #W(t, e, s, i, n) {
481
- C.beginProc(n);
482
- const o = et(t, "b_color", this.#c), r = st({
483
- width: s,
484
- height: i,
485
- backgroundAlpha: o > 16777216 && e.endsWith(".png") ? 0 : 1,
486
- antialias: g(t, "smoothing", !1),
487
- preserveDrawingBuffer: !0,
488
- backgroundColor: o & 16777215,
489
- autoDensity: !0
490
- }), c = t.page !== "back" ? "fore" : "back", { layer: h } = t;
491
- return Promise.allSettled(
492
- this.#p(h).map((f) => new Promise(
493
- (l) => this.#s[f][c].snapshot(r, l)
494
- ))
495
- ).then(async () => {
496
- const f = W.create({ width: r.width, height: r.height });
497
- r.render(this.#e, { renderTexture: f }), await this.sys.savePic(
498
- e,
499
- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access
500
- r.plugins.extract.base64(f)
501
- ), f.destroy();
502
- for (const l of this.#p(h)) this.#s[l][c].snapshot_end();
503
- r.destroy(!0), C.endProc(n);
504
- }), !0;
505
- }
506
- //MARK: プラグインの読み込み
507
- #O(t) {
508
- const { fn: e } = t;
509
- if (!e) throw "fnは必須です";
510
- if (!e.endsWith(".css")) throw "サポートされない拡張子です";
511
- const s = g(t, "join", !0), i = C.procID + `loadplugin fn:${e}`;
512
- return s && C.beginProc(i), (async () => {
513
- const n = await fetch(e);
514
- if (!n.ok) throw new Error("Network response was not ok.");
515
- it(await n.text()), s && C.endProc(i);
516
- })(), s;
517
- }
518
- // // レイヤ共通
519
- //MARK: レイヤを追加する
520
- #j(t) {
521
- const { layer: e, class: s } = t;
522
- if (!e) throw "layerは必須です";
523
- if (e.includes(",")) throw "layer名に「,」は使えません";
524
- if (e in this.#s) throw `layer【${e}】はすでにあります`;
525
- if (!s) throw "clsは必須です";
526
- const i = { isWait: !1 };
527
- switch (this.#s[e] = new I(e, s, this.#t, this.#i, t, this.sys, this.val, i), this.#r.push(e), s) {
528
- case "txt":
529
- this.#v || (this.#C = () => {
530
- }, this.#h = (n) => this.#Q(n), this.#D = (n) => this.#Z(n), this.hTag.current({ layer: e }), this.goTxt = () => {
531
- this.#d.isSkipping ? N.msecChWait = 0 : this.setNormalChWait();
532
- for (const n of this.#r) {
533
- const o = this.#s[n].fore;
534
- o instanceof N && this.#n("gotxt|", o, !1);
535
- }
536
- }), this.val.setVal_Nochk("save", "const.sn.layer." + e + ".enabled", !0);
537
- break;
538
- case "grp":
539
- if (this.#E) break;
540
- this.#E = e;
541
- break;
542
- }
543
- return this.scrItr.recodeDesign(t), i.isWait;
544
- }
545
- #s = {
546
- /* empty */
547
- };
548
- // しおりLoad時再読込
549
- #r = [];
550
- // 最適化用・重なり順つき全レイヤ名
551
- #v = "";
552
- #E = "";
553
- #z(t) {
554
- const e = this.#u(t), s = this.#s[e], i = s.back.ctn, n = s.fore.ctn;
555
- if (g(t, "float", !1))
556
- this.#i.setChildIndex(i, this.#i.children.length - 1), this.#t.setChildIndex(n, this.#t.children.length - 1), this.#V();
557
- else if (t.index)
558
- k(t, "index", 0) && (this.#i.setChildIndex(i, t.index), this.#t.setChildIndex(n, t.index), this.#V());
559
- else if (t.dive) {
560
- const { dive: o } = t;
561
- let r = 0;
562
- if (e === o) throw "[lay] 属性 layerとdiveが同じ【" + o + "】です";
563
- const c = this.#s[o];
564
- if (!c) throw "[lay] 属性 dive【" + o + "】が不正です。レイヤーがありません";
565
- const h = c.back, f = c.fore, l = this.#i.getChildIndex(h.ctn), d = this.#t.getChildIndex(f.ctn);
566
- r = l < d ? l : d, r > this.#i.getChildIndex(i) && --r, this.#t.setChildIndex(n, r), this.#i.setChildIndex(i, r), this.#V();
567
- }
568
- return t[":id_tag"] = s.fore.name.slice(0, -7), this.scrItr.recodeDesign(t), s.lay(t);
569
- }
570
- #V() {
571
- this.#r = this.#U();
572
- }
573
- //MARK: レイヤ設定の消去
574
- #H(t) {
575
- return this.#S(t, (e) => {
576
- const s = this.#s[this.#u({ layer: e })];
577
- if (t.page === "both") {
578
- s.fore.clearLay(t), s.back.clearLay(t);
579
- return;
580
- }
581
- s.getPage(t).clearLay(t);
582
- }), !1;
583
- }
584
- //===================================================
585
- //MARK: WebGL フラグメントシェーダー GLSL
586
- static #F = (
587
- /* glsl */
588
- `
589
- precision mediump float;
590
-
591
- varying vec2 vTextureCoord;
592
- uniform sampler2D uSampler;
593
-
594
- uniform sampler2D rule;
595
- uniform float vague;
596
- uniform float tick;
597
-
598
- uniform vec4 inputPixel;
599
- uniform highp vec4 outputFrame;
600
- vec2 getUV(vec2 coord) {
601
- return coord * inputPixel.xy / outputFrame.zw;
602
- }
603
-
604
- void main() {
605
- vec4 fg = texture2D(uSampler, vTextureCoord);
606
- vec4 ru = texture2D(rule, getUV(vTextureCoord));
607
-
608
- float v = ru.r - tick;
609
- gl_FragColor = abs(v) < vague
610
- ? vec4(fg.rgb, 1) *fg.a *(0.5 +v /vague *0.5)
611
- : 0.0 <= v ? fg : vec4(0);
612
- }`
613
- );
614
- /*
615
- 末尾が読みづらいが、以下のif文を消して三項演算子にしている。
616
-
617
- if (abs(v) < vague) {
618
- float f_a = fg.a *(0.5 +v /vague *0.5);
619
- gl_FragColor.rgb = fg.rgb *f_a;
620
- gl_FragColor.a = f_a;
621
- return;
622
- }
623
- gl_FragColor = v >= 0.0 ? fg : vec4(0);
624
-
625
- ★GLSL : don't use "if"|Nobu note.com/nobuhirosaijo/n/n606a3f5d8e89
626
- > if文はあまり使わない方がいいらしい (処理負荷が高い)
627
- */
628
- #L = W.create({
629
- width: _.stageW,
630
- height: _.stageH
631
- });
632
- #T = new q(this.#L);
633
- #g = W.create({
634
- width: _.stageW,
635
- height: _.stageH
636
- });
637
- #a = new q(this.#g);
638
- //MARK: ページ裏表を交換
639
- #G(t) {
640
- const { layer: e } = t, s = /* @__PURE__ */ new Set(), i = this.#p(e).map((y) => (s.add(y), this.#s[y].fore)), n = () => {
641
- [this.#t, this.#i] = [this.#i, this.#t];
642
- const y = [];
643
- for (const [$, T] of Object.entries(this.#s)) {
644
- if (s.has($)) {
645
- T.transPage(y);
646
- continue;
647
- }
648
- const { fore: { ctn: P }, back: { ctn: D } } = T, z = this.#t.getChildIndex(D);
649
- this.#t.removeChild(D), this.#i.removeChild(P), this.#t.addChildAt(P, z), this.#i.addChildAt(D, z);
650
- }
651
- Promise.allSettled(y).then(() => {
652
- this.#t.visible = !0, this.#i.visible = !1, this.#T.visible = !1, this.#a.visible = !1, C.notifyEndProc(R);
653
- });
654
- };
655
- if (this.#a.filters = [], this.#a.alpha = 1, k(t, "time", 0) === 0 || this.#d.isSkipping)
656
- return n(), !1;
657
- const r = [], c = this.#r.map((y) => {
658
- const { fore: $, back: T } = this.#s[y], P = s.has(y) ? T : $;
659
- return P.ctn.visible && r.push(P.ctn), P;
660
- }), { ticker: h, renderer: f } = this.appPixi;
661
- f.render(this.#i, { renderTexture: this.#L });
662
- let l = () => {
663
- for (const y of r) f.render(
664
- y,
665
- { renderTexture: this.#L, clear: !1 }
666
- );
667
- };
668
- if (!c.some((y) => y.containMovement)) {
669
- const y = l;
670
- l = () => {
671
- l = () => {
672
- }, y();
673
- };
674
- }
675
- const d = () => f.render(this.#t, { renderTexture: this.#g });
676
- d();
677
- let u = () => {
678
- this.#t.visible = !0, d(), this.#t.visible = !1;
679
- };
680
- if (!i.some((y) => y.containMovement)) {
681
- const y = u;
682
- u = () => {
683
- u = () => {
684
- }, y();
685
- };
686
- }
687
- const a = () => {
688
- l(), this.#T.visible = !0, u(), this.#a.visible = !0;
689
- }, { glsl: b, rule: x } = t, v = () => {
690
- h.remove(a), n();
691
- };
692
- if (!b && !x)
693
- return w.tween(R, t, this.#a, { alpha: 0 }, () => {
694
- }, v, () => {
695
- }), h.add(a), !1;
696
- const S = {
697
- rule: at.EMPTY,
698
- vague: k(t, "vague", 0.04),
699
- tick: 0
700
- };
701
- this.#a.filters = [new nt(
702
- void 0,
703
- b ?? Z.#F,
704
- S
705
- )];
706
- const V = w.tween(R, t, S, { tick: 1 }, () => {
707
- }, v, () => {
708
- }, !x);
709
- return x ? new E(x, void 0, (y) => {
710
- S.rule = y.texture, y.destroy(), V.start(), h.add(a);
711
- }, (y) => {
712
- y && this.main.resume();
713
- }).ret : (h.add(a), !1);
714
- }
715
- #p(t = "") {
716
- return t ? t.split(",") : this.#r;
717
- }
718
- #S(t, e) {
719
- const s = this.#p(t.layer);
720
- for (const i of s) {
721
- const n = this.#s[i];
722
- if (!n) throw `存在しないlayer【${i}】です`;
723
- e(i, n);
724
- }
725
- return s;
726
- }
727
- #U(t = "") {
728
- return this.#p(t).sort((e, s) => {
729
- const i = this.#t.getChildIndex(this.#s[e].fore.ctn), n = this.#t.getChildIndex(this.#s[s].fore.ctn);
730
- return i < n ? -1 : i > n ? 1 : 0;
731
- });
732
- }
733
- setAllStyle2TxtLay(t) {
734
- for (const e of this.#r) {
735
- const s = this.#s[e].fore;
736
- s instanceof N && s.lay({ style: t });
737
- }
738
- }
739
- //MARK: 画面を揺らす
740
- #q(t) {
741
- if (k(t, "time", NaN) === 0) return !1;
742
- const e = this.#p(t.layer).map((f) => this.#s[f].fore.ctn), { renderer: s, ticker: i } = this.appPixi;
743
- this.#g.resize(_.stageW, _.stageH);
744
- const n = () => {
745
- this.#t.visible = !0;
746
- for (const f of e) s.render(
747
- f,
748
- { renderTexture: this.#g, clear: !1 }
749
- );
750
- this.#t.visible = !1;
751
- };
752
- this.#a.visible = !0, this.#a.alpha = 1;
753
- const o = O(k(t, "hmax", 10)), r = O(k(t, "vmax", 10)), c = o === 0 ? () => {
754
- } : () => {
755
- this.#a.x = Math.round(Math.random() * o * 2) - o;
756
- }, h = r === 0 ? () => {
757
- } : () => {
758
- this.#a.y = Math.round(Math.random() * r * 2) - r;
759
- };
760
- return this.#a.filters = [], w.tween(R, t, this.#a, { x: 0, y: 0 }, () => {
761
- c(), h();
762
- }, () => {
763
- i.remove(n), this.#t.visible = !0, this.#a.visible = !1, this.#a.x = 0, this.#a.y = 0, C.notifyEndProc(R);
764
- }, () => {
765
- }), i.add(n), !1;
766
- }
767
- //MARK: トゥイーン開始
768
- #J(t) {
769
- const { layer: e, render: s, name: i } = t;
770
- if (!e) throw "layerは必須です";
771
- const n = this.#s[this.#u(t)], o = n.fore;
772
- let r = () => {
773
- };
774
- s && (this.#d.isSkipping ? o.renderStart(!0) : (o.renderStart(!1), r = () => o.renderEnd()));
775
- const c = w.cnvTweenArg(t, o), h = g(t, "arrive", !1), f = g(t, "backlay", !1), l = n.back.ctn;
776
- return w.tween(i ?? e, t, o, w.cnvTweenArg(t, o), () => {
777
- }, r, () => {
778
- if (h && Object.assign(o, c), f) for (const d of w.aLayerPrpNm) l[d] = o[d];
779
- }), "filter" in t && (o.ctn.filters = [J.bldFilters(t)], o.aFltHArg = [t]), !1;
780
- }
781
- //MARK: フィルター追加
782
- #X(t) {
783
- return this.#S(t, (e) => {
784
- const s = this.#s[this.#u({ layer: e })];
785
- if (t.page === "both") {
786
- this.#P(s.fore, t), this.#P(s.back, t);
787
- return;
788
- }
789
- const i = s.getPage(t);
790
- this.#P(i, t);
791
- }), !1;
792
- }
793
- #P(t, e) {
794
- const s = t.ctn;
795
- s.filters ??= [], s.filters = [...s.filters, J.bldFilters(e)], t.aFltHArg.push(e);
796
- }
797
- //MARK: フィルター全削除
798
- #Y(t) {
799
- return this.#S(t, (e) => {
800
- const s = this.#s[this.#u({ layer: e })];
801
- if (t.page === "both") {
802
- const n = s.fore, o = s.back;
803
- n.ctn.filters = null, o.ctn.filters = null, n.aFltHArg = [], o.aFltHArg = [];
804
- return;
805
- }
806
- const i = s.getPage(t);
807
- i.ctn.filters = null, i.aFltHArg = [];
808
- }), !1;
809
- }
810
- //MARK: フィルター個別切替
811
- #K(t) {
812
- return this.#S(t, (e) => {
813
- const s = this.#s[this.#u({ layer: e })];
814
- if (t.page === "both") {
815
- this.#R(s.fore, t), this.#R(s.back, t);
816
- return;
817
- }
818
- const i = s.getPage(t);
819
- this.#R(i, t);
820
- }), !1;
821
- }
822
- #R(t, e) {
823
- const s = t.ctn;
824
- if (!s.filters) throw "フィルターがありません";
825
- const i = O(k(e, "index", 0)), n = s.filters.length;
826
- if (n <= i) throw `フィルターの個数(${String(n)})を越えています`;
827
- t.aFltHArg[i].enabled = s.filters[i].enabled = g(e, "enabled", !0);
828
- }
829
- // // 文字・文字レイヤ
830
- //MARK: 文字を追加する
831
- #I(t) {
832
- const { text: e } = t;
833
- if (!e) throw "textは必須です";
834
- const s = this.#h(t);
835
- delete t.text, this.setNormalChWait(), this.#d.isSkipping ? t.wait = 0 : "wait" in t && k(t, "wait", NaN), this.#n("add|" + L(t), s);
836
- const i = g(t, "record", !0), n = this.val.doRecLog();
837
- return i || this.val.setVal_Nochk("save", "sn.doRecLog", i), s.tagCh(e.replaceAll("[r]", `
838
- `)), this.val.setVal_Nochk("save", "sn.doRecLog", n), this.#n("add_close|", s), !1;
839
- }
840
- #h = (t) => {
841
- throw this.#C(), 0;
842
- };
843
- #Q(t) {
844
- const e = this.#u(t, this.#v), i = this.#s[e].getPage(t);
845
- if (!(i instanceof N)) throw e + "はTxtLayerではありません";
846
- return i;
847
- }
848
- setNormalChWait() {
849
- N.msecChWait = this.scrItr.normalWait;
850
- }
851
- //MARK: 操作対象のメッセージレイヤの指定
852
- #D = (t) => {
853
- throw this.#C(), 0;
854
- };
855
- #Z(t) {
856
- const { layer: e } = t;
857
- if (!e) throw "[current] layerは必須です";
858
- const s = this.#s[e];
859
- if (!s || !(s.getPage(t) instanceof N)) throw `${e}はTxtLayerではありません`;
860
- this.#k = s, this.#l.pagebreak(), this.#v = e, this.val.setVal_Nochk("save", "const.sn.mesLayer", e);
861
- for (const i of this.#r) {
862
- const { fore: n, back: o } = this.#s[i];
863
- n instanceof N && (n.isCur = o.isCur = i === e);
864
- }
865
- return !1;
866
- }
867
- get currentTxtlayForeNeedErr() {
868
- return this.#C(), this.currentTxtlayFore;
869
- }
870
- get currentTxtlayFore() {
871
- return this.#k ? this.#k.fore : null;
872
- }
873
- #k = void 0;
874
- // カレントテキストレイヤ
875
- #C = () => {
876
- throw "文字レイヤーがありません。文字表示や操作する前に、[add_lay layer=(レイヤ名) class=txt]で文字レイヤを追加して下さい";
877
- };
878
- #u(t, e = "") {
879
- const s = t.layer ?? e;
880
- if (s.includes(",")) throw "layer名に「,」は使えません";
881
- if (!(s in this.#s)) throw "属性 layer【" + s + "】が不正です。レイヤーがありません";
882
- return t.layer = s, s;
883
- }
884
- recPagebreak() {
885
- this.#l.pagebreak();
886
- }
887
- //MARK: 文字消去
888
- #M(t) {
889
- const e = this.#h(t);
890
- return t.layer === this.#v && t.page === "fore" && this.#l.pagebreak(), e.clearText(), !1;
891
- }
892
- //MARK: ハイパーリンクの終了
893
- #A(t) {
894
- return this.#n("endlink|", this.#h(t)), !1;
895
- }
896
- //MARK: ページ両面の文字消去
897
- #tt(t) {
898
- return g(t, "rec_page_break", !0) && this.#l.pagebreak(), this.#k && (this.#k.fore.clearLay(t), this.#k.back.clearLay(t)), !1;
899
- }
900
- //MARK: インライン画像表示
901
- #et(t) {
902
- if (!t.pic) throw "[graph] picは必須です";
903
- return this.#n("grp|" + L(t), this.#h(t)), !1;
904
- }
905
- //MARK: ハイパーリンク
906
- #st(t) {
907
- if (!t.fn && !t.label && !t.url) throw "fn,label,url いずれかは必須です";
908
- return t.fn ??= this.scrItr.scriptFn, t.style ??= "background-color: rgba(255,0,0,0.5);", t.style_hover ??= "background-color: rgba(255,0,0,0.9);", t.style_clicked ??= t.style, this.#n("link|" + L(t), this.#h(t)), !1;
909
- }
910
- //MARK: 改行
911
- #it(t) {
912
- return this.#I({ ...t, text: `
913
- ` });
914
- }
915
- //MARK: 文字列と複数ルビの追加
916
- #at(t) {
917
- const { t: e, r: s } = t;
918
- if (!e) throw "[ruby2] tは必須です";
919
- if (!s) throw "[ruby2] rは必須です";
920
- return t.text = "|" + encodeURIComponent(e) + "《" + encodeURIComponent(s) + "》", delete t.t, delete t.r, this.#I(t);
921
- }
922
- //MARK: インラインスタイル設定
923
- #nt(t) {
924
- return this.#n("span|" + L(t), this.#h(t)), !1;
925
- }
926
- //MARK: tcy縦中横を表示する
927
- #rt(t) {
928
- if (!t.t) throw "[tcy] tは必須です";
929
- return this.#n("tcy|" + L(t), this.#h(t)), !1;
930
- }
931
- //MARK: レイヤのダンプ
932
- #ot({ layer: t }) {
933
- console.group("🥟 [dump_lay]");
934
- for (const e of this.#p(t)) {
935
- const { fore: s, back: i } = this.#s[e];
936
- try {
937
- console.info(
938
- `%c${s.name.slice(0, -7)} %o`,
939
- `color:#${_.isDarkMode ? "49F" : "05A"};`,
940
- JSON.parse(`{"back":{${i.dump()}}, "fore":{${s.dump()}}}`)
941
- );
942
- } catch (n) {
943
- console.error("dump_lay err:%o", n), console.error(` back:${i.dump()}`), console.error(` fore:${s.dump()}`);
944
- }
945
- }
946
- return console.groupEnd(), !1;
947
- }
948
- //MARK: イベント有無の切替
949
- #ct(t) {
950
- const e = this.#u(t, this.#v), s = g(t, "enabled", !0);
951
- return this.#h(t).enabled = s, this.val.setVal_Nochk("save", "const.sn.layer." + e + ".enabled", s), !1;
952
- }
953
- //MARK: ボタンを表示
954
- #lt(t) {
955
- return I.argChk_page(t, "back"), t.fn ??= this.scrItr.scriptFn, this.#h(t).addButton(t), this.scrItr.recodeDesign(t), !1;
956
- }
957
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
958
- record() {
959
- const t = {};
960
- for (const e of this.#r) {
961
- const s = this.#s[e];
962
- t[e] = {
963
- cls: s.cls,
964
- fore: s.fore.record(),
965
- back: s.back.record()
966
- };
967
- }
968
- return t;
969
- }
970
- playback(t) {
971
- this.#l.playback();
972
- const e = [], s = [];
973
- for (const [n, { fore: o, fore: { idx: r }, back: c, cls: h }] of Object.entries(t)) {
974
- s.push({ ln: n, idx: r });
975
- const f = this.#s[n] ??= new I(n, h, this.#t, this.#i, {}, this.sys, this.val, { isWait: !1 });
976
- f.fore.playback(o, e), f.back.playback(c, e);
977
- }
978
- const i = this.#t.children.length;
979
- return e.push(new Promise((n) => {
980
- for (const { ln: o, idx: r } of s.sort(({ idx: c }, { idx: h }) => c === h ? 0 : c < h ? -1 : 1)) {
981
- const c = this.#s[o];
982
- if (!c) continue;
983
- const h = i > r ? r : i - 1, { fore: f, back: l } = c;
984
- this.#t.setChildIndex(f.ctn, h), this.#i.setChildIndex(l.ctn, h);
985
- }
986
- n();
987
- })), e;
988
- }
1
+ import { c as argChk_Color, g as uint, h as parseColor, l as argChk_Num, o as addStyle, s as argChk_Boolean, t as CmnLib, u as getDateStr } from "./CmnLib.js";
2
+ import { c as Loader, d as RenderTexture, f as Texture, l as LoaderResource, m as Container, o as Sprite, p as autoDetectRenderer, s as Graphics, u as Filter } from "./pixi.js";
3
+ import { t as EventListenerCtn } from "./EventListenerCtn.js";
4
+ import { n as SEARCH_PATH_ARG_EXT } from "./ConfigBase.js";
5
+ import { t as Layer } from "./Layer.js";
6
+ import "./DebugMng.js";
7
+ import { i as TW_NM_TRANS, r as CmnTween, t as Reading } from "./Reading.js";
8
+ import { t as SpritesMng } from "./SpritesMng.js";
9
+ import { Button } from "./Button.js";
10
+ import { t as RubySpliter } from "./RubySpliter.js";
11
+ import { TxtLayer, t as TxtStage } from "./TxtLayer.js";
12
+ import { GrpLayer, t as DesignCast } from "./GrpLayer.js";
13
+ import { n as PROTOCOL_DL, r as PROTOCOL_USERDATA } from "./Config.js";
14
+ var Pages = class e {
15
+ #e;
16
+ constructor(e, m, h, g, _, y, b, x) {
17
+ this.cls = m, this.hArg = _, this.sys = y, this.val = b, this.ret = x;
18
+ let S = y.hFactoryCls[m];
19
+ if (!S) throw `属性 class【${m}】が不正です`;
20
+ let C = S(), w = S();
21
+ C.layname = w.layname = e;
22
+ let T = _[":id_tag"] = `layer:${e} cls:${m} page:`;
23
+ C.ctn.name = C.name = T + "A", w.ctn.name = w.name = T + "B", h.addChild(C.ctn), g.addChild(w.ctn), argChk_Boolean(_, "visible", !0), argChk_Boolean(_, "visible", !0), x.isWait = C.lay(_) || w.lay(_), this.#e = {
24
+ fore: C,
25
+ back: w
26
+ }, g.visible = !1;
27
+ let E = `const.sn.lay.${e}`;
28
+ b.setVal_Nochk("tmp", E, !0), b.defTmp(E + ".fore.alpha", () => this.#e.fore.alpha), b.defTmp(E + ".back.alpha", () => this.#e.back.alpha), b.defTmp(E + ".fore.height", () => this.#e.fore.height), b.defTmp(E + ".back.height", () => this.#e.back.height), b.defTmp(E + ".fore.visible", () => this.#e.fore.ctn.visible), b.defTmp(E + ".back.visible", () => this.#e.back.ctn.visible), b.defTmp(E + ".fore.width", () => this.#e.fore.width), b.defTmp(E + ".back.width", () => this.#e.back.width), b.defTmp(E + ".fore.x", () => this.#e.fore.x), b.defTmp(E + ".back.x", () => this.#e.back.x), b.defTmp(E + ".fore.y", () => this.#e.fore.y), b.defTmp(E + ".back.y", () => this.#e.back.y);
29
+ }
30
+ destroy() {
31
+ this.#e.fore.destroy(), this.#e.back.destroy();
32
+ }
33
+ lay = (e) => this.getPage(e).lay(e);
34
+ getPage = (m) => e.argChk_page(m, "fore") === "back" ? this.#e.back : this.#e.fore;
35
+ static argChk_page(e, m) {
36
+ let h = e.page ?? m;
37
+ if (h === "fore" || h === "back") return e.page = h, h;
38
+ throw Error("属性 page【" + h + "】が不正です");
39
+ }
40
+ get fore() {
41
+ return this.#e.fore;
42
+ }
43
+ get back() {
44
+ return this.#e.back;
45
+ }
46
+ transPage(e) {
47
+ [this.#e.back, this.#e.fore] = [this.#e.fore, this.#e.back], this.#e.back.copy(this.#e.fore, e);
48
+ }
49
+ }, FrameMng = class e {
50
+ static #e;
51
+ static #t;
52
+ static #n;
53
+ static init(m, h, g) {
54
+ e.#e = m, e.#t = h, e.#n = g;
55
+ }
56
+ constructor(e, m, h) {
57
+ this.appPixi = m, this.val = h, e.add_frame = (e) => this.#o(e), e.let_frame = (e) => this.#f(e), e.set_frame = (e) => this.#p(e), e.frame = (e) => this.#h(e), e.tsy_frame = (e) => this.#g(e);
58
+ }
59
+ #r;
60
+ setEvtMng(e) {
61
+ this.#r = e;
62
+ }
63
+ #i = Object.create(null);
64
+ destroy() {
65
+ for (let e of Object.values(this.#i)) e.parentElement.removeChild(e);
66
+ this.#i = Object.create(null);
67
+ }
68
+ hideAllFrame() {
69
+ for (let [e, { style: m }] of Object.entries(this.#i)) this.#a[e] = m.display !== "none", m.display = "none";
70
+ }
71
+ #a = Object.create(null);
72
+ restoreAllFrame() {
73
+ for (let [e, m] of Object.entries(this.#a)) {
74
+ let h = this.#i[e];
75
+ h && (h.style.display = m ? "inline" : "none");
76
+ }
77
+ this.#a = Object.create(null);
78
+ }
79
+ #o(m) {
80
+ let { id: h, src: g, alpha: _ = 1, scale_x: y = 1, scale_y: b = 1, rotate: S = 0 } = m;
81
+ if (!h) throw "idは必須です";
82
+ if (!g) throw "srcは必須です";
83
+ let C = "const.sn.frm." + h;
84
+ if (this.val.getVal(`tmp:${C}`)) throw `frame【${h}】はすでにあります`;
85
+ let T = argChk_Boolean(m, "visible", !0), E = m.b_color ? ` background-color: ${m.b_color};` : "", D = this.#c(m);
86
+ e.#n.cvs.insertAdjacentHTML("beforebegin", `<iframe id="${h}" style="opacity: ${String(_)}; ${E} position: absolute; left:${String(e.#t.ofsLeft4elm + D.x * e.#t.cvsScale)}px; top: ${String(e.#t.ofsTop4elm + D.y * e.#t.cvsScale)}px; z-index: 1; border: 0px; overflow: hidden; display: ${T ? "inline" : "none"}; transform: scale(${String(y)}, ${String(b)}) rotate(${String(S)}deg);" width="${String(D.width * e.#t.cvsScale)}" height="${String(D.height * e.#t.cvsScale)}"></iframe>`);
87
+ let O = Reading.procID + `add_frame id:${h}`;
88
+ Reading.beginProc(O);
89
+ let k = e.#e.searchPath(g, SEARCH_PATH_ARG_EXT.HTML), A = new Loader().add({
90
+ name: g,
91
+ url: k,
92
+ xhrType: LoaderResource.XHR_RESPONSE_TYPE.TEXT
93
+ });
94
+ return e.#t.arg.crypto && A.use((m, h) => void e.#t.dec(m.extension, m.data).then((e) => {
95
+ m.data = e, h();
96
+ }).catch((g) => {
97
+ e.#n.errScript(`[add_frame]Html ロード失敗です src:${m.name} ${String(g)}`, !1), h();
98
+ })), A.load((m, v) => {
99
+ let x = document.getElementById(h);
100
+ this.#i[h] = x, this.#s[h] = !1;
101
+ let w = k.lastIndexOf("/") + 1, E = k.slice(0, w), A = E.slice(0, w);
102
+ x.srcdoc = String(v[g]?.data).replace("sn_repRes();", "").replaceAll(/\s(?:src|href)=(["'])(\S+?)\1/g, (e, m, h) => h.startsWith("../") ? A + e.slice(3) : e.replace("./", "").replace(m, m + E)), x.srcdoc.includes("true/*WEBP*/;") && (x.srcdoc = x.srcdoc.replaceAll(/data-src="(.+?\.)(?:jpe?g|png)/g, (e, m) => `data-src="${m}webp`)), x.onload = () => {
103
+ Reading.endProc(O), this.val.setVal_Nochk("tmp", C, !0), this.val.setVal_Nochk("tmp", C + ".alpha", _), this.val.setVal_Nochk("tmp", C + ".x", D.x), this.val.setVal_Nochk("tmp", C + ".y", D.y), this.val.setVal_Nochk("tmp", C + ".scale_x", y), this.val.setVal_Nochk("tmp", C + ".scale_y", b), this.val.setVal_Nochk("tmp", C + ".rotate", S), this.val.setVal_Nochk("tmp", C + ".width", D.width), this.val.setVal_Nochk("tmp", C + ".height", D.height), this.val.setVal_Nochk("tmp", C + ".visible", T);
104
+ let m = x.contentWindow;
105
+ this.#r.resvFlameEvent(m.document.body), m.sn_repRes?.((m) => e.#l(m.dataset.src ?? "", m));
106
+ };
107
+ }), !0;
108
+ }
109
+ #s = {};
110
+ getFrmDisabled(e) {
111
+ return this.#s[e];
112
+ }
113
+ #c(e) {
114
+ let m = { ...e };
115
+ return new DOMRect(argChk_Num(m, "x", 0), argChk_Num(m, "y", 0), argChk_Num(m, "width", CmnLib.stageW), argChk_Num(m, "height", CmnLib.stageH));
116
+ }
117
+ static #l(m, h, g) {
118
+ let _ = this.#d[m];
119
+ if (_) {
120
+ h.src = _, g && (h.onload = () => g(h));
121
+ return;
122
+ }
123
+ let v = this.#u[m];
124
+ if (v) {
125
+ v.push(h);
126
+ return;
127
+ }
128
+ this.#u[m] = [h];
129
+ let [y = "", b = ""] = m.split("?"), S = e.#e.searchPath(y, SEARCH_PATH_ARG_EXT.SP_GSM), C = new Loader().add({
130
+ name: m,
131
+ url: S,
132
+ xhrType: LoaderResource.XHR_RESPONSE_TYPE.BUFFER
133
+ });
134
+ e.#t.use4ViteElectron(m, S, C, e.#n) || e.#t.arg.crypto && S.endsWith(".bin") && C.use((m, h) => {
135
+ if (m.extension !== "bin") {
136
+ h();
137
+ return;
138
+ }
139
+ e.#t.decAB(m.data).then((e) => {
140
+ m.data = e, e instanceof HTMLImageElement && (m.type = LoaderResource.TYPE.IMAGE), h();
141
+ }).catch((g) => {
142
+ e.#n.errScript(`FrameMng loadPic ロード失敗です fn:${m.name} ${String(g)}`, !1), h();
143
+ });
144
+ }), C.load((e, m) => {
145
+ for (let [e, { data: { src: h } }] of Object.entries(m)) {
146
+ let m = this.#d[e] = h + (h.startsWith("blob:") || h.startsWith("data:") ? "" : b ? "?" + b : ""), _ = this.#u[e];
147
+ if (_) for (let e of _) e.src = m, g && (e.onload = () => g(e));
148
+ delete this.#u[e];
149
+ }
150
+ });
151
+ }
152
+ static #u = {};
153
+ static #d = {};
154
+ cvsResize() {
155
+ for (let [m, h] of Object.entries(this.#i)) {
156
+ let g = "const.sn.frm." + m, _ = Number(this.val.getVal(g + ".x")), v = Number(this.val.getVal(g + ".y")), y = Number(this.val.getVal(g + ".width")), b = Number(this.val.getVal(g + ".height"));
157
+ h.style.left = `${String(e.#t.ofsLeft4elm + _ * e.#t.cvsScale)}px`, h.style.top = `${String(e.#t.ofsTop4elm + v * e.#t.cvsScale)}px`, h.width = String(y * e.#t.cvsScale), h.height = String(b * e.#t.cvsScale);
158
+ }
159
+ }
160
+ #f(e) {
161
+ let { id: m, var_name: h } = e;
162
+ if (!m) throw "idは必須です";
163
+ let g = document.getElementById(m);
164
+ if (!g) throw `id【${m}】はフレームではありません`;
165
+ let _ = "const.sn.frm." + m;
166
+ if (!this.val.getVal(`tmp:${_}`)) throw `frame【${m}】が読み込まれていません`;
167
+ if (!h) throw "var_nameは必須です";
168
+ let y = g.contentWindow;
169
+ if (!Object.hasOwn(y, h)) throw `frame【${m}】に変数/関数【${h}】がありません。変数は var付きにして下さい`;
170
+ let b = y[h];
171
+ return this.val.setVal_Nochk("tmp", _ + "." + h, argChk_Boolean(e, "function", !1) ? b() : b), !1;
172
+ }
173
+ #p(e) {
174
+ let { id: m, var_name: h, text: g } = e;
175
+ if (!m) throw "idは必須です";
176
+ let _ = document.getElementById(m);
177
+ if (!_) throw `id【${m}】はフレームではありません`;
178
+ let v = "const.sn.frm." + m;
179
+ if (!this.val.getVal(`tmp:${v}`)) throw `frame【${m}】が読み込まれていません`;
180
+ if (!h) throw "var_nameは必須です";
181
+ if (!g) throw "textは必須です";
182
+ this.val.setVal_Nochk("tmp", v + "." + h, g);
183
+ let y = _.contentWindow;
184
+ return y[h] = g, !1;
185
+ }
186
+ #m = 1;
187
+ #h(m) {
188
+ let { id: h } = m;
189
+ if (!h) throw "idは必須です";
190
+ let _ = document.getElementById(h);
191
+ if (!_) throw `id【${h}】はフレームではありません`;
192
+ let y = "const.sn.frm." + h;
193
+ if (!this.val.getVal("tmp:" + y)) throw `frame【${h}】が読み込まれていません`;
194
+ let b = _.style;
195
+ if (argChk_Boolean(m, "float", !1) ? b.zIndex = String(++this.#m) : "index" in m ? b.zIndex = String(argChk_Num(m, "index", 0)) : m.dive && (b.zIndex = String(-++this.#m)), "alpha" in m) {
196
+ let e = b.opacity = String(m.alpha);
197
+ this.val.setVal_Nochk("tmp", y + ".alpha", e);
198
+ }
199
+ let x = this.#c(m);
200
+ if (("x" in m || "y" in m) && (b.left = `${String(e.#t.ofsLeft4elm + x.x * e.#t.cvsScale)}px`, b.top = `${String(e.#t.ofsTop4elm + x.y * e.#t.cvsScale)}px`, this.val.setVal_Nochk("tmp", y + ".x", x.x), this.val.setVal_Nochk("tmp", y + ".y", x.y)), "scale_x" in m || "scale_y" in m || "rotate" in m) {
201
+ let e = argChk_Num(m, "scale_x", 1), h = argChk_Num(m, "scale_y", 1), _ = argChk_Num(m, "rotate", 0);
202
+ b.transform = `scale(${String(e)}, ${String(h)}) rotate(${String(_)}deg)`, this.val.setVal_Nochk("tmp", y + ".scale_x", e), this.val.setVal_Nochk("tmp", y + ".scale_y", h), this.val.setVal_Nochk("tmp", y + ".rotate", _);
203
+ }
204
+ if ("width" in m && (_.width = String(x.width * e.#t.cvsScale), this.val.setVal_Nochk("tmp", y + ".width", x.width)), "height" in m && (_.height = String(x.height * e.#t.cvsScale), this.val.setVal_Nochk("tmp", y + ".height", x.height)), "visible" in m) {
205
+ let e = argChk_Boolean(m, "visible", !0);
206
+ b.display = e ? "inline" : "none", this.val.setVal_Nochk("tmp", y + ".visible", e);
207
+ }
208
+ if ("b_color" in m && (b.backgroundColor = m.b_color), "disabled" in m) {
209
+ let e = this.#s[h] = argChk_Boolean(m, "disabled", !0), g = _.contentDocument.body;
210
+ for (let m of [...Array.from(g.getElementsByTagName("input")), ...Array.from(g.getElementsByTagName("select"))]) m.disabled = e;
211
+ }
212
+ return !1;
213
+ }
214
+ #g(m) {
215
+ let { id: h, alpha: _, x: v, y, scale_x: b, scale_y: x, rotate: S, width: C, height: w } = m;
216
+ if (!h) throw "idは必須です";
217
+ let T = document.getElementById(h);
218
+ if (!T) throw `id【${h}】はフレームではありません`;
219
+ let E = "const.sn.frm." + h;
220
+ if (!this.val.getVal(`tmp:${E}`, 0)) throw `frame【${h}】が読み込まれていません`;
221
+ let D = {};
222
+ _ && (D.a = Number(T.style.opacity)), (v || y || b || x || S) && (D.x = Number(this.val.getVal(`tmp:${E}.x`)), D.y = Number(this.val.getVal(`tmp:${E}.y`)), D.sx = Number(this.val.getVal(`tmp:${E}.scale_x`)), D.sy = Number(this.val.getVal(`tmp:${E}.scale_y`)), D.r = Number(this.val.getVal(`tmp:${E}.rotate`))), C && (D.w = Number(this.val.getVal(`tmp:${E}.width`))), w && (D.h = Number(this.val.getVal(`tmp:${E}.height`)));
223
+ let O = CmnTween.cnvTweenArg(m, D), k = {}, A = (e) => {};
224
+ _ && (k.a = argChk_Num(O, "alpha", 0), A = (e) => {
225
+ T.style.opacity = String(e.a), this.val.setVal_Nochk("tmp", "alpha", e.a);
226
+ });
227
+ let j = (e) => {}, M = this.#c(O);
228
+ (v || y || b || x || S) && (k.x = M.x, k.y = M.y, k.sx = argChk_Num(O, "scale_x", 1), k.sy = argChk_Num(O, "scale_y", 1), k.r = argChk_Num(O, "rotate", 0), j = (m) => {
229
+ T.style.left = `${String(e.#t.ofsLeft4elm + m.x * e.#t.cvsScale)} px`, T.style.top = `${String(e.#t.ofsTop4elm + m.y * e.#t.cvsScale)} px`, T.style.transform = `scale(${String(m.sx)}, ${String(m.sy)}) rotate(${String(m.r)}deg)`, this.val.setVal_Nochk("tmp", E + ".x", m.x), this.val.setVal_Nochk("tmp", E + ".y", m.y), this.val.setVal_Nochk("tmp", E + ".scale_x", m.sx), this.val.setVal_Nochk("tmp", E + ".scale_y", m.sy), this.val.setVal_Nochk("tmp", E + ".rotate", m.r);
230
+ });
231
+ let N = (e) => {};
232
+ C && (k.w = M.width, N = (m) => {
233
+ T.width = `${String(m.w * e.#t.cvsScale)} px`, this.val.setVal_Nochk("tmp", E + ".width", m.w);
234
+ });
235
+ let P = (e) => {};
236
+ return w && (k.h = M.height, P = (m) => {
237
+ T.height = `${String(m.h * e.#t.cvsScale)} px`, this.val.setVal_Nochk("tmp", E + ".height", m.h);
238
+ }), this.appPixi.stage.interactive = !1, CmnTween.tween(`frm\n${h}`, m, D, CmnTween.cnvTweenArg(m, D), (e) => {
239
+ A(e), j(e), N(e), P(e);
240
+ }, () => {
241
+ this.appPixi.stage.interactive = !0;
242
+ }, () => {}), !1;
243
+ }
244
+ }, Log = class {
245
+ #e = { text: "" };
246
+ #t = [];
247
+ constructor(e, m, h) {
248
+ this.oCfg = e, this.hTag = m, this.val = h, m.rec_ch = (e) => this.#n(e), m.rec_r = (e) => this.#r(e), m.reset_rec = (e) => this.#i(e), h.defTmp("const.sn.log.json", () => {
249
+ this.#e.text = this.#e.text.replaceAll("</span><span class='sn_ch'>", "");
250
+ let e = [...this.#t, this.#e];
251
+ return JSON.stringify(e);
252
+ }), this.recText("");
253
+ }
254
+ recText(e) {
255
+ this.#e.text = e, this.val.setVal_Nochk("save", "const.sn.sLog", String(this.val.getVal("const.sn.log.json")));
256
+ }
257
+ #n(e) {
258
+ return this.#e = {
259
+ ...e,
260
+ text: this.#e.text
261
+ }, e.text ? (e.record = !0, e.style ??= "", e.style += "display: none;", e.wait = 0, this.hTag.ch(e)) : (this.val.setVal_Nochk("save", "const.sn.sLog", String(this.val.getVal("const.sn.log.json"))), !1);
262
+ }
263
+ #r(e) {
264
+ return this.#n({
265
+ ...e,
266
+ text: "[r]"
267
+ });
268
+ }
269
+ #i(e) {
270
+ return this.#t = [], e.text ??= "", this.#e = { text: e.text }, this.val.setVal_Nochk("save", "const.sn.sLog", JSON.stringify([this.#e])), !1;
271
+ }
272
+ pagebreak() {
273
+ this.#e.text = this.#e.text.replaceAll("</span><span class='sn_ch'>", ""), this.#e.text && (this.#t.push(this.#e) > this.oCfg.log.max_len && (this.#t = this.#t.slice(-this.oCfg.log.max_len)), this.#e = { text: "" });
274
+ }
275
+ playback() {
276
+ this.#t = JSON.parse(String(this.val.getVal("save:const.sn.sLog"))), this.#e = { text: "" };
277
+ }
278
+ };
279
+ function cnvSArg(e) {
280
+ return encodeURIComponent(JSON.stringify(e));
989
281
  }
990
- export {
991
- Z as LayerMng
282
+ var LayerMng = class x {
283
+ #e;
284
+ #t = new Container();
285
+ #n = new Container();
286
+ #r;
287
+ #i;
288
+ #a;
289
+ #o = new EventListenerCtn();
290
+ constructor(e, m, g, _, v, b, x, S, C) {
291
+ this.cfg = e, this.hTag = m, this.appPixi = g, this.val = _, this.main = v, this.scrItr = b, this.sys = x;
292
+ let w = () => {
293
+ if (x.cvsResize(), this.cvsResizeDesign(), this.#l) for (let e of this.#S) this.#x[e].fore.cvsResizeChildren();
294
+ else for (let e of this.#S) this.#x[e].fore.cvsResize();
295
+ this.#r.cvsResize(), this.#f.cvsResize();
296
+ };
297
+ if (CmnLib.isMobile) this.#o.add(globalThis, "orientationchange", w, { passive: !0 });
298
+ else {
299
+ let e;
300
+ this.#o.add(globalThis, "resize", () => {
301
+ e ||= setTimeout(() => {
302
+ e = void 0, w();
303
+ }, 1e3 / 60 * 10);
304
+ }, { passive: !0 });
305
+ }
306
+ x.cvsResize(), this.#a = new Log(this.cfg.oCfg, m, _), TxtLayer.init(e, m, _, this.#a, (e) => this.#x[e.layname].fore === e, g), GrpLayer.init(v, e, g, x, S, _), FrameMng.init(e, x, v), this.#r = new FrameMng(m, g, _), m.loadplugin = (e) => this.#y(e), m.snapshot = (e) => this.#h(e), this.#g = this.sys.isApp ? (e, m, h, g, _) => this.#_(e, m, h, g, _) : (e, m, h, g, _) => this.#v(e, m, h, g, _), m.add_lay = (e) => this.#b(e), m.clear_lay = (e) => this.#D(e), m.finish_trans = () => !1, m.lay = (e) => this.#T(e), m.trans = (e) => this.#N(e), m.wt = (e) => CmnTween.wt(e), m.quake = (e) => this.#L(e), m.stop_quake = m.finish_trans, m.wq = m.wt, m.pause_tsy = (e) => CmnTween.pause_tsy(e), m.resume_tsy = (e) => CmnTween.resume_tsy(e), m.stop_tsy = (e) => CmnTween.stop_tsy(e), m.tsy = (e) => this.#R(e), m.wait_tsy = (e) => CmnTween.wait_tsy(e), m.add_filter = (e) => this.#z(e), m.clear_filter = (e) => this.#V(e), m.enable_filter = (e) => this.#H(e), m.ch = (e) => this.#W(e), m.clear_text = (e) => this.#Q(e), m.current = (e) => this.#q(e), m.endlink = (e) => this.#$(e), m.er = (e) => this.#ee(e), m.graph = (e) => this.#te(e), m.link = (e) => this.#ne(e), m.r = (e) => this.#re(e), m.ruby2 = (e) => this.#ie(e), m.span = (e) => this.#ae(e), m.tcy = (e) => this.#oe(e), m.add_face = (e) => SpritesMng.add_face(e), m.wv = (e) => SpritesMng.wv(e), m.dump_lay = (e) => this.#se(e), m.enable_event = (e) => this.#ce(e), m.button = (e) => this.#le(e), e.existsBreakline && (this.breakLine = (e) => {
307
+ delete e.visible, e.id = "break", e.pic = "breakline", this.#m("grp|" + cnvSArg(e));
308
+ }), e.existsBreakpage && (this.breakPage = (e) => {
309
+ delete e.visible, e.id = "break", e.pic = "breakpage", this.#m("grp|" + cnvSArg(e));
310
+ }), this.#i = parseColor(String(e.oCfg.init.bg_color));
311
+ let T = new Graphics();
312
+ T.beginFill(this.#i).lineStyle(0, this.#i).drawRect(0, 0, CmnLib.stageW, CmnLib.stageH).endFill(), this.#t.addChild(T.clone()), this.#n.addChild(T), this.#n.visible = !1, this.#t.name = "page:A", this.#n.name = "page:B", this.#e = g.stage, this.#e.addChild(this.#n), this.#e.addChild(this.#t), this.#e.addChild(this.#A), this.#e.addChild(this.#M), this.#e.name = "stage";
313
+ let E = (e, m) => {
314
+ this.#p(Number(m));
315
+ };
316
+ E("", _.getVal("sys:TextLayer.Back.Alpha", 1)), _.defValTrg("sys:TextLayer.Back.Alpha", E);
317
+ let D = (e, m) => {
318
+ Button.fontFamily = m;
319
+ };
320
+ D("", _.getVal("tmp:sn.button.fontFamily", Button.fontFamily)), _.defValTrg("tmp:sn.button.fontFamily", D), _.defTmp("const.sn.last_page_text", () => this.currentTxtlayFore?.pageText ?? ""), _.defTmp("const.sn.last_page_plain_text", () => this.currentTxtlayFore?.pagePlainText ?? ""), CmnLib.isDbg && (DesignCast.init(g, x, b, C, e, this.#x), this.cvsResizeDesign = () => DesignCast.cvsResizeDesign(), x.addHook((e, m) => {
321
+ this.#s[e]?.(e, m) && delete this.#s[e];
322
+ }));
323
+ }
324
+ cvsResizeDesign() {}
325
+ #s = {
326
+ attach: (e) => (DesignCast.leaveMode(), !1),
327
+ continue: (e) => (DesignCast.leaveMode(), !1),
328
+ disconnect: (e) => (DesignCast.leaveMode(), !1),
329
+ _enterDesign: (e) => {
330
+ DesignCast.enterMode();
331
+ for (let e of this.#S) {
332
+ let m = this.#x[e].fore;
333
+ m.makeDesignCastChildren((e) => e.make()), m.makeDesignCast((e) => e.make());
334
+ }
335
+ return this.#u(this.#C), !1;
336
+ },
337
+ _replaceToken: (e, m) => (DesignCast.replaceToken(m), !1),
338
+ _selectNode: (e, m) => (this.#u(m.node), !1)
339
+ };
340
+ #c = "";
341
+ #l = "";
342
+ #u(e) {
343
+ [this.#c = "", this.#l = ""] = e.split("/");
344
+ let m = this.#x[this.#c];
345
+ m && (DesignCast.allHide(), this.#l ? m.fore.showDesignCastChildren() : m.fore.showDesignCast());
346
+ }
347
+ getFrmDisabled = (e) => this.#r.getFrmDisabled(e);
348
+ #d = void 0;
349
+ cover(e, m = 0) {
350
+ this.#d &&= (this.#e.removeChild(this.#d), this.#d.destroy(), void 0), e && this.#e.addChild((this.#d = new Graphics()).beginFill(m).lineStyle(0, m).drawRect(0, 0, CmnLib.stageW, CmnLib.stageH).endFill());
351
+ }
352
+ #f;
353
+ setEvtMng(e) {
354
+ this.#f = e, this.#r.setEvtMng(e), SpritesMng.setEvtMng(e), CmnTween.init(e);
355
+ }
356
+ destroy() {
357
+ for (let e of Object.values(this.#x)) e.destroy();
358
+ this.#o.clear(), GrpLayer.destroy(), RubySpliter.destroy(), TxtStage.destroy(), TxtLayer.destroy(), this.#r.destroy(), CmnTween.destroy(), TxtLayer.msecChWait = 10;
359
+ }
360
+ #p(e) {
361
+ for (let m of this.#S) {
362
+ let { fore: h, back: g } = this.#x[m];
363
+ h instanceof TxtLayer && (h.chgBackAlpha(e), g.chgBackAlpha(e));
364
+ }
365
+ }
366
+ #m = (e, m = this.currentTxtlayForeNeedErr, h = !0) => m.tagCh("|&emsp;《" + e + "》");
367
+ goTxt = () => {};
368
+ get needGoTxt() {
369
+ return this.currentTxtlayFore?.needGoTxt ?? !1;
370
+ }
371
+ breakLine = (e) => {};
372
+ breakPage = (e) => {};
373
+ clearBreak() {
374
+ this.currentTxtlayFore && (this.clearBreak = () => this.#m("del|break"), this.clearBreak());
375
+ }
376
+ clickTxtLay() {
377
+ return this.currentTxtlayFore ? this.#S.map((e) => this.#x[e].fore).some((e) => e instanceof TxtLayer && e.click()) : !1;
378
+ }
379
+ #h(e) {
380
+ let m = getDateStr("-", "_", "", "_"), h = e.fn ? e.fn.startsWith("userdata:/") ? e.fn : `${PROTOCOL_DL + e.fn + m}.png` : `${PROTOCOL_DL}snapshot${m}.png`, _ = this.cfg.searchPath(h), v = argChk_Num(e, "width", CmnLib.stageW), x = argChk_Num(e, "height", CmnLib.stageH);
381
+ return this.#g(e, _, v, x, `snapshot dt:${m}`);
382
+ }
383
+ #g = () => !1;
384
+ #_({ layer: e }, m, h, g, _) {
385
+ if (this.#r.hideAllFrame(), Reading.beginProc(_), !e) return this.sys.capturePage(m, h, g, () => {
386
+ this.#r.restoreAllFrame(), Reading.endProc(_);
387
+ }), !0;
388
+ let v = this.#S.map((e) => {
389
+ let { ctn: m } = this.#x[e].fore, h = [m, m.visible];
390
+ return m.visible = !1, h;
391
+ });
392
+ for (let m of this.#P(e)) this.#x[m].fore.ctn.visible = !0;
393
+ return this.sys.capturePage(m, h, g, () => {
394
+ for (let [e, m] of v) e.visible = m;
395
+ this.#r.restoreAllFrame(), Reading.endProc(_);
396
+ }), !0;
397
+ }
398
+ #v(m, h, g, _, y) {
399
+ Reading.beginProc(y);
400
+ let b = argChk_Color(m, "b_color", this.#i), x = autoDetectRenderer({
401
+ width: g,
402
+ height: _,
403
+ backgroundAlpha: b > 16777216 && h.endsWith(".png") ? 0 : 1,
404
+ antialias: argChk_Boolean(m, "smoothing", !1),
405
+ preserveDrawingBuffer: !0,
406
+ backgroundColor: b & 16777215,
407
+ autoDensity: !0
408
+ }), C = m.page === "back" ? "back" : "fore", { layer: w } = m;
409
+ return Promise.allSettled(this.#P(w).map((e) => new Promise((m) => this.#x[e][C].snapshot(x, m)))).then(async () => {
410
+ let e = RenderTexture.create({
411
+ width: x.width,
412
+ height: x.height
413
+ });
414
+ x.render(this.#e, { renderTexture: e }), await this.sys.savePic(h, x.plugins.extract.base64(e)), e.destroy();
415
+ for (let e of this.#P(w)) this.#x[e][C].snapshot_end();
416
+ x.destroy(!0), Reading.endProc(y);
417
+ }), !0;
418
+ }
419
+ #y(e) {
420
+ let { fn: m } = e;
421
+ if (!m) throw "fnは必須です";
422
+ if (!m.endsWith(".css")) throw "サポートされない拡張子です";
423
+ let h = argChk_Boolean(e, "join", !0), g = Reading.procID + `loadplugin fn:${m}`;
424
+ return h && Reading.beginProc(g), (async () => {
425
+ let e = await fetch(m);
426
+ if (!e.ok) throw Error("Network response was not ok.");
427
+ addStyle(await e.text()), h && Reading.endProc(g);
428
+ })(), h;
429
+ }
430
+ #b(e) {
431
+ let { layer: m, class: h } = e;
432
+ if (!m) throw "layerは必須です";
433
+ if (m.includes(",")) throw "layer名に「,」は使えません";
434
+ if (m in this.#x) throw `layer【${m}】はすでにあります`;
435
+ if (!h) throw "clsは必須です";
436
+ let g = { isWait: !1 };
437
+ switch (this.#x[m] = new Pages(m, h, this.#t, this.#n, e, this.sys, this.val, g), this.#S.push(m), h) {
438
+ case "txt":
439
+ this.#C || (this.#X = () => {}, this.#G = (e) => this.#K(e), this.#q = (e) => this.#J(e), this.hTag.current({ layer: m }), this.goTxt = () => {
440
+ this.#f.isSkipping ? TxtLayer.msecChWait = 0 : this.setNormalChWait();
441
+ for (let e of this.#S) {
442
+ let m = this.#x[e].fore;
443
+ m instanceof TxtLayer && this.#m("gotxt|", m, !1);
444
+ }
445
+ }), this.val.setVal_Nochk("save", "const.sn.layer." + m + ".enabled", !0);
446
+ break;
447
+ case "grp":
448
+ if (this.#w) break;
449
+ this.#w = m;
450
+ break;
451
+ }
452
+ return this.scrItr.recodeDesign(e), g.isWait;
453
+ }
454
+ #x = {};
455
+ #S = [];
456
+ #C = "";
457
+ #w = "";
458
+ #T(e) {
459
+ let m = this.#Z(e), h = this.#x[m], _ = h.back.ctn, y = h.fore.ctn;
460
+ if (argChk_Boolean(e, "float", !1)) this.#n.setChildIndex(_, this.#n.children.length - 1), this.#t.setChildIndex(y, this.#t.children.length - 1), this.#E();
461
+ else if (e.index) argChk_Num(e, "index", 0) && (this.#n.setChildIndex(_, e.index), this.#t.setChildIndex(y, e.index), this.#E());
462
+ else if (e.dive) {
463
+ let { dive: h } = e, g = 0;
464
+ if (m === h) throw "[lay] 属性 layerとdiveが同じ【" + h + "】です";
465
+ let v = this.#x[h];
466
+ if (!v) throw "[lay] 属性 dive【" + h + "】が不正です。レイヤーがありません";
467
+ let b = v.back, x = v.fore, S = this.#n.getChildIndex(b.ctn), C = this.#t.getChildIndex(x.ctn);
468
+ g = S < C ? S : C, g > this.#n.getChildIndex(_) && --g, this.#t.setChildIndex(y, g), this.#n.setChildIndex(_, g), this.#E();
469
+ }
470
+ return e[":id_tag"] = h.fore.name.slice(0, -7), this.scrItr.recodeDesign(e), h.lay(e);
471
+ }
472
+ #E() {
473
+ this.#S = this.#I();
474
+ }
475
+ #D(e) {
476
+ return this.#F(e, (m) => {
477
+ let h = this.#x[this.#Z({ layer: m })];
478
+ if (e.page === "both") {
479
+ h.fore.clearLay(e), h.back.clearLay(e);
480
+ return;
481
+ }
482
+ h.getPage(e).clearLay(e);
483
+ }), !1;
484
+ }
485
+ static #O = "\nprecision mediump float;\n\nvarying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n\nuniform sampler2D rule;\nuniform float vague;\nuniform float tick;\n\nuniform vec4 inputPixel;\nuniform highp vec4 outputFrame;\nvec2 getUV(vec2 coord) {\n return coord * inputPixel.xy / outputFrame.zw;\n}\n\nvoid main() {\n vec4 fg = texture2D(uSampler, vTextureCoord);\n vec4 ru = texture2D(rule, getUV(vTextureCoord));\n\n float v = ru.r - tick;\n gl_FragColor = abs(v) < vague\n ? vec4(fg.rgb, 1) *fg.a *(0.5 +v /vague *0.5)\n : 0.0 <= v ? fg : vec4(0);\n}";
486
+ #k = RenderTexture.create({
487
+ width: CmnLib.stageW,
488
+ height: CmnLib.stageH
489
+ });
490
+ #A = new Sprite(this.#k);
491
+ #j = RenderTexture.create({
492
+ width: CmnLib.stageW,
493
+ height: CmnLib.stageH
494
+ });
495
+ #M = new Sprite(this.#j);
496
+ #N(e) {
497
+ let { layer: m } = e, h = /* @__PURE__ */ new Set(), _ = this.#P(m).map((e) => (h.add(e), this.#x[e].fore)), v = () => {
498
+ [this.#t, this.#n] = [this.#n, this.#t];
499
+ let e = [];
500
+ for (let [m, g] of Object.entries(this.#x)) {
501
+ if (h.has(m)) {
502
+ g.transPage(e);
503
+ continue;
504
+ }
505
+ let { fore: { ctn: _ }, back: { ctn: v } } = g, y = this.#t.getChildIndex(v);
506
+ this.#t.removeChild(v), this.#n.removeChild(_), this.#t.addChildAt(_, y), this.#n.addChildAt(v, y);
507
+ }
508
+ Promise.allSettled(e).then(() => {
509
+ this.#t.visible = !0, this.#n.visible = !1, this.#A.visible = !1, this.#M.visible = !1, Reading.notifyEndProc(TW_NM_TRANS);
510
+ });
511
+ };
512
+ if (this.#M.filters = [], this.#M.alpha = 1, argChk_Num(e, "time", 0) === 0 || this.#f.isSkipping) return v(), !1;
513
+ let y = [], b = this.#S.map((e) => {
514
+ let { fore: m, back: g } = this.#x[e], _ = h.has(e) ? g : m;
515
+ return _.ctn.visible && y.push(_.ctn), _;
516
+ }), { ticker: S, renderer: w } = this.appPixi;
517
+ w.render(this.#n, { renderTexture: this.#k });
518
+ let T = () => {
519
+ for (let e of y) w.render(e, {
520
+ renderTexture: this.#k,
521
+ clear: !1
522
+ });
523
+ };
524
+ if (!b.some((e) => e.containMovement)) {
525
+ let e = T;
526
+ T = () => {
527
+ T = () => {}, e();
528
+ };
529
+ }
530
+ let E = () => w.render(this.#t, { renderTexture: this.#j });
531
+ E();
532
+ let D = () => {
533
+ this.#t.visible = !0, E(), this.#t.visible = !1;
534
+ };
535
+ if (!_.some((e) => e.containMovement)) {
536
+ let e = D;
537
+ D = () => {
538
+ D = () => {}, e();
539
+ };
540
+ }
541
+ let O = () => {
542
+ T(), this.#A.visible = !0, D(), this.#M.visible = !0;
543
+ }, { glsl: A, rule: j } = e, M = () => {
544
+ S.remove(O), v();
545
+ };
546
+ if (!A && !j) return CmnTween.tween(TW_NM_TRANS, e, this.#M, { alpha: 0 }, () => {}, M, () => {}), S.add(O), !1;
547
+ let F = {
548
+ rule: Texture.EMPTY,
549
+ vague: argChk_Num(e, "vague", .04),
550
+ tick: 0
551
+ };
552
+ this.#M.filters = [new Filter(void 0, A ?? x.#O, F)];
553
+ let I = CmnTween.tween(TW_NM_TRANS, e, F, { tick: 1 }, () => {}, M, () => {}, !j);
554
+ return j ? new SpritesMng(j, void 0, (e) => {
555
+ F.rule = e.texture, e.destroy(), I.start(), S.add(O);
556
+ }, (e) => {
557
+ e && this.main.resume();
558
+ }).ret : (S.add(O), !1);
559
+ }
560
+ #P(e = "") {
561
+ return e ? e.split(",") : this.#S;
562
+ }
563
+ #F(e, m) {
564
+ let h = this.#P(e.layer);
565
+ for (let e of h) {
566
+ let h = this.#x[e];
567
+ if (!h) throw `存在しないlayer【${e}】です`;
568
+ m(e, h);
569
+ }
570
+ return h;
571
+ }
572
+ #I(e = "") {
573
+ return this.#P(e).sort((e, m) => {
574
+ let h = this.#t.getChildIndex(this.#x[e].fore.ctn), g = this.#t.getChildIndex(this.#x[m].fore.ctn);
575
+ return h < g ? -1 : h > g ? 1 : 0;
576
+ });
577
+ }
578
+ setAllStyle2TxtLay(e) {
579
+ for (let m of this.#S) {
580
+ let h = this.#x[m].fore;
581
+ h instanceof TxtLayer && h.lay({ style: e });
582
+ }
583
+ }
584
+ #L(e) {
585
+ if (argChk_Num(e, "time", NaN) === 0) return !1;
586
+ let h = this.#P(e.layer).map((e) => this.#x[e].fore.ctn), { renderer: _, ticker: v } = this.appPixi;
587
+ this.#j.resize(CmnLib.stageW, CmnLib.stageH);
588
+ let b = () => {
589
+ this.#t.visible = !0;
590
+ for (let e of h) _.render(e, {
591
+ renderTexture: this.#j,
592
+ clear: !1
593
+ });
594
+ this.#t.visible = !1;
595
+ };
596
+ this.#M.visible = !0, this.#M.alpha = 1;
597
+ let x = uint(argChk_Num(e, "hmax", 10)), S = uint(argChk_Num(e, "vmax", 10)), C = x === 0 ? () => {} : () => {
598
+ this.#M.x = Math.round(Math.random() * x * 2) - x;
599
+ }, w = S === 0 ? () => {} : () => {
600
+ this.#M.y = Math.round(Math.random() * S * 2) - S;
601
+ };
602
+ return this.#M.filters = [], CmnTween.tween(TW_NM_TRANS, e, this.#M, {
603
+ x: 0,
604
+ y: 0
605
+ }, () => {
606
+ C(), w();
607
+ }, () => {
608
+ v.remove(b), this.#t.visible = !0, this.#M.visible = !1, this.#M.x = 0, this.#M.y = 0, Reading.notifyEndProc(TW_NM_TRANS);
609
+ }, () => {}), v.add(b), !1;
610
+ }
611
+ #R(e) {
612
+ let { layer: m, render: h, name: g } = e;
613
+ if (!m) throw "layerは必須です";
614
+ let _ = this.#x[this.#Z(e)], y = _.fore, b = () => {};
615
+ h && (this.#f.isSkipping ? y.renderStart(!0) : (y.renderStart(!1), b = () => y.renderEnd()));
616
+ let x = CmnTween.cnvTweenArg(e, y), S = argChk_Boolean(e, "arrive", !1), C = argChk_Boolean(e, "backlay", !1), w = _.back.ctn;
617
+ return CmnTween.tween(g ?? m, e, y, CmnTween.cnvTweenArg(e, y), () => {}, b, () => {
618
+ if (S && Object.assign(y, x), C) for (let e of CmnTween.aLayerPrpNm) w[e] = y[e];
619
+ }), "filter" in e && (y.ctn.filters = [Layer.bldFilters(e)], y.aFltHArg = [e]), !1;
620
+ }
621
+ #z(e) {
622
+ return this.#F(e, (m) => {
623
+ let h = this.#x[this.#Z({ layer: m })];
624
+ if (e.page === "both") {
625
+ this.#B(h.fore, e), this.#B(h.back, e);
626
+ return;
627
+ }
628
+ let g = h.getPage(e);
629
+ this.#B(g, e);
630
+ }), !1;
631
+ }
632
+ #B(e, m) {
633
+ let h = e.ctn;
634
+ h.filters ??= [], h.filters = [...h.filters, Layer.bldFilters(m)], e.aFltHArg.push(m);
635
+ }
636
+ #V(e) {
637
+ return this.#F(e, (m) => {
638
+ let h = this.#x[this.#Z({ layer: m })];
639
+ if (e.page === "both") {
640
+ let e = h.fore, m = h.back;
641
+ e.ctn.filters = null, m.ctn.filters = null, e.aFltHArg = [], m.aFltHArg = [];
642
+ return;
643
+ }
644
+ let g = h.getPage(e);
645
+ g.ctn.filters = null, g.aFltHArg = [];
646
+ }), !1;
647
+ }
648
+ #H(e) {
649
+ return this.#F(e, (m) => {
650
+ let h = this.#x[this.#Z({ layer: m })];
651
+ if (e.page === "both") {
652
+ this.#U(h.fore, e), this.#U(h.back, e);
653
+ return;
654
+ }
655
+ let g = h.getPage(e);
656
+ this.#U(g, e);
657
+ }), !1;
658
+ }
659
+ #U(e, h) {
660
+ let _ = e.ctn;
661
+ if (!_.filters) throw "フィルターがありません";
662
+ let y = uint(argChk_Num(h, "index", 0)), b = _.filters.length;
663
+ if (b <= y) throw `フィルターの個数(${String(b)})を越えています`;
664
+ e.aFltHArg[y].enabled = _.filters[y].enabled = argChk_Boolean(h, "enabled", !0);
665
+ }
666
+ #W(e) {
667
+ let { text: m } = e;
668
+ if (!m) throw "textは必須です";
669
+ let h = this.#G(e);
670
+ delete e.text, this.setNormalChWait(), this.#f.isSkipping ? e.wait = 0 : "wait" in e && argChk_Num(e, "wait", NaN), this.#m("add|" + cnvSArg(e), h);
671
+ let _ = argChk_Boolean(e, "record", !0), y = this.val.doRecLog();
672
+ return _ || this.val.setVal_Nochk("save", "sn.doRecLog", _), h.tagCh(m.replaceAll("[r]", "\n")), this.val.setVal_Nochk("save", "sn.doRecLog", y), this.#m("add_close|", h), !1;
673
+ }
674
+ #G = (e) => {
675
+ throw this.#X(), 0;
676
+ };
677
+ #K(e) {
678
+ let m = this.#Z(e, this.#C), h = this.#x[m].getPage(e);
679
+ if (!(h instanceof TxtLayer)) throw m + "はTxtLayerではありません";
680
+ return h;
681
+ }
682
+ setNormalChWait() {
683
+ TxtLayer.msecChWait = this.scrItr.normalWait;
684
+ }
685
+ #q = (e) => {
686
+ throw this.#X(), 0;
687
+ };
688
+ #J(e) {
689
+ let { layer: m } = e;
690
+ if (!m) throw "[current] layerは必須です";
691
+ let h = this.#x[m];
692
+ if (!h || !(h.getPage(e) instanceof TxtLayer)) throw `${m}はTxtLayerではありません`;
693
+ this.#Y = h, this.#a.pagebreak(), this.#C = m, this.val.setVal_Nochk("save", "const.sn.mesLayer", m);
694
+ for (let e of this.#S) {
695
+ let { fore: h, back: g } = this.#x[e];
696
+ h instanceof TxtLayer && (h.isCur = g.isCur = e === m);
697
+ }
698
+ return !1;
699
+ }
700
+ get currentTxtlayForeNeedErr() {
701
+ return this.#X(), this.currentTxtlayFore;
702
+ }
703
+ get currentTxtlayFore() {
704
+ return this.#Y ? this.#Y.fore : null;
705
+ }
706
+ #Y = void 0;
707
+ #X = () => {
708
+ throw "文字レイヤーがありません。文字表示や操作する前に、[add_lay layer=(レイヤ名) class=txt]で文字レイヤを追加して下さい";
709
+ };
710
+ #Z(e, m = "") {
711
+ let h = e.layer ?? m;
712
+ if (h.includes(",")) throw "layer名に「,」は使えません";
713
+ if (!(h in this.#x)) throw "属性 layer【" + h + "】が不正です。レイヤーがありません";
714
+ return e.layer = h, h;
715
+ }
716
+ recPagebreak() {
717
+ this.#a.pagebreak();
718
+ }
719
+ #Q(e) {
720
+ let m = this.#G(e);
721
+ return e.layer === this.#C && e.page === "fore" && this.#a.pagebreak(), m.clearText(), !1;
722
+ }
723
+ #$(e) {
724
+ return this.#m("endlink|", this.#G(e)), !1;
725
+ }
726
+ #ee(e) {
727
+ return argChk_Boolean(e, "rec_page_break", !0) && this.#a.pagebreak(), this.#Y && (this.#Y.fore.clearLay(e), this.#Y.back.clearLay(e)), !1;
728
+ }
729
+ #te(e) {
730
+ if (!e.pic) throw "[graph] picは必須です";
731
+ return this.#m("grp|" + cnvSArg(e), this.#G(e)), !1;
732
+ }
733
+ #ne(e) {
734
+ if (!e.fn && !e.label && !e.url) throw "fn,label,url いずれかは必須です";
735
+ return e.fn ??= this.scrItr.scriptFn, e.style ??= "background-color: rgba(255,0,0,0.5);", e.style_hover ??= "background-color: rgba(255,0,0,0.9);", e.style_clicked ??= e.style, this.#m("link|" + cnvSArg(e), this.#G(e)), !1;
736
+ }
737
+ #re(e) {
738
+ return this.#W({
739
+ ...e,
740
+ text: "\n"
741
+ });
742
+ }
743
+ #ie(e) {
744
+ let { t: m, r: h } = e;
745
+ if (!m) throw "[ruby2] tは必須です";
746
+ if (!h) throw "[ruby2] rは必須です";
747
+ return e.text = "|" + encodeURIComponent(m) + "《" + encodeURIComponent(h) + "》", delete e.t, delete e.r, this.#W(e);
748
+ }
749
+ #ae(e) {
750
+ return this.#m("span|" + cnvSArg(e), this.#G(e)), !1;
751
+ }
752
+ #oe(e) {
753
+ if (!e.t) throw "[tcy] tは必須です";
754
+ return this.#m("tcy|" + cnvSArg(e), this.#G(e)), !1;
755
+ }
756
+ #se({ layer: e }) {
757
+ console.group("🥟 [dump_lay]");
758
+ for (let m of this.#P(e)) {
759
+ let { fore: e, back: h } = this.#x[m];
760
+ try {
761
+ console.info(`%c${e.name.slice(0, -7)} %o`, `color:#${CmnLib.isDarkMode ? "49F" : "05A"};`, JSON.parse(`{"back":{${h.dump()}}, "fore":{${e.dump()}}}`));
762
+ } catch (m) {
763
+ console.error("dump_lay err:%o", m), console.error(` back:${h.dump()}`), console.error(` fore:${e.dump()}`);
764
+ }
765
+ }
766
+ return console.groupEnd(), !1;
767
+ }
768
+ #ce(e) {
769
+ let m = this.#Z(e, this.#C), h = argChk_Boolean(e, "enabled", !0);
770
+ return this.#G(e).enabled = h, this.val.setVal_Nochk("save", "const.sn.layer." + m + ".enabled", h), !1;
771
+ }
772
+ #le(e) {
773
+ return Pages.argChk_page(e, "back"), e.fn ??= this.scrItr.scriptFn, this.#G(e).addButton(e), this.scrItr.recodeDesign(e), !1;
774
+ }
775
+ record() {
776
+ let e = {};
777
+ for (let m of this.#S) {
778
+ let h = this.#x[m];
779
+ e[m] = {
780
+ cls: h.cls,
781
+ fore: h.fore.record(),
782
+ back: h.back.record()
783
+ };
784
+ }
785
+ return e;
786
+ }
787
+ playback(e) {
788
+ this.#a.playback();
789
+ let m = [], h = [];
790
+ for (let [g, { fore: _, fore: { idx: v }, back: y, cls: b }] of Object.entries(e)) {
791
+ h.push({
792
+ ln: g,
793
+ idx: v
794
+ });
795
+ let e = this.#x[g] ??= new Pages(g, b, this.#t, this.#n, {}, this.sys, this.val, { isWait: !1 });
796
+ e.fore.playback(_, m), e.back.playback(y, m);
797
+ }
798
+ let g = this.#t.children.length;
799
+ return m.push(new Promise((e) => {
800
+ for (let { ln: e, idx: m } of h.sort(({ idx: e }, { idx: m }) => e === m ? 0 : e < m ? -1 : 1)) {
801
+ let h = this.#x[e];
802
+ if (!h) continue;
803
+ let _ = g > m ? m : g - 1, { fore: v, back: y } = h;
804
+ this.#t.setChildIndex(v.ctn, _), this.#n.setChildIndex(y.ctn, _);
805
+ }
806
+ e();
807
+ })), m;
808
+ }
992
809
  };
993
- //# sourceMappingURL=LayerMng.js.map
810
+ export { LayerMng };
811
+
812
+ //# sourceMappingURL=LayerMng.js.map