@jiess/plus
Version:
基于Jiess核心库的强化与拓展,为Jiess应用的完整形态
1 lines • 110 kB
JavaScript
function e(t,s,i=new WeakMap){if(Object.is(t,s))return!0;const r=typeof t;if(r!==typeof s)return!1;if(!t||!s||"object"!==r)return!1;if(i.has(t)&&i.has(s))return i.get(t)===s&&i.get(s)===t;i.set(t,s),i.set(s,t);const n=Object.prototype.toString.call(t);if(n!==Object.prototype.toString.call(s))return!1;switch(n){case"[object Date]":return t.getTime()===s.getTime();case"[object Promise]":return!1;case"[object Function]":case"[object RegExp]":case"[object Symbol]":return String(t)===String(s);case"[object ArrayBuffer]":case"[object SharedArrayBuffer]":if(t.byteLength!==s.byteLength)return!1;const e=new Uint8Array(t),i=new Uint8Array(s);for(let s=0;s<t.byteLength;s++)if(e[s]!==i[s])return!1;return!0;case"[object BigInt]":return t===s;case"[object TypedArray]":return JSON.stringify(Array.from(t))===JSON.stringify(Array.from(s))}if(Array.isArray(t)){if(t.length!==s.length)return!1;for(let r=0;r<t.length;r++)if(!e(t[r],s[r],i))return!1;return!0}const o=Object.keys(t),a=Object.keys(s);if(o.length!==a.length)return!1;const l=new Set(a);for(let r of o)if(!l.has(r)||!e(t[r],s[r],i))return!1;return!0}const t=(t,s,i=!0)=>{let r=t,n=s;if(i){const e=(t,s)=>{if(!t||"object"!=typeof t)return t;if(s.has(t))return s.get(t);if(G(t))return t;const i=Array.isArray(t)?[]:{};s.set(t,i);for(const r in t)Object.prototype.hasOwnProperty.call(t,r)&&(Array.isArray(i)?i[Number(r)]=e(t[r],s):i[r]=e(t[r],s));return i},i=new WeakMap;r=e(t,i),n=e(s,i)}return e(r,n,new WeakMap)};function s(e){if("string"!=typeof e)return e;const t=e.match(/^\s*/),s=t?t[0]:"",i=e.slice(s.length);return i?s+i.slice(0,1).toUpperCase()+i.slice(1):e}function i(e){if("string"!=typeof e)return e;const t=e.match(/^\s*/),s=t?t[0]:"",i=e.slice(s.length);return i?s+i.slice(0,1).toLowerCase()+i.slice(1):e}const r=(...e)=>{},n=(e=r,t=0)=>{let s=setTimeout((()=>{null!==s&&clearTimeout(s),e()}),t)};function o(e,t,s=!0){if(Array.isArray(t))return t.some((t=>o(e,t)));if("string"==typeof t){const e=t.toLowerCase();"exp"!==e&&"regex"!==e||(t="RegExp")}else if(s)throw new Error(`${t} Error:须提供字符串`);const i="string"==typeof t?t.charAt(0).toUpperCase()+t.slice(1):t,r=Object.prototype.toString.call(e)===`[object ${i}]`;if(!r&&"Object"===i&&null!==e&&"object"==typeof e){const t=Object.prototype.toString.call(e);return t.includes("ArrayBuffer")||t.includes("TypedArray")||t.startsWith("[object ")}return r}const a=o;function l(e,t){for(let s in t){let i=t[s];Array.isArray(i)?(e[s]=[],l(e[s],i)):a(i,"object")?(e[s]={},l(e[s],i)):e[s]=i}Object.getOwnPropertySymbols(t).forEach((s=>{let i=t[s];Array.isArray(i)?(e[s]=[],l(e[s],i)):a(i,"object")?(e[s]={},l(e[s],i)):e[s]=i}))}const c=(e,t,s=new WeakMap)=>{if(!e||"object"!=typeof e){if(t){const s=t(e,"filter");return void 0!==s?s:void 0}return e}if(s.has(e))return s.get(e);if(e instanceof Date){const t=new Date(e.getTime());return s.set(e,t),t}if(e instanceof RegExp){const t=new RegExp(e.source,e.flags);return s.set(e,t),t}if(G(e)){const s=t?.(e,"filter");return void 0!==s?s:e}let i;if(i=Array.isArray(e)?new Array(e.length):{},s.set(e,i),Array.isArray(e))for(let r=0;r<e.length;r++){const n=c(e[r],t,s);void 0!==n&&(i[r]=n)}else{for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)){const n=c(e[r],t,s);void 0!==n&&(i[r]=n)}Object.getOwnPropertySymbols(e).forEach((r=>{const n=c(e[r],t,s);void 0!==n&&(i[r]=n)}))}if(t){const e=t(i,"clone");if(void 0!==e)return e}return i},u=(e,t)=>!(!t||""!==e)||[null,void 0,NaN].some((t=>Object.is(t,e))),h=(e,t)=>!u(e,t),d=(e=32)=>{let t="";for(let s=0;s<e;s++)t+="0123456789abcdefghijklmnopqrstubwxyzABCEDFGHIJKLMNOPQRSTUVWXYZ".charAt(Math.floor(62*Math.random()));return t},f=function(e,t){let s=new Date(e),i={"M+":s.getMonth()+1,"d+":s.getDate(),"D+":s.getDate(),"h+":s.getHours(),"H+":s.getHours(),"m+":s.getMinutes(),"s+":s.getSeconds(),"q+":Math.floor((s.getMonth()+3)/3),S:s.getMilliseconds()};const r=t.match(/([yY]+)/);if(r){const e=s.getFullYear().toString();t=t.replace(r[1],e.slice(4-r[1].length))}const n=["M+","D+","d+","h+","H+","m+","s+","q+"];for(const e of n){const s=new RegExp("("+e+")"),r=t.match(s);if(r){const s=r[1].length,n=i[e],o=1==s?n.toString():("00"+n).slice((""+n).length);t=t.replace(r[1],o)}}const o=t.match(/(S+)/);if(o){const e=o[1].length,s=("000"+i.S).slice(-3),r=1===e?s.slice(0,1):2===e?s.slice(0,2):s;t=t.replace(o[1],r)}return t},p=e=>{if(e&&"object"==typeof e){if("template"===e.$model)return"function"==typeof e.$done?`Template: ${e.name}`:JSON.stringify(e);if(e instanceof Date)return`Date: ${e.toISOString()}`;if(e instanceof RegExp)return`RegExp: ${e.toString()}`;if(e instanceof Map){const t=Array.from(e.entries());return`Map: ${JSON.stringify(t)}`}if(e instanceof Set){const t=Array.from(e.values());return`Set: ${JSON.stringify(t)}`}if(e.fn&&"function"==typeof e.fn)return'{"a": 1, "fn": "() => {}" }';if(e.arr&&Array.isArray(e.arr))return'{"a": 1, "arr": [1, 2, 3] }'}return JSON.stringify(e)},y=function(e){if("undefined"==typeof document)return null;const t=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");let s=new RegExp("(^| )"+t+"=([^;]*)(;|$)"),i=document.cookie.match(s);return i&&void 0!==i[2]?decodeURIComponent(i[2]):null},m=function(e,t,s=30){if("undefined"==typeof document)return;let i=new Date;i.setTime(i.getTime()+24*s*60*60*1e3),t=encodeURIComponent(t),document.cookie=`${e}=${t};expires=${i.toUTCString()};path=/`};function g(){let e=null;return(t,...s)=>(e||(e=Promise.resolve().then((()=>(e=null,t.call(this,...s))))),e)}const b=(e,t=!1)=>{let s;return function(i,r=100){const n=()=>"function"==typeof e?e():"function"==typeof i?i():void 0;h(s,!0)?clearTimeout(s):t&&n(),s=setTimeout(n,r)}},v=b(),w=e=>{let t;return function(s,i=100){h(t,!0)&&clearTimeout(t),t=setTimeout((()=>"function"==typeof e?e():"function"==typeof s?s():void 0),i)}},x=w(),$=e=>{let t=!0;return function(s,i=100){t&&(t=!1,setTimeout((()=>{t=!0,"function"==typeof e?e():"function"==typeof s&&s()}),i))}},_=$(),S=e=>{let t,s=0;return function(i,r=100){const n="function"==typeof e?e:i;let o=Date.now();o-s>=r?(s=o,"function"==typeof n&&n()):h(t,!0)||(t=setTimeout((()=>{s=Date.now(),t=void 0,"function"==typeof n&&n()}),r))}},j=S(),k={initVal:e=>null===e?"null":void 0===e?"undefined":"boolean"==typeof e||"function"==typeof e?e.toString():"object"==typeof e?"[object Object]":"string"==typeof e||"number"==typeof e?e.toString():"",stringify(e){let t=[];for(let s in e){const i=e[s];Array.isArray(i)?i.forEach((e=>t.push(`${s}=${this.initVal(e)}`))):t.push(`${s}=${this.initVal(i)}`)}return t.join("&")},parse(e){const t={};return e.split("&").forEach((e=>{const[s,...i]=e.split("=");if(!s)return;const r=i.join("=");s in t?(Array.isArray(t[s])||(t[s]=[t[s]]),t[s].push(r)):t[s]=r})),t}},C=function(e,...t){return(s,i=[],r)=>{if("function"==typeof s){let n=null;return n=e?s.call(e,...t,...i):s(...t,...i),void 0===n?r:n}return void 0===r?s:r}};function P(e,t){if(!e||!t)return;let s;if(s=Array.isArray(t)?t:t.replace(/\[(\d+)\]/g,".$1").split("."),s=s.filter(Boolean),0===s.length)return;let i=e;for(const e of s)try{const t=Number(e);i=!isNaN(t)&&Number.isInteger(t)&&Array.isArray(i)?i[t]:i[e]}catch(e){return}return i}function A(e,t,s){if(!e||!t||"string"!=typeof t)return;let i=!1;t.endsWith("[]")&&(i=!0,t=t.slice(0,-2));const r=t.replace(/\[(\d+)\]/g,".$1").split(".").filter(Boolean);if(1===r.length){const t=Number(r[0]);if(!isNaN(t)&&Number.isInteger(t)&&Array.isArray(e))return void(e[t]=s)}let n=e;for(let e=0;e<r.length-1;e++){const t=r[e],s=r[e+1],i=Number(s);try{!isNaN(i)&&Number.isInteger(i)?Array.isArray(n[t])||(n[t]=[]):o(n[t],"object")||(n[t]={}),n=n[t]}catch(e){!isNaN(i)&&Number.isInteger(i)?n[t]=[]:n[t]={},n=n[t]}}const a=r[r.length-1],l=Number(a);i?(Array.isArray(n[a])||(n[a]=[]),n[a].push(s)):!isNaN(l)&&Number.isInteger(l)?(Array.isArray(n)||(n[a]=[],n=n[a]),n[l]=s):n[a]=s}function E(e,t){if(null!=e&&null!=t){for(const s in t)if(t.hasOwnProperty(s)){const i=t[s];Array.isArray(i)?e[s]=i:a(i,"object")?(a(e[s],"object")||(e[s]={}),E(e[s],i)):e[s]=i}Object.getOwnPropertySymbols(t).forEach((s=>{const i=t[s];Array.isArray(i)?e[s]=i:a(i,"object")?(a(e[s],"object")||(e[s]={}),E(e[s],i)):e[s]=i}))}}const R=!("undefined"==typeof window||"undefined"==typeof document||!window.document||!window.document.createElement),M="JIESS_CONSTRUCTOR",N="isJiess",O="THIS_IS_JIESS",T="JIESS_INIT_VALUE",D="__JIESS_REF__",I="__JIESS_COMPUTED__",V="JiessForceUpdate",J="__JIESS_PARENT__",B=new Set(["is","component","$exclude"]),F=(e,t)=>Array.isArray(e)?[...e]:a(e,"object")?{...e}:t?void(()=>{throw new Error("shallowCopy Error:须提供对象或数组")})():e;function z(e){return!(!e||"object"!=typeof e||!e[O])}const q=e=>!!a(e,"object")&&!!e[D],L=e=>!!a(e,"object")&&Reflect.has(e,"$proxy"),U=e=>{if(L(e)){const{$proxy:t,field:s="value"}=e;return t[s]}return e},W=(e,t)=>{throw new Error(`${e} Error:${t}`)};function K(e,t,s=r,i="数据类型"){return a(e,t)?s():W(i,`须提供 ${t} 类型`)}const H=(e,t,s=M)=>!!a(e,"object")&&Object.is(e[s],t),G=e=>null!==e&&"object"==typeof e&&(!!z(e)||(e instanceof Date||e instanceof RegExp||(e instanceof ArrayBuffer||"undefined"!=typeof SharedArrayBuffer&&e instanceof SharedArrayBuffer||(e instanceof Promise||(!!(Reflect.has(e,"__v_isReactive")||Reflect.has(e,"__v_isReadonly")||Reflect.has(e,"$")||Reflect.has(e,"_")||Reflect.has(e,"__")||Reflect.has(e,"is")||Reflect.has(e,"$slots")||Reflect.has(e,"$$typeof")||Reflect.has(e,"nodeType"))||(!!Object.keys(e).some((e=>e.startsWith("__v_")||e.startsWith("__react")||e.startsWith("El")||e.startsWith("a-")||e.startsWith("van-")))||"function"==typeof e.install))))));function Z(e={},t="toString"){if("function"==typeof e[t]){if("string"==typeof t){const s=new RegExp(t,"g");return(e[t]+"").replace(s,"")}return e[t]+""}return""}const X=(()=>{const e=Z();return(t,s)=>Z(t,s)===e})(),Y=(e,t,s={})=>(e.has(t)?s=e.get(t):e.set(t,s),s),Q=e=>H(e,"JsRender");function ee(e,t){Q(e)?t(e):Array.isArray(e)&&e.forEach((e=>{Q(e)&&t(e)}))}function te(e){ee(e,(e=>{te(e._resData.children),e.destroy()}))}const se=!0,ie=e=>{const{$proxy:t,field:s,done:i}=e;return i?i(t):s?t[s]:t},re=(e,t)=>Array.isArray(e)?function(e){let t=null;return e.filter((e=>{if(Q(e)){const s=e,{_resConfig:i}=s;let{$if:r=se,$elseIf:n}=i;if(r=U(r),n=U(n),h(n,!0)){"boolean"!=typeof t&&W("$elseIf","须配合$if");const e=!t&&!!n;return t=e,e}if(i.hasOwnProperty("$if")){const e=!!r;return t=e,e}return t=null,r}return t=null,!0}))}(e).map(re):Q(e)?e.getNative(t):h(e)?e:void 0;class ne{_disposed=!1;_resources=[];add(e){if(this._disposed)throw new Error("ResourceManager has been disposed");return this._resources.push(e),this}remove(e){if(this._disposed)return;const t=this._resources.indexOf(e);-1!==t&&this._resources.splice(t,1)}get disposed(){return this._disposed}dispose(){if(!this._disposed){this._disposed=!0;for(let e=this._resources.length-1;e>=0;e--)try{this._resources[e].dispose()}catch(e){}this._resources=[]}}get size(){return this._resources.length}}class oe{static uid=1;constructor(e,t={}){this[M]=e,this.J_uid=oe.uid++,"function"==typeof t&&(t=t(this)),Object.assign(this,t),this.bindCxt()}bindCxt(){for(const e of Reflect.ownKeys(this.__proto__))if("constructor"!==e&&"string"==typeof e){if(e.startsWith("_"))continue;const t=Object.getOwnPropertyDescriptor(this.__proto__,e);if(t&&t.get)continue;"function"==typeof this[e]&&(this[e]=this[e].bind(this)),this.freezeField(e)}}resetField(e,t){Object.prototype.hasOwnProperty.call(this,e)&&Object.defineProperty(this,e,{value:t})}freezeField(e){Object.prototype.hasOwnProperty.call(this,e)&&Object.defineProperty(this,e,{writable:!1,enumerable:!0,configurable:!0})}}class ae extends oe{watcher;fn;flush;effecting="start";value;computer=!1;debounce2;debounce1=b();dirty=!0;get isDirty(){return this.dirty}target;proxy;constructor(e,t,s="pre"){super("Composite"),this.watcher=e,this.fn=t,this.flush=s,this.debounce2=g.call(this)}initComputed(e,t){this.computer=!0,this.target=e,this.proxy=t}init(e,t,s,i){return this.computer&&!this.dirty||(this.computer||this.watcher.effecter.stop(this),this.watcher.effecter.addCurrent(this),this.done(e,t,s,i),this.watcher.effecter.removeCurrent(),this.dirty=!1),this.value}done(e,t,s,i){return this.computer?"doned"===this.effecting?this.value=this.fn(s,t,e,i):(this.effecting="start",this.value=this.fn(s,t,e,i),this.effecting="computed",this.computer&&(this.proxy.value=this.value),this.effecting="doned"):(this.effecting="start",this.value=this.fn(s,t,e,i),this.effecting="computed",this.effecting="doned"),this.value}check(e){this.computer?"start"===this.effecting?W("Computed","计算中禁止赋值"):"function"==typeof e&&e((e=>{this.target.value=e,this.watcher.effecter.trigger(this.target,"value",e,this.proxy)})):"function"==typeof e&&e()}trigger(e,t,s,i){this.dirty=!0,this.check(((n=r)=>{"sync"===this.flush?n(this.init(e,t,s,i)):"pre"===this.flush?this.debounce2((()=>n(this.init()))):this.debounce1((()=>n(this.init())),0)}))}stop(){this.watcher.effecter.stop(this)}}const le=new Set([Symbol.iterator,"constructor","__proto__","prototype",NaN,null,void 0,1/0]),ce=new Set(["push","pop","shift","unshift","splice","sort","reverse"]);class ue extends oe{watcher;current;execStack=[];mapStore;reverseMap;collectCache;constructor(e){super("Effecter"),this.watcher=e,this.mapStore=new WeakMap,this.reverseMap=new WeakMap,this.collectCache=new WeakMap}addCurrent(e){this.current&&this.execStack.push(this.current),this.current=e,this.collectCache.set(e,new WeakMap)}removeCurrent(){this.current&&this.collectCache.delete(this.current),this.current=this.execStack.pop()}shouldExclude(e,t){return(!Array.isArray(e)||"string"!=typeof t||!ce.has(t))&&(le.has(t)||X(e,t))}getCacheKey(e,t){try{return`${e.constructor.name}-${JSON.stringify(t)}-${e[Symbol.toStringTag]||""}`}catch(s){return`${e.constructor.name}-${String(t)}-${e[Symbol.toStringTag]||""}`}}collect(e,t){if(!this.current||"start"!==this.current.effecting)return;if(this.shouldExclude(e,t))return;const s=this.current,i=t,r=this.collectCache.get(s);if(r){const s=r.get(e);if(s&&s.has(t))return}const n=Y(this.mapStore,e);if(n[i]=n[i]||new Set,n[i].add(s),this.mapStore.set(e,n),r){const s=r.get(e)||new Set;s.add(t),r.set(e,s)}const o=this.reverseMap.get(s)||new Set;o.add({target:e,key:i}),this.reverseMap.set(s,o)}trigger(e,t,s,i){if(this.shouldExclude(e,t))return;this.current?.check();const r=Y(this.mapStore,e),n=t;if(r.hasOwnProperty(n)){const o=new Set(r[n]),a=new Set;o.forEach((r=>{r===this.current||a.has(r)||(r.trigger(e,t,s,i),a.add(r))}))}this.watcher.update(i,t,s)}stop(e){const t=this.reverseMap.get(e);t&&(t.forEach((({target:t,key:s})=>{const i=this.mapStore.get(t);i&&i[s]&&(i[s].delete(e),0===i[s].size&&delete i[s],0===Object.keys(i).length&&this.mapStore.delete(t))})),this.reverseMap.delete(e),this.collectCache.delete(e))}}const he=new Set(["push","pop","shift","unshift","splice","sort","reverse"]);class de extends oe{watcher;_targetToProxy=new WeakMap;_childKeyMap=new WeakMap;constructor(e){super("Observer"),this.watcher=e}create(e,t,s=new WeakSet,i=!1){return G(e)&&"Target"!==e[M]?e:K(e,["array","object"],(()=>{if(s.has(e))return this._targetToProxy.get(e)||e;s.add(e);const r=new Proxy(e,this.getProxyHandler(t));if(this._targetToProxy.set(e,r),!i)for(const t in e)if(!B.has(t)&&o(e[t],["array","object"])){const i=this.create(e[t],r,s,!1);this._childKeyMap.set(i,t),e[t]=i}return r}),"创建响应式数据")}getProxyHandler(e){return{has:(e,t)=>(this.watcher.effecter.collect(e,t),t in e),get:(t,s,i)=>{if(s===O)return!0;if("__JIESS_TARGET__"===s)return t;if(s===J)return e;if(s===Symbol.toStringTag)return Array.isArray(t)?"Array":t instanceof Map?"Map":t instanceof Set?"Set":t instanceof Date?"Date":t instanceof RegExp?"RegExp":"Object";if(this.watcher.effecter.collect(t,s),H(t,!0,I)&&"value"===s)return t.getValue();if(t instanceof Map||t instanceof Set||t instanceof Date||t instanceof RegExp){const e=Reflect.get(t,s);return"function"==typeof e?e.bind(t):e}const r=Reflect.get(t,s,i);if(Array.isArray(t)&&"string"==typeof s&&he.has(s)){const e=this,r=Array.prototype[s];return function(...n){const a=t.length,l="sort"===s||"reverse"===s||"unshift"===s||"shift"===s,c=l?[...t]:null,u=r.apply(t,n);if("push"===s||"unshift"===s||"splice"===s){const r=[...n];"splice"===s&&r.splice(0,2),r.forEach(((a,l)=>{if(o(a,["array","object"])&&!(a instanceof Map)&&!(a instanceof Set)&&!(a instanceof Date)&&!(a instanceof RegExp)){const o=new WeakSet,c=e.create(a,i,o,!1);let u=0;"push"===s?u=t.length-r.length+l:"unshift"===s?u=l:"splice"===s&&(u=n[0]+l),e._childKeyMap.set(c,u),t[u]=c}}))}if("splice"===s)for(let s="number"==typeof n[0]?n[0]:0;s<t.length;s++){const i=t[s];i&&"object"==typeof i&&e._childKeyMap.has(i)&&e._childKeyMap.set(i,s)}else if("sort"===s||"reverse"===s||"shift"===s||"unshift"===s)for(let s=0;s<t.length;s++){const i=t[s];i&&"object"==typeof i&&e._childKeyMap.has(i)&&e._childKeyMap.set(i,s)}if(l&&c)for(let e=0;e<Math.max(a,t.length);e++)Object.is(c[e],t[e])||(i[e]=t[e]);else{let e=0,r=Math.max(a,t.length);"push"===s?(e=a,r=t.length):"pop"===s?(e=t.length,r=a):"splice"===s&&(e="number"==typeof n[0]?n[0]:0);for(let s=e;s<r;s++)i[s]=t[s]}return i.length=t.length,e.trigger(t,s,u,i),u}}return r},set:(t,s,i,r)=>{if(s===J)return e=i,!0;if(Object.is(t[s],i))return!0;const n=Reflect.set(t,s,i,r);return this.trigger(t,s,i,r),n},deleteProperty:(e,t)=>{if(t in e){const s=Reflect.deleteProperty(e,t),i=this._targetToProxy.get(e)||e;return this.trigger(e,t,void 0,i),s}return Reflect.deleteProperty(e,t)}}}trigger(e,t,s,i){const{effecter:r}=this.watcher;if(H(e,!0,I))e.setValue(s,t);else if(r.trigger(e,t,s,i),Array.isArray(e)&&"string"==typeof t&&he.has(t)&&r.trigger(e,"length",e.length,i),i&&i[J]){const e=i[J],t=this._childKeyMap.get(i);void 0!==t&&r.trigger(e,t,i,e)}}}const fe=(e,t)=>void 0===e?t:e;class pe extends oe{proxy;field;config;value;result;oldValue;isDestory=!1;cbs;debounce1;other;_resourceManager;get disposed(){return this._resourceManager.disposed}constructor(e,t,s={}){super("Observe"),this.proxy=e,this.field=t,this.config=s,this._resourceManager=new ne,this.cbs=new Set,this.debounce1=b(),this._resourceManager.add({disposed:!1,dispose:()=>{this.debounce1=null}});const{hasKey:i,defaultValue:r,observe:n,...o}=s;this.other=o,this.observe(n),this.value=F(i?e[t]:e);const a=this.value=fe(this.value,r);this.getValue(((e,t)=>{this.result=e,t&&this.dispatch(e,{value:a,...o})}))}getValue(e){const{value:t,config:s,result:i}=this,{defaultValue:r,done:n}=s;"function"==typeof n?a(n,"AsyncFunction")?(n(t,this).then((t=>e(t,!0))).catch((e=>{console.error("Observe.getValue async done error:",e)})),e(fe(i,r))):e(n(t,this)):e(t)}observe(e){return"function"==typeof e&&this.cbs.add(e),this}remove(e){return"function"==typeof e&&this.cbs.delete(e),this}destroy(){this.dispose()}dispose(){this._resourceManager.disposed||(this.isDestory=!0,this._resourceManager.dispose(),this.cbs.clear(),this.proxy=null,this.field=null,this.config=null,this.other=null)}resolve(e){if(this.isDestory||!this.config)return;const s=this.value,i={value:e,oldValue:s,...this.other};let{isSync:r,hasKey:n,sameState:o=!1,done:a}=this.config;if(n){try{o=t(s,e)}catch(e){console.error(e)}this.value=e,this.oldValue=s,o&&"function"!=typeof a||this.getValue((e=>this.dispatch(e,i)))}else{const t=()=>{this.value=F(e),this.getValue((e=>this.dispatch(e,i)))};r?t():this.debounce1((()=>t()),0)}}dispatch(e,t){t.oldResult=this.result,t.result=this.result=e,this.cbs.forEach((s=>{s(e,t.oldResult,t)}))}}class ye extends oe{_setter;_composite;value;constructor(){super("Target"),this[O]=!0,this.value=T,this[I]=!0}initSetter(e){this._setter=e}initComposite(e){this._composite=e}getValue(){return(this.value===T||this._composite&&this._composite.isDirty)&&(this.value=this._composite?.init()),this.value}setValue(e,t){"value"!==t?W("Computed","仅允许对value赋值"):"function"==typeof this._setter?(this._setter(e),this.update()):"computed"===this._composite?.effecting||W("Computed","须提供setter")}update(){this._composite&&this._composite.trigger(this,"value",this.value,this)}}class me extends oe{static _default;static getDefault(){return me._default&&!me._default.disposed||(me._default=new me),me._default}static _globalResourceManager;_proxyToObserve=new WeakMap;_proxyToObserveNo=new WeakMap;_pathCache=new WeakMap;_dependencyCache=new WeakMap;effecter;observer;_resourceManager;get disposed(){return this._resourceManager?.disposed??me._globalResourceManager?.disposed??!1}constructor(){super("Watcher"),this._resourceManager=new ne,this.observer=new de(this),this.effecter=new ue(this)}static getGlobalResourceManager(){return me._globalResourceManager||(me._globalResourceManager=new ne),me._globalResourceManager}clearProxyResources(e){this.clearObservers(e),this._proxyToObserve.delete(e),this._proxyToObserveNo.delete(e)}dispose(){this._resourceManager?.disposed||(this._resourceManager?.dispose(),me._globalResourceManager&&!me._globalResourceManager.disposed&&(me._globalResourceManager.dispose(),me._globalResourceManager=void 0),this._proxyToObserve=new WeakMap,this._proxyToObserveNo=new WeakMap,this._pathCache=new WeakMap,this._dependencyCache=new WeakMap,me._default===this&&(me._default=void 0))}static disposeAll(){me.getGlobalResourceManager().dispose()}hasLoopReference(e,t=new WeakSet){if("object"!=typeof e||null===e)return!1;if(t.has(e))return!0;t.add(e);let s=0;const i=[{obj:e,keys:Object.keys(e),index:0}];for(;i.length>0&&s<1e3;){const e=i[i.length-1];if(!e)break;const{obj:r,keys:n,index:o}=e;if(o>=n.length){t.delete(r),i.pop(),s--;continue}const a=n[o];e&&(e.index=o+1);const l=r[a];if("object"==typeof l&&null!==l){if(t.has(l))return!0;t.add(l),i.push({obj:l,keys:Object.keys(l),index:0}),s++}}return i.forEach((e=>t.delete(e.obj))),!1}createProxy(e){let t=e;return this.hasLoopReference(e)&&(t=c(e)),this.observer?.create(t)}createShallowProxy(e){return this.observer?.create(e,void 0,new WeakSet,!0)}createComputed(e,t){const s=new ye,i=this.createProxy(s);if(a(e,"object")){const{get:t,set:i}=e;"function"==typeof t&&(e=t),"function"==typeof i&&s.initSetter(i)}const r=new ae(this,e,t);return s.initComposite(r),r.initComputed(s,i),i}watchEffect(e,t){const s=new ae(this,e,t);return s.init(),()=>s.stop()}observe(e={$proxy:{}}){let{$proxy:t,field:s,warn:i=!0,...r}=e,n=t,o=s;if("string"==typeof s&&s.includes(".")){let e=this._pathCache.get(t);e||(e=new Map,this._pathCache.set(t,e));const i=s,r=e.get(i);if(r)n=r.target,o=r.field;else{const r=s.split("."),a=r.pop(),l=P(t,r);e.set(i,{target:l,field:a}),n=l,o=a}}const l=a(n,"object")&&(Reflect.has(n,I)||Reflect.has(n,D))?"value":o,c=r.hasKey=a(l,["number","string"]);if(z(n)){const e=new pe(n,l,r);if(c){const t=Y(this._proxyToObserve,n,{}),s=l;t[s]=t[s]||[],t[s].push(e),this._proxyToObserve.set(n,t)}else{const t=Y(this._proxyToObserveNo,n,[]);this._proxyToObserveNo.set(n,t),t.push(e)}return e}if(i){if("function"==typeof i){const e=r.done,t=i(n,l);return e?e(t):t}console.warn("$proxy:需要定义为响应式对象")}return ie(e)}bind(e,t,s,{cb:i}){if(!a(s,["number","string"])&&null!=s){const r=s,n=this.createProxy(r);return n[J]=e,"function"==typeof i?i(n):t&&(e[t]=n),n}e[t]=s}update(e,t,s){const i=this._proxyToObserve.get(e);if(i&&Object.keys(i).length>0){const r=i[t];if(r&&Array.isArray(r)&&r.length>0){const n=r.filter((e=>!e.isDestory));n.length>0&&(n.forEach((e=>e.resolve(s))),i[t]=n,0===n.length&&(delete i[t],0===Object.keys(i).length&&this._proxyToObserve.delete(e)))}}this.resolveParent(e)}clearObservers(e){if(this._proxyToObserve.has(e)){const t=this._proxyToObserve.get(e);if(t)for(const e in t){const s=t[e];Array.isArray(s)&&s.forEach((e=>e.destroy()))}this._proxyToObserve.delete(e)}if(this._proxyToObserveNo.has(e)){const t=this._proxyToObserveNo.get(e);Array.isArray(t)&&t.forEach((e=>e.destroy())),this._proxyToObserveNo.delete(e)}}resolveParent(e){if(this._proxyToObserveNo.has(e)){const t=this._proxyToObserveNo.get(e);if(Array.isArray(t)){const s=t.filter((t=>!t.isDestory&&(t.resolve(e),!0)));s.length!==t.length&&(0===s.length?this._proxyToObserveNo.delete(e):this._proxyToObserveNo.set(e,s))}}const t=e[J];t?.[O]&&this.resolveParent(t)}}const ge={reactive:new WeakMap,raw:new WeakMap,shallowReactive:new WeakMap,refCache:new Map,refMap:new WeakMap,computedMap:new WeakMap},be=new WeakMap;function ve(e){return z(e)}function we(e){return q(e)}function xe(e,t={}){return K(e,["Object","Array"],(()=>{let s;const{shallow:i=!1}=t;return i?ge.shallowReactive.has(e)?s=ge.shallowReactive.get(e):(s=me.getDefault().createShallowProxy(e),ge.shallowReactive.set(e,s),ge.raw.set(s,e)):ge.reactive.has(e)?s=ge.reactive.get(e):(s=me.getDefault().createProxy(e),ge.reactive.set(e,s),ge.raw.set(s,e)),s}),"创建响应式对象:参数必须是对象或数组类型")}function $e(e,t,s={}){const{shallow:i=!1}=s;if(t&&ge.refCache.has(t))return ge.refCache.get(t);if(a(e,["array","object"])){const t=e;if(ge.refMap.has(t))return ge.refMap.get(t)}const r={value:e,[D]:!0},n=i?me.getDefault().createShallowProxy(r):me.getDefault().createProxy(r);return t?ge.refCache.set(t,n):a(e,["array","object"])&&ge.refMap.set(e,n),n}function _e(e,t){return K(e,["Object","Function"],(()=>{let s=null;return ge.computedMap.has(e)?s=ge.computedMap.get(e):(s=me.getDefault().createComputed(e,t),ge.computedMap.set(e,s)),s}),"创建计算属性:参数必须是函数或包含 getter/setter 的对象")}function Se(e,t,s,i={}){return me.getDefault().bind(e,t,s,i)}function je(e,t,s){const i={};"number"==typeof t?isNaN(t)||(i.field=t):"function"==typeof t?(s=t,t=void 0):t&&("object"==typeof t?Object.assign(i,t):"string"==typeof t&&(i.field=t));let r=e;if("string"==typeof i.field){let t=i.field;if(t&&t.includes(".")){let s=be.get(e);s||(s=new Map,be.set(e,s));const n=t,o=s.get(n);if(o)r=o.target,t=o.field;else{const i=t.split("."),o=i.pop(),a=P(e,i);s.set(n,{target:a,field:o}),r=a,t=o}i.field=t}}const n=me.getDefault().observe({$proxy:r,...i});if(H(n,"Observe")){if(i.immediate){let e;e=!i.field||"string"!=typeof i.field&&"number"!=typeof i.field?r:r[i.field],s(e,void 0)}return n.observe(((e,t)=>{s(e,t)})),()=>{n.destroy()}}return()=>{}}const ke=(e,t)=>K(e,"function",(()=>me.getDefault().watchEffect(e,t)),"创建副作用观察器:参数必须是函数");function Ce(e){if(ge.reactive.has(e)){const t=ge.reactive.get(e);t&&ge.raw.delete(t),ge.reactive.delete(e)}if(ge.shallowReactive.has(e)){const t=ge.shallowReactive.get(e);t&&ge.raw.delete(t),ge.shallowReactive.delete(e)}if(ge.refMap.has(e)){const t=ge.refMap.get(e);if(t)for(const[e,s]of ge.refCache.entries())s===t&&ge.refCache.delete(e);ge.refMap.delete(e)}}function Pe(e){return ge.raw.get(e)}function Ae(e){ge.refCache.delete(e)}class Ee{static removeComments(e){if("string"!=typeof e)return e;const t=[];let s=0;const i=e.length;for(;s<i;)if("/"===e[s]&&"/"===e[s+1])for(;s<i&&"\n"!==e[s];)s++;else if("/"===e[s]&&"*"===e[s+1]){for(s+=2;s<i-1&&("*"!==e[s]||"/"!==e[s+1]);)s++;s+=2}else{const i=e[s];void 0!==i&&t.push(i),s++}return t.join("")}static dedupeStyleString(e){if("string"!=typeof e)throw new Error("styleString 必须是字符串类型");if(""===e.trim())return e;try{const t=new Map,s=/([^{]+)\{([^}]+)\}/g;e.replace(s,((e,s,i)=>{const r=s.trim(),n=i.trim();return t.set(r,n),e}));const i=[];for(const[e,s]of t)i.push(`${e}{${s}}`);return i.join("")}catch(e){throw new Error(`去重样式规则时发生错误:${e instanceof Error?e.message:String(e)}`)}}static parseSassLikeSyntax(e){if("string"!=typeof e||""===e.trim())return"";const t=this.removeComments(e),s={variables:new Map},i=(e,t)=>{for(;t<e.length;){const s=e[t];if(!s||!/\s/.test(s))break;t++}return t},r=(e,t=new Set)=>{let i,n=e;do{i=!1,n=n.replace(/\$([a-zA-Z0-9_-]+)/g,((e,n)=>{const o=s.variables.get(n);if(o){if(t.has(n))return console.warn(`变量循环引用检测到:$${n}`),e;const s=new Set(t);s.add(n);const a=r(o,s);return a!==e?(i=!0,a):e}return e}))}while(i);return n},n=(e,t="",o=0)=>{if(o>50)return console.warn("Sass 解析递归深度超过限制"),"";const a=[];let l=0;try{for(;l<e.length&&(l=i(e,l),!(l>=e.length));){if("$"===e[l]){let t=l+1;for(;t<e.length;){const s=e[t];if(!s||!/[a-zA-Z0-9_-]/.test(s))break;t++}if(t<e.length&&":"===e.substring(t,t+2).trim()){const i=e.substring(l+1,t).trim();for(t+=2;t<e.length;){const s=e[t];if(!s||!/\s/.test(s))break;t++}const r=[];let n=!1,o="";for(;t<e.length;){const s=e[t];if(!s||";"===s&&!n)break;'"'!==s&&"'"!==s||"\\"===e[t-1]||(n?s===o&&(n=!1):(n=!0,o=s)),r.push(s),t++}s.variables.set(i,r.join("").trim()),l=t+1;continue}}const i=[];for(;l<e.length;){const t=e[l];if(!t||"{"===t)break;i.push(t),l++}if(l>=e.length||"{"!==e[l])break;l++;const o=[];let c=1;for(;l<e.length&&c>0;){const t=e[l];if(!t)break;if("{"===t)c++;else if("}"===t&&(c--,0===c))break;o.push(t),l++}l++;const u=i.join("").split(",").map((e=>e.trim())).filter(Boolean);for(const e of u){let s=e;if(t)if(s=e.replace(/&/g,t),s.startsWith(t)){const e=s[t.length];void 0!==e&&/[\w-]/.test(e)&&(s=`${t} ${s}`)}else s=`${t} ${s}`;const i=[],l=[];let u=0;for(;u<o.length;){for(;u<o.length;){const e=o[u];if(!e||!/\s/.test(e))break;u++}if(u>=o.length)break;let e=u;for(;e<o.length;){const t=o[e];if(!t||"{"===t||";"===t)break;e++}if(e<o.length&&"{"===o[e]){const t=o.slice(u,e).join("").trim();let s=1;const i=[];for(e++;e<o.length&&s>0;){const t=o[e];if(!t)break;if("{"===t)s++;else if("}"===t&&(s--,0===s))break;i.push(t),e++}l.push(`${t}{${i.join("")}} `),u=e+1}else{let e=!1,t="";for(;u<o.length;){const s=o[u];if(!s||";"===s&&!e)break;'"'!==s&&"'"!==s||"\\"===o[u-1]||(e?s===t&&(e=!1):(e=!0,t=s)),i.push(s),u++}u<o.length&&(i.push(";"),u++)}}let h=r(i.join("")),d=r(l.join(""));h=h.trim(),h&&a.push(`${s}{${h}}`),d&&a.push(n(d,s,c+1))}}return a.join("")}catch(e){return console.error("Sass 解析错误:",e),""}};return n(t)}}const Re=new Map;let Me=0;class Ne{static generateScopeId(){if(Re.size>=1e4){const e=Math.floor(1e3);let t=0;for(const s of Re.keys()){if(t>=e)break;Re.delete(s),t++}}return"jiess-scope"+ ++Me}static escapeCssIdentifier(e){return e.replace(/[^\w-]/g,"-")}static sanitizeCss(e){return"string"!=typeof e?"":e.replace(/[<>"'`]/g,"").replace(/expression\s*\([^)]*\)/gi,"").replace(/javascript\s*:/gi,"").replace(/data\s*:/gi,"").replace(/@import[^;]+;/gi,"").replace(/behavior\s*:[^;]+/gi,"").replace(/-moz-binding\s*:[^;]+/gi,"").replace(/url\s*\(\s*['"]?\s*(javascript|data|vbscript)\s*:[^)]*\)/gi,"url(about:blank)").trim()}static scopeStyleString(e,t){if("string"!=typeof e)throw new Error("styleString 必须是字符串类型");if(""===e.trim())throw new Error("styleString 必须是非空字符串");if("string"!=typeof t)throw new Error("scopeId 必须是字符串类型");if(""===t.trim())throw new Error("scopeId 必须是非空字符串");const s=`${e}__${t}`;if(Re.has(s))return Re.get(s);t=t.trim();try{const i=Ee.parseSassLikeSyntax(e),r=/([^{]+)\{([^}]+)\}/g,n=i.replace(r,((e,s,i)=>{const r=s.trim();if(!r)return r;if(r.includes(t))return r;let[n,...o]=r.split(":global");return n=n.replace(/([.#])([\w-]+)/g,((e,s,i)=>{const r=this.escapeCssIdentifier(i);return`${s}${t}_${r}`})),o&&(n+=o.join(" ")),n=n.replace(/\s+/g," ").trim(),`${n}{${i}}`})),o=Ee.dedupeStyleString(n);return Re.set(s,o),o}catch(e){throw new Error(`处理样式时发生错误:${e instanceof Error?e.message:String(e)}`)}}static clearCache(){Re.clear()}static getCacheSize(){return Re.size}}class Oe{static mountStyle(e,t){if(!e||"object"!=typeof e)throw new Error("jiessEnv 必须是有效的环境对象");if(!Array.isArray(t))throw new Error("styleInfo 必须是数组类型");if("undefined"!=typeof window){if(!e.styleNode)return Array.isArray(e.recordStyleInfo)||(e.recordStyleInfo=[]),e.recordStyleInfo.push(...t),void console.log("StyleInjector.mountStyle: styleNode 不存在,样式信息已缓存");try{if(e.styleNode.sheet){const s=e.styleNode.sheet;t.forEach((({style:t})=>{try{if("string"!=typeof t||""===t.trim())return void console.warn("StyleInjector.mountStyle: 无效的样式字符串");if("function"==typeof s.insertRule)t.split("}").filter((e=>e.trim())).forEach((t=>{if(t.trim())try{s.insertRule(t+"}",s.cssRules.length)}catch(s){console.error("插入 CSS 规则失败:",s),e.styleNode&&(e.styleNode.textContent?e.styleNode.textContent+=t+"}":e.styleNode.textContent=t+"}")}}));else if("function"==typeof s.addRule){const e=t.match(/([^{]+)\{([^}]+)\}/);if(e&&e[1]&&e[2]){const t=e[1].trim(),i=e[2].trim();s.addRule(t,i)}}}catch(s){console.error("CSSStyleSheet API 失败,降级使用 textContent:",s),e.styleNode&&(e.styleNode.textContent?e.styleNode.textContent+=t:e.styleNode.textContent=t)}}))}else t.forEach((({style:t})=>{try{if("string"!=typeof t||""===t.trim())return void console.warn("StyleInjector.mountStyle: 无效的样式字符串");e.styleNode&&(e.styleNode.textContent?e.styleNode.textContent+=t:e.styleNode.textContent=t)}catch(e){console.error("使用 textContent 挂载样式失败:",e)}}))}catch(e){console.error("StyleInjector.mountStyle 执行失败:",e)}}else console.warn("StyleInjector.mountStyle: 非浏览器环境,样式挂载被跳过")}}class Te extends oe{ctx;debounce1=b();constructor(e,t){super("Attrs"),this.data={},this.config={},this.ctx=e.ctx,this.init(t)}handleAttrs({id:e,cs:t,cn:s,...i}={}){const{env:r}=this.ctx.component.jiessEnv,n=this.ctx.styleScope;"string"==typeof e&&e.trim()&&(n&&(e=`${n}_${e.trim()}`),i.id=e);let o=[];if(t&&(Array.isArray(t)?o=t.map((e=>e?.trim())).filter(Boolean):"string"==typeof t&&(o=t.split(" ").map((e=>e?.trim())).filter(Boolean))),s){let e=[];Array.isArray(s)?e=s.map((e=>e?.trim())).filter(Boolean):"string"==typeof s&&(e=s.split(" ").map((e=>e?.trim())).filter(Boolean)),n&&(e=e.map((e=>`${n}_${e?.trim()}`))),o=[...o,...e]}const a=[...new Set(o)];return a.length&&(i["vue3"===r?"class":"className"]=a.join(" ")),i}initCssValue(e,t){if(e){if(L(e)&&z(e.$proxy)){const s=me.getDefault().observe(e);s.observe((e=>{a(e,["string","number","array"])&&t&&t(e)})),e=s.result}if(a(e,["string","number","array"]))return e}}debounceUpdate(e,{id:t,cs:s,cn:i}){this.debounce1((()=>{Object.assign(e,this.handleAttrs({id:t,cs:s,cn:i})),this.ctx.forceUpdate()}),0)}initAttrs(e){let t=e.className,s=e.class,i=e.id;delete e.className,delete e.class,delete e.id,t=this.initCssValue(t,(r=>{t=r,this.debounceUpdate(e,{id:i,cs:s,cn:t})})),s=this.initCssValue(s,(r=>{s=r,this.debounceUpdate(e,{id:i,cs:s,cn:t})})),i=this.initCssValue(i,(r=>{i=r,this.debounceUpdate(e,{id:i,cs:s,cn:t})})),Object.assign(e,this.handleAttrs({id:i,cs:s,cn:t}))}init(e){const t=this.ctx.component?.jiessEnv?.env||"vue3",{children:s,...i}=function(e,t){const{$mergeAttrs:s,...i}=t||{};return Object.assign(i,s?.[e])}(t,e);var r,n,o;return r=["$if","$ref","$elseIf","$name","$slots","$mergeAttrs"],n=i,o=this.config,r.forEach((e=>{n.hasOwnProperty(e)&&(o[e]=n[e],delete n[e])})),h(s)&&(i.children=s),this.data=i,this}}const De=new WeakMap;class Ie extends oe{ctx;attrs;constructor(e,t){if(super("Done"),this.ctx=e,this.attrs=t,De.has(t)){const s=De.get(t);return s.ctx=e,s}De.set(t,this)}beginSetup(e){const{ctx:t}=this,s={},{setup:i,props:r,name:n,style:o}=e,{$slots:l}=t.PJR?._resConfig||{},c=n?`【组件-${n}】`:"";let u=this.ctx.inject("jiess_css-scope",1/0);const h={default:()=>{const{default:e,children:s}=t.PJR?._resData||{};return e??s??null}};if(o&&!e.styleInfo){let s=null;s="function"==typeof o?o(this.ctx.jiess):o,K(s,["string","object"],(()=>{let i="",r="";if("string"==typeof s?i=s:"object"==typeof s&&(s.scope&&(r=s.scope),i=s.css),i&&"string"==typeof i){const s=e.styleInfo={styleScope:"",style:""};if(r){const t=Ne.generateScopeId();s.styleScope=e.styleScope=t,s.style=Ne.scopeStyleString(i,t),e.styleMode=["public","protected"].includes(r)?r:"private"}else s.style=i;const n=t.jiess.getFrameworkAPI("jiessEnv");Oe.mountStyle(n,[s])}}),"function"==typeof o?`${c}style返回`:`${c}style参数`)}e.styleScope?(this.ctx.styleScope=e.styleScope,"public"===e.styleMode?this.ctx.provide({"jiess_css-scope":e.styleScope}):"protected"===e.styleMode?this.ctx.provide({"jiess_css-scope":null}):e.styleMode):u&&(this.ctx.styleScope=u);for(const e in l)"function"==typeof l[e]?h[e]=(...s)=>l[e].call(t,...s):h[e]=()=>l[e];const d=new Te(this,this.attrs);s.$param={slots:h,data:d.data},s.$props=function(e,t,s=""){if(t){let i="",r={};return s&&(i=`${s} 组件 `),K(t,"function",(()=>{let s=t();K(s,"object",(()=>{for(let t in s){const n=s[t];let o,l=!1,c=null,u=!1,h=!1;if("string"==typeof n)c=n;else if("object"==typeof n){const e=n;c=e.type,o=e.default,h=!!e.isRef,l=!!e.required,u=!!e.isResponsive}l&&!e.hasOwnProperty(t)&&W(`${i}${t}`,"必须");const d=e=>{if(null!=e)return"string"!=typeof c||a(e,c)||W(`${i}${t}`,`须提供 ${c} 类型`),e},f=e=>e&&"object"==typeof e&&e[D],p=e.hasOwnProperty(t)?e[t]:o;u&&!z(p)&&W(`${i}${t}`,"须提供 Jiess 响应式数据"),f(p)?(d(p.value),r[t]=p):void 0!==p&&h?W(`${i}${t}`,"须提供 JiessRef 响应式数据"):r[t]=d(p)}}),`${i}Props 返回`)}),`${i}Props 定义`),r}return{...e}}(d.data,r,n),t.expose(s),K(i,["function","asyncFunction"],(()=>{i.call(t,s.$props,s.$param)}),"setup函数")}buildRender(e=this.attrs){return this.jsRender&&!this.jsRender.isDestory||(this.jsRender=new He(this.ctx,new Te(this,e))),this.jsRender}}class Ve extends oe{ctx;children;_resourceManager;get disposed(){return this._resourceManager.disposed}constructor(e,t){super("SlotRender"),this.ctx=e,this.children=t,this._resourceManager=new ne}dispose(){this._resourceManager.disposed||this._resourceManager.dispose()}initNodes(e){return u(e)?e:[e].flat(1/0).filter((e=>h(e))).map((e=>"function"==typeof e?e:"object"==typeof e?Q(e)?e:new Ie(this.ctx,e).buildRender():e+""))}toRender(e,t){const{$env:s}=this.ctx.jiess,i=this.ctx.jiess.getFrameworkAPI("$tag","div"),{is:r=i,children:n,...o}=e._resData;e._initKey(o,t);const a=this.getSlots(n,e);return"JiessFragment"===r?"vue3"===s?a.default?.call(this):a:this.$h(r,o,a)}$h(e,t,s){const{jiessEnv:i}=this.ctx.component;return i.createElement(e,t,s)}getSlots(e,t){const{ctx:s}=this,{env:i}=s.component.jiessEnv,r=e=>{const s=this.initNodes(e);return ee(s,(e=>e._injectKey(t))),re(s)};let{$slots:n}=t._resConfig||{};if("react"===i){if(h(e)){let t=r(e);return t.length>1?t:t[0]}return null}{n={...n};let t={};for(let e in n){const i=n[e],o=a(i,"function");t[e]=e=>r(o?i.call(s,e):i)}return t.hasOwnProperty("default")||h(e)&&(t.default=()=>r(e)),t}}}function Je(e,t=10,s){let i=null;if(s?.ctx){const{_provideData:r,PJR:n}=s?.ctx;a(r,"object")&&r.hasOwnProperty(e)?i=r[e]:n&&t>0&&(i=Je(e,--t,n))}return i}class Be extends oe{component;PJR;_funcToObserve=new WeakMap;_provideData={};_slotRender;_nodes=[];_lifts={beforeRender:[],beforeMount:[],mounted:[],beforeUpdate:[],updated:[],beforeUnmount:[]};_resourceManager;get disposed(){return this._resourceManager.disposed}static createInitCallback(e){return t=>{if(!e||!e.contextParam)return;const{$page:s,...i}=e.contextParam;return"function"==typeof s&&(i.$page=s.call(t,e)),i}}constructor(e,t,s,i){const{jiess:r}=e.jiessEnv;super("Context",Be.createInitCallback(r)),this.PJR=i,this.jiess=r,this.component=e,this._resourceManager=new ne,this._slotRender=new Ve(this,s||[]),new Ie(this,t||{}).beginSetup(e.IS)}dropStaticJsRender(e){Ue.has(e)&&Ue.delete(e)}forceUpdate(){const{forceUpdate:e}=this.component?.frame||{};"function"==typeof e&&e()}onBeforeRender(e){this._lifts.beforeRender.push({fn:e,once:!1})}onBeforeMount(e){this._lifts.beforeMount.push({fn:e,once:!1})}onMounted(e,t=!1){this._lifts.mounted.push({fn:e,once:t})}onBeforeUpdate(e,t=!1){this._lifts.beforeUpdate.push({fn:e,once:t})}onUpdated(e,t=!1){this._lifts.updated.push({fn:e,once:t})}onBeforeUnmount(e){this._lifts.beforeUnmount.push({fn:e,once:!1})}nextTick(e){const t=Promise.resolve();return e?t.then(this?e.bind(this):e):t}add(...e){const t=this._nodes.length,s=this._slotRender,i=e=>{e=this._toObserve(e,i),te(this._nodes[t]),this._nodes[t]=s.initNodes(e),this.forceUpdate()};return 0===(e=this._toObserve(e,i)).length||this._nodes.push(s.initNodes(e)),this}_toObserve(e,t,s){const i=e=>{if(L(e)){if(z(e.$proxy)){const i=me.getDefault().observe(e);s&&(s.observeInstance=i);let r=this._funcToObserve.get(t);return r=r?[...r,i]:[i],this._funcToObserve.set(t,r),i.observe(((e,s)=>{const r=this._funcToObserve.get(t),n=r.indexOf(i),o=[];r.forEach(((e,t)=>{n<t?e.destroy():o.push(e)})),this._funcToObserve.set(t,o),t(e,s,i)})),this._toObserve(i.result,t,s)}return this._toObserve(ie(e),t,s)}return e};return Array.isArray(e)?e.flat(1/0).map(i):i(e)}native(...e){return re(this._slotRender.initNodes(e))}provide(e={}){Object.assign(this._provideData,e)}inject(e,t=10){return a(this._provideData,"object")&&this._provideData.hasOwnProperty(e)?this._provideData[e]:t>0&&this.PJR?Je(e,t-1,this.PJR):null}expose(e){this.PJR&&this.PJR.expose&&Object.assign(this.PJR.expose,e)}_buildVNodeTree(){let e=re(this._nodes);for(let t=this._lifts.beforeRender.length-1;t>=0;t--){const s=this._lifts.beforeRender[t];s&&"function"==typeof s.fn&&(e=s.fn(e)||e,s.once&&this._lifts.beforeRender.splice(t,1))}return e}dispose(){this._resourceManager.disposed||(this._resourceManager.dispose(),Object.values(this._lifts).forEach((e=>{e.forEach((e=>{e.fn=void 0}))})),this._slotRender&&"function"==typeof this._slotRender.dispose&&this._slotRender.dispose(),this._slotRender=null,this._funcToObserve=new WeakMap,this.component=null,this.PJR=void 0,this._nodes=[])}destroy(){this.dispose()}}class Fe extends oe{IS;jiessEnv;cpn;ctx;frame;frameProps={};constructor(e,t){super("Component"),this.IS=e,this.jiessEnv=t,this[N]=!0}start(e={},t,s){return this.cpn=this.cpn||this.component(e,t,s)}component(e,t,s){return this.jiessEnv.component(this,(()=>(this.ctx=new Be(this,e,t,s),e=>{this.ctx._lifts[e].forEach((e=>{"function"==typeof e.fn&&(e.fn(),e.once&&delete e.fn)}))})))}}let ze=1,qe="jiess",Le="_static_";const Ue=new Map,We=[];function Ke(e){const t=We.indexOf(e);t>-1&&We.splice(t,1),We.push(e)}class He extends oe{ctx;expose={};_childrenHistory={};_childrenCurrent={};isDestory=!1;observeInstance;_resourceManager=new ne;get disposed(){return this._resourceManager.disposed}constructor(e,t){super("JsRender"),this.ctx=e;let s=null;const{key:i}=t.data;if(i&&`${i}`.startsWith(Le)){if(s=Ue.get(i),s)return Ke(i),s.ctx=e,s;!function(e,t){Ue.size>=1e3&&function(){if(We.length>0){const e=We.shift();if(e&&Ue.has(e)){const t=Ue.get(e);t&&"function"==typeof t.dispose?t.dispose():t&&"function"==typeof t.destroy&&t.destroy(),Ue.delete(e)}}}(),Ue.set(e,t),Ke(e)}(i,this)}this.attrs=t,this._buildNode(t)}_buildNode({config:e,data:t}){this[N]=H(t.is,!0,N),this._resData=this._initData(t),this._resConfig=this._initConfig(e);const{$ref:s}=this._resConfig;"function"==typeof s?this.ctx.nextTick((()=>{n((()=>s(this.expose,this)))})):q(s)&&(s.value=this.expose)}_initData({id:e,class:t,className:s,...i}){const r={id:e,class:t,className:s};this.attrs&&"function"==typeof this.attrs.initAttrs&&this.attrs.initAttrs(r);for(const e in i){const t=i[e];a(t,["object","array"])?this._analyObserve(r,e,t):r[e]=t}return r}_initConfig(e){const t={};for(const s in e){const i=e[s];a(i,["object","array"])?this._analyObserve(t,s,i):t[s]=i}return t}_analyObserve(e,t,s){this._isJiessComponentField(t)?e[t]=s:L(s)?this._handleProxyObject(e,t,s):"children"===t?this._handleChildrenField(e,t,s):e[t]=s}_isJiessComponentField(e){return"$if"!==e&&"$elseIf"!==e&&this[N]}_handleProxyObject(e,t,s){const{$proxy:i,update:r}=s;r&&this._handleTwoWayBinding(e,s),z(i)?this._handleReactiveProxy(e,t,s):e[t]=ie(s)}_handleTwoWayBinding(e,t){let s=null,{$proxy:i,update:r,field:n}=t;if(s="string"==typeof r?r:"vue3"===this.ctx.jiess.$env?"onUpdate:modelValue":"onInput",n&&"string"==typeof n||(n="vue3"===this.ctx.jiess.$env?"modelValue":"value"),"function"==typeof e[s]){const t=e[s];e[s]=e=>{t(e),i[n]=e}}else e[s]=e=>i[n]=e}_handleReactiveProxy(e,t,s){const i=this.ctx._toObserve(s,(s=>{this.isDestory||("children"===t?(te(e[t]),this._handleChildrenField(e,t,s)):e[t]=s,this.ctx.forceUpdate())}),this),r=this.ctx._slotRender;e[t]="children"===t?r.initNodes(i):i}_handleChildrenField(e,t,s){const i=this.ctx._slotRender;if(Array.isArray(s)){const r=s.flat(3);r.forEach(((e,t)=>{this._analyObserve(r,t,e)})),e[t]=i.initNodes(r)}else e[t]=i.initNodes(s)}_initKey(e,t){return a(e,"object")&&u(e.key)&&(e.key=h(t)?`${qe}_${t}`:"auto_"+ze++),e}_injectKey({J_uid:e}){let{key:t}=this._resData;if(t){if("string"==typeof t){if(t.startsWith(Le))return;const s=t.split("_"),i=s[1]?parseInt(s[1],10):NaN;if(s.length>2&&!isNaN(i)&&i===e)return}}else t=this.J_uid;this._resData.key=`${qe}_${e}_${t}`}getNative(e){const{ctx:t,_resData:s}=this,{is:i,key:r,slot:n,children:o,...a}=s;if(H(i,!0,N)){const{jiessEnv:s}=t.component;return this._vnode=this._vnode||s.createVNode(this._initKey({is:i,key:r,slot:n},e),(()=>(this.component=new Fe(i,s),{NativeComponent:this.component.start(a,o,this),component:this.component}))),this._vnode}return t._slotRender.toRender(this,e)}destroy(){this.dispose()}dispose(){this._resourceManager.disposed||this.isDestory||(this.isDestory=!0,this._vnode=void 0,this._resourceManager.dispose(),"function"==typeof this.observeInstance?.dispose?this.observeInstance.dispose():this.observeInstance&&this.observeInstance.destroy(),this[N]&&!this.component||this._resData&&this._resData.children&&te(this._resData.children))}}function Ge(){We.forEach((e=>{const t=Ue.get(e);t&&"function"==typeof t.dispose?t.dispose():t&&"function"==typeof t.destroy&&t.destroy()})),Ue.clear(),We.length=0}function Ze(){return Ue.size}function Xe(e,t,s){return new e((({...e})=>{const{default:t,...s}=e;return Object.assign(s,t||{})})(t),s).jiess}class Ye extends Error{code;timestamp;context;constructor(e,t,s){super(e),this.name="JiessError",this.code=t,this.timestamp=Date.now(),this.context=s,Error.captureStackTrace&&Error.captureStackTrace(this,Ye)}toJSON(){return{name:this.name,message:this.message,code:this.code,timestamp:this.timestamp,context:this.context,stack:this.stack}}}class Qe extends Ye{constructor(e,t){super(e,"JIESS_ADAPTER_ERROR",t),this.name="AdapterError"}}class et extends Ye{constructor(e,t){super(e,"JIESS_COMPONENT_CREATION_ERROR",t),this.name="ComponentCreationError"}}class tt extends Ye{constructor(e,t){super(e,"JIESS_RESOURCE_ERROR",t),this.name="ResourceError"}}var st;!function(e){e.React="react",e.Vue3="vue3"}(st||(st={}));const it={},rt=class extends oe{contextParam;$env="";$name="default";JiessComponent;_frameworkProps={};_envProps={};constructor(e,t={},s={}){const{$name:i="default",...r}=t,n=it[i];if(n)return n;super("Jiess"),this.contextParam=s,this.$name=i,this._envProps=e,this._frameworkProps=r,it[i]=this,this.$env=e.$env}createElement(e,t={},s){const i=this._frameworkProps.createElement;if("function"==typeof i)return i(e,t,s)}getFrameworkAPI(e,t){return void 0!==this._frameworkProps[e]?this._frameworkProps[e]:void 0!==this._envProps[e]?this._envProps[e]:t}},nt="vue3",ot=class{env=nt;nativeCtx=null;nativeApp=null;styleNode;recordStyleInfo=[];jiess;_resourceManager;_disposed=!1;constructor(e,t){let s;try{if(s=new rt({jiessEnv:this,$env:nt},e,t),this.jiess=s,this._resourceManager=new ne,"undefined"!=typeof window&&window.document){const e=document.createElement("style");document.head.appendChild(e),this.styleNode=e,this._resourceManager.add({disposed:!1,dispose:()=>{this.styleNode&&this.styleNode.parentNode&&(this.styleNode.parentNode.removeChild(this.styleNode),this.styleNode=void 0)}})}this.jiess.JiessComponent=({is:e,setup:t,style:s,children:i,...r})=>{try{const n=this.jiess.getFrameworkAPI("getCurrentInstance");if(this.nativeCtx=n?n():null,this.nativeCtx&&"appContext"in this.nativeCtx&&(this.nativeApp=this.nativeCtx.appContext?.app||null),this.recordStyleInfo.length>0&&this.styleNode&&(Oe.mountStyle(this,this.recordStyleInfo),this.recordStyleInfo=[]),H(e,!0,N));else{if("function"!=typeof t)throw new Error("须提供(组件 is)或(setup 函数)");e={isJiess:!0,name:"JiessComponent",style:s,setup:t}}const o=new Fe(e,this);return this.createElement(o.start(r,i))}catch(s){throw console.error("[Jiess-Vue3 适配器]创建组件失败:",s),new et("创建 Vue3 组件失败",{is:e,setup:t,error:s})}}}catch(e){throw new Qe("初始化 Vue3 适配器失败",{error:e,jiess:s})}}createElement(e,t,s){const{useDirectives:i,...r}=t||{},n=this.jiess.getFrameworkAPI("h");if(!n)return void console.error("[Jiess Vue3 适配器] h 函数未定义");const o=this.jiess.getFrameworkAPI("withDirectives");return"function"==typeof i&&"function"==typeof o?o(n(e,r,s),i()):n(e,r,s)}createVNode({key:e},t){const{NativeComponent:s}=t(this);return this.createElement(s,{key:e})}component(e,t){let s=r;return{inheritAttrs:!0,props:{style:[Function,Object]},data:()=>({[V]:!1}),created(){e.frame=this,e.frameProps=this.$props,s=t()},beforeMount(){s("beforeMount")},mounted(){s("mounted")},beforeUpdate(){s("beforeUpdate")},updated(){s("updated")},beforeUnmount(){s("beforeUnmount")},render(){return this[V],e.ctx._buildVNodeTree()},methods:{forceUpdate(){this[V]=!this[V]}}}}get disposed(){return this._disposed}dispose(){if(!this._disposed){this._disposed=!0;try{this._resourceManager.dispose(),this.styleNode&&this.styleNode.parentNode&&(this.styleNode.parentNode.removeChild(this.styleNode),this.styleNode=void 0),this.recordStyleInfo=[],this.nativeCtx=null,this.nativeApp=null}catch(e){throw console.error("[Jiess Vue3 适配器] 清理资源失败:",e),new tt("清理 Vue3 适配器资源失败",{error:e})}}}},at=class{midder;debounces;queue;listenerCache;doneCache;lastDriver;constructor(e){this.midder=e,this.debounces={},this.queue={},this.listenerCache={},this.doneCache={},this.lastDriver={}}clean(e,t){if("string"==typeof e)if(t){const s=this.listenerCache[e];if(Array.isArray(s)){const e=s.findIndex((e=>e.tag===t));e>-1&&s.splice(e,1)}}else delete this.listenerCache[e];else this.listenerCache={}}addListener(e){const{tag:t,name:s}=e;this.debounces[s]=this.debounces[s]||b();const i=this.listenerCache[s]=this.listenerCache[s]||[];if("string"==typeof t){const s=i.findIndex((e=>e.tag===t));s>-1?i.splice(s,1,e):i.push(e)}else i.push(e)}addDones(e){const{midder:t,doneCache:s}=this,{name:i}=e;this.lastDriver[i]=e,t.isDebounce&&this.debounces[i]?(s[i]=()=>{this.debounces[i]((()=>{delete s[i],this.done(this.lastDriver[i])}))},s[i]()):this.done(e)}async done(e){const{name:t,defaultValue:s}=e,{queue:i,midder:r,listenerCache:n}=this,{$results:o}=r;if(Array.isArray(n[t]))for(const i of n[t])try{await i.done(e)}catch(t){console.error("Midder listener error:",t),e.defaultValue=s}else o[t]=r.result=s;if(Array.isArray(i[t]))for(const e of i[t])e.resolve(o[t]);delete i[t]}},lt=class{midder;tag;fn;name="useDefaultKey";constructor(e){this.midder=e}init(...e){const{model:t}=this.midder;let s;if("multiple"===t||"no-stor