index-022e8a05.js 93 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. import{s as oe,F as Zn}from"./forgotPassword-554f48d6.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 Be,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 uo,cy as co,ay as yt,$ as X,cz as ot,cA as fo,cB as Wt,cC as ho,cD as go,l as po,cE as Et,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 ct,cT as Re,cU as To,cV as vn,ci as So,cW as Zt,cX as Po,cY as vt,aB as Bo,w as Rt,b0 as Ao,cZ as Io,c_ as Mo,c$ as Eo,d0 as Ro,d1 as Fo,d2 as Do,d3 as Jt,d4 as Lo,d5 as _o,d6 as No,d7 as He,aK as Oo,cc as tt,b as Nt,c as wt,e as Ge,q as mn,f as y,o as mt,k as ue,N as Ot,ca as $o,cb as Pt,g as Se,h as lt,C as Uo,B as Ae,j as pe,y as Ft,d8 as Ko,a3 as zo,a_ as jo,a4 as bn,z as Yt,d9 as Ho,F as Vo,bW as Go,x as qo,A as Wo,a as Xo,m as Zo,n as Qt}from"./index-a03a64b8.js";import{U as yn}from"./index-bb315acb.js";import"./api-5a6cb9ad.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,Be(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:u,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:u,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:uo},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:u}=l;a.push(u),(l.isLeaf||!e)&&r.push({label:Dt(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 Dt(o,e,t){const n=[];for(;o;)n.push(o.rawNode[t]),o=o.parent;return n.reverse().join(e)}const ut=co("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:u,cascadeRef:f,mergedCheckStrategyRef:h,onLoadRef:m,mergedClsPrefixRef:S,mergedThemeRef:M,labelFieldRef:R,showCheckboxRef:F,updateHoverKey:g,updateKeyboardKey:b,addLoadingKey:P,deleteLoadingKey:p,closeMenu:k,doCheck:w,doUncheck:B,renderLabelRef:v}=yt(ut),E=X(()=>o.tmNode.key),T=X(()=>{const{value:le}=e,{value:Te}=t;return!Te&&le==="hover"}),c=X(()=>{if(T.value)return ie}),_=X(()=>{if(T.value)return $e}),C=ot(()=>{const{value:le}=n;return le?a.value.includes(E.value):r.value===E.value}),N=ot(()=>n.value?i.value.includes(E.value):!1),x=ot(()=>s.value.includes(E.value)),he=ot(()=>{const{value:le}=l;return le===null?!1:le===E.value}),G=ot(()=>t.value?u.value.has(E.value):!1),fe=X(()=>o.tmNode.isLeaf),ce=X(()=>o.tmNode.disabled),J=X(()=>o.tmNode.rawNode[R.value]),ae=X(()=>o.tmNode.shallowLoaded);function ke(le){if(ce.value)return;const{value:Te}=t,{value:Ue}=u,{value:Xe}=m,{value:I}=E,{value:L}=fe,{value:D}=ae;Et(le,"checkbox")||(Te&&!D&&!Ue.has(I)&&Xe&&(P(I),Xe(o.tmNode.rawNode).then(()=>{p(I)}).catch(()=>{p(I)})),g(I),b(I)),L&&Ee()}function ie(){if(!T.value||ce.value)return;const{value:le}=E;g(le),b(le)}function $e(){T.value&&ie()}function _e(){const{value:le}=fe;le||Ee()}function Ee(){const{value:le}=n,{value:Te}=E;le?N.value||C.value?B(Te):w(Te):(w(Te),k(!0))}return{checkStrategy:h,multiple:n,cascade:f,checked:C,indeterminate:N,hoverPending:x,keyboardPending:he,isLoading:G,showCheckbox:F,isLeaf:fe,disabled:ce,label:J,mergedClsPrefix:S,mergedTheme:M,handleClick:ke,handleCheckboxUpdateValue:_e,mergedHandleMouseEnter:c,mergedHandleMouseMove:_,renderLabel:v}},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(ut),r=Q(null),a=Q(null),i={scroll(s,l){var u,f;o.value?(u=a.value)===null||u===void 0||u.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:X(()=>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(ut),s=[],l=Q(null),u=Q(null);function f(){r()}bo(u,f);function h(F){var g;const{value:{loadingRequiredMessage:b}}=e;(g=l.value)===null||g===void 0||g.showOnce(b(F))}function m(F){a(F)}function S(F){const{value:g}=u;g&&(g.contains(F.relatedTarget)||o.onFocus(F))}function M(F){const{value:g}=u;g&&(g.contains(F.relatedTarget)||o.onBlur(F))}return Object.assign({isMounted:t,mergedClsPrefix:n,selfElRef:u,submenuInstRefs:s,maskInstRef:l,mergedTheme:i,handleFocusin:S,handleFocusout:M,handleClickOutside:m},{scroll(F,g,b){const P=s[F];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:u,doUncheck:f,doCheck:h,clearPattern:m}=yt(ut),S=Q(null),M=X(()=>nr(o.tmNodes,a.value==="child",o.labelField,o.separator)),R=X(()=>{const{filter:T}=o;if(T)return T;const{labelField:c}=o;return(_,C,N)=>N.some(x=>x[c]&&~x[c].indexOf(_))}),F=X(()=>{const{pattern:T}=o,{value:c}=R;return(T?M.value.filter(_=>c(T,_.rawNode,_.path)):M.value).map(_=>({value:_.value,label:_.label}))}),g=X(()=>pn(F.value,xo("value","children")));function b(){s()}function P(T){p(T)}function p(T){if(o.multiple){const{value:c}=t;Array.isArray(c)?c.includes(T.key)?f(T.key):h(T.key):c===null&&h(T.key),m()}else h(T.key),l(!0)}function k(){var T;(T=S.value)===null||T===void 0||T.prev()}function w(){var T;(T=S.value)===null||T===void 0||T.next()}function B(){var T;if(S){const c=(T=S.value)===null||T===void 0?void 0:T.getPendingTmNode();return c&&p(c),!0}return!1}function v(T){u(T)}return Object.assign({isMounted:e,mergedTheme:r,mergedClsPrefix:n,menuInstRef:S,selectTreeMate:g,handleResize:b,handleToggle:P,handleClickOutside:v,cascaderSlots:i},{prev:k,next:w,enter:B})},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"}),ct("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}),ct("label",`
  68. flex: 1 0 0;
  69. overflow: hidden;
  70. text-overflow: ellipsis;
  71. `),ct("prefix",{width:"32px",display:"flex",alignItems:"center",justifyContent:"center"}),ct("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}=To(o),i=vn("Cascader","-cascader",ir,tr,o,n),{localeRef:s}=So("Cascader"),l=Q(o.defaultValue),u=X(()=>o.value),f=Zt(u,l),h=X(()=>o.leafOnly?"child":o.checkStrategy),m=Q(""),S=Po(o),{mergedSizeRef:M,mergedDisabledRef:R,mergedStatusRef:F}=S,g=Q(null),b=Q(null),P=Q(null),p=Q(null),k=Q(null),w=Q(new Set),B=Q(null),v=Q(null),E=vt(o),T=Q(!1),c=d=>{w.value.add(d)},_=d=>{w.value.delete(d)},C=X(()=>{const{valueField:d,childrenField:A,disabledField:O}=o;return pn(o.options,{getDisabled(j){return j[O]},getKey(j){return j[d]},getChildren(j){return j[A]}})}),N=X(()=>{const{cascade:d,multiple:A}=o;return A&&Array.isArray(f.value)?C.value.getCheckedKeys(f.value,{cascade:d,allowNotLoaded:o.allowCheckingNotLoaded}):{checkedKeys:[],indeterminateKeys:[]}}),x=X(()=>N.value.checkedKeys),he=X(()=>N.value.indeterminateKeys),G=X(()=>{const{treeNodePath:d,treeNode:A}=C.value.getPath(k.value);let O;return A===null?O=[C.value.treeNodes]:(O=d.map(j=>j.siblings),!A.isLeaf&&!w.value.has(A.key)&&A.children&&O.push(A.children)),O}),fe=X(()=>{const{keyPath:d}=C.value.getPath(k.value);return d}),ce=X(()=>i.value.self.optionHeight);Bo(o.options)&&Rt(o.options,(d,A)=>{d!==A&&(k.value=null,p.value=null)});function J(d){const{onUpdateShow:A,"onUpdate:show":O}=o;A&&He(A,d),O&&He(O,d),Ue.value=d}function ae(d,A,O){const{onUpdateValue:j,"onUpdate:value":$,onChange:te}=o,{nTriggerFormInput:U,nTriggerFormChange:ne}=S;j&&He(j,d,A,O),$&&He($,d,A,O),te&&He(te,d,A,O),l.value=d,U(),ne()}function ke(d){p.value=d}function ie(d){k.value=d}function $e(d){const{value:{getNode:A}}=C;return d.map(O=>{var j;return((j=A(O))===null||j===void 0?void 0:j.rawNode)||null})}function _e(d){var A;const{cascade:O,multiple:j,filterable:$}=o,{value:{check:te,getNode:U,getPath:ne}}=C;if(j)try{const{checkedKeys:H}=te(d,N.value.checkedKeys,{cascade:O,checkStrategy:h.value,allowNotLoaded:o.allowCheckingNotLoaded});ae(H,$e(H),H.map(Ye=>{var nt;return dt((nt=ne(Ye))===null||nt===void 0?void 0:nt.treeNodePath)})),$&&W(),p.value=d,k.value=d}catch(H){if(H instanceof Lo){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)ae(d,H.rawNode,dt(ne(d).treeNodePath));else return!1}else{const H=U(d);ae(d,(H==null?void 0:H.rawNode)||null,dt((A=ne(d))===null||A===void 0?void 0:A.treeNodePath))}return!0}function Ee(d){const{cascade:A,multiple:O}=o;if(O){const{value:{uncheck:j,getNode:$,getPath:te}}=C,{checkedKeys:U}=j(d,N.value.checkedKeys,{cascade:A,checkStrategy:h.value,allowNotLoaded:o.allowCheckingNotLoaded});ae(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 le=X(()=>{if(o.multiple){const{showPath:d,separator:A,labelField:O,cascade:j}=o,{getCheckedKeys:$,getNode:te}=C.value;return $(x.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?Dt(H,A,O):H.rawNode[O],value:H.key}})}else return[]}),Te=X(()=>{const{multiple:d,showPath:A,separator:O,labelField:j}=o,{value:$}=f;if(!d&&!Array.isArray($)){const{getNode:te}=C.value;if($===null)return null;const U=te($);return U===null?{label:String($),value:$}:{label:A?Dt(U,O,j):U.rawNode[j],value:U.key}}else return null}),Ue=Q(!1),Xe=Be(o,"show"),I=Zt(Xe,Ue),L=X(()=>{const{placeholder:d}=o;return d!==void 0?d:s.value.placeholder}),D=X(()=>!!(o.filterable&&m.value));Rt(I,d=>{if(!d||o.multiple)return;const{value:A}=f;!Array.isArray(A)&&A!==null?(p.value=A,k.value=A,Oo(()=>{var O;if(!I.value)return;const{value:j}=k;if(f.value!==null){const $=C.value.getNode(j);$&&((O=g.value)===null||O===void 0||O.scroll($.level,$.index,it(ce.value)))}})):(p.value=null,k.value=null)},{immediate:!0});function z(d){const{onBlur:A}=o,{nTriggerFormBlur:O}=S;A&&He(A,d),O()}function se(d){const{onFocus:A}=o,{nTriggerFormFocus:O}=S;A&&He(A,d),O()}function W(){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(){R.value||(m.value="",J(!0),o.filterable&&W())}function ee(d=!1){d&&Y(),J(!1),m.value=""}function Ke(d){var A;D.value||I.value&&(!((A=P.value)===null||A===void 0)&&A.$el.contains(_o(d))||ee())}function ze(d){D.value&&Ke(d)}function Ze(){o.clearFilterAfterSelect&&(m.value="")}function je(d){var A,O,j;const{value:$}=p,{value:te}=C;switch(d){case"prev":if($!==null){const U=te.getPrev($,{loop:!0});U!==null&&(ke(U.key),(A=g.value)===null||A===void 0||A.scroll(U.level,U.index,it(ce.value)))}break;case"next":if($===null){const U=te.getFirstAvailableNode();U!==null&&(ke(U.key),(O=g.value)===null||O===void 0||O.scroll(U.level,U.index,it(ce.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(ce.value)))}break;case"child":if($!==null){const U=te.getNode($);if(U!==null)if(U.shallowLoaded){const ne=te.getChild($);ne!==null&&(ie($),ke(ne.key))}else{const{value:ne}=w;if(!ne.has($)){c($),ie($);const{onLoad:H}=o;H&&H(U.rawNode).then(()=>{_($)}).catch(()=>{_($)})}}}break;case"parent":if($!==null){const U=te.getParent($);if(U!==null){ke(U.key);const ne=U.getParent();ie(ne===null?null:ne.key)}}break}}function Ht(d){var A,O;switch(d.key){case" ":case"ArrowDown":case"ArrowUp":if(o.filterable&&I.value)break;d.preventDefault();break}if(!Et(d,"action"))switch(d.key){case" ":if(o.filterable)return;case"Enter":if(!I.value)ge();else{const{value:j}=D,{value:$}=p;if(j)b.value&&b.value.enter()&&Ze();else if($!==null)if(x.value.includes($)||he.value.includes($))Ee($);else{const te=_e($);!o.multiple&&te&&ee(!0)}}break;case"ArrowUp":d.preventDefault(),I.value&&(D.value?(A=b.value)===null||A===void 0||A.prev():je("prev"));break;case"ArrowDown":d.preventDefault(),I.value?D.value?(O=b.value)===null||O===void 0||O.next():je("next"):ge();break;case"ArrowLeft":d.preventDefault(),I.value&&!D.value&&je("parent");break;case"ArrowRight":d.preventDefault(),I.value&&!D.value&&je("child");break;case"Escape":I.value&&(No(d),ee(!0))}}function Rn(d){Ht(d)}function Fn(d){d.stopPropagation(),o.multiple?ae([],[],[]):ae(null,null,null)}function Dn(d){var A;!((A=g.value)===null||A===void 0)&&A.$el.contains(d.relatedTarget)||(T.value=!0,se(d))}function Ln(d){var A;!((A=g.value)===null||A===void 0)&&A.$el.contains(d.relatedTarget)||(T.value=!1,z(d),ee())}function _n(d){var A;!((A=P.value)===null||A===void 0)&&A.$el.contains(d.relatedTarget)||(T.value=!0,se(d))}function Nn(d){var A;!((A=P.value)===null||A===void 0)&&A.$el.contains(d.relatedTarget)||(T.value=!1,z(d))}function On(d){Et(d,"action")||o.multiple&&o.filter&&(d.preventDefault(),W())}function $n(){ee(!0)}function Un(){o.filterable?ge():I.value?ee(!0):ge()}function Kn(d){m.value=d.target.value}function zn(d){const{multiple:A}=o,{value:O}=f;A&&Array.isArray(O)&&d.value!==void 0?Ee(d.value):ae(null,null,null)}function Vt(){var d;(d=B.value)===null||d===void 0||d.syncPosition()}function Gt(){var d;(d=v.value)===null||d===void 0||d.syncPosition()}function jn(){I.value&&(D.value?Vt():Gt())}const St=X(()=>!!(o.multiple&&o.cascade||h.value!=="child"));Ao(ut,{slots:e,mergedClsPrefixRef:n,mergedThemeRef:i,mergedValueRef:f,checkedKeysRef:x,indeterminateKeysRef:he,hoverKeyPathRef:fe,mergedCheckStrategyRef:h,showCheckboxRef:St,cascadeRef:Be(o,"cascade"),multipleRef:Be(o,"multiple"),keyboardKeyRef:p,hoverKeyRef:k,remoteRef:Be(o,"remote"),loadingKeySetRef:w,expandTriggerRef:Be(o,"expandTrigger"),isMountedRef:Io(),onLoadRef:Be(o,"onLoad"),virtualScrollRef:Be(o,"virtualScroll"),optionHeightRef:ce,localeRef:s,labelFieldRef:Be(o,"labelField"),renderLabelRef:Be(o,"renderLabel"),syncCascaderMenuPosition:Gt,syncSelectMenuPosition:Vt,updateKeyboardKey:ke,updateHoverKey:ie,addLoadingKey:c,deleteLoadingKey:_,doCheck:_e,doUncheck:Ee,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(St.value){const d=x.value;return{keys:d,options:$e(d)}}return{keys:[],options:[]}},getIndeterminateData:()=>{if(St.value){const d=he.value;return{keys:d,options:$e(d)}}return{keys:[],options:[]}}},qt=X(()=>{const{self:{optionArrowColor:d,optionTextColor:A,optionTextColorActive:O,optionTextColorDisabled:j,optionCheckMarkColor:$,menuColor:te,menuBoxShadow:U,menuDividerColor:ne,menuBorderRadius:H,menuHeight:Ye,optionColorHover:nt,optionHeight:Vn,optionFontSize:Gn,loadingColor:qn,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":Gn,"--n-option-text-color":A,"--n-option-text-color-disabled":j,"--n-option-text-color-active":O,"--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":qn}}),Je=a?Eo("cascader",void 0,qt,o):void 0;return Object.assign(Object.assign({},Hn),{handleTriggerResize:jn,mergedStatus:F,selectMenuFollowerRef:B,cascaderMenuFollowerRef:v,triggerInstRef:P,selectMenuInstRef:b,cascaderMenuInstRef:g,mergedBordered:t,mergedClsPrefix:n,namespace:r,mergedValue:f,mergedShow:I,showSelectMenu:D,pattern:m,treeMate:C,mergedSize:M,mergedDisabled:R,localizedPlaceholder:L,selectedOption:Te,selectedOptions:le,adjustedTo:E,menuModel:G,handleMenuTabout:$n,handleMenuFocus:_n,handleMenuBlur:Nn,handleMenuKeydown:Rn,handleMenuMousedown:On,handleTriggerFocus:Dn,handleTriggerBlur:Ln,handleTriggerClick:Un,handleClear:Fn,handleDeleteOption:zn,handlePatternInput:Kn,handleKeydown:Ht,focused:T,optionHeight:ce,mergedTheme:i,cssVars:a?void 0:qt,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(Ro,null,{default:()=>[K(Fo,null,{default:()=>K(Do,{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,ur=o=>tt.post("/edu-app/teacher/page",{data:o}),cr=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,u,f,h;const o=Nt(),e=wt(),t=Ge({sexs:[{label:"男",value:1,class:"option"},{label:"女",value:0,class:"option"}],areaList:[]}),n=Q(),r=Ge({provinceCode:"",cityCode:"",regionCode:"",nickname:e.info.nickname,phone:e.info.phone,gender:e.info.gender,schoolId:(u=(l=e.info.schoolInfos)==null?void 0:l[0])==null?void 0:u.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=Ge({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=>{m||(await Ko(r),console.log(r),e.getInfo(),a.disabled=!0,o.success("修改成功"))})};return()=>{var m,S;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]},[ue("修改头像"),a.uploadShow&&y(yn,{class:[oe.uploadFile],cropper:!0,"onUpdate:fileList":M=>{r.avatar=M,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},[(S=(m=e.info.schoolInfos)==null?void 0:m[0])==null?void 0:S.name,ue(" | 音乐老师")])])]),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(Se,{label:"姓名",path:"nickname",rule:{required:!0,message:"请填写老师姓名",trigger:"blur"}},{default:()=>[y(lt,{bordered:!a.disabled,placeholder:"请填写老师姓名",value:r.nickname,"onUpdate:value":M=>r.nickname=M},null)]})]}),y(Pt,null,{default:()=>[y(Se,{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":M=>r.phone=M},null)]})]}),y(Pt,null,{default:()=>[y(Se,{label:"性别",path:"sex"},{default:()=>[y(Uo,{bordered:!a.disabled,class:oe.select,showArrow:!a.disabled,placeholder:"请选择性别",options:t.sexs,value:r.gender,"onUpdate:value":M=>r.gender=M},null)]})]})]}),y(Se,{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,"onUpdate:value":(M,R,F)=>{var g,b,P;r.provinceCode=(g=F[0])==null?void 0:g.code,r.cityCode=(b=F[1])==null?void 0:b.code,r.regionCode=(P=F[2])==null?void 0:P.code}},null)]})]})]),a.disabled?y(Ae,{class:oe.btnList,align:"center",justify:"end"},{default:()=>[y(pe,{class:oe.btn,color:"#198cfe",onClick:()=>a.openChangePwd=!0},{default:()=>[ue("修改密码")]}),y(pe,{class:oe.btn,color:"#f24433",onClick:()=>a.disabled=!1},{default:()=>[ue("修改信息")]})]}):y(Ae,{class:oe.btnList,align:"center",justify:"end"},{default:()=>[y(pe,{class:oe.btn,onClick:()=>a.disabled=!0},{default:()=>[ue("取消")]}),y(pe,{class:oe.btn,type:"primary",onClick:()=>s()},{default:()=>[ue("完成")]})]}),y(Ft,{class:oe.changePwdModal,show:a.openChangePwd,"onUpdate:show":M=>a.openChangePwd=M,preset:"dialog",showIcon:!1,title:"修改密码"},{default:()=>[y(Zn,{onClose:()=>{a.openChangePwd=!1}},null)]})])}}}),pr="_logo_sn7fs_1",vr="_changeHead_sn7fs_8",mr="_uploadFile_sn7fs_29",br="_formWrap_sn7fs_37",yr="_schoolInfo_sn7fs_61",wr="_errorBtn_sn7fs_103",Cr="_addTeacher_sn7fs_106",xr="_btnList_sn7fs_178",kr="_btn_sn7fs_178",ye={logo:pr,changeHead:vr,uploadFile:mr,formWrap:br,schoolInfo:yr,errorBtn:wr,addTeacher:Cr,btnList:xr,btn:kr},Tr={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},Sr=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),Br=[Sr,Pr],Ar=xe({name:"Add",render:function(e,t){return jo(),zo("svg",Tr,Br)}}),Ir=xe({name:"teacher-operation",emits:["close"],props:{areaList:{type:Array,default:()=>[]}},setup(o,{emit:e}){var l,u,f,h;const t=wt(),n=Ge({provinceCode:"",cityCode:"",regionCode:"",tenantId:(u=(l=t.info.schoolInfos)==null?void 0:l[0])==null?void 0:u.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 cr({...n}),i.success("添加成功")}catch(S){console.log(S)}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(Se,{label:"老师姓名",path:"nickname",rule:[{required:!0,message:"请输入老师姓名"}]},{default:()=>[y(lt,{value:n.nickname,"onUpdate:value":m=>n.nickname=m,placeholder:"请输入老师姓名",clearable:!0,maxlength:14},null)]}),y(Se,{label:"老师性别",path:"gender",rule:[{required:!0,message:"请选择老师性别"}]},{default:()=>[y(Ae,null,{default:()=>[y(Yt("n-button"),{class:"genderBtn",type:n.gender?"info":void 0,tertiary:!n.gender,onClick:()=>{n.gender=1}},{default:()=>[ue("男")]}),y(Yt("n-button"),{class:"genderBtn",type:n.gender?void 0:"info",tertiary:!!n.gender,onClick:()=>{n.gender=0}},{default:()=>[ue("女")]})]})]}),y(Se,{label:"城区"},{default:()=>[y($t,{to:"body",placeholder:"请选择城区",options:o.areaList,labelField:"name",valueField:"code",childrenField:"areas",checkStrategy:"child",expandTrigger:"hover","onUpdate:value":(m,S,M)=>{var R,F,g;n.provinceCode=(R=M[0])==null?void 0:R.code,n.cityCode=(F=M[1])==null?void 0:F.code,n.regionCode=(g=M[2])==null?void 0:g.code}},null)]}),y(Se,{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:()=>[ue("默认密码为ktyq+手机号后四位")]})])]}),y(Ae,{style:{padding:"20px 0 32px 0"},justify:"center"},{default:()=>[y(pe,{class:"actionBtn",round:!0,type:"default",onClick:()=>e("close")},{default:()=>[ue("取消")]}),y(pe,{class:"actionBtn",round:!0,type:"primary",onClick:()=>s(),loading:r.value},{default:()=>[ue("确定")]})]})])}});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 qe={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?".":qe.normalize(e)},relative:function(e,t){if(Pe(e),Pe(t),e===t||(e=qe.resolve(e),t=qe.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,u=a<l?a:l,f=-1,h=0;h<=u;++h){if(h===u){if(l>u){if(t.charCodeAt(i+h)===47)return t.slice(i+h+1);if(h===0)return t.slice(i+h)}else a>u&&(e.charCodeAt(n+h)===47?f=h:h===0&&(f=0));break}var m=e.charCodeAt(n+h),S=t.charCodeAt(i+h);if(m!==S)break;m===47&&(f=h)}var M="";for(h=n+f+1;h<=r;++h)(h===r||e.charCodeAt(h)===47)&&(M.length===0?M+="..":M+="/..");return M.length>0?M+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 u=e.charCodeAt(i);if(u===47){if(!a){n=i+1;break}}else l===-1&&(a=!1,l=i+1),s>=0&&(u===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,u=!0,f=e.length-1,h=0;f>=a;--f){if(n=e.charCodeAt(f),n===47){if(!u){s=f+1;break}continue}l===-1&&(u=!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};qe.posix=qe;const Er=qe.extname,Cn=qe.basename;class Rr{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 Fr(o,{filename:e="",extension:t="",format:R,page:r,quality:a,matte:i,density:s,outline:l,archive:S}={}){var{fromMime:f,toMime:h,expected:m}=new Rr,S=S||"canvas",M=R||t.replace(/@\d+x$/i,"")||Er(e),R=f(h(M)||M),F=h(R),g=o.length;if(!M)throw new Error("Cannot determine image format (use a filename extension or 'format' argument)");if(!R)throw new Error(`Unsupported file format "${M}" (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,(w,B)=>(P=!0,B=parseInt(B,10),b=isFinite(B)?B: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||R=="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 w=(t||Cn(e,M)).match(/@(\d+)x$/i);s=w?parseInt(w[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:R=="svg"&&(l=!!l),{filename:e,pattern:p,format:R,mime:F,pages:o,padding:b,quality:a,matte:i,density:s,outline:l,archive:S}}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 Bt(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:u}=this,f=Bt(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);u+=i;let h=Bt(i+a.length+l).set32(0,67324752).bytes(4,f.array).bytes(30,r).bytes(i,a);u+=a.length,h.set32(s,134695760).bytes(s+4,f.array.slice(10,22)),u+=l,this.files.push({offset:u,folder:n,name:r,header:f,payload:h}),this.offset=u}toBuffer(){let e=this.files.reduce((h,{name:m})=>46+m.length+h,0),t=Bt(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),u=0;for(var{payload:f}of this.files)l.set(f.array,u),u+=f.size;return l.set(t.array,u),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))},Dr=(...o)=>Ut(...o).then(e=>e.arrayBuffer()),Lr=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",u=new xt(l);await Promise.all(o.map(async(f,h)=>{let m=s(h);await u.add(m,await Ut(f,e,t,n))})),xn(`${l}.zip`,u.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:Dr,asDownload:Lr,asZipDownload:_r,atScale:Nr,options:Fr},{asBuffer:At,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:()=>At(n,"image/png"),jpg:()=>At(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:u,height:f}=n,l=Object.assign(document.createElement("canvas"),{width:u,height:f});l.getContext("2d").drawImage(n,0,0),r.push(l);var[u,f]=s.length?s:[u,f];return Object.assign(n,{width:u,height:f}).getContext("2d")},saveAs(s,l){l=typeof l=="number"?{quality:l}:l;let u=Mt(this.pages,{filename:s,...l}),{pattern:f,padding:h,mime:m,quality:S,matte:M,density:R,archive:F}=u,g=It(u.pages,R);return h==null?$r(g[0],m,S,M,s):Ur(g,m,S,M,F,f,h)},toBuffer(s="png",l={}){l=typeof l=="number"?{quality:l}:l;let u=Mt(this.pages,{extension:s,...l}),{mime:f,quality:h,matte:m,pages:S,density:M}=u,R=It(S,M,m)[0];return At(R,f,h,m)},[nn]:n.toDataURL.bind(n),toDataURL(s="png",l={}){l=typeof l=="number"?{quality:l}:l;let u=Mt(this.pages,{extension:s,...l}),{mime:f,quality:h,matte:m,pages:S,density:M}=u,R=It(S,M,m)[0],F=R[R===n?nn:"toDataURL"](f,h);return Promise.resolve(F)}})}};const{CanvasRenderingContext2D:jr,CanvasGradient:Hr,CanvasPattern:Vr,Image:kn,ImageData:Gr,Path2D:qr,DOMMatrix:Wr,DOMRect:Xr,DOMPoint:Zr}=window,Jr={Canvas:zr,loadImage:Kr,CanvasRenderingContext2D:jr,CanvasGradient:Hr,CanvasPattern:Vr,Image:kn,ImageData:Gr,Path2D:qr,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++],Tn=(o=0)=>e=>e.data[e.pos+o],Me=o=>e=>e.data.subarray(e.pos,e.pos+=o),kt=o=>e=>e.data.subarray(e.pos,e.pos+o),Lt=o=>e=>Array.from(Me(o)(e)).map(t=>String.fromCharCode(t)).join(""),Ve=o=>e=>{const t=Me(2)(e);return o?(t[1]<<8)+t[0]:(t[0]<<8)+t[1]},Sn=(o,e)=>(t,n,r)=>{const a=typeof e=="function"?e(t,n,r):e,i=Me(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 Tt={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 u=n-o.pos;t.push(Me(u)(o)),r+=u;break}t.push(Me(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:Me(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:Sn(3,(o,e,t)=>Math.pow(2,t.descriptor.lct.size+1))},(o,e,t)=>t.descriptor.lct.exists),{data:[{minCodeSize:Ce()},Tt]}]},o=>Tn()(o)===44),oa=We({text:[{codes:Me(2)},{blockSize:Ce()},{preData:(o,e,t)=>Me(t.text.blockSize)(o)},Tt]},o=>{var e=kt(2)(o);return e[0]===33&&e[1]===1}),ra=We({application:[{codes:Me(2)},{blockSize:Ce()},{id:(o,e,t)=>Lt(t.blockSize)(o)},Tt]},o=>{var e=kt(2)(o);return e[0]===33&&e[1]===255}),aa=We({comment:[{codes:Me(2)},Tt]},o=>{var e=kt(2)(o);return e[0]===33&&e[1]===254}),ia=[{header:[{signature:Lt(3)},{version:Lt(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:Sn(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=Tn()(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 u=a[l];u<n;u+=i[l])r(u,s),s++;return t},la=(o,e,t)=>{const a=t;var i,s,l,u,f,h,m,k,S,M,p,R,w,B,E,v;const F=new Array(t),g=new Array(4096),b=new Array(4096),P=new Array(4096+1);for(R=o,s=1<<R,f=s+1,i=s+2,m=-1,u=R+1,l=(1<<u)-1,S=0;S<s;S++)g[S]=0,b[S]=S;var p,k,w,B,v,E;for(p=k=w=B=v=E=0,M=0;M<a;){if(B===0){if(k<u){p+=e[E]<<k,k+=8,E++;continue}if(S=p&l,p>>=u,k-=u,S>i||S==f)break;if(S==s){u=R+1,l=(1<<u)-1,i=s+2,m=-1;continue}if(m==-1){P[B++]=b[S],m=S,w=S;continue}for(h=S,S==i&&(P[B++]=w,S=m);S>s;)P[B++]=b[S],S=g[S];w=b[S]&255,P[B++]=w,i<4096&&(g[i]=m,b[i]=w,i++,!(i&l)&&i<4096&&(u++,l+=i)),m=h}B--,F[v++]=P[B],M++}for(M=v;M<a;M++)F[M]=0;return F},ua=o=>{const e=new Uint8Array(o);return st(Qr(e),ia)},ca=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=ca(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=Ie[r][0];break;case ve.M:a=Ie[r][1];break;case ve.Q:a=Ie[r][2];break;case ve.H:a=Ie[r][3];break}return n<=a}function ga(o,e){for(var t=1,n=Pn(o),r=0,a=Ie.length;r<a;r++){var i=0;switch(e){case ve.L:i=Ie[r][0];break;case ve.M:i=Ie[r][1];break;case ve.Q:i=Ie[r][2];break;case ve.H:i=Ie[r][3];break}if(n<=i)break;t++}if(t>Ie.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(De).includes(this.maskPattern))return this.maskPattern;let e=0,t=0;for(let n=0;n<8;n++){this.makeImpl(!0,n);const r=q.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=q.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=q.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=q.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 u=!1;i<e.length&&(u=(e[i]>>>a&1)==1),q.getMask(t,r,s-l)&&(u=!u),this.modules[r][s-l]=u,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=Le.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(),q.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 S=t[l].dataCount,M=t[l].totalCount-S;r=Math.max(r,S),a=Math.max(a,M),i[l]=new Array(S);for(var u=0;u<i[l].length;u++)i[l][u]=255&e.buffer[u+n];n+=S;const R=q.getErrorCorrectPolynomial(M),g=new et(i[l],R.getLength()-1).mod(R);s[l]=new Array(R.getLength()-1);for(var u=0;u<s[l].length;u++){const P=u+g.getLength()-s[l].length;s[l][u]=P>=0?g.get(P):0}}let f=0;for(var u=0;u<t.length;u++)f+=t[u].totalCount;const h=new Array(f);let m=0;for(var u=0;u<r;u++)for(var l=0;l<t.length;l++)u<i[l].length&&(h[m++]=i[l][u]);for(var u=0;u<a;u++)for(var l=0;l<t.length;l++)u<s[l].length&&(h[m++]=s[l][u]);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},De={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};class q{static getBCHTypeInfo(e){let t=e<<10;for(;q.getBCHDigit(t)-q.getBCHDigit(q.G15)>=0;)t^=q.G15<<q.getBCHDigit(t)-q.getBCHDigit(q.G15);return(e<<10|t)^q.G15_MASK}static getBCHTypeNumber(e){let t=e<<12;for(;q.getBCHDigit(t)-q.getBCHDigit(q.G18)>=0;)t^=q.G18<<q.getBCHDigit(t)-q.getBCHDigit(q.G18);return e<<12|t}static getBCHDigit(e){let t=0;for(;e!=0;)t++,e>>>=1;return t}static getPatternPosition(e){return q.PATTERN_POSITION_TABLE[e-1]}static getMask(e,t,n){switch(e){case De.PATTERN000:return(t+n)%2==0;case De.PATTERN001:return t%2==0;case De.PATTERN010:return n%3==0;case De.PATTERN011:return(t+n)%3==0;case De.PATTERN100:return(Math.floor(t/2)+Math.floor(n/3))%2==0;case De.PATTERN101:return t*n%2+t*n%3==0;case De.PATTERN110:return(t*n%2+t*n%3)%2==0;case De.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,re.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 u=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||u==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}}q.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]];q.G15=1335;q.G18=7973;q.G15_MASK=21522;class re{static glog(e){if(e<1)throw new Error(`glog(${e})`);return re.LOG_TABLE[e]}static gexp(e){for(;e<0;)e+=255;for(;e>=256;)e-=255;return re.EXP_TABLE[e]}}re.EXP_TABLE=new Array(256);re.LOG_TABLE=new Array(256);re._constructor=function(){for(var o=0;o<8;o++)re.EXP_TABLE[o]=1<<o;for(var o=8;o<256;o++)re.EXP_TABLE[o]=re.EXP_TABLE[o-4]^re.EXP_TABLE[o-5]^re.EXP_TABLE[o-6]^re.EXP_TABLE[o-8];for(var o=0;o<255;o++)re.LOG_TABLE[re.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]^=re.gexp(re.glog(this.get(n))+re.glog(e.get(r)));return new et(t,0)}mod(e){if(this.getLength()-e.getLength()<0)return this;const t=re.glog(this.get(0))-re.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]^=re.gexp(re.glog(e.get(r))+t);return new et(n,0).mod(e)}}class Le{constructor(e,t){this.totalCount=e,this.dataCount=t}static getRSBlocks(e,t){const n=Le.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],u=n[i*3+2];for(let f=0;f<s;f++)a.push(new Le(l,u))}return a}static getRsBlockTable(e,t){switch(t){case ve.L:return Le.RS_BLOCK_TABLE[(e-1)*4+0];case ve.M:return Le.RS_BLOCK_TABLE[(e-1)*4+1];case ve.Q:return Le.RS_BLOCK_TABLE[(e-1)*4+2];case ve.H:return Le.RS_BLOCK_TABLE[(e-1)*4+3];default:return}}}Le.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 Ie=[[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,de=256,on=de-1,Ne=4,Bn=16,zt=1<<Bn,An=10,jt=10,ba=zt>>jt,ya=zt<<An-jt,wa=de>>3,_t=6,Ca=1<<_t,xa=wa*Ca,ka=30,In=10,ft=1<<In,Mn=8,rn=1<<Mn,Ta=In+Mn,Qe=1<<Ta,an=499,sn=491,ln=487,En=503,Sa=3*En;function Pa(o,e){var t,n,r,a,i;function s(){t=[],n=new Int32Array(256),r=new Int32Array(de),a=new Int32Array(de),i=new Int32Array(de>>3);var g,b;for(g=0;g<de;g++)b=(g<<Ne+8)/de,t[g]=new Float64Array([b,b,b,0]),a[g]=zt/de,r[g]=0}function l(){for(var g=0;g<de;g++)t[g][0]>>=Ne,t[g][1]>>=Ne,t[g][2]>>=Ne,t[g][3]=g}function u(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 w=Math.abs(b-g),B=Math.min(b+g,de),v=b+1,E=b-1,T=1,c,_;v<B||E>w;)_=i[T++],v<B&&(c=t[v++],c[0]-=_*(c[0]-P)/Qe,c[1]-=_*(c[1]-p)/Qe,c[2]-=_*(c[2]-k)/Qe),E>w&&(c=t[E--],c[0]-=_*(c[0]-P)/Qe,c[1]-=_*(c[1]-p)/Qe,c[2]-=_*(c[2]-k)/Qe)}function h(g,b,P){var p=2147483647,k=p,w=-1,B=w,v,E,T,c,_;for(v=0;v<de;v++)E=t[v],T=Math.abs(E[0]-g)+Math.abs(E[1]-b)+Math.abs(E[2]-P),T<p&&(p=T,w=v),c=T-(r[v]>>Bn-Ne),c<k&&(k=c,B=v),_=a[v]>>jt,a[v]-=_,r[v]+=_<<An;return a[w]+=ba,r[w]-=ya,B}function m(){var g,b,P,p,k,w,B=0,v=0;for(g=0;g<de;g++){for(P=t[g],k=g,w=P[1],b=g+1;b<de;b++)p=t[b],p[1]<w&&(k=b,w=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),w!=B){for(n[B]=v+g>>1,b=B+1;b<w;b++)n[b]=g;B=w,v=g}}for(n[B]=v+on>>1,b=B+1;b<256;b++)n[b]=on}function S(g,b,P){for(var p,k,w,B=1e3,v=-1,E=n[b],T=E-1;E<de||T>=0;)E<de&&(k=t[E],w=k[1]-b,w>=B?E=de:(E++,w<0&&(w=-w),p=k[0]-g,p<0&&(p=-p),w+=p,w<B&&(p=k[2]-P,p<0&&(p=-p),w+=p,w<B&&(B=w,v=k[3])))),T>=0&&(k=t[T],w=b-k[1],w>=B?T=-1:(T--,w<0&&(w=-w),p=k[0]-g,p<0&&(p=-p),w+=p,w<B&&(p=k[2]-P,p<0&&(p=-p),w+=p,w<B&&(B=w,v=k[3]))));return v}function M(){var g,b=o.length,P=30+(e-1)/3,p=b/(3*e),k=~~(p/ma),w=ft,B=xa,v=B>>_t;for(v<=1&&(v=0),g=0;g<v;g++)i[g]=w*((v*v-g*g)*rn/(v*v));var E;b<Sa?(e=1,E=3):b%an!==0?E=3*an:b%sn!==0?E=3*sn:b%ln!==0?E=3*ln:E=3*En;var T,c,_,C,N=0;for(g=0;g<p;)if(T=(o[N]&255)<<Ne,c=(o[N+1]&255)<<Ne,_=(o[N+2]&255)<<Ne,C=h(T,c,_),u(w,C,T,c,_),v!==0&&f(v,C,T,c,_),N+=E,N>=b&&(N-=b),g++,k===0&&(k=1),g%k===0)for(w-=w/P,B-=B/ka,v=B>>_t,v<=1&&(v=0),C=0;C<v;C++)i[C]=w*((v*v-C*C)*rn/(v*v))}function R(){s(),M(),l(),m()}this.buildColormap=R;function F(){for(var g=[],b=[],P=0;P<de;P++)b[t[P][3]]=P;for(var p=0,k=0;k<de;k++){var w=b[k];g[p++]=t[w][0],g[p++]=t[w][1],g[p++]=t[w][2]}return g}this.getColormap=F,this.lookupRGB=S}var un=-1,ht=12,at=5003,Ba=[0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535];function Aa(o,e,t,n){var r=Math.max(2,n),a=new Uint8Array(256),i=new Int32Array(at),s=new Int32Array(at),l,u=0,f,h=0,m,S=!1,M,R,F,g,b,P;function p(C,N){a[f++]=C,f>=254&&E(N)}function k(C){w(at),h=R+2,S=!0,_(R,C)}function w(C){for(var N=0;N<C;++N)i[N]=-1}function B(C,N){var x,he,G,fe,ce,J,ae;for(M=C,S=!1,P=M,m=T(P),R=1<<C-1,F=R+1,h=R+2,f=0,fe=c(),ae=0,x=at;x<65536;x*=2)++ae;ae=8-ae,J=at,w(J),_(R,N);e:for(;(he=c())!=un;){if(x=(he<<ht)+fe,G=he<<ae^fe,i[G]===x){fe=s[G];continue}else if(i[G]>=0){ce=J-G,G===0&&(ce=1);do if((G-=ce)<0&&(G+=J),i[G]===x){fe=s[G];continue e}while(i[G]>=0)}_(fe,N),fe=he,h<1<<ht?(s[G]=h++,i[G]=x):k(N)}_(fe,N),_(F,N)}function v(C){C.writeByte(r),g=o*e,b=0,B(r+1,C),C.writeByte(0)}function E(C){f>0&&(C.writeByte(f),C.writeBytes(a,0,f),f=0)}function T(C){return(1<<C)-1}function c(){if(g===0)return un;--g;var C=t[b++];return C&255}function _(C,N){for(l&=Ba[u],u>0?l|=C<<u:l=C,u+=P;u>=8;)p(l&255,N),l>>=8,u-=8;if((h>m||S)&&(S?(m=T(P=M),S=!1):(++P,P==ht?m=1<<ht:m=T(P))),C==F){for(;u>0;)p(l&255,N),l>>=8,u-=8;E(N)}}this.encode=v}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 Z(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}Z.prototype.setDelay=function(o){this.delay=Math.round(o/10)};Z.prototype.setFrameRate=function(o){this.delay=Math.round(100/o)};Z.prototype.setDispose=function(o){o>=0&&(this.dispose=o)};Z.prototype.setRepeat=function(o){this.repeat=o};Z.prototype.setTransparent=function(o){this.transparent=o};Z.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};Z.prototype.finish=function(){this.out.writeByte(59)};Z.prototype.setQuality=function(o){o<1&&(o=1),this.sample=o};Z.prototype.setDither=function(o){o===!0&&(o="FloydSteinberg"),this.dither=o};Z.prototype.setGlobalPalette=function(o){this.globalPalette=o};Z.prototype.getGlobalPalette=function(){return this.globalPalette&&this.globalPalette.slice&&this.globalPalette.slice(0)||this.globalPalette};Z.prototype.writeHeader=function(){this.out.writeUTFBytes("GIF89a")};Z.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))};Z.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}};Z.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 u=0;u<a;u++){e&&(l=l*-1);for(var f=l==1?0:i-1,h=l==1?i:0;f!==h;f+=l){r=u*i+f;var m=r*3,S=s[m],M=s[m+1],R=s[m+2];m=this.findClosestRGB(S,M,R),this.usedEntry[m]=!0,this.indexedPixels[r]=m,m*=3;for(var F=this.colorTab[m],g=this.colorTab[m+1],b=this.colorTab[m+2],P=S-F,p=M-g,k=R-b,w=l==1?0:n.length-1,B=l==1?n.length:0;w!==B;w+=l){var v=n[w][1],E=n[w][2];if(v+f>=0&&v+f<i&&E+u>=0&&E+u<a){var T=n[w][0];m=r+v+E*i,m*=3,s[m]=Math.max(0,Math.min(255,s[m]+P*T)),s[m+1]=Math.max(0,Math.min(255,s[m+1]+p*T)),s[m+2]=Math.max(0,Math.min(255,s[m+2]+k*T))}}}}};Z.prototype.findClosest=function(o,e){return this.findClosestRGB((o&16711680)>>16,(o&65280)>>8,o&255,e)};Z.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 u=o-(this.colorTab[s++]&255),f=e-(this.colorTab[s++]&255),h=t-(this.colorTab[s++]&255),m=u*u+f*f+h*h;(!n||this.usedEntry[l])&&m<a&&(a=m,r=l)}return r};Z.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++};Z.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)};Z.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)};Z.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)};Z.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)};Z.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)};Z.prototype.writeShort=function(o){this.out.writeByte(o&255),this.out.writeByte(o>>8&255)};Z.prototype.writePixels=function(){var o=new Aa(this.width,this.height,this.indexedPixels,this.colorDepth);o.encode(this.out)};Z.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{u(n.next(f))}catch(h){i(h)}}function l(f){try{u(n.throw(f))}catch(h){i(h)}}function u(f){f.done?a(f.value):r(f.value).then(s,l)}u((n=n.apply(o,e||[])).next())})};const{Canvas:Fe}=Jr,pt=.4;function cn(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 V{constructor(e){const t=Object.assign({},e);if(Object.keys(V.defaultOptions).forEach(n=>{n in t||Object.defineProperty(t,n,{value:V.defaultOptions[n],enumerable:!0,writable:!0})}),t.components?typeof t.components=="object"&&Object.keys(V.defaultComponentOptions).forEach(n=>{n in t.components?Object.defineProperty(t.components,n,{value:Object.assign(Object.assign({},V.defaultComponentOptions[n]),t.components[n]),enumerable:!0,writable:!0}):Object.defineProperty(t.components,n,{value:V.defaultComponentOptions[n],enumerable:!0,writable:!0})}):t.components=V.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 Fe(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 Fe(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 u=e.fillStyle;e.fillStyle=s,new Array(4).fill(0).map((f,h)=>{V._drawDot(e,t-2+h,n-2,r,a,i),V._drawDot(e,t+2,n-2+h,r,a,i),V._drawDot(e,t+2-h,n+2,r,a,i),V._drawDot(e,t-2,n+2-h,r,a,i)}),V._drawDot(e,t,n,r,a,i),l||(e.fillStyle="rgba(255, 255, 255, 0.6)",new Array(2).fill(0).map((f,h)=>{V._drawDot(e,t-1+h,n-1,r,a,i),V._drawDot(e,t+1,n-1+h,r,a,i),V._drawDot(e,t+1-h,n+1,r,a,i),V._drawDot(e,t-1,n+1-h,r,a,i)})),e.fillStyle=u}_draw(){var e,t,n,r,a,i,s,l,u,f,h,m,S,M,R,F,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 w=this.options.margin;(w<0||w*2>=k)&&(w=0);const B=Math.ceil(w),v=k-2*w,E=this.options.whiteMargin,T=this.options.backgroundDimming,c=Math.ceil(v/p),_=c*p,C=_+2*B,N=new Fe(C,C),x=N.getContext("2d");this._clear(),x.save(),x.translate(B,B);const he=new Fe(C,C),G=he.getContext("2d");let fe=null,ce=[];if(this.options.gifBackground){const I=ua(this.options.gifBackground);if(fe=I,ce=fa(I,!0),this.options.autoColor){let L=0,D=0,z=0,se=0;for(let W=0;W<ce[0].colorTable.length;W++){const Y=ce[0].colorTable[W];Y[0]>200||Y[1]>200||Y[2]>200||Y[0]===0&&Y[1]===0&&Y[2]===0||(se++,L+=Y[0],D+=Y[1],z+=Y[2])}L=~~(L/se),D=~~(D/se),z=~~(z/se),this.options.colorDark=`rgb(${L},${D},${z})`}}else if(this.options.backgroundImage){const I=yield cn(this.options.backgroundImage);if(this.options.autoColor){const L=V._getAverageRGB(I);this.options.colorDark=`rgb(${L.r},${L.g},${L.b})`}G.drawImage(I,0,0,I.width,I.height,0,0,C,C),G.rect(0,0,C,C),G.fillStyle=T,G.fill()}else G.rect(0,0,C,C),G.fillStyle=this.options.colorLight,G.fill();const J=q.getPatternPosition(this.qrCode.typeNumber),ae=((n=(t=this.options.components)===null||t===void 0?void 0:t.data)===null||n===void 0?void 0:n.scale)||pt,ke=(1-ae)*.5;for(let I=0;I<p;I++)for(let L=0;L<p;L++){const D=this.qrCode.isDark(I,L),z=L<8&&(I<8||I>=p-8)||L>=p-8&&I<8,se=I==6&&L>=8&&L<=p-8||L==6&&I>=8&&I<=p-8;let W=z||se;for(let ee=1;ee<J.length-1;ee++)W=W||I>=J[ee]-2&&I<=J[ee]+2&&L>=J[ee]-2&&L<=J[ee]+2;const Y=L*c+(W?0:ke*c),ge=I*c+(W?0:ke*c);if(x.strokeStyle=D?this.options.colorDark:this.options.colorLight,x.lineWidth=.5,x.fillStyle=D?this.options.colorDark:this.options.colorLight,J.length===0)W||x.fillRect(Y,ge,(W?1:ae)*c,(W?1:ae)*c);else{const ee=L<p-4&&L>=p-4-5&&I<p-4&&I>=p-4-5;!W&&!ee&&x.fillRect(Y,ge,(W?1:ae)*c,(W?1:ae)*c)}}const ie=J[J.length-1],$e=this.options.colorLight;if(x.fillStyle=$e,x.fillRect(0,0,8*c,8*c),x.fillRect(0,(p-8)*c,8*c,8*c),x.fillRect((p-8)*c,0,8*c,8*c),!((a=(r=this.options.components)===null||r===void 0?void 0:r.timing)===null||a===void 0)&&a.protectors&&(x.fillRect(8*c,6*c,(p-8-8)*c,c),x.fillRect(6*c,8*c,c,(p-8-8)*c)),!((s=(i=this.options.components)===null||i===void 0?void 0:i.cornerAlignment)===null||s===void 0)&&s.protectors&&V._drawAlignProtector(x,ie,ie,c),!((u=(l=this.options.components)===null||l===void 0?void 0:l.alignment)===null||u===void 0)&&u.protectors)for(let I=0;I<J.length;I++)for(let L=0;L<J.length;L++){const D=J[L],z=J[I];if(!(D===6&&(z===6||z===ie))){if(z===6&&(D===6||D===ie))continue;if(D===ie&&z===ie)continue;V._drawAlignProtector(x,D,z,c)}}x.fillStyle=this.options.colorDark,x.fillRect(0,0,7*c,c),x.fillRect((p-7)*c,0,7*c,c),x.fillRect(0,6*c,7*c,c),x.fillRect((p-7)*c,6*c,7*c,c),x.fillRect(0,(p-7)*c,7*c,c),x.fillRect(0,(p-7+6)*c,7*c,c),x.fillRect(0,0,c,7*c),x.fillRect(6*c,0,c,7*c),x.fillRect((p-7)*c,0,c,7*c),x.fillRect((p-7+6)*c,0,c,7*c),x.fillRect(0,(p-7)*c,c,7*c),x.fillRect(6*c,(p-7)*c,c,7*c),x.fillRect(2*c,2*c,3*c,3*c),x.fillRect((p-7+2)*c,2*c,3*c,3*c),x.fillRect(2*c,(p-7+2)*c,3*c,3*c);const _e=((h=(f=this.options.components)===null||f===void 0?void 0:f.timing)===null||h===void 0?void 0:h.scale)||pt,Ee=(1-_e)*.5;for(let I=0;I<p-8;I+=2)V._drawDot(x,8+I,6,c,Ee,_e),V._drawDot(x,6,8+I,c,Ee,_e);const le=((S=(m=this.options.components)===null||m===void 0?void 0:m.cornerAlignment)===null||S===void 0?void 0:S.scale)||pt,Te=(1-le)*.5;V._drawAlign(x,ie,ie,c,Te,le,this.options.colorDark,((R=(M=this.options.components)===null||M===void 0?void 0:M.cornerAlignment)===null||R===void 0?void 0:R.protectors)||!1);const Ue=((g=(F=this.options.components)===null||F===void 0?void 0:F.alignment)===null||g===void 0?void 0:g.scale)||pt,Xe=(1-Ue)*.5;for(let I=0;I<J.length;I++)for(let L=0;L<J.length;L++){const D=J[L],z=J[I];if(!(D===6&&(z===6||z===ie))){if(z===6&&(D===6||D===ie))continue;if(D===ie&&z===ie)continue;V._drawAlign(x,D,z,c,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(E&&(x.fillStyle=this.options.backgroundColor,x.fillRect(-B,-B,C,B),x.fillRect(-B,_,C,B),x.fillRect(_,-B,B,C),x.fillRect(-B,-B,B,C)),this.options.logoImage){const I=yield cn(this.options.logoImage);let L=this.options.logoScale,D=this.options.logoMargin,z=this.options.logoCornerRadius;(L<=0||L>=1)&&(L=.2),D<0&&(D=0),z<0&&(z=0);const se=_*L,W=.5*(C-se),Y=W;x.restore(),x.fillStyle=this.options.logoBackgroundColor,x.save(),V._prepareRoundedCornerClip(x,W-D,Y-D,se+2*D,se+2*D,z+D),x.clip();const ge=x.globalCompositeOperation;x.globalCompositeOperation="destination-out",x.fill(),x.globalCompositeOperation=ge,x.restore(),x.save(),V._prepareRoundedCornerClip(x,W,Y,se,se,z),x.clip(),x.drawImage(I,W,Y,se,se),x.restore(),x.save(),x.translate(B,B)}if(fe){let I,L,D,z,se,W;if(ce.forEach(function(Y){I||(I=new Z(k,k),I.setDelay(Y.delay),I.setRepeat(0));const{width:ge,height:ee}=Y.dims;L||(L=new Fe(ge,ee),D=L.getContext("2d"),D.rect(0,0,L.width,L.height),D.fillStyle="#ffffff",D.fill()),(!z||!W||ge!==z.width||ee!==z.height)&&(z=new Fe(ge,ee),se=z.getContext("2d"),W=se.createImageData(ge,ee)),W.data.set(Y.patch),se.putImageData(W,0,0),D.drawImage(z.getContext("2d").canvas,Y.dims.left,Y.dims.top);const Ke=new Fe(C,C),ze=Ke.getContext("2d");ze.drawImage(L.getContext("2d").canvas,0,0,C,C),ze.rect(0,0,C,C),ze.fillStyle=T,ze.fill(),ze.drawImage(N.getContext("2d").canvas,0,0,C,C);const Ze=new Fe(k,k),je=Ze.getContext("2d");je.drawImage(Ke.getContext("2d").canvas,0,0,k,k),I.addFrame(je.getImageData(0,0,Ze.width,Ze.height).data)}),!I)throw new Error("No frames.");if(I.finish(),dn(this.canvas)){const ge=I.stream().toFlattenUint8Array().reduce((ee,Ke)=>ee+String.fromCharCode(Ke),"");return Promise.resolve(`data:image/gif;base64,${window.btoa(ge)}`)}return Promise.resolve(Buffer.from(I.stream().toFlattenUint8Array()))}else{G.drawImage(N.getContext("2d").canvas,0,0,C,C),x.drawImage(he.getContext("2d").canvas,-B,-B,C,C);const I=new Fe(k,k);I.getContext("2d").drawImage(N.getContext("2d").canvas,0,0,k,k),this.canvas=I;const D=this.options.gifBackground?"gif":"png";return dn(this.canvas)?Promise.resolve(this.canvas.toDataURL(D)):Promise.resolve(this.canvas.toBuffer(D))}})}}V.CorrectLevel=ve;V.defaultComponentOptions={data:{scale:.4},timing:{scale:.5,protectors:!1},alignment:{scale:.5,protectors:!1},cornerAlignment:{scale:.5,protectors:!0}};V.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:V.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 Ea=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 V({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)])}}),Ra=xe({name:"school-info",setup(){var M,R,F,g,b,P,p,k,w,B;const o=wt(),e=Ge({areaList:[]}),t=Ge({name:(R=(M=o.info.schoolInfos)==null?void 0:M[0])==null?void 0:R.name,logo:((g=(F=o.info.schoolInfos)==null?void 0:F[0])==null?void 0:g.logo)||o.info.avatar,provinceCode:((P=(b=o.info.schoolInfos)==null?void 0:b[0])==null?void 0:P.provinceCode)||"",cityCode:((k=(p=o.info.schoolInfos)==null?void 0:p[0])==null?void 0:k.cityCode)||"",regionCode:((B=(w=o.info.schoolInfos)==null?void 0:w[0])==null?void 0:B.regionCode)||""}),n=Ge({loading:!1,schoolLoading:!0,dataList:[],disabled:!0,modal:!1,qrModal:!1}),r=()=>[{title:"老师姓名",key:"nickname"},{title:"手机号码",key:"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:()=>[v.statusName]}):y(pe,{class:ye.errorBtn,text:!0},{default:()=>[v.statusName]})])},{title:"操作",key:"titleImg",render:v=>y(Ae,null,{default:()=>[y(pe,{type:"primary",quaternary:!0,size:"small",onClick:()=>f(v)},{default:()=>[ue("重置密码")]}),v.status==="ACTIVATION"?y(pe,{type:"primary",quaternary:!0,size:"small",onClick:()=>u(v)},{default:()=>[ue("冻结")]}):y(pe,{class:ye.errorBtn,quaternary:!0,size:"small",onClick:()=>u(v)},{default:()=>[ue("解冻")]})]})}],a=async()=>{const v=await wn();(v==null?void 0:v.code)===200&&(e.areaList=v.data)},i=async()=>{var E,T,c;n.loading=!0;const v=await ur({schoolId:(T=(E=o.info.schoolInfos)==null?void 0:E[0])==null?void 0:T.id,page:1,rows:1e3});n.loading=!1,(v==null?void 0:v.code)===200&&Array.isArray((c=v==null?void 0:v.data)==null?void 0:c.rows)&&(n.dataList=v.data.rows)};mn(()=>{a(),i()});const s=Go(),l=Nt(),u=v=>{const E=v.status==="LOCKED"?"解冻":"冻结";s.warning({title:"温馨提示",content:`是否${E}"${v.nickname}"?`,positiveText:"确定",negativeText:"取消",onPositiveClick:async()=>{await dr({ids:[v.id],status:v.status==="LOCKED"?"ACTIVATION":"LOCKED"}),i(),l.success(E+"成功")}})},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 E=>{var T;E||(n.schoolLoading=!1,await hr({...(T=o.info.schoolInfos)==null?void 0:T[0],...t}),n.schoolLoading=!0,l.success("修改成功"),n.disabled=!0)})},S=()=>{var T,c,_,C,N,x;const v=`tenantId=${(c=(T=o.info.schoolInfos)==null?void 0:T[0])==null?void 0:c.tenantId}&schoolId=${(C=(_=o.info.schoolInfos)==null?void 0:_[0])==null?void 0:C.id}&schoolName=${(x=(N=o.info.schoolInfos)==null?void 0:N[0])==null?void 0:x.name}`,E=`${location.origin}/classroom-app/#/teaher-register?`+v;return console.log(E),E};return()=>y("div",{class:ye.schoolInfo},[y(Ae,{wrapItem:!1,align:"center"},{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},[ue("修改头像"),n.schoolLoading&&y(yn,{class:[ye.uploadFile],cropper:!0,"onUpdate:fileList":v=>{t.logo=v}},null)])]),y(Ot,{ref:h,class:ye.formWrap,model:t,style:{paddingTop:"30px",paddingLeft:"80px"},disabled:n.disabled},{default:()=>[y(Ae,{size:100},{default:()=>[y(Se,{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(Se,{label:"城区"},{default:()=>{var v,E,T,c;return[y($t,{placeholder:"请选择城区",bordered:!n.disabled,options:e.areaList,labelField:"name",valueField:"code",childrenField:"areas",checkStrategy:"child",expandTrigger:"hover",defaultValue:((E=(v=o.info.schoolInfos)==null?void 0:v[0])==null?void 0:E.regionCode)||((c=(T=o.info.schoolInfos)==null?void 0:T[0])==null?void 0:c.cityCode),"onUpdate:value":(_,C,N)=>{var x,he,G;t.provinceCode=(x=N[0])==null?void 0:x.code,t.cityCode=(he=N[1])==null?void 0:he.code,t.regionCode=(G=N[2])==null?void 0:G.code}},null)]}}),y(Se,null,{default:()=>[n.disabled?y(Ae,{class:ye.btnList,align:"center",justify:"end"},{default:()=>[y(pe,{class:ye.btn,color:"#f24433",onClick:()=>n.disabled=!1},{default:()=>[ue("修改信息")]})]}):y(Ae,{class:ye.btnList,align:"center",justify:"end"},{default:()=>[y(pe,{class:ye.btn,onClick:()=>n.disabled=!0},{default:()=>[ue("取消")]}),y(pe,{class:ye.btn,loading:!n.schoolLoading,type:"primary",onClick:()=>m()},{default:()=>[ue("完成")]})]})]})]})]})]}),y(Ae,{style:{padding:"32px 0"}},{default:()=>[y(pe,{type:"primary",renderIcon:()=>y(qo,{component:y(Ar,null,null)},null),onClick:()=>n.modal=!0},{default:()=>[ue("添加老师")]}),y(pe,{type:"primary",onClick:()=>n.qrModal=!0},{default:()=>[ue("老师注册二维码")]})]}),y(Wo,{loading:n.loading,columns:r(),data:n.dataList},null),y(Ft,{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(Ft,{show:n.qrModal,"onUpdate:show":v=>n.qrModal=v,title:"二维码",preset:"dialog",showIcon:!1},{default:()=>[y("div",{style:{textAlign:"center"}},[y(Ea,{text:S(),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),Rt(()=>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(Ra,null,null)]})]})])}});export{Ua as default};