2022-08-18 19:47:49 +08:00

11 lines
80 KiB
JavaScript

var Q=Object.defineProperty;var Z=(e,t,n)=>t in e?Q(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var I=(e,t,n)=>(Z(e,typeof t!="symbol"?t+"":t,n),n);function __vite_legacy_guard(){import("data:text/javascript,")}const p=function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))i(r);new MutationObserver(r=>{for(const o of r)if(o.type==="childList")for(const s of o.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&i(s)}).observe(document,{childList:!0,subtree:!0});function n(r){const o={};return r.integrity&&(o.integrity=r.integrity),r.referrerpolicy&&(o.referrerPolicy=r.referrerpolicy),r.crossorigin==="use-credentials"?o.credentials="include":r.crossorigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function i(r){if(r.ep)return;r.ep=!0;const o=n(r);fetch(r.href,o)}};p();var commonjsGlobal=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function getDefaultExportFromCjs(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var events={exports:{}},R=typeof Reflect=="object"?Reflect:null,ReflectApply=R&&typeof R.apply=="function"?R.apply:function(t,n,i){return Function.prototype.apply.call(t,n,i)},ReflectOwnKeys;R&&typeof R.ownKeys=="function"?ReflectOwnKeys=R.ownKeys:Object.getOwnPropertySymbols?ReflectOwnKeys=function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:ReflectOwnKeys=function(t){return Object.getOwnPropertyNames(t)};function ProcessEmitWarning(e){console&&console.warn&&console.warn(e)}var NumberIsNaN=Number.isNaN||function(t){return t!==t};function EventEmitter(){EventEmitter.init.call(this)}events.exports=EventEmitter;events.exports.once=once;EventEmitter.EventEmitter=EventEmitter;EventEmitter.prototype._events=void 0;EventEmitter.prototype._eventsCount=0;EventEmitter.prototype._maxListeners=void 0;var defaultMaxListeners=10;function checkListener(e){if(typeof e!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}Object.defineProperty(EventEmitter,"defaultMaxListeners",{enumerable:!0,get:function(){return defaultMaxListeners},set:function(e){if(typeof e!="number"||e<0||NumberIsNaN(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");defaultMaxListeners=e}});EventEmitter.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};EventEmitter.prototype.setMaxListeners=function(t){if(typeof t!="number"||t<0||NumberIsNaN(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this};function _getMaxListeners(e){return e._maxListeners===void 0?EventEmitter.defaultMaxListeners:e._maxListeners}EventEmitter.prototype.getMaxListeners=function(){return _getMaxListeners(this)};EventEmitter.prototype.emit=function(t){for(var n=[],i=1;i<arguments.length;i++)n.push(arguments[i]);var r=t==="error",o=this._events;if(o!==void 0)r=r&&o.error===void 0;else if(!r)return!1;if(r){var s;if(n.length>0&&(s=n[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var u=o[t];if(u===void 0)return!1;if(typeof u=="function")ReflectApply(u,this,n);else for(var c=u.length,l=arrayClone(u,c),i=0;i<c;++i)ReflectApply(l[i],this,n);return!0};function _addListener(e,t,n,i){var r,o,s;if(checkListener(n),o=e._events,o===void 0?(o=e._events=Object.create(null),e._eventsCount=0):(o.newListener!==void 0&&(e.emit("newListener",t,n.listener?n.listener:n),o=e._events),s=o[t]),s===void 0)s=o[t]=n,++e._eventsCount;else if(typeof s=="function"?s=o[t]=i?[n,s]:[s,n]:i?s.unshift(n):s.push(n),r=_getMaxListeners(e),r>0&&s.length>r&&!s.warned){s.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=e,a.type=t,a.count=s.length,ProcessEmitWarning(a)}return e}EventEmitter.prototype.addListener=function(t,n){return _addListener(this,t,n,!1)};EventEmitter.prototype.on=EventEmitter.prototype.addListener;EventEmitter.prototype.prependListener=function(t,n){return _addListener(this,t,n,!0)};function onceWrapper(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function _onceWrap(e,t,n){var i={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},r=onceWrapper.bind(i);return r.listener=n,i.wrapFn=r,r}EventEmitter.prototype.once=function(t,n){return checkListener(n),this.on(t,_onceWrap(this,t,n)),this};EventEmitter.prototype.prependOnceListener=function(t,n){return checkListener(n),this.prependListener(t,_onceWrap(this,t,n)),this};EventEmitter.prototype.removeListener=function(t,n){var i,r,o,s,a;if(checkListener(n),r=this._events,r===void 0)return this;if(i=r[t],i===void 0)return this;if(i===n||i.listener===n)--this._eventsCount===0?this._events=Object.create(null):(delete r[t],r.removeListener&&this.emit("removeListener",t,i.listener||n));else if(typeof i!="function"){for(o=-1,s=i.length-1;s>=0;s--)if(i[s]===n||i[s].listener===n){a=i[s].listener,o=s;break}if(o<0)return this;o===0?i.shift():spliceOne(i,o),i.length===1&&(r[t]=i[0]),r.removeListener!==void 0&&this.emit("removeListener",t,a||n)}return this};EventEmitter.prototype.off=EventEmitter.prototype.removeListener;EventEmitter.prototype.removeAllListeners=function(t){var n,i,r;if(i=this._events,i===void 0)return this;if(i.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):i[t]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete i[t]),this;if(arguments.length===0){var o=Object.keys(i),s;for(r=0;r<o.length;++r)s=o[r],s!=="removeListener"&&this.removeAllListeners(s);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(n=i[t],typeof n=="function")this.removeListener(t,n);else if(n!==void 0)for(r=n.length-1;r>=0;r--)this.removeListener(t,n[r]);return this};function _listeners(e,t,n){var i=e._events;if(i===void 0)return[];var r=i[t];return r===void 0?[]:typeof r=="function"?n?[r.listener||r]:[r]:n?unwrapListeners(r):arrayClone(r,r.length)}EventEmitter.prototype.listeners=function(t){return _listeners(this,t,!0)};EventEmitter.prototype.rawListeners=function(t){return _listeners(this,t,!1)};EventEmitter.listenerCount=function(e,t){return typeof e.listenerCount=="function"?e.listenerCount(t):listenerCount.call(e,t)};EventEmitter.prototype.listenerCount=listenerCount;function listenerCount(e){var t=this._events;if(t!==void 0){var n=t[e];if(typeof n=="function")return 1;if(n!==void 0)return n.length}return 0}EventEmitter.prototype.eventNames=function(){return this._eventsCount>0?ReflectOwnKeys(this._events):[]};function arrayClone(e,t){for(var n=new Array(t),i=0;i<t;++i)n[i]=e[i];return n}function spliceOne(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}function unwrapListeners(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}function once(e,t){return new Promise(function(n,i){function r(s){e.removeListener(t,o),i(s)}function o(){typeof e.removeListener=="function"&&e.removeListener("error",r),n([].slice.call(arguments))}eventTargetAgnosticAddListener(e,t,o,{once:!0}),t!=="error"&&addErrorHandlerIfEventEmitter(e,r,{once:!0})})}function addErrorHandlerIfEventEmitter(e,t,n){typeof e.on=="function"&&eventTargetAgnosticAddListener(e,"error",t,n)}function eventTargetAgnosticAddListener(e,t,n,i){if(typeof e.on=="function")i.once?e.once(t,n):e.on(t,n);else if(typeof e.addEventListener=="function")e.addEventListener(t,function r(o){i.once&&e.removeEventListener(t,r),n(o)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e)}class Env{constructor(t=globalThis.navigator.userAgent,n={}){I(this,"isIos",!1);I(this,"isIphone",!1);I(this,"isIpad",!1);I(this,"isAndroid",!1);I(this,"isAndroidPad",!1);I(this,"isMac",!1);I(this,"isWin",!1);I(this,"isMqq",!1);I(this,"isWechat",!1);I(this,"isWeb",!1);this.isIphone=t.indexOf("iPhone")>=0,this.isIpad=/(iPad).*OS\s([\d_]+)/.test(t),this.isIos=this.isIphone||this.isIpad,this.isAndroid=t.indexOf("Android")>=0,this.isAndroidPad=this.isAndroid&&t.indexOf("Mobile")<0,this.isMac=t.indexOf("Macintosh")>=0,this.isWin=t.indexOf("Windows")>=0,this.isMqq=/QQ\/([\d.]+)/.test(t),this.isWechat=t.indexOf("MicroMessenger")>=0&&t.indexOf("wxwork")<0,this.isWeb=!this.isIos&&!this.isAndroid&&!/(WebOS|BlackBerry)/.test(t),Object.entries(n).forEach(([i,r])=>{this[i]=r})}}const COMMON_EVENT_PREFIX="magic:common:events:",COMMON_METHOD_PREFIX="magic:common:actions:",CommonMethod={SHOW:"show",HIDE:"hide",SCROLL_TO_VIEW:"scrollIntoView",SCROLL_TO_TOP:"scrollToTop"},DEFAULT_EVENTS=[{label:"\u70B9\u51FB",value:`${COMMON_EVENT_PREFIX}click`}],getCommonEventName=(e,t)=>{const n=`${e}:${t}`;return e.startsWith(COMMON_EVENT_PREFIX)?n:`${COMMON_EVENT_PREFIX}${n}`},isCommonMethod=e=>e.startsWith(COMMON_METHOD_PREFIX),getDirectComponent=(e,t)=>{var i;if(!e)return!1;if(!e.id)return getDirectComponent(e.parentElement,t);const n=(i=t.page)==null?void 0:i.getNode(e.id);return n||!1},commonClickEventHandler=(e,t,n)=>{const i=getDirectComponent(n.target,e);if(i){const{instance:r,data:o}=i;e.emit(getCommonEventName(t,o.id),r)}},bindCommonEventListener=e=>{window.document.body.addEventListener("click",t=>{commonClickEventHandler(e,"click",t)}),window.document.body.addEventListener("click",t=>{commonClickEventHandler(e,"click:capture",t)},!0)},triggerCommonMethod=(e,t)=>{const{instance:n}=t;switch(e.replace(COMMON_METHOD_PREFIX,"")){case CommonMethod.SHOW:n.show();break;case CommonMethod.HIDE:n.hide();break;case CommonMethod.SCROLL_TO_VIEW:n.$el.scrollIntoView({behavior:"smooth"});break;case CommonMethod.SCROLL_TO_TOP:window.scrollTo({top:0,behavior:"smooth"});break}};class Store{constructor(){I(this,"data",{})}set(t,n){this.data[t]=n}get(t){return this.data[t]}}class Node extends events.exports.EventEmitter{constructor(n){super();I(this,"data");I(this,"style");I(this,"events");I(this,"instance");I(this,"page");I(this,"parent");I(this,"app");I(this,"store",new Store);this.page=n.page,this.parent=n.parent,this.app=n.app;const{events:i}=n.config;this.data=n.config,this.events=i,this.listenLifeSafe(),this.once("destroy",()=>{this.instance=null,typeof this.data.destroy=="function"&&this.data.destroy(this),this.listenLifeSafe()})}listenLifeSafe(){this.once("created",n=>{this.instance=n,typeof this.data.created=="function"&&this.data.created(this)}),this.once("mounted",n=>{this.instance=n;const i=this.app.eventQueueMap[n.config.id]||[];for(let r=i.shift();r;r=i.shift())this.app.eventHandler(r.eventConfig,r.fromCpt,r.args);typeof this.data.mounted=="function"&&this.data.mounted(this)})}}class Page extends Node{constructor(n){super(n);I(this,"nodes",new Map);this.setNode(n.config.id,this),this.initNode(n.config,this)}initNode(n,i){var o;const r=new Node({config:n,parent:i,page:this,app:this.app});this.setNode(n.id,r),(o=n.items)==null||o.forEach(s=>{this.initNode(s,r)})}getNode(n){return this.nodes.get(n)}setNode(n,i){this.nodes.set(n,i)}deleteNode(n){this.nodes.delete(n)}}const style2Obj=e=>{if(typeof e!="string")return e;const t={};return e.split(";").forEach(n=>{if(!n)return;const i=n.split(":");let r=i.shift(),o=i.join(":");!r||(r=r.replace(/^\s*/,"").replace(/\s*$/,""),o=o.replace(/^\s*/,"").replace(/\s*$/,""),r=r.split("-").map((s,a)=>a>0?`${s[0].toUpperCase()}${s.substr(1)}`:s).join(""),t[r]=o)}),t},fillBackgroundImage=e=>e&&!/^url/.test(e)&&!/^linear-gradient/.test(e)?`url(${e})`:e,isNumber$1=e=>/^(-?\d+)(\.\d+)?$/.test(e);class App extends events.exports.EventEmitter{constructor(n){super();I(this,"env");I(this,"pages",new Map);I(this,"page");I(this,"platform","mobile");I(this,"jsEngine","browser");I(this,"designWidth",375);I(this,"components",new Map);I(this,"eventQueueMap",{});if(this.env=new Env(n.ua),n.platform&&(this.platform=n.platform),n.jsEngine&&(this.jsEngine=n.jsEngine),n.designWidth&&(this.designWidth=n.designWidth),this.platform==="mobile"||this.platform==="editor"){const i=()=>{let{width:r}=document.documentElement.getBoundingClientRect();r=Math.min(800,r);const o=r/(this.designWidth/100);document.documentElement.style.fontSize=`${o}px`};i(),document.body.style.fontSize="14px",globalThis.addEventListener("resize",i)}n.transformStyle&&(this.transformStyle=n.transformStyle),n.config&&this.setConfig(n.config,n.curPage),bindCommonEventListener(this)}transformStyle(n){if(!n)return{};let i={};const r={};typeof n=="string"?i=style2Obj(n):i={...n};const o=["zIndex","opacity","fontWeight"];return Object.entries(i).forEach(([s,a])=>{s==="backgroundImage"?a&&(r[s]=fillBackgroundImage(a)):s==="transform"&&typeof a!="string"?r[s]=Object.entries(a).map(([u,c])=>{let l=0;return u==="scale"&&(l=1),u==="rotate"&&isNumber$1(c)&&(c=`${c}deg`),`${u}(${c||l})`}).join(" "):!o.includes(s)&&a&&/^[-]?[0-9]*[.]?[0-9]*$/.test(a)?r[s]=`${a/100}rem`:r[s]=a}),r}setConfig(n,i){var r,o,s;this.pages=new Map,(r=n.items)==null||r.forEach(a=>{this.pages.set(a.id,new Page({config:a,app:this}))}),this.setPage(i||((s=(o=this.page)==null?void 0:o.data)==null?void 0:s.id))}setPage(n){let i;n&&(i=this.pages.get(n)),i||(i=this.pages.get(this.pages.keys().next().value)),this.page=i,this.platform!=="magic"&&this.bindEvents()}registerComponent(n,i){this.components.set(n,i)}unregisterComponent(n){this.components.delete(n)}resolveComponent(n){return this.components.get(n)}bindEvents(){var n;if(!!this.page){this.removeAllListeners();for(const[,i]of this.page.nodes)(n=i.events)==null||n.forEach(r=>this.bindEvent(r,`${i.data.id}`))}}bindEvent(n,i){let{name:r}=n;DEFAULT_EVENTS.findIndex(o=>o.value===r)>-1&&(r=getCommonEventName(r,i)),this.on(r,(o,...s)=>{this.eventHandler(n,o,s)})}eventHandler(n,i,r){if(!this.page)throw new Error("\u5F53\u524D\u6CA1\u6709\u9875\u9762");const{method:o,to:s}=n,a=this.page.getNode(s);if(!a)throw`ID\u4E3A${s}\u7684\u7EC4\u4EF6\u4E0D\u5B58\u5728`;if(isCommonMethod(o))return triggerCommonMethod(o,a);a.instance?typeof a.instance[o]=="function"&&a.instance[o](i,...r):this.addEventToMap({eventConfig:n,fromCpt:i,args:r})}destroy(){this.removeAllListeners(),this.pages.clear()}addEventToMap(n){this.eventQueueMap[n.eventConfig.to]?this.eventQueueMap[n.eventConfig.to].push(n):this.eventQueueMap[n.eventConfig.to]=[n]}}var dayjs_min={exports:{}};(function(e,t){(function(n,i){e.exports=i()})(commonjsGlobal,function(){var n=1e3,i=6e4,r=36e5,o="millisecond",s="second",a="minute",u="hour",c="day",l="week",f="month",C="quarter",g="year",$="date",h="Invalid Date",B=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,w=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,b={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_")},E=function(_,y,m){var A=String(_);return!A||A.length>=y?_:""+Array(y+1-A.length).join(m)+_},d={s:E,z:function(_){var y=-_.utcOffset(),m=Math.abs(y),A=Math.floor(m/60),v=m%60;return(y<=0?"+":"-")+E(A,2,"0")+":"+E(v,2,"0")},m:function _(y,m){if(y.date()<m.date())return-_(m,y);var A=12*(m.year()-y.year())+(m.month()-y.month()),v=y.clone().add(A,f),M=m-v<0,L=y.clone().add(A+(M?-1:1),f);return+(-(A+(m-v)/(M?v-L:L-v))||0)},a:function(_){return _<0?Math.ceil(_)||0:Math.floor(_)},p:function(_){return{M:f,y:g,w:l,d:c,D:$,h:u,m:a,s,ms:o,Q:C}[_]||String(_||"").toLowerCase().replace(/s$/,"")},u:function(_){return _===void 0}},T="en",O={};O[T]=b;var D=function(_){return _ instanceof q},U=function _(y,m,A){var v;if(!y)return T;if(typeof y=="string"){var M=y.toLowerCase();O[M]&&(v=M),m&&(O[M]=m,v=M);var L=y.split("-");if(!v&&L.length>1)return _(L[0])}else{var P=y.name;O[P]=y,v=P}return!A&&v&&(T=v),v||!A&&T},N=function(_,y){if(D(_))return _.clone();var m=typeof y=="object"?y:{};return m.date=_,m.args=arguments,new q(m)},S=d;S.l=U,S.i=D,S.w=function(_,y){return N(_,{locale:y.$L,utc:y.$u,x:y.$x,$offset:y.$offset})};var q=function(){function _(m){this.$L=U(m.locale,null,!0),this.parse(m)}var y=_.prototype;return y.parse=function(m){this.$d=function(A){var v=A.date,M=A.utc;if(v===null)return new Date(NaN);if(S.u(v))return new Date;if(v instanceof Date)return new Date(v);if(typeof v=="string"&&!/Z$/i.test(v)){var L=v.match(B);if(L){var P=L[2]-1||0,k=(L[7]||"0").substring(0,3);return M?new Date(Date.UTC(L[1],P,L[3]||1,L[4]||0,L[5]||0,L[6]||0,k)):new Date(L[1],P,L[3]||1,L[4]||0,L[5]||0,L[6]||0,k)}}return new Date(v)}(m),this.$x=m.x||{},this.init()},y.init=function(){var m=this.$d;this.$y=m.getFullYear(),this.$M=m.getMonth(),this.$D=m.getDate(),this.$W=m.getDay(),this.$H=m.getHours(),this.$m=m.getMinutes(),this.$s=m.getSeconds(),this.$ms=m.getMilliseconds()},y.$utils=function(){return S},y.isValid=function(){return this.$d.toString()!==h},y.isSame=function(m,A){var v=N(m);return this.startOf(A)<=v&&v<=this.endOf(A)},y.isAfter=function(m,A){return N(m)<this.startOf(A)},y.isBefore=function(m,A){return this.endOf(A)<N(m)},y.$g=function(m,A,v){return S.u(m)?this[A]:this.set(v,m)},y.unix=function(){return Math.floor(this.valueOf()/1e3)},y.valueOf=function(){return this.$d.getTime()},y.startOf=function(m,A){var v=this,M=!!S.u(A)||A,L=S.p(m),P=function(K,F){var W=S.w(v.$u?Date.UTC(v.$y,F,K):new Date(v.$y,F,K),v);return M?W:W.endOf(c)},k=function(K,F){return S.w(v.toDate()[K].apply(v.toDate("s"),(M?[0,0,0,0]:[23,59,59,999]).slice(F)),v)},x=this.$W,V=this.$M,z=this.$D,H="set"+(this.$u?"UTC":"");switch(L){case g:return M?P(1,0):P(31,11);case f:return M?P(1,V):P(0,V+1);case l:var J=this.$locale().weekStart||0,Y=(x<J?x+7:x)-J;return P(M?z-Y:z+(6-Y),V);case c:case $:return k(H+"Hours",0);case u:return k(H+"Minutes",1);case a:return k(H+"Seconds",2);case s:return k(H+"Milliseconds",3);default:return this.clone()}},y.endOf=function(m){return this.startOf(m,!1)},y.$set=function(m,A){var v,M=S.p(m),L="set"+(this.$u?"UTC":""),P=(v={},v[c]=L+"Date",v[$]=L+"Date",v[f]=L+"Month",v[g]=L+"FullYear",v[u]=L+"Hours",v[a]=L+"Minutes",v[s]=L+"Seconds",v[o]=L+"Milliseconds",v)[M],k=M===c?this.$D+(A-this.$W):A;if(M===f||M===g){var x=this.clone().set($,1);x.$d[P](k),x.init(),this.$d=x.set($,Math.min(this.$D,x.daysInMonth())).$d}else P&&this.$d[P](k);return this.init(),this},y.set=function(m,A){return this.clone().$set(m,A)},y.get=function(m){return this[S.p(m)]()},y.add=function(m,A){var v,M=this;m=Number(m);var L=S.p(A),P=function(V){var z=N(M);return S.w(z.date(z.date()+Math.round(V*m)),M)};if(L===f)return this.set(f,this.$M+m);if(L===g)return this.set(g,this.$y+m);if(L===c)return P(1);if(L===l)return P(7);var k=(v={},v[a]=i,v[u]=r,v[s]=n,v)[L]||1,x=this.$d.getTime()+m*k;return S.w(x,this)},y.subtract=function(m,A){return this.add(-1*m,A)},y.format=function(m){var A=this,v=this.$locale();if(!this.isValid())return v.invalidDate||h;var M=m||"YYYY-MM-DDTHH:mm:ssZ",L=S.z(this),P=this.$H,k=this.$m,x=this.$M,V=v.weekdays,z=v.months,H=function(F,W,G,X){return F&&(F[W]||F(A,M))||G[W].slice(0,X)},J=function(F){return S.s(P%12||12,F,"0")},Y=v.meridiem||function(F,W,G){var X=F<12?"AM":"PM";return G?X.toLowerCase():X},K={YY:String(this.$y).slice(-2),YYYY:this.$y,M:x+1,MM:S.s(x+1,2,"0"),MMM:H(v.monthsShort,x,z,3),MMMM:H(z,x),D:this.$D,DD:S.s(this.$D,2,"0"),d:String(this.$W),dd:H(v.weekdaysMin,this.$W,V,2),ddd:H(v.weekdaysShort,this.$W,V,3),dddd:V[this.$W],H:String(P),HH:S.s(P,2,"0"),h:J(1),hh:J(2),a:Y(P,k,!0),A:Y(P,k,!1),m:String(k),mm:S.s(k,2,"0"),s:String(this.$s),ss:S.s(this.$s,2,"0"),SSS:S.s(this.$ms,3,"0"),Z:L};return M.replace(w,function(F,W){return W||K[F]||L.replace(":","")})},y.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},y.diff=function(m,A,v){var M,L=S.p(A),P=N(m),k=(P.utcOffset()-this.utcOffset())*i,x=this-P,V=S.m(this,P);return V=(M={},M[g]=V/12,M[f]=V,M[C]=V/3,M[l]=(x-k)/6048e5,M[c]=(x-k)/864e5,M[u]=x/r,M[a]=x/i,M[s]=x/n,M)[L]||x,v?V:S.a(V)},y.daysInMonth=function(){return this.endOf(f).$D},y.$locale=function(){return O[this.$L]},y.locale=function(m,A){if(!m)return this.$L;var v=this.clone(),M=U(m,A,!0);return M&&(v.$L=M),v},y.clone=function(){return S.w(this.$d,this)},y.toDate=function(){return new Date(this.valueOf())},y.toJSON=function(){return this.isValid()?this.toISOString():null},y.toISOString=function(){return this.$d.toISOString()},y.toString=function(){return this.$d.toUTCString()},_}(),j=q.prototype;return N.prototype=j,[["$ms",o],["$s",s],["$m",a],["$H",u],["$W",c],["$M",f],["$y",g],["$D",$]].forEach(function(_){j[_[1]]=function(y){return this.$g(y,_[0],_[1])}}),N.extend=function(_,y){return _.$i||(_(y,q,N),_.$i=!0),N},N.locale=U,N.isDayjs=D,N.unix=function(_){return N(1e3*_)},N.en=O[T],N.Ls=O,N.p={},N})})(dayjs_min);const dayjs=dayjs_min.exports;var utc$1={exports:{}};(function(e,t){(function(n,i){e.exports=i()})(commonjsGlobal,function(){var n="minute",i=/[+-]\d\d(?::?\d\d)?/g,r=/([+-]|\d\d)/g;return function(o,s,a){var u=s.prototype;a.utc=function(h){var B={date:h,utc:!0,args:arguments};return new s(B)},u.utc=function(h){var B=a(this.toDate(),{locale:this.$L,utc:!0});return h?B.add(this.utcOffset(),n):B},u.local=function(){return a(this.toDate(),{locale:this.$L,utc:!1})};var c=u.parse;u.parse=function(h){h.utc&&(this.$u=!0),this.$utils().u(h.$offset)||(this.$offset=h.$offset),c.call(this,h)};var l=u.init;u.init=function(){if(this.$u){var h=this.$d;this.$y=h.getUTCFullYear(),this.$M=h.getUTCMonth(),this.$D=h.getUTCDate(),this.$W=h.getUTCDay(),this.$H=h.getUTCHours(),this.$m=h.getUTCMinutes(),this.$s=h.getUTCSeconds(),this.$ms=h.getUTCMilliseconds()}else l.call(this)};var f=u.utcOffset;u.utcOffset=function(h,B){var w=this.$utils().u;if(w(h))return this.$u?0:w(this.$offset)?f.call(this):this.$offset;if(typeof h=="string"&&(h=function(T){T===void 0&&(T="");var O=T.match(i);if(!O)return null;var D=(""+O[0]).match(r)||["-",0,0],U=D[0],N=60*+D[1]+ +D[2];return N===0?0:U==="+"?N:-N}(h),h===null))return this;var b=Math.abs(h)<=16?60*h:h,E=this;if(B)return E.$offset=b,E.$u=h===0,E;if(h!==0){var d=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();(E=this.local().add(b+d,n)).$offset=b,E.$x.$localOffset=d}else E=this.utc();return E};var C=u.format;u.format=function(h){var B=h||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return C.call(this,B)},u.valueOf=function(){var h=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*h},u.isUTC=function(){return!!this.$u},u.toISOString=function(){return this.toDate().toISOString()},u.toString=function(){return this.toDate().toUTCString()};var g=u.toDate;u.toDate=function(h){return h==="s"&&this.$offset?a(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():g.call(this)};var $=u.diff;u.diff=function(h,B,w){if(h&&this.$u===h.$u)return $.call(this,h,B,w);var b=this.local(),E=a(h).local();return $.call(b,E,B,w)}}})})(utc$1);const utc=utc$1.exports;dayjs.extend(utc);const toLine=(e="")=>e.replace(/\B([A-Z])/g,"-$1").toLowerCase(),filterXSS=e=>e.replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;"),getUrlParam=(e,t)=>{const n=t||location.href,i=new RegExp(`[?&#]${e}=([^&#]+)`,"gi"),r=n.match(i);let o;return r&&r.length>0?(o=r[r.length-1].split("="),o&&o.length>1?filterXSS(o[1]):""):""},_sfc_main$8=Vue.defineComponent({name:"magic-ui-component",props:{config:{type:Object,default:()=>({})}},setup(e){var i;const t=(i=Vue.getCurrentInstance())==null?void 0:i.proxy,n=Vue.inject("app");return Vue.provide("hoc",t),{tagName:Vue.computed(()=>`magic-ui-${toLine(e.config.type)}`),style:Vue.computed(()=>n==null?void 0:n.transformStyle(e.config.style)),display:()=>{var o;const r=(o=e.config)==null?void 0:o.display;return typeof r=="function"?r(n):r!==!1}}}}),_export_sfc=(e,t)=>{const n=e.__vccOpts||e;for(const[i,r]of t)n[i]=r;return n};function _sfc_render$7(e,t,n,i,r,o){return e.display()?(Vue.openBlock(),Vue.createBlock(Vue.resolveDynamicComponent(e.tagName),{key:0,id:e.config.id,class:Vue.normalizeClass(`magic-ui-component${e.config.className?` ${e.config.className}`:""}`),style:Vue.normalizeStyle(e.style),config:e.config},null,8,["id","class","style","config"])):Vue.createCommentVNode("v-if",!0)}const Component=_export_sfc(_sfc_main$8,[["render",_sfc_render$7],["__file","/data/magic/tmagic-editor/packages/ui/src/Component.vue"]]),useApp=e=>{var r,o;const t=Vue.inject("app"),n=(r=t==null?void 0:t.page)==null?void 0:r.getNode(e.config.id),i=(o=Vue.getCurrentInstance())==null?void 0:o.proxy;return n==null||n.emit("created",i),Vue.onMounted(()=>{n==null||n.emit("mounted",i)}),Vue.onUnmounted(()=>{n==null||n.emit("destroy",i)}),t},_sfc_main$7=Vue.defineComponent({name:"magic-ui-page",components:{"magic-ui-component":Component},props:{config:{type:Object,default:()=>({})}},setup(e){const t=useApp(e);return{style:Vue.computed(()=>t==null?void 0:t.transformStyle(e.config.style||{})),refresh(){window.location.reload()}}}}),_hoisted_1$3=["id"];function _sfc_render$6(e,t,n,i,r,o){const s=Vue.resolveComponent("magic-ui-component");return Vue.openBlock(),Vue.createElementBlock("div",{id:`${e.config.id||""}`,class:Vue.normalizeClass(`magic-ui-page magic-ui-container${e.config.className?` ${e.config.className}`:""}`),style:Vue.normalizeStyle(e.style)},[Vue.renderSlot(e.$slots,"default"),(Vue.openBlock(!0),Vue.createElementBlock(Vue.Fragment,null,Vue.renderList(e.config.items,a=>(Vue.openBlock(),Vue.createBlock(s,{key:a.id,config:a},null,8,["config"]))),128))],14,_hoisted_1$3)}const page=_export_sfc(_sfc_main$7,[["render",_sfc_render$6],["__file","/data/magic/tmagic-editor/packages/ui/src/page/src/index.vue"]]),useCommonMethod=e=>({show:()=>{e.config.style.display="initial"},hide:()=>{e.config.style.display="none"}}),_sfc_main$6=Vue.defineComponent({name:"magic-ui-container",components:{"magic-ui-component":Component},props:{config:{type:Object,default:()=>({})}},setup(e){const t=useApp(e);return{style:Vue.computed(()=>t==null?void 0:t.transformStyle(e.config.style||{})),display:()=>{var i;const n=(i=e.config)==null?void 0:i.display;return typeof n=="function"?n(t):n!==!1},...useCommonMethod(e)}}}),_hoisted_1$2=["id"];function _sfc_render$5(e,t,n,i,r,o){const s=Vue.resolveComponent("magic-ui-component");return e.display()?(Vue.openBlock(),Vue.createElementBlock("div",{key:0,id:`${e.config.id||""}`,class:Vue.normalizeClass(`magic-ui-container${e.config.className?` ${e.config.className}`:""}`),style:Vue.normalizeStyle(e.style)},[Vue.renderSlot(e.$slots,"default"),(Vue.openBlock(!0),Vue.createElementBlock(Vue.Fragment,null,Vue.renderList(e.config.items,a=>(Vue.openBlock(),Vue.createBlock(s,{key:a.id,config:a},null,8,["config"]))),128))],14,_hoisted_1$2)):Vue.createCommentVNode("v-if",!0)}const container=_export_sfc(_sfc_main$6,[["render",_sfc_render$5],["__file","/data/magic/tmagic-editor/packages/ui/src/container/src/Container.vue"]]),_sfc_main$5=Vue.defineComponent({name:"magic-ui-button",props:{config:{type:Object,default:()=>({})},model:{type:Object,default:()=>({})}},setup(e){var a;useApp(e);const t=(a=Vue.getCurrentInstance())==null?void 0:a.proxy,n=Vue.reactive([]),i=Vue.computed(()=>[typeof e.config.preAction=="function"?e.config.preAction:()=>!0,...n,typeof e.config.postAction=="function"?e.config.postAction:()=>!0]);function r(u){n.push(u)}async function o(){for(const u of i.value)if(typeof u=="function"&&await u(t,{model:e.model})===!1)break}const s=Vue.computed(()=>{var u,c,l;return{type:"text",text:((u=e.config)==null?void 0:u.text)||"",disabledText:((c=e.config)==null?void 0:c.disabledText)||"",html:((l=e.config)==null?void 0:l.html)||""}});return{pushAction:r,clickHandler:o,textConfig:s}}});function _sfc_render$4(e,t,n,i,r,o){const s=Vue.resolveComponent("magic-ui-text");return Vue.openBlock(),Vue.createElementBlock("button",{class:"magic-ui-button",onClick:t[0]||(t[0]=(...a)=>e.clickHandler&&e.clickHandler(...a))},[Vue.renderSlot(e.$slots,"default",{},()=>[Vue.createVNode(s,{config:e.textConfig},null,8,["config"])])])}const button=_export_sfc(_sfc_main$5,[["render",_sfc_render$4],["__file","/data/magic/tmagic-editor/packages/ui/src/button/src/index.vue"]]),_sfc_main$4=Vue.defineComponent({name:"magic-ui-text",props:{config:{type:Object,default:()=>({})},model:{type:Object,default:()=>({})},vars:{type:Object,default:()=>({})}},setup(e){var r;useApp(e);const t=(r=Vue.getCurrentInstance())==null?void 0:r.proxy,n=Vue.inject("hoc");return{displayText:Vue.computed(()=>{var a,u;let o=((a=e.config)==null?void 0:a.text)||"";const{vars:s}=e;if((n==null?void 0:n.disabled)&&((u=e.config)==null?void 0:u.disabledText)&&(o=e.config.disabledText),typeof o=="function")return o.bind(t)(t,{model:e.model});if(Object.prototype.toString.call(s)==="[object Object]"){let c=o;return Object.entries(s).forEach(([l,f])=>{c=c.replace(new RegExp(`{{${l}}}`,"g"),f)}),c}return o||""})}},render(){var t,n,i,r;const e=(t=this.config)!=null&&t.multiple?"magic-ui-text":"magic-ui-text magic-ui-text--single-line";return typeof((n=this.$slots)==null?void 0:n.default)=="function"?Vue.h("span",{class:e},[((r=(i=this.$slots)==null?void 0:i.default)==null?void 0:r.call(i))||""]):Vue.h("span",{class:e,...this.displayText?{innerHTML:this.displayText}:{}})}}),text=_export_sfc(_sfc_main$4,[["__file","/data/magic/tmagic-editor/packages/ui/src/text/src/index.vue"]]),_sfc_main$3=Vue.defineComponent({name:"magic-ui-img",props:{config:{type:Object,default:()=>({})},model:{type:Object,default:()=>({})}},setup(e){return useApp(e),{clickHandler(){e.config.url&&(window.location.href=e.config.url)}}}}),_hoisted_1$1=["src"];function _sfc_render$3(e,t,n,i,r,o){return Vue.openBlock(),Vue.createElementBlock("img",{class:"magic-ui-img",src:e.config.src,onClick:t[0]||(t[0]=(...s)=>e.clickHandler&&e.clickHandler(...s))},null,8,_hoisted_1$1)}const img=_export_sfc(_sfc_main$3,[["render",_sfc_render$3],["__file","/data/magic/tmagic-editor/packages/ui/src/img/src/index.vue"]]);var browser={},canPromise$1=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then},qrcode$1={},utils$a={};let toSJISFunction;const CODEWORDS_COUNT=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];utils$a.getSymbolSize=function(t){if(!t)throw new Error('"version" cannot be null or undefined');if(t<1||t>40)throw new Error('"version" should be in range from 1 to 40');return t*4+17};utils$a.getSymbolTotalCodewords=function(t){return CODEWORDS_COUNT[t]};utils$a.getBCHDigit=function(e){let t=0;for(;e!==0;)t++,e>>>=1;return t};utils$a.setToSJISFunction=function(t){if(typeof t!="function")throw new Error('"toSJISFunc" is not a valid function.');toSJISFunction=t};utils$a.isKanjiModeEnabled=function(){return typeof toSJISFunction<"u"};utils$a.toSJIS=function(t){return toSJISFunction(t)};var errorCorrectionLevel={};(function(e){e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function t(n){if(typeof n!="string")throw new Error("Param is not a string");switch(n.toLowerCase()){case"l":case"low":return e.L;case"m":case"medium":return e.M;case"q":case"quartile":return e.Q;case"h":case"high":return e.H;default:throw new Error("Unknown EC Level: "+n)}}e.isValid=function(i){return i&&typeof i.bit<"u"&&i.bit>=0&&i.bit<4},e.from=function(i,r){if(e.isValid(i))return i;try{return t(i)}catch{return r}}})(errorCorrectionLevel);function BitBuffer$1(){this.buffer=[],this.length=0}BitBuffer$1.prototype={get:function(e){const t=Math.floor(e/8);return(this.buffer[t]>>>7-e%8&1)===1},put:function(e,t){for(let n=0;n<t;n++)this.putBit((e>>>t-n-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(e){const t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}};var bitBuffer=BitBuffer$1;function BitMatrix$1(e){if(!e||e<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=e,this.data=new Uint8Array(e*e),this.reservedBit=new Uint8Array(e*e)}BitMatrix$1.prototype.set=function(e,t,n,i){const r=e*this.size+t;this.data[r]=n,i&&(this.reservedBit[r]=!0)};BitMatrix$1.prototype.get=function(e,t){return this.data[e*this.size+t]};BitMatrix$1.prototype.xor=function(e,t,n){this.data[e*this.size+t]^=n};BitMatrix$1.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]};var bitMatrix=BitMatrix$1,alignmentPattern={};(function(e){const t=utils$a.getSymbolSize;e.getRowColCoords=function(i){if(i===1)return[];const r=Math.floor(i/7)+2,o=t(i),s=o===145?26:Math.ceil((o-13)/(2*r-2))*2,a=[o-7];for(let u=1;u<r-1;u++)a[u]=a[u-1]-s;return a.push(6),a.reverse()},e.getPositions=function(i){const r=[],o=e.getRowColCoords(i),s=o.length;for(let a=0;a<s;a++)for(let u=0;u<s;u++)a===0&&u===0||a===0&&u===s-1||a===s-1&&u===0||r.push([o[a],o[u]]);return r}})(alignmentPattern);var finderPattern={};const getSymbolSize=utils$a.getSymbolSize,FINDER_PATTERN_SIZE=7;finderPattern.getPositions=function(t){const n=getSymbolSize(t);return[[0,0],[n-FINDER_PATTERN_SIZE,0],[0,n-FINDER_PATTERN_SIZE]]};var maskPattern={};(function(e){e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};const t={N1:3,N2:3,N3:40,N4:10};e.isValid=function(r){return r!=null&&r!==""&&!isNaN(r)&&r>=0&&r<=7},e.from=function(r){return e.isValid(r)?parseInt(r,10):void 0},e.getPenaltyN1=function(r){const o=r.size;let s=0,a=0,u=0,c=null,l=null;for(let f=0;f<o;f++){a=u=0,c=l=null;for(let C=0;C<o;C++){let g=r.get(f,C);g===c?a++:(a>=5&&(s+=t.N1+(a-5)),c=g,a=1),g=r.get(C,f),g===l?u++:(u>=5&&(s+=t.N1+(u-5)),l=g,u=1)}a>=5&&(s+=t.N1+(a-5)),u>=5&&(s+=t.N1+(u-5))}return s},e.getPenaltyN2=function(r){const o=r.size;let s=0;for(let a=0;a<o-1;a++)for(let u=0;u<o-1;u++){const c=r.get(a,u)+r.get(a,u+1)+r.get(a+1,u)+r.get(a+1,u+1);(c===4||c===0)&&s++}return s*t.N2},e.getPenaltyN3=function(r){const o=r.size;let s=0,a=0,u=0;for(let c=0;c<o;c++){a=u=0;for(let l=0;l<o;l++)a=a<<1&2047|r.get(c,l),l>=10&&(a===1488||a===93)&&s++,u=u<<1&2047|r.get(l,c),l>=10&&(u===1488||u===93)&&s++}return s*t.N3},e.getPenaltyN4=function(r){let o=0;const s=r.data.length;for(let u=0;u<s;u++)o+=r.data[u];return Math.abs(Math.ceil(o*100/s/5)-10)*t.N4};function n(i,r,o){switch(i){case e.Patterns.PATTERN000:return(r+o)%2===0;case e.Patterns.PATTERN001:return r%2===0;case e.Patterns.PATTERN010:return o%3===0;case e.Patterns.PATTERN011:return(r+o)%3===0;case e.Patterns.PATTERN100:return(Math.floor(r/2)+Math.floor(o/3))%2===0;case e.Patterns.PATTERN101:return r*o%2+r*o%3===0;case e.Patterns.PATTERN110:return(r*o%2+r*o%3)%2===0;case e.Patterns.PATTERN111:return(r*o%3+(r+o)%2)%2===0;default:throw new Error("bad maskPattern:"+i)}}e.applyMask=function(r,o){const s=o.size;for(let a=0;a<s;a++)for(let u=0;u<s;u++)o.isReserved(u,a)||o.xor(u,a,n(r,u,a))},e.getBestMask=function(r,o){const s=Object.keys(e.Patterns).length;let a=0,u=1/0;for(let c=0;c<s;c++){o(c),e.applyMask(c,r);const l=e.getPenaltyN1(r)+e.getPenaltyN2(r)+e.getPenaltyN3(r)+e.getPenaltyN4(r);e.applyMask(c,r),l<u&&(u=l,a=c)}return a}})(maskPattern);var errorCorrectionCode={};const ECLevel$1=errorCorrectionLevel,EC_BLOCKS_TABLE=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],EC_CODEWORDS_TABLE=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];errorCorrectionCode.getBlocksCount=function(t,n){switch(n){case ECLevel$1.L:return EC_BLOCKS_TABLE[(t-1)*4+0];case ECLevel$1.M:return EC_BLOCKS_TABLE[(t-1)*4+1];case ECLevel$1.Q:return EC_BLOCKS_TABLE[(t-1)*4+2];case ECLevel$1.H:return EC_BLOCKS_TABLE[(t-1)*4+3];default:return}};errorCorrectionCode.getTotalCodewordsCount=function(t,n){switch(n){case ECLevel$1.L:return EC_CODEWORDS_TABLE[(t-1)*4+0];case ECLevel$1.M:return EC_CODEWORDS_TABLE[(t-1)*4+1];case ECLevel$1.Q:return EC_CODEWORDS_TABLE[(t-1)*4+2];case ECLevel$1.H:return EC_CODEWORDS_TABLE[(t-1)*4+3];default:return}};var polynomial={},galoisField={};const EXP_TABLE=new Uint8Array(512),LOG_TABLE=new Uint8Array(256);(function(){let t=1;for(let n=0;n<255;n++)EXP_TABLE[n]=t,LOG_TABLE[t]=n,t<<=1,t&256&&(t^=285);for(let n=255;n<512;n++)EXP_TABLE[n]=EXP_TABLE[n-255]})();galoisField.log=function(t){if(t<1)throw new Error("log("+t+")");return LOG_TABLE[t]};galoisField.exp=function(t){return EXP_TABLE[t]};galoisField.mul=function(t,n){return t===0||n===0?0:EXP_TABLE[LOG_TABLE[t]+LOG_TABLE[n]]};(function(e){const t=galoisField;e.mul=function(i,r){const o=new Uint8Array(i.length+r.length-1);for(let s=0;s<i.length;s++)for(let a=0;a<r.length;a++)o[s+a]^=t.mul(i[s],r[a]);return o},e.mod=function(i,r){let o=new Uint8Array(i);for(;o.length-r.length>=0;){const s=o[0];for(let u=0;u<r.length;u++)o[u]^=t.mul(r[u],s);let a=0;for(;a<o.length&&o[a]===0;)a++;o=o.slice(a)}return o},e.generateECPolynomial=function(i){let r=new Uint8Array([1]);for(let o=0;o<i;o++)r=e.mul(r,new Uint8Array([1,t.exp(o)]));return r}})(polynomial);const Polynomial=polynomial;function ReedSolomonEncoder$1(e){this.genPoly=void 0,this.degree=e,this.degree&&this.initialize(this.degree)}ReedSolomonEncoder$1.prototype.initialize=function(t){this.degree=t,this.genPoly=Polynomial.generateECPolynomial(this.degree)};ReedSolomonEncoder$1.prototype.encode=function(t){if(!this.genPoly)throw new Error("Encoder not initialized");const n=new Uint8Array(t.length+this.degree);n.set(t);const i=Polynomial.mod(n,this.genPoly),r=this.degree-i.length;if(r>0){const o=new Uint8Array(this.degree);return o.set(i,r),o}return i};var reedSolomonEncoder=ReedSolomonEncoder$1,version={},mode={},versionCheck={};versionCheck.isValid=function(t){return!isNaN(t)&&t>=1&&t<=40};var regex={};const numeric="[0-9]+",alphanumeric="[A-Z $%*+\\-./:]+";let kanji="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";kanji=kanji.replace(/u/g,"\\u");const byte="(?:(?![A-Z0-9 $%*+\\-./:]|"+kanji+`)(?:.|[\r
]))+`;regex.KANJI=new RegExp(kanji,"g");regex.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g");regex.BYTE=new RegExp(byte,"g");regex.NUMERIC=new RegExp(numeric,"g");regex.ALPHANUMERIC=new RegExp(alphanumeric,"g");const TEST_KANJI=new RegExp("^"+kanji+"$"),TEST_NUMERIC=new RegExp("^"+numeric+"$"),TEST_ALPHANUMERIC=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");regex.testKanji=function(t){return TEST_KANJI.test(t)};regex.testNumeric=function(t){return TEST_NUMERIC.test(t)};regex.testAlphanumeric=function(t){return TEST_ALPHANUMERIC.test(t)};(function(e){const t=versionCheck,n=regex;e.NUMERIC={id:"Numeric",bit:1<<0,ccBits:[10,12,14]},e.ALPHANUMERIC={id:"Alphanumeric",bit:1<<1,ccBits:[9,11,13]},e.BYTE={id:"Byte",bit:1<<2,ccBits:[8,16,16]},e.KANJI={id:"Kanji",bit:1<<3,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(o,s){if(!o.ccBits)throw new Error("Invalid mode: "+o);if(!t.isValid(s))throw new Error("Invalid version: "+s);return s>=1&&s<10?o.ccBits[0]:s<27?o.ccBits[1]:o.ccBits[2]},e.getBestModeForData=function(o){return n.testNumeric(o)?e.NUMERIC:n.testAlphanumeric(o)?e.ALPHANUMERIC:n.testKanji(o)?e.KANJI:e.BYTE},e.toString=function(o){if(o&&o.id)return o.id;throw new Error("Invalid mode")},e.isValid=function(o){return o&&o.bit&&o.ccBits};function i(r){if(typeof r!="string")throw new Error("Param is not a string");switch(r.toLowerCase()){case"numeric":return e.NUMERIC;case"alphanumeric":return e.ALPHANUMERIC;case"kanji":return e.KANJI;case"byte":return e.BYTE;default:throw new Error("Unknown mode: "+r)}}e.from=function(o,s){if(e.isValid(o))return o;try{return i(o)}catch{return s}}})(mode);(function(e){const t=utils$a,n=errorCorrectionCode,i=errorCorrectionLevel,r=mode,o=versionCheck,s=1<<12|1<<11|1<<10|1<<9|1<<8|1<<5|1<<2|1<<0,a=t.getBCHDigit(s);function u(C,g,$){for(let h=1;h<=40;h++)if(g<=e.getCapacity(h,$,C))return h}function c(C,g){return r.getCharCountIndicator(C,g)+4}function l(C,g){let $=0;return C.forEach(function(h){$+=c(h.mode,g)+h.getBitsLength()}),$}function f(C,g){for(let $=1;$<=40;$++)if(l(C,$)<=e.getCapacity($,g,r.MIXED))return $}e.from=function(g,$){return o.isValid(g)?parseInt(g,10):$},e.getCapacity=function(g,$,h){if(!o.isValid(g))throw new Error("Invalid QR Code version");typeof h>"u"&&(h=r.BYTE);const B=t.getSymbolTotalCodewords(g),w=n.getTotalCodewordsCount(g,$),b=(B-w)*8;if(h===r.MIXED)return b;const E=b-c(h,g);switch(h){case r.NUMERIC:return Math.floor(E/10*3);case r.ALPHANUMERIC:return Math.floor(E/11*2);case r.KANJI:return Math.floor(E/13);case r.BYTE:default:return Math.floor(E/8)}},e.getBestVersionForData=function(g,$){let h;const B=i.from($,i.M);if(Array.isArray(g)){if(g.length>1)return f(g,B);if(g.length===0)return 1;h=g[0]}else h=g;return u(h.mode,h.getLength(),B)},e.getEncodedBits=function(g){if(!o.isValid(g)||g<7)throw new Error("Invalid QR Code version");let $=g<<12;for(;t.getBCHDigit($)-a>=0;)$^=s<<t.getBCHDigit($)-a;return g<<12|$}})(version);var formatInfo={};const Utils$3=utils$a,G15=1<<10|1<<8|1<<5|1<<4|1<<2|1<<1|1<<0,G15_MASK=1<<14|1<<12|1<<10|1<<4|1<<1,G15_BCH=Utils$3.getBCHDigit(G15);formatInfo.getEncodedBits=function(t,n){const i=t.bit<<3|n;let r=i<<10;for(;Utils$3.getBCHDigit(r)-G15_BCH>=0;)r^=G15<<Utils$3.getBCHDigit(r)-G15_BCH;return(i<<10|r)^G15_MASK};var segments={};const Mode$4=mode;function NumericData(e){this.mode=Mode$4.NUMERIC,this.data=e.toString()}NumericData.getBitsLength=function(t){return 10*Math.floor(t/3)+(t%3?t%3*3+1:0)};NumericData.prototype.getLength=function(){return this.data.length};NumericData.prototype.getBitsLength=function(){return NumericData.getBitsLength(this.data.length)};NumericData.prototype.write=function(t){let n,i,r;for(n=0;n+3<=this.data.length;n+=3)i=this.data.substr(n,3),r=parseInt(i,10),t.put(r,10);const o=this.data.length-n;o>0&&(i=this.data.substr(n),r=parseInt(i,10),t.put(r,o*3+1))};var numericData=NumericData;const Mode$3=mode,ALPHA_NUM_CHARS=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function AlphanumericData(e){this.mode=Mode$3.ALPHANUMERIC,this.data=e}AlphanumericData.getBitsLength=function(t){return 11*Math.floor(t/2)+6*(t%2)};AlphanumericData.prototype.getLength=function(){return this.data.length};AlphanumericData.prototype.getBitsLength=function(){return AlphanumericData.getBitsLength(this.data.length)};AlphanumericData.prototype.write=function(t){let n;for(n=0;n+2<=this.data.length;n+=2){let i=ALPHA_NUM_CHARS.indexOf(this.data[n])*45;i+=ALPHA_NUM_CHARS.indexOf(this.data[n+1]),t.put(i,11)}this.data.length%2&&t.put(ALPHA_NUM_CHARS.indexOf(this.data[n]),6)};var alphanumericData=AlphanumericData,encodeUtf8$1=function(t){for(var n=[],i=t.length,r=0;r<i;r++){var o=t.charCodeAt(r);if(o>=55296&&o<=56319&&i>r+1){var s=t.charCodeAt(r+1);s>=56320&&s<=57343&&(o=(o-55296)*1024+s-56320+65536,r+=1)}if(o<128){n.push(o);continue}if(o<2048){n.push(o>>6|192),n.push(o&63|128);continue}if(o<55296||o>=57344&&o<65536){n.push(o>>12|224),n.push(o>>6&63|128),n.push(o&63|128);continue}if(o>=65536&&o<=1114111){n.push(o>>18|240),n.push(o>>12&63|128),n.push(o>>6&63|128),n.push(o&63|128);continue}n.push(239,191,189)}return new Uint8Array(n).buffer};const encodeUtf8=encodeUtf8$1,Mode$2=mode;function ByteData(e){this.mode=Mode$2.BYTE,this.data=new Uint8Array(encodeUtf8(e))}ByteData.getBitsLength=function(t){return t*8};ByteData.prototype.getLength=function(){return this.data.length};ByteData.prototype.getBitsLength=function(){return ByteData.getBitsLength(this.data.length)};ByteData.prototype.write=function(e){for(let t=0,n=this.data.length;t<n;t++)e.put(this.data[t],8)};var byteData=ByteData;const Mode$1=mode,Utils$2=utils$a;function KanjiData(e){this.mode=Mode$1.KANJI,this.data=e}KanjiData.getBitsLength=function(t){return t*13};KanjiData.prototype.getLength=function(){return this.data.length};KanjiData.prototype.getBitsLength=function(){return KanjiData.getBitsLength(this.data.length)};KanjiData.prototype.write=function(e){let t;for(t=0;t<this.data.length;t++){let n=Utils$2.toSJIS(this.data[t]);if(n>=33088&&n<=40956)n-=33088;else if(n>=57408&&n<=60351)n-=49472;else throw new Error("Invalid SJIS character: "+this.data[t]+`
Make sure your charset is UTF-8`);n=(n>>>8&255)*192+(n&255),e.put(n,13)}};var kanjiData=KanjiData,dijkstra={exports:{}};(function(e){var t={single_source_shortest_paths:function(n,i,r){var o={},s={};s[i]=0;var a=t.PriorityQueue.make();a.push(i,0);for(var u,c,l,f,C,g,$,h,B;!a.empty();){u=a.pop(),c=u.value,f=u.cost,C=n[c]||{};for(l in C)C.hasOwnProperty(l)&&(g=C[l],$=f+g,h=s[l],B=typeof s[l]>"u",(B||h>$)&&(s[l]=$,a.push(l,$),o[l]=c))}if(typeof r<"u"&&typeof s[r]>"u"){var w=["Could not find a path from ",i," to ",r,"."].join("");throw new Error(w)}return o},extract_shortest_path_from_predecessor_list:function(n,i){for(var r=[],o=i;o;)r.push(o),n[o],o=n[o];return r.reverse(),r},find_path:function(n,i,r){var o=t.single_source_shortest_paths(n,i,r);return t.extract_shortest_path_from_predecessor_list(o,r)},PriorityQueue:{make:function(n){var i=t.PriorityQueue,r={},o;n=n||{};for(o in i)i.hasOwnProperty(o)&&(r[o]=i[o]);return r.queue=[],r.sorter=n.sorter||i.default_sorter,r},default_sorter:function(n,i){return n.cost-i.cost},push:function(n,i){var r={value:n,cost:i};this.queue.push(r),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};e.exports=t})(dijkstra);(function(e){const t=mode,n=numericData,i=alphanumericData,r=byteData,o=kanjiData,s=regex,a=utils$a,u=dijkstra.exports;function c(w){return unescape(encodeURIComponent(w)).length}function l(w,b,E){const d=[];let T;for(;(T=w.exec(E))!==null;)d.push({data:T[0],index:T.index,mode:b,length:T[0].length});return d}function f(w){const b=l(s.NUMERIC,t.NUMERIC,w),E=l(s.ALPHANUMERIC,t.ALPHANUMERIC,w);let d,T;return a.isKanjiModeEnabled()?(d=l(s.BYTE,t.BYTE,w),T=l(s.KANJI,t.KANJI,w)):(d=l(s.BYTE_KANJI,t.BYTE,w),T=[]),b.concat(E,d,T).sort(function(D,U){return D.index-U.index}).map(function(D){return{data:D.data,mode:D.mode,length:D.length}})}function C(w,b){switch(b){case t.NUMERIC:return n.getBitsLength(w);case t.ALPHANUMERIC:return i.getBitsLength(w);case t.KANJI:return o.getBitsLength(w);case t.BYTE:return r.getBitsLength(w)}}function g(w){return w.reduce(function(b,E){const d=b.length-1>=0?b[b.length-1]:null;return d&&d.mode===E.mode?(b[b.length-1].data+=E.data,b):(b.push(E),b)},[])}function $(w){const b=[];for(let E=0;E<w.length;E++){const d=w[E];switch(d.mode){case t.NUMERIC:b.push([d,{data:d.data,mode:t.ALPHANUMERIC,length:d.length},{data:d.data,mode:t.BYTE,length:d.length}]);break;case t.ALPHANUMERIC:b.push([d,{data:d.data,mode:t.BYTE,length:d.length}]);break;case t.KANJI:b.push([d,{data:d.data,mode:t.BYTE,length:c(d.data)}]);break;case t.BYTE:b.push([{data:d.data,mode:t.BYTE,length:c(d.data)}])}}return b}function h(w,b){const E={},d={start:{}};let T=["start"];for(let O=0;O<w.length;O++){const D=w[O],U=[];for(let N=0;N<D.length;N++){const S=D[N],q=""+O+N;U.push(q),E[q]={node:S,lastCount:0},d[q]={};for(let j=0;j<T.length;j++){const _=T[j];E[_]&&E[_].node.mode===S.mode?(d[_][q]=C(E[_].lastCount+S.length,S.mode)-C(E[_].lastCount,S.mode),E[_].lastCount+=S.length):(E[_]&&(E[_].lastCount=S.length),d[_][q]=C(S.length,S.mode)+4+t.getCharCountIndicator(S.mode,b))}}T=U}for(let O=0;O<T.length;O++)d[T[O]].end=0;return{map:d,table:E}}function B(w,b){let E;const d=t.getBestModeForData(w);if(E=t.from(b,d),E!==t.BYTE&&E.bit<d.bit)throw new Error('"'+w+'" cannot be encoded with mode '+t.toString(E)+`.
Suggested mode is: `+t.toString(d));switch(E===t.KANJI&&!a.isKanjiModeEnabled()&&(E=t.BYTE),E){case t.NUMERIC:return new n(w);case t.ALPHANUMERIC:return new i(w);case t.KANJI:return new o(w);case t.BYTE:return new r(w)}}e.fromArray=function(b){return b.reduce(function(E,d){return typeof d=="string"?E.push(B(d,null)):d.data&&E.push(B(d.data,d.mode)),E},[])},e.fromString=function(b,E){const d=f(b,a.isKanjiModeEnabled()),T=$(d),O=h(T,E),D=u.find_path(O.map,"start","end"),U=[];for(let N=1;N<D.length-1;N++)U.push(O.table[D[N]].node);return e.fromArray(g(U))},e.rawSplit=function(b){return e.fromArray(f(b,a.isKanjiModeEnabled()))}})(segments);const Utils$1=utils$a,ECLevel=errorCorrectionLevel,BitBuffer=bitBuffer,BitMatrix=bitMatrix,AlignmentPattern=alignmentPattern,FinderPattern=finderPattern,MaskPattern=maskPattern,ECCode=errorCorrectionCode,ReedSolomonEncoder=reedSolomonEncoder,Version=version,FormatInfo=formatInfo,Mode=mode,Segments=segments;function setupFinderPattern(e,t){const n=e.size,i=FinderPattern.getPositions(t);for(let r=0;r<i.length;r++){const o=i[r][0],s=i[r][1];for(let a=-1;a<=7;a++)if(!(o+a<=-1||n<=o+a))for(let u=-1;u<=7;u++)s+u<=-1||n<=s+u||(a>=0&&a<=6&&(u===0||u===6)||u>=0&&u<=6&&(a===0||a===6)||a>=2&&a<=4&&u>=2&&u<=4?e.set(o+a,s+u,!0,!0):e.set(o+a,s+u,!1,!0))}}function setupTimingPattern(e){const t=e.size;for(let n=8;n<t-8;n++){const i=n%2===0;e.set(n,6,i,!0),e.set(6,n,i,!0)}}function setupAlignmentPattern(e,t){const n=AlignmentPattern.getPositions(t);for(let i=0;i<n.length;i++){const r=n[i][0],o=n[i][1];for(let s=-2;s<=2;s++)for(let a=-2;a<=2;a++)s===-2||s===2||a===-2||a===2||s===0&&a===0?e.set(r+s,o+a,!0,!0):e.set(r+s,o+a,!1,!0)}}function setupVersionInfo(e,t){const n=e.size,i=Version.getEncodedBits(t);let r,o,s;for(let a=0;a<18;a++)r=Math.floor(a/3),o=a%3+n-8-3,s=(i>>a&1)===1,e.set(r,o,s,!0),e.set(o,r,s,!0)}function setupFormatInfo(e,t,n){const i=e.size,r=FormatInfo.getEncodedBits(t,n);let o,s;for(o=0;o<15;o++)s=(r>>o&1)===1,o<6?e.set(o,8,s,!0):o<8?e.set(o+1,8,s,!0):e.set(i-15+o,8,s,!0),o<8?e.set(8,i-o-1,s,!0):o<9?e.set(8,15-o-1+1,s,!0):e.set(8,15-o-1,s,!0);e.set(i-8,8,1,!0)}function setupData(e,t){const n=e.size;let i=-1,r=n-1,o=7,s=0;for(let a=n-1;a>0;a-=2)for(a===6&&a--;;){for(let u=0;u<2;u++)if(!e.isReserved(r,a-u)){let c=!1;s<t.length&&(c=(t[s]>>>o&1)===1),e.set(r,a-u,c),o--,o===-1&&(s++,o=7)}if(r+=i,r<0||n<=r){r-=i,i=-i;break}}}function createData(e,t,n){const i=new BitBuffer;n.forEach(function(u){i.put(u.mode.bit,4),i.put(u.getLength(),Mode.getCharCountIndicator(u.mode,e)),u.write(i)});const r=Utils$1.getSymbolTotalCodewords(e),o=ECCode.getTotalCodewordsCount(e,t),s=(r-o)*8;for(i.getLengthInBits()+4<=s&&i.put(0,4);i.getLengthInBits()%8!==0;)i.putBit(0);const a=(s-i.getLengthInBits())/8;for(let u=0;u<a;u++)i.put(u%2?17:236,8);return createCodewords(i,e,t)}function createCodewords(e,t,n){const i=Utils$1.getSymbolTotalCodewords(t),r=ECCode.getTotalCodewordsCount(t,n),o=i-r,s=ECCode.getBlocksCount(t,n),a=i%s,u=s-a,c=Math.floor(i/s),l=Math.floor(o/s),f=l+1,C=c-l,g=new ReedSolomonEncoder(C);let $=0;const h=new Array(s),B=new Array(s);let w=0;const b=new Uint8Array(e.buffer);for(let D=0;D<s;D++){const U=D<u?l:f;h[D]=b.slice($,$+U),B[D]=g.encode(h[D]),$+=U,w=Math.max(w,U)}const E=new Uint8Array(i);let d=0,T,O;for(T=0;T<w;T++)for(O=0;O<s;O++)T<h[O].length&&(E[d++]=h[O][T]);for(T=0;T<C;T++)for(O=0;O<s;O++)E[d++]=B[O][T];return E}function createSymbol(e,t,n,i){let r;if(Array.isArray(e))r=Segments.fromArray(e);else if(typeof e=="string"){let c=t;if(!c){const l=Segments.rawSplit(e);c=Version.getBestVersionForData(l,n)}r=Segments.fromString(e,c||40)}else throw new Error("Invalid data");const o=Version.getBestVersionForData(r,n);if(!o)throw new Error("The amount of data is too big to be stored in a QR Code");if(!t)t=o;else if(t<o)throw new Error(`
The chosen QR Code version cannot contain this amount of data.
Minimum version required to store current data is: `+o+`.
`);const s=createData(t,n,r),a=Utils$1.getSymbolSize(t),u=new BitMatrix(a);return setupFinderPattern(u,t),setupTimingPattern(u),setupAlignmentPattern(u,t),setupFormatInfo(u,n,0),t>=7&&setupVersionInfo(u,t),setupData(u,s),isNaN(i)&&(i=MaskPattern.getBestMask(u,setupFormatInfo.bind(null,u,n))),MaskPattern.applyMask(i,u),setupFormatInfo(u,n,i),{modules:u,version:t,errorCorrectionLevel:n,maskPattern:i,segments:r}}qrcode$1.create=function(t,n){if(typeof t>"u"||t==="")throw new Error("No input text");let i=ECLevel.M,r,o;return typeof n<"u"&&(i=ECLevel.from(n.errorCorrectionLevel,ECLevel.M),r=Version.from(n.version),o=MaskPattern.from(n.maskPattern),n.toSJISFunc&&Utils$1.setToSJISFunction(n.toSJISFunc)),createSymbol(t,r,i,o)};var canvas={},utils$9={};(function(e){function t(n){if(typeof n=="number"&&(n=n.toString()),typeof n!="string")throw new Error("Color should be defined as hex string");let i=n.slice().replace("#","").split("");if(i.length<3||i.length===5||i.length>8)throw new Error("Invalid hex color: "+n);(i.length===3||i.length===4)&&(i=Array.prototype.concat.apply([],i.map(function(o){return[o,o]}))),i.length===6&&i.push("F","F");const r=parseInt(i.join(""),16);return{r:r>>24&255,g:r>>16&255,b:r>>8&255,a:r&255,hex:"#"+i.slice(0,6).join("")}}e.getOptions=function(i){i||(i={}),i.color||(i.color={});const r=typeof i.margin>"u"||i.margin===null||i.margin<0?4:i.margin,o=i.width&&i.width>=21?i.width:void 0,s=i.scale||4;return{width:o,scale:o?4:s,margin:r,color:{dark:t(i.color.dark||"#000000ff"),light:t(i.color.light||"#ffffffff")},type:i.type,rendererOpts:i.rendererOpts||{}}},e.getScale=function(i,r){return r.width&&r.width>=i+r.margin*2?r.width/(i+r.margin*2):r.scale},e.getImageWidth=function(i,r){const o=e.getScale(i,r);return Math.floor((i+r.margin*2)*o)},e.qrToImageData=function(i,r,o){const s=r.modules.size,a=r.modules.data,u=e.getScale(s,o),c=Math.floor((s+o.margin*2)*u),l=o.margin*u,f=[o.color.light,o.color.dark];for(let C=0;C<c;C++)for(let g=0;g<c;g++){let $=(C*c+g)*4,h=o.color.light;if(C>=l&&g>=l&&C<c-l&&g<c-l){const B=Math.floor((C-l)/u),w=Math.floor((g-l)/u);h=f[a[B*s+w]?1:0]}i[$++]=h.r,i[$++]=h.g,i[$++]=h.b,i[$]=h.a}}})(utils$9);(function(e){const t=utils$9;function n(r,o,s){r.clearRect(0,0,o.width,o.height),o.style||(o.style={}),o.height=s,o.width=s,o.style.height=s+"px",o.style.width=s+"px"}function i(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}e.render=function(o,s,a){let u=a,c=s;typeof u>"u"&&(!s||!s.getContext)&&(u=s,s=void 0),s||(c=i()),u=t.getOptions(u);const l=t.getImageWidth(o.modules.size,u),f=c.getContext("2d"),C=f.createImageData(l,l);return t.qrToImageData(C.data,o,u),n(f,c,l),f.putImageData(C,0,0),c},e.renderToDataURL=function(o,s,a){let u=a;typeof u>"u"&&(!s||!s.getContext)&&(u=s,s=void 0),u||(u={});const c=e.render(o,s,u),l=u.type||"image/png",f=u.rendererOpts||{};return c.toDataURL(l,f.quality)}})(canvas);var svgTag={};const Utils=utils$9;function getColorAttrib(e,t){const n=e.a/255,i=t+'="'+e.hex+'"';return n<1?i+" "+t+'-opacity="'+n.toFixed(2).slice(1)+'"':i}function svgCmd(e,t,n){let i=e+t;return typeof n<"u"&&(i+=" "+n),i}function qrToPath(e,t,n){let i="",r=0,o=!1,s=0;for(let a=0;a<e.length;a++){const u=Math.floor(a%t),c=Math.floor(a/t);!u&&!o&&(o=!0),e[a]?(s++,a>0&&u>0&&e[a-1]||(i+=o?svgCmd("M",u+n,.5+c+n):svgCmd("m",r,0),r=0,o=!1),u+1<t&&e[a+1]||(i+=svgCmd("h",s),s=0)):r++}return i}svgTag.render=function(t,n,i){const r=Utils.getOptions(n),o=t.modules.size,s=t.modules.data,a=o+r.margin*2,u=r.color.light.a?"<path "+getColorAttrib(r.color.light,"fill")+' d="M0 0h'+a+"v"+a+'H0z"/>':"",c="<path "+getColorAttrib(r.color.dark,"stroke")+' d="'+qrToPath(s,o,r.margin)+'"/>',l='viewBox="0 0 '+a+" "+a+'"',f=r.width?'width="'+r.width+'" height="'+r.width+'" ':"",C='<svg xmlns="http://www.w3.org/2000/svg" '+f+l+' shape-rendering="crispEdges">'+u+c+`</svg>
`;return typeof i=="function"&&i(null,C),C};const canPromise=canPromise$1,QRCode=qrcode$1,CanvasRenderer=canvas,SvgRenderer=svgTag;function renderCanvas(e,t,n,i,r){const o=[].slice.call(arguments,1),s=o.length,a=typeof o[s-1]=="function";if(!a&&!canPromise())throw new Error("Callback required as last argument");if(a){if(s<2)throw new Error("Too few arguments provided");s===2?(r=n,n=t,t=i=void 0):s===3&&(t.getContext&&typeof r>"u"?(r=i,i=void 0):(r=i,i=n,n=t,t=void 0))}else{if(s<1)throw new Error("Too few arguments provided");return s===1?(n=t,t=i=void 0):s===2&&!t.getContext&&(i=n,n=t,t=void 0),new Promise(function(u,c){try{const l=QRCode.create(n,i);u(e(l,t,i))}catch(l){c(l)}})}try{const u=QRCode.create(n,i);r(null,e(u,t,i))}catch(u){r(u)}}browser.create=QRCode.create;browser.toCanvas=renderCanvas.bind(null,CanvasRenderer.render);browser.toDataURL=renderCanvas.bind(null,CanvasRenderer.renderToDataURL);browser.toString=renderCanvas.bind(null,function(e,t,n){return SvgRenderer.render(e,n)});const _sfc_main$2=Vue.defineComponent({name:"magic-ui-qrcode",props:{config:{type:Object,default:()=>({})},model:{type:Object,default:()=>({})}},setup(e){useApp(e);const t=Vue.ref();return Vue.watch(()=>e.config.url,(n="")=>{browser.toDataURL(n,(i,r)=>{i&&console.error(i),t.value=r})},{immediate:!0}),{imgUrl:t}}}),_hoisted_1=["src"];function _sfc_render$2(e,t,n,i,r,o){return Vue.openBlock(),Vue.createElementBlock("img",{class:"magic-ui-qrcode",src:e.imgUrl},null,8,_hoisted_1)}const qrcode=_export_sfc(_sfc_main$2,[["render",_sfc_render$2],["__file","/data/magic/tmagic-editor/packages/ui/src/qrcode/src/index.vue"]]),_sfc_main$1=Vue.defineComponent({name:"magic-ui-overlay",props:{config:{type:Object,default:()=>({})},model:{type:Object,default:()=>({})}},setup(e){var s;const t=Vue.ref(!1),n=useApp(e),i=(s=n==null?void 0:n.page)==null?void 0:s.getNode(e.config.id),r=()=>{t.value=!0,n&&n.emit("overlay:open",i)},o=()=>{t.value=!1,n&&n.emit("overlay:close",i)};return n==null||n.on("editor:select",(a,u)=>{u.find(c=>c.id===e.config.id)?r():o()}),{visible:t,openOverlay:r,closeOverlay:o}}});function _sfc_render$1(e,t,n,i,r,o){const s=Vue.resolveComponent("magic-ui-container");return e.visible?(Vue.openBlock(),Vue.createBlock(s,{key:0,class:"magic-ui-overlay",config:{items:e.config.items}},{default:Vue.withCtx(()=>[Vue.renderSlot(e.$slots,"default")]),_:3},8,["config"])):Vue.createCommentVNode("v-if",!0)}const overlay=_export_sfc(_sfc_main$1,[["render",_sfc_render$1],["__file","/data/magic/tmagic-editor/packages/ui/src/overlay/src/index.vue"]]),components={page,container,button,text,img,qrcode,overlay},plugins={};var axios$3={exports:{}},axios$2={exports:{}},bind$2=function(t,n){return function(){for(var r=new Array(arguments.length),o=0;o<r.length;o++)r[o]=arguments[o];return t.apply(n,r)}},bind$1=bind$2,toString=Object.prototype.toString;function isArray(e){return Array.isArray(e)}function isUndefined(e){return typeof e>"u"}function isBuffer(e){return e!==null&&!isUndefined(e)&&e.constructor!==null&&!isUndefined(e.constructor)&&typeof e.constructor.isBuffer=="function"&&e.constructor.isBuffer(e)}function isArrayBuffer(e){return toString.call(e)==="[object ArrayBuffer]"}function isFormData(e){return toString.call(e)==="[object FormData]"}function isArrayBufferView(e){var t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&isArrayBuffer(e.buffer),t}function isString(e){return typeof e=="string"}function isNumber(e){return typeof e=="number"}function isObject(e){return e!==null&&typeof e=="object"}function isPlainObject(e){if(toString.call(e)!=="[object Object]")return!1;var t=Object.getPrototypeOf(e);return t===null||t===Object.prototype}function isDate(e){return toString.call(e)==="[object Date]"}function isFile(e){return toString.call(e)==="[object File]"}function isBlob(e){return toString.call(e)==="[object Blob]"}function isFunction(e){return toString.call(e)==="[object Function]"}function isStream(e){return isObject(e)&&isFunction(e.pipe)}function isURLSearchParams(e){return toString.call(e)==="[object URLSearchParams]"}function trim(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function isStandardBrowserEnv(){return typeof navigator<"u"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")?!1:typeof window<"u"&&typeof document<"u"}function forEach(e,t){if(!(e===null||typeof e>"u"))if(typeof e!="object"&&(e=[e]),isArray(e))for(var n=0,i=e.length;n<i;n++)t.call(null,e[n],n,e);else for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.call(null,e[r],r,e)}function merge(){var e={};function t(r,o){isPlainObject(e[o])&&isPlainObject(r)?e[o]=merge(e[o],r):isPlainObject(r)?e[o]=merge({},r):isArray(r)?e[o]=r.slice():e[o]=r}for(var n=0,i=arguments.length;n<i;n++)forEach(arguments[n],t);return e}function extend(e,t,n){return forEach(t,function(r,o){n&&typeof r=="function"?e[o]=bind$1(r,n):e[o]=r}),e}function stripBOM(e){return e.charCodeAt(0)===65279&&(e=e.slice(1)),e}var utils$8={isArray,isArrayBuffer,isBuffer,isFormData,isArrayBufferView,isString,isNumber,isObject,isPlainObject,isUndefined,isDate,isFile,isBlob,isFunction,isStream,isURLSearchParams,isStandardBrowserEnv,forEach,merge,extend,trim,stripBOM},utils$7=utils$8;function encode(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var buildURL$1=function(t,n,i){if(!n)return t;var r;if(i)r=i(n);else if(utils$7.isURLSearchParams(n))r=n.toString();else{var o=[];utils$7.forEach(n,function(u,c){u===null||typeof u>"u"||(utils$7.isArray(u)?c=c+"[]":u=[u],utils$7.forEach(u,function(f){utils$7.isDate(f)?f=f.toISOString():utils$7.isObject(f)&&(f=JSON.stringify(f)),o.push(encode(c)+"="+encode(f))}))}),r=o.join("&")}if(r){var s=t.indexOf("#");s!==-1&&(t=t.slice(0,s)),t+=(t.indexOf("?")===-1?"?":"&")+r}return t},utils$6=utils$8;function InterceptorManager$1(){this.handlers=[]}InterceptorManager$1.prototype.use=function(t,n,i){return this.handlers.push({fulfilled:t,rejected:n,synchronous:i?i.synchronous:!1,runWhen:i?i.runWhen:null}),this.handlers.length-1};InterceptorManager$1.prototype.eject=function(t){this.handlers[t]&&(this.handlers[t]=null)};InterceptorManager$1.prototype.forEach=function(t){utils$6.forEach(this.handlers,function(i){i!==null&&t(i)})};var InterceptorManager_1=InterceptorManager$1,utils$5=utils$8,normalizeHeaderName=function(t,n){utils$5.forEach(t,function(r,o){o!==n&&o.toUpperCase()===n.toUpperCase()&&(t[n]=r,delete t[o])})},enhanceError=function(t,n,i,r,o){return t.config=n,i&&(t.code=i),t.request=r,t.response=o,t.isAxiosError=!0,t.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}},t},createError,hasRequiredCreateError;function requireCreateError(){if(hasRequiredCreateError)return createError;hasRequiredCreateError=1;var e=enhanceError;return createError=function(n,i,r,o,s){var a=new Error(n);return e(a,i,r,o,s)},createError}var settle,hasRequiredSettle;function requireSettle(){if(hasRequiredSettle)return settle;hasRequiredSettle=1;var e=requireCreateError();return settle=function(n,i,r){var o=r.config.validateStatus;!r.status||!o||o(r.status)?n(r):i(e("Request failed with status code "+r.status,r.config,null,r.request,r))},settle}var cookies,hasRequiredCookies;function requireCookies(){if(hasRequiredCookies)return cookies;hasRequiredCookies=1;var e=utils$8;return cookies=e.isStandardBrowserEnv()?function(){return{write:function(i,r,o,s,a,u){var c=[];c.push(i+"="+encodeURIComponent(r)),e.isNumber(o)&&c.push("expires="+new Date(o).toGMTString()),e.isString(s)&&c.push("path="+s),e.isString(a)&&c.push("domain="+a),u===!0&&c.push("secure"),document.cookie=c.join("; ")},read:function(i){var r=document.cookie.match(new RegExp("(^|;\\s*)("+i+")=([^;]*)"));return r?decodeURIComponent(r[3]):null},remove:function(i){this.write(i,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}(),cookies}var isAbsoluteURL,hasRequiredIsAbsoluteURL;function requireIsAbsoluteURL(){return hasRequiredIsAbsoluteURL||(hasRequiredIsAbsoluteURL=1,isAbsoluteURL=function(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}),isAbsoluteURL}var combineURLs,hasRequiredCombineURLs;function requireCombineURLs(){return hasRequiredCombineURLs||(hasRequiredCombineURLs=1,combineURLs=function(t,n){return n?t.replace(/\/+$/,"")+"/"+n.replace(/^\/+/,""):t}),combineURLs}var buildFullPath,hasRequiredBuildFullPath;function requireBuildFullPath(){if(hasRequiredBuildFullPath)return buildFullPath;hasRequiredBuildFullPath=1;var e=requireIsAbsoluteURL(),t=requireCombineURLs();return buildFullPath=function(i,r){return i&&!e(r)?t(i,r):r},buildFullPath}var parseHeaders,hasRequiredParseHeaders;function requireParseHeaders(){if(hasRequiredParseHeaders)return parseHeaders;hasRequiredParseHeaders=1;var e=utils$8,t=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];return parseHeaders=function(i){var r={},o,s,a;return i&&e.forEach(i.split(`
`),function(c){if(a=c.indexOf(":"),o=e.trim(c.substr(0,a)).toLowerCase(),s=e.trim(c.substr(a+1)),o){if(r[o]&&t.indexOf(o)>=0)return;o==="set-cookie"?r[o]=(r[o]?r[o]:[]).concat([s]):r[o]=r[o]?r[o]+", "+s:s}}),r},parseHeaders}var isURLSameOrigin,hasRequiredIsURLSameOrigin;function requireIsURLSameOrigin(){if(hasRequiredIsURLSameOrigin)return isURLSameOrigin;hasRequiredIsURLSameOrigin=1;var e=utils$8;return isURLSameOrigin=e.isStandardBrowserEnv()?function(){var n=/(msie|trident)/i.test(navigator.userAgent),i=document.createElement("a"),r;function o(s){var a=s;return n&&(i.setAttribute("href",a),a=i.href),i.setAttribute("href",a),{href:i.href,protocol:i.protocol?i.protocol.replace(/:$/,""):"",host:i.host,search:i.search?i.search.replace(/^\?/,""):"",hash:i.hash?i.hash.replace(/^#/,""):"",hostname:i.hostname,port:i.port,pathname:i.pathname.charAt(0)==="/"?i.pathname:"/"+i.pathname}}return r=o(window.location.href),function(a){var u=e.isString(a)?o(a):a;return u.protocol===r.protocol&&u.host===r.host}}():function(){return function(){return!0}}(),isURLSameOrigin}var Cancel_1,hasRequiredCancel;function requireCancel(){if(hasRequiredCancel)return Cancel_1;hasRequiredCancel=1;function e(t){this.message=t}return e.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},e.prototype.__CANCEL__=!0,Cancel_1=e,Cancel_1}var xhr,hasRequiredXhr;function requireXhr(){if(hasRequiredXhr)return xhr;hasRequiredXhr=1;var e=utils$8,t=requireSettle(),n=requireCookies(),i=buildURL$1,r=requireBuildFullPath(),o=requireParseHeaders(),s=requireIsURLSameOrigin(),a=requireCreateError(),u=requireDefaults(),c=requireCancel();return xhr=function(f){return new Promise(function(g,$){var h=f.data,B=f.headers,w=f.responseType,b;function E(){f.cancelToken&&f.cancelToken.unsubscribe(b),f.signal&&f.signal.removeEventListener("abort",b)}e.isFormData(h)&&delete B["Content-Type"];var d=new XMLHttpRequest;if(f.auth){var T=f.auth.username||"",O=f.auth.password?unescape(encodeURIComponent(f.auth.password)):"";B.Authorization="Basic "+btoa(T+":"+O)}var D=r(f.baseURL,f.url);d.open(f.method.toUpperCase(),i(D,f.params,f.paramsSerializer),!0),d.timeout=f.timeout;function U(){if(!!d){var S="getAllResponseHeaders"in d?o(d.getAllResponseHeaders()):null,q=!w||w==="text"||w==="json"?d.responseText:d.response,j={data:q,status:d.status,statusText:d.statusText,headers:S,config:f,request:d};t(function(y){g(y),E()},function(y){$(y),E()},j),d=null}}if("onloadend"in d?d.onloadend=U:d.onreadystatechange=function(){!d||d.readyState!==4||d.status===0&&!(d.responseURL&&d.responseURL.indexOf("file:")===0)||setTimeout(U)},d.onabort=function(){!d||($(a("Request aborted",f,"ECONNABORTED",d)),d=null)},d.onerror=function(){$(a("Network Error",f,null,d)),d=null},d.ontimeout=function(){var q=f.timeout?"timeout of "+f.timeout+"ms exceeded":"timeout exceeded",j=f.transitional||u.transitional;f.timeoutErrorMessage&&(q=f.timeoutErrorMessage),$(a(q,f,j.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",d)),d=null},e.isStandardBrowserEnv()){var N=(f.withCredentials||s(D))&&f.xsrfCookieName?n.read(f.xsrfCookieName):void 0;N&&(B[f.xsrfHeaderName]=N)}"setRequestHeader"in d&&e.forEach(B,function(q,j){typeof h>"u"&&j.toLowerCase()==="content-type"?delete B[j]:d.setRequestHeader(j,q)}),e.isUndefined(f.withCredentials)||(d.withCredentials=!!f.withCredentials),w&&w!=="json"&&(d.responseType=f.responseType),typeof f.onDownloadProgress=="function"&&d.addEventListener("progress",f.onDownloadProgress),typeof f.onUploadProgress=="function"&&d.upload&&d.upload.addEventListener("progress",f.onUploadProgress),(f.cancelToken||f.signal)&&(b=function(S){!d||($(!S||S&&S.type?new c("canceled"):S),d.abort(),d=null)},f.cancelToken&&f.cancelToken.subscribe(b),f.signal&&(f.signal.aborted?b():f.signal.addEventListener("abort",b))),h||(h=null),d.send(h)})},xhr}var defaults_1,hasRequiredDefaults;function requireDefaults(){if(hasRequiredDefaults)return defaults_1;hasRequiredDefaults=1;var e=utils$8,t=normalizeHeaderName,n=enhanceError,i={"Content-Type":"application/x-www-form-urlencoded"};function r(u,c){!e.isUndefined(u)&&e.isUndefined(u["Content-Type"])&&(u["Content-Type"]=c)}function o(){var u;return(typeof XMLHttpRequest<"u"||typeof process<"u"&&Object.prototype.toString.call(process)==="[object process]")&&(u=requireXhr()),u}function s(u,c,l){if(e.isString(u))try{return(c||JSON.parse)(u),e.trim(u)}catch(f){if(f.name!=="SyntaxError")throw f}return(l||JSON.stringify)(u)}var a={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:o(),transformRequest:[function(c,l){return t(l,"Accept"),t(l,"Content-Type"),e.isFormData(c)||e.isArrayBuffer(c)||e.isBuffer(c)||e.isStream(c)||e.isFile(c)||e.isBlob(c)?c:e.isArrayBufferView(c)?c.buffer:e.isURLSearchParams(c)?(r(l,"application/x-www-form-urlencoded;charset=utf-8"),c.toString()):e.isObject(c)||l&&l["Content-Type"]==="application/json"?(r(l,"application/json"),s(c)):c}],transformResponse:[function(c){var l=this.transitional||a.transitional,f=l&&l.silentJSONParsing,C=l&&l.forcedJSONParsing,g=!f&&this.responseType==="json";if(g||C&&e.isString(c)&&c.length)try{return JSON.parse(c)}catch($){if(g)throw $.name==="SyntaxError"?n($,this,"E_JSON_PARSE"):$}return c}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(c){return c>=200&&c<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};return e.forEach(["delete","get","head"],function(c){a.headers[c]={}}),e.forEach(["post","put","patch"],function(c){a.headers[c]=e.merge(i)}),defaults_1=a,defaults_1}var utils$4=utils$8,defaults$2=requireDefaults(),transformData$1=function(t,n,i){var r=this||defaults$2;return utils$4.forEach(i,function(s){t=s.call(r,t,n)}),t},isCancel$1,hasRequiredIsCancel;function requireIsCancel(){return hasRequiredIsCancel||(hasRequiredIsCancel=1,isCancel$1=function(t){return!!(t&&t.__CANCEL__)}),isCancel$1}var utils$3=utils$8,transformData=transformData$1,isCancel=requireIsCancel(),defaults$1=requireDefaults(),Cancel=requireCancel();function throwIfCancellationRequested(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Cancel("canceled")}var dispatchRequest$1=function(t){throwIfCancellationRequested(t),t.headers=t.headers||{},t.data=transformData.call(t,t.data,t.headers,t.transformRequest),t.headers=utils$3.merge(t.headers.common||{},t.headers[t.method]||{},t.headers),utils$3.forEach(["delete","get","head","post","put","patch","common"],function(r){delete t.headers[r]});var n=t.adapter||defaults$1.adapter;return n(t).then(function(r){return throwIfCancellationRequested(t),r.data=transformData.call(t,r.data,r.headers,t.transformResponse),r},function(r){return isCancel(r)||(throwIfCancellationRequested(t),r&&r.response&&(r.response.data=transformData.call(t,r.response.data,r.response.headers,t.transformResponse))),Promise.reject(r)})},utils$2=utils$8,mergeConfig$2=function(t,n){n=n||{};var i={};function r(l,f){return utils$2.isPlainObject(l)&&utils$2.isPlainObject(f)?utils$2.merge(l,f):utils$2.isPlainObject(f)?utils$2.merge({},f):utils$2.isArray(f)?f.slice():f}function o(l){if(utils$2.isUndefined(n[l])){if(!utils$2.isUndefined(t[l]))return r(void 0,t[l])}else return r(t[l],n[l])}function s(l){if(!utils$2.isUndefined(n[l]))return r(void 0,n[l])}function a(l){if(utils$2.isUndefined(n[l])){if(!utils$2.isUndefined(t[l]))return r(void 0,t[l])}else return r(void 0,n[l])}function u(l){if(l in n)return r(t[l],n[l]);if(l in t)return r(void 0,t[l])}var c={url:s,method:s,data:s,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:u};return utils$2.forEach(Object.keys(t).concat(Object.keys(n)),function(f){var C=c[f]||o,g=C(f);utils$2.isUndefined(g)&&C!==u||(i[f]=g)}),i},data,hasRequiredData;function requireData(){return hasRequiredData||(hasRequiredData=1,data={version:"0.25.0"}),data}var VERSION=requireData().version,validators$1={};["object","boolean","number","function","string","symbol"].forEach(function(e,t){validators$1[e]=function(i){return typeof i===e||"a"+(t<1?"n ":" ")+e}});var deprecatedWarnings={};validators$1.transitional=function(t,n,i){function r(o,s){return"[Axios v"+VERSION+"] Transitional option '"+o+"'"+s+(i?". "+i:"")}return function(o,s,a){if(t===!1)throw new Error(r(s," has been removed"+(n?" in "+n:"")));return n&&!deprecatedWarnings[s]&&(deprecatedWarnings[s]=!0,console.warn(r(s," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(o,s,a):!0}};function assertOptions(e,t,n){if(typeof e!="object")throw new TypeError("options must be an object");for(var i=Object.keys(e),r=i.length;r-- >0;){var o=i[r],s=t[o];if(s){var a=e[o],u=a===void 0||s(a,o,e);if(u!==!0)throw new TypeError("option "+o+" must be "+u);continue}if(n!==!0)throw Error("Unknown option "+o)}}var validator$1={assertOptions,validators:validators$1},utils$1=utils$8,buildURL=buildURL$1,InterceptorManager=InterceptorManager_1,dispatchRequest=dispatchRequest$1,mergeConfig$1=mergeConfig$2,validator=validator$1,validators=validator.validators;function Axios$1(e){this.defaults=e,this.interceptors={request:new InterceptorManager,response:new InterceptorManager}}Axios$1.prototype.request=function(t,n){if(typeof t=="string"?(n=n||{},n.url=t):n=t||{},!n.url)throw new Error("Provided config url is not valid");n=mergeConfig$1(this.defaults,n),n.method?n.method=n.method.toLowerCase():this.defaults.method?n.method=this.defaults.method.toLowerCase():n.method="get";var i=n.transitional;i!==void 0&&validator.assertOptions(i,{silentJSONParsing:validators.transitional(validators.boolean),forcedJSONParsing:validators.transitional(validators.boolean),clarifyTimeoutError:validators.transitional(validators.boolean)},!1);var r=[],o=!0;this.interceptors.request.forEach(function(g){typeof g.runWhen=="function"&&g.runWhen(n)===!1||(o=o&&g.synchronous,r.unshift(g.fulfilled,g.rejected))});var s=[];this.interceptors.response.forEach(function(g){s.push(g.fulfilled,g.rejected)});var a;if(!o){var u=[dispatchRequest,void 0];for(Array.prototype.unshift.apply(u,r),u=u.concat(s),a=Promise.resolve(n);u.length;)a=a.then(u.shift(),u.shift());return a}for(var c=n;r.length;){var l=r.shift(),f=r.shift();try{c=l(c)}catch(C){f(C);break}}try{a=dispatchRequest(c)}catch(C){return Promise.reject(C)}for(;s.length;)a=a.then(s.shift(),s.shift());return a};Axios$1.prototype.getUri=function(t){if(!t.url)throw new Error("Provided config url is not valid");return t=mergeConfig$1(this.defaults,t),buildURL(t.url,t.params,t.paramsSerializer).replace(/^\?/,"")};utils$1.forEach(["delete","get","head","options"],function(t){Axios$1.prototype[t]=function(n,i){return this.request(mergeConfig$1(i||{},{method:t,url:n,data:(i||{}).data}))}});utils$1.forEach(["post","put","patch"],function(t){Axios$1.prototype[t]=function(n,i,r){return this.request(mergeConfig$1(r||{},{method:t,url:n,data:i}))}});var Axios_1=Axios$1,CancelToken_1,hasRequiredCancelToken;function requireCancelToken(){if(hasRequiredCancelToken)return CancelToken_1;hasRequiredCancelToken=1;var e=requireCancel();function t(n){if(typeof n!="function")throw new TypeError("executor must be a function.");var i;this.promise=new Promise(function(s){i=s});var r=this;this.promise.then(function(o){if(!!r._listeners){var s,a=r._listeners.length;for(s=0;s<a;s++)r._listeners[s](o);r._listeners=null}}),this.promise.then=function(o){var s,a=new Promise(function(u){r.subscribe(u),s=u}).then(o);return a.cancel=function(){r.unsubscribe(s)},a},n(function(s){r.reason||(r.reason=new e(s),i(r.reason))})}return t.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},t.prototype.subscribe=function(i){if(this.reason){i(this.reason);return}this._listeners?this._listeners.push(i):this._listeners=[i]},t.prototype.unsubscribe=function(i){if(!!this._listeners){var r=this._listeners.indexOf(i);r!==-1&&this._listeners.splice(r,1)}},t.source=function(){var i,r=new t(function(s){i=s});return{token:r,cancel:i}},CancelToken_1=t,CancelToken_1}var spread,hasRequiredSpread;function requireSpread(){return hasRequiredSpread||(hasRequiredSpread=1,spread=function(t){return function(i){return t.apply(null,i)}}),spread}var isAxiosError,hasRequiredIsAxiosError;function requireIsAxiosError(){if(hasRequiredIsAxiosError)return isAxiosError;hasRequiredIsAxiosError=1;var e=utils$8;return isAxiosError=function(n){return e.isObject(n)&&n.isAxiosError===!0},isAxiosError}var utils=utils$8,bind=bind$2,Axios=Axios_1,mergeConfig=mergeConfig$2,defaults=requireDefaults();function createInstance(e){var t=new Axios(e),n=bind(Axios.prototype.request,t);return utils.extend(n,Axios.prototype,t),utils.extend(n,t),n.create=function(r){return createInstance(mergeConfig(e,r))},n}var axios$1=createInstance(defaults);axios$1.Axios=Axios;axios$1.Cancel=requireCancel();axios$1.CancelToken=requireCancelToken();axios$1.isCancel=requireIsCancel();axios$1.VERSION=requireData().version;axios$1.all=function(t){return Promise.all(t)};axios$1.spread=requireSpread();axios$1.isAxiosError=requireIsAxiosError();axios$2.exports=axios$1;axios$2.exports.default=axios$1;(function(e){e.exports=axios$2.exports})(axios$3);const axios=getDefaultExportFromCjs(axios$3.exports),service=axios.create({withCredentials:!0,timeout:7e3}),requestHandler=function(e){return e},responseHandler=function(e){return e};service.interceptors.request.use(requestHandler);service.interceptors.response.use(responseHandler);const request={install(e){e.provide("request",service)}},_sfc_main=Vue.defineComponent({name:"App",setup(){var n;const e=Vue.inject("app");return{pageConfig:Vue.reactive(((n=e==null?void 0:e.page)==null?void 0:n.data)||{})}}});function _sfc_render(e,t,n,i,r,o){const s=Vue.resolveComponent("magic-ui-page");return Vue.openBlock(),Vue.createBlock(s,{config:e.pageConfig},null,8,["config"])}const AppComponent=_export_sfc(_sfc_main,[["render",_sfc_render],["__file","/data/magic/tmagic-editor/runtime/vue3/page/App.vue"]]),getLocalConfig=()=>{const configStr=localStorage.getItem("magicDSL");if(!configStr)return[];try{return[eval(`(${configStr})`)]}catch(e){return[]}},magicApp=Vue.createApp(AppComponent);magicApp.use(request);Object.values(components).forEach(e=>{magicApp.component(e.name,e)});Object.values(plugins).forEach(e=>{magicApp.use(e)});const app=new App({config:((getUrlParam("localPreview")?getLocalConfig():window.magicDSL)||[])[0]||{},curPage:getUrlParam("page")});magicApp.config.globalProperties.app=app;magicApp.provide("app",app);magicApp.mount("#app");export{__vite_legacy_guard};
//# sourceMappingURL=index.30b4791d.js.map