@vtj/renderer 0.18.1 → 0.18.3
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.cjs +3 -3
- package/dist/index.mjs +4 -5
- package/package.json +5 -5
- package/types/version.d.ts +2 -2
package/dist/index.cjs
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
* Copyright (c) 2026, VTJ.PRO All rights reserved.
|
|
3
3
|
* @name @vtj/renderer
|
|
4
4
|
* @author CHC chenhuachun1549@dingtalk.com
|
|
5
|
-
* @version 0.18.
|
|
5
|
+
* @version 0.18.3
|
|
6
6
|
* @license <a href="https://vtj.pro/license.html">MIT License</a>
|
|
7
|
-
*/const ve="0.18.
|
|
7
|
+
*/const ve="0.18.3";var A=(t=>(t.Runtime="Runtime",t.Design="Design",t.Raw="Raw",t.VNode="VNode",t))(A||{});const ct=["$el","$emit","$nextTick","$parent","$root","$attrs","$slots","$watch","$props","$options","$forceUpdate"],pi=["beforeCreate","created","beforeMount","mounted","beforeUpdate","updated","beforeUnmount","unmounted","errorCaptured","renderTracked","renderTriggered","activated","deactivated"],fi=["onBeforeMount","onMounted","onBeforeUpdate","onUpdated","onBeforeUnmount","onUnmounted","onErrorCaptured","onRenderTracked","onRenderTriggered","onActivated","onDeactivated"],Qt=["vIf","vElseIf","vElse","vShow","vModel","vFor","vBind","vHtml"],Yt={String,Number,Boolean,Array,Object,Function,Date},be="VtjPage",Ie="VtjHomepage",gt="html,body,base,head,link,meta,style,title,address,article,aside,footer,header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,summary,template,blockquote,iframe,tfoot,svg".split(","),Xt="component,slot".split(","),di=["h","t","t","p","s",":","/","/","a","p","p",".","v","t","j",".","p","r","o"].join(""),mi={auth:["h","t","t","p","s",":","/","/","a","p","p",".","v","t","j",".","p","r","o","/","a","u","t","h",".","h","t","m","l"].join(""),storageKey:["R","R","O","_","I","D","E","_","A","C","C","E","S","S","_","S","T","O","R","A","G","E","_","_"].join(""),privateKey:"MIIBOgIBAAJBAKoIzmn1FYQ1YOhOBw9EhABxZ+PySAIaydI+zdhoKflrdgJ4A5E4/5gbQmRpk09hPWG8nvX7h+l/QLU8kXxAIBECAwEAAQJAAlgpxQY6sByLsXqzJcthC8LSGsLf2JEJkHwlnpwFqlEV8UCkoINpuZ2Wzl+aftURu5rIfAzRCQBvHmeOTW9/zQIhAO5ufWDmnSLyfAAsNo5JRNpVuLFCFodR8Xm+ulDlosR/AiEAtpAltyP9wmCABKG/v/hrtTr3mcvFNGCjoGa9bUAok28CIHbrVs9w1ijrBlvTsXYwJw46uP539uKRRT4ymZzlm9QjAiB+1KH/G9f9pEEL9rtaSOG7JF5D0JcOjlze4MGVFs+ZrQIhALKOUFBNr2zEsyJIjw2PlvEucdlG77UniszjXTROHSPd"};function Ee(t,e){return t.map(s=>f.isUrl(s)||s.startsWith("/")?s:`${e}${s}`)}function Oe(t){return/\.css$/.test(t)}function Ve(t){return/\.js$/.test(t)}function Zt(t){return/\.json$/.test(t)}function gi(t){return t.map(e=>`<script src="${f.url.append(e,{v:ve})}"><\/script>`).join("")}function xi(t=[]){return t.map(e=>`<link rel="stylesheet" href="${f.url.append(e,{v:ve})}" />`).join("")}function es(t,e=!1){return e&&t.endsWith(".prod.js")?t.replace(".prod.js",".js"):t}function ts(t,e,s=!1){const i=t.filter(m=>!!m.enabled),r=[],n=[],a=[],u=[],c={},l={},h=[],p={};return i.forEach(({urls:m,assetsUrl:d,library:g,assetsLibrary:x,localeLibrary:v})=>{m?.forEach(k=>{Ve(k)&&r.push(es(k,s)),Oe(k)&&n.push(k)}),g&&(u.push(g),c[g]=Ee(m||[],e),v&&(l[g]=v)),d&&a.push(d),x&&h.push(x),g&&x&&(p[x]=g)}),{scripts:Ee(r,e),css:Ee(n,e),materials:Ee(a,e),libraryExports:u,materialExports:f.dedupArray(h),materialMapLibrary:p,libraryMap:c,libraryLocaleMap:l}}function ss(t,e){const{name:s,parent:i,alias:r}=t;return i?e[i]?.[r||s]:e[r||s]}function is(t=[]){const e=t.filter(i=>Oe(i)),s=t.filter(i=>Ve(i));return{css:e,js:s}}function rs(t,e){const s=l=>{const h=[];let p=0;for(;p<l.length;){if(/\s/.test(l[p])){p++;continue}if(l.substring(p,p+2)==="/*"){const k=l.indexOf("*/",p+2);if(k!==-1){p=k+2;continue}}if(l[p]==="@"){const k=p;for(;p<l.length&&l[p]!=="{"&&l[p]!==";";)p++;const T=l.substring(k,p).trim(),O=T.includes("@keyframes");if(l[p]===";")h.push({type:"simple-at-rule",content:l.substring(k,p+1)}),p++;else if(l[p]==="{"){const w=p+1;let W=1;for(p++;p<l.length&&W>0;)l[p]==="{"?W++:l[p]==="}"&&W--,p++;const pe=l.substring(k,p),we=l.substring(w,p-1);h.push({type:O?"keyframes":"at-rule",rule:T,content:pe,inner:we})}continue}const m=p;for(;p<l.length&&l[p]!=="{";)p++;if(p>=l.length)break;const d=l.substring(m,p).trim();if(!d){p++;continue}const g=p+1;let x=1;for(p++;p<l.length&&x>0;)l[p]==="{"?x++:l[p]==="}"&&x--,p++;const v=l.substring(g,p-1);h.push({type:"rule",selector:d,content:v.trim()})}return h},i=l=>{const h=l.trim();return/^(from|to|\d+(\.\d+)?%)$/.test(h)},r=l=>l.replace(/::v-deep\(/g,":deep(").replace(/::v-deep\s+/g,":deep(").replace(/\/deep\//g," ").replace(/>>>/g," ").replace(/(.*?):deep\(([^)]+)\)/g,(h,p,m)=>{const d=p.trim(),g=m.trim();return d?`${d}[${e}] ${g}`:g}),n=l=>{const h=l.trim();if(!h||h.includes(`[${e}]`)||/^(:root|:host|html|body)(\s|$|:|\.|\#|\[)/.test(h)||i(h))return h;const p=h.match(/^(.+?)((?:::?[\w-]+(?:\([^)]*\))?)*)\s*$/);if(p){const[,m,d=""]=p,g=m.trim();return g?`${g}[${e}]${d}`:h}return`${h}[${e}]`},a=l=>r(l).split(",").map(p=>n(p)).filter(p=>p.trim()).join(", "),u=l=>l.map(h=>{switch(h.type){case"simple-at-rule":return h.content;case"keyframes":return h.content;case"at-rule":try{const m=s(h.inner),d=u(m);return`${h.rule} { ${d} }`}catch{return h.content}case"rule":if(!h.selector||!h.content)return"";const p=a(h.selector);return p.trim()?`${p} { ${h.content} }`:"";default:return""}}).filter(h=>h.trim()).join(" "),c=l=>l.replace(/\s*{\s*/g," { ").replace(/\s*}\s*/g," } ").replace(/\s*;\s*/g,"; ").replace(/\s*,\s*/g,", ").replace(/\s+/g," ").replace(/^\s+|\s+$/g,"").replace(/\s*}\s*}/g," } }").trim();try{const l=t.replace(/\/\*(?!\s*!)[\s\S]*?\*\//g,"").replace(/^\s+|\s+$/gm,"").replace(/\n\s*\n/g,`
|
|
8
8
|
`),h=s(l),p=u(h);return c(p)}catch(l){return console.error("CSS scoping failed:",l),console.error("Input CSS:",t),t.replace(/\/\*[\s\S]*?\*\//g,"").replace(/(@keyframes\s+[^{]+\s*{[^{}]*(?:{[^}]*}[^{}]*)*})/g,h=>h).replace(/([^{}@]+)(?=\s*{)/g,h=>{const p=h.trim();return!p||p.startsWith("@")||p.includes(`[${e}]`)||i(p)?h:`${p}[${e}]`})}}const vi=750;function ns(t,e,s){let i;typeof t<"u"?i=t.innerWidth||t.document.documentElement.clientWidth:(console.warn("无法获取屏幕宽度,使用默认值375"),i=375);const r=s||vi;return e*i/r}function as(t,e){let s=!1,i=!1,r=!1,n="";for(let a=0;a<e.length;a++){const u=e[a];if(u==="'"&&!i&&!r?s=!s:u==='"'&&!s&&!r?i=!i:e.substr(a,4).toLowerCase()==="url("&&!s&&!i?r=!0:u===")"&&r&&(r=!1),!s&&!i&&!r){const c=e.substr(a).match(/^(-?\d+(?:\.\d+)?)\s*rpx/);if(c){const l=c[1],h=parseFloat(l),m=`${ns(t,h).toFixed(6).replace(/\.?0+$/,"")}px`;n+=m,a+=c[0].length-1;continue}}n+=u}return n}function xt(t){return f.isString(t)?t:JSON.stringify(t)}function qe(t,e,s,i=!1){const r=t.CSSStyleSheet,n=i?`data-v-${e}`:e,a=t.__uniConfig?as(t,s):s,u=i?rs(a,n):a,c=!!t.__uniConfig;if(r.prototype.replaceSync&&!c){const l=new r;l.id=e,l.replaceSync(u);const h=t.document,p=h.adoptedStyleSheets,m=Array.from(p).filter(d=>d.id!==e);h.adoptedStyleSheets=[...m,l]}else{const l=t.document;let h=l.getElementById(e);h?h.innerHTML=u:(h=l.createElement("style"),h.id=e,h.innerHTML=u,l.head.appendChild(h))}}function bi(t){const e=t.adoptedStyleSheets||[];let s="";if(e.forEach(i=>{try{for(const r of i.cssRules)s+=r.cssText+`
|
|
9
9
|
`}catch(r){console.error("Failed to read cssRules from adopted stylesheet:",r)}}),s){const i=t.createElement("style");i.textContent=s,t.head.appendChild(i)}}async function os(t,e){const s=await globalThis.fetch(e).then(i=>i.text()).catch(()=>"");s&&qe(globalThis,t,s)}function vt(t,e=globalThis){const s=e.document,i=e.document.head;for(const r of t)if(!s.getElementById(r)){const a=s.createElement("link");a.rel="stylesheet",a.id=r,a.href=r,i.appendChild(a)}}async function bt(t,e,s=globalThis){const i=s.document,r=s.document.head;let n=s[e];return n?n.default||n:new Promise((a,u)=>{for(const c of t){const l=i.createElement("script");l.src=c,l.onload=()=>{n=s[e],n?a(n.default||n):u(null)},l.onerror=h=>{u(h)},r.appendChild(l)}})}function us(t){return f.isFunction(t)&&Object.getOwnPropertyNames(t.prototype||{}).length===0||f.isFunction(t?.install)}function cs(t){return Xt.includes(t)}function ls(t){return gt.includes(t)}function ye(t=globalThis){const e=globalThis?.Mock;if(e)return e;const s=t?.Mock;if(s&&globalThis)return globalThis.Mock=s,s}function yi(t,e,s){Object.assign(e.meta,s.meta);const i=t?._container;s?.type==="page"&&i.classList.add("is-page"),s?.pure&&i.classList.add("is-pure")}function hs(t){return/^\([\s\S]*\)/.test(t.trim())}function ps(t){return/\w+\([\s\S]*\)$/.test(t.trim())}function fs(t){return t.includes("=")}var it={3:"abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile",5:"class enum extends super const export import",6:"enum",strict:"implements interface let package private protected public static yield",strictBind:"eval arguments"},rt="break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this",_i={5:rt,"5module":rt+" export import",6:rt+" const class extends export import super"},Si=/^in(stanceof)?$/,yt="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࢠ-ࢴࢶ-ࣇऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲈᲐ-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-鿼ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꞿꟂ-ꟊꟵ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",ds="·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛࣓-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-ໍ໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜔ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠐-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿᫀᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷹᷻-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_",Ci=new RegExp("["+yt+"]"),wi=new RegExp("["+yt+ds+"]");yt=ds=null;var ms=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,157,310,10,21,11,7,153,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,349,41,7,1,79,28,11,0,9,21,107,20,28,22,13,52,76,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,85,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,159,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,230,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,35,56,264,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,190,0,80,921,103,110,18,195,2749,1070,4050,582,8634,568,8,30,114,29,19,47,17,3,32,20,6,18,689,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,43,8,8952,286,50,2,18,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,2357,44,11,6,17,0,370,43,1301,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42717,35,4148,12,221,3,5761,15,7472,3104,541,1507,4938],Ei=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,370,1,154,10,176,2,54,14,32,9,16,3,46,10,54,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,161,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,193,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,84,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,406,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,19306,9,135,4,60,6,26,9,1014,0,2,54,8,3,82,0,12,1,19628,1,5319,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,262,6,10,9,419,13,1495,6,110,6,6,9,4759,9,787719,239];function lt(t,e){for(var s=65536,i=0;i<e.length;i+=2){if(s+=e[i],s>t)return!1;if(s+=e[i+1],s>=t)return!0}}function ne(t,e){return t<65?t===36:t<91?!0:t<97?t===95:t<123?!0:t<=65535?t>=170&&Ci.test(String.fromCharCode(t)):e===!1?!1:lt(t,ms)}function _e(t,e){return t<48?t===36:t<58?!0:t<65?!1:t<91?!0:t<97?t===95:t<123?!0:t<=65535?t>=170&&wi.test(String.fromCharCode(t)):e===!1?!1:lt(t,ms)||lt(t,Ei)}var E=function(e,s){s===void 0&&(s={}),this.label=e,this.keyword=s.keyword,this.beforeExpr=!!s.beforeExpr,this.startsExpr=!!s.startsExpr,this.isLoop=!!s.isLoop,this.isAssign=!!s.isAssign,this.prefix=!!s.prefix,this.postfix=!!s.postfix,this.binop=s.binop||null,this.updateContext=null};function H(t,e){return new E(t,{beforeExpr:!0,binop:e})}var U={beforeExpr:!0},B={startsExpr:!0},_t={};function C(t,e){return e===void 0&&(e={}),e.keyword=t,_t[t]=new E(t,e)}var o={num:new E("num",B),regexp:new E("regexp",B),string:new E("string",B),name:new E("name",B),eof:new E("eof"),bracketL:new E("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new E("]"),braceL:new E("{",{beforeExpr:!0,startsExpr:!0}),braceR:new E("}"),parenL:new E("(",{beforeExpr:!0,startsExpr:!0}),parenR:new E(")"),comma:new E(",",U),semi:new E(";",U),colon:new E(":",U),dot:new E("."),question:new E("?",U),questionDot:new E("?."),arrow:new E("=>",U),template:new E("template"),invalidTemplate:new E("invalidTemplate"),ellipsis:new E("...",U),backQuote:new E("`",B),dollarBraceL:new E("${",{beforeExpr:!0,startsExpr:!0}),eq:new E("=",{beforeExpr:!0,isAssign:!0}),assign:new E("_=",{beforeExpr:!0,isAssign:!0}),incDec:new E("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new E("!/~",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:H("||",1),logicalAND:H("&&",2),bitwiseOR:H("|",3),bitwiseXOR:H("^",4),bitwiseAND:H("&",5),equality:H("==/!=/===/!==",6),relational:H("</>/<=/>=",7),bitShift:H("<</>>/>>>",8),plusMin:new E("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:H("%",10),star:H("*",10),slash:H("/",10),starstar:new E("**",{beforeExpr:!0}),coalesce:H("??",1),_break:C("break"),_case:C("case",U),_catch:C("catch"),_continue:C("continue"),_debugger:C("debugger"),_default:C("default",U),_do:C("do",{isLoop:!0,beforeExpr:!0}),_else:C("else",U),_finally:C("finally"),_for:C("for",{isLoop:!0}),_function:C("function",B),_if:C("if"),_return:C("return",U),_switch:C("switch"),_throw:C("throw",U),_try:C("try"),_var:C("var"),_const:C("const"),_while:C("while",{isLoop:!0}),_with:C("with"),_new:C("new",{beforeExpr:!0,startsExpr:!0}),_this:C("this",B),_super:C("super",B),_class:C("class",B),_extends:C("extends",U),_export:C("export"),_import:C("import",B),_null:C("null",B),_true:C("true",B),_false:C("false",B),_in:C("in",{beforeExpr:!0,binop:7}),_instanceof:C("instanceof",{beforeExpr:!0,binop:7}),_typeof:C("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:C("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:C("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},q=/\r\n?|\n|\u2028|\u2029/,Pe=new RegExp(q.source,"g");function Fe(t,e){return t===10||t===13||!e&&(t===8232||t===8233)}var gs=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,$=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,xs=Object.prototype,ki=xs.hasOwnProperty,Ii=xs.toString;function We(t,e){return ki.call(t,e)}var Bt=Array.isArray||(function(t){return Ii.call(t)==="[object Array]"});function ce(t){return new RegExp("^(?:"+t.replace(/ /g,"|")+")$")}var Te=function(e,s){this.line=e,this.column=s};Te.prototype.offset=function(e){return new Te(this.line,this.column+e)};var Ke=function(e,s,i){this.start=s,this.end=i,e.sourceFile!==null&&(this.source=e.sourceFile)};function vs(t,e){for(var s=1,i=0;;){Pe.lastIndex=i;var r=Pe.exec(t);if(r&&r.index<e)++s,i=r.index+r[0].length;else return new Te(s,e-i)}}var ht={ecmaVersion:10,sourceType:"script",onInsertedSemicolon:null,onTrailingComma:null,allowReserved:null,allowReturnOutsideFunction:!1,allowImportExportEverywhere:!1,allowAwaitOutsideFunction:!1,allowHashBang:!1,locations:!1,onToken:null,onComment:null,ranges:!1,program:null,sourceFile:null,directSourceFile:null,preserveParens:!1};function Ai(t){var e={};for(var s in ht)e[s]=t&&We(t,s)?t[s]:ht[s];if(e.ecmaVersion>=2015&&(e.ecmaVersion-=2009),e.allowReserved==null&&(e.allowReserved=e.ecmaVersion<5),Bt(e.onToken)){var i=e.onToken;e.onToken=function(r){return i.push(r)}}return Bt(e.onComment)&&(e.onComment=Pi(e,e.onComment)),e}function Pi(t,e){return function(s,i,r,n,a,u){var c={type:s?"Block":"Line",value:i,start:r,end:n};t.locations&&(c.loc=new Ke(this,a,u)),t.ranges&&(c.range=[r,n]),e.push(c)}}var Re=1,Le=2,St=Re|Le,bs=4,ys=8,_s=16,Ss=32,Cs=64,ws=128;function Ct(t,e){return Le|(t?bs:0)|(e?ys:0)}var Ht=0,wt=1,X=2,Es=3,ks=4,Is=5,P=function(e,s,i){this.options=e=Ai(e),this.sourceFile=e.sourceFile,this.keywords=ce(_i[e.ecmaVersion>=6?6:e.sourceType==="module"?"5module":5]);var r="";if(e.allowReserved!==!0){for(var n=e.ecmaVersion;!(r=it[n]);n--);e.sourceType==="module"&&(r+=" await")}this.reservedWords=ce(r);var a=(r?r+" ":"")+it.strict;this.reservedWordsStrict=ce(a),this.reservedWordsStrictBind=ce(a+" "+it.strictBind),this.input=String(s),this.containsEsc=!1,i?(this.pos=i,this.lineStart=this.input.lastIndexOf(`
|
|
10
10
|
`,i-1)+1,this.curLine=this.input.slice(0,this.lineStart).split(q).length):(this.pos=this.lineStart=0,this.curLine=1),this.type=o.eof,this.value=null,this.start=this.end=this.pos,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=this.pos,this.context=this.initialContext(),this.exprAllowed=!0,this.inModule=e.sourceType==="module",this.strict=this.inModule||this.strictDirective(this.pos),this.potentialArrowAt=-1,this.yieldPos=this.awaitPos=this.awaitIdentPos=0,this.labels=[],this.undefinedExports={},this.pos===0&&e.allowHashBang&&this.input.slice(0,2)==="#!"&&this.skipLineComment(2),this.scopeStack=[],this.enterScope(Re),this.regexpState=null},he={inFunction:{configurable:!0},inGenerator:{configurable:!0},inAsync:{configurable:!0},allowSuper:{configurable:!0},allowDirectSuper:{configurable:!0},treatFunctionsAsVar:{configurable:!0}};P.prototype.parse=function(){var e=this.options.program||this.startNode();return this.nextToken(),this.parseTopLevel(e)};he.inFunction.get=function(){return(this.currentVarScope().flags&Le)>0};he.inGenerator.get=function(){return(this.currentVarScope().flags&ys)>0};he.inAsync.get=function(){return(this.currentVarScope().flags&bs)>0};he.allowSuper.get=function(){return(this.currentThisScope().flags&Cs)>0};he.allowDirectSuper.get=function(){return(this.currentThisScope().flags&ws)>0};he.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())};P.prototype.inNonArrowFunction=function(){return(this.currentThisScope().flags&Le)>0};P.extend=function(){for(var e=[],s=arguments.length;s--;)e[s]=arguments[s];for(var i=this,r=0;r<e.length;r++)i=e[r](i);return i};P.parse=function(e,s){return new this(s,e).parse()};P.parseExpressionAt=function(e,s,i){var r=new this(i,e,s);return r.nextToken(),r.parseExpression()};P.tokenizer=function(e,s){return new this(s,e)};Object.defineProperties(P.prototype,he);var j=P.prototype,Ti=/^(?:'((?:\\.|[^'\\])*?)'|"((?:\\.|[^"\\])*?)")/;j.strictDirective=function(t){for(;;){$.lastIndex=t,t+=$.exec(this.input)[0].length;var e=Ti.exec(this.input.slice(t));if(!e)return!1;if((e[1]||e[2])==="use strict"){$.lastIndex=t+e[0].length;var s=$.exec(this.input),i=s.index+s[0].length,r=this.input.charAt(i);return r===";"||r==="}"||q.test(s[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(r)||r==="!"&&this.input.charAt(i+1)==="=")}t+=e[0].length,$.lastIndex=t,t+=$.exec(this.input)[0].length,this.input[t]===";"&&t++}};j.eat=function(t){return this.type===t?(this.next(),!0):!1};j.isContextual=function(t){return this.type===o.name&&this.value===t&&!this.containsEsc};j.eatContextual=function(t){return this.isContextual(t)?(this.next(),!0):!1};j.expectContextual=function(t){this.eatContextual(t)||this.unexpected()};j.canInsertSemicolon=function(){return this.type===o.eof||this.type===o.braceR||q.test(this.input.slice(this.lastTokEnd,this.start))};j.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0};j.semicolon=function(){!this.eat(o.semi)&&!this.insertSemicolon()&&this.unexpected()};j.afterTrailingComma=function(t,e){if(this.type===t)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),e||this.next(),!0};j.expect=function(t){this.eat(t)||this.unexpected()};j.unexpected=function(t){this.raise(t??this.start,"Unexpected token")};function ze(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1}j.checkPatternErrors=function(t,e){if(t){t.trailingComma>-1&&this.raiseRecoverable(t.trailingComma,"Comma is not permitted after the rest element");var s=e?t.parenthesizedAssign:t.parenthesizedBind;s>-1&&this.raiseRecoverable(s,"Parenthesized pattern")}};j.checkExpressionErrors=function(t,e){if(!t)return!1;var s=t.shorthandAssign,i=t.doubleProto;if(!e)return s>=0||i>=0;s>=0&&this.raise(s,"Shorthand property assignments are valid only in destructuring patterns"),i>=0&&this.raiseRecoverable(i,"Redefinition of __proto__ property")};j.checkYieldAwaitInDefaultParams=function(){this.yieldPos&&(!this.awaitPos||this.yieldPos<this.awaitPos)&&this.raise(this.yieldPos,"Yield expression cannot be a default value"),this.awaitPos&&this.raise(this.awaitPos,"Await expression cannot be a default value")};j.isSimpleAssignTarget=function(t){return t.type==="ParenthesizedExpression"?this.isSimpleAssignTarget(t.expression):t.type==="Identifier"||t.type==="MemberExpression"};var y=P.prototype;y.parseTopLevel=function(t){var e={};for(t.body||(t.body=[]);this.type!==o.eof;){var s=this.parseStatement(null,!0,e);t.body.push(s)}if(this.inModule)for(var i=0,r=Object.keys(this.undefinedExports);i<r.length;i+=1){var n=r[i];this.raiseRecoverable(this.undefinedExports[n].start,"Export '"+n+"' is not defined")}return this.adaptDirectivePrologue(t.body),this.next(),t.sourceType=this.options.sourceType,this.finishNode(t,"Program")};var Et={kind:"loop"},Ri={kind:"switch"};y.isLet=function(t){if(this.options.ecmaVersion<6||!this.isContextual("let"))return!1;$.lastIndex=this.pos;var e=$.exec(this.input),s=this.pos+e[0].length,i=this.input.charCodeAt(s);if(i===91)return!0;if(t)return!1;if(i===123)return!0;if(ne(i,!0)){for(var r=s+1;_e(this.input.charCodeAt(r),!0);)++r;var n=this.input.slice(s,r);if(!Si.test(n))return!0}return!1};y.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return!1;$.lastIndex=this.pos;var t=$.exec(this.input),e=this.pos+t[0].length;return!q.test(this.input.slice(this.pos,e))&&this.input.slice(e,e+8)==="function"&&(e+8===this.input.length||!_e(this.input.charAt(e+8)))};y.parseStatement=function(t,e,s){var i=this.type,r=this.startNode(),n;switch(this.isLet(t)&&(i=o._var,n="let"),i){case o._break:case o._continue:return this.parseBreakContinueStatement(r,i.keyword);case o._debugger:return this.parseDebuggerStatement(r);case o._do:return this.parseDoStatement(r);case o._for:return this.parseForStatement(r);case o._function:return t&&(this.strict||t!=="if"&&t!=="label")&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(r,!1,!t);case o._class:return t&&this.unexpected(),this.parseClass(r,!0);case o._if:return this.parseIfStatement(r);case o._return:return this.parseReturnStatement(r);case o._switch:return this.parseSwitchStatement(r);case o._throw:return this.parseThrowStatement(r);case o._try:return this.parseTryStatement(r);case o._const:case o._var:return n=n||this.value,t&&n!=="var"&&this.unexpected(),this.parseVarStatement(r,n);case o._while:return this.parseWhileStatement(r);case o._with:return this.parseWithStatement(r);case o.braceL:return this.parseBlock(!0,r);case o.semi:return this.parseEmptyStatement(r);case o._export:case o._import:if(this.options.ecmaVersion>10&&i===o._import){$.lastIndex=this.pos;var a=$.exec(this.input),u=this.pos+a[0].length,c=this.input.charCodeAt(u);if(c===40||c===46)return this.parseExpressionStatement(r,this.parseExpression())}return this.options.allowImportExportEverywhere||(e||this.raise(this.start,"'import' and 'export' may only appear at the top level"),this.inModule||this.raise(this.start,"'import' and 'export' may appear only with 'sourceType: module'")),i===o._import?this.parseImport(r):this.parseExport(r,s);default:if(this.isAsyncFunction())return t&&this.unexpected(),this.next(),this.parseFunctionStatement(r,!0,!t);var l=this.value,h=this.parseExpression();return i===o.name&&h.type==="Identifier"&&this.eat(o.colon)?this.parseLabeledStatement(r,l,h,t):this.parseExpressionStatement(r,h)}};y.parseBreakContinueStatement=function(t,e){var s=e==="break";this.next(),this.eat(o.semi)||this.insertSemicolon()?t.label=null:this.type!==o.name?this.unexpected():(t.label=this.parseIdent(),this.semicolon());for(var i=0;i<this.labels.length;++i){var r=this.labels[i];if((t.label==null||r.name===t.label.name)&&(r.kind!=null&&(s||r.kind==="loop")||t.label&&s))break}return i===this.labels.length&&this.raise(t.start,"Unsyntactic "+e),this.finishNode(t,s?"BreakStatement":"ContinueStatement")};y.parseDebuggerStatement=function(t){return this.next(),this.semicolon(),this.finishNode(t,"DebuggerStatement")};y.parseDoStatement=function(t){return this.next(),this.labels.push(Et),t.body=this.parseStatement("do"),this.labels.pop(),this.expect(o._while),t.test=this.parseParenExpression(),this.options.ecmaVersion>=6?this.eat(o.semi):this.semicolon(),this.finishNode(t,"DoWhileStatement")};y.parseForStatement=function(t){this.next();var e=this.options.ecmaVersion>=9&&(this.inAsync||!this.inFunction&&this.options.allowAwaitOutsideFunction)&&this.eatContextual("await")?this.lastTokStart:-1;if(this.labels.push(Et),this.enterScope(0),this.expect(o.parenL),this.type===o.semi)return e>-1&&this.unexpected(e),this.parseFor(t,null);var s=this.isLet();if(this.type===o._var||this.type===o._const||s){var i=this.startNode(),r=s?"let":this.value;return this.next(),this.parseVar(i,!0,r),this.finishNode(i,"VariableDeclaration"),(this.type===o._in||this.options.ecmaVersion>=6&&this.isContextual("of"))&&i.declarations.length===1?(this.options.ecmaVersion>=9&&(this.type===o._in?e>-1&&this.unexpected(e):t.await=e>-1),this.parseForIn(t,i)):(e>-1&&this.unexpected(e),this.parseFor(t,i))}var n=new ze,a=this.parseExpression(!0,n);return this.type===o._in||this.options.ecmaVersion>=6&&this.isContextual("of")?(this.options.ecmaVersion>=9&&(this.type===o._in?e>-1&&this.unexpected(e):t.await=e>-1),this.toAssignable(a,!1,n),this.checkLVal(a),this.parseForIn(t,a)):(this.checkExpressionErrors(n,!0),e>-1&&this.unexpected(e),this.parseFor(t,a))};y.parseFunctionStatement=function(t,e,s){return this.next(),this.parseFunction(t,Ae|(s?0:pt),!1,e)};y.parseIfStatement=function(t){return this.next(),t.test=this.parseParenExpression(),t.consequent=this.parseStatement("if"),t.alternate=this.eat(o._else)?this.parseStatement("if"):null,this.finishNode(t,"IfStatement")};y.parseReturnStatement=function(t){return!this.inFunction&&!this.options.allowReturnOutsideFunction&&this.raise(this.start,"'return' outside of function"),this.next(),this.eat(o.semi)||this.insertSemicolon()?t.argument=null:(t.argument=this.parseExpression(),this.semicolon()),this.finishNode(t,"ReturnStatement")};y.parseSwitchStatement=function(t){this.next(),t.discriminant=this.parseParenExpression(),t.cases=[],this.expect(o.braceL),this.labels.push(Ri),this.enterScope(0);for(var e,s=!1;this.type!==o.braceR;)if(this.type===o._case||this.type===o._default){var i=this.type===o._case;e&&this.finishNode(e,"SwitchCase"),t.cases.push(e=this.startNode()),e.consequent=[],this.next(),i?e.test=this.parseExpression():(s&&this.raiseRecoverable(this.lastTokStart,"Multiple default clauses"),s=!0,e.test=null),this.expect(o.colon)}else e||this.unexpected(),e.consequent.push(this.parseStatement(null));return this.exitScope(),e&&this.finishNode(e,"SwitchCase"),this.next(),this.labels.pop(),this.finishNode(t,"SwitchStatement")};y.parseThrowStatement=function(t){return this.next(),q.test(this.input.slice(this.lastTokEnd,this.start))&&this.raise(this.lastTokEnd,"Illegal newline after throw"),t.argument=this.parseExpression(),this.semicolon(),this.finishNode(t,"ThrowStatement")};var Ni=[];y.parseTryStatement=function(t){if(this.next(),t.block=this.parseBlock(),t.handler=null,this.type===o._catch){var e=this.startNode();if(this.next(),this.eat(o.parenL)){e.param=this.parseBindingAtom();var s=e.param.type==="Identifier";this.enterScope(s?Ss:0),this.checkLVal(e.param,s?ks:X),this.expect(o.parenR)}else this.options.ecmaVersion<10&&this.unexpected(),e.param=null,this.enterScope(0);e.body=this.parseBlock(!1),this.exitScope(),t.handler=this.finishNode(e,"CatchClause")}return t.finalizer=this.eat(o._finally)?this.parseBlock():null,!t.handler&&!t.finalizer&&this.raise(t.start,"Missing catch or finally clause"),this.finishNode(t,"TryStatement")};y.parseVarStatement=function(t,e){return this.next(),this.parseVar(t,!1,e),this.semicolon(),this.finishNode(t,"VariableDeclaration")};y.parseWhileStatement=function(t){return this.next(),t.test=this.parseParenExpression(),this.labels.push(Et),t.body=this.parseStatement("while"),this.labels.pop(),this.finishNode(t,"WhileStatement")};y.parseWithStatement=function(t){return this.strict&&this.raise(this.start,"'with' in strict mode"),this.next(),t.object=this.parseParenExpression(),t.body=this.parseStatement("with"),this.finishNode(t,"WithStatement")};y.parseEmptyStatement=function(t){return this.next(),this.finishNode(t,"EmptyStatement")};y.parseLabeledStatement=function(t,e,s,i){for(var r=0,n=this.labels;r<n.length;r+=1){var a=n[r];a.name===e&&this.raise(s.start,"Label '"+e+"' is already declared")}for(var u=this.type.isLoop?"loop":this.type===o._switch?"switch":null,c=this.labels.length-1;c>=0;c--){var l=this.labels[c];if(l.statementStart===t.start)l.statementStart=this.start,l.kind=u;else break}return this.labels.push({name:e,kind:u,statementStart:this.start}),t.body=this.parseStatement(i?i.indexOf("label")===-1?i+"label":i:"label"),this.labels.pop(),t.label=s,this.finishNode(t,"LabeledStatement")};y.parseExpressionStatement=function(t,e){return t.expression=e,this.semicolon(),this.finishNode(t,"ExpressionStatement")};y.parseBlock=function(t,e,s){for(t===void 0&&(t=!0),e===void 0&&(e=this.startNode()),e.body=[],this.expect(o.braceL),t&&this.enterScope(0);this.type!==o.braceR;){var i=this.parseStatement(null);e.body.push(i)}return s&&(this.strict=!1),this.next(),t&&this.exitScope(),this.finishNode(e,"BlockStatement")};y.parseFor=function(t,e){return t.init=e,this.expect(o.semi),t.test=this.type===o.semi?null:this.parseExpression(),this.expect(o.semi),t.update=this.type===o.parenR?null:this.parseExpression(),this.expect(o.parenR),t.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(t,"ForStatement")};y.parseForIn=function(t,e){var s=this.type===o._in;return this.next(),e.type==="VariableDeclaration"&&e.declarations[0].init!=null&&(!s||this.options.ecmaVersion<8||this.strict||e.kind!=="var"||e.declarations[0].id.type!=="Identifier")?this.raise(e.start,(s?"for-in":"for-of")+" loop variable declaration may not have an initializer"):e.type==="AssignmentPattern"&&this.raise(e.start,"Invalid left-hand side in for-loop"),t.left=e,t.right=s?this.parseExpression():this.parseMaybeAssign(),this.expect(o.parenR),t.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(t,s?"ForInStatement":"ForOfStatement")};y.parseVar=function(t,e,s){for(t.declarations=[],t.kind=s;;){var i=this.startNode();if(this.parseVarId(i,s),this.eat(o.eq)?i.init=this.parseMaybeAssign(e):s==="const"&&!(this.type===o._in||this.options.ecmaVersion>=6&&this.isContextual("of"))?this.unexpected():i.id.type!=="Identifier"&&!(e&&(this.type===o._in||this.isContextual("of")))?this.raise(this.lastTokEnd,"Complex binding patterns require an initialization value"):i.init=null,t.declarations.push(this.finishNode(i,"VariableDeclarator")),!this.eat(o.comma))break}return t};y.parseVarId=function(t,e){t.id=this.parseBindingAtom(),this.checkLVal(t.id,e==="var"?wt:X,!1)};var Ae=1,pt=2,As=4;y.parseFunction=function(t,e,s,i){this.initFunction(t),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!i)&&(this.type===o.star&&e&pt&&this.unexpected(),t.generator=this.eat(o.star)),this.options.ecmaVersion>=8&&(t.async=!!i),e&Ae&&(t.id=e&As&&this.type!==o.name?null:this.parseIdent(),t.id&&!(e&pt)&&this.checkLVal(t.id,this.strict||t.generator||t.async?this.treatFunctionsAsVar?wt:X:Es));var r=this.yieldPos,n=this.awaitPos,a=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(Ct(t.async,t.generator)),e&Ae||(t.id=this.type===o.name?this.parseIdent():null),this.parseFunctionParams(t),this.parseFunctionBody(t,s,!1),this.yieldPos=r,this.awaitPos=n,this.awaitIdentPos=a,this.finishNode(t,e&Ae?"FunctionDeclaration":"FunctionExpression")};y.parseFunctionParams=function(t){this.expect(o.parenL),t.params=this.parseBindingList(o.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()};y.parseClass=function(t,e){this.next();var s=this.strict;this.strict=!0,this.parseClassId(t,e),this.parseClassSuper(t);var i=this.startNode(),r=!1;for(i.body=[],this.expect(o.braceL);this.type!==o.braceR;){var n=this.parseClassElement(t.superClass!==null);n&&(i.body.push(n),n.type==="MethodDefinition"&&n.kind==="constructor"&&(r&&this.raise(n.start,"Duplicate constructor in the same class"),r=!0))}return this.strict=s,this.next(),t.body=this.finishNode(i,"ClassBody"),this.finishNode(t,e?"ClassDeclaration":"ClassExpression")};y.parseClassElement=function(t){var e=this;if(this.eat(o.semi))return null;var s=this.startNode(),i=function(c,l){l===void 0&&(l=!1);var h=e.start,p=e.startLoc;return e.eatContextual(c)?e.type!==o.parenL&&(!l||!e.canInsertSemicolon())?!0:(s.key&&e.unexpected(),s.computed=!1,s.key=e.startNodeAt(h,p),s.key.name=c,e.finishNode(s.key,"Identifier"),!1):!1};s.kind="method",s.static=i("static");var r=this.eat(o.star),n=!1;r||(this.options.ecmaVersion>=8&&i("async",!0)?(n=!0,r=this.options.ecmaVersion>=9&&this.eat(o.star)):i("get")?s.kind="get":i("set")&&(s.kind="set")),s.key||this.parsePropertyName(s);var a=s.key,u=!1;return!s.computed&&!s.static&&(a.type==="Identifier"&&a.name==="constructor"||a.type==="Literal"&&a.value==="constructor")?(s.kind!=="method"&&this.raise(a.start,"Constructor can't have get/set modifier"),r&&this.raise(a.start,"Constructor can't be a generator"),n&&this.raise(a.start,"Constructor can't be an async method"),s.kind="constructor",u=t):s.static&&a.type==="Identifier"&&a.name==="prototype"&&this.raise(a.start,"Classes may not have a static property named prototype"),this.parseClassMethod(s,r,n,u),s.kind==="get"&&s.value.params.length!==0&&this.raiseRecoverable(s.value.start,"getter should have no params"),s.kind==="set"&&s.value.params.length!==1&&this.raiseRecoverable(s.value.start,"setter should have exactly one param"),s.kind==="set"&&s.value.params[0].type==="RestElement"&&this.raiseRecoverable(s.value.params[0].start,"Setter cannot use rest params"),s};y.parseClassMethod=function(t,e,s,i){return t.value=this.parseMethod(e,s,i),this.finishNode(t,"MethodDefinition")};y.parseClassId=function(t,e){this.type===o.name?(t.id=this.parseIdent(),e&&this.checkLVal(t.id,X,!1)):(e===!0&&this.unexpected(),t.id=null)};y.parseClassSuper=function(t){t.superClass=this.eat(o._extends)?this.parseExprSubscripts():null};y.parseExport=function(t,e){if(this.next(),this.eat(o.star))return this.options.ecmaVersion>=11&&(this.eatContextual("as")?(t.exported=this.parseIdent(!0),this.checkExport(e,t.exported.name,this.lastTokStart)):t.exported=null),this.expectContextual("from"),this.type!==o.string&&this.unexpected(),t.source=this.parseExprAtom(),this.semicolon(),this.finishNode(t,"ExportAllDeclaration");if(this.eat(o._default)){this.checkExport(e,"default",this.lastTokStart);var s;if(this.type===o._function||(s=this.isAsyncFunction())){var i=this.startNode();this.next(),s&&this.next(),t.declaration=this.parseFunction(i,Ae|As,!1,s)}else if(this.type===o._class){var r=this.startNode();t.declaration=this.parseClass(r,"nullableID")}else t.declaration=this.parseMaybeAssign(),this.semicolon();return this.finishNode(t,"ExportDefaultDeclaration")}if(this.shouldParseExportStatement())t.declaration=this.parseStatement(null),t.declaration.type==="VariableDeclaration"?this.checkVariableExport(e,t.declaration.declarations):this.checkExport(e,t.declaration.id.name,t.declaration.id.start),t.specifiers=[],t.source=null;else{if(t.declaration=null,t.specifiers=this.parseExportSpecifiers(e),this.eatContextual("from"))this.type!==o.string&&this.unexpected(),t.source=this.parseExprAtom();else{for(var n=0,a=t.specifiers;n<a.length;n+=1){var u=a[n];this.checkUnreserved(u.local),this.checkLocalExport(u.local)}t.source=null}this.semicolon()}return this.finishNode(t,"ExportNamedDeclaration")};y.checkExport=function(t,e,s){t&&(We(t,e)&&this.raiseRecoverable(s,"Duplicate export '"+e+"'"),t[e]=!0)};y.checkPatternExport=function(t,e){var s=e.type;if(s==="Identifier")this.checkExport(t,e.name,e.start);else if(s==="ObjectPattern")for(var i=0,r=e.properties;i<r.length;i+=1){var n=r[i];this.checkPatternExport(t,n)}else if(s==="ArrayPattern")for(var a=0,u=e.elements;a<u.length;a+=1){var c=u[a];c&&this.checkPatternExport(t,c)}else s==="Property"?this.checkPatternExport(t,e.value):s==="AssignmentPattern"?this.checkPatternExport(t,e.left):s==="RestElement"?this.checkPatternExport(t,e.argument):s==="ParenthesizedExpression"&&this.checkPatternExport(t,e.expression)};y.checkVariableExport=function(t,e){if(t)for(var s=0,i=e;s<i.length;s+=1){var r=i[s];this.checkPatternExport(t,r.id)}};y.shouldParseExportStatement=function(){return this.type.keyword==="var"||this.type.keyword==="const"||this.type.keyword==="class"||this.type.keyword==="function"||this.isLet()||this.isAsyncFunction()};y.parseExportSpecifiers=function(t){var e=[],s=!0;for(this.expect(o.braceL);!this.eat(o.braceR);){if(s)s=!1;else if(this.expect(o.comma),this.afterTrailingComma(o.braceR))break;var i=this.startNode();i.local=this.parseIdent(!0),i.exported=this.eatContextual("as")?this.parseIdent(!0):i.local,this.checkExport(t,i.exported.name,i.exported.start),e.push(this.finishNode(i,"ExportSpecifier"))}return e};y.parseImport=function(t){return this.next(),this.type===o.string?(t.specifiers=Ni,t.source=this.parseExprAtom()):(t.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),t.source=this.type===o.string?this.parseExprAtom():this.unexpected()),this.semicolon(),this.finishNode(t,"ImportDeclaration")};y.parseImportSpecifiers=function(){var t=[],e=!0;if(this.type===o.name){var s=this.startNode();if(s.local=this.parseIdent(),this.checkLVal(s.local,X),t.push(this.finishNode(s,"ImportDefaultSpecifier")),!this.eat(o.comma))return t}if(this.type===o.star){var i=this.startNode();return this.next(),this.expectContextual("as"),i.local=this.parseIdent(),this.checkLVal(i.local,X),t.push(this.finishNode(i,"ImportNamespaceSpecifier")),t}for(this.expect(o.braceL);!this.eat(o.braceR);){if(e)e=!1;else if(this.expect(o.comma),this.afterTrailingComma(o.braceR))break;var r=this.startNode();r.imported=this.parseIdent(!0),this.eatContextual("as")?r.local=this.parseIdent():(this.checkUnreserved(r.imported),r.local=r.imported),this.checkLVal(r.local,X),t.push(this.finishNode(r,"ImportSpecifier"))}return t};y.adaptDirectivePrologue=function(t){for(var e=0;e<t.length&&this.isDirectiveCandidate(t[e]);++e)t[e].directive=t[e].expression.raw.slice(1,-1)};y.isDirectiveCandidate=function(t){return t.type==="ExpressionStatement"&&t.expression.type==="Literal"&&typeof t.expression.value=="string"&&(this.input[t.start]==='"'||this.input[t.start]==="'")};var Z=P.prototype;Z.toAssignable=function(t,e,s){if(this.options.ecmaVersion>=6&&t)switch(t.type){case"Identifier":this.inAsync&&t.name==="await"&&this.raise(t.start,"Cannot use 'await' as identifier inside an async function");break;case"ObjectPattern":case"ArrayPattern":case"RestElement":break;case"ObjectExpression":t.type="ObjectPattern",s&&this.checkPatternErrors(s,!0);for(var i=0,r=t.properties;i<r.length;i+=1){var n=r[i];this.toAssignable(n,e),n.type==="RestElement"&&(n.argument.type==="ArrayPattern"||n.argument.type==="ObjectPattern")&&this.raise(n.argument.start,"Unexpected token")}break;case"Property":t.kind!=="init"&&this.raise(t.key.start,"Object pattern can't contain getter or setter"),this.toAssignable(t.value,e);break;case"ArrayExpression":t.type="ArrayPattern",s&&this.checkPatternErrors(s,!0),this.toAssignableList(t.elements,e);break;case"SpreadElement":t.type="RestElement",this.toAssignable(t.argument,e),t.argument.type==="AssignmentPattern"&&this.raise(t.argument.start,"Rest elements cannot have a default value");break;case"AssignmentExpression":t.operator!=="="&&this.raise(t.left.end,"Only '=' operator can be used for specifying default value."),t.type="AssignmentPattern",delete t.operator,this.toAssignable(t.left,e);case"AssignmentPattern":break;case"ParenthesizedExpression":this.toAssignable(t.expression,e,s);break;case"ChainExpression":this.raiseRecoverable(t.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":if(!e)break;default:this.raise(t.start,"Assigning to rvalue")}else s&&this.checkPatternErrors(s,!0);return t};Z.toAssignableList=function(t,e){for(var s=t.length,i=0;i<s;i++){var r=t[i];r&&this.toAssignable(r,e)}if(s){var n=t[s-1];this.options.ecmaVersion===6&&e&&n&&n.type==="RestElement"&&n.argument.type!=="Identifier"&&this.unexpected(n.argument.start)}return t};Z.parseSpread=function(t){var e=this.startNode();return this.next(),e.argument=this.parseMaybeAssign(!1,t),this.finishNode(e,"SpreadElement")};Z.parseRestBinding=function(){var t=this.startNode();return this.next(),this.options.ecmaVersion===6&&this.type!==o.name&&this.unexpected(),t.argument=this.parseBindingAtom(),this.finishNode(t,"RestElement")};Z.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case o.bracketL:var t=this.startNode();return this.next(),t.elements=this.parseBindingList(o.bracketR,!0,!0),this.finishNode(t,"ArrayPattern");case o.braceL:return this.parseObj(!0)}return this.parseIdent()};Z.parseBindingList=function(t,e,s){for(var i=[],r=!0;!this.eat(t);)if(r?r=!1:this.expect(o.comma),e&&this.type===o.comma)i.push(null);else{if(s&&this.afterTrailingComma(t))break;if(this.type===o.ellipsis){var n=this.parseRestBinding();this.parseBindingListItem(n),i.push(n),this.type===o.comma&&this.raise(this.start,"Comma is not permitted after the rest element"),this.expect(t);break}else{var a=this.parseMaybeDefault(this.start,this.startLoc);this.parseBindingListItem(a),i.push(a)}}return i};Z.parseBindingListItem=function(t){return t};Z.parseMaybeDefault=function(t,e,s){if(s=s||this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(o.eq))return s;var i=this.startNodeAt(t,e);return i.left=s,i.right=this.parseMaybeAssign(),this.finishNode(i,"AssignmentPattern")};Z.checkLVal=function(t,e,s){switch(e===void 0&&(e=Ht),t.type){case"Identifier":e===X&&t.name==="let"&&this.raiseRecoverable(t.start,"let is disallowed as a lexically bound name"),this.strict&&this.reservedWordsStrictBind.test(t.name)&&this.raiseRecoverable(t.start,(e?"Binding ":"Assigning to ")+t.name+" in strict mode"),s&&(We(s,t.name)&&this.raiseRecoverable(t.start,"Argument name clash"),s[t.name]=!0),e!==Ht&&e!==Is&&this.declareName(t.name,e,t.start);break;case"ChainExpression":this.raiseRecoverable(t.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":e&&this.raiseRecoverable(t.start,"Binding member expression");break;case"ObjectPattern":for(var i=0,r=t.properties;i<r.length;i+=1){var n=r[i];this.checkLVal(n,e,s)}break;case"Property":this.checkLVal(t.value,e,s);break;case"ArrayPattern":for(var a=0,u=t.elements;a<u.length;a+=1){var c=u[a];c&&this.checkLVal(c,e,s)}break;case"AssignmentPattern":this.checkLVal(t.left,e,s);break;case"RestElement":this.checkLVal(t.argument,e,s);break;case"ParenthesizedExpression":this.checkLVal(t.expression,e,s);break;default:this.raise(t.start,(e?"Binding":"Assigning to")+" rvalue")}};var _=P.prototype;_.checkPropClash=function(t,e,s){if(!(this.options.ecmaVersion>=9&&t.type==="SpreadElement")&&!(this.options.ecmaVersion>=6&&(t.computed||t.method||t.shorthand))){var i=t.key,r;switch(i.type){case"Identifier":r=i.name;break;case"Literal":r=String(i.value);break;default:return}var n=t.kind;if(this.options.ecmaVersion>=6){r==="__proto__"&&n==="init"&&(e.proto&&(s?s.doubleProto<0&&(s.doubleProto=i.start):this.raiseRecoverable(i.start,"Redefinition of __proto__ property")),e.proto=!0);return}r="$"+r;var a=e[r];if(a){var u;n==="init"?u=this.strict&&a.init||a.get||a.set:u=a.init||a[n],u&&this.raiseRecoverable(i.start,"Redefinition of property")}else a=e[r]={init:!1,get:!1,set:!1};a[n]=!0}};_.parseExpression=function(t,e){var s=this.start,i=this.startLoc,r=this.parseMaybeAssign(t,e);if(this.type===o.comma){var n=this.startNodeAt(s,i);for(n.expressions=[r];this.eat(o.comma);)n.expressions.push(this.parseMaybeAssign(t,e));return this.finishNode(n,"SequenceExpression")}return r};_.parseMaybeAssign=function(t,e,s){if(this.isContextual("yield")){if(this.inGenerator)return this.parseYield(t);this.exprAllowed=!1}var i=!1,r=-1,n=-1;e?(r=e.parenthesizedAssign,n=e.trailingComma,e.parenthesizedAssign=e.trailingComma=-1):(e=new ze,i=!0);var a=this.start,u=this.startLoc;(this.type===o.parenL||this.type===o.name)&&(this.potentialArrowAt=this.start);var c=this.parseMaybeConditional(t,e);if(s&&(c=s.call(this,c,a,u)),this.type.isAssign){var l=this.startNodeAt(a,u);return l.operator=this.value,l.left=this.type===o.eq?this.toAssignable(c,!1,e):c,i||(e.parenthesizedAssign=e.trailingComma=e.doubleProto=-1),e.shorthandAssign>=l.left.start&&(e.shorthandAssign=-1),this.checkLVal(c),this.next(),l.right=this.parseMaybeAssign(t),this.finishNode(l,"AssignmentExpression")}else i&&this.checkExpressionErrors(e,!0);return r>-1&&(e.parenthesizedAssign=r),n>-1&&(e.trailingComma=n),c};_.parseMaybeConditional=function(t,e){var s=this.start,i=this.startLoc,r=this.parseExprOps(t,e);if(this.checkExpressionErrors(e))return r;if(this.eat(o.question)){var n=this.startNodeAt(s,i);return n.test=r,n.consequent=this.parseMaybeAssign(),this.expect(o.colon),n.alternate=this.parseMaybeAssign(t),this.finishNode(n,"ConditionalExpression")}return r};_.parseExprOps=function(t,e){var s=this.start,i=this.startLoc,r=this.parseMaybeUnary(e,!1);return this.checkExpressionErrors(e)||r.start===s&&r.type==="ArrowFunctionExpression"?r:this.parseExprOp(r,s,i,-1,t)};_.parseExprOp=function(t,e,s,i,r){var n=this.type.binop;if(n!=null&&(!r||this.type!==o._in)&&n>i){var a=this.type===o.logicalOR||this.type===o.logicalAND,u=this.type===o.coalesce;u&&(n=o.logicalAND.binop);var c=this.value;this.next();var l=this.start,h=this.startLoc,p=this.parseExprOp(this.parseMaybeUnary(null,!1),l,h,n,r),m=this.buildBinary(e,s,t,p,c,a||u);return(a&&this.type===o.coalesce||u&&(this.type===o.logicalOR||this.type===o.logicalAND))&&this.raiseRecoverable(this.start,"Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses"),this.parseExprOp(m,e,s,i,r)}return t};_.buildBinary=function(t,e,s,i,r,n){var a=this.startNodeAt(t,e);return a.left=s,a.operator=r,a.right=i,this.finishNode(a,n?"LogicalExpression":"BinaryExpression")};_.parseMaybeUnary=function(t,e){var s=this.start,i=this.startLoc,r;if(this.isContextual("await")&&(this.inAsync||!this.inFunction&&this.options.allowAwaitOutsideFunction))r=this.parseAwait(),e=!0;else if(this.type.prefix){var n=this.startNode(),a=this.type===o.incDec;n.operator=this.value,n.prefix=!0,this.next(),n.argument=this.parseMaybeUnary(null,!0),this.checkExpressionErrors(t,!0),a?this.checkLVal(n.argument):this.strict&&n.operator==="delete"&&n.argument.type==="Identifier"?this.raiseRecoverable(n.start,"Deleting local variable in strict mode"):e=!0,r=this.finishNode(n,a?"UpdateExpression":"UnaryExpression")}else{if(r=this.parseExprSubscripts(t),this.checkExpressionErrors(t))return r;for(;this.type.postfix&&!this.canInsertSemicolon();){var u=this.startNodeAt(s,i);u.operator=this.value,u.prefix=!1,u.argument=r,this.checkLVal(r),this.next(),r=this.finishNode(u,"UpdateExpression")}}return!e&&this.eat(o.starstar)?this.buildBinary(s,i,r,this.parseMaybeUnary(null,!1),"**",!1):r};_.parseExprSubscripts=function(t){var e=this.start,s=this.startLoc,i=this.parseExprAtom(t);if(i.type==="ArrowFunctionExpression"&&this.input.slice(this.lastTokStart,this.lastTokEnd)!==")")return i;var r=this.parseSubscripts(i,e,s);return t&&r.type==="MemberExpression"&&(t.parenthesizedAssign>=r.start&&(t.parenthesizedAssign=-1),t.parenthesizedBind>=r.start&&(t.parenthesizedBind=-1)),r};_.parseSubscripts=function(t,e,s,i){for(var r=this.options.ecmaVersion>=8&&t.type==="Identifier"&&t.name==="async"&&this.lastTokEnd===t.end&&!this.canInsertSemicolon()&&t.end-t.start===5&&this.potentialArrowAt===t.start,n=!1;;){var a=this.parseSubscript(t,e,s,i,r,n);if(a.optional&&(n=!0),a===t||a.type==="ArrowFunctionExpression"){if(n){var u=this.startNodeAt(e,s);u.expression=a,a=this.finishNode(u,"ChainExpression")}return a}t=a}};_.parseSubscript=function(t,e,s,i,r,n){var a=this.options.ecmaVersion>=11,u=a&&this.eat(o.questionDot);i&&u&&this.raise(this.lastTokStart,"Optional chaining cannot appear in the callee of new expressions");var c=this.eat(o.bracketL);if(c||u&&this.type!==o.parenL&&this.type!==o.backQuote||this.eat(o.dot)){var l=this.startNodeAt(e,s);l.object=t,l.property=c?this.parseExpression():this.parseIdent(this.options.allowReserved!=="never"),l.computed=!!c,c&&this.expect(o.bracketR),a&&(l.optional=u),t=this.finishNode(l,"MemberExpression")}else if(!i&&this.eat(o.parenL)){var h=new ze,p=this.yieldPos,m=this.awaitPos,d=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var g=this.parseExprList(o.parenR,this.options.ecmaVersion>=8,!1,h);if(r&&!u&&!this.canInsertSemicolon()&&this.eat(o.arrow))return this.checkPatternErrors(h,!1),this.checkYieldAwaitInDefaultParams(),this.awaitIdentPos>0&&this.raise(this.awaitIdentPos,"Cannot use 'await' as identifier inside an async function"),this.yieldPos=p,this.awaitPos=m,this.awaitIdentPos=d,this.parseArrowExpression(this.startNodeAt(e,s),g,!0);this.checkExpressionErrors(h,!0),this.yieldPos=p||this.yieldPos,this.awaitPos=m||this.awaitPos,this.awaitIdentPos=d||this.awaitIdentPos;var x=this.startNodeAt(e,s);x.callee=t,x.arguments=g,a&&(x.optional=u),t=this.finishNode(x,"CallExpression")}else if(this.type===o.backQuote){(u||n)&&this.raise(this.start,"Optional chaining cannot appear in the tag of tagged template expressions");var v=this.startNodeAt(e,s);v.tag=t,v.quasi=this.parseTemplate({isTagged:!0}),t=this.finishNode(v,"TaggedTemplateExpression")}return t};_.parseExprAtom=function(t){this.type===o.slash&&this.readRegexp();var e,s=this.potentialArrowAt===this.start;switch(this.type){case o._super:return this.allowSuper||this.raise(this.start,"'super' keyword outside a method"),e=this.startNode(),this.next(),this.type===o.parenL&&!this.allowDirectSuper&&this.raise(e.start,"super() call outside constructor of a subclass"),this.type!==o.dot&&this.type!==o.bracketL&&this.type!==o.parenL&&this.unexpected(),this.finishNode(e,"Super");case o._this:return e=this.startNode(),this.next(),this.finishNode(e,"ThisExpression");case o.name:var i=this.start,r=this.startLoc,n=this.containsEsc,a=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!n&&a.name==="async"&&!this.canInsertSemicolon()&&this.eat(o._function))return this.parseFunction(this.startNodeAt(i,r),0,!1,!0);if(s&&!this.canInsertSemicolon()){if(this.eat(o.arrow))return this.parseArrowExpression(this.startNodeAt(i,r),[a],!1);if(this.options.ecmaVersion>=8&&a.name==="async"&&this.type===o.name&&!n)return a=this.parseIdent(!1),(this.canInsertSemicolon()||!this.eat(o.arrow))&&this.unexpected(),this.parseArrowExpression(this.startNodeAt(i,r),[a],!0)}return a;case o.regexp:var u=this.value;return e=this.parseLiteral(u.value),e.regex={pattern:u.pattern,flags:u.flags},e;case o.num:case o.string:return this.parseLiteral(this.value);case o._null:case o._true:case o._false:return e=this.startNode(),e.value=this.type===o._null?null:this.type===o._true,e.raw=this.type.keyword,this.next(),this.finishNode(e,"Literal");case o.parenL:var c=this.start,l=this.parseParenAndDistinguishExpression(s);return t&&(t.parenthesizedAssign<0&&!this.isSimpleAssignTarget(l)&&(t.parenthesizedAssign=c),t.parenthesizedBind<0&&(t.parenthesizedBind=c)),l;case o.bracketL:return e=this.startNode(),this.next(),e.elements=this.parseExprList(o.bracketR,!0,!0,t),this.finishNode(e,"ArrayExpression");case o.braceL:return this.parseObj(!1,t);case o._function:return e=this.startNode(),this.next(),this.parseFunction(e,0);case o._class:return this.parseClass(this.startNode(),!1);case o._new:return this.parseNew();case o.backQuote:return this.parseTemplate();case o._import:return this.options.ecmaVersion>=11?this.parseExprImport():this.unexpected();default:this.unexpected()}};_.parseExprImport=function(){var t=this.startNode();this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword import");var e=this.parseIdent(!0);switch(this.type){case o.parenL:return this.parseDynamicImport(t);case o.dot:return t.meta=e,this.parseImportMeta(t);default:this.unexpected()}};_.parseDynamicImport=function(t){if(this.next(),t.source=this.parseMaybeAssign(),!this.eat(o.parenR)){var e=this.start;this.eat(o.comma)&&this.eat(o.parenR)?this.raiseRecoverable(e,"Trailing comma is not allowed in import()"):this.unexpected(e)}return this.finishNode(t,"ImportExpression")};_.parseImportMeta=function(t){this.next();var e=this.containsEsc;return t.property=this.parseIdent(!0),t.property.name!=="meta"&&this.raiseRecoverable(t.property.start,"The only valid meta property for import is 'import.meta'"),e&&this.raiseRecoverable(t.start,"'import.meta' must not contain escaped characters"),this.options.sourceType!=="module"&&this.raiseRecoverable(t.start,"Cannot use 'import.meta' outside a module"),this.finishNode(t,"MetaProperty")};_.parseLiteral=function(t){var e=this.startNode();return e.value=t,e.raw=this.input.slice(this.start,this.end),e.raw.charCodeAt(e.raw.length-1)===110&&(e.bigint=e.raw.slice(0,-1).replace(/_/g,"")),this.next(),this.finishNode(e,"Literal")};_.parseParenExpression=function(){this.expect(o.parenL);var t=this.parseExpression();return this.expect(o.parenR),t};_.parseParenAndDistinguishExpression=function(t){var e=this.start,s=this.startLoc,i,r=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var n=this.start,a=this.startLoc,u=[],c=!0,l=!1,h=new ze,p=this.yieldPos,m=this.awaitPos,d;for(this.yieldPos=0,this.awaitPos=0;this.type!==o.parenR;)if(c?c=!1:this.expect(o.comma),r&&this.afterTrailingComma(o.parenR,!0)){l=!0;break}else if(this.type===o.ellipsis){d=this.start,u.push(this.parseParenItem(this.parseRestBinding())),this.type===o.comma&&this.raise(this.start,"Comma is not permitted after the rest element");break}else u.push(this.parseMaybeAssign(!1,h,this.parseParenItem));var g=this.start,x=this.startLoc;if(this.expect(o.parenR),t&&!this.canInsertSemicolon()&&this.eat(o.arrow))return this.checkPatternErrors(h,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=p,this.awaitPos=m,this.parseParenArrowList(e,s,u);(!u.length||l)&&this.unexpected(this.lastTokStart),d&&this.unexpected(d),this.checkExpressionErrors(h,!0),this.yieldPos=p||this.yieldPos,this.awaitPos=m||this.awaitPos,u.length>1?(i=this.startNodeAt(n,a),i.expressions=u,this.finishNodeAt(i,"SequenceExpression",g,x)):i=u[0]}else i=this.parseParenExpression();if(this.options.preserveParens){var v=this.startNodeAt(e,s);return v.expression=i,this.finishNode(v,"ParenthesizedExpression")}else return i};_.parseParenItem=function(t){return t};_.parseParenArrowList=function(t,e,s){return this.parseArrowExpression(this.startNodeAt(t,e),s)};var Oi=[];_.parseNew=function(){this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword new");var t=this.startNode(),e=this.parseIdent(!0);if(this.options.ecmaVersion>=6&&this.eat(o.dot)){t.meta=e;var s=this.containsEsc;return t.property=this.parseIdent(!0),t.property.name!=="target"&&this.raiseRecoverable(t.property.start,"The only valid meta property for new is 'new.target'"),s&&this.raiseRecoverable(t.start,"'new.target' must not contain escaped characters"),this.inNonArrowFunction()||this.raiseRecoverable(t.start,"'new.target' can only be used in functions"),this.finishNode(t,"MetaProperty")}var i=this.start,r=this.startLoc,n=this.type===o._import;return t.callee=this.parseSubscripts(this.parseExprAtom(),i,r,!0),n&&t.callee.type==="ImportExpression"&&this.raise(i,"Cannot use new with import()"),this.eat(o.parenL)?t.arguments=this.parseExprList(o.parenR,this.options.ecmaVersion>=8,!1):t.arguments=Oi,this.finishNode(t,"NewExpression")};_.parseTemplateElement=function(t){var e=t.isTagged,s=this.startNode();return this.type===o.invalidTemplate?(e||this.raiseRecoverable(this.start,"Bad escape sequence in untagged template literal"),s.value={raw:this.value,cooked:null}):s.value={raw:this.input.slice(this.start,this.end).replace(/\r\n?/g,`
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
`;return r.evaluate(n)}Object.defineProperty(Rt,"__IS_FUNCTION_FUNC",{value:!0,writable:!1,enumerable:!1,configurable:!1});class Q{constructor(e){this.value=e}}class oe{constructor(e){this.value=e}}class se{constructor(e){this.value=e}}class me{constructor(e,s=null,i){this.name=i,this.parent=s,this.data=e,this.labelStack=[]}}function Me(){}function Zi(t=null,e){return new me(Object.create(null),t,e)}function er(t){return Object.create(t)}const Y={NaN:NaN,Infinity:1/0,undefined:void 0,Object,Array,String,Boolean,Number,Date,RegExp,Error,URIError,TypeError,RangeError,SyntaxError,ReferenceError,Math,parseInt,parseFloat,isNaN,isFinite,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,escape,unescape,eval:Tt,Function:Rt};typeof JSON<"u"&&(Y.JSON=JSON);typeof Promise<"u"&&(Y.Promise=Promise);typeof Set<"u"&&(Y.Set=Set);typeof Map<"u"&&(Y.Map=Map);typeof Symbol<"u"&&(Y.Symbol=Symbol);typeof Proxy<"u"&&(Y.Proxy=Proxy);typeof WeakMap<"u"&&(Y.WeakMap=WeakMap);typeof WeakSet<"u"&&(Y.WeakSet=WeakSet);typeof Reflect<"u"&&(Y.Reflect=Reflect);class D{constructor(e=D.global,s={}){this.sourceList=[],this.collectDeclVars=Object.create(null),this.collectDeclFuncs=Object.create(null),this.isVarDeclMode=!1,this.lastExecNode=null,this.isRunning=!1,this.options={ecmaVersion:s.ecmaVersion||D.ecmaVersion,timeout:s.timeout||0,rootContext:s.rootContext,globalContextInFunction:s.globalContextInFunction===void 0?D.globalContextInFunction:s.globalContextInFunction,_initEnv:s._initEnv},this.context=e||Object.create(null),this.callStack=[],this.initEnvironment(this.context)}initEnvironment(e){let s;if(e instanceof me)s=e;else{let r=null;const n=this.createSuperScope(e);this.options.rootContext&&(r=new me(er(this.options.rootContext),n,Kt)),s=new me(e,r||n,zt)}this.globalScope=s,this.currentScope=this.globalScope,this.globalContext=s.data,this.currentContext=s.data,this.collectDeclVars=Object.create(null),this.collectDeclFuncs=Object.create(null),this.execStartTime=Date.now(),this.execEndTime=this.execStartTime;const i=this.options._initEnv;i&&i.call(this)}getExecStartTime(){return this.execStartTime}getExecutionTime(){return this.execEndTime-this.execStartTime}setExecTimeout(e=0){this.options.timeout=e}getOptions(){return this.options}getGlobalScope(){return this.globalScope}getCurrentScope(){return this.currentScope}getCurrentContext(){return this.currentContext}isInterruptThrow(e){return e instanceof $s||e instanceof J||e instanceof Qi}createSuperScope(e){let s=Object.assign({},Y);return Object.keys(s).forEach(r=>{r in e&&delete s[r]}),new me(s,null,Wt)}setCurrentContext(e){this.currentContext=e}setCurrentScope(e){this.currentScope=e}evaluate(e=""){let s;if(e)return s=Wi(e,{ranges:!0,locations:!0,ecmaVersion:this.options.ecmaVersion||D.ecmaVersion}),this.evaluateNode(s,e)}appendCode(e){return this.evaluate(e)}evaluateNode(e,s=""){this.value=void 0,this.source=s,this.sourceList.push(s),this.isRunning=!0,this.execStartTime=Date.now(),this.execEndTime=this.execStartTime,this.collectDeclVars=Object.create(null),this.collectDeclFuncs=Object.create(null);const i=this.getCurrentScope(),r=this.getCurrentContext(),n=i.labelStack.concat([]),a=this.callStack.concat([]),u=()=>{this.setCurrentScope(i),this.setCurrentContext(r),i.labelStack=n,this.callStack=a};try{const c=this.createClosure(e);this.addDeclarationsToScope(this.collectDeclVars,this.collectDeclFuncs,this.getCurrentScope()),c()}catch(c){throw c}finally{u(),this.execEndTime=Date.now()}return this.isRunning=!1,this.getValue()}createErrorMessage(e,s,i){let r=e[1].replace("%0",String(s));return i!==null&&(r+=this.getNodePosition(i||this.lastExecNode)),r}createError(e,s){return new s(e)}createThrowError(e,s){return this.createError(e,s)}createInternalThrowError(e,s,i){return this.createError(this.createErrorMessage(e,s,i),e[2])}checkTimeout(){if(!this.isRunning)return!1;const e=this.options.timeout||0;return Date.now()-this.execStartTime>e}getNodePosition(e){return e&&e.loc?` [${e.loc.start.line}:${e.loc.start.column}]`:""}createClosure(e){let s;switch(e.type){case"BinaryExpression":s=this.binaryExpressionHandler(e);break;case"LogicalExpression":s=this.logicalExpressionHandler(e);break;case"UnaryExpression":s=this.unaryExpressionHandler(e);break;case"UpdateExpression":s=this.updateExpressionHandler(e);break;case"ObjectExpression":s=this.objectExpressionHandler(e);break;case"ArrayExpression":s=this.arrayExpressionHandler(e);break;case"CallExpression":s=this.callExpressionHandler(e);break;case"NewExpression":s=this.newExpressionHandler(e);break;case"MemberExpression":s=this.memberExpressionHandler(e);break;case"ThisExpression":s=this.thisExpressionHandler(e);break;case"SequenceExpression":s=this.sequenceExpressionHandler(e);break;case"Literal":s=this.literalHandler(e);break;case"Identifier":s=this.identifierHandler(e);break;case"AssignmentExpression":s=this.assignmentExpressionHandler(e);break;case"FunctionDeclaration":s=this.functionDeclarationHandler(e);break;case"VariableDeclaration":s=this.variableDeclarationHandler(e);break;case"BlockStatement":case"Program":s=this.programHandler(e);break;case"ExpressionStatement":s=this.expressionStatementHandler(e);break;case"EmptyStatement":s=this.emptyStatementHandler(e);break;case"ReturnStatement":s=this.returnStatementHandler(e);break;case"FunctionExpression":s=this.functionExpressionHandler(e);break;case"IfStatement":s=this.ifStatementHandler(e);break;case"ConditionalExpression":s=this.conditionalExpressionHandler(e);break;case"ForStatement":s=this.forStatementHandler(e);break;case"WhileStatement":s=this.whileStatementHandler(e);break;case"DoWhileStatement":s=this.doWhileStatementHandler(e);break;case"ForInStatement":s=this.forInStatementHandler(e);break;case"WithStatement":s=this.withStatementHandler(e);break;case"ThrowStatement":s=this.throwStatementHandler(e);break;case"TryStatement":s=this.tryStatementHandler(e);break;case"ContinueStatement":s=this.continueStatementHandler(e);break;case"BreakStatement":s=this.breakStatementHandler(e);break;case"SwitchStatement":s=this.switchStatementHandler(e);break;case"LabeledStatement":s=this.labeledStatementHandler(e);break;case"DebuggerStatement":s=this.debuggerStatementHandler(e);break;default:throw this.createInternalThrowError(V.NodeTypeSyntaxError,e.type,e)}return(...i)=>{const r=this.options.timeout;if(r&&r>0&&this.checkTimeout())throw this.createInternalThrowError(V.ExecutionTimeOutError,r,null);return this.lastExecNode=e,s(...i)}}binaryExpressionHandler(e){const s=this.createClosure(e.left),i=this.createClosure(e.right);return()=>{const r=s(),n=i();switch(e.operator){case"==":return r==n;case"!=":return r!=n;case"===":return r===n;case"!==":return r!==n;case"<":return r<n;case"<=":return r<=n;case">":return r>n;case">=":return r>=n;case"<<":return r<<n;case">>":return r>>n;case">>>":return r>>>n;case"+":return r+n;case"-":return r-n;case"*":return r*n;case"**":return Math.pow(r,n);case"/":return r/n;case"%":return r%n;case"|":return r|n;case"^":return r^n;case"&":return r&n;case"in":return r in n;case"instanceof":return r instanceof n;default:throw this.createInternalThrowError(V.BinaryOperatorSyntaxError,e.operator,e)}}}logicalExpressionHandler(e){const s=this.createClosure(e.left),i=this.createClosure(e.right);return()=>{switch(e.operator){case"||":return s()||i();case"&&":return s()&&i();default:throw this.createInternalThrowError(V.LogicalOperatorSyntaxError,e.operator,e)}}}unaryExpressionHandler(e){switch(e.operator){case"delete":const s=this.createObjectGetter(e.argument),i=this.createNameGetter(e.argument);return()=>{let n=s();const a=i();return delete n[a]};default:let r;if(e.operator==="typeof"&&e.argument.type==="Identifier"){const n=this.createObjectGetter(e.argument),a=this.createNameGetter(e.argument);r=()=>n()[a()]}else r=this.createClosure(e.argument);return()=>{const n=r();switch(e.operator){case"-":return-n;case"+":return+n;case"!":return!n;case"~":return~n;case"void":return;case"typeof":return typeof n;default:throw this.createInternalThrowError(V.UnaryOperatorSyntaxError,e.operator,e)}}}}updateExpressionHandler(e){const s=this.createObjectGetter(e.argument),i=this.createNameGetter(e.argument);return()=>{const r=s(),n=i();switch(this.assertVariable(r,n,e),e.operator){case"++":return e.prefix?++r[n]:r[n]++;case"--":return e.prefix?--r[n]:r[n]--;default:throw this.createInternalThrowError(V.UpdateOperatorSyntaxError,e.operator,e)}}}objectExpressionHandler(e){const s=[];function i(n){return n.type==="Identifier"?n.name:n.type==="Literal"?n.value:this.throwError(V.ObjectStructureSyntaxError,n.type,n)}const r=Object.create(null);return e.properties.forEach(n=>{const a=n.kind,u=i(n.key);(!r[u]||a==="init")&&(r[u]={}),r[u][a]=this.createClosure(n.value),s.push({key:u,property:n})}),()=>{const n={},a=s.length;for(let u=0;u<a;u++){const c=s[u],l=c.key,h=r[l],p=h.init?h.init():void 0,m=h.get?h.get():function(){},d=h.set?h.set():function(g){};if("set"in h||"get"in h)Object.defineProperty(n,l,{configurable:!0,enumerable:!0,get:m,set:d});else{const g=c.property,x=g.kind;g.key.type==="Identifier"&&g.value.type==="FunctionExpression"&&x==="init"&&!g.value.id&&$t(p,g.key.name),n[l]=p}}return n}}arrayExpressionHandler(e){const s=e.elements.map(i=>i&&this.createClosure(i));return()=>{const i=s.length,r=Array(i);for(let n=0;n<i;n++){const a=s[n];a&&(r[n]=a())}return r}}safeObjectGet(e,s,i){return e[s]}createCallFunctionGetter(e){switch(e.type){case"MemberExpression":const s=this.createClosure(e.object),i=this.createMemberKeyGetter(e),r=this.source;return()=>{const a=s(),u=i(),c=this.safeObjectGet(a,u,e);if(!c||!nt(c)){const l=r.slice(e.start,e.end);throw this.createInternalThrowError(V.FunctionUndefinedReferenceError,l,e)}return c.__IS_EVAL_FUNC?l=>c(new ie(this),l,!0):c.__IS_FUNCTION_FUNC?(...l)=>c(new ie(this),...l):c.bind(a)};default:const n=this.createClosure(e);return()=>{let a="";e.type==="Identifier"&&(a=e.name);const u=n();if(!u||!nt(u))throw this.createInternalThrowError(V.FunctionUndefinedReferenceError,a,e);if(e.type==="Identifier"&&u.__IS_EVAL_FUNC&&a==="eval")return l=>{const h=this.getScopeFromName(a,this.getCurrentScope()),p=h.name===Wt||h.name===zt||h.name===Kt;return u(new ie(this),l,!p)};if(u.__IS_EVAL_FUNC)return l=>u(new ie(this),l,!0);if(u.__IS_FUNCTION_FUNC)return(...l)=>u(new ie(this),...l);let c=this.options.globalContextInFunction;if(e.type==="Identifier"){const l=this.getIdentifierScope(e);l.name===qt&&(c=l.data)}return u.bind(c)}}}callExpressionHandler(e){const s=this.createCallFunctionGetter(e.callee),i=e.arguments.map(r=>this.createClosure(r));return()=>s()(...i.map(r=>r()))}functionExpressionHandler(e){const s=this,i=this.source,r=this.collectDeclVars,n=this.collectDeclFuncs;this.collectDeclVars=Object.create(null),this.collectDeclFuncs=Object.create(null);const a=e.id?e.id.name:"",u=e.params.length,c=e.params.map(m=>this.createParamNameGetter(m)),l=this.createClosure(e.body),h=this.collectDeclVars,p=this.collectDeclFuncs;return this.collectDeclVars=r,this.collectDeclFuncs=n,()=>{const m=s.getCurrentScope(),d=function(...g){s.callStack.push(`${a}`);const x=s.getCurrentScope(),v=Zi(m,`FunctionScope(${a})`);s.setCurrentScope(v),s.addDeclarationsToScope(h,p,v),a&&(v.data[a]=d),v.data.arguments=arguments,c.forEach((O,w)=>{v.data[O()]=g[w]});const k=s.getCurrentContext();s.setCurrentContext(this);const T=l();if(s.setCurrentContext(k),s.setCurrentScope(x),s.callStack.pop(),T instanceof Q)return T.value};return $t(d,a),Object.defineProperty(d,"length",{value:u,writable:!1,enumerable:!1,configurable:!0}),Object.defineProperty(d,"toString",{value:()=>i.slice(e.start,e.end),writable:!0,configurable:!0,enumerable:!1}),Object.defineProperty(d,"valueOf",{value:()=>i.slice(e.start,e.end),writable:!0,configurable:!0,enumerable:!1}),d}}newExpressionHandler(e){const s=this.source,i=this.createClosure(e.callee),r=e.arguments.map(n=>this.createClosure(n));return()=>{const n=i();if(!nt(n)||n.__IS_EVAL_FUNC){const a=e.callee,u=s.slice(a.start,a.end);throw this.createInternalThrowError(V.IsNotConstructor,u,e)}return n.__IS_FUNCTION_FUNC?n(new ie(this),...r.map(a=>a())):new n(...r.map(a=>a()))}}memberExpressionHandler(e){const s=this.createClosure(e.object),i=this.createMemberKeyGetter(e);return()=>{const r=s();let n=i();return r[n]}}thisExpressionHandler(e){return()=>this.getCurrentContext()}sequenceExpressionHandler(e){const s=e.expressions.map(i=>this.createClosure(i));return()=>{let i;const r=s.length;for(let n=0;n<r;n++){const a=s[n];i=a()}return i}}literalHandler(e){return()=>e.regex?new RegExp(e.regex.pattern,e.regex.flags):e.value}identifierHandler(e){return()=>{const s=this.getCurrentScope(),i=this.getScopeDataFromName(e.name,s);return this.assertVariable(i,e.name,e),i[e.name]}}getIdentifierScope(e){const s=this.getCurrentScope();return this.getScopeFromName(e.name,s)}assignmentExpressionHandler(e){e.left.type==="Identifier"&&e.right.type==="FunctionExpression"&&!e.right.id&&(e.right.id={type:"Identifier",name:e.left.name});const s=this.createObjectGetter(e.left),i=this.createNameGetter(e.left),r=this.createClosure(e.right);return()=>{const n=s(),a=i(),u=r();switch(e.operator!=="="&&this.assertVariable(n,a,e),e.operator){case"=":return n[a]=u;case"+=":return n[a]+=u;case"-=":return n[a]-=u;case"*=":return n[a]*=u;case"**=":return n[a]=Math.pow(n[a],u);case"/=":return n[a]/=u;case"%=":return n[a]%=u;case"<<=":return n[a]<<=u;case">>=":return n[a]>>=u;case">>>=":return n[a]>>>=u;case"&=":return n[a]&=u;case"^=":return n[a]^=u;case"|=":return n[a]|=u;default:throw this.createInternalThrowError(V.AssignmentExpressionSyntaxError,e.type,e)}}}functionDeclarationHandler(e){if(e.id){const s=this.functionExpressionHandler(e);Object.defineProperty(s,"isFunctionDeclareClosure",{value:!0,writable:!1,configurable:!1,enumerable:!1}),this.funcDeclaration(e.id.name,s)}return()=>N}getVariableName(e){if(e.type==="Identifier")return e.name;throw this.createInternalThrowError(V.VariableTypeSyntaxError,e.type,e)}variableDeclarationHandler(e){let s;const i=[];for(let r=0;r<e.declarations.length;r++){const n=e.declarations[r];this.varDeclaration(this.getVariableName(n.id)),n.init&&i.push({type:"AssignmentExpression",operator:"=",left:n.id,right:n.init})}return i.length&&(s=this.createClosure({type:"BlockStatement",body:i})),()=>{if(s){const r=this.isVarDeclMode;this.isVarDeclMode=!0,s(),this.isVarDeclMode=r}return N}}assertVariable(e,s,i){if(e===this.globalScope.data&&!(s in e))throw this.createInternalThrowError(V.VariableUndefinedReferenceError,s,i)}programHandler(e){const s=e.body.map(i=>this.createClosure(i));return()=>{let i=N;for(let r=0;r<s.length;r++){const n=s[r],a=this.setValue(n());if(a!==N&&(i=a,i instanceof Q||i instanceof oe||i instanceof se||i===fe||i===de))break}return i}}expressionStatementHandler(e){return this.createClosure(e.expression)}emptyStatementHandler(e){return()=>N}returnStatementHandler(e){const s=e.argument?this.createClosure(e.argument):Me;return()=>new Q(s())}ifStatementHandler(e){const s=this.createClosure(e.test),i=this.createClosure(e.consequent),r=e.alternate?this.createClosure(e.alternate):()=>N;return()=>s()?i():r()}conditionalExpressionHandler(e){return this.ifStatementHandler(e)}forStatementHandler(e){let s=Me,i=e.test?this.createClosure(e.test):()=>!0,r=Me;const n=this.createClosure(e.body);return e.type==="ForStatement"&&(s=e.init?this.createClosure(e.init):s,r=e.update?this.createClosure(e.update):Me),a=>{let u,c=N,l=e.type==="DoWhileStatement";for(a&&a.type==="LabeledStatement"&&(u=a.label.name),s();l||i();r()){l=!1;const h=this.setValue(n());if(!(h===N||h===de)){if(h===fe)break;if(c=h,c instanceof se&&c.value===u){c=N;continue}if(c instanceof Q||c instanceof oe||c instanceof se)break}}return c}}whileStatementHandler(e){return this.forStatementHandler(e)}doWhileStatementHandler(e){return this.forStatementHandler(e)}forInStatementHandler(e){let s=e.left;const i=this.createClosure(e.right),r=this.createClosure(e.body);return e.left.type==="VariableDeclaration"&&(this.createClosure(e.left)(),s=e.left.declarations[0].id),n=>{let a,u=N,c;n&&n.type==="LabeledStatement"&&(a=n.label.name);const l=i();for(c in l){this.assignmentExpressionHandler({type:"AssignmentExpression",operator:"=",left:s,right:{type:"Literal",value:c}})();const h=this.setValue(r());if(!(h===N||h===de)){if(h===fe)break;if(u=h,u instanceof se&&u.value===a){u=N;continue}if(u instanceof Q||u instanceof oe||u instanceof se)break}}return u}}withStatementHandler(e){const s=this.createClosure(e.object),i=this.createClosure(e.body);return()=>{const r=s(),n=this.getCurrentScope(),a=new me(r,n,qt);this.setCurrentScope(a);const u=this.setValue(i());return this.setCurrentScope(n),u}}throwStatementHandler(e){const s=this.createClosure(e.argument);return()=>{throw this.setValue(void 0),s()}}tryStatementHandler(e){const s=this.createClosure(e.block),i=e.handler?this.catchClauseHandler(e.handler):null,r=e.finalizer?this.createClosure(e.finalizer):null;return()=>{const n=this.getCurrentScope(),a=this.getCurrentContext(),u=n.labelStack.concat([]),c=this.callStack.concat([]);let l=N,h,p;const m=()=>{this.setCurrentScope(n),this.setCurrentContext(a),n.labelStack=u,this.callStack=c};try{l=this.setValue(s()),l instanceof Q&&(h=l)}catch(d){if(m(),this.isInterruptThrow(d))throw d;if(i)try{l=this.setValue(i(d)),l instanceof Q&&(h=l)}catch(g){if(m(),this.isInterruptThrow(g))throw g;p=g}}if(r)try{l=r(),l instanceof Q&&(h=l)}catch(d){if(m(),this.isInterruptThrow(d))throw d;p=d}if(p)throw p;return h||l}}catchClauseHandler(e){const s=this.createParamNameGetter(e.param),i=this.createClosure(e.body);return r=>{let n;const u=this.getCurrentScope().data,c=s(),l=Xi.call(u,c),h=u[c];return u[c]=r,n=i(),l?u[c]=h:delete u[c],n}}continueStatementHandler(e){return()=>e.label?new se(e.label.name):de}breakStatementHandler(e){return()=>e.label?new oe(e.label.name):fe}switchStatementHandler(e){const s=this.createClosure(e.discriminant),i=e.cases.map(r=>this.switchCaseHandler(r));return()=>{const r=s();let n=!1,a,u,c=0,l=!1;for(let h=0;h<2;h++){for(let p=c;p<i.length;p++){const m=i[p](),d=m.testClosure();if(!l&&d===Gt&&(l=!0,c=p),n||d===r){if(n=!0,u=this.setValue(m.bodyClosure()),u===N)continue;if(u===fe||(a=u,a instanceof Q||a instanceof oe||a instanceof se||a===de))break}}if(!n&&l)n=!0;else break}return a}}switchCaseHandler(e){const s=e.test?this.createClosure(e.test):()=>Gt,i=this.createClosure({type:"BlockStatement",body:e.consequent});return()=>({testClosure:s,bodyClosure:i})}labeledStatementHandler(e){const s=e.label.name,i=this.createClosure(e.body);return()=>{let r;const n=this.getCurrentScope();return n.labelStack.push(s),r=i(e),r instanceof oe&&r.value===s&&(r=N),n.labelStack.pop(),r}}debuggerStatementHandler(e){return()=>{debugger;return N}}createParamNameGetter(e){if(e.type==="Identifier")return()=>e.name;throw this.createInternalThrowError(V.ParamTypeSyntaxError,e.type,e)}createObjectKeyGetter(e){let s;return e.type==="Identifier"?s=()=>e.name:s=this.createClosure(e),function(){return s()}}createMemberKeyGetter(e){return e.computed?this.createClosure(e.property):this.createObjectKeyGetter(e.property)}createObjectGetter(e){switch(e.type){case"Identifier":return()=>this.getScopeDataFromName(e.name,this.getCurrentScope());case"MemberExpression":return this.createClosure(e.object);default:throw this.createInternalThrowError(V.AssignmentTypeSyntaxError,e.type,e)}}createNameGetter(e){switch(e.type){case"Identifier":return()=>e.name;case"MemberExpression":return this.createMemberKeyGetter(e);default:throw this.createInternalThrowError(V.AssignmentTypeSyntaxError,e.type,e)}}varDeclaration(e){const s=this.collectDeclVars;s[e]=void 0}funcDeclaration(e,s){const i=this.collectDeclFuncs;i[e]=s}addDeclarationsToScope(e,s,i){const r=i.data;for(let n in s){const a=s[n];r[n]=a&&a()}for(let n in e)n in r||(r[n]=void 0)}getScopeValue(e,s){return this.getScopeFromName(e,s).data[e]}getScopeDataFromName(e,s){return this.getScopeFromName(e,s).data}getScopeFromName(e,s){let i=s;do if(e in i.data)return i;while(i=i.parent);return this.globalScope}setValue(e){const s=this.callStack.length;return this.isVarDeclMode||s||e===N||e===fe||e===de||e instanceof oe||e instanceof se||(this.value=e instanceof Q?e.value:e),e}getValue(){return this.value}}D.version=Yi;D.eval=Tt;D.Function=Rt;D.ecmaVersion=5;D.globalContextInFunction=void 0;D.global=Object.create(null);const tr=(()=>{try{return new Function("return 1")(),!0}catch{return!1}})();function Ue(t){if(typeof globalThis>"u")return;const e=globalThis[0]||globalThis;if(e.__simulator__)try{const s=e.__simulator__.engine.provider.errorHandler;s&&s(t)}catch{}}function sr(t,e){return new D(e,{rootContext:e,globalContextInFunction:e}).evaluate(`(function($scope){ ${t} }).call(this, this)`)}function Se(t,e,s=!1,i=!1,r=!1){try{const n=['"use strict";',"var __self = arguments[0];"];n.push("return ");let a=(t.value||"").trim();r||(a=a.replace(/this(\W|$)/g,(c,l)=>`__self${l}`)),a=n.join(`
|
|
18
18
|
`)+a;const u=r?`
|
|
19
19
|
${a}
|
|
20
|
-
`:`with(${s?"{}":"$scope || {}"}) { ${a} }`;return tr?new Function("$scope",u)(e):sr(u,e)}catch(n){if(f.logger.error("parseExpression.error",n,t,e?.__self??e),Ue(n),i)throw n}}function G(t,e,s=!1,i=!1,r=!1){const n=Se(t,e,s,i,r);if(typeof n!="function"&&(f.logger.error("parseFunction.error","not a function",t,e?.__self??e),i))throw new Error(`"${t.value}" not a function`);return n}function R(t){return t&&t.type==="JSExpression"}function F(t){return typeof t=="object"&&t&&t.type==="JSFunction"}function Gs(t){return R(t)||F(t)}function ir(t){return Gs(t)?t.value.startsWith("{")?`(${t.value})`:t.value:JSON.stringify(t)}const rr={session:!1,authKey:"Authorization",storageKey:"ACCESS_STORAGE",storagePrefix:"__VTJ_",unauthorized:void 0,auth:"/#/login",redirectParam:"r",unauthorizedCode:401,unauthorizedMessage:"登录已经失效,请重新登录!",noPermissionMessage:"无权限访问该页面",appName:"",statusKey:"code"},Nt=Symbol("access");class Xe{options;data=null;mode=A.Raw;interceptResponse=!0;isTipShowing=!1;constructor(e){this.options=Object.assign({},rr,e),this.loadData()}enableIntercept(){this.interceptResponse=!0}disableIntercept(){this.interceptResponse=!1}connect(e){const{mode:s,router:i,request:r}=e;this.mode=s,i&&this.mode!==A.Design&&this.setGuard(i),r&&this.setRequest(r)}login(e){const{storageKey:s,storagePrefix:i,session:r,authKey:n}=this.options;this.setData(e),this.data&&(f.storage.save(s,e,{type:"local",prefix:i}),r&&f.cookie.set(n,this.data.token))}clear(){const{storageKey:e,storagePrefix:s,session:i,authKey:r}=this.options;this.data=null,f.storage.remove(e,{type:"local",prefix:s}),i&&f.cookie.remove(r)}logout(){this.clear(),this.toLogin()}getData(){return this.data?this.data:(this.loadData(),this.data)}getToken(){return this.data||this.loadData(),this.data?.token}can(e){const{appName:s}=this.options,{permissions:i={}}=this.data||{};if(typeof e=="function")return e(i);const r=f.toArray(e);return Array.isArray(i)?r.every(n=>i.includes(n)||i.includes(s+"."+n)):r.every(n=>i[n]||i[s+"."+n])}some(e){const{appName:s}=this.options,{permissions:i={}}=this.data||{},r=f.toArray(e);return Array.isArray(i)?r.some(n=>i.includes(n)||i.includes(s+"."+n)):r.some(n=>i[n]||i[s+"."+n])}install(e){e.config.globalProperties.$access=this,e.provide(Nt,this)}isAuthPath(e){const{auth:s,isAuth:i}=this.options;if(i)return i(e);if(e.path&&typeof s=="string"){const r=s.split("#")[1]||s;return e.path===r}return!1}toLogin(){const{auth:e,redirectParam:s}=this.options;if(!e)return;const i=s?`?${s}=${encodeURIComponent(location.href)}`:"";typeof e=="function"?e(i):location.href=s?`${e}${i}`:e}setData(e){const{privateKey:s}=this.options;if(Array.isArray(e)&&s){const i=e.map(r=>f.unRSA(r,s));try{this.data=JSON.parse(i.join(""))}catch(r){console.warn(r)}return}if(typeof e=="string")try{const i=s?f.unRSA(e,s):e;i?this.data=JSON.parse(i):console.warn("RSA解密失败或登录信息缺失")}catch(i){console.warn(i)}else this.data=e}loadData(){const{storageKey:e,storagePrefix:s}=this.options,i=f.storage.get(e,{type:"local",prefix:s});this.setData(i||null)}isLogined(){const{session:e,authKey:s}=this.options;return e&&s?!!f.cookie.get(s):!!this.getToken()}hasRoutePermission(e){if(e.name===be){const s=e.params.id;return s&&this.can(s)}return e.meta.__vtj__?this.can(e.meta.__vtj__):e.meta.permission?this.can(e.meta.permission):!0}setGuard(e){e.beforeEach((s,i,r)=>this.guard(s,r))}async guard(e,s){if(this.isWhiteList(e)||this.isAuthPath(e))return s();if(this.isLogined()){if(this.hasRoutePermission(e))return s();{const{noPermissionMessage:i="无权限访问",unauthorized:r=!1}=this.options;return await this.showTip(i),f.isFunction(r)?(r(),s(!1)):f.isString(r)?s(r):s(!1)}}s(!1),await f.delay(0),this.toLogin()}isWhiteList(e){const{whiteList:s}=this.options;return s?Array.isArray(s)?s.some(i=>e.fullPath.startsWith(i)):s(e):!1}isUnauthorized(e){const{unauthorizedCode:s=401,statusKey:i="code"}=this.options;return e.status===s||e.data?.[i]===s}async showUnauthorizedAlert(e){const{unauthorizedMessage:s="登录已失效"}=this.options;this.isUnauthorized(e)&&await this.showTip(s)&&this.toLogin()}async showTip(e){const{alert:s}=this.options;return this.isTipShowing?!1:s?(this.isTipShowing=!0,await f.delay(150),await s(e,{title:"提示",type:"warning"})?.catch(()=>!0)?.finally(()=>{this.isTipShowing=!1})):(globalThis.alert?.(e)??console.warn(e),!0)}setRequest(e){e.useRequest(s=>(this.data?.token&&(s.headers[this.options.authKey]=this.data?.token),s)),e.useResponse(async s=>(this.interceptResponse&&await this.showUnauthorizedAlert(s),s),async s=>{if(!this.interceptResponse)return Promise.reject(s);const i=s.response||s||{};return await this.showUnauthorizedAlert(i),Promise.reject(s)})}}function qs(){return L.inject(Nt,null)}function nr(t={}){const{notify:e,loading:s,settings:i={},Startup:r,access:n,useTitle:a,alert:u}=t;let c=null;return{request:f.createRequest({adapter:t.axiosAdapter,settings:{type:"form",validSuccess:!1,originResponse:!0,loading:!0,validate:h=>h.data?.code===0||!!h.data?.success,failMessage:!0,showError:h=>{e&&e(h||"未知错误")},showLoading:()=>{c&&c.close(),s&&(c=s())},hideLoading:()=>{c&&(c.close(),c=null)},...i}}),jsonp:f.jsonp,notify:e,loading:s,useTitle:a,alert:u,startupComponent:r,access:n?new Xe({alert:u,...n}):void 0}}function ar(t={}){return new Xe(t)}function Ws(t,e){const{jsonp:s,request:i}=e;if(t.method==="jsonp")return(r={})=>s(t.url,{...t.jsonpOptions,query:r});{const r=t.headers?Se(t.headers,{},!0):void 0,n={url:t.url,method:t.method,settings:{...t.settings,headers:r}};return(a,u)=>(delete n.data,i.send(f.merge(n,u||{},{data:a})))}}function Ks(t,e){const{metaQuery:s}=e;if(!s)return;const{code:i,queryCode:r}=t;return(n,a)=>{if(!s){console.warn("adapter.metaQuery is not defined!");return}return s(i,r,n,a)}}function zs(t=[],e=[],s){const i={};for(const r of t){const n=Ws(r,s);i[r.id]=n,i[r.name]=n}for(const r of e)i[r.id]=Ks(r,s);return i}async function Js(t=[],e=globalThis){const s=ye(e);s&&(Ot(e),t.forEach(i=>Ys(s,i)))}function Qs(t,e=globalThis){const s=F(t.mockTemplate)&&t.mockTemplate.value?G(t.mockTemplate,{},!0):void 0,i=ye(e);return async(...r)=>{let n={};if(s)try{n=await s.apply(s,r)}catch(a){f.logger.warn("模拟数据模版异常",a)}return i?.mock(n)}}function Ys(t,e){if(!e.mock)return;const{url:s,mockTemplate:i,method:r="get",settings:n={}}=e;if(s&&i)try{const a=f.isUrl(s)?new URL(s).pathname:s,u=f.pathToRegexp(`(.*)${a}(.*)`),c=f.pathToRegexpMatch(a,{decode:decodeURIComponent}),l=Se(i,{},!0);t.mock(u,r.toLowerCase(),h=>{const p=f.url.parse(h.url)||{},m=n.type||"form";let d=h.body instanceof FormData?f.formDataToJson(h.body):h.body;if(typeof d=="string")if(m==="json")try{d=JSON.parse(d)}catch(v){console.warn("[Mock.mock]",v)}else d=f.url.parse(d);const g=f.isUrl(h.url)?new URL(h.url).pathname:h.url.split("?")[0],x=c(g)?.params;Object.assign(h,{data:d,params:x,query:p});try{return t.mock(l(h))}catch(v){return console.warn("[mockApi]",u,h,v),null}})}catch(a){console.warn("mockApi",a)}}function Ot(t=globalThis){const e=ye(t);e&&(e._mocked={})}class Xs{__id=null;__mode;__instance=null;__contextRefs={};__refs={};__refCaches={};context={};state={};props={};$props={};$state={};$refs={};$el=null;$emit=null;$nextTick=null;$parent=null;$root=null;$attrs=null;$slots=null;$watch=null;$options=null;$forceUpdate=null;$components={};$libs={};$apis={};$provider=null;$uni=null;$getApp=null;__transform={};constructor(e){const{mode:s,dsl:i,attrs:r}=e;this.__mode=s,i&&(this.__id=i.id||null,this.__transform=i.transform||{}),r&&Object.assign(this,r)}setup(e,s=xe){const i=s.getCurrentInstance();if(!i)return;this.__refs={},this.__refCaches={},this.$refs={},this.context={},this.__contextRefs={},this.__instance=i.proxy;const{state:r}=this,n=i.appContext.config.globalProperties;Object.assign(this,n,e||{}),this.$uni=this.$libs.UniH5?.uni??null,this.$getApp=this.$libs.UniH5?.getApp??null,this.$state=this.state=r,this.__proxy(),s.onMounted(()=>{this.__proxy()}),s.onUnmounted(()=>{this.__cleanup()}),s.onBeforeUpdate(()=>{this.__reset()})}__proxy(){if(!this.__instance)return;const e=this.__instance;ct.forEach(s=>{this[s]=e[s]||e._?.[s.replace("$","")]||null})}__cleanup(){ct.forEach(e=>{this[e]=null}),this.__reset()}__reset(){this.__refs={},this.__refCaches={},this.$refs={},this.__contextRefs={},this.context={}}__parseFunction(e){if(e)if(this.__mode===A.Runtime){const{id:s,type:i}=e,r=s?this.__transform[s]??e.value:e.value;return G({type:i,value:r},this)}else return G(e,this)}__parseExpression(e){if(e)if(this.__mode===A.Runtime){const{id:s,type:i}=e,r=s?this.__transform[s]??e.value:e.value;return Se({type:i,value:r},this)}else return Se(e,this)}__ref(e=null,s){if(this.__mode===A.VNode)return;e&&e!==this.__id&&(this.__contextRefs[e]=this);let i=e?this.__refCaches[e]:null;return i||(i=async r=>{await f.delay(0);let n=r?.$vtjEl||r?.$el||r?._?.vnode?.el||r;if(!n){typeof s=="string"&&(delete this.$refs[s],this[s]&&xe.isRef(this[s])&&(this[s].value=null),e&&delete this.__refs[e]);return}return n.nodeType===3&&n.nextSibling&&(n=n.nextSibling),n.__vtj__=e,A.Design===this.__mode&&(n.__context__=this,n.draggable=!0),e&&(this.__refs[e]=this.__getRefEl(this.__refs,e,r)),typeof s=="function"?s(r):s&&(this.$refs[s]=this.__getRefEl(this.$refs,s,r),this[s]&&xe.isRef(this[s])&&(this[s].value=this.$refs[s])),r},e&&(this.__refCaches[e]=i),i)}__getRefEl(e,s,i){const r=e[s];if(r&&i!==r){const n=new Set([].concat(r,i));return Array.from(n)}else return i}__clone(e={}){const s={...this.context,...e},i={...s,context:s};return i.context.__proto__=this.context,i.__proto__=this,i}}function $e(t){const{Vue:e=xe,UniApp:s={},mode:i=A.Runtime,components:r={},libs:n={},apis:a={},loader:u}=t,c=e.computed(()=>t.dsl),l={$components:r,$libs:n,$apis:a},h=new Xs({mode:i,dsl:c.value,attrs:l}),p=e.defineComponent({name:c.value.name,__scopeId:c.value.id?`data-v-${c.value.id}`:void 0,props:{...ur(c.value.props??[],h)},async setup(m={}){h.$props=h.props=m,c.value.id&&qe(t.window||globalThis,c.value.id,c.value.css||"",!0);const d=c.value.apiMode==="composition";h.$state=h.state=cr(e,c.value.state??{},h);const g=d?dr(e,c.value.refs??{},h):{},x=d?mr(e,c.value.reactives??{},h):{},v=lr(e,c.value.computed??{},h),k=hr(c.value.methods??{},h),T=pr(e,c.value.inject,h),O=Zs(c.value.dataSources||{},h);let w={};d&&(w=gr(c.value.composables??[],h));const W={...m,...g,...x,...T,...v,...k,...O,...w};if(h.setup(W,e),fr(e,c.value.watch??[],h),d){if(await vr(e,c.value.lifeCycles??{},h,s),c.value.setup){const pe=h.__parseFunction(c.value.setup);if(f.isFunction(pe))try{await pe()}catch(we){console.warn("[VTJ] Composition setup 执行失败",we)}}xr(e,c.value.provide??{},h)}return{vtj:h,state:h.state,$state:h.$state,...m,...g,...x,...v,...k}},emits:or(c.value.emits),expose:["vtj",...c.value.expose||[]],render(){if(!c.value.nodes)return null;const m=c.value.nodes||[];if(m.length===1)return le(m[0],h,e,u,m);{const d=m.map(g=>le(g,h,e,u,m)).flat();return e.createVNode("div",{},d)}},...c.value.apiMode!=="composition"?br(c.value.lifeCycles??{},h):{}});return{renderer:e.markRaw(p),context:h}}function or(t=[]){return t.map(e=>f.isString(e)?e:e.name)}function ur(t=[],e){const s=i=>i?(Array.isArray(i)?i:[i]).map(n=>Yt[n]):void 0;return t.map(i=>f.isString(i)?{name:i}:{name:i.name,type:i.type,required:i.required,default:R(i.default)?e.__parseExpression(i.default):i.default}).reduce((i,r)=>(i[r.name]={type:s(r.type),required:r.required,default:r.default},i),{})}function cr(t,e,s){return t.reactive(Object.keys(e||{}).reduce((i,r)=>{let n=e[r];return R(n)?n=s.__parseExpression(n):F(n)&&(n=s.__parseFunction(n)),i[r]=n,i},{}))}function lr(t,e,s){return Object.entries(e??{}).reduce((i,[r,n])=>(F(n)?i[r]=t.computed(s.__parseFunction(n)):i[r]=t.computed(s.__parseExpression(n)),i),{})}function hr(t,e){return Object.entries(t??{}).reduce((s,[i,r])=>(s[i]=e.__parseFunction(r),s),{})}function pr(t,e=[],s){return e.reduce((i,r)=>{const{name:n,from:a}=r||{},u=R(a)?s.__parseExpression(a)||n:a??n,c=R(r.default)?s.__parseExpression(r.default):r.default??null;return i[n]=t.inject(u,c),i},{})}function Zs(t,e){return Object.keys(t).reduce((s,i)=>{const r=t[i];if(r.type==="mock")s[i]=Qs(r);else if(r.ref){const n=e.$apis[r.ref],a=F(r.transform)?r.transform.value?e.__parseFunction(r.transform):void 0:r.transform;s[i]=async(...u)=>{const c=await n.apply(e,u);return a?a(c):c}}return s},{})}function fr(t,e=[],s){e.forEach(i=>{t.watch(s.__parseExpression(i.source),s.__parseFunction(i.handler),{deep:i.deep,immediate:i.immediate,flush:i.flush})})}function dr(t,e,s){return Object.entries(e).reduce((i,[r,n])=>{const a=R(n)?s.__parseExpression(n):n;return i[r]=t.ref(a),i},{})}function mr(t,e,s){return Object.entries(e).reduce((i,[r,n])=>{const a=R(n)?s.__parseExpression(n):n;return i[r]=t.reactive(a??{}),i},{})}function gr(t,e){return t.reduce((s,i)=>{try{let r;if(R(i.composable)?r=e.__parseExpression(i.composable):f.isString(i.composable)&&(r=e.$libs[i.composable]),f.isFunction(r)){const n=(i.args||[]).map(u=>R(u)?e.__parseExpression(u):u),a=r(...n);if(i.destructure&&i.destructure.length>0)for(const u of i.destructure)s[u]=a?.[u];else s[i.name]=a}}catch(r){e.__mode===A.Design&&(console.warn("[VTJ] composable 执行失败,已降级处理",r),s[i.name]={})}return s},{})}function xr(t,e,s){Object.entries(e).forEach(([i,r])=>{let n=r;R(r)?n=s.__parseExpression(r):F(r)&&(n=s.__parseFunction(r)),t.provide(i,n)})}async function vr(t,e,s,i={}){const r={beforeMount:"onBeforeMount",mounted:"onMounted",beforeUpdate:"onBeforeUpdate",updated:"onUpdated",beforeUnmount:"onBeforeUnmount",unmounted:"onUnmounted",errorCaptured:"onErrorCaptured",renderTracked:"onRenderTracked",renderTriggered:"onRenderTriggered",activated:"onActivated",deactivated:"onDeactivated"};for(const[n,a]of Object.entries(e)){if(n==="created"||n==="beforeCreate"){const l=s.__parseFunction(a);if(f.isFunction(l))try{await l()}catch(h){console.warn(`[VTJ] Composition 生命周期 "${n}" 执行失败`,h),Ue(h)}continue}const u=r[n]||n,c=t[u]||i[u];if(c&&f.isFunction(c)){const l=s.__parseFunction(a);f.isFunction(l)&&c(async()=>{try{await f.delay(0),await l()}catch(h){console.warn(`[VTJ] Composition 生命周期 "${n}" 执行失败`,h),Ue(h)}})}else console.warn(`[VTJ] 无效的 Composition 生命周期钩子 "${n}"`)}}function br(t,e){return Object.entries(t??{}).reduce((s,[i,r])=>{const n=e.__parseFunction(r);return s[i]=async()=>{f.isFunction(n)&&(await f.delay(0),await n())},s},{})}class yr{__props={};__events={};__nodes={};constructor(){}setProps(e,s){this.__props[e]=s}getProps(e){return this.__props[e]}loadProps(e,s){const i=e?this.getProps(e):null;return i||(e&&this.setProps(e,s),s)}setEvents(e,s){}getEvents(e){return this.__events[e]}loadEvents(e,s){const i=e?this.getEvents(e):null;return i||(e&&this.setEvents(e,s),s)}setNode(e,s){this.__nodes[e]=s}getNode(e){return this.__nodes[e]}loadNode(e,s){const i=e?this.getNode(e):null;return i||(e&&this.setNode(e,s),s)}isEqual(e,s){return f.isEqual(e,s)}isNodeEqual(e,s){if(e===s)return!0;if(!e||!s)return!1;const i=u=>!u||typeof u!="object"?[]:Object.keys(u).filter(c=>f.isFunction(u[c])),r=u=>{if(!u||typeof u!="object")return u;const c={};for(const l in u)if(Object.prototype.hasOwnProperty.call(u,l)){const h=u[l];f.isFunction(h)||(c[l]=h)}return c},n=i(e).sort(),a=i(s).sort();return f.isEqual(n,a)?f.isEqual(r(e),r(s)):!1}clear(){this.__props={},this.__events={},this.__nodes={}}}const ge=new yr,ei=new f.Queue;let at=[],ue={},ke={};const ti=(t,e)=>e;async function Vt(t,e=globalThis){const{urls:s=[],library:i}=t,r=s.filter(u=>Ve(u));if(r.length===0||!i)return null;const n=s.filter(u=>Oe(u));return n.length&&vt(n,e),await bt(r,i,e).catch(u=>(console.warn("loadScriptUrl error",r,i,u),null))}function Ge(t){const{getDsl:e,getDslByUrl:s,options:i}=t;return i.window&&(at.forEach(r=>{delete i.window[r]}),at=[]),(r,n,a,u=xe)=>{if(!a||typeof a=="string")return n;let c="";if(a.type==="Schema"&&a.id)return c=a.id+"_"+r,ke[c]||(ke[c]=u.defineAsyncComponent(async()=>{const l=ue[a.id]||await ei.add(a.id,()=>e(a.id));return l&&(l.name=n,ue[a.id]=l),l?$e({Vue:u,mode:A.Runtime,...i,dsl:f.cloneDeep(l),loader:Ge(t)}).renderer:null}));if(a.type==="UrlSchema"&&a.url)return c=a.url+"_"+r,ke[c]||(ke[c]=u.defineAsyncComponent(async()=>{const l=ue[a.url]||await s(a.url);return l&&(l.name=n,ue[a.url]=l),l?$e({...i,Vue:u,dsl:f.cloneDeep(l),mode:A.Runtime,loader:Ge(t)}).renderer:null}));if(a.type==="Plugin"){let l=a.library?ue[a.library]:null;return l||(a.library&&at.push(a.library),l=ue[a.library||Symbol()]=u.defineAsyncComponent(async()=>{const h=await Vt(a,i.window);return h||(console.warn("getPlugin result is null",a),null)}),l)}return n}}function _r(){ue={},ke={},ei.clearAllCache(),ge.clear()}function le(t,e,s=xe,i=ti,r=[],n=!1,a=0){if(!t||!t.name||t.invisible)return null;const u=s.getCurrentInstance()?.appContext,{id:c=null,directives:l=[]}=t,{vIf:h,vElseIf:p,vElse:m,vFor:d,vShow:g,vModels:x,vBind:v,vHtml:k,others:T}=si(l);if(!n&&(p||m))return null;if(h&&!Cr(h,e))return Pr(t,e,s,i,r);const O=(w,W=0)=>{const pe=w.$components,we=(()=>{if(t.name==="component")return wr(w,t.props?.is);if(t.name==="slot")return t.name;const K=i(`${t.id}_${W}`,t.name,t.from,s);return f.isString(K)?cs(K)||ls(K)?K:pe[K]??u?.app?.component(K)??K:K})(),te=Er(c,t.props??{},w),oi=Ar(s,t.id,t.events??{},w);if(t.name==="slot")return Tr(s,t,te,w,i);v&&Object.assign(te,w.__parseExpression(v.value)),g&&(te.style=Object.assign(te.style??{},Nr(g,w))),k&&Object.assign(te,Or(k,w)),x.forEach(K=>{gt.includes(t.name)?Object.assign(te,Vr(K,w)):Object.assign(te,Fr(s,K,w))});const ui=Lr(s,t.children??[],w,i,t),Mt=w?.__id?`data-v-${w.__id}`:void 0,ci=Mt?{[Mt]:""}:{},li=w.__mode===A.Design?{"data-vtj":c}:{},je=`${c}_${W}`,tt={key:je,...ci,...li,...te,...oi};ge.isNodeEqual(tt,ge.getNode(je))||ge.setNode(je,tt);let st=s.createVNode(we,ge.getNode(je)||tt||{},ui);const Dt=u?Sr(u,T,w):[];return Dt.length&&(st=s.withDirectives(st,Dt)),st};return d?Dr(d,O,e):O(e,a)}function Sr(t,e,s){const i=t.app;return e.map(r=>{const n=typeof r.name=="string"?i.directive(r.name):s.__parseExpression(r.name);if(!n)return null;const a=[n];return r.value&&a.push(s.__parseExpression(r.value)),r.arg&&a.push(r.arg),r.modifiers&&a.push(r.modifiers),a}).filter(r=>!!r)}function si(t=[]){const e=t.find(h=>f.camelCase(h.name)==="vIf"),s=t.find(h=>f.camelCase(h.name)==="vElseIf"),i=t.find(h=>f.camelCase(h.name)==="vElse"),r=t.find(h=>f.camelCase(h.name)==="vFor"),n=t.find(h=>f.camelCase(h.name)==="vShow"),a=t.find(h=>f.camelCase(h.name)==="vBind"),u=t.find(h=>f.camelCase(h.name)==="vHtml"),c=t.filter(h=>f.camelCase(h.name)==="vModel"),l=t.filter(h=>!Qt.includes(f.camelCase(h.name)));return{vIf:e,vElseIf:s,vElse:i,vFor:r,vShow:n,vModels:c,vBind:a,others:l,vHtml:u}}function Cr(t,e){return!!e.__parseExpression(t.value)}function wr(t,e){return e?R(e)?t.__parseExpression(e):e:"div"}function Er(t,e,s){const i=dt(e,s);return i.ref=s.__ref(t,i.ref),i}function dt(t,e){return R(t)?e.__parseExpression(t):F(t)?e.__parseFunction(t):Array.isArray(t)?t.map(s=>dt(s,e)):typeof t=="object"?Object.keys(t||{}).reduce((s,i)=>{let r=t[i];return s[i]=dt(r,e),s},{}):t}function kr(t,e){return s=>{s?.key?.toLowerCase()===e.toLowerCase()&&t(s)}}function Ir(t){return hs(t.value)?t:ps(t.value)?{type:"JSFunction",value:`(...args) => (() => {
|
|
20
|
+
`:`with(${s?"{}":"$scope || {}"}) { ${a} }`;return tr?new Function("$scope",u)(e):sr(u,e)}catch(n){if(f.logger.error("parseExpression.error",n,t,e?.__self??e),Ue(n),i)throw n}}function G(t,e,s=!1,i=!1,r=!1){const n=Se(t,e,s,i,r);if(typeof n!="function"&&(f.logger.error("parseFunction.error","not a function",t,e?.__self??e),i))throw new Error(`"${t.value}" not a function`);return n}function R(t){return t&&t.type==="JSExpression"}function F(t){return typeof t=="object"&&t&&t.type==="JSFunction"}function Gs(t){return R(t)||F(t)}function ir(t){return Gs(t)?t.value.startsWith("{")?`(${t.value})`:t.value:JSON.stringify(t)}const rr={session:!1,authKey:"Authorization",storageKey:"ACCESS_STORAGE",storagePrefix:"__VTJ_",unauthorized:void 0,auth:"/#/login",redirectParam:"r",unauthorizedCode:401,unauthorizedMessage:"登录已经失效,请重新登录!",noPermissionMessage:"无权限访问该页面",appName:"",statusKey:"code"},Nt=Symbol("access");class Xe{options;data=null;mode=A.Raw;interceptResponse=!0;isTipShowing=!1;constructor(e){this.options=Object.assign({},rr,e),this.loadData()}enableIntercept(){this.interceptResponse=!0}disableIntercept(){this.interceptResponse=!1}connect(e){const{mode:s,router:i,request:r}=e;this.mode=s,i&&this.mode!==A.Design&&this.setGuard(i),r&&this.setRequest(r)}login(e){const{storageKey:s,storagePrefix:i,session:r,authKey:n}=this.options;this.setData(e),this.data&&(f.storage.save(s,e,{type:"local",prefix:i}),r&&f.cookie.set(n,this.data.token))}clear(){const{storageKey:e,storagePrefix:s,session:i,authKey:r}=this.options;this.data=null,f.storage.remove(e,{type:"local",prefix:s}),i&&f.cookie.remove(r)}logout(){this.clear(),this.toLogin()}getData(){return this.data?this.data:(this.loadData(),this.data)}getToken(){return this.data||this.loadData(),this.data?.token}can(e){const{appName:s}=this.options,{permissions:i={}}=this.data||{};if(typeof e=="function")return e(i);const r=f.toArray(e);return Array.isArray(i)?r.every(n=>i.includes(n)||i.includes(s+"."+n)):r.every(n=>i[n]||i[s+"."+n])}some(e){const{appName:s}=this.options,{permissions:i={}}=this.data||{},r=f.toArray(e);return Array.isArray(i)?r.some(n=>i.includes(n)||i.includes(s+"."+n)):r.some(n=>i[n]||i[s+"."+n])}install(e){e.config.globalProperties.$access=this,e.provide(Nt,this)}isAuthPath(e){const{auth:s,isAuth:i}=this.options;if(i)return i(e);if(e.path&&typeof s=="string"){const r=s.split("#")[1]||s;return e.path===r}return!1}toLogin(){const{auth:e,redirectParam:s}=this.options;if(!e)return;const i=s?`?${s}=${encodeURIComponent(location.href)}`:"";typeof e=="function"?e(i):location.href=s?`${e}${i}`:e}setData(e){const{privateKey:s}=this.options;if(Array.isArray(e)&&s){const i=e.map(r=>f.unRSA(r,s));try{this.data=JSON.parse(i.join(""))}catch(r){console.warn(r)}return}if(typeof e=="string")try{const i=s?f.unRSA(e,s):e;i?this.data=JSON.parse(i):console.warn("RSA解密失败或登录信息缺失")}catch(i){console.warn(i)}else this.data=e}loadData(){const{storageKey:e,storagePrefix:s}=this.options,i=f.storage.get(e,{type:"local",prefix:s});this.setData(i||null)}isLogined(){const{session:e,authKey:s}=this.options;return e&&s?!!f.cookie.get(s):!!this.getToken()}hasRoutePermission(e){if(e.name===be){const s=e.params.id;return s&&this.can(s)}return e.meta.__vtj__?this.can(e.meta.__vtj__):e.meta.permission?this.can(e.meta.permission):!0}setGuard(e){e.beforeEach((s,i,r)=>this.guard(s,r))}async guard(e,s){if(this.isWhiteList(e)||this.isAuthPath(e))return s();if(this.isLogined()){if(this.hasRoutePermission(e))return s();{const{noPermissionMessage:i="无权限访问",unauthorized:r=!1}=this.options;return await this.showTip(i),f.isFunction(r)?(r(),s(!1)):f.isString(r)?s(r):s(!1)}}s(!1),await f.delay(0),this.toLogin()}isWhiteList(e){const{whiteList:s}=this.options;return s?Array.isArray(s)?s.some(i=>e.fullPath.startsWith(i)):s(e):!1}isUnauthorized(e){const{unauthorizedCode:s=401,statusKey:i="code"}=this.options;return e.status===s||e.data?.[i]===s}async showUnauthorizedAlert(e){const{unauthorizedMessage:s="登录已失效"}=this.options;this.isUnauthorized(e)&&await this.showTip(s)&&this.toLogin()}async showTip(e){const{alert:s}=this.options;return this.isTipShowing?!1:s?(this.isTipShowing=!0,await f.delay(150),await s(e,{title:"提示",type:"warning"})?.catch(()=>!0)?.finally(()=>{this.isTipShowing=!1})):(globalThis.alert?.(e)??console.warn(e),!0)}setRequest(e){e.useRequest(s=>(this.data?.token&&(s.headers[this.options.authKey]=this.data?.token),s)),e.useResponse(async s=>(this.interceptResponse&&await this.showUnauthorizedAlert(s),s),async s=>{if(!this.interceptResponse)return Promise.reject(s);const i=s.response||s||{};return await this.showUnauthorizedAlert(i),Promise.reject(s)})}}function qs(){return L.inject(Nt,null)}function nr(t={}){const{notify:e,loading:s,settings:i={},Startup:r,access:n,useTitle:a,alert:u}=t;let c=null;return{request:f.createRequest({adapter:t.axiosAdapter,settings:{type:"form",validSuccess:!1,originResponse:!0,loading:!0,validate:h=>h.data?.code===0||!!h.data?.success,failMessage:!0,showError:h=>{e&&e(h||"未知错误")},showLoading:()=>{c&&c.close(),s&&(c=s())},hideLoading:()=>{c&&(c.close(),c=null)},...i}}),jsonp:f.jsonp,notify:e,loading:s,useTitle:a,alert:u,startupComponent:r,access:n?new Xe({alert:u,...n}):void 0}}function ar(t={}){return new Xe(t)}function Ws(t,e){const{jsonp:s,request:i}=e;if(t.method==="jsonp")return(r={})=>s(t.url,{...t.jsonpOptions,query:r});{const r=t.headers?Se(t.headers,{},!0):void 0,n={url:t.url,method:t.method,settings:{...t.settings,headers:r}};return(a,u)=>(delete n.data,i.send(f.merge(n,u||{},{data:a})))}}function Ks(t,e){const{metaQuery:s}=e;if(!s)return;const{code:i,queryCode:r}=t;return(n,a)=>{if(!s){console.warn("adapter.metaQuery is not defined!");return}return s(i,r,n,a)}}function zs(t=[],e=[],s){const i={};for(const r of t){const n=Ws(r,s);i[r.id]=n,i[r.name]=n}for(const r of e)i[r.id]=Ks(r,s);return i}async function Js(t=[],e=globalThis){const s=ye(e);s&&(Ot(e),t.forEach(i=>Ys(s,i)))}function Qs(t,e=globalThis){const s=F(t.mockTemplate)&&t.mockTemplate.value?G(t.mockTemplate,{},!0):void 0,i=ye(e);return async(...r)=>{let n={};if(s)try{n=await s.apply(s,r)}catch(a){f.logger.warn("模拟数据模版异常",a)}return i?.mock(n)}}function Ys(t,e){if(!e.mock)return;const{url:s,mockTemplate:i,method:r="get",settings:n={}}=e;if(s&&i)try{const a=f.isUrl(s)?new URL(s).pathname:s,u=f.pathToRegexp(`(.*)${a}(.*)`),c=f.pathToRegexpMatch(a,{decode:decodeURIComponent}),l=Se(i,{},!0);t.mock(u,r.toLowerCase(),h=>{const p=f.url.parse(h.url)||{},m=n.type||"form";let d=h.body instanceof FormData?f.formDataToJson(h.body):h.body;if(typeof d=="string")if(m==="json")try{d=JSON.parse(d)}catch(v){console.warn("[Mock.mock]",v)}else d=f.url.parse(d);const g=f.isUrl(h.url)?new URL(h.url).pathname:h.url.split("?")[0],x=c(g)?.params;Object.assign(h,{data:d,params:x,query:p});try{return t.mock(l(h))}catch(v){return console.warn("[mockApi]",u,h,v),null}})}catch(a){console.warn("mockApi",a)}}function Ot(t=globalThis){const e=ye(t);e&&(e._mocked={})}class Xs{__id=null;__mode;__instance=null;__contextRefs={};__refs={};__refCaches={};context={};state={};props={};$props={};$state={};$refs={};$el=null;$emit=null;$nextTick=null;$parent=null;$root=null;$attrs=null;$slots=null;$watch=null;$options=null;$forceUpdate=null;$components={};$libs={};$apis={};$provider=null;$uni=null;$getApp=null;__transform={};constructor(e){const{mode:s,dsl:i,attrs:r}=e;this.__mode=s,i&&(this.__id=i.id||null,this.__transform=i.transform||{}),r&&Object.assign(this,r)}setup(e,s=xe){const i=s.getCurrentInstance();if(!i)return;this.__refs={},this.__refCaches={},this.$refs={},this.context={},this.__contextRefs={},this.__instance=i.proxy;const{state:r}=this,n=i.appContext.config.globalProperties;Object.assign(this,n,e||{}),this.$uni=this.$libs.UniH5?.uni??null,this.$getApp=this.$libs.UniH5?.getApp??null,this.$state=this.state=r,this.__proxy(),s.onMounted(()=>{this.__proxy()}),s.onUnmounted(()=>{this.__cleanup()}),s.onBeforeUpdate(()=>{this.__reset()})}__proxy(){if(!this.__instance)return;const e=this.__instance;ct.forEach(s=>{this[s]=e[s]||e._?.[s.replace("$","")]||null})}__cleanup(){ct.forEach(e=>{this[e]=null}),this.__reset()}__reset(){this.__refs={},this.__refCaches={},this.$refs={},this.__contextRefs={},this.context={}}__parseFunction(e){if(e)if(this.__mode===A.Runtime){const{id:s,type:i}=e,r=s?this.__transform[s]??e.value:e.value;return G({type:i,value:r},this)}else return G(e,this)}__parseExpression(e){if(e)if(this.__mode===A.Runtime){const{id:s,type:i}=e,r=s?this.__transform[s]??e.value:e.value;return Se({type:i,value:r},this)}else return Se(e,this)}__ref(e=null,s){if(this.__mode===A.VNode)return;e&&e!==this.__id&&(this.__contextRefs[e]=this);let i=e?this.__refCaches[e]:null;return i||(i=async r=>{await f.delay(0);let n=r?.$vtjEl||r?.$el||r?._?.vnode?.el||r;if(!n){typeof s=="string"&&(delete this.$refs[s],this[s]&&xe.isRef(this[s])&&(this[s].value=null),e&&delete this.__refs[e]);return}return n.nodeType===3&&n.nextSibling&&(n=n.nextSibling),n.__vtj__=e,A.Design===this.__mode&&(n.__context__=this,n.draggable=!0),e&&(this.__refs[e]=this.__getRefEl(this.__refs,e,r)),typeof s=="function"?s(r):s&&(this.$refs[s]=this.__getRefEl(this.$refs,s,r),this[s]&&xe.isRef(this[s])&&(this[s].value=this.$refs[s])),r},e&&(this.__refCaches[e]=i),i)}__getRefEl(e,s,i){const r=e[s];if(r&&i!==r){const n=new Set([].concat(r,i));return Array.from(n)}else return i}__clone(e={}){const s={...this.context,...e},i={...s,context:s};return i.context.__proto__=this.context,i.__proto__=this,i}}function $e(t){const{Vue:e=xe,UniApp:s={},mode:i=A.Runtime,components:r={},libs:n={},apis:a={},loader:u}=t,c=e.computed(()=>t.dsl),l={$components:r,$libs:n,$apis:a},h=new Xs({mode:i,dsl:c.value,attrs:l}),p=e.defineComponent({name:c.value.name,__scopeId:c.value.id?`data-v-${c.value.id}`:void 0,props:{...ur(c.value.props??[],h)},async setup(m={}){h.$props=h.props=m,c.value.id&&qe(t.window||globalThis,c.value.id,c.value.css||"",!0);const d=c.value.apiMode==="composition";h.$state=h.state=cr(e,c.value.state??{},h);const g=d?dr(e,c.value.refs??{},h):{},x=d?mr(e,c.value.reactives??{},h):{},v=lr(e,c.value.computed??{},h),k=hr(c.value.methods??{},h),T=pr(e,c.value.inject,h),O=Zs(c.value.dataSources||{},h);let w={};d&&(w=gr(c.value.composables??[],h));const W={...m,...g,...x,...T,...v,...k,...O,...w};if(h.setup(W,e),fr(e,c.value.watch??[],h),d){if(await vr(e,c.value.lifeCycles??{},h,s),c.value.setup){const pe=h.__parseFunction(c.value.setup);if(f.isFunction(pe))try{await pe()}catch(we){console.warn("[VTJ] Composition setup 执行失败",we)}}xr(e,c.value.provide??{},h)}return{vtj:h,state:h.state,$state:h.$state,...m,...g,...x,...v,...k}},emits:or(c.value.emits),expose:["vtj",...c.value.expose||[]],render(){if(!c.value.nodes)return null;const m=c.value.nodes||[];if(m.length===1)return le(m[0],h,e,u,m);{const d=m.map(g=>le(g,h,e,u,m)).flat();return e.createVNode("div",{},d)}},...c.value.apiMode!=="composition"?br(c.value.lifeCycles??{},h):{}});return{renderer:e.markRaw(p),context:h}}function or(t=[]){return t.map(e=>f.isString(e)?e:e.name)}function ur(t=[],e){const s=i=>i?(Array.isArray(i)?i:[i]).map(n=>Yt[n]):void 0;return t.map(i=>f.isString(i)?{name:i}:{name:i.name,type:i.type,required:i.required,default:R(i.default)?e.__parseExpression(i.default):i.default}).reduce((i,r)=>(i[r.name]={type:s(r.type),required:r.required,default:r.default},i),{})}function cr(t,e,s){return t.reactive(Object.keys(e||{}).reduce((i,r)=>{let n=e[r];return R(n)?n=s.__parseExpression(n):F(n)&&(n=s.__parseFunction(n)),i[r]=n,i},{}))}function lr(t,e,s){return Object.entries(e??{}).reduce((i,[r,n])=>(F(n)?i[r]=t.computed(s.__parseFunction(n)):i[r]=t.computed(s.__parseExpression(n)),i),{})}function hr(t,e){return Object.entries(t??{}).reduce((s,[i,r])=>(s[i]=e.__parseFunction(r),s),{})}function pr(t,e=[],s){return e.reduce((i,r)=>{const{name:n,from:a}=r||{},u=R(a)?s.__parseExpression(a)||n:a??n,c=R(r.default)?s.__parseExpression(r.default):r.default??null;return i[n]=t.inject(u,c),i},{})}function Zs(t,e){return Object.keys(t).reduce((s,i)=>{const r=t[i];if(r.type==="mock")s[i]=Qs(r);else if(r.ref){const n=e.$apis[r.ref],a=F(r.transform)?r.transform.value?e.__parseFunction(r.transform):void 0:r.transform;s[i]=async(...u)=>{const c=await n.apply(e,u);return a?a(c):c}}return s},{})}function fr(t,e=[],s){e.forEach(i=>{t.watch(s.__parseExpression(i.source),s.__parseFunction(i.handler),{deep:i.deep,immediate:i.immediate,flush:i.flush})})}function dr(t,e,s){return Object.entries(e).reduce((i,[r,n])=>{const a=R(n)?s.__parseExpression(n):n;return i[r]=t.ref(a),i},{})}function mr(t,e,s){return Object.entries(e).reduce((i,[r,n])=>{const a=R(n)?s.__parseExpression(n):n;return i[r]=t.reactive(a??{}),i},{})}function gr(t,e){return t.reduce((s,i)=>{try{let r;if(R(i.composable)?r=e.__parseExpression(i.composable):f.isString(i.composable)&&(r=e.$libs[i.composable]),f.isFunction(r)){const n=(i.args||[]).map(u=>R(u)?e.__parseExpression(u):u),a=r(...n);if(i.destructure&&i.destructure.length>0)for(const u of i.destructure)s[u]=a?.[u];else s[i.name]=a}}catch(r){e.__mode===A.Design&&(console.warn("[VTJ] composable 执行失败,已降级处理",r),s[i.name]={})}return s},{})}function xr(t,e,s){Object.entries(e).forEach(([i,r])=>{let n=r;R(r)?n=s.__parseExpression(r):F(r)&&(n=s.__parseFunction(r)),t.provide(i,n)})}async function vr(t,e,s,i={}){const r={beforeMount:"onBeforeMount",mounted:"onMounted",beforeUpdate:"onBeforeUpdate",updated:"onUpdated",beforeUnmount:"onBeforeUnmount",unmounted:"onUnmounted",errorCaptured:"onErrorCaptured",renderTracked:"onRenderTracked",renderTriggered:"onRenderTriggered",activated:"onActivated",deactivated:"onDeactivated"};for(const[n,a]of Object.entries(e)){if(n==="created"||n==="beforeCreate"){const l=s.__parseFunction(a);if(f.isFunction(l))try{await l()}catch(h){console.warn(`[VTJ] Composition 生命周期 "${n}" 执行失败`,h),Ue(h)}continue}const u=r[n]||n,c=t[u]||i[u];if(c&&f.isFunction(c)){const l=s.__parseFunction(a);f.isFunction(l)&&c(async()=>{try{await f.delay(0),await l()}catch(h){console.warn(`[VTJ] Composition 生命周期 "${n}" 执行失败`,h),Ue(h)}})}else console.warn(`[VTJ] 无效的 Composition 生命周期钩子 "${n}"`)}}function br(t,e){return Object.entries(t??{}).reduce((s,[i,r])=>{const n=e.__parseFunction(r);return s[i]=async()=>{f.isFunction(n)&&(await f.delay(0),await n())},s},{})}class yr{__props={};__events={};__nodes={};constructor(){}setProps(e,s){this.__props[e]=s}getProps(e){return this.__props[e]}loadProps(e,s){const i=e?this.getProps(e):null;return i||(e&&this.setProps(e,s),s)}setEvents(e,s){}getEvents(e){return this.__events[e]}loadEvents(e,s){const i=e?this.getEvents(e):null;return i||(e&&this.setEvents(e,s),s)}setNode(e,s){this.__nodes[e]=s}getNode(e){return this.__nodes[e]}loadNode(e,s){const i=e?this.getNode(e):null;return i||(e&&this.setNode(e,s),s)}isEqual(e,s){return f.isEqual(e,s)}isNodeEqual(e,s){if(e===s)return!0;if(!e||!s)return!1;const i=u=>!u||typeof u!="object"?[]:Object.keys(u).filter(c=>f.isFunction(u[c])),r=u=>{if(!u||typeof u!="object")return u;const c={};for(const l in u)if(Object.prototype.hasOwnProperty.call(u,l)){const h=u[l];f.isFunction(h)||(c[l]=h)}return c},n=i(e).sort(),a=i(s).sort();return f.isEqual(n,a)?f.isEqual(r(e),r(s)):!1}clear(){this.__props={},this.__events={},this.__nodes={}}}const ge=new yr,ei=new f.Queue;let at=[],ue={},ke={};const ti=(t,e)=>e;async function Vt(t,e=globalThis){const{urls:s=[],library:i}=t,r=s.filter(u=>Ve(u));if(r.length===0||!i)return null;const n=s.filter(u=>Oe(u));return n.length&&vt(n,e),await bt(r,i,e).catch(u=>(console.warn("loadScriptUrl error",r,i,u),null))}function Ge(t){const{getDsl:e,getDslByUrl:s,options:i}=t;return i.window&&(at.forEach(r=>{delete i.window[r]}),at=[]),(r,n,a,u=xe)=>{if(!a||typeof a=="string")return n;let c="";if(a.type==="Schema"&&a.id)return c=a.id+"_"+r,ke[c]||(ke[c]=u.defineAsyncComponent(async()=>{const l=ue[a.id]||await ei.add(a.id,()=>e(a.id));return l&&(l.name=n,ue[a.id]=l),l?$e({Vue:u,mode:A.Runtime,...i,dsl:f.cloneDeep(l),loader:Ge(t)}).renderer:null}));if(a.type==="UrlSchema"&&a.url)return c=a.url+"_"+r,ke[c]||(ke[c]=u.defineAsyncComponent(async()=>{const l=ue[a.url]||await s(a.url);return l&&(l.name=n,ue[a.url]=l),l?$e({...i,Vue:u,dsl:f.cloneDeep(l),mode:A.Runtime,loader:Ge(t)}).renderer:null}));if(a.type==="Plugin"){let l=a.library?ue[a.library]:null;return l||(a.library&&at.push(a.library),l=ue[a.library||Symbol()]=u.defineAsyncComponent(async()=>{const h=await Vt(a,i.window);return h||(console.warn("getPlugin result is null",a),null)}),l)}return n}}function _r(){ue={},ke={},ei.clearAllCache(),ge.clear()}function le(t,e,s=xe,i=ti,r=[],n=!1,a=0){if(!t||!t.name||t.invisible)return null;const u=s.getCurrentInstance()?.appContext,{id:c=null,directives:l=[]}=t,{vIf:h,vElseIf:p,vElse:m,vFor:d,vShow:g,vModels:x,vBind:v,vHtml:k,others:T}=si(l);if(!n&&(p||m))return null;if(h&&!Cr(h,e))return Pr(t,e,s,i,r);const O=(w,W=0)=>{const pe=w.$components,we=(()=>{if(t.name==="component")return wr(w,t.props?.is);if(t.name==="slot")return t.name;const K=i(`${t.id}_${W}`,t.name,t.from,s);return f.isString(K)?cs(K)||ls(K)?K:pe[K]??u?.app?.component(K)??K:K})(),te=Er(c,t.props??{},w),oi=Ar(s,t.id,t.events??{},w);if(t.name==="slot")return Tr(s,t,te,w,i);v&&Object.assign(te,w.__parseExpression(v.value)),g&&(te.style=Object.assign(te.style??{},Nr(g,w))),k&&Object.assign(te,Or(k,w)),x.forEach(K=>{gt.includes(t.name)?Object.assign(te,Vr(K,w)):Object.assign(te,Fr(s,K,w))});const ui=Lr(s,t.children??[],w,i,t),Mt=w?.__id?`data-v-${w.__id}`:void 0,ci=Mt?{[Mt]:""}:{},li=w.__mode===A.Design?{"data-vtj":c}:{},je=`${c}_${W}`,tt={key:je,...ci,...li,...te};ge.isNodeEqual(tt,ge.getNode(je))||ge.setNode(je,tt);let st=s.createVNode(we,{...ge.getNode(je)||tt,...oi},ui);const Dt=u?Sr(u,T,w):[];return Dt.length&&(st=s.withDirectives(st,Dt)),st};return d?Dr(d,O,e):O(e,a)}function Sr(t,e,s){const i=t.app;return e.map(r=>{const n=typeof r.name=="string"?i.directive(r.name):s.__parseExpression(r.name);if(!n)return null;const a=[n];return r.value&&a.push(s.__parseExpression(r.value)),r.arg&&a.push(r.arg),r.modifiers&&a.push(r.modifiers),a}).filter(r=>!!r)}function si(t=[]){const e=t.find(h=>f.camelCase(h.name)==="vIf"),s=t.find(h=>f.camelCase(h.name)==="vElseIf"),i=t.find(h=>f.camelCase(h.name)==="vElse"),r=t.find(h=>f.camelCase(h.name)==="vFor"),n=t.find(h=>f.camelCase(h.name)==="vShow"),a=t.find(h=>f.camelCase(h.name)==="vBind"),u=t.find(h=>f.camelCase(h.name)==="vHtml"),c=t.filter(h=>f.camelCase(h.name)==="vModel"),l=t.filter(h=>!Qt.includes(f.camelCase(h.name)));return{vIf:e,vElseIf:s,vElse:i,vFor:r,vShow:n,vModels:c,vBind:a,others:l,vHtml:u}}function Cr(t,e){return!!e.__parseExpression(t.value)}function wr(t,e){return e?R(e)?t.__parseExpression(e):e:"div"}function Er(t,e,s){const i=dt(e,s);return i.ref=s.__ref(t,i.ref),i}function dt(t,e){return R(t)?e.__parseExpression(t):F(t)?e.__parseFunction(t):Array.isArray(t)?t.map(s=>dt(s,e)):typeof t=="object"?Object.keys(t||{}).reduce((s,i)=>{let r=t[i];return s[i]=dt(r,e),s},{}):t}function kr(t,e){return s=>{s?.key?.toLowerCase()===e.toLowerCase()&&t(s)}}function Ir(t){return hs(t.value)?t:ps(t.value)?{type:"JSFunction",value:`(...args) => (() => {
|
|
21
21
|
return (($event) => {
|
|
22
22
|
${t.value}
|
|
23
23
|
}).apply(this, args);
|
package/dist/index.mjs
CHANGED
|
@@ -7,10 +7,10 @@ import { useRoute as os } from "vue-router";
|
|
|
7
7
|
* Copyright (c) 2026, VTJ.PRO All rights reserved.
|
|
8
8
|
* @name @vtj/renderer
|
|
9
9
|
* @author CHC chenhuachun1549@dingtalk.com
|
|
10
|
-
* @version 0.18.
|
|
10
|
+
* @version 0.18.3
|
|
11
11
|
* @license <a href="https://vtj.pro/license.html">MIT License</a>
|
|
12
12
|
*/
|
|
13
|
-
const Ce = "0.18.
|
|
13
|
+
const Ce = "0.18.3";
|
|
14
14
|
var P = /* @__PURE__ */ ((t) => (t.Runtime = "Runtime", t.Design = "Design", t.Raw = "Raw", t.VNode = "VNode", t))(P || {});
|
|
15
15
|
const zt = [
|
|
16
16
|
"$el",
|
|
@@ -5119,13 +5119,12 @@ function be(t, e, s = xe, i = Br, r = [], n = !1, a = 0) {
|
|
|
5119
5119
|
key: Fe,
|
|
5120
5120
|
...Zs,
|
|
5121
5121
|
...ei,
|
|
5122
|
-
...se
|
|
5123
|
-
...Xs
|
|
5122
|
+
...se
|
|
5124
5123
|
};
|
|
5125
5124
|
_e.isNodeEqual(Ye, _e.getNode(Fe)) || _e.setNode(Fe, Ye);
|
|
5126
5125
|
let Ze = s.createVNode(
|
|
5127
5126
|
ye,
|
|
5128
|
-
_e.getNode(Fe) || Ye
|
|
5127
|
+
{ ..._e.getNode(Fe) || Ye, ...Xs },
|
|
5129
5128
|
Ys
|
|
5130
5129
|
);
|
|
5131
5130
|
const Ht = u ? Hr(u, A, C) : [];
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vtj/renderer",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.18.
|
|
4
|
+
"version": "0.18.3",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"低代码引擎",
|
|
@@ -22,15 +22,15 @@
|
|
|
22
22
|
"license": "MIT",
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"eval5": "^1.4.8",
|
|
25
|
-
"@vtj/core": "~0.18.
|
|
26
|
-
"@vtj/utils": "~0.18.
|
|
25
|
+
"@vtj/core": "~0.18.3",
|
|
26
|
+
"@vtj/utils": "~0.18.3"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"vue": "~3.5.37",
|
|
30
30
|
"vue-router": "~4.6.0",
|
|
31
31
|
"@vtj/cli": "~0.13.0",
|
|
32
|
-
"@vtj/ui": "~0.18.
|
|
33
|
-
"@vtj/icons": "~0.18.
|
|
32
|
+
"@vtj/ui": "~0.18.3",
|
|
33
|
+
"@vtj/icons": "~0.18.3"
|
|
34
34
|
},
|
|
35
35
|
"exports": {
|
|
36
36
|
".": {
|
package/types/version.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright (c) 2026, VTJ.PRO All rights reserved.
|
|
3
3
|
* @name @vtj/renderer
|
|
4
4
|
* @author CHC chenhuachun1549@dingtalk.com
|
|
5
|
-
* @version 0.18.
|
|
5
|
+
* @version 0.18.2
|
|
6
6
|
* @license <a href="https://vtj.pro/license.html">MIT License</a>
|
|
7
7
|
*/
|
|
8
|
-
export declare const version = "0.18.
|
|
8
|
+
export declare const version = "0.18.2";
|