ss-component-new 1.1.76 → 1.1.78

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 (48) hide show
  1. package/dist/_plugin-vue_export-helper-BHFhmbuH.cjs +1 -0
  2. package/dist/_plugin-vue_export-helper-CHgC5LLL.js +9 -0
  3. package/dist/array-DQ6meJk7.cjs +9 -0
  4. package/dist/{array-BejyPB_1.js → array-Dsurpc08.js} +247 -241
  5. package/dist/cloneDeep-BH_aXSAH.cjs +1 -0
  6. package/dist/cloneDeep-MKlVykeI.js +318 -0
  7. package/dist/{index-ChCXzsYf.js → index-54P6MUQ5.js} +2 -2
  8. package/dist/index-BCHKDSAB.cjs +1 -0
  9. package/dist/index-Bc2TP6E4.cjs +1 -0
  10. package/dist/index-C8abtcPh.cjs +87 -0
  11. package/dist/index-CBzgTVRc.cjs +1 -0
  12. package/dist/index-CRm-Cd9v.cjs +1 -0
  13. package/dist/index-CTc_dwbb.js +3133 -0
  14. package/dist/index-ChZ6L8qy.js +371 -0
  15. package/dist/index-ClguzCrn.js +131 -0
  16. package/dist/{menu-oGClEGzK.js → index-D0v2_dMz.js} +1945 -1834
  17. package/dist/{index-BT8Pkr84.js → index-D9tWUDyO.js} +8 -6
  18. package/dist/index-DB-XsCH7.cjs +1 -0
  19. package/dist/{index-BvoThyOF.js → index-DBKxwOZZ.js} +2 -2
  20. package/dist/index-DtmWzVIG.cjs +6 -0
  21. package/dist/{index-10n3uNlg.js → index-HDBRQNLs.js} +4 -3
  22. package/dist/index-YSJ2XYuj.cjs +1 -0
  23. package/dist/index-qogZoGJJ.js +351 -0
  24. package/dist/index-sjmLPf8w.cjs +1 -0
  25. package/dist/index-zIb6b0kg.cjs +6 -0
  26. package/dist/index.vue_vue_type_script_setup_true_lang-D0K1veK2.cjs +1 -0
  27. package/dist/index.vue_vue_type_style_index_0_scoped_876d48c6_lang-BWOIM9wH.js +254 -0
  28. package/dist/index.vue_vue_type_style_index_0_scoped_876d48c6_lang-Csg3VsXp.cjs +4 -0
  29. package/dist/{index.vue_vue_type_style_index_0_scoped_dc84a8f7_lang-DG5vph3h.js → index.vue_vue_type_style_index_0_scoped_dc84a8f7_lang-DHffsUIJ.js} +39 -38
  30. package/dist/index.vue_vue_type_style_index_0_scoped_dc84a8f7_lang-DzfJEE_l.cjs +1 -0
  31. package/dist/main-RfdttOpi.js +288 -0
  32. package/dist/main-u6M32FUn.cjs +1 -0
  33. package/dist/menu-BIINB-0Y.js +1013 -0
  34. package/dist/menu-B_Az9K_F.cjs +11 -0
  35. package/dist/{modelComp-CqA1NVfH.js → modelComp-B3sxj_Kp.js} +1 -1
  36. package/dist/modelComp-DAsVXKA0.cjs +1 -0
  37. package/dist/router.d.ts +1 -0
  38. package/dist/ss-component.cjs +1 -0
  39. package/dist/ss-component.css +1 -1
  40. package/dist/ss-component.js +26 -24
  41. package/dist/ss-component2.cjs +1 -0
  42. package/dist/ss-component2.js +5 -0
  43. package/package.json +11 -5
  44. package/dist/_plugin-vue_export-helper-B7R8Jogt.js +0 -524
  45. package/dist/index-CCr_UQBn.js +0 -3749
  46. package/dist/main-BUjoLIJC.js +0 -404
  47. package/dist/ss-component.umd.cjs +0 -115
  48. /package/dist/{ss-component.d.ts → main.d.ts} +0 -0
@@ -0,0 +1,288 @@
1
+ import { ref as _, watch as V, createElementBlock as C, createCommentVNode as I, openBlock as f, Fragment as le, renderList as se, createElementVNode as O, createBlock as Z, toDisplayString as v, resolveDynamicComponent as ue, onMounted as ce, createVNode as A } from "vue";
2
+ import { m as ie, a as me, b as de } from "./index-ClguzCrn.js";
3
+ import { p as E, e as ye, g as fe, a as ge } from "./array-Dsurpc08.js";
4
+ import { u as ee } from "./modelComp-B3sxj_Kp.js";
5
+ import { s as te, u as he } from "./menu-BIINB-0Y.js";
6
+ import { _ as ne } from "./_plugin-vue_export-helper-CHgC5LLL.js";
7
+ import { c as k } from "./cloneDeep-MKlVykeI.js";
8
+ const x = [
9
+ {
10
+ key: "FormName",
11
+ value: "Form"
12
+ },
13
+ {
14
+ key: "TableName",
15
+ value: "Table"
16
+ }
17
+ ], s = [
18
+ {
19
+ key: "FormDirect",
20
+ value: "formFlex"
21
+ },
22
+ {
23
+ key: "Form",
24
+ value: "formContent"
25
+ },
26
+ {
27
+ key: "FormButton",
28
+ value: "formButton"
29
+ },
30
+ {
31
+ key: "TableColumns",
32
+ value: "header"
33
+ },
34
+ {
35
+ key: "TableButton",
36
+ value: "extraButton"
37
+ },
38
+ {
39
+ key: "LineButton",
40
+ value: "rowButton"
41
+ },
42
+ {
43
+ key: "Table",
44
+ value: "tableContents"
45
+ },
46
+ {
47
+ key: "TableIndex",
48
+ value: "tableIndex"
49
+ }
50
+ ], ke = {
51
+ key: 0,
52
+ class: "show-content"
53
+ }, _e = { class: "item-view-group" }, Ce = {
54
+ __name: "index",
55
+ props: {
56
+ content: String,
57
+ jsonContents: Array
58
+ },
59
+ emits: ["change"],
60
+ setup(F, { emit: B }) {
61
+ const e = F, $ = B, h = ee(E), { itemData: p } = te(h), b = _([]), w = _([]), L = (l) => {
62
+ $("change", {
63
+ wholeValue: b.value,
64
+ editValue: l
65
+ });
66
+ }, D = (l) => {
67
+ const g = k(b.value), S = g == null ? void 0 : g.map((c, j) => (j === (l == null ? void 0 : l.index) && (c.compData = l == null ? void 0 : l.contents), c));
68
+ b.value = S;
69
+ };
70
+ V(
71
+ () => p.value,
72
+ () => {
73
+ var l;
74
+ !p.value || ((l = p.value) == null ? void 0 : l.length) === 0 || (w.value = p.value, b.value = p.value);
75
+ },
76
+ { deep: !0, immediate: !0 }
77
+ ), V(
78
+ () => [e == null ? void 0 : e.content, e == null ? void 0 : e.jsonContents],
79
+ () => {
80
+ var g;
81
+ if (((g = e == null ? void 0 : e.jsonContents) == null ? void 0 : g.length) > 0) {
82
+ h.setOriginalData(e == null ? void 0 : e.jsonContents), h.setItemData(e == null ? void 0 : e.jsonContents);
83
+ return;
84
+ }
85
+ if (!(e != null && e.content) || (e == null ? void 0 : e.content) === "") return;
86
+ const l = ye(e == null ? void 0 : e.content);
87
+ h.setOriginalData(l), h.setItemData(l);
88
+ },
89
+ { deep: !0, immediate: !0 }
90
+ );
91
+ const N = (l) => fe(l);
92
+ return (l, g) => {
93
+ var S;
94
+ return ((S = w.value) == null ? void 0 : S.length) > 0 ? (f(), C("div", ke, [
95
+ (f(!0), C(le, null, se(w.value, (c, j) => (f(), C("div", {
96
+ class: "item-content",
97
+ key: j
98
+ }, [
99
+ O("div", _e, v(c.name), 1),
100
+ (f(), Z(ue(N(c.comp)), {
101
+ itemData: c == null ? void 0 : c.compData,
102
+ childItemData: c == null ? void 0 : c.itemChildData,
103
+ key: j,
104
+ onChange: L,
105
+ index: j,
106
+ onContentChange: D
107
+ }, null, 40, ["itemData", "childItemData", "index"]))
108
+ ]))), 128))
109
+ ])) : I("", !0);
110
+ };
111
+ }
112
+ }, pe = /* @__PURE__ */ ne(Ce, [["__scopeId", "data-v-869e6e20"]]), be = { class: "add-model-content" }, we = {
113
+ key: 0,
114
+ class: "model-import-data"
115
+ }, je = { class: "import-button" }, Se = { key: 0 }, xe = {
116
+ key: 1,
117
+ class: "model-operate"
118
+ }, Oe = { class: "model-select" }, Ie = { class: "model-fill" }, Ne = {
119
+ key: 2,
120
+ class: "model-view ssComponent"
121
+ }, Te = {
122
+ __name: "main",
123
+ props: {
124
+ mode: {
125
+ type: String,
126
+ default: "view"
127
+ },
128
+ content: {
129
+ type: String,
130
+ default: ""
131
+ },
132
+ jsonContents: {
133
+ type: Array,
134
+ default: () => []
135
+ },
136
+ showButton: {
137
+ type: Boolean,
138
+ default: !0
139
+ }
140
+ },
141
+ emits: ["change"],
142
+ setup(F, { emit: B }) {
143
+ const e = F, $ = B, h = _(""), p = _([]), b = _(0), w = ee(E);
144
+ he(E);
145
+ const { itemData: L, originalData: D } = te(w), N = _(null), l = _(0), g = _(""), S = () => {
146
+ b.value = window.innerWidth;
147
+ }, c = async (o) => {
148
+ var u;
149
+ const a = (u = k(o == null ? void 0 : o.wholeValue)) == null ? void 0 : u.map((n) => {
150
+ var d;
151
+ return (n == null ? void 0 : n.comp) === "Form" && (n.compData = (d = n.compData) == null ? void 0 : d.map((y) => ((y == null ? void 0 : y.key) === "formContent" && (y.contents = ge(y == null ? void 0 : y.contents)), y))), n;
152
+ });
153
+ $("change", {
154
+ originalContents: D.value,
155
+ currentContents: o == null ? void 0 : o.wholeValue,
156
+ editContent: o == null ? void 0 : o.editValue,
157
+ stringContent: j(k(o == null ? void 0 : o.wholeValue)),
158
+ arrayToContents: a
159
+ });
160
+ }, j = (o) => {
161
+ var u;
162
+ let a = [];
163
+ return (u = k(o)) == null || u.forEach((n) => {
164
+ var d, y;
165
+ x != null && x.find((t) => (t == null ? void 0 : t.value) === (n == null ? void 0 : n.comp)) && a.push(((d = x == null ? void 0 : x.find((t) => (t == null ? void 0 : t.value) === (n == null ? void 0 : n.comp))) == null ? void 0 : d.key) + "=" + n.name + "/r/n"), (y = n == null ? void 0 : n.compData) == null || y.forEach((t) => {
166
+ var M, R, z, W, q, G, H, K, P, Q, U, X;
167
+ if (s != null && s.find((i) => (i == null ? void 0 : i.value) === (t == null ? void 0 : t.key)))
168
+ if (!((M = t == null ? void 0 : t.contents) != null && M.length))
169
+ a.push(((R = s == null ? void 0 : s.find((i) => (i == null ? void 0 : i.value) === (t == null ? void 0 : t.key))) == null ? void 0 : R.key) + "=" + (t.contents === !0 ? '""' : "Vertical") + "/r/n");
170
+ else {
171
+ let i = (z = t == null ? void 0 : t.contents) == null ? void 0 : z[0];
172
+ if (!i) return;
173
+ if (Object.keys(i).includes("label") && Object.keys(i).includes("key") && Object.keys(i).includes("width"))
174
+ if (((q = (W = t.contents) == null ? void 0 : W.filter((m) => m.width !== 1)) == null ? void 0 : q.length) === 0) {
175
+ const m = (G = k(t == null ? void 0 : t.contents)) == null ? void 0 : G.map((r) => ({ [r.label]: r.value }));
176
+ a.push(((H = s == null ? void 0 : s.find((r) => (r == null ? void 0 : r.value) === (t == null ? void 0 : t.key))) == null ? void 0 : H.key) + "=" + JSON.stringify(m) + "/r/n");
177
+ } else {
178
+ let m = [];
179
+ (K = k(t == null ? void 0 : t.contents)) == null || K.reduce((r, J) => {
180
+ var Y;
181
+ return r[J.label] = J.key, ((Y = Object.keys(k(r))) == null ? void 0 : Y.length) >= J.width && (m.push(k(r)), r = {}), r;
182
+ }, {}), a.push(((P = s == null ? void 0 : s.find((r) => (r == null ? void 0 : r.value) === (t == null ? void 0 : t.key))) == null ? void 0 : P.key) + "=" + JSON.stringify(m) + "/r/n");
183
+ }
184
+ else if (Object.keys(i).includes("label")) {
185
+ const m = (Q = k(t == null ? void 0 : t.contents)) == null ? void 0 : Q.map((r) => r.label);
186
+ a.push(((U = s == null ? void 0 : s.find((r) => (r == null ? void 0 : r.value) === (t == null ? void 0 : t.key))) == null ? void 0 : U.key) + "=" + JSON.stringify(m) + "/r/n");
187
+ } else
188
+ a.push(((X = s == null ? void 0 : s.find((m) => (m == null ? void 0 : m.value) === (t == null ? void 0 : t.key))) == null ? void 0 : X.key) + "=" + JSON.stringify(t == null ? void 0 : t.contents) + "/r/n");
189
+ }
190
+ });
191
+ }), JSON.stringify(a);
192
+ }, T = _([]), ae = () => {
193
+ N.value.click();
194
+ }, oe = (o) => {
195
+ const a = o.target.files[0];
196
+ if (!a) return;
197
+ const u = new FileReader();
198
+ u.onload = (n) => {
199
+ try {
200
+ h.value = n.target.result, T.value = re(n.target.result), l.value++;
201
+ } catch (d) {
202
+ console.error("解析失败:", d);
203
+ }
204
+ }, u.onerror = (n) => {
205
+ console.error("文件读取错误:", n);
206
+ }, u.readAsText(a);
207
+ };
208
+ ce(() => {
209
+ window.addEventListener("resize", S);
210
+ }), V(
211
+ () => [e == null ? void 0 : e.content, e == null ? void 0 : e.jsonContents],
212
+ () => {
213
+ h.value = e == null ? void 0 : e.content, p.value = e == null ? void 0 : e.jsonContents;
214
+ },
215
+ { deep: !0, immediate: !0 }
216
+ ), V(
217
+ () => l.value,
218
+ () => {
219
+ var o;
220
+ ((o = T.value) == null ? void 0 : o.length) !== 0 && (w.setOriginalData(T.value), w.setItemData(T.value));
221
+ },
222
+ { deep: !0, immediate: !0 }
223
+ );
224
+ const re = (o) => {
225
+ let a = o.replace(/,/g, ",").replace(/;/g, ";").replace(/:/g, ":");
226
+ a = a.replace(/(\w+)\s*:/g, "$1:"), a = a.replace(/\r\n/g, "").replace(/\n/g, "").replace(/\t/g, "").replace(/\s+/g, " ").trim(), a = a.replace(/,\s*([}\]])/g, "$1"), a = a.replace(/:(\s*)([^"{}\[\],\s]+)(\s*)([,}])/g, ": $2$4");
227
+ try {
228
+ return JSON.parse(a);
229
+ } catch (u) {
230
+ try {
231
+ const d = new Function(`return ${a}`)();
232
+ if (Array.isArray(d) || typeof d == "object")
233
+ return d;
234
+ throw new Error(`解析结果不是有效的数组或对象: ${u}`);
235
+ } catch (n) {
236
+ throw new Error(`无法解析JSON: ${n.message}`);
237
+ }
238
+ }
239
+ };
240
+ return (o, a) => {
241
+ var u;
242
+ return f(), C("div", be, [
243
+ ((u = e == null ? void 0 : e.jsonContents) == null ? void 0 : u.length) === 0 ? (f(), C("div", we, [
244
+ O("div", je, [
245
+ O("input", {
246
+ type: "file",
247
+ ref_key: "fileInput",
248
+ ref: N,
249
+ accept: ".txt",
250
+ onChange: oe,
251
+ style: { display: "none" }
252
+ }, null, 544),
253
+ O("button", {
254
+ onClick: ae,
255
+ class: "import-button-content"
256
+ }, "导入文件"),
257
+ g.value ? (f(), C("span", Se, v(g.value), 1)) : I("", !0)
258
+ ])
259
+ ])) : I("", !0),
260
+ (e == null ? void 0 : e.mode) === "edit" ? (f(), C("div", xe, [
261
+ O("div", Oe, [
262
+ A(ie)
263
+ ]),
264
+ (f(), C("div", {
265
+ class: "model-show",
266
+ key: b.value
267
+ }, [
268
+ A(me)
269
+ ])),
270
+ O("div", Ie, [
271
+ A(de)
272
+ ])
273
+ ])) : I("", !0),
274
+ (e == null ? void 0 : e.mode) === "view" ? (f(), C("div", Ne, [
275
+ (f(), Z(pe, {
276
+ content: h.value,
277
+ onChange: c,
278
+ jsonContents: p.value,
279
+ key: b.value
280
+ }, null, 8, ["content", "jsonContents"]))
281
+ ])) : I("", !0)
282
+ ]);
283
+ };
284
+ }
285
+ }, Ee = /* @__PURE__ */ ne(Te, [["__scopeId", "data-v-b25bde75"]]);
286
+ export {
287
+ Ee as default
288
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),T=require("./index-CRm-Cd9v.cjs"),N=require("./array-DQ6meJk7.cjs"),Q=require("./modelComp-DAsVXKA0.cjs"),I=require("./menu-B_Az9K_F.cjs"),U=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),h=require("./cloneDeep-BH_aXSAH.cjs"),V=[{key:"FormName",value:"Form"},{key:"TableName",value:"Table"}],s=[{key:"FormDirect",value:"formFlex"},{key:"Form",value:"formContent"},{key:"FormButton",value:"formButton"},{key:"TableColumns",value:"header"},{key:"TableButton",value:"extraButton"},{key:"LineButton",value:"rowButton"},{key:"Table",value:"tableContents"},{key:"TableIndex",value:"tableIndex"}],v={key:0,class:"show-content"},ee={class:"item-view-group"},te={__name:"index",props:{content:String,jsonContents:Array},emits:["change"],setup(E,{emit:D}){const t=E,S=D,g=Q.useModelComp(N.pinia),{itemData:p}=I.storeToRefs(g),_=e.ref([]),C=e.ref([]),F=c=>{S("change",{wholeValue:_.value,editValue:c})},x=c=>{const k=h.cloneDeep(_.value),b=k==null?void 0:k.map((i,B)=>(B===(c==null?void 0:c.index)&&(i.compData=c==null?void 0:c.contents),i));_.value=b};e.watch(()=>p.value,()=>{var c;!p.value||((c=p.value)==null?void 0:c.length)===0||(C.value=p.value,_.value=p.value)},{deep:!0,immediate:!0}),e.watch(()=>[t==null?void 0:t.content,t==null?void 0:t.jsonContents],()=>{var k;if(((k=t==null?void 0:t.jsonContents)==null?void 0:k.length)>0){g.setOriginalData(t==null?void 0:t.jsonContents),g.setItemData(t==null?void 0:t.jsonContents);return}if(!(t!=null&&t.content)||(t==null?void 0:t.content)==="")return;const c=N.expandStringToJson(t==null?void 0:t.content);g.setOriginalData(c),g.setItemData(c)},{deep:!0,immediate:!0});const w=c=>N.getComponent(c);return(c,k)=>{var b;return((b=C.value)==null?void 0:b.length)>0?(e.openBlock(),e.createElementBlock("div",v,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(C.value,(i,B)=>(e.openBlock(),e.createElementBlock("div",{class:"item-content",key:B},[e.createElementVNode("div",ee,e.toDisplayString(i.name),1),(e.openBlock(),e.createBlock(e.resolveDynamicComponent(w(i.comp)),{itemData:i==null?void 0:i.compData,childItemData:i==null?void 0:i.itemChildData,key:B,onChange:F,index:B,onContentChange:x},null,40,["itemData","childItemData","index"]))]))),128))])):e.createCommentVNode("",!0)}}},ne=U._export_sfc(te,[["__scopeId","data-v-869e6e20"]]),oe={class:"add-model-content"},ae={key:0,class:"model-import-data"},le={class:"import-button"},re={key:0},ce={key:1,class:"model-operate"},se={class:"model-select"},ue={class:"model-fill"},ie={key:2,class:"model-view ssComponent"},de={__name:"main",props:{mode:{type:String,default:"view"},content:{type:String,default:""},jsonContents:{type:Array,default:()=>[]},showButton:{type:Boolean,default:!0}},emits:["change"],setup(E,{emit:D}){const t=E,S=D,g=e.ref(""),p=e.ref([]),_=e.ref(0),C=Q.useModelComp(N.pinia);I.useMenuState(N.pinia);const{itemData:F,originalData:x}=I.storeToRefs(C),w=e.ref(null),c=e.ref(0),k=e.ref(""),b=()=>{_.value=window.innerWidth},i=async l=>{var u;const a=(u=h.cloneDeep(l==null?void 0:l.wholeValue))==null?void 0:u.map(o=>{var y;return(o==null?void 0:o.comp)==="Form"&&(o.compData=(y=o.compData)==null?void 0:y.map(f=>((f==null?void 0:f.key)==="formContent"&&(f.contents=N.arrayToNumberArray(f==null?void 0:f.contents)),f))),o});S("change",{originalContents:x.value,currentContents:l==null?void 0:l.wholeValue,editContent:l==null?void 0:l.editValue,stringContent:B(h.cloneDeep(l==null?void 0:l.wholeValue)),arrayToContents:a})},B=l=>{var u;let a=[];return(u=h.cloneDeep(l))==null||u.forEach(o=>{var y,f;V!=null&&V.find(n=>(n==null?void 0:n.value)===(o==null?void 0:o.comp))&&a.push(((y=V==null?void 0:V.find(n=>(n==null?void 0:n.value)===(o==null?void 0:o.comp)))==null?void 0:y.key)+"="+o.name+"/r/n"),(f=o==null?void 0:o.compData)==null||f.forEach(n=>{var $,J,A,q,M,R,L,z,W,H,P,G;if(s!=null&&s.find(d=>(d==null?void 0:d.value)===(n==null?void 0:n.key)))if(!(($=n==null?void 0:n.contents)!=null&&$.length))a.push(((J=s==null?void 0:s.find(d=>(d==null?void 0:d.value)===(n==null?void 0:n.key)))==null?void 0:J.key)+"="+(n.contents===!0?'""':"Vertical")+"/r/n");else{let d=(A=n==null?void 0:n.contents)==null?void 0:A[0];if(!d)return;if(Object.keys(d).includes("label")&&Object.keys(d).includes("key")&&Object.keys(d).includes("width"))if(((M=(q=n.contents)==null?void 0:q.filter(m=>m.width!==1))==null?void 0:M.length)===0){const m=(R=h.cloneDeep(n==null?void 0:n.contents))==null?void 0:R.map(r=>({[r.label]:r.value}));a.push(((L=s==null?void 0:s.find(r=>(r==null?void 0:r.value)===(n==null?void 0:n.key)))==null?void 0:L.key)+"="+JSON.stringify(m)+"/r/n")}else{let m=[];(z=h.cloneDeep(n==null?void 0:n.contents))==null||z.reduce((r,O)=>{var K;return r[O.label]=O.key,((K=Object.keys(h.cloneDeep(r)))==null?void 0:K.length)>=O.width&&(m.push(h.cloneDeep(r)),r={}),r},{}),a.push(((W=s==null?void 0:s.find(r=>(r==null?void 0:r.value)===(n==null?void 0:n.key)))==null?void 0:W.key)+"="+JSON.stringify(m)+"/r/n")}else if(Object.keys(d).includes("label")){const m=(H=h.cloneDeep(n==null?void 0:n.contents))==null?void 0:H.map(r=>r.label);a.push(((P=s==null?void 0:s.find(r=>(r==null?void 0:r.value)===(n==null?void 0:n.key)))==null?void 0:P.key)+"="+JSON.stringify(m)+"/r/n")}else a.push(((G=s==null?void 0:s.find(m=>(m==null?void 0:m.value)===(n==null?void 0:n.key)))==null?void 0:G.key)+"="+JSON.stringify(n==null?void 0:n.contents)+"/r/n")}})}),JSON.stringify(a)},j=e.ref([]),X=()=>{w.value.click()},Y=l=>{const a=l.target.files[0];if(!a)return;const u=new FileReader;u.onload=o=>{try{g.value=o.target.result,j.value=Z(o.target.result),c.value++}catch(y){console.error("解析失败:",y)}},u.onerror=o=>{console.error("文件读取错误:",o)},u.readAsText(a)};e.onMounted(()=>{window.addEventListener("resize",b)}),e.watch(()=>[t==null?void 0:t.content,t==null?void 0:t.jsonContents],()=>{g.value=t==null?void 0:t.content,p.value=t==null?void 0:t.jsonContents},{deep:!0,immediate:!0}),e.watch(()=>c.value,()=>{var l;((l=j.value)==null?void 0:l.length)!==0&&(C.setOriginalData(j.value),C.setItemData(j.value))},{deep:!0,immediate:!0});const Z=l=>{let a=l.replace(/,/g,",").replace(/;/g,";").replace(/:/g,":");a=a.replace(/(\w+)\s*:/g,"$1:"),a=a.replace(/\r\n/g,"").replace(/\n/g,"").replace(/\t/g,"").replace(/\s+/g," ").trim(),a=a.replace(/,\s*([}\]])/g,"$1"),a=a.replace(/:(\s*)([^"{}\[\],\s]+)(\s*)([,}])/g,": $2$4");try{return JSON.parse(a)}catch(u){try{const y=new Function(`return ${a}`)();if(Array.isArray(y)||typeof y=="object")return y;throw new Error(`解析结果不是有效的数组或对象: ${u}`)}catch(o){throw new Error(`无法解析JSON: ${o.message}`)}}};return(l,a)=>{var u;return e.openBlock(),e.createElementBlock("div",oe,[((u=t==null?void 0:t.jsonContents)==null?void 0:u.length)===0?(e.openBlock(),e.createElementBlock("div",ae,[e.createElementVNode("div",le,[e.createElementVNode("input",{type:"file",ref_key:"fileInput",ref:w,accept:".txt",onChange:Y,style:{display:"none"}},null,544),e.createElementVNode("button",{onClick:X,class:"import-button-content"},"导入文件"),k.value?(e.openBlock(),e.createElementBlock("span",re,e.toDisplayString(k.value),1)):e.createCommentVNode("",!0)])])):e.createCommentVNode("",!0),(t==null?void 0:t.mode)==="edit"?(e.openBlock(),e.createElementBlock("div",ce,[e.createElementVNode("div",se,[e.createVNode(T.modelSelect)]),(e.openBlock(),e.createElementBlock("div",{class:"model-show",key:_.value},[e.createVNode(T.modelShow)])),e.createElementVNode("div",ue,[e.createVNode(T.modelFill)])])):e.createCommentVNode("",!0),(t==null?void 0:t.mode)==="view"?(e.openBlock(),e.createElementBlock("div",ie,[(e.openBlock(),e.createBlock(ne,{content:g.value,onChange:i,jsonContents:p.value,key:_.value},null,8,["content","jsonContents"]))])):e.createCommentVNode("",!0)])}}},me=U._export_sfc(de,[["__scopeId","data-v-b25bde75"]]);exports.default=me;