index-23f89c82.js 94 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. import{s as oe,F as Zn}from"./forgotPassword-fb995d55.js";import{d as Jn}from"./teacherIcon-b8e3946d.js";import{m as Yn,f as Qn}from"./maleIcon-3fe0e51e.js";import{co as me,cp as eo,d as xe,cq as to,bq as Ae,r as Q,aQ as no,as as K,T as bt,cr as oo,cs as ro,ct as ao,cu as io,cv as so,cw as lo,cx as co,cy as uo,ay as yt,$ as Z,cz as ot,cA as fo,cB as Wt,cC as ho,cD as go,l as po,cE as Rt,cF as it,cG as vo,cH as mo,cI as bo,bR as fn,cJ as hn,cK as gn,cn as yo,cL as wo,cM as Co,cN as pn,cO as xo,cP as ko,cQ as rt,cR as Xt,cS as ut,cT as Re,cU as So,cV as vn,ci as To,cW as Zt,cX as Po,cY as vt,aB as Ao,w as Dt,b0 as Bo,cZ as Io,c_ as Mo,c$ as Ro,d0 as Do,d1 as Lo,d2 as Eo,d3 as Jt,d4 as Fo,d5 as _o,d6 as No,d7 as He,aK as Oo,cc as tt,b as Nt,c as wt,e as qe,q as mn,f as y,o as mt,k as ae,N as Ot,ca as $o,cb as Pt,g as Te,h as lt,C as Uo,B as Fe,j as pe,y as Lt,d8 as Ko,a3 as zo,a_ as jo,a4 as bn,z as Yt,d9 as Ho,F as Vo,bW as qo,x as Go,A as Wo,a as Xo,m as Zo,n as Qt}from"./index-b5a12e99.js";import{U as yn}from"./index-94927417.js";import"./api-ac36752b.js";const Jo=me("base-menu-mask",`
  2. position: absolute;
  3. left: 0;
  4. right: 0;
  5. top: 0;
  6. bottom: 0;
  7. display: flex;
  8. align-items: center;
  9. justify-content: center;
  10. text-align: center;
  11. padding: 14px;
  12. overflow: hidden;
  13. `,[eo()]),Yo=xe({name:"BaseMenuMask",props:{clsPrefix:{type:String,required:!0}},setup(o){to("-base-menu-mask",Jo,Ae(o,"clsPrefix"));const e=Q(null);let t=null;const n=Q(!1);return no(()=>{t!==null&&window.clearTimeout(t)}),Object.assign({message:e,show:n},{showOnce(a,i=1500){t&&window.clearTimeout(t),n.value=!0,e.value=a,t=window.setTimeout(()=>{n.value=!1,e.value=null},i)}})},render(){return K(bt,{name:"fade-in-transition"},{default:()=>this.show?K("div",{class:`${this.clsPrefix}-base-menu-mask`},this.message):null})}}),Qo=o=>{const{borderRadius:e,boxShadow2:t,popoverColor:n,textColor2:r,textColor3:a,primaryColor:i,textColorDisabled:s,dividerColor:l,hoverColor:c,fontSizeMedium:f,heightMedium:h}=o;return{menuBorderRadius:e,menuColor:n,menuBoxShadow:t,menuDividerColor:l,menuHeight:"calc(var(--n-option-height) * 6.6)",optionArrowColor:a,optionHeight:h,optionFontSize:f,optionColorHover:c,optionTextColor:r,optionTextColorActive:i,optionTextColorDisabled:s,optionCheckMarkColor:i,loadingColor:i,columnWidth:"180px"}},er=oo({name:"Cascader",common:ro,peers:{InternalSelectMenu:ao,InternalSelection:io,Scrollbar:so,Checkbox:lo,Empty:co},self:Qo}),tr=er;function dt(o){return o?o.map(e=>e.rawNode):null}function nr(o,e,t,n){const r=[],a=[];function i(s){for(const l of s){if(l.disabled)continue;const{rawNode:c}=l;a.push(c),(l.isLeaf||!e)&&r.push({label:Et(l,n,t),value:l.key,rawNode:l.rawNode,path:Array.from(a)}),!l.isLeaf&&l.children&&i(l.children),a.pop()}}return i(o),r}function Et(o,e,t){const n=[];for(;o;)n.push(o.rawNode[t]),o=o.parent;return n.reverse().join(e)}const ct=uo("n-cascader"),en=xe({name:"NCascaderOption",props:{tmNode:{type:Object,required:!0}},setup(o){const{expandTriggerRef:e,remoteRef:t,multipleRef:n,mergedValueRef:r,checkedKeysRef:a,indeterminateKeysRef:i,hoverKeyPathRef:s,keyboardKeyRef:l,loadingKeySetRef:c,cascadeRef:f,mergedCheckStrategyRef:h,onLoadRef:m,mergedClsPrefixRef:T,mergedThemeRef:I,labelFieldRef:D,showCheckboxRef:L,updateHoverKey:g,updateKeyboardKey:b,addLoadingKey:P,deleteLoadingKey:p,closeMenu:k,doCheck:C,doUncheck:A,renderLabelRef:R}=yt(ct),v=Z(()=>o.tmNode.key),w=Z(()=>{const{value:de}=e,{value:Se}=t;return!Se&&de==="hover"}),u=Z(()=>{if(w.value)return le}),E=Z(()=>{if(w.value)return $e}),x=ot(()=>{const{value:de}=n;return de?a.value.includes(v.value):r.value===v.value}),O=ot(()=>n.value?i.value.includes(v.value):!1),S=ot(()=>s.value.includes(v.value)),he=ot(()=>{const{value:de}=l;return de===null?!1:de===v.value}),V=ot(()=>t.value?c.value.has(v.value):!1),ue=Z(()=>o.tmNode.isLeaf),re=Z(()=>o.tmNode.disabled),G=Z(()=>o.tmNode.rawNode[D.value]),se=Z(()=>o.tmNode.shallowLoaded);function ke(de){if(re.value)return;const{value:Se}=t,{value:Ue}=c,{value:Xe}=m,{value:M}=v,{value:_}=ue,{value:F}=se;Rt(de,"checkbox")||(Se&&!F&&!Ue.has(M)&&Xe&&(P(M),Xe(o.tmNode.rawNode).then(()=>{p(M)}).catch(()=>{p(M)})),g(M),b(M)),_&&Me()}function le(){if(!w.value||re.value)return;const{value:de}=v;g(de),b(de)}function $e(){w.value&&le()}function _e(){const{value:de}=ue;de||Me()}function Me(){const{value:de}=n,{value:Se}=v;de?O.value||x.value?A(Se):C(Se):(C(Se),k(!0))}return{checkStrategy:h,multiple:n,cascade:f,checked:x,indeterminate:O,hoverPending:S,keyboardPending:he,isLoading:V,showCheckbox:L,isLeaf:ue,disabled:re,label:G,mergedClsPrefix:T,mergedTheme:I,handleClick:ke,handleCheckboxUpdateValue:_e,mergedHandleMouseEnter:u,mergedHandleMouseMove:E,renderLabel:R}},render(){const{mergedClsPrefix:o,renderLabel:e}=this;return K("div",{class:[`${o}-cascader-option`,{[`${o}-cascader-option--pending`]:this.keyboardPending||this.hoverPending,[`${o}-cascader-option--disabled`]:this.disabled,[`${o}-cascader-option--show-prefix`]:this.showCheckbox}],onMouseenter:this.mergedHandleMouseEnter,onMousemove:this.mergedHandleMouseMove,onClick:this.handleClick},this.showCheckbox?K("div",{class:`${o}-cascader-option__prefix`},K(po,{focusable:!1,"data-checkbox":!0,disabled:this.disabled,checked:this.checked,indeterminate:this.indeterminate,theme:this.mergedTheme.peers.Checkbox,themeOverrides:this.mergedTheme.peerOverrides.Checkbox,onUpdateChecked:this.handleCheckboxUpdateValue})):null,K("span",{class:`${o}-cascader-option__label`},e?e(this.tmNode.rawNode,this.checked):this.label),K("div",{class:`${o}-cascader-option__suffix`},K("div",{class:`${o}-cascader-option-icon-placeholder`},this.isLeaf?this.checkStrategy==="child"&&!(this.multiple&&this.cascade)?K(bt,{name:"fade-in-scale-up-transition"},{default:()=>this.checked?K(Wt,{clsPrefix:o,class:`${o}-cascader-option-icon ${o}-cascader-option-icon--checkmark`},{default:()=>K(go,null)}):null}):null:K(fo,{clsPrefix:o,scale:.85,strokeWidth:24,show:this.isLoading,class:`${o}-cascader-option-icon`},{default:()=>K(Wt,{clsPrefix:o,key:"arrow",class:`${o}-cascader-option-icon ${o}-cascader-option-icon--arrow`},{default:()=>K(ho,null)})}))))}}),or=xe({name:"CascaderSubmenu",props:{depth:{type:Number,required:!0},tmNodes:{type:Array,required:!0}},setup(){const{virtualScrollRef:o,mergedClsPrefixRef:e,mergedThemeRef:t,optionHeightRef:n}=yt(ct),r=Q(null),a=Q(null),i={scroll(s,l){var c,f;o.value?(c=a.value)===null||c===void 0||c.scrollTo({index:s}):(f=r.value)===null||f===void 0||f.scrollTo({index:s,elSize:l})}};return Object.assign({mergedClsPrefix:e,mergedTheme:t,scrollbarInstRef:r,vlInstRef:a,virtualScroll:o,itemSize:Z(()=>it(n.value)),handleVlScroll:()=>{var s;(s=r.value)===null||s===void 0||s.sync()},getVlContainer:()=>{var s;return(s=a.value)===null||s===void 0?void 0:s.listElRef},getVlContent:()=>{var s;return(s=a.value)===null||s===void 0?void 0:s.itemsElRef}},i)},render(){const{mergedClsPrefix:o,mergedTheme:e,virtualScroll:t}=this;return K("div",{class:[t&&`${o}-cascader-submenu--virtual`,`${o}-cascader-submenu`]},K(vo,{ref:"scrollbarInstRef",theme:e.peers.Scrollbar,themeOverrides:e.peerOverrides.Scrollbar,container:t?this.getVlContainer:void 0,content:t?this.getVlContent:void 0},{default:()=>t?K(mo,{items:this.tmNodes,itemSize:this.itemSize,onScroll:this.handleVlScroll,showScrollbar:!1,ref:"vlInstRef"},{default:({item:n})=>K(en,{key:n.key,tmNode:n})}):this.tmNodes.map(n=>K(en,{key:n.key,tmNode:n}))}))}}),rr=xe({name:"NCascaderMenu",props:{value:[String,Number,Array],placement:{type:String,default:"bottom-start"},show:Boolean,menuModel:{type:Array,required:!0},loading:Boolean,onFocus:{type:Function,required:!0},onBlur:{type:Function,required:!0},onKeydown:{type:Function,required:!0},onMousedown:{type:Function,required:!0},onTabout:{type:Function,required:!0}},setup(o){const{localeRef:e,isMountedRef:t,mergedClsPrefixRef:n,syncCascaderMenuPosition:r,handleCascaderMenuClickOutside:a,mergedThemeRef:i}=yt(ct),s=[],l=Q(null),c=Q(null);function f(){r()}bo(c,f);function h(L){var g;const{value:{loadingRequiredMessage:b}}=e;(g=l.value)===null||g===void 0||g.showOnce(b(L))}function m(L){a(L)}function T(L){const{value:g}=c;g&&(g.contains(L.relatedTarget)||o.onFocus(L))}function I(L){const{value:g}=c;g&&(g.contains(L.relatedTarget)||o.onBlur(L))}return Object.assign({isMounted:t,mergedClsPrefix:n,selfElRef:c,submenuInstRefs:s,maskInstRef:l,mergedTheme:i,handleFocusin:T,handleFocusout:I,handleClickOutside:m},{scroll(L,g,b){const P=s[L];P&&P.scroll(g,b)},showErrorMessage:h})},render(){const{submenuInstRefs:o,mergedClsPrefix:e,mergedTheme:t}=this;return K(bt,{name:"fade-in-scale-up-transition",appear:this.isMounted},{default:()=>this.show?fn(K("div",{tabindex:"0",ref:"selfElRef",class:`${e}-cascader-menu`,onMousedown:this.onMousedown,onFocusin:this.handleFocusin,onFocusout:this.handleFocusout,onKeydown:this.onKeydown},this.menuModel[0].length?K("div",{class:`${e}-cascader-submenu-wrapper`},this.menuModel.map((n,r)=>K(or,{ref:a=>{a&&(o[r]=a)},key:r,tmNodes:n,depth:r+1})),K(Yo,{clsPrefix:e,ref:"maskInstRef"})):K("div",{class:`${e}-cascader-menu__empty`},gn(this.$slots.empty,()=>[K(yo,{theme:t.peers.Empty,themeOverrides:t.peerOverrides.Empty})])),wo(this.$slots.action,n=>n&&K("div",{class:`${e}-cascader-menu-action`,"data-action":!0},n)),K(Co,{onFocus:this.onTabout})),[[hn,this.handleClickOutside,void 0,{capture:!0}]]):null})}}),ar=xe({name:"NCascaderSelectMenu",props:{value:{type:[String,Number,Array],default:null},show:Boolean,pattern:{type:String,default:""},multiple:Boolean,tmNodes:{type:Array,default:()=>[]},filter:Function,labelField:{type:String,required:!0},separator:{type:String,required:!0}},setup(o){const{isMountedRef:e,mergedValueRef:t,mergedClsPrefixRef:n,mergedThemeRef:r,mergedCheckStrategyRef:a,slots:i,syncSelectMenuPosition:s,closeMenu:l,handleSelectMenuClickOutside:c,doUncheck:f,doCheck:h,clearPattern:m}=yt(ct),T=Q(null),I=Z(()=>nr(o.tmNodes,a.value==="child",o.labelField,o.separator)),D=Z(()=>{const{filter:w}=o;if(w)return w;const{labelField:u}=o;return(E,x,O)=>O.some(S=>S[u]&&~S[u].indexOf(E))}),L=Z(()=>{const{pattern:w}=o,{value:u}=D;return(w?I.value.filter(E=>u(w,E.rawNode,E.path)):I.value).map(E=>({value:E.value,label:E.label}))}),g=Z(()=>pn(L.value,xo("value","children")));function b(){s()}function P(w){p(w)}function p(w){if(o.multiple){const{value:u}=t;Array.isArray(u)?u.includes(w.key)?f(w.key):h(w.key):u===null&&h(w.key),m()}else h(w.key),l(!0)}function k(){var w;(w=T.value)===null||w===void 0||w.prev()}function C(){var w;(w=T.value)===null||w===void 0||w.next()}function A(){var w;if(T){const u=(w=T.value)===null||w===void 0?void 0:w.getPendingTmNode();return u&&p(u),!0}return!1}function R(w){c(w)}return Object.assign({isMounted:e,mergedTheme:r,mergedClsPrefix:n,menuInstRef:T,selectTreeMate:g,handleResize:b,handleToggle:P,handleClickOutside:R,cascaderSlots:i},{prev:k,next:C,enter:A})},render(){const{mergedClsPrefix:o,isMounted:e,mergedTheme:t,cascaderSlots:n}=this;return K(bt,{name:"fade-in-scale-up-transition",appear:e},{default:()=>this.show?fn(K(ko,{ref:"menuInstRef",onResize:this.handleResize,clsPrefix:o,class:`${o}-cascader-menu`,autoPending:!0,themeOverrides:t.peerOverrides.InternalSelectMenu,theme:t.peers.InternalSelectMenu,treeMate:this.selectTreeMate,multiple:this.multiple,value:this.value,onToggle:this.handleToggle},{empty:()=>gn(n["not-found"],()=>[])}),[[hn,this.handleClickOutside,void 0,{capture:!0}]]):null})}}),ir=rt([me("cascader-menu",`
  14. outline: none;
  15. position: relative;
  16. margin: 4px 0;
  17. display: flex;
  18. flex-flow: column nowrap;
  19. border-radius: var(--n-menu-border-radius);
  20. overflow: hidden;
  21. box-shadow: var(--n-menu-box-shadow);
  22. color: var(--n-option-text-color);
  23. background-color: var(--n-menu-color);
  24. `,[Xt({transformOrigin:"inherit",duration:"0.2s"}),ut("empty",`
  25. display: flex;
  26. padding: 12px 32px;
  27. flex: 1;
  28. justify-content: center;
  29. `),me("scrollbar",{width:"100%"}),me("base-menu-mask",{backgroundColor:"var(--n-menu-mask-color)"}),me("base-loading",{color:"var(--n-loading-color)"}),me("cascader-submenu-wrapper",`
  30. position: relative;
  31. display: flex;
  32. flex-wrap: nowrap;
  33. `),me("cascader-submenu",`
  34. height: var(--n-menu-height);
  35. min-width: var(--n-column-width);
  36. position: relative;
  37. `,[Re("virtual",`
  38. width: var(--n-column-width);
  39. `),me("scrollbar-content",{position:"relative"}),rt("&:first-child",`
  40. border-top-left-radius: var(--n-menu-border-radius);
  41. border-bottom-left-radius: var(--n-menu-border-radius);
  42. `),rt("&:last-child",`
  43. border-top-right-radius: var(--n-menu-border-radius);
  44. border-bottom-right-radius: var(--n-menu-border-radius);
  45. `),rt("&:not(:first-child)",`
  46. border-left: 1px solid var(--n-menu-divider-color);
  47. `)]),me("cascader-menu-action",`
  48. box-sizing: border-box;
  49. padding: 8px;
  50. border-top: 1px solid var(--n-menu-divider-color);
  51. `),me("cascader-option",`
  52. height: var(--n-option-height);
  53. line-height: var(--n-option-height);
  54. font-size: var(--n-option-font-size);
  55. padding: 0 0 0 18px;
  56. box-sizing: border-box;
  57. min-width: 182px;
  58. background-color: #0000;
  59. display: flex;
  60. align-items: center;
  61. white-space: nowrap;
  62. position: relative;
  63. cursor: pointer;
  64. transition:
  65. background-color .2s var(--n-bezier),
  66. color 0.2s var(--n-bezier);
  67. `,[Re("show-prefix",{paddingLeft:0}),ut("label",`
  68. flex: 1 0 0;
  69. overflow: hidden;
  70. text-overflow: ellipsis;
  71. `),ut("prefix",{width:"32px",display:"flex",alignItems:"center",justifyContent:"center"}),ut("suffix",{width:"32px",display:"flex",alignItems:"center",justifyContent:"center"}),me("cascader-option-icon-placeholder",{lineHeight:0,position:"relative",width:"16px",height:"16px",fontSize:"16px"},[me("cascader-option-icon",[Re("checkmark",{color:"var(--n-option-check-mark-color)"},[Xt({originalTransition:"background-color .3s var(--n-bezier), box-shadow .3s var(--n-bezier)"})]),Re("arrow",{color:"var(--n-option-arrow-color)"})])]),Re("selected",{color:"var(--n-option-text-color-active)"}),Re("active",{color:"var(--n-option-text-color-active)",backgroundColor:"var(--n-option-color-hover)"}),Re("pending",{backgroundColor:"var(--n-option-color-hover)"}),rt("&:hover",{backgroundColor:"var(--n-option-color-hover)"}),Re("disabled",`
  72. color: var(--n-option-text-color-disabled);
  73. background-color: #0000;
  74. cursor: not-allowed;
  75. `,[me("cascader-option-icon",[Re("arrow",{color:"var(--n-option-text-color-disabled)"})])])])]),me("cascader",`
  76. z-index: auto;
  77. position: relative;
  78. width: 100%;
  79. `)]),sr=Object.assign(Object.assign({},vn.props),{allowCheckingNotLoaded:Boolean,to:vt.propTo,bordered:{type:Boolean,default:void 0},options:{type:Array,default:()=>[]},value:[String,Number,Array],defaultValue:{type:[String,Number,Array],default:null},placeholder:String,multiple:Boolean,size:String,filterable:Boolean,disabled:{type:Boolean,default:void 0},disabledField:{type:String,default:"disabled"},expandTrigger:{type:String,default:"click"},clearable:Boolean,clearFilterAfterSelect:{type:Boolean,default:!0},remote:Boolean,onLoad:Function,separator:{type:String,default:" / "},filter:Function,placement:{type:String,default:"bottom-start"},cascade:{type:Boolean,default:!0},leafOnly:Boolean,showPath:{type:Boolean,default:!0},show:{type:Boolean,default:void 0},maxTagCount:[String,Number],menuProps:Object,filterMenuProps:Object,virtualScroll:{type:Boolean,default:!0},checkStrategy:{type:String,default:"all"},valueField:{type:String,default:"value"},labelField:{type:String,default:"label"},childrenField:{type:String,default:"children"},renderLabel:Function,status:String,"onUpdate:value":[Function,Array],onUpdateValue:[Function,Array],"onUpdate:show":[Function,Array],onUpdateShow:[Function,Array],onBlur:Function,onFocus:Function,onChange:[Function,Array]}),$t=xe({name:"Cascader",props:sr,setup(o,{slots:e}){const{mergedBorderedRef:t,mergedClsPrefixRef:n,namespaceRef:r,inlineThemeDisabled:a}=So(o),i=vn("Cascader","-cascader",ir,tr,o,n),{localeRef:s}=To("Cascader"),l=Q(o.defaultValue),c=Z(()=>o.value),f=Zt(c,l),h=Z(()=>o.leafOnly?"child":o.checkStrategy),m=Q(""),T=Po(o),{mergedSizeRef:I,mergedDisabledRef:D,mergedStatusRef:L}=T,g=Q(null),b=Q(null),P=Q(null),p=Q(null),k=Q(null),C=Q(new Set),A=Q(null),R=Q(null),v=vt(o),w=Q(!1),u=d=>{C.value.add(d)},E=d=>{C.value.delete(d)},x=Z(()=>{const{valueField:d,childrenField:B,disabledField:N}=o;return pn(o.options,{getDisabled(j){return j[N]},getKey(j){return j[d]},getChildren(j){return j[B]}})}),O=Z(()=>{const{cascade:d,multiple:B}=o;return B&&Array.isArray(f.value)?x.value.getCheckedKeys(f.value,{cascade:d,allowNotLoaded:o.allowCheckingNotLoaded}):{checkedKeys:[],indeterminateKeys:[]}}),S=Z(()=>O.value.checkedKeys),he=Z(()=>O.value.indeterminateKeys),V=Z(()=>{const{treeNodePath:d,treeNode:B}=x.value.getPath(k.value);let N;return B===null?N=[x.value.treeNodes]:(N=d.map(j=>j.siblings),!B.isLeaf&&!C.value.has(B.key)&&B.children&&N.push(B.children)),N}),ue=Z(()=>{const{keyPath:d}=x.value.getPath(k.value);return d}),re=Z(()=>i.value.self.optionHeight);Ao(o.options)&&Dt(o.options,(d,B)=>{d!==B&&(k.value=null,p.value=null)});function G(d){const{onUpdateShow:B,"onUpdate:show":N}=o;B&&He(B,d),N&&He(N,d),Ue.value=d}function se(d,B,N){const{onUpdateValue:j,"onUpdate:value":$,onChange:te}=o,{nTriggerFormInput:U,nTriggerFormChange:ne}=T;j&&He(j,d,B,N),$&&He($,d,B,N),te&&He(te,d,B,N),l.value=d,U(),ne()}function ke(d){p.value=d}function le(d){k.value=d}function $e(d){const{value:{getNode:B}}=x;return d.map(N=>{var j;return((j=B(N))===null||j===void 0?void 0:j.rawNode)||null})}function _e(d){var B;const{cascade:N,multiple:j,filterable:$}=o,{value:{check:te,getNode:U,getPath:ne}}=x;if(j)try{const{checkedKeys:H}=te(d,O.value.checkedKeys,{cascade:N,checkStrategy:h.value,allowNotLoaded:o.allowCheckingNotLoaded});se(H,$e(H),H.map(Ye=>{var nt;return dt((nt=ne(Ye))===null||nt===void 0?void 0:nt.treeNodePath)})),$&&X(),p.value=d,k.value=d}catch(H){if(H instanceof Fo){if(g.value){const Ye=U(d);Ye!==null&&g.value.showErrorMessage(Ye.rawNode[o.labelField])}}else throw H}else if(h.value==="child"){const H=U(d);if(H!=null&&H.isLeaf)se(d,H.rawNode,dt(ne(d).treeNodePath));else return!1}else{const H=U(d);se(d,(H==null?void 0:H.rawNode)||null,dt((B=ne(d))===null||B===void 0?void 0:B.treeNodePath))}return!0}function Me(d){const{cascade:B,multiple:N}=o;if(N){const{value:{uncheck:j,getNode:$,getPath:te}}=x,{checkedKeys:U}=j(d,O.value.checkedKeys,{cascade:B,checkStrategy:h.value,allowNotLoaded:o.allowCheckingNotLoaded});se(U,U.map(ne=>{var H;return((H=$(ne))===null||H===void 0?void 0:H.rawNode)||null}),U.map(ne=>{var H;return dt((H=te(ne))===null||H===void 0?void 0:H.treeNodePath)})),p.value=d,k.value=d}}const de=Z(()=>{if(o.multiple){const{showPath:d,separator:B,labelField:N,cascade:j}=o,{getCheckedKeys:$,getNode:te}=x.value;return $(S.value,{cascade:j,checkStrategy:h.value,allowNotLoaded:o.allowCheckingNotLoaded}).checkedKeys.map(ne=>{const H=te(ne);return H===null?{label:String(ne),value:ne}:{label:d?Et(H,B,N):H.rawNode[N],value:H.key}})}else return[]}),Se=Z(()=>{const{multiple:d,showPath:B,separator:N,labelField:j}=o,{value:$}=f;if(!d&&!Array.isArray($)){const{getNode:te}=x.value;if($===null)return null;const U=te($);return U===null?{label:String($),value:$}:{label:B?Et(U,N,j):U.rawNode[j],value:U.key}}else return null}),Ue=Q(!1),Xe=Ae(o,"show"),M=Zt(Xe,Ue),_=Z(()=>{const{placeholder:d}=o;return d!==void 0?d:s.value.placeholder}),F=Z(()=>!!(o.filterable&&m.value));Dt(M,d=>{if(!d||o.multiple)return;const{value:B}=f;!Array.isArray(B)&&B!==null?(p.value=B,k.value=B,Oo(()=>{var N;if(!M.value)return;const{value:j}=k;if(f.value!==null){const $=x.value.getNode(j);$&&((N=g.value)===null||N===void 0||N.scroll($.level,$.index,it(re.value)))}})):(p.value=null,k.value=null)},{immediate:!0});function z(d){const{onBlur:B}=o,{nTriggerFormBlur:N}=T;B&&He(B,d),N()}function ce(d){const{onFocus:B}=o,{nTriggerFormFocus:N}=T;B&&He(B,d),N()}function X(){var d;(d=P.value)===null||d===void 0||d.focusInput()}function Y(){var d;(d=P.value)===null||d===void 0||d.focus()}function ge(){D.value||(m.value="",G(!0),o.filterable&&X())}function ee(d=!1){d&&Y(),G(!1),m.value=""}function Ke(d){var B;F.value||M.value&&(!((B=P.value)===null||B===void 0)&&B.$el.contains(_o(d))||ee())}function ze(d){F.value&&Ke(d)}function Ze(){o.clearFilterAfterSelect&&(m.value="")}function je(d){var B,N,j;const{value:$}=p,{value:te}=x;switch(d){case"prev":if($!==null){const U=te.getPrev($,{loop:!0});U!==null&&(ke(U.key),(B=g.value)===null||B===void 0||B.scroll(U.level,U.index,it(re.value)))}break;case"next":if($===null){const U=te.getFirstAvailableNode();U!==null&&(ke(U.key),(N=g.value)===null||N===void 0||N.scroll(U.level,U.index,it(re.value)))}else{const U=te.getNext($,{loop:!0});U!==null&&(ke(U.key),(j=g.value)===null||j===void 0||j.scroll(U.level,U.index,it(re.value)))}break;case"child":if($!==null){const U=te.getNode($);if(U!==null)if(U.shallowLoaded){const ne=te.getChild($);ne!==null&&(le($),ke(ne.key))}else{const{value:ne}=C;if(!ne.has($)){u($),le($);const{onLoad:H}=o;H&&H(U.rawNode).then(()=>{E($)}).catch(()=>{E($)})}}}break;case"parent":if($!==null){const U=te.getParent($);if(U!==null){ke(U.key);const ne=U.getParent();le(ne===null?null:ne.key)}}break}}function Ht(d){var B,N;switch(d.key){case" ":case"ArrowDown":case"ArrowUp":if(o.filterable&&M.value)break;d.preventDefault();break}if(!Rt(d,"action"))switch(d.key){case" ":if(o.filterable)return;case"Enter":if(!M.value)ge();else{const{value:j}=F,{value:$}=p;if(j)b.value&&b.value.enter()&&Ze();else if($!==null)if(S.value.includes($)||he.value.includes($))Me($);else{const te=_e($);!o.multiple&&te&&ee(!0)}}break;case"ArrowUp":d.preventDefault(),M.value&&(F.value?(B=b.value)===null||B===void 0||B.prev():je("prev"));break;case"ArrowDown":d.preventDefault(),M.value?F.value?(N=b.value)===null||N===void 0||N.next():je("next"):ge();break;case"ArrowLeft":d.preventDefault(),M.value&&!F.value&&je("parent");break;case"ArrowRight":d.preventDefault(),M.value&&!F.value&&je("child");break;case"Escape":M.value&&(No(d),ee(!0))}}function Dn(d){Ht(d)}function Ln(d){d.stopPropagation(),o.multiple?se([],[],[]):se(null,null,null)}function En(d){var B;!((B=g.value)===null||B===void 0)&&B.$el.contains(d.relatedTarget)||(w.value=!0,ce(d))}function Fn(d){var B;!((B=g.value)===null||B===void 0)&&B.$el.contains(d.relatedTarget)||(w.value=!1,z(d),ee())}function _n(d){var B;!((B=P.value)===null||B===void 0)&&B.$el.contains(d.relatedTarget)||(w.value=!0,ce(d))}function Nn(d){var B;!((B=P.value)===null||B===void 0)&&B.$el.contains(d.relatedTarget)||(w.value=!1,z(d))}function On(d){Rt(d,"action")||o.multiple&&o.filter&&(d.preventDefault(),X())}function $n(){ee(!0)}function Un(){o.filterable?ge():M.value?ee(!0):ge()}function Kn(d){m.value=d.target.value}function zn(d){const{multiple:B}=o,{value:N}=f;B&&Array.isArray(N)&&d.value!==void 0?Me(d.value):se(null,null,null)}function Vt(){var d;(d=A.value)===null||d===void 0||d.syncPosition()}function qt(){var d;(d=R.value)===null||d===void 0||d.syncPosition()}function jn(){M.value&&(F.value?Vt():qt())}const Tt=Z(()=>!!(o.multiple&&o.cascade||h.value!=="child"));Bo(ct,{slots:e,mergedClsPrefixRef:n,mergedThemeRef:i,mergedValueRef:f,checkedKeysRef:S,indeterminateKeysRef:he,hoverKeyPathRef:ue,mergedCheckStrategyRef:h,showCheckboxRef:Tt,cascadeRef:Ae(o,"cascade"),multipleRef:Ae(o,"multiple"),keyboardKeyRef:p,hoverKeyRef:k,remoteRef:Ae(o,"remote"),loadingKeySetRef:C,expandTriggerRef:Ae(o,"expandTrigger"),isMountedRef:Io(),onLoadRef:Ae(o,"onLoad"),virtualScrollRef:Ae(o,"virtualScroll"),optionHeightRef:re,localeRef:s,labelFieldRef:Ae(o,"labelField"),renderLabelRef:Ae(o,"renderLabel"),syncCascaderMenuPosition:qt,syncSelectMenuPosition:Vt,updateKeyboardKey:ke,updateHoverKey:le,addLoadingKey:u,deleteLoadingKey:E,doCheck:_e,doUncheck:Me,closeMenu:ee,handleSelectMenuClickOutside:ze,handleCascaderMenuClickOutside:Ke,clearPattern:Ze});const Hn={focus:()=>{var d;(d=P.value)===null||d===void 0||d.focus()},blur:()=>{var d;(d=P.value)===null||d===void 0||d.blur()},getCheckedData:()=>{if(Tt.value){const d=S.value;return{keys:d,options:$e(d)}}return{keys:[],options:[]}},getIndeterminateData:()=>{if(Tt.value){const d=he.value;return{keys:d,options:$e(d)}}return{keys:[],options:[]}}},Gt=Z(()=>{const{self:{optionArrowColor:d,optionTextColor:B,optionTextColorActive:N,optionTextColorDisabled:j,optionCheckMarkColor:$,menuColor:te,menuBoxShadow:U,menuDividerColor:ne,menuBorderRadius:H,menuHeight:Ye,optionColorHover:nt,optionHeight:Vn,optionFontSize:qn,loadingColor:Gn,columnWidth:Wn},common:{cubicBezierEaseInOut:Xn}}=i.value;return{"--n-bezier":Xn,"--n-menu-border-radius":H,"--n-menu-box-shadow":U,"--n-menu-height":Ye,"--n-column-width":Wn,"--n-menu-color":te,"--n-menu-divider-color":ne,"--n-option-height":Vn,"--n-option-font-size":qn,"--n-option-text-color":B,"--n-option-text-color-disabled":j,"--n-option-text-color-active":N,"--n-option-color-hover":nt,"--n-option-check-mark-color":$,"--n-option-arrow-color":d,"--n-menu-mask-color":Mo(te,{alpha:.75}),"--n-loading-color":Gn}}),Je=a?Ro("cascader",void 0,Gt,o):void 0;return Object.assign(Object.assign({},Hn),{handleTriggerResize:jn,mergedStatus:L,selectMenuFollowerRef:A,cascaderMenuFollowerRef:R,triggerInstRef:P,selectMenuInstRef:b,cascaderMenuInstRef:g,mergedBordered:t,mergedClsPrefix:n,namespace:r,mergedValue:f,mergedShow:M,showSelectMenu:F,pattern:m,treeMate:x,mergedSize:I,mergedDisabled:D,localizedPlaceholder:_,selectedOption:Se,selectedOptions:de,adjustedTo:v,menuModel:V,handleMenuTabout:$n,handleMenuFocus:_n,handleMenuBlur:Nn,handleMenuKeydown:Dn,handleMenuMousedown:On,handleTriggerFocus:En,handleTriggerBlur:Fn,handleTriggerClick:Un,handleClear:Ln,handleDeleteOption:zn,handlePatternInput:Kn,handleKeydown:Ht,focused:w,optionHeight:re,mergedTheme:i,cssVars:a?void 0:Gt,themeClass:Je==null?void 0:Je.themeClass,onRender:Je==null?void 0:Je.onRender})},render(){const{mergedClsPrefix:o}=this;return K("div",{class:`${o}-cascader`},K(Do,null,{default:()=>[K(Lo,null,{default:()=>K(Eo,{onResize:this.handleTriggerResize,ref:"triggerInstRef",status:this.mergedStatus,clsPrefix:o,maxTagCount:this.maxTagCount,bordered:this.mergedBordered,size:this.mergedSize,theme:this.mergedTheme.peers.InternalSelection,themeOverrides:this.mergedTheme.peerOverrides.InternalSelection,active:this.mergedShow,pattern:this.pattern,placeholder:this.localizedPlaceholder,selectedOption:this.selectedOption,selectedOptions:this.selectedOptions,multiple:this.multiple,filterable:this.filterable,clearable:this.clearable,disabled:this.mergedDisabled,focused:this.focused,onFocus:this.handleTriggerFocus,onBlur:this.handleTriggerBlur,onClick:this.handleTriggerClick,onClear:this.handleClear,onDeleteOption:this.handleDeleteOption,onPatternInput:this.handlePatternInput,onKeydown:this.handleKeydown},{arrow:()=>{var e,t;return(t=(e=this.$slots).arrow)===null||t===void 0?void 0:t.call(e)}})}),K(Jt,{key:"cascaderMenu",ref:"cascaderMenuFollowerRef",show:this.mergedShow&&!this.showSelectMenu,containerClass:this.namespace,placement:this.placement,width:this.options.length?void 0:"target",teleportDisabled:this.adjustedTo===vt.tdkey,to:this.adjustedTo},{default:()=>{var e;(e=this.onRender)===null||e===void 0||e.call(this);const{menuProps:t}=this;return K(rr,Object.assign({},t,{ref:"cascaderMenuInstRef",class:[this.themeClass,t==null?void 0:t.class],value:this.mergedValue,show:this.mergedShow&&!this.showSelectMenu,menuModel:this.menuModel,style:[this.cssVars,t==null?void 0:t.style],onFocus:this.handleMenuFocus,onBlur:this.handleMenuBlur,onKeydown:this.handleMenuKeydown,onMousedown:this.handleMenuMousedown,onTabout:this.handleMenuTabout}),{action:()=>{var n,r;return(r=(n=this.$slots).action)===null||r===void 0?void 0:r.call(n)},empty:()=>{var n,r;return(r=(n=this.$slots).empty)===null||r===void 0?void 0:r.call(n)}})}}),K(Jt,{key:"selectMenu",ref:"selectMenuFollowerRef",show:this.mergedShow&&this.showSelectMenu,containerClass:this.namespace,width:"target",placement:this.placement,to:this.adjustedTo,teleportDisabled:this.adjustedTo===vt.tdkey},{default:()=>{var e;(e=this.onRender)===null||e===void 0||e.call(this);const{filterMenuProps:t}=this;return K(ar,Object.assign({},t,{ref:"selectMenuInstRef",class:[this.themeClass,t==null?void 0:t.class],value:this.mergedValue,show:this.mergedShow&&this.showSelectMenu,pattern:this.pattern,multiple:this.multiple,tmNodes:this.treeMate.treeNodes,filter:this.filter,labelField:this.labelField,separator:this.separator,style:[this.cssVars,t==null?void 0:t.style]}))}})]}))}}),lr=""+new URL("headerD-220e6507.png",import.meta.url).href,cr=o=>tt.post("/edu-app/teacher/page",{data:o}),ur=o=>tt.post("/edu-app/teacher/add",{data:o}),dr=o=>tt.post("/edu-app/teacher/updateStatus",{data:o}),fr=o=>tt.post("/edu-app/user/resetPassword",{data:o,requestType:"form"}),hr=o=>tt.post("/edu-app/school/update",{data:o}),wn=()=>tt.get("/edu-app/open/sysArea/queryAllProvince"),gr=xe({name:"setting-personInfo",setup(){var l,c,f,h;const o=Nt(),e=wt(),t=qe({sexs:[{label:"男",value:1,class:"option"},{label:"女",value:0,class:"option"}],areaList:[]}),n=Q(),r=qe({provinceCode:e.info.provinceCode,cityCode:e.info.cityCode,regionCode:e.info.regionCode,nickname:e.info.nickname,phone:e.info.phone,gender:e.info.gender,schoolId:(c=(l=e.info.schoolInfos)==null?void 0:l[0])==null?void 0:c.id,tenantId:(h=(f=e.info.schoolInfos)==null?void 0:f[0])==null?void 0:h.tenantId,id:e.info.id,avatar:e.info.avatar}),a=qe({disabled:!0,openChangePwd:!1,uploadShow:!0}),i=async()=>{const m=await wn();(m==null?void 0:m.code)===200&&(t.areaList=m.data)};mn(()=>{i()});const s=()=>{n.value.validate(async m=>{if(!m){if(!r.provinceCode||!r.cityCode){o.error("请选择城区");return}await Ko(r),console.log(r),e.getInfo(),a.disabled=!0,o.success("修改成功")}})};return()=>{var m,T;return y("div",{class:oe.infoWrap},[y("div",{class:oe.teacherInfoWrap},[y("div",{class:oe.teacherHeadWrap},[y(mt,{previewDisabled:!0,class:oe.headerD,src:lr},null),y(mt,{previewDisabled:!0,class:oe.defultHeade,src:r.avatar||Jn},null),y("div",{style:{display:a.disabled?"none":""},class:[oe.defultHeade,oe.changeHead]},[ae("修改头像"),a.uploadShow&&y(yn,{class:[oe.uploadFile],cropper:!0,"onUpdate:fileList":I=>{r.avatar=I,a.uploadShow=!1,setTimeout(()=>{a.uploadShow=!0},100)}},null)])]),y("div",{class:oe.headerInfo},[y("p",{class:oe.headerTitle},[e.info.nickname,y(mt,{previewDisabled:!0,class:oe.sexIcon,src:e.info.gender?Yn:Qn},null)]),y("p",{class:oe.headerSubTitle},[(T=(m=e.info.schoolInfos)==null?void 0:m[0])==null?void 0:T.name,ae(" | 音乐老师")])])]),y("div",{class:oe.setInfo},[y(Ot,{ref:n,model:r,disabled:a.disabled},{default:()=>[y($o,{cols:3,"x-gap":"100"},{default:()=>[y(Pt,null,{default:()=>[y(Te,{label:"姓名",path:"nickname",rule:[{required:!0,message:"请输入老师姓名",trigger:"blur"},{pattern:/^(?:[\u4e00-\u9fa5·]{2,16})$/,message:"请输入中文姓名,不要包含空格,及特殊符号",trigger:"blur"}]},{default:()=>[y(lt,{maxlength:14,bordered:!a.disabled,placeholder:"请填写老师姓名",value:r.nickname,"onUpdate:value":I=>r.nickname=I},null)]})]}),y(Pt,null,{default:()=>[y(Te,{label:"手机号",path:"phone",rule:[{required:!0,message:"请填写老师手机号",trigger:"blur"},{pattern:/^1[3456789]\d{9}$/,message:"手机号格式不正确",trigger:"blur"}]},{default:()=>[y(lt,{bordered:!a.disabled,placeholder:"请填写老师手机号",value:r.phone,"onUpdate:value":I=>r.phone=I},null)]})]}),y(Pt,null,{default:()=>[y(Te,{label:"性别",path:"sex"},{default:()=>[y(Uo,{bordered:!a.disabled,class:oe.select,showArrow:!a.disabled,placeholder:"请选择性别",options:t.sexs,value:r.gender,"onUpdate:value":I=>r.gender=I},null)]})]})]}),y(Te,{label:"城区",style:{maxWidth:"30%"}},{default:()=>[y($t,{bordered:!a.disabled,options:t.areaList,labelField:"name",valueField:"code",childrenField:"areas",checkStrategy:"child",expandTrigger:"hover",defaultValue:e.info.regionCode||e.info.cityCode||e.info.provinceCode,"onUpdate:value":(I,D,L)=>{var g,b,P;r.provinceCode=(g=L[0])==null?void 0:g.code,r.cityCode=(b=L[1])==null?void 0:b.code,r.regionCode=(P=L[2])==null?void 0:P.code}},null)]})]})]),a.disabled?y(Fe,{class:oe.btnList,align:"center",justify:"end"},{default:()=>[y(pe,{class:oe.btn,color:"#198cfe",onClick:()=>a.openChangePwd=!0},{default:()=>[ae("修改密码")]}),y(pe,{class:oe.btn,color:"#f24433",onClick:()=>a.disabled=!1},{default:()=>[ae("修改信息")]})]}):y(Fe,{class:oe.btnList,align:"center",justify:"end"},{default:()=>[y(pe,{class:oe.btn,onClick:()=>{var I;a.disabled=!0,(I=n.value)==null||I.restoreValidation()}},{default:()=>[ae("取消")]}),y(pe,{class:oe.btn,type:"primary",onClick:()=>s()},{default:()=>[ae("完成")]})]}),y(Lt,{class:oe.changePwdModal,show:a.openChangePwd,"onUpdate:show":I=>a.openChangePwd=I,preset:"dialog",showIcon:!1,title:"修改密码"},{default:()=>[y(Zn,{phone:e.info.phone,onClose:()=>{a.openChangePwd=!1}},null)]})])}}}),pr="_logo_1g0fd_1",vr="_changeHead_1g0fd_8",mr="_uploadFile_1g0fd_29",br="_formWrap_1g0fd_37",yr="_schoolInfo_1g0fd_62",wr="_errorBtn_1g0fd_83",Cr="_addTeacher_1g0fd_86",xr="_btnList_1g0fd_160",kr="_btn_1g0fd_160",ye={logo:pr,changeHead:vr,uploadFile:mr,formWrap:br,schoolInfo:yr,errorBtn:wr,addTeacher:Cr,btnList:xr,btn:kr},Sr={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},Tr=bn("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M256 112v288"},null,-1),Pr=bn("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M400 256H112"},null,-1),Ar=[Tr,Pr],Br=xe({name:"Add",render:function(e,t){return jo(),zo("svg",Sr,Ar)}}),Ir=xe({name:"teacher-operation",emits:["close"],props:{areaList:{type:Array,default:()=>[]}},setup(o,{emit:e}){var l,c,f,h;const t=wt(),n=qe({provinceCode:"",cityCode:"",regionCode:"",tenantId:(c=(l=t.info.schoolInfos)==null?void 0:l[0])==null?void 0:c.tenantId,phone:null,schoolId:(h=(f=t.info.schoolInfos)==null?void 0:f[0])==null?void 0:h.id,nickname:null,gender:1}),r=Q(!1),a=Q(),i=Nt(),s=async()=>{a.value.validate(async m=>{if(!m){try{r.value=!0,await ur({...n}),i.success("添加成功")}catch(T){console.log(T)}setTimeout(()=>{r.value=!1,e("close")},100)}})};return()=>y("div",null,[y(Ot,{model:n,ref:a,showRequireMark:!1,"label-placement":"left","label-width":"126"},{default:()=>[y(Te,{label:"老师姓名",path:"nickname",rule:[{required:!0,message:"请输入老师姓名",trigger:"blur"},{pattern:/^(?:[\u4e00-\u9fa5·]{2,16})$/,message:"请输入中文姓名,不要包含空格,及特殊符号",trigger:"blur"}]},{default:()=>[y(lt,{value:n.nickname,"onUpdate:value":m=>n.nickname=m,placeholder:"请输入老师姓名",clearable:!0,maxlength:14},null)]}),y(Te,{label:"老师性别",path:"gender",rule:[{required:!0,message:"请选择老师性别"}]},{default:()=>[y(Fe,null,{default:()=>[y(Yt("n-button"),{class:"genderBtn",type:n.gender?"info":void 0,tertiary:!n.gender,onClick:()=>{n.gender=1}},{default:()=>[ae("男")]}),y(Yt("n-button"),{class:"genderBtn",type:n.gender?void 0:"info",tertiary:!!n.gender,onClick:()=>{n.gender=0}},{default:()=>[ae("女")]})]})]}),y(Te,{label:"城区",path:"provinceCode",rule:[{required:!0,message:"请选择城区",trigger:"change"}]},{default:()=>[y($t,{to:"body",placeholder:"请选择城区",options:o.areaList,labelField:"name",valueField:"code",childrenField:"areas",checkStrategy:"child",expandTrigger:"hover","onUpdate:value":(m,T,I)=>{var D,L,g;n.provinceCode=((D=I[0])==null?void 0:D.code)+"",n.cityCode=(L=I[1])==null?void 0:L.code,n.regionCode=(g=I[2])==null?void 0:g.code}},null)]}),y(Te,{label:"手机号",path:"phone",rule:[{required:!0,message:"请输入正确的手机号码",trigger:"blur"},{pattern:/^((13[0-9])|(14(0|[5-7]|9))|(15([0-3]|[5-9]))|(16(2|[5-7]))|(17[0-8])|(18[0-9])|(19([0-3]|[5-9])))\d{8}$/,message:"请输入正确的手机号",trigger:"blur"}]},{default:()=>[y(lt,{maxlength:11,value:n.phone,"onUpdate:value":m=>n.phone=m,placeholder:"请输入手机号",clearable:!0},null)]}),y("div",{class:"nalert"},[y(Ho,{type:"error",showIcon:!1,bordered:!1},{default:()=>[ae("默认密码为ktyq+手机号后四位")]})])]}),y(Fe,{style:{padding:"20px 0 32px 0"},justify:"center"},{default:()=>[y(pe,{class:"actionBtn",round:!0,type:"default",onClick:()=>e("close")},{default:()=>[ae("取消")]}),y(pe,{class:"actionBtn",round:!0,type:"primary",onClick:()=>s(),loading:r.value},{default:()=>[ae("确定")]})]})])}});function Pe(o){if(typeof o!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(o))}function tn(o,e){for(var t="",n=0,r=-1,a=0,i,s=0;s<=o.length;++s){if(s<o.length)i=o.charCodeAt(s);else{if(i===47)break;i=47}if(i===47){if(!(r===s-1||a===1))if(r!==s-1&&a===2){if(t.length<2||n!==2||t.charCodeAt(t.length-1)!==46||t.charCodeAt(t.length-2)!==46){if(t.length>2){var l=t.lastIndexOf("/");if(l!==t.length-1){l===-1?(t="",n=0):(t=t.slice(0,l),n=t.length-1-t.lastIndexOf("/")),r=s,a=0;continue}}else if(t.length===2||t.length===1){t="",n=0,r=s,a=0;continue}}e&&(t.length>0?t+="/..":t="..",n=2)}else t.length>0?t+="/"+o.slice(r+1,s):t=o.slice(r+1,s),n=s-r-1;r=s,a=0}else i===46&&a!==-1?++a:a=-1}return t}function Mr(o,e){var t=e.dir||e.root,n=e.base||(e.name||"")+(e.ext||"");return t?t===e.root?t+n:t+o+n:n}var Ge={resolve:function(){for(var e="",t=!1,n,r=arguments.length-1;r>=-1&&!t;r--){var a;r>=0?a=arguments[r]:(n===void 0&&(n=process.cwd()),a=n),Pe(a),a.length!==0&&(e=a+"/"+e,t=a.charCodeAt(0)===47)}return e=tn(e,!t),t?e.length>0?"/"+e:"/":e.length>0?e:"."},normalize:function(e){if(Pe(e),e.length===0)return".";var t=e.charCodeAt(0)===47,n=e.charCodeAt(e.length-1)===47;return e=tn(e,!t),e.length===0&&!t&&(e="."),e.length>0&&n&&(e+="/"),t?"/"+e:e},isAbsolute:function(e){return Pe(e),e.length>0&&e.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var e,t=0;t<arguments.length;++t){var n=arguments[t];Pe(n),n.length>0&&(e===void 0?e=n:e+="/"+n)}return e===void 0?".":Ge.normalize(e)},relative:function(e,t){if(Pe(e),Pe(t),e===t||(e=Ge.resolve(e),t=Ge.resolve(t),e===t))return"";for(var n=1;n<e.length&&e.charCodeAt(n)===47;++n);for(var r=e.length,a=r-n,i=1;i<t.length&&t.charCodeAt(i)===47;++i);for(var s=t.length,l=s-i,c=a<l?a:l,f=-1,h=0;h<=c;++h){if(h===c){if(l>c){if(t.charCodeAt(i+h)===47)return t.slice(i+h+1);if(h===0)return t.slice(i+h)}else a>c&&(e.charCodeAt(n+h)===47?f=h:h===0&&(f=0));break}var m=e.charCodeAt(n+h),T=t.charCodeAt(i+h);if(m!==T)break;m===47&&(f=h)}var I="";for(h=n+f+1;h<=r;++h)(h===r||e.charCodeAt(h)===47)&&(I.length===0?I+="..":I+="/..");return I.length>0?I+t.slice(i+f):(i+=f,t.charCodeAt(i)===47&&++i,t.slice(i))},_makeLong:function(e){return e},dirname:function(e){if(Pe(e),e.length===0)return".";for(var t=e.charCodeAt(0),n=t===47,r=-1,a=!0,i=e.length-1;i>=1;--i)if(t=e.charCodeAt(i),t===47){if(!a){r=i;break}}else a=!1;return r===-1?n?"/":".":n&&r===1?"//":e.slice(0,r)},basename:function(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Pe(e);var n=0,r=-1,a=!0,i;if(t!==void 0&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return"";var s=t.length-1,l=-1;for(i=e.length-1;i>=0;--i){var c=e.charCodeAt(i);if(c===47){if(!a){n=i+1;break}}else l===-1&&(a=!1,l=i+1),s>=0&&(c===t.charCodeAt(s)?--s===-1&&(r=i):(s=-1,r=l))}return n===r?r=l:r===-1&&(r=e.length),e.slice(n,r)}else{for(i=e.length-1;i>=0;--i)if(e.charCodeAt(i)===47){if(!a){n=i+1;break}}else r===-1&&(a=!1,r=i+1);return r===-1?"":e.slice(n,r)}},extname:function(e){Pe(e);for(var t=-1,n=0,r=-1,a=!0,i=0,s=e.length-1;s>=0;--s){var l=e.charCodeAt(s);if(l===47){if(!a){n=s+1;break}continue}r===-1&&(a=!1,r=s+1),l===46?t===-1?t=s:i!==1&&(i=1):t!==-1&&(i=-1)}return t===-1||r===-1||i===0||i===1&&t===r-1&&t===n+1?"":e.slice(t,r)},format:function(e){if(e===null||typeof e!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof e);return Mr("/",e)},parse:function(e){Pe(e);var t={root:"",dir:"",base:"",ext:"",name:""};if(e.length===0)return t;var n=e.charCodeAt(0),r=n===47,a;r?(t.root="/",a=1):a=0;for(var i=-1,s=0,l=-1,c=!0,f=e.length-1,h=0;f>=a;--f){if(n=e.charCodeAt(f),n===47){if(!c){s=f+1;break}continue}l===-1&&(c=!1,l=f+1),n===46?i===-1?i=f:h!==1&&(h=1):i!==-1&&(h=-1)}return i===-1||l===-1||h===0||h===1&&i===l-1&&i===s+1?l!==-1&&(s===0&&r?t.base=t.name=e.slice(1,l):t.base=t.name=e.slice(s,l)):(s===0&&r?(t.name=e.slice(1,i),t.base=e.slice(1,l)):(t.name=e.slice(s,i),t.base=e.slice(s,l)),t.ext=e.slice(i,l)),s>0?t.dir=e.slice(0,s-1):r&&(t.dir="/"),t},sep:"/",delimiter:":",win32:null,posix:null};Ge.posix=Ge;const Rr=Ge.extname,Cn=Ge.basename;class Dr{constructor(){let e=(()=>typeof global>"u")(),t="image/png",n="image/jpeg",r="image/jpeg",a="image/webp",i="application/pdf",s="image/svg+xml";Object.assign(this,{toMime:this.toMime.bind(this),fromMime:this.fromMime.bind(this),expected:e?'"png", "jpg", or "webp"':'"png", "jpg", "pdf", or "svg"',formats:e?{png:t,jpg:n,jpeg:r,webp:a}:{png:t,jpg:n,jpeg:r,pdf:i,svg:s},mimes:e?{[t]:"png",[n]:"jpg",[a]:"webp"}:{[t]:"png",[n]:"jpg",[i]:"pdf",[s]:"svg"}})}toMime(e){return this.formats[(e||"").replace(/^\./,"").toLowerCase()]}fromMime(e){return this.mimes[e]}}function Lr(o,{filename:e="",extension:t="",format:D,page:r,quality:a,matte:i,density:s,outline:l,archive:T}={}){var{fromMime:f,toMime:h,expected:m}=new Dr,T=T||"canvas",I=D||t.replace(/@\d+x$/i,"")||Rr(e),D=f(h(I)||I),L=h(D),g=o.length;if(!I)throw new Error("Cannot determine image format (use a filename extension or 'format' argument)");if(!D)throw new Error(`Unsupported file format "${I}" (expected ${m})`);if(!g)throw new RangeError("Canvas has no associated contexts (try calling getContext or newPage first)");let b,P,p=e.replace(/{(\d*)}/g,(C,A)=>(P=!0,A=parseInt(A,10),b=isFinite(A)?A:isFinite(b)?b:-1,"{}")),k=r>0?r-1:r<0?g+r:void 0;if(isFinite(k)&&k<0||k>=g)throw new RangeError(g==1?`Canvas only has a ‘page 1’ (${k} is out of bounds)`:`Canvas has pages 1–${g} (${k} is out of bounds)`);if(o=isFinite(k)?[o[k]]:P||D=="pdf"?o:o.slice(-1),a===void 0)a=.92;else if(typeof a!="number"||!isFinite(a)||a<0||a>1)throw new TypeError("The quality option must be an number in the 0.0–1.0 range");if(s===void 0){let C=(t||Cn(e,I)).match(/@(\d+)x$/i);s=C?parseInt(C[1],10):1}else if(typeof s!="number"||!Number.isInteger(s)||s<1)throw new TypeError("The density option must be a non-negative integer");return l===void 0?l=!0:D=="svg"&&(l=!!l),{filename:e,pattern:p,format:D,mime:L,pages:o,padding:b,quality:a,matte:i,density:s,outline:l,archive:T}}class Ct{static for(e){return new Ct().append(e).get()}constructor(){this.crc=-1}get(){return~this.crc}append(e){for(var t=this.crc|0,n=this.table,r=0,a=e.length|0;r<a;r++)t=t>>>8^n[(t^e[r])&255];return this.crc=t,this}}Ct.prototype.table=(()=>{var o,e,t,n=[];for(o=0;o<256;o++){for(t=o,e=0;e<8;e++)t=t&1?t>>>1^3988292384:t>>>1;n[o]=t}return n})();function At(o){let e=new Uint8Array(o),t=new DataView(e.buffer),n={array:e,view:t,size:o,set8(r,a){return t.setUint8(r,a),n},set16(r,a){return t.setUint16(r,a,!0),n},set32(r,a){return t.setUint32(r,a,!0),n},bytes(r,a){return e.set(a,r),n}};return n}class xt{constructor(e){let t=new Date;Object.assign(this,{directory:e,offset:0,files:[],time:(t.getHours()<<6|t.getMinutes())<<5|t.getSeconds()/2,date:(t.getFullYear()-1980<<4|t.getMonth()+1)<<5|t.getDate()}),this.add(e)}async add(e,t){let n=!t,r=xt.encoder.encode(`${this.directory}/${n?"":e}`),a=new Uint8Array(n?0:await t.arrayBuffer()),i=30+r.length,s=i+a.length,l=16,{offset:c}=this,f=At(26).set32(0,134742036).set16(6,this.time).set16(8,this.date).set32(10,Ct.for(a)).set32(14,a.length).set32(18,a.length).set16(22,r.length);c+=i;let h=At(i+a.length+l).set32(0,67324752).bytes(4,f.array).bytes(30,r).bytes(i,a);c+=a.length,h.set32(s,134695760).bytes(s+4,f.array.slice(10,22)),c+=l,this.files.push({offset:c,folder:n,name:r,header:f,payload:h}),this.offset=c}toBuffer(){let e=this.files.reduce((h,{name:m})=>46+m.length+h,0),t=At(e+22),n=0;for(var{offset:r,name:a,header:i,folder:s}of this.files)t.set32(n,33639248).set16(n+4,20).bytes(n+6,i.array).set8(n+38,s?16:0).set32(n+42,r).bytes(n+46,a),n+=46+a.length;t.set32(n,101010256).set16(n+8,this.files.length).set16(n+10,this.files.length).set32(n+12,e).set32(n+16,this.offset);let l=new Uint8Array(this.offset+t.size),c=0;for(var{payload:f}of this.files)l.set(f.array,c),c+=f.size;return l.set(t.array,c),l}get blob(){return new Blob([this.toBuffer()],{type:"application/zip"})}}xt.encoder=new TextEncoder;const Ut=(o,e,t,n)=>{if(n){let{width:r,height:a}=o,i=Object.assign(document.createElement("canvas"),{width:r,height:a}),s=i.getContext("2d");s.fillStyle=n,s.fillRect(0,0,r,a),s.drawImage(o,0,0),o=i}return new Promise((r,a)=>o.toBlob(r,e,t))},Er=(...o)=>Ut(...o).then(e=>e.arrayBuffer()),Fr=async(o,e,t,n,r)=>{xn(r,await Ut(o,e,t,n))},_r=async(o,e,t,n,r,a,i)=>{let s=f=>a.replace("{}",String(f+1).padStart(i,"0")),l=Cn(r,".zip")||"archive",c=new xt(l);await Promise.all(o.map(async(f,h)=>{let m=s(h);await c.add(m,await Ut(f,e,t,n))})),xn(`${l}.zip`,c.blob)},xn=(o,e)=>{const t=window.URL.createObjectURL(e),n=document.createElement("a");n.style.display="none",n.href=t,n.setAttribute("download",o),typeof n.download>"u"&&n.setAttribute("target","_blank"),document.body.appendChild(n),n.click(),document.body.removeChild(n),setTimeout(()=>window.URL.revokeObjectURL(t),100)},Nr=(o,e,t)=>o.map(n=>{if(e==1&&!t)return n.canvas;let r=document.createElement("canvas"),a=r.getContext("2d"),i=n.canvas?n.canvas:n;return r.width=i.width*e,r.height=i.height*e,t&&(a.fillStyle=t,a.fillRect(0,0,r.width,r.height)),a.scale(e,e),a.drawImage(i,0,0),r}),Or={asBuffer:Er,asDownload:Fr,asZipDownload:_r,atScale:Nr,options:Lr},{asBuffer:Bt,asDownload:$r,asZipDownload:Ur,atScale:It,options:Mt}=Or,nn=Symbol.for("toDataURL"),Kr=o=>new Promise((e,t)=>Object.assign(new kn,{crossOrigin:"Anonymous",onload:e,onerror:t,src:o}));let zr=class{constructor(e,t){let n=document.createElement("canvas"),r=[];Object.defineProperty(n,"async",{value:!0,writable:!1,enumerable:!0});for(var[a,i]of Object.entries({png:()=>Bt(n,"image/png"),jpg:()=>Bt(n,"image/jpeg"),pages:()=>r.concat(n).map(s=>s.getContext("2d"))}))Object.defineProperty(n,a,{get:i});return Object.assign(n,{width:e,height:t,newPage(...s){var{width:c,height:f}=n,l=Object.assign(document.createElement("canvas"),{width:c,height:f});l.getContext("2d").drawImage(n,0,0),r.push(l);var[c,f]=s.length?s:[c,f];return Object.assign(n,{width:c,height:f}).getContext("2d")},saveAs(s,l){l=typeof l=="number"?{quality:l}:l;let c=Mt(this.pages,{filename:s,...l}),{pattern:f,padding:h,mime:m,quality:T,matte:I,density:D,archive:L}=c,g=It(c.pages,D);return h==null?$r(g[0],m,T,I,s):Ur(g,m,T,I,L,f,h)},toBuffer(s="png",l={}){l=typeof l=="number"?{quality:l}:l;let c=Mt(this.pages,{extension:s,...l}),{mime:f,quality:h,matte:m,pages:T,density:I}=c,D=It(T,I,m)[0];return Bt(D,f,h,m)},[nn]:n.toDataURL.bind(n),toDataURL(s="png",l={}){l=typeof l=="number"?{quality:l}:l;let c=Mt(this.pages,{extension:s,...l}),{mime:f,quality:h,matte:m,pages:T,density:I}=c,D=It(T,I,m)[0],L=D[D===n?nn:"toDataURL"](f,h);return Promise.resolve(L)}})}};const{CanvasRenderingContext2D:jr,CanvasGradient:Hr,CanvasPattern:Vr,Image:kn,ImageData:qr,Path2D:Gr,DOMMatrix:Wr,DOMRect:Xr,DOMPoint:Zr}=window,Jr={Canvas:zr,loadImage:Kr,CanvasRenderingContext2D:jr,CanvasGradient:Hr,CanvasPattern:Vr,Image:kn,ImageData:qr,Path2D:Gr,DOMMatrix:Wr,DOMRect:Xr,DOMPoint:Zr},st=(o,e,t={},n=t)=>{if(Array.isArray(e))e.forEach(r=>st(o,r,t,n));else if(typeof e=="function")e(o,t,n,st);else{const r=Object.keys(e)[0];Array.isArray(e[r])?(n[r]={},st(o,e[r],t,n[r])):n[r]=e[r](o,t,n,st)}return t},We=(o,e)=>(t,n,r,a)=>{e(t,n,r)&&a(t,o,n,r)},Yr=(o,e)=>(t,n,r,a)=>{const i=[];let s=t.pos;for(;e(t,n,r);){const l={};if(a(t,o,n,l),t.pos===s)break;s=t.pos,i.push(l)}return i},Qr=o=>({data:o,pos:0}),Ce=()=>o=>o.data[o.pos++],Sn=(o=0)=>e=>e.data[e.pos+o],Ie=o=>e=>e.data.subarray(e.pos,e.pos+=o),kt=o=>e=>e.data.subarray(e.pos,e.pos+o),Ft=o=>e=>Array.from(Ie(o)(e)).map(t=>String.fromCharCode(t)).join(""),Ve=o=>e=>{const t=Ie(2)(e);return o?(t[1]<<8)+t[0]:(t[0]<<8)+t[1]},Tn=(o,e)=>(t,n,r)=>{const a=typeof e=="function"?e(t,n,r):e,i=Ie(o),s=new Array(a);for(var l=0;l<a;l++)s[l]=i(t);return s},ea=(o,e,t)=>{for(var n=0,r=0;r<t;r++)n+=o[e+r]&&2**(t-r-1);return n},Kt=o=>e=>{const t=Ce()(e),n=new Array(8);for(var r=0;r<8;r++)n[7-r]=!!(t&1<<r);return Object.keys(o).reduce((a,i)=>{const s=o[i];return s.length?a[i]=ea(n,s.index,s.length):a[i]=n[s.index],a},{})};var St={blocks:o=>{const t=[],n=o.data.length;for(var r=0,a=Ce()(o);a!==0&&a;a=Ce()(o)){if(o.pos+a>=n){const c=n-o.pos;t.push(Ie(c)(o)),r+=c;break}t.push(Ie(a)(o)),r+=a}const i=new Uint8Array(r);for(var s=0,l=0;l<t.length;l++)i.set(t[l],s),s+=t[l].length;return i}};const ta=We({gce:[{codes:Ie(2)},{byteSize:Ce()},{extras:Kt({future:{index:0,length:3},disposal:{index:3,length:3},userInput:{index:6},transparentColorGiven:{index:7}})},{delay:Ve(!0)},{transparentColorIndex:Ce()},{terminator:Ce()}]},o=>{var e=kt(2)(o);return e[0]===33&&e[1]===249}),na=We({image:[{code:Ce()},{descriptor:[{left:Ve(!0)},{top:Ve(!0)},{width:Ve(!0)},{height:Ve(!0)},{lct:Kt({exists:{index:0},interlaced:{index:1},sort:{index:2},future:{index:3,length:2},size:{index:5,length:3}})}]},We({lct:Tn(3,(o,e,t)=>Math.pow(2,t.descriptor.lct.size+1))},(o,e,t)=>t.descriptor.lct.exists),{data:[{minCodeSize:Ce()},St]}]},o=>Sn()(o)===44),oa=We({text:[{codes:Ie(2)},{blockSize:Ce()},{preData:(o,e,t)=>Ie(t.text.blockSize)(o)},St]},o=>{var e=kt(2)(o);return e[0]===33&&e[1]===1}),ra=We({application:[{codes:Ie(2)},{blockSize:Ce()},{id:(o,e,t)=>Ft(t.blockSize)(o)},St]},o=>{var e=kt(2)(o);return e[0]===33&&e[1]===255}),aa=We({comment:[{codes:Ie(2)},St]},o=>{var e=kt(2)(o);return e[0]===33&&e[1]===254}),ia=[{header:[{signature:Ft(3)},{version:Ft(3)}]},{lsd:[{width:Ve(!0)},{height:Ve(!0)},{gct:Kt({exists:{index:0},resolution:{index:1,length:3},sort:{index:4},size:{index:5,length:3}})},{backgroundColorIndex:Ce()},{pixelAspectRatio:Ce()}]},We({gct:Tn(3,(o,e)=>Math.pow(2,e.lsd.gct.size+1))},(o,e)=>e.lsd.gct.exists),{frames:Yr([ta,ra,aa,na,oa],o=>{var e=Sn()(o);return e===33||e===44})}],sa=(o,e)=>{const t=new Array(o.length),n=o.length/e,r=function(f,h){const m=o.slice(h*e,(h+1)*e);t.splice.apply(t,[f*e,e].concat(m))},a=[0,4,2,1],i=[8,8,4,2];for(var s=0,l=0;l<4;l++)for(var c=a[l];c<n;c+=i[l])r(c,s),s++;return t},la=(o,e,t)=>{const a=t;var i,s,l,c,f,h,m,k,T,I,p,D,C,A,v,R;const L=new Array(t),g=new Array(4096),b=new Array(4096),P=new Array(4096+1);for(D=o,s=1<<D,f=s+1,i=s+2,m=-1,c=D+1,l=(1<<c)-1,T=0;T<s;T++)g[T]=0,b[T]=T;var p,k,C,A,R,v;for(p=k=C=A=R=v=0,I=0;I<a;){if(A===0){if(k<c){p+=e[v]<<k,k+=8,v++;continue}if(T=p&l,p>>=c,k-=c,T>i||T==f)break;if(T==s){c=D+1,l=(1<<c)-1,i=s+2,m=-1;continue}if(m==-1){P[A++]=b[T],m=T,C=T;continue}for(h=T,T==i&&(P[A++]=C,T=m);T>s;)P[A++]=b[T],T=g[T];C=b[T]&255,P[A++]=C,i<4096&&(g[i]=m,b[i]=C,i++,!(i&l)&&i<4096&&(c++,l+=i)),m=h}A--,L[R++]=P[A],I++}for(I=R;I<a;I++)L[I]=0;return L},ca=o=>{const e=new Uint8Array(o);return st(Qr(e),ia)},ua=o=>{const e=o.pixels.length,t=new Uint8ClampedArray(e*4);for(var n=0;n<e;n++){const r=n*4,a=o.pixels[n],i=o.colorTable[a];t[r]=i[0],t[r+1]=i[1],t[r+2]=i[2],t[r+3]=a!==o.transparentIndex?255:0}return t},da=(o,e,t)=>{if(!o.image){console.warn("gif frame does not have associated image.");return}const{image:n}=o,r=n.descriptor.width*n.descriptor.height;var a=la(n.data.minCodeSize,n.data.blocks,r);n.descriptor.lct.interlaced&&(a=sa(a,n.descriptor.width));const i={pixels:a,dims:{top:o.image.descriptor.top,left:o.image.descriptor.left,width:o.image.descriptor.width,height:o.image.descriptor.height}};return n.descriptor.lct&&n.descriptor.lct.exists?i.colorTable=n.lct:i.colorTable=e,o.gce&&(i.delay=(o.gce.delay||10)*10,i.disposalType=o.gce.extras.disposal,o.gce.extras.transparentColorGiven&&(i.transparentIndex=o.gce.transparentColorIndex)),t&&(i.patch=ua(i)),i},fa=(o,e)=>o.frames.filter(t=>t.image).map(t=>da(t,o.gct,e));function ha(o,e,t){const n=Pn(e),r=o-1;let a=0;switch(t){case ve.L:a=Be[r][0];break;case ve.M:a=Be[r][1];break;case ve.Q:a=Be[r][2];break;case ve.H:a=Be[r][3];break}return n<=a}function ga(o,e){for(var t=1,n=Pn(o),r=0,a=Be.length;r<a;r++){var i=0;switch(e){case ve.L:i=Be[r][0];break;case ve.M:i=Be[r][1];break;case ve.Q:i=Be[r][2];break;case ve.H:i=Be[r][3];break}if(n<=i)break;t++}if(t>Be.length)throw new Error("Too long data");return t}function Pn(o){var e=encodeURI(o).toString().replace(/\%[0-9a-fA-F]{2}/g,"a");return e.length+(e.length!=Number(o)?3:0)}class pa{constructor(e){this.mode=we.MODE_8BIT_BYTE,this.parsedData=[],this.data=e;const t=[];for(let n=0,r=this.data.length;n<r;n++){const a=[],i=this.data.charCodeAt(n);i>65536?(a[0]=240|(i&1835008)>>>18,a[1]=128|(i&258048)>>>12,a[2]=128|(i&4032)>>>6,a[3]=128|i&63):i>2048?(a[0]=224|(i&61440)>>>12,a[1]=128|(i&4032)>>>6,a[2]=128|i&63):i>128?(a[0]=192|(i&1984)>>>6,a[1]=128|i&63):a[0]=i,t.push(a)}this.parsedData=Array.prototype.concat.apply([],t),this.parsedData.length!=this.data.length&&(this.parsedData.unshift(191),this.parsedData.unshift(187),this.parsedData.unshift(239))}getLength(){return this.parsedData.length}write(e){for(let t=0,n=this.parsedData.length;t<n;t++)e.put(this.parsedData[t],8)}}class Oe{constructor(e=-1,t=ve.L){this.moduleCount=0,this.dataList=[],this.typeNumber=e,this.errorCorrectLevel=t,this.moduleCount=0,this.dataList=[]}addData(e){if(this.typeNumber<=0)this.typeNumber=ga(e,this.errorCorrectLevel);else{if(this.typeNumber>40)throw new Error(`Invalid QR version: ${this.typeNumber}`);if(!ha(this.typeNumber,e,this.errorCorrectLevel))throw new Error(`Data is too long for QR version: ${this.typeNumber}`)}const t=new pa(e);this.dataList.push(t),this.dataCache=void 0}isDark(e,t){if(e<0||this.moduleCount<=e||t<0||this.moduleCount<=t)throw new Error(`${e},${t}`);return this.modules[e][t]}getModuleCount(){return this.moduleCount}make(){this.makeImpl(!1,this.getBestMaskPattern())}makeImpl(e,t){this.moduleCount=this.typeNumber*4+17,this.modules=new Array(this.moduleCount);for(let n=0;n<this.moduleCount;n++){this.modules[n]=new Array(this.moduleCount);for(let r=0;r<this.moduleCount;r++)this.modules[n][r]=null}this.setupPositionProbePattern(0,0),this.setupPositionProbePattern(this.moduleCount-7,0),this.setupPositionProbePattern(0,this.moduleCount-7),this.setupPositionAdjustPattern(),this.setupTimingPattern(),this.setupTypeInfo(e,t),this.typeNumber>=7&&this.setupTypeNumber(e),this.dataCache==null&&(this.dataCache=Oe.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,t)}setupPositionProbePattern(e,t){for(let n=-1;n<=7;n++)if(!(e+n<=-1||this.moduleCount<=e+n))for(let r=-1;r<=7;r++)t+r<=-1||this.moduleCount<=t+r||(0<=n&&n<=6&&(r==0||r==6)||0<=r&&r<=6&&(n==0||n==6)||2<=n&&n<=4&&2<=r&&r<=4?this.modules[e+n][t+r]=!0:this.modules[e+n][t+r]=!1)}getBestMaskPattern(){if(Number.isInteger(this.maskPattern)&&Object.values(Le).includes(this.maskPattern))return this.maskPattern;let e=0,t=0;for(let n=0;n<8;n++){this.makeImpl(!0,n);const r=W.getLostPoint(this);(n==0||e>r)&&(e=r,t=n)}return t}setupTimingPattern(){for(let e=8;e<this.moduleCount-8;e++)this.modules[e][6]==null&&(this.modules[e][6]=e%2==0);for(let e=8;e<this.moduleCount-8;e++)this.modules[6][e]==null&&(this.modules[6][e]=e%2==0)}setupPositionAdjustPattern(){const e=W.getPatternPosition(this.typeNumber);for(let t=0;t<e.length;t++)for(let n=0;n<e.length;n++){const r=e[t],a=e[n];if(this.modules[r][a]==null)for(let i=-2;i<=2;i++)for(let s=-2;s<=2;s++)i==-2||i==2||s==-2||s==2||i==0&&s==0?this.modules[r+i][a+s]=!0:this.modules[r+i][a+s]=!1}}setupTypeNumber(e){const t=W.getBCHTypeNumber(this.typeNumber);for(var n=0;n<18;n++){var r=!e&&(t>>n&1)==1;this.modules[Math.floor(n/3)][n%3+this.moduleCount-8-3]=r}for(var n=0;n<18;n++){var r=!e&&(t>>n&1)==1;this.modules[n%3+this.moduleCount-8-3][Math.floor(n/3)]=r}}setupTypeInfo(e,t){const n=this.errorCorrectLevel<<3|t,r=W.getBCHTypeInfo(n);for(var a=0;a<15;a++){var i=!e&&(r>>a&1)==1;a<6?this.modules[a][8]=i:a<8?this.modules[a+1][8]=i:this.modules[this.moduleCount-15+a][8]=i}for(var a=0;a<15;a++){var i=!e&&(r>>a&1)==1;a<8?this.modules[8][this.moduleCount-a-1]=i:a<9?this.modules[8][15-a-1+1]=i:this.modules[8][15-a-1]=i}this.modules[this.moduleCount-8][8]=!e}mapData(e,t){let n=-1,r=this.moduleCount-1,a=7,i=0;for(let s=this.moduleCount-1;s>0;s-=2)for(s==6&&s--;;){for(let l=0;l<2;l++)if(this.modules[r][s-l]==null){let c=!1;i<e.length&&(c=(e[i]>>>a&1)==1),W.getMask(t,r,s-l)&&(c=!c),this.modules[r][s-l]=c,a--,a==-1&&(i++,a=7)}if(r+=n,r<0||this.moduleCount<=r){r-=n,n=-n;break}}}static createData(e,t,n){const r=Ee.getRSBlocks(e,t),a=new va;for(var i=0;i<n.length;i++){const l=n[i];a.put(l.mode,4),a.put(l.getLength(),W.getLengthInBits(l.mode,e)),l.write(a)}let s=0;for(var i=0;i<r.length;i++)s+=r[i].dataCount;if(a.getLengthInBits()>s*8)throw new Error(`code length overflow. (${a.getLengthInBits()}>${s*8})`);for(a.getLengthInBits()+4<=s*8&&a.put(0,4);a.getLengthInBits()%8!=0;)a.putBit(!1);for(;!(a.getLengthInBits()>=s*8||(a.put(Oe.PAD0,8),a.getLengthInBits()>=s*8));)a.put(Oe.PAD1,8);return Oe.createBytes(a,r)}static createBytes(e,t){let n=0,r=0,a=0;const i=new Array(t.length),s=new Array(t.length);for(var l=0;l<t.length;l++){const T=t[l].dataCount,I=t[l].totalCount-T;r=Math.max(r,T),a=Math.max(a,I),i[l]=new Array(T);for(var c=0;c<i[l].length;c++)i[l][c]=255&e.buffer[c+n];n+=T;const D=W.getErrorCorrectPolynomial(I),g=new et(i[l],D.getLength()-1).mod(D);s[l]=new Array(D.getLength()-1);for(var c=0;c<s[l].length;c++){const P=c+g.getLength()-s[l].length;s[l][c]=P>=0?g.get(P):0}}let f=0;for(var c=0;c<t.length;c++)f+=t[c].totalCount;const h=new Array(f);let m=0;for(var c=0;c<r;c++)for(var l=0;l<t.length;l++)c<i[l].length&&(h[m++]=i[l][c]);for(var c=0;c<a;c++)for(var l=0;l<t.length;l++)c<s[l].length&&(h[m++]=s[l][c]);return h}}Oe.PAD0=236;Oe.PAD1=17;const ve={L:1,M:0,Q:3,H:2},we={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},Le={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};class W{static getBCHTypeInfo(e){let t=e<<10;for(;W.getBCHDigit(t)-W.getBCHDigit(W.G15)>=0;)t^=W.G15<<W.getBCHDigit(t)-W.getBCHDigit(W.G15);return(e<<10|t)^W.G15_MASK}static getBCHTypeNumber(e){let t=e<<12;for(;W.getBCHDigit(t)-W.getBCHDigit(W.G18)>=0;)t^=W.G18<<W.getBCHDigit(t)-W.getBCHDigit(W.G18);return e<<12|t}static getBCHDigit(e){let t=0;for(;e!=0;)t++,e>>>=1;return t}static getPatternPosition(e){return W.PATTERN_POSITION_TABLE[e-1]}static getMask(e,t,n){switch(e){case Le.PATTERN000:return(t+n)%2==0;case Le.PATTERN001:return t%2==0;case Le.PATTERN010:return n%3==0;case Le.PATTERN011:return(t+n)%3==0;case Le.PATTERN100:return(Math.floor(t/2)+Math.floor(n/3))%2==0;case Le.PATTERN101:return t*n%2+t*n%3==0;case Le.PATTERN110:return(t*n%2+t*n%3)%2==0;case Le.PATTERN111:return(t*n%3+(t+n)%2)%2==0;default:throw new Error(`bad maskPattern:${e}`)}}static getErrorCorrectPolynomial(e){let t=new et([1],0);for(let n=0;n<e;n++)t=t.multiply(new et([1,ie.gexp(n)],0));return t}static getLengthInBits(e,t){if(1<=t&&t<10)switch(e){case we.MODE_NUMBER:return 10;case we.MODE_ALPHA_NUM:return 9;case we.MODE_8BIT_BYTE:return 8;case we.MODE_KANJI:return 8;default:throw new Error(`mode:${e}`)}else if(t<27)switch(e){case we.MODE_NUMBER:return 12;case we.MODE_ALPHA_NUM:return 11;case we.MODE_8BIT_BYTE:return 16;case we.MODE_KANJI:return 10;default:throw new Error(`mode:${e}`)}else if(t<41)switch(e){case we.MODE_NUMBER:return 14;case we.MODE_ALPHA_NUM:return 13;case we.MODE_8BIT_BYTE:return 16;case we.MODE_KANJI:return 12;default:throw new Error(`mode:${e}`)}else throw new Error(`type:${t}`)}static getLostPoint(e){const t=e.getModuleCount();let n=0;for(var r=0;r<t;r++)for(var a=0;a<t;a++){let l=0;const c=e.isDark(r,a);for(let f=-1;f<=1;f++)if(!(r+f<0||t<=r+f))for(let h=-1;h<=1;h++)a+h<0||t<=a+h||f==0&&h==0||c==e.isDark(r+f,a+h)&&l++;l>5&&(n+=3+l-5)}for(var r=0;r<t-1;r++)for(var a=0;a<t-1;a++){let f=0;e.isDark(r,a)&&f++,e.isDark(r+1,a)&&f++,e.isDark(r,a+1)&&f++,e.isDark(r+1,a+1)&&f++,(f==0||f==4)&&(n+=3)}for(var r=0;r<t;r++)for(var a=0;a<t-6;a++)e.isDark(r,a)&&!e.isDark(r,a+1)&&e.isDark(r,a+2)&&e.isDark(r,a+3)&&e.isDark(r,a+4)&&!e.isDark(r,a+5)&&e.isDark(r,a+6)&&(n+=40);for(var a=0;a<t;a++)for(var r=0;r<t-6;r++)e.isDark(r,a)&&!e.isDark(r+1,a)&&e.isDark(r+2,a)&&e.isDark(r+3,a)&&e.isDark(r+4,a)&&!e.isDark(r+5,a)&&e.isDark(r+6,a)&&(n+=40);let i=0;for(var a=0;a<t;a++)for(var r=0;r<t;r++)e.isDark(r,a)&&i++;const s=Math.abs(100*i/t/t-50)/5;return n+=s*10,n}}W.PATTERN_POSITION_TABLE=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]];W.G15=1335;W.G18=7973;W.G15_MASK=21522;class ie{static glog(e){if(e<1)throw new Error(`glog(${e})`);return ie.LOG_TABLE[e]}static gexp(e){for(;e<0;)e+=255;for(;e>=256;)e-=255;return ie.EXP_TABLE[e]}}ie.EXP_TABLE=new Array(256);ie.LOG_TABLE=new Array(256);ie._constructor=function(){for(var o=0;o<8;o++)ie.EXP_TABLE[o]=1<<o;for(var o=8;o<256;o++)ie.EXP_TABLE[o]=ie.EXP_TABLE[o-4]^ie.EXP_TABLE[o-5]^ie.EXP_TABLE[o-6]^ie.EXP_TABLE[o-8];for(var o=0;o<255;o++)ie.LOG_TABLE[ie.EXP_TABLE[o]]=o}();class et{constructor(e,t){if(e.length==null)throw new Error(`${e.length}/${t}`);let n=0;for(;n<e.length&&e[n]==0;)n++;this.num=new Array(e.length-n+t);for(let r=0;r<e.length-n;r++)this.num[r]=e[r+n]}get(e){return this.num[e]}getLength(){return this.num.length}multiply(e){const t=new Array(this.getLength()+e.getLength()-1);for(let n=0;n<this.getLength();n++)for(let r=0;r<e.getLength();r++)t[n+r]^=ie.gexp(ie.glog(this.get(n))+ie.glog(e.get(r)));return new et(t,0)}mod(e){if(this.getLength()-e.getLength()<0)return this;const t=ie.glog(this.get(0))-ie.glog(e.get(0)),n=new Array(this.getLength());for(var r=0;r<this.getLength();r++)n[r]=this.get(r);for(var r=0;r<e.getLength();r++)n[r]^=ie.gexp(ie.glog(e.get(r))+t);return new et(n,0).mod(e)}}class Ee{constructor(e,t){this.totalCount=e,this.dataCount=t}static getRSBlocks(e,t){const n=Ee.getRsBlockTable(e,t);if(n==null)throw new Error(`bad rs block @ typeNumber:${e}/errorCorrectLevel:${t}`);const r=n.length/3,a=[];for(let i=0;i<r;i++){const s=n[i*3+0],l=n[i*3+1],c=n[i*3+2];for(let f=0;f<s;f++)a.push(new Ee(l,c))}return a}static getRsBlockTable(e,t){switch(t){case ve.L:return Ee.RS_BLOCK_TABLE[(e-1)*4+0];case ve.M:return Ee.RS_BLOCK_TABLE[(e-1)*4+1];case ve.Q:return Ee.RS_BLOCK_TABLE[(e-1)*4+2];case ve.H:return Ee.RS_BLOCK_TABLE[(e-1)*4+3];default:return}}}Ee.RS_BLOCK_TABLE=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]];class va{constructor(){this.buffer=[],this.length=0}get(e){const t=Math.floor(e/8);return(this.buffer[t]>>>7-e%8&1)==1}put(e,t){for(let n=0;n<t;n++)this.putBit((e>>>t-n-1&1)==1)}getLengthInBits(){return this.length}putBit(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++}}const Be=[[17,14,11,7],[32,26,20,14],[53,42,32,24],[78,62,46,34],[106,84,60,44],[134,106,74,58],[154,122,86,64],[192,152,108,84],[230,180,130,98],[271,213,151,119],[321,251,177,137],[367,287,203,155],[425,331,241,177],[458,362,258,194],[520,412,292,220],[586,450,322,250],[644,504,364,280],[718,560,394,310],[792,624,442,338],[858,666,482,382],[929,711,509,403],[1003,779,565,439],[1091,857,611,461],[1171,911,661,511],[1273,997,715,535],[1367,1059,751,593],[1465,1125,805,625],[1528,1190,868,658],[1628,1264,908,698],[1732,1370,982,742],[1840,1452,1030,790],[1952,1538,1112,842],[2068,1628,1168,898],[2188,1722,1228,958],[2303,1809,1283,983],[2431,1911,1351,1051],[2563,1989,1423,1093],[2699,2099,1499,1139],[2809,2213,1579,1219],[2953,2331,1663,1273]];var ma=100,fe=256,on=fe-1,Ne=4,An=16,zt=1<<An,Bn=10,jt=10,ba=zt>>jt,ya=zt<<Bn-jt,wa=fe>>3,_t=6,Ca=1<<_t,xa=wa*Ca,ka=30,In=10,ft=1<<In,Mn=8,rn=1<<Mn,Sa=In+Mn,Qe=1<<Sa,an=499,sn=491,ln=487,Rn=503,Ta=3*Rn;function Pa(o,e){var t,n,r,a,i;function s(){t=[],n=new Int32Array(256),r=new Int32Array(fe),a=new Int32Array(fe),i=new Int32Array(fe>>3);var g,b;for(g=0;g<fe;g++)b=(g<<Ne+8)/fe,t[g]=new Float64Array([b,b,b,0]),a[g]=zt/fe,r[g]=0}function l(){for(var g=0;g<fe;g++)t[g][0]>>=Ne,t[g][1]>>=Ne,t[g][2]>>=Ne,t[g][3]=g}function c(g,b,P,p,k){t[b][0]-=g*(t[b][0]-P)/ft,t[b][1]-=g*(t[b][1]-p)/ft,t[b][2]-=g*(t[b][2]-k)/ft}function f(g,b,P,p,k){for(var C=Math.abs(b-g),A=Math.min(b+g,fe),R=b+1,v=b-1,w=1,u,E;R<A||v>C;)E=i[w++],R<A&&(u=t[R++],u[0]-=E*(u[0]-P)/Qe,u[1]-=E*(u[1]-p)/Qe,u[2]-=E*(u[2]-k)/Qe),v>C&&(u=t[v--],u[0]-=E*(u[0]-P)/Qe,u[1]-=E*(u[1]-p)/Qe,u[2]-=E*(u[2]-k)/Qe)}function h(g,b,P){var p=2147483647,k=p,C=-1,A=C,R,v,w,u,E;for(R=0;R<fe;R++)v=t[R],w=Math.abs(v[0]-g)+Math.abs(v[1]-b)+Math.abs(v[2]-P),w<p&&(p=w,C=R),u=w-(r[R]>>An-Ne),u<k&&(k=u,A=R),E=a[R]>>jt,a[R]-=E,r[R]+=E<<Bn;return a[C]+=ba,r[C]-=ya,A}function m(){var g,b,P,p,k,C,A=0,R=0;for(g=0;g<fe;g++){for(P=t[g],k=g,C=P[1],b=g+1;b<fe;b++)p=t[b],p[1]<C&&(k=b,C=p[1]);if(p=t[k],g!=k&&(b=p[0],p[0]=P[0],P[0]=b,b=p[1],p[1]=P[1],P[1]=b,b=p[2],p[2]=P[2],P[2]=b,b=p[3],p[3]=P[3],P[3]=b),C!=A){for(n[A]=R+g>>1,b=A+1;b<C;b++)n[b]=g;A=C,R=g}}for(n[A]=R+on>>1,b=A+1;b<256;b++)n[b]=on}function T(g,b,P){for(var p,k,C,A=1e3,R=-1,v=n[b],w=v-1;v<fe||w>=0;)v<fe&&(k=t[v],C=k[1]-b,C>=A?v=fe:(v++,C<0&&(C=-C),p=k[0]-g,p<0&&(p=-p),C+=p,C<A&&(p=k[2]-P,p<0&&(p=-p),C+=p,C<A&&(A=C,R=k[3])))),w>=0&&(k=t[w],C=b-k[1],C>=A?w=-1:(w--,C<0&&(C=-C),p=k[0]-g,p<0&&(p=-p),C+=p,C<A&&(p=k[2]-P,p<0&&(p=-p),C+=p,C<A&&(A=C,R=k[3]))));return R}function I(){var g,b=o.length,P=30+(e-1)/3,p=b/(3*e),k=~~(p/ma),C=ft,A=xa,R=A>>_t;for(R<=1&&(R=0),g=0;g<R;g++)i[g]=C*((R*R-g*g)*rn/(R*R));var v;b<Ta?(e=1,v=3):b%an!==0?v=3*an:b%sn!==0?v=3*sn:b%ln!==0?v=3*ln:v=3*Rn;var w,u,E,x,O=0;for(g=0;g<p;)if(w=(o[O]&255)<<Ne,u=(o[O+1]&255)<<Ne,E=(o[O+2]&255)<<Ne,x=h(w,u,E),c(C,x,w,u,E),R!==0&&f(R,x,w,u,E),O+=v,O>=b&&(O-=b),g++,k===0&&(k=1),g%k===0)for(C-=C/P,A-=A/ka,R=A>>_t,R<=1&&(R=0),x=0;x<R;x++)i[x]=C*((R*R-x*x)*rn/(R*R))}function D(){s(),I(),l(),m()}this.buildColormap=D;function L(){for(var g=[],b=[],P=0;P<fe;P++)b[t[P][3]]=P;for(var p=0,k=0;k<fe;k++){var C=b[k];g[p++]=t[C][0],g[p++]=t[C][1],g[p++]=t[C][2]}return g}this.getColormap=L,this.lookupRGB=T}var cn=-1,ht=12,at=5003,Aa=[0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535];function Ba(o,e,t,n){var r=Math.max(2,n),a=new Uint8Array(256),i=new Int32Array(at),s=new Int32Array(at),l,c=0,f,h=0,m,T=!1,I,D,L,g,b,P;function p(x,O){a[f++]=x,f>=254&&v(O)}function k(x){C(at),h=D+2,T=!0,E(D,x)}function C(x){for(var O=0;O<x;++O)i[O]=-1}function A(x,O){var S,he,V,ue,re,G,se;for(I=x,T=!1,P=I,m=w(P),D=1<<x-1,L=D+1,h=D+2,f=0,ue=u(),se=0,S=at;S<65536;S*=2)++se;se=8-se,G=at,C(G),E(D,O);e:for(;(he=u())!=cn;){if(S=(he<<ht)+ue,V=he<<se^ue,i[V]===S){ue=s[V];continue}else if(i[V]>=0){re=G-V,V===0&&(re=1);do if((V-=re)<0&&(V+=G),i[V]===S){ue=s[V];continue e}while(i[V]>=0)}E(ue,O),ue=he,h<1<<ht?(s[V]=h++,i[V]=S):k(O)}E(ue,O),E(L,O)}function R(x){x.writeByte(r),g=o*e,b=0,A(r+1,x),x.writeByte(0)}function v(x){f>0&&(x.writeByte(f),x.writeBytes(a,0,f),f=0)}function w(x){return(1<<x)-1}function u(){if(g===0)return cn;--g;var x=t[b++];return x&255}function E(x,O){for(l&=Aa[c],c>0?l|=x<<c:l=x,c+=P;c>=8;)p(l&255,O),l>>=8,c-=8;if((h>m||T)&&(T?(m=w(P=I),T=!1):(++P,P==ht?m=1<<ht:m=w(P))),x==L){for(;c>0;)p(l&255,O),l>>=8,c-=8;v(O)}}this.encode=R}function be(){this.page=-1,this.pages=[],this.newPage()}be.pageSize=4096;be.charMap={};for(var gt=0;gt<256;gt++)be.charMap[gt]=String.fromCharCode(gt);be.prototype.newPage=function(){this.pages[++this.page]=new Uint8Array(be.pageSize),this.cursor=0};be.prototype.getData=function(){for(var o="",e=0;e<this.pages.length;e++)for(var t=0;t<be.pageSize;t++)o+=be.charMap[this.pages[e][t]];return o};be.prototype.toFlattenUint8Array=function(){const o=[];for(var e=0;e<this.pages.length;e++)if(e===this.pages.length-1){const n=Uint8Array.from(this.pages[e].slice(0,this.cursor));o.push(n)}else o.push(this.pages[e]);const t=new Uint8Array(o.reduce((n,r)=>n+r.length,0));return o.reduce((n,r)=>(t.set(r,n),n+r.length),0),t};be.prototype.writeByte=function(o){this.cursor>=be.pageSize&&this.newPage(),this.pages[this.page][this.cursor++]=o};be.prototype.writeUTFBytes=function(o){for(var e=o.length,t=0;t<e;t++)this.writeByte(o.charCodeAt(t))};be.prototype.writeBytes=function(o,e,t){for(var n=t||o.length,r=e||0;r<n;r++)this.writeByte(o[r])};function J(o,e){this.width=~~o,this.height=~~e,this.transparent=null,this.transIndex=0,this.repeat=-1,this.delay=0,this.image=null,this.pixels=null,this.indexedPixels=null,this.colorDepth=null,this.colorTab=null,this.neuQuant=null,this.usedEntry=new Array,this.palSize=7,this.dispose=-1,this.firstFrame=!0,this.sample=10,this.dither=!1,this.globalPalette=!1,this.out=new be}J.prototype.setDelay=function(o){this.delay=Math.round(o/10)};J.prototype.setFrameRate=function(o){this.delay=Math.round(100/o)};J.prototype.setDispose=function(o){o>=0&&(this.dispose=o)};J.prototype.setRepeat=function(o){this.repeat=o};J.prototype.setTransparent=function(o){this.transparent=o};J.prototype.addFrame=function(o){this.image=o,this.colorTab=this.globalPalette&&this.globalPalette.slice?this.globalPalette:null,this.getImagePixels(),this.analyzePixels(),this.globalPalette===!0&&(this.globalPalette=this.colorTab),this.firstFrame&&(this.writeHeader(),this.writeLSD(),this.writePalette(),this.repeat>=0&&this.writeNetscapeExt()),this.writeGraphicCtrlExt(),this.writeImageDesc(),!this.firstFrame&&!this.globalPalette&&this.writePalette(),this.writePixels(),this.firstFrame=!1};J.prototype.finish=function(){this.out.writeByte(59)};J.prototype.setQuality=function(o){o<1&&(o=1),this.sample=o};J.prototype.setDither=function(o){o===!0&&(o="FloydSteinberg"),this.dither=o};J.prototype.setGlobalPalette=function(o){this.globalPalette=o};J.prototype.getGlobalPalette=function(){return this.globalPalette&&this.globalPalette.slice&&this.globalPalette.slice(0)||this.globalPalette};J.prototype.writeHeader=function(){this.out.writeUTFBytes("GIF89a")};J.prototype.analyzePixels=function(){this.colorTab||(this.neuQuant=new Pa(this.pixels,this.sample),this.neuQuant.buildColormap(),this.colorTab=this.neuQuant.getColormap()),this.dither?this.ditherPixels(this.dither.replace("-serpentine",""),this.dither.match(/-serpentine/)!==null):this.indexPixels(),this.pixels=null,this.colorDepth=8,this.palSize=7,this.transparent!==null&&(this.transIndex=this.findClosest(this.transparent,!0))};J.prototype.indexPixels=function(o){var e=this.pixels.length/3;this.indexedPixels=new Uint8Array(e);for(var t=0,n=0;n<e;n++){var r=this.findClosestRGB(this.pixels[t++]&255,this.pixels[t++]&255,this.pixels[t++]&255);this.usedEntry[r]=!0,this.indexedPixels[n]=r}};J.prototype.ditherPixels=function(o,e){var t={FalseFloydSteinberg:[[.375,1,0],[.375,0,1],[.25,1,1]],FloydSteinberg:[[.4375,1,0],[.1875,-1,1],[.3125,0,1],[.0625,1,1]],Stucki:[[.19047619047619047,1,0],[.09523809523809523,2,0],[.047619047619047616,-2,1],[.09523809523809523,-1,1],[.19047619047619047,0,1],[.09523809523809523,1,1],[.047619047619047616,2,1],[.023809523809523808,-2,2],[.047619047619047616,-1,2],[.09523809523809523,0,2],[.047619047619047616,1,2],[.023809523809523808,2,2]],Atkinson:[[.125,1,0],[.125,2,0],[.125,-1,1],[.125,0,1],[.125,1,1],[.125,0,2]]};if(!o||!t[o])throw"Unknown dithering kernel: "+o;var n=t[o],r=0,a=this.height,i=this.width,s=this.pixels,l=e?-1:1;this.indexedPixels=new Uint8Array(this.pixels.length/3);for(var c=0;c<a;c++){e&&(l=l*-1);for(var f=l==1?0:i-1,h=l==1?i:0;f!==h;f+=l){r=c*i+f;var m=r*3,T=s[m],I=s[m+1],D=s[m+2];m=this.findClosestRGB(T,I,D),this.usedEntry[m]=!0,this.indexedPixels[r]=m,m*=3;for(var L=this.colorTab[m],g=this.colorTab[m+1],b=this.colorTab[m+2],P=T-L,p=I-g,k=D-b,C=l==1?0:n.length-1,A=l==1?n.length:0;C!==A;C+=l){var R=n[C][1],v=n[C][2];if(R+f>=0&&R+f<i&&v+c>=0&&v+c<a){var w=n[C][0];m=r+R+v*i,m*=3,s[m]=Math.max(0,Math.min(255,s[m]+P*w)),s[m+1]=Math.max(0,Math.min(255,s[m+1]+p*w)),s[m+2]=Math.max(0,Math.min(255,s[m+2]+k*w))}}}}};J.prototype.findClosest=function(o,e){return this.findClosestRGB((o&16711680)>>16,(o&65280)>>8,o&255,e)};J.prototype.findClosestRGB=function(o,e,t,n){if(this.colorTab===null)return-1;if(this.neuQuant&&!n)return this.neuQuant.lookupRGB(o,e,t);for(var r=0,a=256*256*256,i=this.colorTab.length,s=0,l=0;s<i;l++){var c=o-(this.colorTab[s++]&255),f=e-(this.colorTab[s++]&255),h=t-(this.colorTab[s++]&255),m=c*c+f*f+h*h;(!n||this.usedEntry[l])&&m<a&&(a=m,r=l)}return r};J.prototype.getImagePixels=function(){var o=this.width,e=this.height;this.pixels=new Uint8Array(o*e*3);for(var t=this.image,n=0,r=0,a=0;a<e;a++)for(var i=0;i<o;i++)this.pixels[r++]=t[n++],this.pixels[r++]=t[n++],this.pixels[r++]=t[n++],n++};J.prototype.writeGraphicCtrlExt=function(){this.out.writeByte(33),this.out.writeByte(249),this.out.writeByte(4);var o,e;this.transparent===null?(o=0,e=0):(o=1,e=2),this.dispose>=0&&(e=this.dispose&7),e<<=2,this.out.writeByte(0|e|0|o),this.writeShort(this.delay),this.out.writeByte(this.transIndex),this.out.writeByte(0)};J.prototype.writeImageDesc=function(){this.out.writeByte(44),this.writeShort(0),this.writeShort(0),this.writeShort(this.width),this.writeShort(this.height),this.firstFrame||this.globalPalette?this.out.writeByte(0):this.out.writeByte(128|this.palSize)};J.prototype.writeLSD=function(){this.writeShort(this.width),this.writeShort(this.height),this.out.writeByte(240|this.palSize),this.out.writeByte(0),this.out.writeByte(0)};J.prototype.writeNetscapeExt=function(){this.out.writeByte(33),this.out.writeByte(255),this.out.writeByte(11),this.out.writeUTFBytes("NETSCAPE2.0"),this.out.writeByte(3),this.out.writeByte(1),this.writeShort(this.repeat),this.out.writeByte(0)};J.prototype.writePalette=function(){this.out.writeBytes(this.colorTab);for(var o=3*256-this.colorTab.length,e=0;e<o;e++)this.out.writeByte(0)};J.prototype.writeShort=function(o){this.out.writeByte(o&255),this.out.writeByte(o>>8&255)};J.prototype.writePixels=function(){var o=new Ba(this.width,this.height,this.indexedPixels,this.colorDepth);o.encode(this.out)};J.prototype.stream=function(){return this.out};var Ia=globalThis&&globalThis.__awaiter||function(o,e,t,n){function r(a){return a instanceof t?a:new t(function(i){i(a)})}return new(t||(t=Promise))(function(a,i){function s(f){try{c(n.next(f))}catch(h){i(h)}}function l(f){try{c(n.throw(f))}catch(h){i(h)}}function c(f){f.done?a(f.value):r(f.value).then(s,l)}c((n=n.apply(o,e||[])).next())})};const{Canvas:De}=Jr,pt=.4;function un(o){if(!o)return;function e(t){t.onload=null,t.onerror=null}return new Promise(function(t,n){if(o.slice(0,4)=="data"){let a=new Image;a.onload=function(){t(a),e(a)},a.onerror=function(){n("Image load error"),e(a)},a.src=o;return}let r=new Image;r.setAttribute("crossOrigin","Anonymous"),r.onload=function(){t(r)},r.onerror=function(){n("Image load error")},r.src=o})}class q{constructor(e){const t=Object.assign({},e);if(Object.keys(q.defaultOptions).forEach(n=>{n in t||Object.defineProperty(t,n,{value:q.defaultOptions[n],enumerable:!0,writable:!0})}),t.components?typeof t.components=="object"&&Object.keys(q.defaultComponentOptions).forEach(n=>{n in t.components?Object.defineProperty(t.components,n,{value:Object.assign(Object.assign({},q.defaultComponentOptions[n]),t.components[n]),enumerable:!0,writable:!0}):Object.defineProperty(t.components,n,{value:q.defaultComponentOptions[n],enumerable:!0,writable:!0})}):t.components=q.defaultComponentOptions,t.dotScale!==null&&t.dotScale!==void 0){if(t.dotScale<=0||t.dotScale>1)throw new Error("dotScale should be in range (0, 1].");t.components.data.scale=t.dotScale,t.components.timing.scale=t.dotScale,t.components.alignment.scale=t.dotScale}this.options=t,this.canvas=new De(e.size,e.size),this.canvasContext=this.canvas.getContext("2d"),this.qrCode=new Oe(-1,this.options.correctLevel),Number.isInteger(this.options.maskPattern)&&(this.qrCode.maskPattern=this.options.maskPattern),Number.isInteger(this.options.version)&&(this.qrCode.typeNumber=this.options.version),this.qrCode.addData(this.options.text),this.qrCode.make()}draw(){return new Promise(e=>this._draw().then(e))}_clear(){this.canvasContext.clearRect(0,0,this.canvas.width,this.canvas.height)}static _prepareRoundedCornerClip(e,t,n,r,a,i){e.beginPath(),e.moveTo(t,n),e.arcTo(t+r,n,t+r,n+a,i),e.arcTo(t+r,n+a,t,n+a,i),e.arcTo(t,n+a,t,n,i),e.arcTo(t,n,t+r,n,i),e.closePath()}static _getAverageRGB(e){const n={r:0,g:0,b:0};let r,a,i=-4;const s={r:0,g:0,b:0};let l=0;a=e.naturalHeight||e.height,r=e.naturalWidth||e.width;const f=new De(r,a).getContext("2d");if(!f)return n;f.drawImage(e,0,0);let h;try{h=f.getImageData(0,0,r,a)}catch(m){return n}for(;(i+=5*4)<h.data.length;)h.data[i]>200||h.data[i+1]>200||h.data[i+2]>200||(++l,s.r+=h.data[i],s.g+=h.data[i+1],s.b+=h.data[i+2]);return s.r=~~(s.r/l),s.g=~~(s.g/l),s.b=~~(s.b/l),s}static _drawDot(e,t,n,r,a=0,i=1){e.fillRect((t+a)*r,(n+a)*r,i*r,i*r)}static _drawAlignProtector(e,t,n,r){e.clearRect((t-2)*r,(n-2)*r,5*r,5*r),e.fillRect((t-2)*r,(n-2)*r,5*r,5*r)}static _drawAlign(e,t,n,r,a=0,i=1,s,l){const c=e.fillStyle;e.fillStyle=s,new Array(4).fill(0).map((f,h)=>{q._drawDot(e,t-2+h,n-2,r,a,i),q._drawDot(e,t+2,n-2+h,r,a,i),q._drawDot(e,t+2-h,n+2,r,a,i),q._drawDot(e,t-2,n+2-h,r,a,i)}),q._drawDot(e,t,n,r,a,i),l||(e.fillStyle="rgba(255, 255, 255, 0.6)",new Array(2).fill(0).map((f,h)=>{q._drawDot(e,t-1+h,n-1,r,a,i),q._drawDot(e,t+1,n-1+h,r,a,i),q._drawDot(e,t+1-h,n+1,r,a,i),q._drawDot(e,t-1,n+1-h,r,a,i)})),e.fillStyle=c}_draw(){var e,t,n,r,a,i,s,l,c,f,h,m,T,I,D,L,g,b,P;return Ia(this,void 0,void 0,function*(){const p=(e=this.qrCode)===null||e===void 0?void 0:e.moduleCount,k=this.options.size;let C=this.options.margin;(C<0||C*2>=k)&&(C=0);const A=Math.ceil(C),R=k-2*C,v=this.options.whiteMargin,w=this.options.backgroundDimming,u=Math.ceil(R/p),E=u*p,x=E+2*A,O=new De(x,x),S=O.getContext("2d");this._clear(),S.save(),S.translate(A,A);const he=new De(x,x),V=he.getContext("2d");let ue=null,re=[];if(this.options.gifBackground){const M=ca(this.options.gifBackground);if(ue=M,re=fa(M,!0),this.options.autoColor){let _=0,F=0,z=0,ce=0;for(let X=0;X<re[0].colorTable.length;X++){const Y=re[0].colorTable[X];Y[0]>200||Y[1]>200||Y[2]>200||Y[0]===0&&Y[1]===0&&Y[2]===0||(ce++,_+=Y[0],F+=Y[1],z+=Y[2])}_=~~(_/ce),F=~~(F/ce),z=~~(z/ce),this.options.colorDark=`rgb(${_},${F},${z})`}}else if(this.options.backgroundImage){const M=yield un(this.options.backgroundImage);if(this.options.autoColor){const _=q._getAverageRGB(M);this.options.colorDark=`rgb(${_.r},${_.g},${_.b})`}V.drawImage(M,0,0,M.width,M.height,0,0,x,x),V.rect(0,0,x,x),V.fillStyle=w,V.fill()}else V.rect(0,0,x,x),V.fillStyle=this.options.colorLight,V.fill();const G=W.getPatternPosition(this.qrCode.typeNumber),se=((n=(t=this.options.components)===null||t===void 0?void 0:t.data)===null||n===void 0?void 0:n.scale)||pt,ke=(1-se)*.5;for(let M=0;M<p;M++)for(let _=0;_<p;_++){const F=this.qrCode.isDark(M,_),z=_<8&&(M<8||M>=p-8)||_>=p-8&&M<8,ce=M==6&&_>=8&&_<=p-8||_==6&&M>=8&&M<=p-8;let X=z||ce;for(let ee=1;ee<G.length-1;ee++)X=X||M>=G[ee]-2&&M<=G[ee]+2&&_>=G[ee]-2&&_<=G[ee]+2;const Y=_*u+(X?0:ke*u),ge=M*u+(X?0:ke*u);if(S.strokeStyle=F?this.options.colorDark:this.options.colorLight,S.lineWidth=.5,S.fillStyle=F?this.options.colorDark:this.options.colorLight,G.length===0)X||S.fillRect(Y,ge,(X?1:se)*u,(X?1:se)*u);else{const ee=_<p-4&&_>=p-4-5&&M<p-4&&M>=p-4-5;!X&&!ee&&S.fillRect(Y,ge,(X?1:se)*u,(X?1:se)*u)}}const le=G[G.length-1],$e=this.options.colorLight;if(S.fillStyle=$e,S.fillRect(0,0,8*u,8*u),S.fillRect(0,(p-8)*u,8*u,8*u),S.fillRect((p-8)*u,0,8*u,8*u),!((a=(r=this.options.components)===null||r===void 0?void 0:r.timing)===null||a===void 0)&&a.protectors&&(S.fillRect(8*u,6*u,(p-8-8)*u,u),S.fillRect(6*u,8*u,u,(p-8-8)*u)),!((s=(i=this.options.components)===null||i===void 0?void 0:i.cornerAlignment)===null||s===void 0)&&s.protectors&&q._drawAlignProtector(S,le,le,u),!((c=(l=this.options.components)===null||l===void 0?void 0:l.alignment)===null||c===void 0)&&c.protectors)for(let M=0;M<G.length;M++)for(let _=0;_<G.length;_++){const F=G[_],z=G[M];if(!(F===6&&(z===6||z===le))){if(z===6&&(F===6||F===le))continue;if(F===le&&z===le)continue;q._drawAlignProtector(S,F,z,u)}}S.fillStyle=this.options.colorDark,S.fillRect(0,0,7*u,u),S.fillRect((p-7)*u,0,7*u,u),S.fillRect(0,6*u,7*u,u),S.fillRect((p-7)*u,6*u,7*u,u),S.fillRect(0,(p-7)*u,7*u,u),S.fillRect(0,(p-7+6)*u,7*u,u),S.fillRect(0,0,u,7*u),S.fillRect(6*u,0,u,7*u),S.fillRect((p-7)*u,0,u,7*u),S.fillRect((p-7+6)*u,0,u,7*u),S.fillRect(0,(p-7)*u,u,7*u),S.fillRect(6*u,(p-7)*u,u,7*u),S.fillRect(2*u,2*u,3*u,3*u),S.fillRect((p-7+2)*u,2*u,3*u,3*u),S.fillRect(2*u,(p-7+2)*u,3*u,3*u);const _e=((h=(f=this.options.components)===null||f===void 0?void 0:f.timing)===null||h===void 0?void 0:h.scale)||pt,Me=(1-_e)*.5;for(let M=0;M<p-8;M+=2)q._drawDot(S,8+M,6,u,Me,_e),q._drawDot(S,6,8+M,u,Me,_e);const de=((T=(m=this.options.components)===null||m===void 0?void 0:m.cornerAlignment)===null||T===void 0?void 0:T.scale)||pt,Se=(1-de)*.5;q._drawAlign(S,le,le,u,Se,de,this.options.colorDark,((D=(I=this.options.components)===null||I===void 0?void 0:I.cornerAlignment)===null||D===void 0?void 0:D.protectors)||!1);const Ue=((g=(L=this.options.components)===null||L===void 0?void 0:L.alignment)===null||g===void 0?void 0:g.scale)||pt,Xe=(1-Ue)*.5;for(let M=0;M<G.length;M++)for(let _=0;_<G.length;_++){const F=G[_],z=G[M];if(!(F===6&&(z===6||z===le))){if(z===6&&(F===6||F===le))continue;if(F===le&&z===le)continue;q._drawAlign(S,F,z,u,Xe,Ue,this.options.colorDark,((P=(b=this.options.components)===null||b===void 0?void 0:b.alignment)===null||P===void 0?void 0:P.protectors)||!1)}}if(v&&(S.fillStyle=this.options.backgroundColor,S.fillRect(-A,-A,x,A),S.fillRect(-A,E,x,A),S.fillRect(E,-A,A,x),S.fillRect(-A,-A,A,x)),this.options.logoImage){const M=yield un(this.options.logoImage);let _=this.options.logoScale,F=this.options.logoMargin,z=this.options.logoCornerRadius;(_<=0||_>=1)&&(_=.2),F<0&&(F=0),z<0&&(z=0);const ce=E*_,X=.5*(x-ce),Y=X;S.restore(),S.fillStyle=this.options.logoBackgroundColor,S.save(),q._prepareRoundedCornerClip(S,X-F,Y-F,ce+2*F,ce+2*F,z+F),S.clip();const ge=S.globalCompositeOperation;S.globalCompositeOperation="destination-out",S.fill(),S.globalCompositeOperation=ge,S.restore(),S.save(),q._prepareRoundedCornerClip(S,X,Y,ce,ce,z),S.clip(),S.drawImage(M,X,Y,ce,ce),S.restore(),S.save(),S.translate(A,A)}if(ue){let M,_,F,z,ce,X;if(re.forEach(function(Y){M||(M=new J(k,k),M.setDelay(Y.delay),M.setRepeat(0));const{width:ge,height:ee}=Y.dims;_||(_=new De(ge,ee),F=_.getContext("2d"),F.rect(0,0,_.width,_.height),F.fillStyle="#ffffff",F.fill()),(!z||!X||ge!==z.width||ee!==z.height)&&(z=new De(ge,ee),ce=z.getContext("2d"),X=ce.createImageData(ge,ee)),X.data.set(Y.patch),ce.putImageData(X,0,0),F.drawImage(z.getContext("2d").canvas,Y.dims.left,Y.dims.top);const Ke=new De(x,x),ze=Ke.getContext("2d");ze.drawImage(_.getContext("2d").canvas,0,0,x,x),ze.rect(0,0,x,x),ze.fillStyle=w,ze.fill(),ze.drawImage(O.getContext("2d").canvas,0,0,x,x);const Ze=new De(k,k),je=Ze.getContext("2d");je.drawImage(Ke.getContext("2d").canvas,0,0,k,k),M.addFrame(je.getImageData(0,0,Ze.width,Ze.height).data)}),!M)throw new Error("No frames.");if(M.finish(),dn(this.canvas)){const ge=M.stream().toFlattenUint8Array().reduce((ee,Ke)=>ee+String.fromCharCode(Ke),"");return Promise.resolve(`data:image/gif;base64,${window.btoa(ge)}`)}return Promise.resolve(Buffer.from(M.stream().toFlattenUint8Array()))}else{V.drawImage(O.getContext("2d").canvas,0,0,x,x),S.drawImage(he.getContext("2d").canvas,-A,-A,x,x);const M=new De(k,k);M.getContext("2d").drawImage(O.getContext("2d").canvas,0,0,k,k),this.canvas=M;const F=this.options.gifBackground?"gif":"png";return dn(this.canvas)?Promise.resolve(this.canvas.toDataURL(F)):Promise.resolve(this.canvas.toBuffer(F))}})}}q.CorrectLevel=ve;q.defaultComponentOptions={data:{scale:.4},timing:{scale:.5,protectors:!1},alignment:{scale:.5,protectors:!1},cornerAlignment:{scale:.5,protectors:!0}};q.defaultOptions={text:"",size:400,margin:20,colorDark:"#000000",colorLight:"rgba(255, 255, 255, 0.6)",correctLevel:ve.M,backgroundImage:void 0,backgroundDimming:"rgba(0,0,0,0)",logoImage:void 0,logoScale:.2,logoMargin:4,logoCornerRadius:8,whiteMargin:!0,components:q.defaultComponentOptions,autoColor:!0,logoBackgroundColor:"#ffffff",backgroundColor:"#ffffff"};function dn(o){try{return o instanceof HTMLElement}catch(e){return typeof o=="object"&&o.nodeType===1&&typeof o.style=="object"&&typeof o.ownerDocument=="object"}}function Ma(o){return new Promise(e=>{const t=new XMLHttpRequest;t.responseType="blob",t.onload=function(){const n=new FileReader;n.onloadend=function(){e(n.result)},n.readAsArrayBuffer(t.response)},t.open("GET",o),t.send()})}const Ra=xe({name:"TheQrCode",props:{text:{type:String,required:!0},qid:{type:String},correctLevel:{type:Number,default:0},size:{type:Number,default:220},margin:{type:Number,default:20},colorDark:{type:String,default:"#000000"},colorLight:{type:String,default:"#FFFFFF"},bgSrc:{type:String,default:void 0},background:{type:String,default:"rgba(0,0,0,0)"},backgroundDimming:{type:String,default:"rgba(0,0,0,0)"},logoSrc:{type:String,default:void 0},logoBackgroundColor:{type:String,default:"rgba(255,255,255,1)"},gifBgSrc:{type:String,default:void 0},logoScale:{type:Number,default:.2},logoMargin:{type:Number,default:0},logoCornerRadius:{type:Number,default:8},whiteMargin:{type:[Boolean,String],default:!0},dotScale:{type:Number,default:1},autoColor:{type:[Boolean,String],default:!0},binarize:{type:[Boolean,String],default:!1},binarizeThreshold:{type:Number,default:128},callback:{type:Function,default:function(){}},bindElement:{type:Boolean,default:!0},backgroundColor:{type:String,default:"#FFFFFF"},components:{default:function(){return{data:{scale:1},timing:{scale:1,protectors:!1},alignment:{scale:1,protectors:!1},cornerAlignment:{scale:1,protectors:!0}}}}},data(){return{imgUrl:""}},watch:{$props:{deep:!0,handler(){this.main()}}},mounted(){this.main()},methods:{async main(){if(this.gifBgSrc){const t=await Ma(this.gifBgSrc),n=this.logoSrc;this.render(void 0,n,t);return}const o=this.bgSrc,e=this.logoSrc;this.render(o,e)},async render(o,e,t){console.log(o,e,t),new q({gifBackground:t,text:this.text,size:this.size}).draw().then(n=>{console.log("🚀 ~ dataUri:",n),this.imgUrl=n,this.callback&&this.callback(n,this.qid)})}},render(){return y(Vo,null,[this.bindElement&&this.imgUrl&&y("img",{style:"display: inline-block",src:this.imgUrl},null)])}}),Da=xe({name:"school-info",setup(){var D,L,g,b,P,p,k,C,A,R;const o=wt(),e=qe({areaList:[]}),t=qe({name:(L=(D=o.info.schoolInfos)==null?void 0:D[0])==null?void 0:L.name,logo:((b=(g=o.info.schoolInfos)==null?void 0:g[0])==null?void 0:b.logo)||o.info.avatar,provinceCode:((p=(P=o.info.schoolInfos)==null?void 0:P[0])==null?void 0:p.provinceCode)||"",cityCode:((C=(k=o.info.schoolInfos)==null?void 0:k[0])==null?void 0:C.cityCode)||"",regionCode:((R=(A=o.info.schoolInfos)==null?void 0:A[0])==null?void 0:R.regionCode)||""}),n=qe({loading:!1,schoolLoading:!0,dataList:[],disabled:!0,modal:!1,qrModal:!1}),r=()=>[{title:"老师姓名",key:"nickname",render:v=>y("div",{style:{userSelect:"all",cursor:"pointer"},onClick:()=>I(v.nickname)},[v.nickname])},{title:"手机号码",key:"phone",render:v=>y("div",{style:{userSelect:"all",cursor:"pointer"},onClick:()=>I(v.phone)},[v.phone])},{title:"性别",key:"questionTypeCode",render:v=>y("div",null,[v.gender?"男":"女"])},{title:"状态",key:"statusName",render:v=>y("div",null,[v.status==="ACTIVATION"?y(pe,{text:!0},{default:()=>[ae("启用")]}):y(pe,{class:ye.errorBtn,text:!0},{default:()=>[ae("冻结")]})])},{title:"操作",key:"titleImg",render:v=>y(Fe,null,{default:()=>[y(pe,{type:"primary",quaternary:!0,size:"small",onClick:()=>f(v)},{default:()=>[ae("重置密码")]}),v.status==="ACTIVATION"?y(pe,{type:"primary",quaternary:!0,size:"small",onClick:()=>c(v)},{default:()=>[ae("冻结")]}):y(pe,{class:ye.errorBtn,quaternary:!0,size:"small",onClick:()=>c(v)},{default:()=>[ae("解冻")]})]})}],a=async()=>{const v=await wn();(v==null?void 0:v.code)===200&&(e.areaList=v.data)},i=async()=>{var w,u,E;n.loading=!0;const v=await cr({schoolId:(u=(w=o.info.schoolInfos)==null?void 0:w[0])==null?void 0:u.id,page:1,rows:1e3});n.loading=!1,(v==null?void 0:v.code)===200&&Array.isArray((E=v==null?void 0:v.data)==null?void 0:E.rows)&&(n.dataList=v.data.rows)};mn(()=>{a(),i()});const s=qo(),l=Nt(),c=v=>{const w=v.status==="LOCKED"?"解冻":"冻结";s.warning({title:"温馨提示",content:`是否${w}"${v.nickname}"?`,positiveText:"确定",negativeText:"取消",onPositiveClick:async()=>{await dr({ids:[v.id],status:v.status==="LOCKED"?"ACTIVATION":"LOCKED"}),i(),l.success(w+"成功")}})},f=v=>{s.warning({title:"警告",content:`重置"${v.nickname}"的密码,是否继续?`,positiveText:"确定",negativeText:"取消",onPositiveClick:async()=>{await fr({userId:v.id,password:"ktyq"+v.phone.substr(7),clientType:"TEACHER"}),l.success("重置成功")}})},h=Q(),m=()=>{var v;(v=h.value)==null||v.validate(async w=>{var u;w||(n.schoolLoading=!1,await hr({...(u=o.info.schoolInfos)==null?void 0:u[0],...t}),n.schoolLoading=!0,l.success("修改成功"),n.disabled=!0)})},T=()=>{var u,E,x,O,S,he;const v=`tenantId=${(E=(u=o.info.schoolInfos)==null?void 0:u[0])==null?void 0:E.tenantId}&schoolId=${(O=(x=o.info.schoolInfos)==null?void 0:x[0])==null?void 0:O.id}&schoolName=${(he=(S=o.info.schoolInfos)==null?void 0:S[0])==null?void 0:he.name}`,w=`${location.origin}/classroom-app/#/teaher-register?`+v;return console.log(w),w},I=v=>{const w=document.createElement("input");w.value=v,document.body.appendChild(w),w.select(),w.setSelectionRange(0,w.value.length),document.execCommand("Copy"),document.body.removeChild(w),l.success("复制成功")};return()=>y("div",{class:ye.schoolInfo},[y(Ot,{ref:h,class:ye.formWrap,model:t,style:{padding:"30px 0"},disabled:n.disabled},{default:()=>[y(Fe,{size:[30,20]},{default:()=>[y("div",{class:ye.logo},[y(mt,{previewDisabled:!1,width:100,height:100,src:t.logo},null),y("div",{style:{display:n.disabled?"none":""},class:ye.changeHead},[ae("修改头像"),n.schoolLoading&&y(yn,{class:[ye.uploadFile],cropper:!0,"onUpdate:fileList":v=>{t.logo=v}},null)])]),y(Te,{label:"学校名称",path:"name",showRequireMark:!1,rule:[{required:!0,message:"请填写学校名称",trigger:"blur"}]},{default:()=>[y(lt,{bordered:!n.disabled,maxlength:20,value:t.name,"onUpdate:value":v=>t.name=v},null)]}),y(Te,{label:"城区"},{default:()=>{var v,w,u,E,x,O;return[y($t,{placeholder:"请选择城区",bordered:!n.disabled,options:e.areaList,labelField:"name",valueField:"code",childrenField:"areas",checkStrategy:"child",expandTrigger:"hover",defaultValue:((w=(v=o.info.schoolInfos)==null?void 0:v[0])==null?void 0:w.regionCode)||((E=(u=o.info.schoolInfos)==null?void 0:u[0])==null?void 0:E.cityCode)||((O=(x=o.info.schoolInfos)==null?void 0:x[0])==null?void 0:O.provinceCode),"onUpdate:value":(S,he,V)=>{var ue,re,G;t.provinceCode=(ue=V[0])==null?void 0:ue.code,t.cityCode=(re=V[1])==null?void 0:re.code,t.regionCode=(G=V[2])==null?void 0:G.code}},null)]}}),y(Te,null,{default:()=>[n.disabled?y(Fe,{class:ye.btnList,align:"center",justify:"end"},{default:()=>[y(pe,{class:ye.btn,color:"#f24433",onClick:()=>n.disabled=!1},{default:()=>[ae("修改信息")]})]}):y(Fe,{class:ye.btnList,align:"center",justify:"end"},{default:()=>[y(pe,{class:ye.btn,onClick:()=>n.disabled=!0},{default:()=>[ae("取消")]}),y(pe,{class:ye.btn,loading:!n.schoolLoading,type:"primary",onClick:()=>m()},{default:()=>[ae("完成")]})]})]})]})]}),y(Fe,{style:{padding:"32px 0"}},{default:()=>[y(pe,{type:"primary",renderIcon:()=>y(Go,{component:y(Br,null,null)},null),onClick:()=>n.modal=!0},{default:()=>[ae("添加老师")]}),y(pe,{type:"primary",onClick:()=>n.qrModal=!0},{default:()=>[ae("老师注册二维码")]})]}),y(Wo,{loading:n.loading,columns:r(),data:n.dataList},null),y(Lt,{class:ye.addTeacher,show:n.modal,"onUpdate:show":v=>n.modal=v,title:"添加老师",preset:"dialog",showIcon:!1},{default:()=>[y(Ir,{areaList:e.areaList,onClose:()=>{n.modal=!1,i()}},null)]}),y(Lt,{show:n.qrModal,"onUpdate:show":v=>n.qrModal=v,title:"二维码",preset:"dialog",showIcon:!1},{default:()=>[y("div",{style:{textAlign:"center"}},[y(Ra,{text:T(),size:300},null)])]})])}}),Ua=xe({name:"base-setting",setup(o,{emit:e,attrs:t}){const n=Q("person"),r=wt(),a=Xo();return a.query.activeTab&&(n.value=a.query.activeTab),Dt(()=>a.query.activeTab,i=>{n.value=i}),()=>y("div",{class:oe.listWrap},[y(Zo,{class:oe.customTabs,value:n.value,"onUpdate:value":i=>n.value=i,size:"large",animated:!0,"pane-wrapper-style":"margin: 0 -4px","pane-style":"padding-left: 4px; padding-right: 4px; box-sizing: border-box;"},{default:()=>[y(Qt,{name:"person",tab:"个人信息"},{default:()=>[y(gr,null,null)]}),r.info.isSuperAdmin&&y(Qt,{name:"school",tab:"学校设置"},{default:()=>[y(Da,null,null)]})]})])}});export{Ua as default};