@chamn/engine 0.0.44 → 0.0.45

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.
package/dist/index.js CHANGED
@@ -123,7 +123,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
123
123
  data struct format is invalidate`);return o.message||n?console.warn(`${o.message||n}
124
124
  originData: ${JSON.stringify(t)}`):console.warn(`${JSON.stringify(t)}
125
125
  data struct format is invalidate`),o},Hd=e=>{const{data:t,message:n,throwError:r,dataStruct:o}=e;return $3(({data:a})=>{try{return T1(a,o),{isValidate:!0}}catch(i){let s=i;return i instanceof $1&&(s=i.failures().map(l=>`【${l.path.join(".")}】: ${l.message}
126
- `)),{isValidate:!1,message:s,error:i}}})({data:t,message:n,throwError:r})};var da=(e=>(e.ROOT_CONTAINER="RootContainer",e))(da||{});const T3=$e({type:At(rn.FUNCTION),value:ne()}),P3=Ld(P1(Xo,["componentName"]),$e({componentName:At("RootContainer")}));function k3(e){return{all:e=e||new Map,on:function(t,n){var r=e.get(t);r?r.push(n):e.set(t,[n])},off:function(t,n){var r=e.get(t);r&&(n?r.splice(r.indexOf(n)>>>0,1):e.set(t,[]))},emit:function(t,n){var r=e.get(t);r&&r.slice().map(function(o){o(n)}),(r=e.get("*"))&&r.slice().map(function(o){o(t,n)})}}}const Di=k3(),N3=(e,t)=>{const n={...e,value:[]},r=e.value;let o=new Kr([]);return t&&(o=t.materialsMode||new Kr([])),r&&(ot(r)?n.value=r.map(a=>new Qe(a,{parent:t,materials:o})):It(r)&&n.value.push(new Qe(r,{parent:t,materials:o}))),n};class Yo{constructor(t,n){ge(this,"nodeType","SLOT"),ge(this,"rawData"),ge(this,"parent"),ge(this,"emitter",Di),ge(this,"data"),ge(this,"id"),ge(this,"materialsMode"),this.parent=(n==null?void 0:n.parent)||null,this.rawData=t;const r=(n==null?void 0:n.materials)||new Kr([]);this.materialsMode=r,this.id=Vn(),this.data=N3(t,this)}get value(){return this.data}export(t){const n=this.data,r=o=>{if(o instanceof Qe)return o.export(t);if(It(o)){const a={};return Object.keys(o||{}).forEach(i=>{a[i]=r(o[i])}),a}return ot(o)?o.map(a=>r(a)):(t==="design"&&delete o.id,o)};return r(n)}}const A1=e=>{let t=[];return e.forEach(n=>{const r=n;r.type?r.type===Ju.SINGLE?t.push(r.content):r.type===Ju.GROUP&&(t=[...t,...A1(r.content)]):t.push(n)}),t},Qu=(e,t,n)=>{if(e.type)return e.type===rn.SLOT?new Yo(e,{parent:t,materials:n}):e;if(It(e)){const r={};return Object.keys(e).forEach(o=>{r[o]=Zu(e[o],t,n)}),r}else return Array.isArray(e)?e.map(r=>Qu(r,t,n)):e},Zu=(e,t,n)=>It(e)?Qu(e,t,n):ot(e)?e.map(r=>Qu(r,t,n)):e;let Jo=class j1{constructor(t,n,r){ge(this,"nodeType","PROP"),ge(this,"rawData"),ge(this,"parent"),ge(this,"emitter",Di),ge(this,"data"),ge(this,"name"),ge(this,"materialsMode");const o=(r==null?void 0:r.materials)||new Kr([]);this.materialsMode=o,this.parent=r==null?void 0:r.parent,this.rawData=n,this.name=t,this.data=Zu(n,this,o)}isIncludeSlot(){return!1}isIncludeExpression(){return!1}get value(){return this.data}updateValue(t){const n=this.data;this.data=Zu(t??n,this,this.materialsMode),this.emitter.emit("onPropChange",{value:this.data,preValue:n,node:this}),this.parent&&!(this.parent instanceof Yo)&&this.emitter.emit("onNodeChange",{value:this.parent.value,preValue:this.parent.value,node:this.parent})}get material(){const t=this.parent;if(t instanceof Qe){const n=t.material;return A1((n==null?void 0:n.value.props)||[]).find(r=>r.name===this.name)}else return null}export(t){const n=this.data,r=o=>{if(o instanceof j1||o instanceof Yo||o instanceof Qe)return o.export(t);if(ot(o))return o.map(a=>r(a));if(It(o)){const a={};return Object.keys(o||{}).forEach(i=>{a[i]=r(o[i])}),a}return o};return r(n)}};const M3=e=>{if(typeof e=="string")return!0;Hd({data:e,dataStruct:Xo,throwError:!1})},Dg=(e,t,n=new Kr([]))=>{if(typeof e=="string")return e;const r={...e,id:e.id??Vn(),children:[],props:{},methods:e.methods||[],configure:E1(e.configure||{},{propsSetter:{},advanceSetter:{}})},o=Object.keys(e.props||{});return o.length&&o.forEach(a=>{var i;const s=(i=e.props)==null?void 0:i[a];if(s instanceof Jo){r.props[a]=s;return}r.props[a]=new Jo(a,s||"",{parent:t,materials:n})}),e.children&&(Array.isArray(e.children)?r.children=e.children.map(a=>{if(a instanceof Qe)return a;if(It(a)){const i=a;return new Qe(i,{parent:t,materials:n})}else return a}):(e.children instanceof Qe&&(r.children=[e.children]),r.children=[new Qe(e.children,{parent:t,materials:n})])),r};class Qe{constructor(t,n){ge(this,"nodeType","NODE"),ge(this,"rawData"),ge(this,"data"),ge(this,"emitter",Di),ge(this,"parent"),ge(this,"materialsModel"),ge(this,"listenerHandle"),ge(this,"onChangeCbQueue"),this.rawData=JSON.parse(JSON.stringify(t)),M3(t);const r=(n==null?void 0:n.materials)||new Kr([]);this.parent=(n==null?void 0:n.parent)||null,this.materialsModel=r,this.data=Dg(t,this,r),this.listenerHandle=[],this.onChangeCbQueue=[],this.registerListener()}registerListener(){const t=n=>{const{node:r}=n;r===this&&r.id===this.id&&this.onChangeCbQueue.forEach(o=>o(n))};this.emitter.on("onNodeChange",t),this.listenerHandle.push(()=>{this.emitter.off("onNodeChange",t)})}onChange(t){return this.onChangeCbQueue.push(t),()=>{this.onChangeCbQueue=this.onChangeCbQueue.filter(n=>n!==t)}}destroy(){this.listenerHandle.forEach(t=>t())}get id(){return this.data.id}get value(){return this.data}clone(t){const n={...this.export("design"),id:t||Vn()};return new Qe(n,{materials:this.materialsModel})}updateWithPlainObj(t){const n={...this.data,...t};return this.data=Dg(n,this),n}updateValue(t){const n=this.data,r=this.updateWithPlainObj(t);this.emitter.emit("onNodeChange",{value:r,preValue:n,node:this})}contains(t){return Ud(this,t)}get props(){return this.data.props}get material(){const t=this.materialsModel;return t==null?void 0:t.findByComponentName(this.data.componentName)}getPlainProps(){const t=this.data,n={};return Object.keys(t.props||{}).forEach(r=>{n[r]=t.props[r].export("design")}),n}getMaterialConfig(t){var n;return this.data.configure[t]!==void 0?this.data.configure.isContainer:(n=this.material)==null?void 0:n.value.isContainer}isContainer(){return this.getMaterialConfig("isContainer")}export(t){var n;const r=this.data;if(typeof r=="string")return r;const o={};Object.keys(r.props||{}).forEach(u=>{o[u]=r.props[u].export(t)});const a=(n=r.children)==null?void 0:n.map(u=>u instanceof Qe?u.export(t):u),i=r.configure||{},s=i.propsSetter||{},l={};Object.keys(s).forEach(u=>{const f=s1(s,u,!1);f&&(l[u]=f)}),i.propsSetter=l,this.material&&this.materialsModel.usedMaterials.push(this.material);let c={...r,configure:i,props:o,children:a,condition:r.condition};return t==="design"&&delete c.id,c=Vd(c),c}}const Ig=(e,t,n)=>{const r={...e,id:Vn(),props:{},componentName:da.ROOT_CONTAINER,children:[],methods:e.methods||[],configure:E1(e.configure||{},{propsSetter:{},advanceSetter:{}})};let o=[];ot(e.children)?o=e.children.map(i=>i instanceof Qe?i:It(i)?new Qe(i,{parent:t,materials:n}):i):e.children instanceof Qe?o.push(e.children):e.children&&It(e.children)&&o.push(new Qe(e.children,{parent:t,materials:n}));const a=Object.keys(e.props||{});return a.length&&a.forEach(i=>{var s;const l=(s=e.props)==null?void 0:s[i];l instanceof Jo?r.props[i]=l:r.props[i]=new Jo(i,l||"",{parent:t,materials:n})}),r.children=o,r};class wi{constructor(t,{parent:n,materials:r}){ge(this,"rawData"),ge(this,"data"),ge(this,"nodeType",da.ROOT_CONTAINER),ge(this,"emitter",Di),ge(this,"materialsModel"),ge(this,"listenerHandle"),ge(this,"onChangeCbQueue"),ge(this,"parent"),this.materialsModel=r,this.rawData=JSON.parse(JSON.stringify(t)),this.data=Ig(t,this,r),this.listenerHandle=[],this.onChangeCbQueue=[],this.registerListener(),this.parent=n}registerListener(){const t=n=>{const{node:r}=n;r===this&&r.id===this.id&&this.onChangeCbQueue.forEach(o=>o(n))};this.emitter.on("onNodeChange",t),this.listenerHandle.push(()=>{this.emitter.off("onNodeChange",t)})}onChange(t){return this.onChangeCbQueue.push(t),()=>{this.onChangeCbQueue=this.onChangeCbQueue.filter(n=>n!==t)}}get id(){return this.data.id}get value(){return this.data}get props(){return this.data.props}get material(){const t=this.materialsModel;return t==null?void 0:t.findByComponentName(this.data.componentName)}updateWithPlainObj(t){const n={...this.data,...t};return this.data=Ig(n,this,this.materialsModel),n}updateValue(t){const n=this.data;this.updateWithPlainObj(t),this.emitter.emit("onNodeChange",{value:this.data,preValue:n,node:this})}contains(t){return Ud(this,t)}getMaterialConfig(t){var n;return this.data.configure[t]!==void 0?this.data.configure.isContainer:(n=this.material)==null?void 0:n.value.isContainer}isContainer(){return this.getMaterialConfig("isContainer")}export(t=Fd.SAVE){var n;const r=this.data,o={};Object.keys(r.props||{}).forEach(l=>{o[l]=r.props[l].export(t)});const a=((n=r.children)==null?void 0:n.map(l=>{var c;return(c=l==null?void 0:l.export)==null?void 0:c.call(l,t)}))||[],i={...r,props:o,children:a.filter(l=>l),condition:r.condition};let s=R1(i,["id"]);return s=Vd(s),s}getPlainProps(){const t=this.data,n={};return Object.keys(t.props||{}).forEach(r=>{n[r]=t.props[r].export("design")}),n}destroy(){this.listenerHandle.forEach(t=>t())}clone(t){const n={...this.export("design"),id:t||Vn()};return new wi(n,{materials:this.materialsModel,parent:null})}}const Mr=e=>(e==null?void 0:e.type)===rn.EXPRESSION,A3=e=>(e==null?void 0:e.type)===rn.FUNCTION,Vn=()=>Math.random().toString(32).slice(3,9),j3=e=>(e==null?void 0:e.nodeType)==="NODE",Rc=e=>(e==null?void 0:e.nodeType)==="PROP",D3=e=>(e==null?void 0:e.nodeType)==="SLOT",Vd=e=>r3(e,t=>It(t)?!Object.keys(t).length:ot(t)?!t.length:!t);function I3(e,t){const n=[e];for(;n.length;){const r=n.shift();if(r&&t(r))return r;const o=(r==null?void 0:r.props)||{},a=s=>{if(s instanceof Qe){n.push(s);return}if(s instanceof Yo&&a(s.value.value),s instanceof Jo){a(s.value);return}if(It(s)){const l=s;Object.keys(l).forEach(c=>{a(l[c])});return}if(ot(s)){s.forEach(l=>{a(l)});return}};a(o);const i=(r==null?void 0:r.value.children.filter(s=>s instanceof Qe))||[];n.push(...i)}}function Ud(e,t){return I3(e,n=>n.id===t)}const L3=e=>{const t=y1(e),n=t.snippets;return delete t.snippets,t.snippets=n.map(r=>({...t,...r,id:r.id||`${e.componentName}-${Vn()}`,title:r.title||e.title,category:r.category||e.category,tags:[...r.tags||[],...e.tags||[]],groupName:r.groupName||e.groupName,snapshot:r.snapshot||e.icon,snapshotText:r.snapshotText,schema:{...r.schema,componentName:r.schema.componentName||e.componentName}})),t};class B3{constructor(t){ge(this,"rawData"),ge(this,"data"),this.rawData=t,this.data=L3(t)}get value(){return this.data}get rawValue(){return this.rawData}get componentName(){return this.data.componentName}get snippets(){return this.data.snippets}getSnippetById(t){return this.data.snippets.find(n=>n.id===t)}}const $c=e=>{if(!ot(e))throw new Error("Materials must be a array");return e.map(t=>new B3(t))},F3=e=>{e==null||e.forEach(t=>{Hd({data:t,dataStruct:R3,throwError:!1})})};class Kr{constructor(t){ge(this,"rawData"),ge(this,"data"),ge(this,"usedMaterials",[]),this.rawData=t,F3(t),this.data=$c(t)}addMaterials(t){const n=$c(t),r=[],o=this.data.map(i=>{const s=n.findIndex(l=>l.componentName===i.componentName);return s>=0?(r.push(s),n[s]):i}),a=n.filter((i,s)=>r.includes(s));this.data=[...o,...a]}replaceMaterials(t){const n=$c(t);this.data=[...n]}removeMaterial(t){const n=this.data.filter(r=>!t.includes(r.componentName));this.data=n}findByComponentName(t){return this.data.find(n=>n.componentName===t)}findSnippetById(t){const n=[...this.data];let r=null;for(;!r&&n.length;){const o=n.pop();r=o==null?void 0:o.getSnippetById(t)}return r}getAllSnippets(){const t=this.data.reduce((a,i)=>(a.push(...i.snippets),a),[]),n=[],r={default:[]};t.forEach(a=>{const i=a.groupName||"default";n.includes(i)||(n.push(i),r[i]=[]),r[i].push(a)});let o=[];return n.forEach(a=>{const i=["default"],s={default:[]},l=r[a];if(l.length!==0){l.forEach(f=>{const d=f.category||"default";i.includes(d)||(i.push(d),s[d]=[]),s[d].push(f)});const c=[];i.forEach(f=>{s[f].length&&c.push({name:f,list:s[f]})});const u={name:a,list:c};o.push(u)}}),o=o.sort((a,i)=>(a.name||"")>(i.name||"")?1:-1),o}get value(){return this.data}get rawValue(){return this.rawData}}const z3=$e({version:ne(),name:ne(),css:te(ne()),renderType:te(jt([At("COMPONENT"),At("PAGE")])),loadType:te(Ye()),lifecycle:te(Ye()),props:te(Ye()),methods:te(tt(T3)),componentsMeta:tt(Ld($e({componentName:ne()}),Bd)),thirdLibs:te(y3),componentsTree:P3,assets:te(tt(Ye()))}),D1=e=>(Hd({data:e,dataStruct:z3,throwError:!1}),e),Tc=(e,t,n)=>({...e,componentsTree:new wi(e.componentsTree,{parent:t,materials:n})});class ol{constructor(t,n){ge(this,"nodeType","PAGE"),ge(this,"rawData"),ge(this,"emitter",Di),ge(this,"data"),ge(this,"parent"),ge(this,"materialsModel"),ge(this,"assetPackagesList"),D1(t),this.rawData=JSON.parse(JSON.stringify(t)),this.materialsModel=new Kr((n==null?void 0:n.materials)||[]),this.data=Tc(t,this,this.materialsModel),this.assetPackagesList=[...(n==null?void 0:n.assetPackagesList)||[],...this.data.assets||[]]}updatePage(t){const n=this.data;this.rawData=JSON.parse(JSON.stringify(t)),this.data=Tc(t,this,this.materialsModel),this.emitter.emit("onPageChange",{value:this.data,preValue:n,node:this})}reloadPage(t){const n=this.data;this.rawData=JSON.parse(JSON.stringify(t)),this.data=Tc(t,this,this.materialsModel),this.emitter.emit("onReloadPage",{value:this.data,preValue:n,node:this})}get value(){return this.data}getNode(t){if(!t)return;const n=this.data.componentsTree;return Ud(n,t)}addNode(t,n,r="AFTER"){var o;if(r==="AFTER"||r==="BEFORE"){const a=n.parent;if(a===null&&n instanceof wi)return console.warn("Not found parent node"),!1;if(a instanceof Jo)return console.warn("CProp can not add node"),!1;if(a instanceof Yo){const s=a.value.value,l=s.findIndex(c=>c===n)??-1;return l>=0?(r==="BEFORE"?s.splice(l,0,t):s.splice(l+1,0,t),t.parent=a,(o=a.parent)==null||o.updateValue(),!0):!1}if(a instanceof ol)return!1;const i=(a==null?void 0:a.value.children.findIndex(s=>s===n))??-1;return i>=0?(r==="BEFORE"?a==null||a.value.children.splice(i,0,t):a==null||a.value.children.splice(i+1,0,t),t.parent=a,a==null||a.updateValue(),!0):(console.warn("Not found target node"),!1)}if(r==="CHILD_START")return n.value.children.unshift(t),t.parent=n,n.updateValue(),!0;if(r==="CHILD_END")return n.value.children.push(t),t.parent=n,n.updateValue(),!0;if(It(r)){const a=r;if(a.type==="CHILD"){const i=a.pos,s=a.index||0;return i==="BEFORE"?n==null||n.value.children.splice(s,0,t):n==null||n.value.children.splice(s+1,0,t),t.parent=n,n.updateValue(),!0}else console.warn("Can not parse pos obj")}return!1}createNode(t){return delete t.id,new Qe(t,{parent:null,materials:this.materialsModel})}addNodeById(t,n,r="AFTER"){const o=this.getNode(n);return o?this.addNode(t,o,r):(console.warn(`Not find a node by ${n}, pls check it`),!1)}copyNode(t){const n=t.export("design");n.id=Vn();const r=new Qe(n,{parent:t.parent,materials:this.materialsModel});return this.addNode(r,t,"AFTER"),r}copyNodeById(t){const n=this.getNode(t);return n&&n instanceof Qe?this.copyNode(n):!1}moveNode(t,n,r){this.deleteNode(t);let o=n;return["AFTER","BEFORE"].includes(r)&&(o=n.parent),t.parent=o,this.addNode(t,n,r)}moveNodeById(t,n,r){const o=this.getNode(t),a=this.getNode(n);return o&&a&&o instanceof Qe&&a instanceof Qe?this.moveNode(o,a,r):!1}deleteNode(t){var n;const r=t.parent;if(!r)throw new Error("parent node is null or undefined, pls check it");if(r instanceof Yo){const o=r.value.value,a=o.findIndex(s=>s===t),i=o[a];return o.splice(a,1),(n=r.parent)==null||n.updateValue(),i}if(r instanceof Qe||r instanceof wi){const o=r.value.children,a=o.findIndex(s=>s===t),i=o[a];return o.splice(a,1),r.updateValue(),i}}deleteNodeById(t){const n=this.getNode(t);if(n)return this.deleteNode(n)}export(t=Fd.SAVE){var n;const r=this.data.componentsTree.export(t),o=this.assetPackagesList,a=[],i=this.materialsModel.usedMaterials.map(l=>{const c=o.find(u=>{var f;return u.package===((f=l.value.npm)==null?void 0:f.package)});return c&&a.push(c),{componentName:l.componentName,...y1(l.value.npm||{})}}).filter(l=>l.componentName&&l.package&&l.version?!0:(console.warn(`${l} not a valid material info`),!1));this.materialsModel.usedMaterials=[];let s={...this.data,componentsTree:Vd(r),componentsMeta:i,thirdLibs:this.data.thirdLibs,assets:[]};return(n=this.data.thirdLibs)==null||n.forEach(l=>{const c=o.find(u=>l.package===u.package);c&&a.push(c)}),s.assets=u3(a,l=>l.package),s=R1(s,["id"]),JSON.parse(JSON.stringify(s))}getRootNode(){return this.data.componentsTree}}da.ROOT_CONTAINER;var H3=typeof global=="object"&&global&&global.Object===Object&&global;const I1=H3;var V3=typeof self=="object"&&self&&self.Object===Object&&self,U3=I1||V3||Function("return this")();const ha=U3;var W3=ha.Symbol;const Qo=W3;var L1=Object.prototype,G3=L1.hasOwnProperty,K3=L1.toString,Ba=Qo?Qo.toStringTag:void 0;function q3(e){var t=G3.call(e,Ba),n=e[Ba];try{e[Ba]=void 0;var r=!0}catch{}var o=K3.call(e);return r&&(t?e[Ba]=n:delete e[Ba]),o}var X3=Object.prototype,Y3=X3.toString;function J3(e){return Y3.call(e)}var Q3="[object Null]",Z3="[object Undefined]",Lg=Qo?Qo.toStringTag:void 0;function Ii(e){return e==null?e===void 0?Z3:Q3:Lg&&Lg in Object(e)?q3(e):J3(e)}function pa(e){return e!=null&&typeof e=="object"}var e6="[object Symbol]";function t6(e){return typeof e=="symbol"||pa(e)&&Ii(e)==e6}function n6(e,t){for(var n=-1,r=e==null?0:e.length,o=Array(r);++n<r;)o[n]=t(e[n],n,e);return o}var r6=Array.isArray;const Zo=r6;var o6=1/0,Bg=Qo?Qo.prototype:void 0,Fg=Bg?Bg.toString:void 0;function B1(e){if(typeof e=="string")return e;if(Zo(e))return n6(e,B1)+"";if(t6(e))return Fg?Fg.call(e):"";var t=e+"";return t=="0"&&1/e==-o6?"-0":t}function ro(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}function F1(e){return e}var a6="[object AsyncFunction]",i6="[object Function]",s6="[object GeneratorFunction]",l6="[object Proxy]";function Wd(e){if(!ro(e))return!1;var t=Ii(e);return t==i6||t==s6||t==a6||t==l6}var c6=ha["__core-js_shared__"];const Pc=c6;var zg=function(){var e=/[^.]+$/.exec(Pc&&Pc.keys&&Pc.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function u6(e){return!!zg&&zg in e}var f6=Function.prototype,d6=f6.toString;function h6(e){if(e!=null){try{return d6.call(e)}catch{}try{return e+""}catch{}}return""}var p6=/[\\^$.*+?()[\]{}|]/g,g6=/^\[object .+?Constructor\]$/,v6=Function.prototype,m6=Object.prototype,b6=v6.toString,y6=m6.hasOwnProperty,x6=RegExp("^"+b6.call(y6).replace(p6,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function w6(e){if(!ro(e)||u6(e))return!1;var t=Wd(e)?x6:g6;return t.test(h6(e))}function S6(e,t){return e==null?void 0:e[t]}function Gd(e,t){var n=S6(e,t);return w6(n)?n:void 0}var Hg=Object.create,C6=function(){function e(){}return function(t){if(!ro(t))return{};if(Hg)return Hg(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();const _6=C6;function O6(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function E6(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t}var R6=800,$6=16,T6=Date.now;function P6(e){var t=0,n=0;return function(){var r=T6(),o=$6-(r-n);if(n=r,o>0){if(++t>=R6)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function k6(e){return function(){return e}}var N6=function(){try{var e=Gd(Object,"defineProperty");return e({},"",{}),e}catch{}}();const al=N6;var M6=al?function(e,t){return al(e,"toString",{configurable:!0,enumerable:!1,value:k6(t),writable:!0})}:F1;const A6=M6;var j6=P6(A6);const D6=j6;var I6=9007199254740991,L6=/^(?:0|[1-9]\d*)$/;function z1(e,t){var n=typeof e;return t=t??I6,!!t&&(n=="number"||n!="symbol"&&L6.test(e))&&e>-1&&e%1==0&&e<t}function Kd(e,t,n){t=="__proto__"&&al?al(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function Bl(e,t){return e===t||e!==e&&t!==t}var B6=Object.prototype,F6=B6.hasOwnProperty;function z6(e,t,n){var r=e[t];(!(F6.call(e,t)&&Bl(r,n))||n===void 0&&!(t in e))&&Kd(e,t,n)}function H6(e,t,n,r){var o=!n;n||(n={});for(var a=-1,i=t.length;++a<i;){var s=t[a],l=r?r(n[s],e[s],s,n,e):void 0;l===void 0&&(l=e[s]),o?Kd(n,s,l):z6(n,s,l)}return n}var Vg=Math.max;function V6(e,t,n){return t=Vg(t===void 0?e.length-1:t,0),function(){for(var r=arguments,o=-1,a=Vg(r.length-t,0),i=Array(a);++o<a;)i[o]=r[t+o];o=-1;for(var s=Array(t+1);++o<t;)s[o]=r[o];return s[t]=n(i),O6(e,this,s)}}function U6(e,t){return D6(V6(e,t,F1),e+"")}var W6=9007199254740991;function H1(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=W6}function qd(e){return e!=null&&H1(e.length)&&!Wd(e)}function G6(e,t,n){if(!ro(n))return!1;var r=typeof t;return(r=="number"?qd(n)&&z1(t,n.length):r=="string"&&t in n)?Bl(n[t],e):!1}function K6(e){return U6(function(t,n){var r=-1,o=n.length,a=o>1?n[o-1]:void 0,i=o>2?n[2]:void 0;for(a=e.length>3&&typeof a=="function"?(o--,a):void 0,i&&G6(n[0],n[1],i)&&(a=o<3?void 0:a,o=1),t=Object(t);++r<o;){var s=n[r];s&&e(t,s,r,a)}return t})}var q6=Object.prototype;function V1(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||q6;return e===n}function X6(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}var Y6="[object Arguments]";function Ug(e){return pa(e)&&Ii(e)==Y6}var U1=Object.prototype,J6=U1.hasOwnProperty,Q6=U1.propertyIsEnumerable,Z6=Ug(function(){return arguments}())?Ug:function(e){return pa(e)&&J6.call(e,"callee")&&!Q6.call(e,"callee")};const ef=Z6;function e4(){return!1}var W1=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Wg=W1&&typeof module=="object"&&module&&!module.nodeType&&module,t4=Wg&&Wg.exports===W1,Gg=t4?ha.Buffer:void 0,n4=Gg?Gg.isBuffer:void 0,r4=n4||e4;const G1=r4;var o4="[object Arguments]",a4="[object Array]",i4="[object Boolean]",s4="[object Date]",l4="[object Error]",c4="[object Function]",u4="[object Map]",f4="[object Number]",d4="[object Object]",h4="[object RegExp]",p4="[object Set]",g4="[object String]",v4="[object WeakMap]",m4="[object ArrayBuffer]",b4="[object DataView]",y4="[object Float32Array]",x4="[object Float64Array]",w4="[object Int8Array]",S4="[object Int16Array]",C4="[object Int32Array]",_4="[object Uint8Array]",O4="[object Uint8ClampedArray]",E4="[object Uint16Array]",R4="[object Uint32Array]",Ue={};Ue[y4]=Ue[x4]=Ue[w4]=Ue[S4]=Ue[C4]=Ue[_4]=Ue[O4]=Ue[E4]=Ue[R4]=!0;Ue[o4]=Ue[a4]=Ue[m4]=Ue[i4]=Ue[b4]=Ue[s4]=Ue[l4]=Ue[c4]=Ue[u4]=Ue[f4]=Ue[d4]=Ue[h4]=Ue[p4]=Ue[g4]=Ue[v4]=!1;function $4(e){return pa(e)&&H1(e.length)&&!!Ue[Ii(e)]}function T4(e){return function(t){return e(t)}}var K1=typeof exports=="object"&&exports&&!exports.nodeType&&exports,ni=K1&&typeof module=="object"&&module&&!module.nodeType&&module,P4=ni&&ni.exports===K1,kc=P4&&I1.process,k4=function(){try{var e=ni&&ni.require&&ni.require("util").types;return e||kc&&kc.binding&&kc.binding("util")}catch{}}();const Kg=k4;var qg=Kg&&Kg.isTypedArray,N4=qg?T4(qg):$4;const q1=N4;var M4=Object.prototype,A4=M4.hasOwnProperty;function j4(e,t){var n=Zo(e),r=!n&&ef(e),o=!n&&!r&&G1(e),a=!n&&!r&&!o&&q1(e),i=n||r||o||a,s=i?X6(e.length,String):[],l=s.length;for(var c in e)(t||A4.call(e,c))&&!(i&&(c=="length"||o&&(c=="offset"||c=="parent")||a&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||z1(c,l)))&&s.push(c);return s}function D4(e,t){return function(n){return e(t(n))}}function I4(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}var L4=Object.prototype,B4=L4.hasOwnProperty;function F4(e){if(!ro(e))return I4(e);var t=V1(e),n=[];for(var r in e)r=="constructor"&&(t||!B4.call(e,r))||n.push(r);return n}function X1(e){return qd(e)?j4(e,!0):F4(e)}var z4=Gd(Object,"create");const Si=z4;function H4(){this.__data__=Si?Si(null):{},this.size=0}function V4(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var U4="__lodash_hash_undefined__",W4=Object.prototype,G4=W4.hasOwnProperty;function K4(e){var t=this.__data__;if(Si){var n=t[e];return n===U4?void 0:n}return G4.call(t,e)?t[e]:void 0}var q4=Object.prototype,X4=q4.hasOwnProperty;function Y4(e){var t=this.__data__;return Si?t[e]!==void 0:X4.call(t,e)}var J4="__lodash_hash_undefined__";function Q4(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Si&&t===void 0?J4:t,this}function qr(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}qr.prototype.clear=H4;qr.prototype.delete=V4;qr.prototype.get=K4;qr.prototype.has=Y4;qr.prototype.set=Q4;function Z4(){this.__data__=[],this.size=0}function Fl(e,t){for(var n=e.length;n--;)if(Bl(e[n][0],t))return n;return-1}var ej=Array.prototype,tj=ej.splice;function nj(e){var t=this.__data__,n=Fl(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():tj.call(t,n,1),--this.size,!0}function rj(e){var t=this.__data__,n=Fl(t,e);return n<0?void 0:t[n][1]}function oj(e){return Fl(this.__data__,e)>-1}function aj(e,t){var n=this.__data__,r=Fl(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}function ur(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}ur.prototype.clear=Z4;ur.prototype.delete=nj;ur.prototype.get=rj;ur.prototype.has=oj;ur.prototype.set=aj;var ij=Gd(ha,"Map");const Y1=ij;function sj(){this.size=0,this.__data__={hash:new qr,map:new(Y1||ur),string:new qr}}function lj(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function zl(e,t){var n=e.__data__;return lj(t)?n[typeof t=="string"?"string":"hash"]:n.map}function cj(e){var t=zl(this,e).delete(e);return this.size-=t?1:0,t}function uj(e){return zl(this,e).get(e)}function fj(e){return zl(this,e).has(e)}function dj(e,t){var n=zl(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}function ga(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}ga.prototype.clear=sj;ga.prototype.delete=cj;ga.prototype.get=uj;ga.prototype.has=fj;ga.prototype.set=dj;function J1(e){return e==null?"":B1(e)}var hj=D4(Object.getPrototypeOf,Object);const Q1=hj;var pj="[object Object]",gj=Function.prototype,vj=Object.prototype,Z1=gj.toString,mj=vj.hasOwnProperty,bj=Z1.call(Object);function ea(e){if(!pa(e)||Ii(e)!=pj)return!1;var t=Q1(e);if(t===null)return!0;var n=mj.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&Z1.call(n)==bj}function yj(e,t,n){var r=-1,o=e.length;t<0&&(t=-t>o?0:o+t),n=n>o?o:n,n<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var a=Array(o);++r<o;)a[r]=e[r+t];return a}function xj(e,t,n){var r=e.length;return n=n===void 0?r:n,!t&&n>=r?e:yj(e,t,n)}var wj="\\ud800-\\udfff",Sj="\\u0300-\\u036f",Cj="\\ufe20-\\ufe2f",_j="\\u20d0-\\u20ff",Oj=Sj+Cj+_j,Ej="\\ufe0e\\ufe0f",Rj="\\u200d",$j=RegExp("["+Rj+wj+Oj+Ej+"]");function ex(e){return $j.test(e)}function Tj(e){return e.split("")}var tx="\\ud800-\\udfff",Pj="\\u0300-\\u036f",kj="\\ufe20-\\ufe2f",Nj="\\u20d0-\\u20ff",Mj=Pj+kj+Nj,Aj="\\ufe0e\\ufe0f",jj="["+tx+"]",tf="["+Mj+"]",nf="\\ud83c[\\udffb-\\udfff]",Dj="(?:"+tf+"|"+nf+")",nx="[^"+tx+"]",rx="(?:\\ud83c[\\udde6-\\uddff]){2}",ox="[\\ud800-\\udbff][\\udc00-\\udfff]",Ij="\\u200d",ax=Dj+"?",ix="["+Aj+"]?",Lj="(?:"+Ij+"(?:"+[nx,rx,ox].join("|")+")"+ix+ax+")*",Bj=ix+ax+Lj,Fj="(?:"+[nx+tf+"?",tf,rx,ox,jj].join("|")+")",zj=RegExp(nf+"(?="+nf+")|"+Fj+Bj,"g");function Hj(e){return e.match(zj)||[]}function Vj(e){return ex(e)?Hj(e):Tj(e)}function Uj(e){return function(t){t=J1(t);var n=ex(t)?Vj(t):void 0,r=n?n[0]:t.charAt(0),o=n?xj(n,1).join(""):t.slice(1);return r[e]()+o}}var Wj=Uj("toUpperCase");const Gj=Wj;function Kj(e){return Gj(J1(e).toLowerCase())}function qj(){this.__data__=new ur,this.size=0}function Xj(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function Yj(e){return this.__data__.get(e)}function Jj(e){return this.__data__.has(e)}var Qj=200;function Zj(e,t){var n=this.__data__;if(n instanceof ur){var r=n.__data__;if(!Y1||r.length<Qj-1)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new ga(r)}return n.set(e,t),this.size=n.size,this}function va(e){var t=this.__data__=new ur(e);this.size=t.size}va.prototype.clear=qj;va.prototype.delete=Xj;va.prototype.get=Yj;va.prototype.has=Jj;va.prototype.set=Zj;var sx=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Xg=sx&&typeof module=="object"&&module&&!module.nodeType&&module,eD=Xg&&Xg.exports===sx,Yg=eD?ha.Buffer:void 0,Jg=Yg?Yg.allocUnsafe:void 0;function tD(e,t){if(t)return e.slice();var n=e.length,r=Jg?Jg(n):new e.constructor(n);return e.copy(r),r}var nD=ha.Uint8Array;const Qg=nD;function rD(e){var t=new e.constructor(e.byteLength);return new Qg(t).set(new Qg(e)),t}function oD(e,t){var n=t?rD(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function aD(e){return typeof e.constructor=="function"&&!V1(e)?_6(Q1(e)):{}}function iD(e){return function(t,n,r){for(var o=-1,a=Object(t),i=r(t),s=i.length;s--;){var l=i[e?s:++o];if(n(a[l],l,a)===!1)break}return t}}var sD=iD();const lD=sD;function rf(e,t,n){(n!==void 0&&!Bl(e[t],n)||n===void 0&&!(t in e))&&Kd(e,t,n)}function cD(e){return pa(e)&&qd(e)}function of(e,t){if(!(t==="constructor"&&typeof e[t]=="function")&&t!="__proto__")return e[t]}function uD(e){return H6(e,X1(e))}function fD(e,t,n,r,o,a,i){var s=of(e,n),l=of(t,n),c=i.get(l);if(c){rf(e,n,c);return}var u=a?a(s,l,n+"",e,t,i):void 0,f=u===void 0;if(f){var d=Zo(l),h=!d&&G1(l),v=!d&&!h&&q1(l);u=l,d||h||v?Zo(s)?u=s:cD(s)?u=E6(s):h?(f=!1,u=tD(l,!0)):v?(f=!1,u=oD(l,!0)):u=[]:ea(l)||ef(l)?(u=s,ef(s)?u=uD(s):(!ro(s)||Wd(s))&&(u=aD(l))):f=!1}f&&(i.set(l,u),o(u,l,r,a,i),i.delete(l)),rf(e,n,u)}function lx(e,t,n,r,o){e!==t&&lD(t,function(a,i){if(o||(o=new va),ro(a))fD(e,t,i,n,lx,r,o);else{var s=r?r(of(e,i),a,i+"",e,t,o):void 0;s===void 0&&(s=a),rf(e,i,s)}},X1)}var dD=K6(function(e,t,n){lx(e,t,n)});const hD=dD;function pD(e){const t=e==null?void 0:e.prototype;return!!(t&&t.isReactComponent)}function gD(e){var t,n;const r=typeof Symbol=="function"&&Symbol.for?Symbol.for("react.forward_ref"):60112;return(e==null?void 0:e.$$typeof)===r||((t=e==null?void 0:e.prototype)==null?void 0:t.isReactComponent)||((n=e==null?void 0:e.prototype)==null?void 0:n.setState)||e._forwardRef}function vD(e){class t extends b.Component{render(){return b.createElement(e,this.props)}}return t.displayName=e.displayName,t}const po=(e,t)=>{const n=r=>{const o=`
126
+ `)),{isValidate:!1,message:s,error:i}}})({data:t,message:n,throwError:r})};var da=(e=>(e.ROOT_CONTAINER="RootContainer",e))(da||{});const T3=$e({type:At(rn.FUNCTION),value:ne()}),P3=Ld(P1(Xo,["componentName"]),$e({componentName:At("RootContainer")}));function k3(e){return{all:e=e||new Map,on:function(t,n){var r=e.get(t);r?r.push(n):e.set(t,[n])},off:function(t,n){var r=e.get(t);r&&(n?r.splice(r.indexOf(n)>>>0,1):e.set(t,[]))},emit:function(t,n){var r=e.get(t);r&&r.slice().map(function(o){o(n)}),(r=e.get("*"))&&r.slice().map(function(o){o(t,n)})}}}const Di=k3(),N3=(e,t)=>{const n={...e,value:[]},r=e.value;let o=new Kr([]);return t&&(o=t.materialsMode||new Kr([])),r&&(ot(r)?n.value=r.map(a=>new Qe(a,{parent:t,materials:o})):It(r)&&n.value.push(new Qe(r,{parent:t,materials:o}))),n};class Yo{constructor(t,n){ge(this,"nodeType","SLOT"),ge(this,"rawData"),ge(this,"parent"),ge(this,"emitter",Di),ge(this,"data"),ge(this,"id"),ge(this,"materialsMode"),this.parent=(n==null?void 0:n.parent)||null,this.rawData=t;const r=(n==null?void 0:n.materials)||new Kr([]);this.materialsMode=r,this.id=Vn(),this.data=N3(t,this)}get value(){return this.data}export(t){const n=this.data,r=o=>{if(o instanceof Qe)return o.export(t);if(It(o)){const a={};return Object.keys(o||{}).forEach(i=>{a[i]=r(o[i])}),a}return ot(o)?o.map(a=>r(a)):(t==="design"&&delete o.id,o)};return r(n)}}const A1=e=>{let t=[];return e.forEach(n=>{const r=n;r.type?r.type===Ju.SINGLE?t.push(r.content):r.type===Ju.GROUP&&(t=[...t,...A1(r.content)]):t.push(n)}),t},Qu=(e,t,n)=>{if(e.type)return e.type===rn.SLOT?new Yo(e,{parent:t,materials:n}):e;if(It(e)){const r={};return Object.keys(e).forEach(o=>{r[o]=Zu(e[o],t,n)}),r}else return Array.isArray(e)?e.map(r=>Qu(r,t,n)):e},Zu=(e,t,n)=>It(e)?Qu(e,t,n):ot(e)?e.map(r=>Qu(r,t,n)):e;let Jo=class j1{constructor(t,n,r){ge(this,"nodeType","PROP"),ge(this,"rawData"),ge(this,"parent"),ge(this,"emitter",Di),ge(this,"data"),ge(this,"name"),ge(this,"materialsMode");const o=(r==null?void 0:r.materials)||new Kr([]);this.materialsMode=o,this.parent=r==null?void 0:r.parent,this.rawData=n,this.name=t,this.data=Zu(n,this,o)}isIncludeSlot(){return!1}isIncludeExpression(){return!1}get value(){return this.data}updateValue(t){const n=this.data;this.data=Zu(t??n,this,this.materialsMode),this.emitter.emit("onPropChange",{value:this.data,preValue:n,node:this}),this.parent&&!(this.parent instanceof Yo)&&this.emitter.emit("onNodeChange",{value:this.parent.value,preValue:this.parent.value,node:this.parent})}get material(){const t=this.parent;if(t instanceof Qe){const n=t.material;return A1((n==null?void 0:n.value.props)||[]).find(r=>r.name===this.name)}else return null}export(t){const n=this.data,r=o=>{if(o instanceof j1||o instanceof Yo||o instanceof Qe)return o.export(t);if(ot(o))return o.map(a=>r(a));if(It(o)){const a={};return Object.keys(o||{}).forEach(i=>{a[i]=r(o[i])}),a}return o};return r(n)}};const M3=e=>{if(typeof e=="string")return!0;Hd({data:e,dataStruct:Xo,throwError:!1})},Dg=(e,t,n=new Kr([]))=>{if(typeof e=="string")return e;const r={...e,id:e.id??Vn(),children:[],props:{},methods:e.methods||[],configure:E1(e.configure||{},{propsSetter:{},advanceSetter:{}})},o=Object.keys(e.props||{});return o.length&&o.forEach(a=>{var i;const s=(i=e.props)==null?void 0:i[a];if(s instanceof Jo){r.props[a]=s;return}r.props[a]=new Jo(a,s||"",{parent:t,materials:n})}),e.children&&(Array.isArray(e.children)?r.children=e.children.map(a=>{if(a instanceof Qe)return a;if(It(a)){const i=a;return new Qe(i,{parent:t,materials:n})}else return a}):(e.children instanceof Qe&&(r.children=[e.children]),r.children=[new Qe(e.children,{parent:t,materials:n})])),r};class Qe{constructor(t,n){ge(this,"nodeType","NODE"),ge(this,"rawData"),ge(this,"data"),ge(this,"emitter",Di),ge(this,"parent"),ge(this,"materialsModel"),ge(this,"listenerHandle"),ge(this,"onChangeCbQueue"),this.rawData=JSON.parse(JSON.stringify(t)),M3(t);const r=(n==null?void 0:n.materials)||new Kr([]);this.parent=(n==null?void 0:n.parent)||null,this.materialsModel=r,this.data=Dg(t,this,r),this.listenerHandle=[],this.onChangeCbQueue=[],this.registerListener()}registerListener(){const t=n=>{const{node:r}=n;r===this&&r.id===this.id&&this.onChangeCbQueue.forEach(o=>o(n))};this.emitter.on("onNodeChange",t),this.listenerHandle.push(()=>{this.emitter.off("onNodeChange",t)})}onChange(t){return this.onChangeCbQueue.push(t),()=>{this.onChangeCbQueue=this.onChangeCbQueue.filter(n=>n!==t)}}destroy(){this.listenerHandle.forEach(t=>t())}get id(){return this.data.id}get value(){return this.data}clone(t){const n={...this.export("design"),id:t||Vn()};return new Qe(n,{materials:this.materialsModel})}updateWithPlainObj(t){const n={...this.data,...t};return this.data=Dg(n,this),n}updateValue(t){const n=this.data,r=this.updateWithPlainObj(t);this.emitter.emit("onNodeChange",{value:r,preValue:n,node:this})}contains(t){return Ud(this,t)}get props(){return this.data.props}get material(){const t=this.materialsModel;return t==null?void 0:t.findByComponentName(this.data.componentName)}getPlainProps(){const t=this.data,n={};return Object.keys(t.props||{}).forEach(r=>{n[r]=t.props[r].export("design")}),n}getMaterialConfig(t){var n;return this.data.configure[t]!==void 0?this.data.configure.isContainer:(n=this.material)==null?void 0:n.value.isContainer}isContainer(){return this.getMaterialConfig("isContainer")}export(t){var n;const r=this.data;if(typeof r=="string")return r;const o={};Object.keys(r.props||{}).forEach(u=>{o[u]=r.props[u].export(t)});const a=(n=r.children)==null?void 0:n.map(u=>u instanceof Qe?u.export(t):u),i=r.configure||{},s=i.propsSetter||{},l={};Object.keys(s).forEach(u=>{const f=s1(s,u,!1);f&&(l[u]=f)}),i.propsSetter=l,this.material&&this.materialsModel.usedMaterials.push(this.material);let c={...r,configure:i,props:o,children:a,condition:r.condition};return t==="design"&&delete c.id,c=Vd(c),c}}const Ig=(e,t,n)=>{const r={...e,id:Vn(),props:{},componentName:da.ROOT_CONTAINER,children:[],methods:e.methods||[],configure:E1(e.configure||{},{propsSetter:{},advanceSetter:{}})};let o=[];ot(e.children)?o=e.children.map(i=>i instanceof Qe?i:It(i)?new Qe(i,{parent:t,materials:n}):i):e.children instanceof Qe?o.push(e.children):e.children&&It(e.children)&&o.push(new Qe(e.children,{parent:t,materials:n}));const a=Object.keys(e.props||{});return a.length&&a.forEach(i=>{var s;const l=(s=e.props)==null?void 0:s[i];l instanceof Jo?r.props[i]=l:r.props[i]=new Jo(i,l||"",{parent:t,materials:n})}),r.children=o,r};class wi{constructor(t,{parent:n,materials:r}){ge(this,"rawData"),ge(this,"data"),ge(this,"nodeType",da.ROOT_CONTAINER),ge(this,"emitter",Di),ge(this,"materialsModel"),ge(this,"listenerHandle"),ge(this,"onChangeCbQueue"),ge(this,"parent"),this.materialsModel=r,this.rawData=JSON.parse(JSON.stringify(t)),this.data=Ig(t,this,r),this.listenerHandle=[],this.onChangeCbQueue=[],this.registerListener(),this.parent=n}registerListener(){const t=n=>{const{node:r}=n;r===this&&r.id===this.id&&this.onChangeCbQueue.forEach(o=>o(n))};this.emitter.on("onNodeChange",t),this.listenerHandle.push(()=>{this.emitter.off("onNodeChange",t)})}onChange(t){return this.onChangeCbQueue.push(t),()=>{this.onChangeCbQueue=this.onChangeCbQueue.filter(n=>n!==t)}}get id(){return this.data.id}get value(){return this.data}get props(){return this.data.props}get material(){const t=this.materialsModel;return t==null?void 0:t.findByComponentName(this.data.componentName)}updateWithPlainObj(t){const n={...this.data,...t};return this.data=Ig(n,this,this.materialsModel),n}updateValue(t){const n=this.data;this.updateWithPlainObj(t),this.emitter.emit("onNodeChange",{value:this.data,preValue:n,node:this})}contains(t){return Ud(this,t)}getMaterialConfig(t){var n;return this.data.configure[t]!==void 0?this.data.configure.isContainer:(n=this.material)==null?void 0:n.value.isContainer}isContainer(){return this.getMaterialConfig("isContainer")}export(t=Fd.SAVE){var n;const r=this.data,o={};Object.keys(r.props||{}).forEach(l=>{o[l]=r.props[l].export(t)});const a=((n=r.children)==null?void 0:n.map(l=>{var c;return(c=l==null?void 0:l.export)==null?void 0:c.call(l,t)}))||[],i={...r,props:o,children:a.filter(l=>l),condition:r.condition};let s=R1(i,["id"]);return s=Vd(s),s}getPlainProps(){const t=this.data,n={};return Object.keys(t.props||{}).forEach(r=>{n[r]=t.props[r].export("design")}),n}destroy(){this.listenerHandle.forEach(t=>t())}clone(t){const n={...this.export("design"),id:t||Vn()};return new wi(n,{materials:this.materialsModel,parent:null})}}const Mr=e=>(e==null?void 0:e.type)===rn.EXPRESSION,A3=e=>(e==null?void 0:e.type)===rn.FUNCTION,Vn=()=>Math.random().toString(32).slice(3,9),j3=e=>(e==null?void 0:e.nodeType)==="NODE",Rc=e=>(e==null?void 0:e.nodeType)==="PROP",D3=e=>(e==null?void 0:e.nodeType)==="SLOT",Vd=e=>r3(e,t=>It(t)?!Object.keys(t).length:ot(t)?!t.length:!t);function I3(e,t){const n=[e];for(;n.length;){const r=n.shift();if(r&&t(r))return r;const o=(r==null?void 0:r.props)||{},a=s=>{if(s instanceof Qe){n.push(s);return}if(s instanceof Yo&&a(s.value.value),s instanceof Jo){a(s.value);return}if(It(s)){const l=s;Object.keys(l).forEach(c=>{a(l[c])});return}if(ot(s)){s.forEach(l=>{a(l)});return}};a(o);const i=(r==null?void 0:r.value.children.filter(s=>s instanceof Qe))||[];n.push(...i)}}function Ud(e,t){return I3(e,n=>n.id===t)}const L3=e=>{const t=y1(e),n=t.snippets;return delete t.snippets,t.snippets=n.map(r=>({...t,...r,id:r.id||`${e.componentName}-${Vn()}`,title:r.title||e.title,category:r.category||e.category,tags:[...r.tags||[],...e.tags||[]],groupName:r.groupName||e.groupName,snapshot:r.snapshot||e.icon,snapshotText:r.snapshotText,schema:{...r.schema,componentName:r.schema.componentName||e.componentName}})),t};class B3{constructor(t){ge(this,"rawData"),ge(this,"data"),this.rawData=t,this.data=L3(t)}get value(){return this.data}get rawValue(){return this.rawData}get componentName(){return this.data.componentName}get snippets(){return this.data.snippets}getSnippetById(t){return this.data.snippets.find(n=>n.id===t)}}const $c=e=>{if(!ot(e))throw new Error("Materials must be a array");return e.map(t=>new B3(t))},F3=e=>{e==null||e.forEach(t=>{Hd({data:t,dataStruct:R3,throwError:!1})})};class Kr{constructor(t){ge(this,"rawData"),ge(this,"data"),ge(this,"usedMaterials",[]),this.rawData=t,F3(t),this.data=$c(t)}addMaterials(t){const n=$c(t),r=[],o=this.data.map(i=>{const s=n.findIndex(l=>l.componentName===i.componentName);return s>=0?(r.push(s),n[s]):i}),a=n.filter((i,s)=>!r.includes(s));this.data=[...o,...a]}replaceMaterials(t){const n=$c(t);this.data=[...n]}removeMaterial(t){const n=this.data.filter(r=>!t.includes(r.componentName));this.data=n}findByComponentName(t){return this.data.find(n=>n.componentName===t)}findSnippetById(t){const n=[...this.data];let r=null;for(;!r&&n.length;){const o=n.pop();r=o==null?void 0:o.getSnippetById(t)}return r}getAllSnippets(){const t=this.data.reduce((a,i)=>(a.push(...i.snippets),a),[]),n=[],r={default:[]};t.forEach(a=>{const i=a.groupName||"default";n.includes(i)||(n.push(i),r[i]=[]),r[i].push(a)});let o=[];return n.forEach(a=>{const i=["default"],s={default:[]},l=r[a];if(l.length!==0){l.forEach(f=>{const d=f.category||"default";i.includes(d)||(i.push(d),s[d]=[]),s[d].push(f)});const c=[];i.forEach(f=>{s[f].length&&c.push({name:f,list:s[f]})});const u={name:a,list:c};o.push(u)}}),o=o.sort((a,i)=>(a.name||"")>(i.name||"")?1:-1),o}get value(){return this.data}get rawValue(){return this.rawData}}const z3=$e({version:ne(),name:ne(),css:te(ne()),renderType:te(jt([At("COMPONENT"),At("PAGE")])),loadType:te(Ye()),lifecycle:te(Ye()),props:te(Ye()),methods:te(tt(T3)),componentsMeta:tt(Ld($e({componentName:ne()}),Bd)),thirdLibs:te(y3),componentsTree:P3,assets:te(tt(Ye()))}),D1=e=>(Hd({data:e,dataStruct:z3,throwError:!1}),e),Tc=(e,t,n)=>({...e,componentsTree:new wi(e.componentsTree,{parent:t,materials:n})});class ol{constructor(t,n){ge(this,"nodeType","PAGE"),ge(this,"rawData"),ge(this,"emitter",Di),ge(this,"data"),ge(this,"parent"),ge(this,"materialsModel"),ge(this,"assetPackagesList"),D1(t),this.rawData=JSON.parse(JSON.stringify(t)),this.materialsModel=new Kr((n==null?void 0:n.materials)||[]),this.data=Tc(t,this,this.materialsModel),this.assetPackagesList=[...(n==null?void 0:n.assetPackagesList)||[],...this.data.assets||[]]}updatePage(t){const n=this.data;this.rawData=JSON.parse(JSON.stringify(t)),this.data=Tc(t,this,this.materialsModel),this.emitter.emit("onPageChange",{value:this.data,preValue:n,node:this})}reloadPage(t){const n=this.data;this.rawData=JSON.parse(JSON.stringify(t)),this.data=Tc(t,this,this.materialsModel),this.emitter.emit("onReloadPage",{value:this.data,preValue:n,node:this})}get value(){return this.data}getNode(t){if(!t)return;const n=this.data.componentsTree;return Ud(n,t)}addNode(t,n,r="AFTER"){var o;if(r==="AFTER"||r==="BEFORE"){const a=n.parent;if(a===null&&n instanceof wi)return console.warn("Not found parent node"),!1;if(a instanceof Jo)return console.warn("CProp can not add node"),!1;if(a instanceof Yo){const s=a.value.value,l=s.findIndex(c=>c===n)??-1;return l>=0?(r==="BEFORE"?s.splice(l,0,t):s.splice(l+1,0,t),t.parent=a,(o=a.parent)==null||o.updateValue(),!0):!1}if(a instanceof ol)return!1;const i=(a==null?void 0:a.value.children.findIndex(s=>s===n))??-1;return i>=0?(r==="BEFORE"?a==null||a.value.children.splice(i,0,t):a==null||a.value.children.splice(i+1,0,t),t.parent=a,a==null||a.updateValue(),!0):(console.warn("Not found target node"),!1)}if(r==="CHILD_START")return n.value.children.unshift(t),t.parent=n,n.updateValue(),!0;if(r==="CHILD_END")return n.value.children.push(t),t.parent=n,n.updateValue(),!0;if(It(r)){const a=r;if(a.type==="CHILD"){const i=a.pos,s=a.index||0;return i==="BEFORE"?n==null||n.value.children.splice(s,0,t):n==null||n.value.children.splice(s+1,0,t),t.parent=n,n.updateValue(),!0}else console.warn("Can not parse pos obj")}return!1}createNode(t){return delete t.id,new Qe(t,{parent:null,materials:this.materialsModel})}addNodeById(t,n,r="AFTER"){const o=this.getNode(n);return o?this.addNode(t,o,r):(console.warn(`Not find a node by ${n}, pls check it`),!1)}copyNode(t){const n=t.export("design");n.id=Vn();const r=new Qe(n,{parent:t.parent,materials:this.materialsModel});return this.addNode(r,t,"AFTER"),r}copyNodeById(t){const n=this.getNode(t);return n&&n instanceof Qe?this.copyNode(n):!1}moveNode(t,n,r){this.deleteNode(t);let o=n;return["AFTER","BEFORE"].includes(r)&&(o=n.parent),t.parent=o,this.addNode(t,n,r)}moveNodeById(t,n,r){const o=this.getNode(t),a=this.getNode(n);return o&&a&&o instanceof Qe&&a instanceof Qe?this.moveNode(o,a,r):!1}deleteNode(t){var n;const r=t.parent;if(!r)throw new Error("parent node is null or undefined, pls check it");if(r instanceof Yo){const o=r.value.value,a=o.findIndex(s=>s===t),i=o[a];return o.splice(a,1),(n=r.parent)==null||n.updateValue(),i}if(r instanceof Qe||r instanceof wi){const o=r.value.children,a=o.findIndex(s=>s===t),i=o[a];return o.splice(a,1),r.updateValue(),i}}deleteNodeById(t){const n=this.getNode(t);if(n)return this.deleteNode(n)}export(t=Fd.SAVE){var n;const r=this.data.componentsTree.export(t),o=this.assetPackagesList,a=[],i=this.materialsModel.usedMaterials.map(l=>{const c=o.find(u=>{var f;return u.package===((f=l.value.npm)==null?void 0:f.package)});return c&&a.push(c),{componentName:l.componentName,...y1(l.value.npm||{})}}).filter(l=>l.componentName&&l.package&&l.version?!0:(console.warn(`${l} not a valid material info`),!1));this.materialsModel.usedMaterials=[];let s={...this.data,componentsTree:Vd(r),componentsMeta:i,thirdLibs:this.data.thirdLibs,assets:[]};return(n=this.data.thirdLibs)==null||n.forEach(l=>{const c=o.find(u=>l.package===u.package);c&&a.push(c)}),s.assets=u3(a,l=>l.package),s=R1(s,["id"]),JSON.parse(JSON.stringify(s))}getRootNode(){return this.data.componentsTree}}da.ROOT_CONTAINER;var H3=typeof global=="object"&&global&&global.Object===Object&&global;const I1=H3;var V3=typeof self=="object"&&self&&self.Object===Object&&self,U3=I1||V3||Function("return this")();const ha=U3;var W3=ha.Symbol;const Qo=W3;var L1=Object.prototype,G3=L1.hasOwnProperty,K3=L1.toString,Ba=Qo?Qo.toStringTag:void 0;function q3(e){var t=G3.call(e,Ba),n=e[Ba];try{e[Ba]=void 0;var r=!0}catch{}var o=K3.call(e);return r&&(t?e[Ba]=n:delete e[Ba]),o}var X3=Object.prototype,Y3=X3.toString;function J3(e){return Y3.call(e)}var Q3="[object Null]",Z3="[object Undefined]",Lg=Qo?Qo.toStringTag:void 0;function Ii(e){return e==null?e===void 0?Z3:Q3:Lg&&Lg in Object(e)?q3(e):J3(e)}function pa(e){return e!=null&&typeof e=="object"}var e6="[object Symbol]";function t6(e){return typeof e=="symbol"||pa(e)&&Ii(e)==e6}function n6(e,t){for(var n=-1,r=e==null?0:e.length,o=Array(r);++n<r;)o[n]=t(e[n],n,e);return o}var r6=Array.isArray;const Zo=r6;var o6=1/0,Bg=Qo?Qo.prototype:void 0,Fg=Bg?Bg.toString:void 0;function B1(e){if(typeof e=="string")return e;if(Zo(e))return n6(e,B1)+"";if(t6(e))return Fg?Fg.call(e):"";var t=e+"";return t=="0"&&1/e==-o6?"-0":t}function ro(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}function F1(e){return e}var a6="[object AsyncFunction]",i6="[object Function]",s6="[object GeneratorFunction]",l6="[object Proxy]";function Wd(e){if(!ro(e))return!1;var t=Ii(e);return t==i6||t==s6||t==a6||t==l6}var c6=ha["__core-js_shared__"];const Pc=c6;var zg=function(){var e=/[^.]+$/.exec(Pc&&Pc.keys&&Pc.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function u6(e){return!!zg&&zg in e}var f6=Function.prototype,d6=f6.toString;function h6(e){if(e!=null){try{return d6.call(e)}catch{}try{return e+""}catch{}}return""}var p6=/[\\^$.*+?()[\]{}|]/g,g6=/^\[object .+?Constructor\]$/,v6=Function.prototype,m6=Object.prototype,b6=v6.toString,y6=m6.hasOwnProperty,x6=RegExp("^"+b6.call(y6).replace(p6,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function w6(e){if(!ro(e)||u6(e))return!1;var t=Wd(e)?x6:g6;return t.test(h6(e))}function S6(e,t){return e==null?void 0:e[t]}function Gd(e,t){var n=S6(e,t);return w6(n)?n:void 0}var Hg=Object.create,C6=function(){function e(){}return function(t){if(!ro(t))return{};if(Hg)return Hg(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();const _6=C6;function O6(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function E6(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t}var R6=800,$6=16,T6=Date.now;function P6(e){var t=0,n=0;return function(){var r=T6(),o=$6-(r-n);if(n=r,o>0){if(++t>=R6)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function k6(e){return function(){return e}}var N6=function(){try{var e=Gd(Object,"defineProperty");return e({},"",{}),e}catch{}}();const al=N6;var M6=al?function(e,t){return al(e,"toString",{configurable:!0,enumerable:!1,value:k6(t),writable:!0})}:F1;const A6=M6;var j6=P6(A6);const D6=j6;var I6=9007199254740991,L6=/^(?:0|[1-9]\d*)$/;function z1(e,t){var n=typeof e;return t=t??I6,!!t&&(n=="number"||n!="symbol"&&L6.test(e))&&e>-1&&e%1==0&&e<t}function Kd(e,t,n){t=="__proto__"&&al?al(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function Bl(e,t){return e===t||e!==e&&t!==t}var B6=Object.prototype,F6=B6.hasOwnProperty;function z6(e,t,n){var r=e[t];(!(F6.call(e,t)&&Bl(r,n))||n===void 0&&!(t in e))&&Kd(e,t,n)}function H6(e,t,n,r){var o=!n;n||(n={});for(var a=-1,i=t.length;++a<i;){var s=t[a],l=r?r(n[s],e[s],s,n,e):void 0;l===void 0&&(l=e[s]),o?Kd(n,s,l):z6(n,s,l)}return n}var Vg=Math.max;function V6(e,t,n){return t=Vg(t===void 0?e.length-1:t,0),function(){for(var r=arguments,o=-1,a=Vg(r.length-t,0),i=Array(a);++o<a;)i[o]=r[t+o];o=-1;for(var s=Array(t+1);++o<t;)s[o]=r[o];return s[t]=n(i),O6(e,this,s)}}function U6(e,t){return D6(V6(e,t,F1),e+"")}var W6=9007199254740991;function H1(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=W6}function qd(e){return e!=null&&H1(e.length)&&!Wd(e)}function G6(e,t,n){if(!ro(n))return!1;var r=typeof t;return(r=="number"?qd(n)&&z1(t,n.length):r=="string"&&t in n)?Bl(n[t],e):!1}function K6(e){return U6(function(t,n){var r=-1,o=n.length,a=o>1?n[o-1]:void 0,i=o>2?n[2]:void 0;for(a=e.length>3&&typeof a=="function"?(o--,a):void 0,i&&G6(n[0],n[1],i)&&(a=o<3?void 0:a,o=1),t=Object(t);++r<o;){var s=n[r];s&&e(t,s,r,a)}return t})}var q6=Object.prototype;function V1(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||q6;return e===n}function X6(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}var Y6="[object Arguments]";function Ug(e){return pa(e)&&Ii(e)==Y6}var U1=Object.prototype,J6=U1.hasOwnProperty,Q6=U1.propertyIsEnumerable,Z6=Ug(function(){return arguments}())?Ug:function(e){return pa(e)&&J6.call(e,"callee")&&!Q6.call(e,"callee")};const ef=Z6;function e4(){return!1}var W1=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Wg=W1&&typeof module=="object"&&module&&!module.nodeType&&module,t4=Wg&&Wg.exports===W1,Gg=t4?ha.Buffer:void 0,n4=Gg?Gg.isBuffer:void 0,r4=n4||e4;const G1=r4;var o4="[object Arguments]",a4="[object Array]",i4="[object Boolean]",s4="[object Date]",l4="[object Error]",c4="[object Function]",u4="[object Map]",f4="[object Number]",d4="[object Object]",h4="[object RegExp]",p4="[object Set]",g4="[object String]",v4="[object WeakMap]",m4="[object ArrayBuffer]",b4="[object DataView]",y4="[object Float32Array]",x4="[object Float64Array]",w4="[object Int8Array]",S4="[object Int16Array]",C4="[object Int32Array]",_4="[object Uint8Array]",O4="[object Uint8ClampedArray]",E4="[object Uint16Array]",R4="[object Uint32Array]",Ue={};Ue[y4]=Ue[x4]=Ue[w4]=Ue[S4]=Ue[C4]=Ue[_4]=Ue[O4]=Ue[E4]=Ue[R4]=!0;Ue[o4]=Ue[a4]=Ue[m4]=Ue[i4]=Ue[b4]=Ue[s4]=Ue[l4]=Ue[c4]=Ue[u4]=Ue[f4]=Ue[d4]=Ue[h4]=Ue[p4]=Ue[g4]=Ue[v4]=!1;function $4(e){return pa(e)&&H1(e.length)&&!!Ue[Ii(e)]}function T4(e){return function(t){return e(t)}}var K1=typeof exports=="object"&&exports&&!exports.nodeType&&exports,ni=K1&&typeof module=="object"&&module&&!module.nodeType&&module,P4=ni&&ni.exports===K1,kc=P4&&I1.process,k4=function(){try{var e=ni&&ni.require&&ni.require("util").types;return e||kc&&kc.binding&&kc.binding("util")}catch{}}();const Kg=k4;var qg=Kg&&Kg.isTypedArray,N4=qg?T4(qg):$4;const q1=N4;var M4=Object.prototype,A4=M4.hasOwnProperty;function j4(e,t){var n=Zo(e),r=!n&&ef(e),o=!n&&!r&&G1(e),a=!n&&!r&&!o&&q1(e),i=n||r||o||a,s=i?X6(e.length,String):[],l=s.length;for(var c in e)(t||A4.call(e,c))&&!(i&&(c=="length"||o&&(c=="offset"||c=="parent")||a&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||z1(c,l)))&&s.push(c);return s}function D4(e,t){return function(n){return e(t(n))}}function I4(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}var L4=Object.prototype,B4=L4.hasOwnProperty;function F4(e){if(!ro(e))return I4(e);var t=V1(e),n=[];for(var r in e)r=="constructor"&&(t||!B4.call(e,r))||n.push(r);return n}function X1(e){return qd(e)?j4(e,!0):F4(e)}var z4=Gd(Object,"create");const Si=z4;function H4(){this.__data__=Si?Si(null):{},this.size=0}function V4(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var U4="__lodash_hash_undefined__",W4=Object.prototype,G4=W4.hasOwnProperty;function K4(e){var t=this.__data__;if(Si){var n=t[e];return n===U4?void 0:n}return G4.call(t,e)?t[e]:void 0}var q4=Object.prototype,X4=q4.hasOwnProperty;function Y4(e){var t=this.__data__;return Si?t[e]!==void 0:X4.call(t,e)}var J4="__lodash_hash_undefined__";function Q4(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Si&&t===void 0?J4:t,this}function qr(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}qr.prototype.clear=H4;qr.prototype.delete=V4;qr.prototype.get=K4;qr.prototype.has=Y4;qr.prototype.set=Q4;function Z4(){this.__data__=[],this.size=0}function Fl(e,t){for(var n=e.length;n--;)if(Bl(e[n][0],t))return n;return-1}var ej=Array.prototype,tj=ej.splice;function nj(e){var t=this.__data__,n=Fl(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():tj.call(t,n,1),--this.size,!0}function rj(e){var t=this.__data__,n=Fl(t,e);return n<0?void 0:t[n][1]}function oj(e){return Fl(this.__data__,e)>-1}function aj(e,t){var n=this.__data__,r=Fl(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}function ur(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}ur.prototype.clear=Z4;ur.prototype.delete=nj;ur.prototype.get=rj;ur.prototype.has=oj;ur.prototype.set=aj;var ij=Gd(ha,"Map");const Y1=ij;function sj(){this.size=0,this.__data__={hash:new qr,map:new(Y1||ur),string:new qr}}function lj(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function zl(e,t){var n=e.__data__;return lj(t)?n[typeof t=="string"?"string":"hash"]:n.map}function cj(e){var t=zl(this,e).delete(e);return this.size-=t?1:0,t}function uj(e){return zl(this,e).get(e)}function fj(e){return zl(this,e).has(e)}function dj(e,t){var n=zl(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}function ga(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}ga.prototype.clear=sj;ga.prototype.delete=cj;ga.prototype.get=uj;ga.prototype.has=fj;ga.prototype.set=dj;function J1(e){return e==null?"":B1(e)}var hj=D4(Object.getPrototypeOf,Object);const Q1=hj;var pj="[object Object]",gj=Function.prototype,vj=Object.prototype,Z1=gj.toString,mj=vj.hasOwnProperty,bj=Z1.call(Object);function ea(e){if(!pa(e)||Ii(e)!=pj)return!1;var t=Q1(e);if(t===null)return!0;var n=mj.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&Z1.call(n)==bj}function yj(e,t,n){var r=-1,o=e.length;t<0&&(t=-t>o?0:o+t),n=n>o?o:n,n<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var a=Array(o);++r<o;)a[r]=e[r+t];return a}function xj(e,t,n){var r=e.length;return n=n===void 0?r:n,!t&&n>=r?e:yj(e,t,n)}var wj="\\ud800-\\udfff",Sj="\\u0300-\\u036f",Cj="\\ufe20-\\ufe2f",_j="\\u20d0-\\u20ff",Oj=Sj+Cj+_j,Ej="\\ufe0e\\ufe0f",Rj="\\u200d",$j=RegExp("["+Rj+wj+Oj+Ej+"]");function ex(e){return $j.test(e)}function Tj(e){return e.split("")}var tx="\\ud800-\\udfff",Pj="\\u0300-\\u036f",kj="\\ufe20-\\ufe2f",Nj="\\u20d0-\\u20ff",Mj=Pj+kj+Nj,Aj="\\ufe0e\\ufe0f",jj="["+tx+"]",tf="["+Mj+"]",nf="\\ud83c[\\udffb-\\udfff]",Dj="(?:"+tf+"|"+nf+")",nx="[^"+tx+"]",rx="(?:\\ud83c[\\udde6-\\uddff]){2}",ox="[\\ud800-\\udbff][\\udc00-\\udfff]",Ij="\\u200d",ax=Dj+"?",ix="["+Aj+"]?",Lj="(?:"+Ij+"(?:"+[nx,rx,ox].join("|")+")"+ix+ax+")*",Bj=ix+ax+Lj,Fj="(?:"+[nx+tf+"?",tf,rx,ox,jj].join("|")+")",zj=RegExp(nf+"(?="+nf+")|"+Fj+Bj,"g");function Hj(e){return e.match(zj)||[]}function Vj(e){return ex(e)?Hj(e):Tj(e)}function Uj(e){return function(t){t=J1(t);var n=ex(t)?Vj(t):void 0,r=n?n[0]:t.charAt(0),o=n?xj(n,1).join(""):t.slice(1);return r[e]()+o}}var Wj=Uj("toUpperCase");const Gj=Wj;function Kj(e){return Gj(J1(e).toLowerCase())}function qj(){this.__data__=new ur,this.size=0}function Xj(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function Yj(e){return this.__data__.get(e)}function Jj(e){return this.__data__.has(e)}var Qj=200;function Zj(e,t){var n=this.__data__;if(n instanceof ur){var r=n.__data__;if(!Y1||r.length<Qj-1)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new ga(r)}return n.set(e,t),this.size=n.size,this}function va(e){var t=this.__data__=new ur(e);this.size=t.size}va.prototype.clear=qj;va.prototype.delete=Xj;va.prototype.get=Yj;va.prototype.has=Jj;va.prototype.set=Zj;var sx=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Xg=sx&&typeof module=="object"&&module&&!module.nodeType&&module,eD=Xg&&Xg.exports===sx,Yg=eD?ha.Buffer:void 0,Jg=Yg?Yg.allocUnsafe:void 0;function tD(e,t){if(t)return e.slice();var n=e.length,r=Jg?Jg(n):new e.constructor(n);return e.copy(r),r}var nD=ha.Uint8Array;const Qg=nD;function rD(e){var t=new e.constructor(e.byteLength);return new Qg(t).set(new Qg(e)),t}function oD(e,t){var n=t?rD(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function aD(e){return typeof e.constructor=="function"&&!V1(e)?_6(Q1(e)):{}}function iD(e){return function(t,n,r){for(var o=-1,a=Object(t),i=r(t),s=i.length;s--;){var l=i[e?s:++o];if(n(a[l],l,a)===!1)break}return t}}var sD=iD();const lD=sD;function rf(e,t,n){(n!==void 0&&!Bl(e[t],n)||n===void 0&&!(t in e))&&Kd(e,t,n)}function cD(e){return pa(e)&&qd(e)}function of(e,t){if(!(t==="constructor"&&typeof e[t]=="function")&&t!="__proto__")return e[t]}function uD(e){return H6(e,X1(e))}function fD(e,t,n,r,o,a,i){var s=of(e,n),l=of(t,n),c=i.get(l);if(c){rf(e,n,c);return}var u=a?a(s,l,n+"",e,t,i):void 0,f=u===void 0;if(f){var d=Zo(l),h=!d&&G1(l),v=!d&&!h&&q1(l);u=l,d||h||v?Zo(s)?u=s:cD(s)?u=E6(s):h?(f=!1,u=tD(l,!0)):v?(f=!1,u=oD(l,!0)):u=[]:ea(l)||ef(l)?(u=s,ef(s)?u=uD(s):(!ro(s)||Wd(s))&&(u=aD(l))):f=!1}f&&(i.set(l,u),o(u,l,r,a,i),i.delete(l)),rf(e,n,u)}function lx(e,t,n,r,o){e!==t&&lD(t,function(a,i){if(o||(o=new va),ro(a))fD(e,t,i,n,lx,r,o);else{var s=r?r(of(e,i),a,i+"",e,t,o):void 0;s===void 0&&(s=a),rf(e,i,s)}},X1)}var dD=K6(function(e,t,n){lx(e,t,n)});const hD=dD;function pD(e){const t=e==null?void 0:e.prototype;return!!(t&&t.isReactComponent)}function gD(e){var t,n;const r=typeof Symbol=="function"&&Symbol.for?Symbol.for("react.forward_ref"):60112;return(e==null?void 0:e.$$typeof)===r||((t=e==null?void 0:e.prototype)==null?void 0:t.isReactComponent)||((n=e==null?void 0:e.prototype)==null?void 0:n.setState)||e._forwardRef}function vD(e){class t extends b.Component{render(){return b.createElement(e,this.props)}}return t.displayName=e.displayName,t}const po=(e,t)=>{const n=r=>{const o=`
127
127
  ${Object.keys(t).map(a=>`const ${a} = $$context['${a}'];`).join(`
128
128
  `)}
129
129
  return ${r};
@@ -325,5 +325,5 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
325
325
  ctx.font = "48px serif";
326
326
  ctx.fillText("Hello Canvas", 10, 50);
327
327
  }
328
- `}}}}]},{title:"HTML 标签",componentName:"CNativeTag",props:[{name:"htmlTag",title:"标签名",valueType:"string",setters:[{componentName:"SelectSetter",props:{options:De.HTMl_TAGS.map(e=>({name:e,value:e}))}}]},rr],isContainer:!0,groupName:"原子组件",snippets:[{title:"HTML",snapshotText:"HTML",category:"基础组件",schema:{props:{htmlTag:"div"}}}]}],oie=[...rie,...nie];class S2 extends b.Component{constructor(n){super(n);H(this,"currentSelectNode");H(this,"pluginManager");H(this,"workbenchRef",b.createRef());H(this,"pageSchema");H(this,"pageModel");H(this,"material");H(this,"emitter");H(this,"assetsPackageListManager");H(this,"updatePage",n=>{this.pageModel.updatePage(n)});H(this,"updateMaterials",async(n,r,o)=>{const a=await this.pluginManager.get("Designer"),i=a==null?void 0:a.export;this.pluginManager.assetsPackageListManager.setList(r),this.pageModel.assetPackagesList=this.pluginManager.assetsPackageListManager.getList();const s=i==null?void 0:i.getDesignerWindow();if(!s){console.warn("subWin not exits");return}await new tI(r,s).load();const c=cx(r,s);let u=ux(c);o!=null&&o.formatComponents&&(u=o.formatComponents(u)),i==null||i.updateRenderComponents(u),this.pageModel.materialsModel.addMaterials(n),this.emitter.emit("updateMaterials")});H(this,"refresh",async()=>{this.pageModel.reloadPage(this.pageModel.export("design"))});H(this,"getWorkbench",()=>this.workbenchRef.current);this.pageSchema=n.schema,this.material=n.material,this.currentSelectNode=null,window.__CHAMELEON_ENG__=this,this.assetsPackageListManager=new hP(n.assetPackagesList||[]);try{this.pageModel=new De.CPage(this.pageSchema,{materials:this.material||[],assetPackagesList:n.assetPackagesList||[]})}catch(r){console.error(r),this.pageModel=new De.CPage(De.EmptyPage)}this.emitter=qs()}updateCurrentSelectNode(n){this.currentSelectNode=n,this.emitter.emit("onSelectNodeChange",{node:n})}async componentDidMount(){var a,i,s,l,c,u;window.__C_ENGINE__=this;const n=this.props.plugins,r=new nL({engine:this,getWorkbench:()=>this.workbenchRef.current,emitter:this.emitter,pageModel:this.pageModel,i18n:Ox,assetsPackageListManager:this.assetsPackageListManager});this.pluginManager=r,r.customPlugin("Designer",f=>(f.ctx.config.beforeInitRender=vx,f.ctx.config.customRender=mx(this.props.components||{}),f.ctx.config.components=this.props.components,f)),(i=(a=this.props).beforePluginRun)==null||i.call(a,{pluginManager:this.pluginManager});const o=n.map(f=>this.pluginManager.add(f));(l=(s=this.props).onMount)==null||l.call(s,{pluginManager:this.pluginManager,engine:this}),await Promise.all(o),this.pageModel.emitter.on("onReloadPage",()=>{var d;if(!this.currentSelectNode)return;const f=this.pageModel.getNode((d=this.currentSelectNode)==null?void 0:d.id);f&&this.updateCurrentSelectNode(f)}),(u=(c=this.props).onReady)==null||u.call(c,{pluginManager:this.pluginManager,engine:this})}getActiveNode(){var r;if(!((r=this.currentSelectNode)!=null&&r.id))return null;const n=this.pageModel.getNode(this.currentSelectNode.id)??null;return this.currentSelectNode=n,n}render(){return p("div",{className:Ge([iI.engineContainer,this.props.className]),style:this.props.style,children:p(oI,{ref:this.workbenchRef,emitter:this.emitter})})}}H(S2,"version","0.0.44");exports.Engine=S2;exports.InnerComponentMeta=oie;exports.LOGGER=dn;exports.beforeInitRender=vx;exports.formatCSSTextProperty=gd;exports.formatCssToNodeVal=Gy;exports.formatNodeValToEditor=Ky;exports.formatStyleProperty=Fu;exports.getColorFromStr=zu;exports.getDefaultRender=mx;exports.parseBoxShadowString=Ls;exports.plugins=tie;exports.registerCustomSetter=nB;exports.styleArr2Obj=Vy;exports.styleList2Text=Wy;exports.styleObjToArr=Uy;exports.waitReactUpdate=Bn;Object.keys(br).forEach(e=>{e!=="default"&&!Object.prototype.hasOwnProperty.call(exports,e)&&Object.defineProperty(exports,e,{enumerable:!0,get:()=>br[e]})});
328
+ `}}}}]},{title:"HTML 标签",componentName:"CNativeTag",props:[{name:"htmlTag",title:"标签名",valueType:"string",setters:[{componentName:"SelectSetter",props:{options:De.HTMl_TAGS.map(e=>({name:e,value:e}))}}]},rr],isContainer:!0,groupName:"原子组件",snippets:[{title:"HTML",snapshotText:"HTML",category:"基础组件",schema:{props:{htmlTag:"div"}}}]}],oie=[...rie,...nie];class S2 extends b.Component{constructor(n){super(n);H(this,"currentSelectNode");H(this,"pluginManager");H(this,"workbenchRef",b.createRef());H(this,"pageSchema");H(this,"pageModel");H(this,"material");H(this,"emitter");H(this,"assetsPackageListManager");H(this,"updatePage",n=>{this.pageModel.updatePage(n)});H(this,"updateMaterials",async(n,r,o)=>{const a=await this.pluginManager.get("Designer"),i=a==null?void 0:a.export;this.pluginManager.assetsPackageListManager.setList(r),this.pageModel.assetPackagesList=this.pluginManager.assetsPackageListManager.getList();const s=i==null?void 0:i.getDesignerWindow();if(!s){console.warn("subWin not exits");return}await new tI(r,s).load();const c=cx(r,s);let u=ux(c);o!=null&&o.formatComponents&&(u=o.formatComponents(u)),i==null||i.updateRenderComponents(u),this.pageModel.materialsModel.addMaterials(n),this.emitter.emit("updateMaterials")});H(this,"refresh",async()=>{this.pageModel.reloadPage(this.pageModel.export("design"))});H(this,"getWorkbench",()=>this.workbenchRef.current);this.pageSchema=n.schema,this.material=n.material,this.currentSelectNode=null,window.__CHAMELEON_ENG__=this,this.assetsPackageListManager=new hP(n.assetPackagesList||[]);try{this.pageModel=new De.CPage(this.pageSchema,{materials:this.material||[],assetPackagesList:n.assetPackagesList||[]})}catch(r){console.error(r),this.pageModel=new De.CPage(De.EmptyPage)}this.emitter=qs()}updateCurrentSelectNode(n){this.currentSelectNode=n,this.emitter.emit("onSelectNodeChange",{node:n})}async componentDidMount(){var a,i,s,l,c,u;window.__C_ENGINE__=this;const n=this.props.plugins,r=new nL({engine:this,getWorkbench:()=>this.workbenchRef.current,emitter:this.emitter,pageModel:this.pageModel,i18n:Ox,assetsPackageListManager:this.assetsPackageListManager});this.pluginManager=r,r.customPlugin("Designer",f=>(f.ctx.config.beforeInitRender=vx,f.ctx.config.customRender=mx(this.props.components||{}),f.ctx.config.components=this.props.components,f)),(i=(a=this.props).beforePluginRun)==null||i.call(a,{pluginManager:this.pluginManager});const o=n.map(f=>this.pluginManager.add(f));(l=(s=this.props).onMount)==null||l.call(s,{pluginManager:this.pluginManager,engine:this}),await Promise.all(o),this.pageModel.emitter.on("onReloadPage",()=>{var d;if(!this.currentSelectNode)return;const f=this.pageModel.getNode((d=this.currentSelectNode)==null?void 0:d.id);f&&this.updateCurrentSelectNode(f)}),(u=(c=this.props).onReady)==null||u.call(c,{pluginManager:this.pluginManager,engine:this})}getActiveNode(){var r;if(!((r=this.currentSelectNode)!=null&&r.id))return null;const n=this.pageModel.getNode(this.currentSelectNode.id)??null;return this.currentSelectNode=n,n}render(){return p("div",{className:Ge([iI.engineContainer,this.props.className]),style:this.props.style,children:p(oI,{ref:this.workbenchRef,emitter:this.emitter})})}}H(S2,"version","0.0.45");exports.Engine=S2;exports.InnerComponentMeta=oie;exports.LOGGER=dn;exports.beforeInitRender=vx;exports.formatCSSTextProperty=gd;exports.formatCssToNodeVal=Gy;exports.formatNodeValToEditor=Ky;exports.formatStyleProperty=Fu;exports.getColorFromStr=zu;exports.getDefaultRender=mx;exports.parseBoxShadowString=Ls;exports.plugins=tie;exports.registerCustomSetter=nB;exports.styleArr2Obj=Vy;exports.styleList2Text=Wy;exports.styleObjToArr=Uy;exports.waitReactUpdate=Bn;Object.keys(br).forEach(e=>{e!=="default"&&!Object.prototype.hasOwnProperty.call(exports,e)&&Object.defineProperty(exports,e,{enumerable:!0,get:()=>br[e]})});
329
329
  //# sourceMappingURL=index.js.map