gzkx-package 0.1.59 → 0.1.60

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -3,5 +3,5 @@
3
3
  Copyright (c) 2018 Jed Watson.
4
4
  Licensed under the MIT License (MIT), see
5
5
  http://jedwatson.github.io/classnames
6
- */const X=G((Z||(Z=1,Y=J,function(){var e={}.hasOwnProperty;function t(){for(var e="",t=0;t<arguments.length;t++){var s=arguments[t];s&&(e=r(e,n(s)))}return e}function n(n){if("string"==typeof n||"number"==typeof n)return n;if("object"!=typeof n)return"";if(Array.isArray(n))return t.apply(null,n);if(n.toString!==Object.prototype.toString&&!n.toString.toString().includes("[native code]"))return n.toString();var s="";for(var i in n)e.call(n,i)&&n[i]&&(s=r(s,i));return s}function r(e,t){return t?e?e+" "+t:e+t:e}Y.exports?(t.default=t,Y.exports=t):window.classNames=t}()),J.exports)),Q=Math.round;function ee(e,t){const n=e.replace(/^[^(]*\((.*)/,"$1").replace(/\).*/,"").match(/\d*\.?\d+%?/g)||[],r=n.map(e=>parseFloat(e));for(let s=0;s<3;s+=1)r[s]=t(r[s]||0,n[s]||"",s);return n[3]?r[3]=n[3].includes("%")?r[3]/100:r[3]:r[3]=1,r}const te=(e,t,n)=>0===n?e:e/100;function ne(e,t){const n=t||255;return e>n?n:e<0?0:e}class re{constructor(e){function t(t){return t[0]in e&&t[1]in e&&t[2]in e}if(H(this,"isValid",!0),H(this,"r",0),H(this,"g",0),H(this,"b",0),H(this,"a",1),H(this,"_h",void 0),H(this,"_s",void 0),H(this,"_l",void 0),H(this,"_v",void 0),H(this,"_max",void 0),H(this,"_min",void 0),H(this,"_brightness",void 0),e)if("string"==typeof e){let t=function(e){return n.startsWith(e)};const n=e.trim();/^#?[A-F\d]{3,8}$/i.test(n)?this.fromHexString(n):t("rgb")?this.fromRgbString(n):t("hsl")?this.fromHslString(n):(t("hsv")||t("hsb"))&&this.fromHsvString(n)}else if(e instanceof re)this.r=e.r,this.g=e.g,this.b=e.b,this.a=e.a,this._h=e._h,this._s=e._s,this._l=e._l,this._v=e._v;else if(t("rgb"))this.r=ne(e.r),this.g=ne(e.g),this.b=ne(e.b),this.a="number"==typeof e.a?ne(e.a,1):1;else if(t("hsl"))this.fromHsl(e);else{if(!t("hsv"))throw new Error("@ant-design/fast-color: unsupported input "+JSON.stringify(e));this.fromHsv(e)}else;}setR(e){return this._sc("r",e)}setG(e){return this._sc("g",e)}setB(e){return this._sc("b",e)}setA(e){return this._sc("a",e,1)}setHue(e){const t=this.toHsv();return t.h=e,this._c(t)}getLuminance(){function e(e){const t=e/255;return t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4)}return.2126*e(this.r)+.7152*e(this.g)+.0722*e(this.b)}getHue(){if(void 0===this._h){const e=this.getMax()-this.getMin();this._h=0===e?0:Q(60*(this.r===this.getMax()?(this.g-this.b)/e+(this.g<this.b?6:0):this.g===this.getMax()?(this.b-this.r)/e+2:(this.r-this.g)/e+4))}return this._h}getSaturation(){if(void 0===this._s){const e=this.getMax()-this.getMin();this._s=0===e?0:e/this.getMax()}return this._s}getLightness(){return void 0===this._l&&(this._l=(this.getMax()+this.getMin())/510),this._l}getValue(){return void 0===this._v&&(this._v=this.getMax()/255),this._v}getBrightness(){return void 0===this._brightness&&(this._brightness=(299*this.r+587*this.g+114*this.b)/1e3),this._brightness}darken(e=10){const t=this.getHue(),n=this.getSaturation();let r=this.getLightness()-e/100;return r<0&&(r=0),this._c({h:t,s:n,l:r,a:this.a})}lighten(e=10){const t=this.getHue(),n=this.getSaturation();let r=this.getLightness()+e/100;return r>1&&(r=1),this._c({h:t,s:n,l:r,a:this.a})}mix(e,t=50){const n=this._c(e),r=t/100,s=e=>(n[e]-this[e])*r+this[e],i={r:Q(s("r")),g:Q(s("g")),b:Q(s("b")),a:Q(100*s("a"))/100};return this._c(i)}tint(e=10){return this.mix({r:255,g:255,b:255,a:1},e)}shade(e=10){return this.mix({r:0,g:0,b:0,a:1},e)}onBackground(e){const t=this._c(e),n=this.a+t.a*(1-this.a),r=e=>Q((this[e]*this.a+t[e]*t.a*(1-this.a))/n);return this._c({r:r("r"),g:r("g"),b:r("b"),a:n})}isDark(){return this.getBrightness()<128}isLight(){return this.getBrightness()>=128}equals(e){return this.r===e.r&&this.g===e.g&&this.b===e.b&&this.a===e.a}clone(){return this._c(this)}toHexString(){let e="#";const t=(this.r||0).toString(16);e+=2===t.length?t:"0"+t;const n=(this.g||0).toString(16);e+=2===n.length?n:"0"+n;const r=(this.b||0).toString(16);if(e+=2===r.length?r:"0"+r,"number"==typeof this.a&&this.a>=0&&this.a<1){const t=Q(255*this.a).toString(16);e+=2===t.length?t:"0"+t}return e}toHsl(){return{h:this.getHue(),s:this.getSaturation(),l:this.getLightness(),a:this.a}}toHslString(){const e=this.getHue(),t=Q(100*this.getSaturation()),n=Q(100*this.getLightness());return 1!==this.a?`hsla(${e},${t}%,${n}%,${this.a})`:`hsl(${e},${t}%,${n}%)`}toHsv(){return{h:this.getHue(),s:this.getSaturation(),v:this.getValue(),a:this.a}}toRgb(){return{r:this.r,g:this.g,b:this.b,a:this.a}}toRgbString(){return 1!==this.a?`rgba(${this.r},${this.g},${this.b},${this.a})`:`rgb(${this.r},${this.g},${this.b})`}toString(){return this.toRgbString()}_sc(e,t,n){const r=this.clone();return r[e]=ne(t,n),r}_c(e){return new this.constructor(e)}getMax(){return void 0===this._max&&(this._max=Math.max(this.r,this.g,this.b)),this._max}getMin(){return void 0===this._min&&(this._min=Math.min(this.r,this.g,this.b)),this._min}fromHexString(e){const t=e.replace("#","");function n(e,n){return parseInt(t[e]+t[n||e],16)}t.length<6?(this.r=n(0),this.g=n(1),this.b=n(2),this.a=t[3]?n(3)/255:1):(this.r=n(0,1),this.g=n(2,3),this.b=n(4,5),this.a=t[6]?n(6,7)/255:1)}fromHsl({h:e,s:t,l:n,a:r}){if(this._h=e%360,this._s=t,this._l=n,this.a="number"==typeof r?r:1,t<=0){const e=Q(255*n);this.r=e,this.g=e,this.b=e}let s=0,i=0,o=0;const l=e/60,a=(1-Math.abs(2*n-1))*t,c=a*(1-Math.abs(l%2-1));l>=0&&l<1?(s=a,i=c):l>=1&&l<2?(s=c,i=a):l>=2&&l<3?(i=a,o=c):l>=3&&l<4?(i=c,o=a):l>=4&&l<5?(s=c,o=a):l>=5&&l<6&&(s=a,o=c);const u=n-a/2;this.r=Q(255*(s+u)),this.g=Q(255*(i+u)),this.b=Q(255*(o+u))}fromHsv({h:e,s:t,v:n,a:r}){this._h=e%360,this._s=t,this._v=n,this.a="number"==typeof r?r:1;const s=Q(255*n);if(this.r=s,this.g=s,this.b=s,t<=0)return;const i=e/60,o=Math.floor(i),l=i-o,a=Q(n*(1-t)*255),c=Q(n*(1-t*l)*255),u=Q(n*(1-t*(1-l))*255);switch(o){case 0:this.g=u,this.b=a;break;case 1:this.r=c,this.b=a;break;case 2:this.r=a,this.b=u;break;case 3:this.r=a,this.g=c;break;case 4:this.r=u,this.g=a;break;default:this.g=a,this.b=c}}fromHsvString(e){const t=ee(e,te);this.fromHsv({h:t[0],s:t[1],v:t[2],a:t[3]})}fromHslString(e){const t=ee(e,te);this.fromHsl({h:t[0],s:t[1],l:t[2],a:t[3]})}fromRgbString(e){const t=ee(e,(e,t)=>t.includes("%")?Q(e/100*255):e);this.r=t[0],this.g=t[1],this.b=t[2],this.a=t[3]}}var se=[{index:7,amount:15},{index:6,amount:25},{index:5,amount:30},{index:5,amount:45},{index:5,amount:65},{index:5,amount:85},{index:4,amount:90},{index:3,amount:95},{index:2,amount:97},{index:1,amount:98}];function ie(e,t,n){var r;return(r=Math.round(e.h)>=60&&Math.round(e.h)<=240?n?Math.round(e.h)-2*t:Math.round(e.h)+2*t:n?Math.round(e.h)+2*t:Math.round(e.h)-2*t)<0?r+=360:r>=360&&(r-=360),r}function oe(e,t,n){return 0===e.h&&0===e.s?e.s:((r=n?e.s-.16*t:4===t?e.s+.16:e.s+.05*t)>1&&(r=1),n&&5===t&&r>.1&&(r=.1),r<.06&&(r=.06),Math.round(100*r)/100);var r}function le(e,t,n){var r;return r=n?e.v+.05*t:e.v-.15*t,r=Math.max(0,Math.min(1,r)),Math.round(100*r)/100}var ae=["#e6f4ff","#bae0ff","#91caff","#69b1ff","#4096ff","#1677ff","#0958d9","#003eb3","#002c8c","#001d66"];function ce(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ue(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ce(Object(n),!0).forEach(function(t){H(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ce(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}ae.primary=ae[5];var de="data-rc-order",he="data-rc-priority",fe=new Map;function pe(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).mark;return e?e.startsWith("data-")?e:"data-".concat(e):"rc-util-key"}function me(e){return e.attachTo?e.attachTo:document.querySelector("head")||document.body}function ge(e){return Array.from((fe.get(e)||e).children).filter(function(e){return"STYLE"===e.tagName})}function ve(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("undefined"==typeof window||!window.document||!window.document.createElement)return null;var n=t.csp,r=t.prepend,s=t.priority,i=void 0===s?0:s,o=function(e){return"queue"===e?"prependQueue":e?"prepend":"append"}(r),l="prependQueue"===o,a=document.createElement("style");a.setAttribute(de,o),l&&i&&a.setAttribute(he,"".concat(i)),null!=n&&n.nonce&&(a.nonce=null==n?void 0:n.nonce),a.innerHTML=e;var c=me(t),u=c.firstChild;if(r){if(l){var d=(t.styles||ge(c)).filter(function(e){if(!["prepend","prependQueue"].includes(e.getAttribute(de)))return!1;var t=Number(e.getAttribute(he)||0);return i>=t});if(d.length)return c.insertBefore(a,d[d.length-1].nextSibling),a}c.insertBefore(a,u)}else c.appendChild(a);return a}function be(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=me(n),s=ge(r),i=ue(ue({},n),{},{styles:s});!function(e,t){var n=fe.get(e);if(!n||!function(e,t){if(!e)return!1;if(e.contains)return e.contains(t);for(var n=t;n;){if(n===e)return!0;n=n.parentNode}return!1}(document,n)){var r=ve("",t),s=r.parentNode;fe.set(e,s),e.removeChild(r)}}(r,i);var o=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=me(t);return(t.styles||ge(n)).find(function(n){return n.getAttribute(pe(t))===e})}(t,i);if(o){var l,a,c;if(null!==(l=i.csp)&&void 0!==l&&l.nonce&&o.nonce!==(null===(a=i.csp)||void 0===a?void 0:a.nonce))o.nonce=null===(c=i.csp)||void 0===c?void 0:c.nonce;return o.innerHTML!==e&&(o.innerHTML=e),o}var u=ve(e,i);return u.setAttribute(pe(i),t),u}function ye(e){var t;return null==e||null===(t=e.getRootNode)||void 0===t?void 0:t.call(e)}function xe(e){return function(e){return ye(e)instanceof ShadowRoot}(e)?ye(e):null}var we={},Ne=[];function Ee(e,t){if("production"!==process.env.NODE_ENV&&!e&&void 0!==console)Ne.reduce(function(e,t){return t(null!=e?e:"","warning")},t)}function ke(e,t){if("production"!==process.env.NODE_ENV&&!e&&void 0!==console)Ne.reduce(function(e,t){return t(null!=e?e:"","note")},t)}function Se(e,t,n){t||we[n]||(e(!1,n),we[n]=!0)}function Ae(e,t){Se(Ee,e,t)}function Ce(e){return"object"===$(e)&&"string"==typeof e.name&&"string"==typeof e.theme&&("object"===$(e.icon)||"function"==typeof e.icon)}function je(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Object.keys(e).reduce(function(t,n){var r,s=e[n];if("class"===n)t.className=s,delete t.class;else delete t[n],t[(r=n,r.replace(/-(.)/g,function(e,t){return t.toUpperCase()}))]=s;return t},{})}function _e(e,t,n){return n?r.createElement(e.tag,ue(ue({key:t},je(e.attrs)),n),(e.children||[]).map(function(n,r){return _e(n,"".concat(t,"-").concat(e.tag,"-").concat(r))})):r.createElement(e.tag,ue({key:t},je(e.attrs)),(e.children||[]).map(function(n,r){return _e(n,"".concat(t,"-").concat(e.tag,"-").concat(r))}))}function Oe(e){return function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=[],r=new re(e),s=r.toHsv(),i=5;i>0;i-=1){var o=new re({h:ie(s,i,!0),s:oe(s,i,!0),v:le(s,i,!0)});n.push(o)}n.push(r);for(var l=1;l<=4;l+=1){var a=new re({h:ie(s,l),s:oe(s,l),v:le(s,l)});n.push(a)}return"dark"===t.theme?se.map(function(e){var r=e.index,s=e.amount;return new re(t.backgroundColor||"#141414").mix(n[r],s).toHexString()}):n.map(function(e){return e.toHexString()})}(e)[0]}function Te(e){return e?Array.isArray(e)?e:[e]:[]}Ae.preMessage=function(e){Ne.push(e)},Ae.resetWarned=function(){we={}},Ae.noteOnce=function(e,t){Se(ke,e,t)};var Le=["icon","className","onClick","style","primaryColor","secondaryColor"],qe={primaryColor:"#333",secondaryColor:"#E6E6E6",calculated:!1};var Ie=function(e){var t,n,s,i,o,l,a,c,d=e.icon,h=e.className,f=e.onClick,p=e.style,m=e.primaryColor,g=e.secondaryColor,v=K(e,Le),b=u.useRef(),y=qe;if(m&&(y={primaryColor:m,secondaryColor:g||Oe(m)}),t=b,n=r.useContext(P),s=n.csp,i=n.prefixCls,o=n.layer,l="\n.anticon {\n display: inline-flex;\n align-items: center;\n color: inherit;\n font-style: normal;\n line-height: 0;\n text-align: center;\n text-transform: none;\n vertical-align: -0.125em;\n text-rendering: optimizeLegibility;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n\n.anticon > * {\n line-height: 1;\n}\n\n.anticon svg {\n display: inline-block;\n}\n\n.anticon::before {\n display: none;\n}\n\n.anticon .anticon-icon {\n display: block;\n}\n\n.anticon[tabindex] {\n cursor: pointer;\n}\n\n.anticon-spin::before,\n.anticon-spin {\n display: inline-block;\n -webkit-animation: loadingCircle 1s infinite linear;\n animation: loadingCircle 1s infinite linear;\n}\n\n@-webkit-keyframes loadingCircle {\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n}\n\n@keyframes loadingCircle {\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n}\n",i&&(l=l.replace(/anticon/g,i)),o&&(l="@layer ".concat(o," {\n").concat(l,"\n}")),r.useEffect(function(){var e=xe(t.current);be(l,"@ant-design-icons",{prepend:!o,csp:s,attachTo:e})},[]),a=Ce(d),c="icon should be icon definiton, but got ".concat(d),Ae(a,"[@ant-design/icons] ".concat(c)),!Ce(d))return null;var x=d;return x&&"function"==typeof x.icon&&(x=ue(ue({},x),{},{icon:x.icon(y.primaryColor,y.secondaryColor)})),_e(x.icon,"svg-".concat(x.name),ue(ue({className:h,onClick:f,style:p,"data-icon":x.name,width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},v),{},{ref:b}))};function Re(e){var t=z(Te(e),2),n=t[0],r=t[1];return Ie.setTwoToneColors({primaryColor:n,secondaryColor:r})}Ie.displayName="IconReact",Ie.getTwoToneColors=function(){return ue({},qe)},Ie.setTwoToneColors=function(e){var t=e.primaryColor,n=e.secondaryColor;qe.primaryColor=t,qe.secondaryColor=n||Oe(t),qe.calculated=!!n};var Me=["className","icon","spin","rotate","tabIndex","onClick","twoToneColor"];Re(ae.primary);var Be=u.forwardRef(function(e,t){var n=e.className,r=e.icon,s=e.spin,i=e.rotate,o=e.tabIndex,l=e.onClick,a=e.twoToneColor,c=K(e,Me),d=u.useContext(P),h=d.prefixCls,f=void 0===h?"anticon":h,p=d.rootClassName,m=X(p,f,H(H({},"".concat(f,"-").concat(r.name),!!r.name),"".concat(f,"-spin"),!!s||"loading"===r.name),n),g=o;void 0===g&&l&&(g=-1);var v=i?{msTransform:"rotate(".concat(i,"deg)"),transform:"rotate(".concat(i,"deg)")}:void 0,b=z(Te(a),2),y=b[0],x=b[1];return u.createElement("span",F({role:"img","aria-label":r.name},c,{ref:t,tabIndex:g,onClick:l,className:m}),u.createElement(Ie,{icon:r,primaryColor:y,secondaryColor:x,style:v}))});Be.displayName="AntdIcon",Be.getTwoToneColor=function(){var e=Ie.getTwoToneColors();return e.calculated?[e.primaryColor,e.secondaryColor]:e.primaryColor},Be.setTwoToneColor=Re;var De={icon:{tag:"svg",attrs:{"fill-rule":"evenodd",viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M799.86 166.31c.02 0 .04.02.08.06l57.69 57.7c.04.03.05.05.06.08a.12.12 0 010 .06c0 .03-.02.05-.06.09L569.93 512l287.7 287.7c.04.04.05.06.06.09a.12.12 0 010 .07c0 .02-.02.04-.06.08l-57.7 57.69c-.03.04-.05.05-.07.06a.12.12 0 01-.07 0c-.03 0-.05-.02-.09-.06L512 569.93l-287.7 287.7c-.04.04-.06.05-.09.06a.12.12 0 01-.07 0c-.02 0-.04-.02-.08-.06l-57.69-57.7c-.04-.03-.05-.05-.06-.07a.12.12 0 010-.07c0-.03.02-.05.06-.09L454.07 512l-287.7-287.7c-.04-.04-.05-.06-.06-.09a.12.12 0 010-.07c0-.02.02-.04.06-.08l57.7-57.69c.03-.04.05-.05.07-.06a.12.12 0 01.07 0c.03 0 .05.02.09.06L512 454.07l287.7-287.7c.04-.04.06-.05.09-.06a.12.12 0 01.07 0z"}}]},name:"close",theme:"outlined"},Pe=function(e,t){return u.createElement(Be,F({},e,{ref:t,icon:De}))},Fe=u.forwardRef(Pe);"production"!==process.env.NODE_ENV&&(Fe.displayName="CloseOutlined");var Ue={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z"}}]},name:"down",theme:"outlined"},ze=function(e,t){return u.createElement(Be,F({},e,{ref:t,icon:Ue}))},$e=u.forwardRef(ze);"production"!==process.env.NODE_ENV&&($e.displayName="DownOutlined");var Ve={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0042 42h216v494zM514.1 580.1l-61.8-102.4c-2.2-3.6-6.1-5.8-10.3-5.8h-38.4c-2.3 0-4.5.6-6.4 1.9-5.6 3.5-7.3 10.9-3.7 16.6l82.3 130.4-83.4 132.8a12.04 12.04 0 0010.2 18.4h34.5c4.2 0 8-2.2 10.2-5.7L510 664.8l62.3 101.4c2.2 3.6 6.1 5.7 10.2 5.7H620c2.3 0 4.5-.7 6.5-1.9 5.6-3.6 7.2-11 3.6-16.6l-84-130.4 85.3-132.5a12.04 12.04 0 00-10.1-18.5h-35.7c-4.2 0-8.1 2.2-10.3 5.8l-61.2 102.3z"}}]},name:"file-excel",theme:"outlined"},He=function(e,t){return u.createElement(Be,F({},e,{ref:t,icon:Ve}))},Ke=u.forwardRef(He);"production"!==process.env.NODE_ENV&&(Ke.displayName="FileExcelOutlined");var We={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M553.1 509.1l-77.8 99.2-41.1-52.4a8 8 0 00-12.6 0l-99.8 127.2a7.98 7.98 0 006.3 12.9H696c6.7 0 10.4-7.7 6.3-12.9l-136.5-174a8.1 8.1 0 00-12.7 0zM360 442a40 40 0 1080 0 40 40 0 10-80 0zm494.6-153.4L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0042 42h216v494z"}}]},name:"file-image",theme:"outlined"},Ge=function(e,t){return u.createElement(Be,F({},e,{ref:t,icon:We}))},Ze=u.forwardRef(Ge);"production"!==process.env.NODE_ENV&&(Ze.displayName="FileImageOutlined");var Ye={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M531.3 574.4l.3-1.4c5.8-23.9 13.1-53.7 7.4-80.7-3.8-21.3-19.5-29.6-32.9-30.2-15.8-.7-29.9 8.3-33.4 21.4-6.6 24-.7 56.8 10.1 98.6-13.6 32.4-35.3 79.5-51.2 107.5-29.6 15.3-69.3 38.9-75.2 68.7-1.2 5.5.2 12.5 3.5 18.8 3.7 7 9.6 12.4 16.5 15 3 1.1 6.6 2 10.8 2 17.6 0 46.1-14.2 84.1-79.4 5.8-1.9 11.8-3.9 17.6-5.9 27.2-9.2 55.4-18.8 80.9-23.1 28.2 15.1 60.3 24.8 82.1 24.8 21.6 0 30.1-12.8 33.3-20.5 5.6-13.5 2.9-30.5-6.2-39.6-13.2-13-45.3-16.4-95.3-10.2-24.6-15-40.7-35.4-52.4-65.8zM421.6 726.3c-13.9 20.2-24.4 30.3-30.1 34.7 6.7-12.3 19.8-25.3 30.1-34.7zm87.6-235.5c5.2 8.9 4.5 35.8.5 49.4-4.9-19.9-5.6-48.1-2.7-51.4.8.1 1.5.7 2.2 2zm-1.6 120.5c10.7 18.5 24.2 34.4 39.1 46.2-21.6 4.9-41.3 13-58.9 20.2-4.2 1.7-8.3 3.4-12.3 5 13.3-24.1 24.4-51.4 32.1-71.4zm155.6 65.5c.1.2.2.5-.4.9h-.2l-.2.3c-.8.5-9 5.3-44.3-8.6 40.6-1.9 45 7.3 45.1 7.4zm191.4-388.2L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0042 42h216v494z"}}]},name:"file-pdf",theme:"outlined"},Je=function(e,t){return u.createElement(Be,F({},e,{ref:t,icon:Ye}))},Xe=u.forwardRef(Je);"production"!==process.env.NODE_ENV&&(Xe.displayName="FilePdfOutlined");var Qe={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M424 476c-4.4 0-8 3.6-8 8v276c0 4.4 3.6 8 8 8h32.5c4.4 0 8-3.6 8-8v-95.5h63.3c59.4 0 96.2-38.9 96.2-94.1 0-54.5-36.3-94.3-96-94.3H424zm150.6 94.3c0 43.4-26.5 54.3-71.2 54.3h-38.9V516.2h56.2c33.8 0 53.9 19.7 53.9 54.1zm280-281.7L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0042 42h216v494z"}}]},name:"file-ppt",theme:"outlined"},et=function(e,t){return u.createElement(Be,F({},e,{ref:t,icon:Qe}))},tt=u.forwardRef(et);"production"!==process.env.NODE_ENV&&(tt.displayName="FilePptOutlined");var nt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0042 42h216v494zM504 618H320c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h184c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8zM312 490v48c0 4.4 3.6 8 8 8h384c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H320c-4.4 0-8 3.6-8 8z"}}]},name:"file-text",theme:"outlined"},rt=function(e,t){return u.createElement(Be,F({},e,{ref:t,icon:nt}))},st=u.forwardRef(rt);"production"!==process.env.NODE_ENV&&(st.displayName="FileTextOutlined");var it={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0042 42h216v494zM528.1 472h-32.2c-5.5 0-10.3 3.7-11.6 9.1L434.6 680l-46.1-198.7c-1.3-5.4-6.1-9.3-11.7-9.3h-35.4a12.02 12.02 0 00-11.6 15.1l74.2 276c1.4 5.2 6.2 8.9 11.6 8.9h32c5.4 0 10.2-3.6 11.6-8.9l52.8-197 52.8 197c1.4 5.2 6.2 8.9 11.6 8.9h31.8c5.4 0 10.2-3.6 11.6-8.9l74.4-276a12.04 12.04 0 00-11.6-15.1H647c-5.6 0-10.4 3.9-11.7 9.3l-45.8 199.1-49.8-199.3c-1.3-5.4-6.1-9.1-11.6-9.1z"}}]},name:"file-word",theme:"outlined"},ot=function(e,t){return u.createElement(Be,F({},e,{ref:t,icon:it}))},lt=u.forwardRef(ot);"production"!==process.env.NODE_ENV&&(lt.displayName="FileWordOutlined");var at={icon:{tag:"svg",attrs:{viewBox:"0 0 1024 1024",focusable:"false"},children:[{tag:"path",attrs:{d:"M988 548c-19.9 0-36-16.1-36-36 0-59.4-11.6-117-34.6-171.3a440.45 440.45 0 00-94.3-139.9 437.71 437.71 0 00-139.9-94.3C629 83.6 571.4 72 512 72c-19.9 0-36-16.1-36-36s16.1-36 36-36c69.1 0 136.2 13.5 199.3 40.3C772.3 66 827 103 874 150c47 47 83.9 101.8 109.7 162.7 26.7 63.1 40.2 130.2 40.2 199.3.1 19.9-16 36-35.9 36z"}}]},name:"loading",theme:"outlined"},ct=function(e,t){return u.createElement(Be,F({},e,{ref:t,icon:at}))},ut=u.forwardRef(ct);"production"!==process.env.NODE_ENV&&(ut.displayName="LoadingOutlined");var dt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z"}},{tag:"path",attrs:{d:"M192 474h672q8 0 8 8v60q0 8-8 8H160q-8 0-8-8v-60q0-8 8-8z"}}]},name:"plus",theme:"outlined"},ht=function(e,t){return u.createElement(Be,F({},e,{ref:t,icon:dt}))},ft=u.forwardRef(ht);"production"!==process.env.NODE_ENV&&(ft.displayName="PlusOutlined");var pt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M765.7 486.8L314.9 134.7A7.97 7.97 0 00302 141v77.3c0 4.9 2.3 9.6 6.1 12.6l360 281.1-360 281.1c-3.9 3-6.1 7.7-6.1 12.6V883c0 6.7 7.7 10.4 12.9 6.3l450.8-352.1a31.96 31.96 0 000-50.4z"}}]},name:"right",theme:"outlined"},mt=function(e,t){return u.createElement(Be,F({},e,{ref:t,icon:pt}))},gt=u.forwardRef(mt);"production"!==process.env.NODE_ENV&&(gt.displayName="RightOutlined");var vt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M909.6 854.5L649.9 594.8C690.2 542.7 712 479 712 412c0-80.2-31.3-155.4-87.9-212.1-56.6-56.7-132-87.9-212.1-87.9s-155.5 31.3-212.1 87.9C143.2 256.5 112 331.8 112 412c0 80.1 31.3 155.5 87.9 212.1C256.5 680.8 331.8 712 412 712c67 0 130.6-21.8 182.7-62l259.7 259.6a8.2 8.2 0 0011.6 0l43.6-43.5a8.2 8.2 0 000-11.6zM570.4 570.4C528 612.7 471.8 636 412 636s-116-23.3-158.4-65.6C211.3 528 188 471.8 188 412s23.3-116.1 65.6-158.4C296 211.3 352.2 188 412 188s116.1 23.2 158.4 65.6S636 352.2 636 412s-23.3 116.1-65.6 158.4z"}}]},name:"search",theme:"outlined"},bt=function(e,t){return u.createElement(Be,F({},e,{ref:t,icon:vt}))},yt=u.forwardRef(bt);"production"!==process.env.NODE_ENV&&(yt.displayName="SearchOutlined");var xt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M924.8 625.7l-65.5-56c3.1-19 4.7-38.4 4.7-57.8s-1.6-38.8-4.7-57.8l65.5-56a32.03 32.03 0 009.3-35.2l-.9-2.6a443.74 443.74 0 00-79.7-137.9l-1.8-2.1a32.12 32.12 0 00-35.1-9.5l-81.3 28.9c-30-24.6-63.5-44-99.7-57.6l-15.7-85a32.05 32.05 0 00-25.8-25.7l-2.7-.5c-52.1-9.4-106.9-9.4-159 0l-2.7.5a32.05 32.05 0 00-25.8 25.7l-15.8 85.4a351.86 351.86 0 00-99 57.4l-81.9-29.1a32 32 0 00-35.1 9.5l-1.8 2.1a446.02 446.02 0 00-79.7 137.9l-.9 2.6c-4.5 12.5-.8 26.5 9.3 35.2l66.3 56.6c-3.1 18.8-4.6 38-4.6 57.1 0 19.2 1.5 38.4 4.6 57.1L99 625.5a32.03 32.03 0 00-9.3 35.2l.9 2.6c18.1 50.4 44.9 96.9 79.7 137.9l1.8 2.1a32.12 32.12 0 0035.1 9.5l81.9-29.1c29.8 24.5 63.1 43.9 99 57.4l15.8 85.4a32.05 32.05 0 0025.8 25.7l2.7.5a449.4 449.4 0 00159 0l2.7-.5a32.05 32.05 0 0025.8-25.7l15.7-85a350 350 0 0099.7-57.6l81.3 28.9a32 32 0 0035.1-9.5l1.8-2.1c34.8-41.1 61.6-87.5 79.7-137.9l.9-2.6c4.5-12.3.8-26.3-9.3-35zM788.3 465.9c2.5 15.1 3.8 30.6 3.8 46.1s-1.3 31-3.8 46.1l-6.6 40.1 74.7 63.9a370.03 370.03 0 01-42.6 73.6L721 702.8l-31.4 25.8c-23.9 19.6-50.5 35-79.3 45.8l-38.1 14.3-17.9 97a377.5 377.5 0 01-85 0l-17.9-97.2-37.8-14.5c-28.5-10.8-55-26.2-78.7-45.7l-31.4-25.9-93.4 33.2c-17-22.9-31.2-47.6-42.6-73.6l75.5-64.5-6.5-40c-2.4-14.9-3.7-30.3-3.7-45.5 0-15.3 1.2-30.6 3.7-45.5l6.5-40-75.5-64.5c11.3-26.1 25.6-50.7 42.6-73.6l93.4 33.2 31.4-25.9c23.7-19.5 50.2-34.9 78.7-45.7l37.9-14.3 17.9-97.2c28.1-3.2 56.8-3.2 85 0l17.9 97 38.1 14.3c28.7 10.8 55.4 26.2 79.3 45.8l31.4 25.8 92.8-32.9c17 22.9 31.2 47.6 42.6 73.6L781.8 426l6.5 39.9zM512 326c-97.2 0-176 78.8-176 176s78.8 176 176 176 176-78.8 176-176-78.8-176-176-176zm79.2 255.2A111.6 111.6 0 01512 614c-29.9 0-58-11.7-79.2-32.8A111.6 111.6 0 01400 502c0-29.9 11.7-58 32.8-79.2C454 401.6 482.1 390 512 390c29.9 0 58 11.6 79.2 32.8A111.6 111.6 0 01624 502c0 29.9-11.7 58-32.8 79.2z"}}]},name:"setting",theme:"outlined"},wt=function(e,t){return u.createElement(Be,F({},e,{ref:t,icon:xt}))},Nt=u.forwardRef(wt);"production"!==process.env.NODE_ENV&&(Nt.displayName="SettingOutlined");var Et={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M400 317.7h73.9V656c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V317.7H624c6.7 0 10.4-7.7 6.3-12.9L518.3 163a8 8 0 00-12.6 0l-112 141.7c-4.1 5.3-.4 13 6.3 13zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z"}}]},name:"upload",theme:"outlined"},kt=function(e,t){return u.createElement(Be,F({},e,{ref:t,icon:Et}))},St=u.forwardRef(kt);"production"!==process.env.NODE_ENV&&(St.displayName="UploadOutlined");var At={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M912 302.3L784 376V224c0-35.3-28.7-64-64-64H128c-35.3 0-64 28.7-64 64v576c0 35.3 28.7 64 64 64h592c35.3 0 64-28.7 64-64V648l128 73.7c21.3 12.3 48-3.1 48-27.6V330c0-24.6-26.7-40-48-27.7zM712 792H136V232h576v560zm176-167l-104-59.8V458.9L888 399v226zM208 360h112c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H208c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8z"}}]},name:"video-camera",theme:"outlined"},Ct=function(e,t){return u.createElement(Be,F({},e,{ref:t,icon:At}))},jt=u.forwardRef(Ct);"production"!==process.env.NODE_ENV&&(jt.displayName="VideoCameraOutlined");const{Option:_t}=s.Select,Ot=e=>(t,n)=>{const r=null==t?void 0:t[e],s=null==n?void 0:n[e],i=null==r||""===r,o=null==s||""===s;if(i&&o)return 0;if(i)return 1;if(o)return-1;const l=Number(r),a=Number(s);if(!isNaN(l)&&!isNaN(a))return l-a;const c=String(r),u=String(s);return c.localeCompare(u,"zh-CN",{numeric:!0,sensitivity:"base"})},Tt=r.forwardRef((e,t)=>{var i;const{columns:o,dataSource:a,pagination:c,tableId:u,size:d="middle",onRowClick:h,page:p,showTableConfig:m=!0,...g}=e,[v,b]=r.useState([]),[y,x]=r.useState([]),[w,N]=r.useState(!1),[E,k]=r.useState([]),[S,C]=r.useState([]),[j,_]=r.useState([]),[O]=s.Form.useForm(),[T,L]=r.useState([]),[q,I]=r.useState({field:null,order:null}),[R,M]=r.useState([]),B=f.getUserInfo(),D=null==(i=f.getOrgInfo())?void 0:i.orgId,P=r.useRef(void 0),F=r.useRef(void 0);r.useImperativeHandle(t,()=>({openSettingModal:()=>N(!0),closeSettingModal:()=>N(!1)}));const U=r.useMemo(()=>(null==o?void 0:o.map(e=>e.dataIndex||e.key).join(","))||"",[o]),z=r.useCallback(async()=>{var e,t,n;const r=(null==o?void 0:o.map((e,t)=>({key:e.key||e.dataIndex||`col-${t}`,title:e.title,dataIndex:e.dataIndex,displayTitle:"string"==typeof e.title?e.title:`列 ${t+1}`,headerAlignment:e.align||"left",contentAlignment:e.align||"left",dataFormat:"字符串",width:e.width||100,enabled:!1!==e.enabled,calculateTotal:!1,isBuiltIn:!1,allowSorting:!1,sort:t+1,render:e.render,fixed:e.fixed,originalColumn:{...e}})))||[];if(C(r),o.length>1)try{if(u){const i=await(s={userId:B.userId,tableId:u||"",orgId:D},A("/platform/business/common/getTableConfigByUser",s));if(null==(e=null==i?void 0:i.data)?void 0:e.content){const e=null==(n=JSON.parse(null==(t=null==i?void 0:i.data)?void 0:t.content))?void 0:n.map(e=>{var t;const n=null==(t=o.find(t=>t.key===e.key))?void 0:t.render;return{...e,render:n,originalColumn:{...e.originalColumn,render:n}}});k(e),_(e)}else k(r),_(r)}else k(r),_(r)}catch(i){k(r),_(r)}else k(r),_(r);var s},[o,u,B.userId]),$=r.useMemo(()=>l.debounce(z,100),[z]);r.useEffect(()=>{(P.current!==u||F.current!==U)&&(P.current=u,F.current=U,$())},[u,U,$]),r.useEffect(()=>{const e=E.filter(e=>e.enabled).sort((e,t)=>e.sort-t.sort).map(e=>{const t=o.find(t=>(t.key||t.dataIndex)===e.key),n={...e.originalColumn,...t,key:e.key,title:e.displayTitle,dataIndex:e.dataIndex,align:e.contentAlignment,width:Number(e.width),onHeaderCell:n=>{var r;const s=(null==t?void 0:t.onHeaderCell)||(null==(r=e.originalColumn)?void 0:r.onHeaderCell),i=s?s(n):{};return{...i,style:{...i.style,textAlign:e.headerAlignment}}}};return e.allowSorting&&e.dataIndex&&(n.sorter=!0,n.sortDirections=["ascend","descend"],n.sortOrder=q.field===e.dataIndex?q.order:null),n}),t=[...m?[{title:n.jsxs(s.Space,{size:"small",children:[n.jsx("span",{children:"序号"}),n.jsx(s.Tooltip,{title:"表格配置",children:n.jsx(Nt,{onClick:()=>N(!0),style:{cursor:"pointer"}})})]}),dataIndex:"INDEX",key:"INDEX",width:80,align:"center",isBuiltIn:!0,fixed:"left",render:(e,t,r)=>{const i=e||((null==p?void 0:p.current)-1)*(null==p?void 0:p.pageSize)+r+1||r+1;return n.jsx(s.Tooltip,{title:String(i),children:n.jsx("div",{style:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:i})})}}]:[],...e].map(e=>{const t=e.render;return{...e,render:(i,o,l)=>{const a=t?t(i,o,l):i;return r.isValidElement(a)?n.jsx("div",{style:{textAlign:e.align,width:"100%"},children:a}):"object"==typeof a&&null!==a?"":n.jsx(s.Tooltip,{title:null!=a?String(a):"",children:n.jsx("div",{style:{display:"block",width:"100%",textAlign:e.align,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",paddingLeft:"left"===e.align?0:void 0,paddingRight:"right"===e.align?0:void 0},children:null!=a?a:""})})}}});b(t)},[E,m,p,q,o]),r.useEffect(()=>{const e=(t,n,r)=>t.map((t,s)=>{const i=`${n}.${s+1}`,o={...t,parentId:(null==t?void 0:t.parentId)||r,id:(null==t?void 0:t.id)||`${r}-${s+1}`,INDEX:i};return Array.isArray(null==t?void 0:t.children)&&t.children.length>0&&(o.children=e(t.children,i,o.id)),o}),t=(a||[]).map((t,n)=>{const r=(null==t?void 0:t.INDEX)||((null==p?void 0:p.current)-1)*(null==p?void 0:p.pageSize)+n+1||n+1,s={...t,parentId:(null==t?void 0:t.parentId)||null,id:(null==t?void 0:t.id)||n+1,INDEX:r};return Array.isArray(null==t?void 0:t.children)&&t.children.length>0&&(s.children=e(t.children,r,s.id)),s});if(L(t.map(e=>e.id)),M(t),q.field&&q.order&&t.length>0){const e=[...t].sort((e,t)=>{const n=Ot(q.field)(e,t);return"descend"===q.order?-n:n});x(e)}else x(t)},[a]);const V=r.useRef(null),H=[{title:"显示名称",dataIndex:"displayTitle",key:"displayTitle",render:(e,t)=>n.jsx(s.Input,{size:"small",defaultValue:e,onBlur:e=>K(t.key,"displayTitle",e.target.value)})},{title:"表头对齐",dataIndex:"headerAlignment",key:"headerAlignment",align:"center",render:(e,t)=>n.jsxs(s.Radio.Group,{size:"small",defaultValue:e,onChange:e=>K(t.key,"headerAlignment",e.target.value),children:[n.jsx(s.Radio.Button,{value:"left",children:"左"}),n.jsx(s.Radio.Button,{value:"center",children:"中"}),n.jsx(s.Radio.Button,{value:"right",children:"右"})]})},{title:"内容对齐",dataIndex:"contentAlignment",key:"contentAlignment",align:"center",render:(e,t)=>n.jsxs(s.Radio.Group,{size:"small",defaultValue:e,onChange:e=>K(t.key,"contentAlignment",e.target.value),children:[n.jsx(s.Radio.Button,{value:"left",children:"左"}),n.jsx(s.Radio.Button,{value:"center",children:"中"}),n.jsx(s.Radio.Button,{value:"right",children:"右"})]})},{title:"数据格式",dataIndex:"dataFormat",key:"dataFormat",render:(e,t)=>n.jsxs(s.Select,{size:"small",defaultValue:e,style:{width:80},onChange:e=>K(t.key,"dataFormat",e),children:[n.jsx(_t,{value:"字符串",children:"字符串"}),n.jsx(_t,{value:"数字",children:"数字"}),n.jsx(_t,{value:"日期",children:"日期"})]})},{title:"宽度",dataIndex:"width",key:"width",render:(e,t)=>n.jsx(s.InputNumber,{size:"small",defaultValue:e,style:{width:60},onBlur:e=>K(t.key,"width",e.target.value)})},{title:"是否启用",dataIndex:"enabled",key:"enabled",align:"center",render:(e,t)=>n.jsx(s.Switch,{size:"small",defaultValue:e,onChange:e=>K(t.key,"enabled",e)})},{title:"允许排序",dataIndex:"allowSorting",key:"allowSorting",align:"center",render:(e,t)=>n.jsx(s.Switch,{size:"small",defaultValue:e,onChange:e=>K(t.key,"allowSorting",e)})},{title:"显示顺序",dataIndex:"sort",key:"sort",render:(e,t)=>n.jsx(s.InputNumber,{size:"small",defaultValue:e,style:{width:60},onBlur:e=>K(t.key,"sort",e.target.value)})}],K=(e,t,n)=>{_(r=>r.map(r=>r.key===e?{...r,[t]:n}:r))},W=async()=>{try{const t=await(e={tableId:u||"",userId:B.userId,content:JSON.stringify(j)},A("/platform/business/common/saveUserTableConfig",e));k(j),200===(null==t?void 0:t.code)&&(s.message.success("保存成功"),$())}catch(t){}var e},G=()=>{N(!1)},Z=(e,t=!1)=>{L(t?T.filter(t=>t!==(null==e?void 0:e.id)):[...T,null==e?void 0:e.id])},Y=r.useCallback(e=>{const{field:t,order:n}=e,r=R||[];if(!t||!n)return I({field:null,order:null}),void x([...r]);if(I({field:t,order:n}),0===r.length)return void x([]);const s=[...r].sort((e,r)=>{const s=Ot(t)(e,r);return"descend"===n?-s:s});x(s)},[R]),J=r.useCallback((e,t,n,r)=>{"sort"!==(null==r?void 0:r.action)?(g.onChange&&g.onChange(e,t,n,r),g.handleTableChange&&g.handleTableChange(e,t,n)):Y(n)},[Y,g.onChange,g.handleTableChange]),X=r.useMemo(()=>{if(!1===c)return!1;if(c&&"object"==typeof c){const e={pageSize:10,...c};return Array.isArray(e.pageSizeOptions)&&(e.pageSizeOptions=e.pageSizeOptions.filter(e=>null!=e)),e}return c},[c]);return n.jsxs(s.ConfigProvider,{theme:{components:{Table:{bodySortBg:"transparent",headerSortActiveBg:"#2569D8",headerSortHoverBg:"#2569D8"}}},children:[n.jsx(s.Table,{...g,columns:v,dataSource:y,bordered:!0,rowKey:"id",indentSize:24,pagination:X,size:"small",onChange:J,onRow:(e,t)=>{const n=g.onRow?g.onRow(e,t):{};return{...n,onClick:t=>{var r;h&&h(e,t),null==(r=null==n?void 0:n.onClick)||r.call(n,t)}}},expandable:{expandedRowKeys:T,expandIcon:({expanded:e,onExpand:t,record:r})=>{var s;if((null==(s=null==r?void 0:r.children)?void 0:s.length)>0){const s={fontSize:"14px",color:"rgba(0, 0, 0, 0.45)",cursor:"pointer",position:"absolute",left:`${18+8*((null==r?void 0:r.INDEX)?String(r.INDEX).split(".").length-1:0)}px`,top:"13px"};return e?n.jsx($e,{onClick:e=>{t(r,e),Z(r,!0)},style:s}):n.jsx(gt,{onClick:e=>{t(r,e),Z(r,!1)},style:s})}return null}}}),n.jsx(s.Modal,{title:"表格设置",visible:w,footer:[n.jsx(s.Button,{onClick:async()=>{var e;200===(await(e={userId:B.userId,tableId:u||""},A("/platform/business/common/restoreDefaultTableConfig",e))).code&&(k(S),_(S),N(!1),s.message.success("重置成功"))},children:"重置"},"reset"),n.jsx(s.Button,{onClick:G,children:"取消"},"cancel"),n.jsx(s.Button,{onClick:async()=>{try{const t=await(e={orgId:D,tableId:u||"",content:JSON.stringify(j)},A("/platform/business/common/saveCurOrgTableConfig",e));k(j),200===(null==t?void 0:t.code)&&(s.message.success("保存为机构配置成功"),N(!1))}catch(t){}var e},children:"保存为该机构配置"},"saveOrg"),n.jsx(s.Button,{type:"primary",onClick:()=>{N(!1),W()},children:"保存"},"submit")],onCancel:G,width:1e3,destroyOnClose:!0,maskClosable:!1,children:n.jsx(s.Spin,{spinning:!1,children:n.jsx(s.Form,{form:O,component:!1,children:n.jsx(s.Table,{ref:V,columns:H,dataSource:j.filter(e=>!e.isBuiltIn).sort((e,t)=>e.sort-t.sort),rowKey:"key",size:"small",pagination:!1,bordered:!0,scroll:{y:400}})})})})]})}),Lt=({label:e,id:t,value:i,onChange:o,disabled:l=!1})=>{const[a,c]=r.useState([]),[u,d]=r.useState(void 0),[h,f]=r.useState(!1),[p,m]=r.useState(void 0),[g,v]=r.useState(void 0),[b,y]=r.useState(void 0),[x,w]=r.useState(void 0),[N,E]=r.useState([]),[k,S]=r.useState(void 0),[A,C]=r.useState(!1),[j,_]=r.useState([]),[T,L]=r.useState(void 0),[q,I]=r.useState(!1),[R,M]=r.useState([]),[B,D]=r.useState(void 0),[P,F]=r.useState(!1),[U,z]=r.useState(""),$=r.useRef(!1),V=r.useRef(!1),H=r.useRef(o);H.current=o;const K=r.useCallback(e=>{H.current&&H.current(e)},[]),W=r.useCallback(async(e,t)=>{switch(e){case 1:f(!0);break;case 2:C(!0);break;case 3:I(!0);break;case 4:F(!0)}try{const n=await O({level:e,parent:t.toString()},"/platform/business/common/getAreaByLevel");return 200===n.code&&Array.isArray(n.data)?n.data.map(e=>({value:e.code,label:e.name})):[]}catch(n){return[]}finally{switch(e){case 1:f(!1);break;case 2:C(!1);break;case 3:I(!1);break;case 4:F(!1)}}},[]);r.useEffect(()=>{W(1,"0").then(e=>{c(e)})},[W]),r.useEffect(()=>{if(!i)return;if(V.current)return void(V.current=!1);$.current=!0,d(i.addProvinceCode),m(i.addProvince),S(i.addCityCode),v(i.addCity),L(i.addCountyCode),y(i.addCounty),D(i.addStreetCode),w(i.addStreet),z(i.address||"");(async()=>{try{if(i.addProvinceCode){const e=await W(2,i.addProvinceCode);if(E(e),i.addCityCode){const e=await W(3,i.addCityCode);if(_(e),i.addCountyCode){const e=await W(4,i.addCountyCode);M(e)}}}}finally{$.current=!1}})()},[i]),r.useEffect(()=>{$.current||(u?W(2,u).then(e=>E(e)):(v(void 0),y(void 0),w(void 0),m(void 0),z(""),S(void 0),E([]),L(void 0),_([]),D(void 0),M([])))},[u,W]),r.useEffect(()=>{$.current||(k?W(3,k).then(e=>_(e)):(L(void 0),_([]),D(void 0),M([]),z("")))},[k,W]),r.useEffect(()=>{$.current||(T?W(4,T).then(e=>M(e)):(D(void 0),M([]),z("")))},[T,W]);return n.jsx("div",{children:n.jsxs(s.Space,{wrap:!0,id:t,children:[n.jsx(s.Select,{style:{minWidth:100},options:a,value:u,onChange:e=>{var t;if(e===u&&void 0!==e)return;V.current=!0;const n=null==(t=a.find(t=>t.value===e))?void 0:t.label;d(e),m(n),S(void 0),v(void 0),E([]),L(void 0),y(void 0),_([]),D(void 0),w(void 0),M([]),z(""),K({addProvince:n,addProvinceCode:e,addCity:void 0,addCityCode:void 0,addCounty:void 0,addCountyCode:void 0,addStreet:void 0,addStreetCode:void 0,address:""})},placeholder:"请选择省",loading:h,disabled:l,allowClear:!0}),n.jsx(s.Select,{style:{minWidth:100},options:N,value:k,onChange:e=>{var t;if(e===k&&void 0!==e)return;V.current=!0;const n=null==(t=N.find(t=>t.value===e))?void 0:t.label;S(e),v(n),L(void 0),y(void 0),_([]),D(void 0),w(void 0),M([]),z(""),K({addProvince:p,addProvinceCode:u,addCity:n,addCityCode:e,addCounty:void 0,addCountyCode:void 0,addStreet:void 0,addStreetCode:void 0,address:""})},placeholder:"请选择市",loading:A,disabled:l||!u||h,allowClear:!0}),n.jsx(s.Select,{style:{minWidth:100},options:j,value:T,onChange:e=>{var t;if(e===T&&void 0!==e)return;V.current=!0;const n=null==(t=j.find(t=>t.value===e))?void 0:t.label;L(e),y(n),D(void 0),w(void 0),M([]),z(""),K({addProvince:p,addProvinceCode:u,addCity:g,addCityCode:k,addCounty:n,addCountyCode:e,addStreet:void 0,addStreetCode:void 0,address:""})},placeholder:"请选择区/县",loading:q,disabled:l||!k||A,allowClear:!0}),n.jsx(s.Select,{style:{minWidth:100},options:R,value:B,onChange:e=>{var t;if(e===B&&void 0!==e)return;V.current=!0;const n=null==(t=R.find(t=>t.value===e))?void 0:t.label;D(e),w(n),z(""),K({addProvince:p,addProvinceCode:u,addCity:g,addCityCode:k,addCounty:b,addCountyCode:T,addStreet:n,addStreetCode:e,address:""})},placeholder:"请选择乡/镇",loading:P,disabled:l||!T||q,allowClear:!0}),n.jsx(s.Input,{placeholder:"请输入详细地址",disabled:l||!T,value:U,onChange:e=>{V.current=!0;const t=e.target.value;z(t),K({addProvince:p,addProvinceCode:u,addCity:g,addCityCode:k,addCounty:b,addCountyCode:T,addStreet:x,addStreetCode:B,address:t})}})]})})},qt=({value:e,onChange:t,accept:i="image/*",listType:o="picture-card",maxCount:l=1,key:a,disabled:c=!1})=>{const[u,d]=r.useState(!1),[h,f]=r.useState(""),[p,m]=r.useState(""),[g,v]=r.useState([]);r.useEffect(()=>{v(e?[{uid:"-1",name:"image.png",status:"done",url:e}]:[])},[e]);const b=r.useCallback(e=>{t&&t(e)},[t]),y=n.jsxs("div",{children:[n.jsx(ft,{}),n.jsx("div",{style:{marginTop:8},children:"上传"})]});return n.jsxs(n.Fragment,{children:[n.jsx(s.Upload,{accept:i,listType:o,fileList:g,onPreview:async e=>{e.url||e.preview||e.originFileObj&&(e.preview=await(e=>new Promise((t,n)=>{const r=new FileReader;r.readAsDataURL(e),r.onload=()=>t(r.result),r.onerror=e=>n(e)}))(e.originFileObj)),f(e.url||e.preview),d(!0),m(e.name||e.url.substring(e.url.lastIndexOf("/")+1))},onChange:({file:e,fileList:t})=>{var n,r;if(v(t),"done"===e.status){const r=null==(n=e.response)?void 0:n.data;r?(s.message.success(`${e.name} 文件上传成功`),null==b||b(r)):(s.message.error(`${e.name} 文件上传成功,但未获取到 URL。`),v(t.filter(t=>t.uid!==e.uid)))}else"removed"===e.status?(s.message.success(`${e.name} 文件已移除`),null==b||b(void 0)):"error"===e.status&&(s.message.error(`${e.name} 文件上传失败: ${(null==(r=e.error)?void 0:r.message)||"未知错误"}`),null==b||b(void 0))},customRequest:async e=>{const{onSuccess:t,onError:n,file:r,onProgress:i}=e;if(r instanceof File&&r.size>8388608)return s.message.error("文件大小不能超过 8MB"),void(null==n||n(new Error("文件大小不能超过 8MB")));const o=new FormData;o.append("file",r);try{const e=await q(o,{headers:{"Content-Type":"multipart/form-data"},onUploadProgress:e=>{e.total&&i({percent:e.loaded/e.total*100})}});e&&e.data?(null==b||b(e.data),t(e,r)):n(new Error("上传成功但响应中缺少图片URL"),e)}catch(l){n(l)}},maxCount:l,disabled:c,onRemove:e=>!0,children:g.length>=(l||1)?null:y},a),n.jsx(s.Modal,{visible:u,title:p,footer:null,onCancel:()=>d(!1),children:n.jsx("img",{alt:"example",style:{width:"100%"},src:h})})]})};var It="object"==typeof global&&global&&global.Object===Object&&global,Rt="object"==typeof self&&self&&self.Object===Object&&self,Mt=It||Rt||Function("return this")(),Bt=Mt.Symbol,Dt=Object.prototype,Pt=Dt.hasOwnProperty,Ft=Dt.toString,Ut=Bt?Bt.toStringTag:void 0;var zt=Object.prototype.toString;var $t=Bt?Bt.toStringTag:void 0;function Vt(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":$t&&$t in Object(e)?function(e){var t=Pt.call(e,Ut),n=e[Ut];try{e[Ut]=void 0;var r=!0}catch(i){}var s=Ft.call(e);return r&&(t?e[Ut]=n:delete e[Ut]),s}(e):function(e){return zt.call(e)}(e)}function Ht(e){return null!=e&&"object"==typeof e}var Kt=Array.isArray;function Wt(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function Gt(e){return e}function Zt(e){if(!Wt(e))return!1;var t=Vt(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}var Yt,Jt=Mt["__core-js_shared__"],Xt=(Yt=/[^.]+$/.exec(Jt&&Jt.keys&&Jt.keys.IE_PROTO||""))?"Symbol(src)_1."+Yt:"";var Qt=Function.prototype.toString;function en(e){if(null!=e){try{return Qt.call(e)}catch(t){}try{return e+""}catch(t){}}return""}var tn=/^\[object .+?Constructor\]$/,nn=Function.prototype,rn=Object.prototype,sn=nn.toString,on=rn.hasOwnProperty,ln=RegExp("^"+sn.call(on).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function an(e){return!(!Wt(e)||(t=e,Xt&&Xt in t))&&(Zt(e)?ln:tn).test(en(e));var t}function cn(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return an(n)?n:void 0}var un=cn(Mt,"WeakMap"),dn=Object.create,hn=function(){function e(){}return function(t){if(!Wt(t))return{};if(dn)return dn(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();var fn=Date.now;var pn,mn,gn,vn=function(){try{var e=cn(Object,"defineProperty");return e({},"",{}),e}catch(t){}}(),bn=vn?function(e,t){return vn(e,"toString",{configurable:!0,enumerable:!1,value:(n=t,function(){return n}),writable:!0});var n}:Gt,yn=(pn=bn,mn=0,gn=0,function(){var e=fn(),t=16-(e-gn);if(gn=e,t>0){if(++mn>=800)return arguments[0]}else mn=0;return pn.apply(void 0,arguments)});var xn=/^(?:0|[1-9]\d*)$/;function wn(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&xn.test(e))&&e>-1&&e%1==0&&e<t}function Nn(e,t,n){"__proto__"==t&&vn?vn(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function En(e,t){return e===t||e!=e&&t!=t}var kn=Object.prototype.hasOwnProperty;function Sn(e,t,n){var r=e[t];kn.call(e,t)&&En(r,n)&&(void 0!==n||t in e)||Nn(e,t,n)}var An=Math.max;function Cn(e,t){return yn(function(e,t,n){return t=An(void 0===t?e.length-1:t,0),function(){for(var r=arguments,s=-1,i=An(r.length-t,0),o=Array(i);++s<i;)o[s]=r[t+s];s=-1;for(var l=Array(t+1);++s<t;)l[s]=r[s];return l[t]=n(o),function(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}(e,this,l)}}(e,t,Gt),e+"")}function jn(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function _n(e){return null!=e&&jn(e.length)&&!Zt(e)}var On=Object.prototype;function Tn(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||On)}function Ln(e){return Ht(e)&&"[object Arguments]"==Vt(e)}var qn=Object.prototype,In=qn.hasOwnProperty,Rn=qn.propertyIsEnumerable,Mn=Ln(function(){return arguments}())?Ln:function(e){return Ht(e)&&In.call(e,"callee")&&!Rn.call(e,"callee")};var Bn="object"==typeof exports&&exports&&!exports.nodeType&&exports,Dn=Bn&&"object"==typeof module&&module&&!module.nodeType&&module,Pn=Dn&&Dn.exports===Bn?Mt.Buffer:void 0,Fn=(Pn?Pn.isBuffer:void 0)||function(){return!1},Un={};function zn(e){return function(t){return e(t)}}Un["[object Float32Array]"]=Un["[object Float64Array]"]=Un["[object Int8Array]"]=Un["[object Int16Array]"]=Un["[object Int32Array]"]=Un["[object Uint8Array]"]=Un["[object Uint8ClampedArray]"]=Un["[object Uint16Array]"]=Un["[object Uint32Array]"]=!0,Un["[object Arguments]"]=Un["[object Array]"]=Un["[object ArrayBuffer]"]=Un["[object Boolean]"]=Un["[object DataView]"]=Un["[object Date]"]=Un["[object Error]"]=Un["[object Function]"]=Un["[object Map]"]=Un["[object Number]"]=Un["[object Object]"]=Un["[object RegExp]"]=Un["[object Set]"]=Un["[object String]"]=Un["[object WeakMap]"]=!1;var $n="object"==typeof exports&&exports&&!exports.nodeType&&exports,Vn=$n&&"object"==typeof module&&module&&!module.nodeType&&module,Hn=Vn&&Vn.exports===$n&&It.process,Kn=function(){try{var e=Vn&&Vn.require&&Vn.require("util").types;return e||Hn&&Hn.binding&&Hn.binding("util")}catch(t){}}(),Wn=Kn&&Kn.isTypedArray,Gn=Wn?zn(Wn):function(e){return Ht(e)&&jn(e.length)&&!!Un[Vt(e)]},Zn=Object.prototype.hasOwnProperty;function Yn(e,t){var n=Kt(e),r=!n&&Mn(e),s=!n&&!r&&Fn(e),i=!n&&!r&&!s&&Gn(e),o=n||r||s||i,l=o?function(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}(e.length,String):[],a=l.length;for(var c in e)!t&&!Zn.call(e,c)||o&&("length"==c||s&&("offset"==c||"parent"==c)||i&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||wn(c,a))||l.push(c);return l}function Jn(e,t){return function(n){return e(t(n))}}var Xn=Jn(Object.keys,Object),Qn=Object.prototype.hasOwnProperty;function er(e){return _n(e)?Yn(e):function(e){if(!Tn(e))return Xn(e);var t=[];for(var n in Object(e))Qn.call(e,n)&&"constructor"!=n&&t.push(n);return t}(e)}var tr=Object.prototype.hasOwnProperty;function nr(e){if(!Wt(e))return function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t}(e);var t=Tn(e),n=[];for(var r in e)("constructor"!=r||!t&&tr.call(e,r))&&n.push(r);return n}function rr(e){return _n(e)?Yn(e,!0):nr(e)}var sr=cn(Object,"create");var ir=Object.prototype.hasOwnProperty;var or=Object.prototype.hasOwnProperty;function lr(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function ar(e,t){for(var n=e.length;n--;)if(En(e[n][0],t))return n;return-1}lr.prototype.clear=function(){this.__data__=sr?sr(null):{},this.size=0},lr.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},lr.prototype.get=function(e){var t=this.__data__;if(sr){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return ir.call(t,e)?t[e]:void 0},lr.prototype.has=function(e){var t=this.__data__;return sr?void 0!==t[e]:or.call(t,e)},lr.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=sr&&void 0===t?"__lodash_hash_undefined__":t,this};var cr=Array.prototype.splice;function ur(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}ur.prototype.clear=function(){this.__data__=[],this.size=0},ur.prototype.delete=function(e){var t=this.__data__,n=ar(t,e);return!(n<0)&&(n==t.length-1?t.pop():cr.call(t,n,1),--this.size,!0)},ur.prototype.get=function(e){var t=this.__data__,n=ar(t,e);return n<0?void 0:t[n][1]},ur.prototype.has=function(e){return ar(this.__data__,e)>-1},ur.prototype.set=function(e,t){var n=this.__data__,r=ar(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this};var dr=cn(Mt,"Map");function hr(e,t){var n,r,s=e.__data__;return("string"==(r=typeof(n=t))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?s["string"==typeof t?"string":"hash"]:s.map}function fr(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}fr.prototype.clear=function(){this.size=0,this.__data__={hash:new lr,map:new(dr||ur),string:new lr}},fr.prototype.delete=function(e){var t=hr(this,e).delete(e);return this.size-=t?1:0,t},fr.prototype.get=function(e){return hr(this,e).get(e)},fr.prototype.has=function(e){return hr(this,e).has(e)},fr.prototype.set=function(e,t){var n=hr(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this};var pr=Jn(Object.getPrototypeOf,Object),mr=Function.prototype,gr=Object.prototype,vr=mr.toString,br=gr.hasOwnProperty,yr=vr.call(Object);function xr(e){var t=this.__data__=new ur(e);this.size=t.size}xr.prototype.clear=function(){this.__data__=new ur,this.size=0},xr.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},xr.prototype.get=function(e){return this.__data__.get(e)},xr.prototype.has=function(e){return this.__data__.has(e)},xr.prototype.set=function(e,t){var n=this.__data__;if(n instanceof ur){var r=n.__data__;if(!dr||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new fr(r)}return n.set(e,t),this.size=n.size,this};var wr="object"==typeof exports&&exports&&!exports.nodeType&&exports,Nr=wr&&"object"==typeof module&&module&&!module.nodeType&&module,Er=Nr&&Nr.exports===wr?Mt.Buffer:void 0,kr=Er?Er.allocUnsafe:void 0;function Sr(e,t){if(t)return e.slice();var n=e.length,r=kr?kr(n):new e.constructor(n);return e.copy(r),r}var Ar=Object.prototype.propertyIsEnumerable,Cr=Object.getOwnPropertySymbols,jr=Cr?function(e){return null==e?[]:(e=Object(e),function(e,t){for(var n=-1,r=null==e?0:e.length,s=0,i=[];++n<r;){var o=e[n];t(o,n,e)&&(i[s++]=o)}return i}(Cr(e),function(t){return Ar.call(e,t)}))}:function(){return[]};function _r(e){return function(e,t,n){var r=t(e);return Kt(e)?r:function(e,t){for(var n=-1,r=t.length,s=e.length;++n<r;)e[s+n]=t[n];return e}(r,n(e))}(e,er,jr)}var Or=cn(Mt,"DataView"),Tr=cn(Mt,"Promise"),Lr=cn(Mt,"Set"),qr="[object Map]",Ir="[object Promise]",Rr="[object Set]",Mr="[object WeakMap]",Br="[object DataView]",Dr=en(Or),Pr=en(dr),Fr=en(Tr),Ur=en(Lr),zr=en(un),$r=Vt;(Or&&$r(new Or(new ArrayBuffer(1)))!=Br||dr&&$r(new dr)!=qr||Tr&&$r(Tr.resolve())!=Ir||Lr&&$r(new Lr)!=Rr||un&&$r(new un)!=Mr)&&($r=function(e){var t=Vt(e),n="[object Object]"==t?e.constructor:void 0,r=n?en(n):"";if(r)switch(r){case Dr:return Br;case Pr:return qr;case Fr:return Ir;case Ur:return Rr;case zr:return Mr}return t});var Vr=Object.prototype.hasOwnProperty;var Hr=Mt.Uint8Array;function Kr(e){var t=new e.constructor(e.byteLength);return new Hr(t).set(new Hr(e)),t}var Wr=/\w*$/;var Gr=Bt?Bt.prototype:void 0,Zr=Gr?Gr.valueOf:void 0;function Yr(e,t){var n=t?Kr(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function Jr(e,t,n){var r,s,i,o,l,a=e.constructor;switch(t){case"[object ArrayBuffer]":return Kr(e);case"[object Boolean]":case"[object Date]":return new a(+e);case"[object DataView]":return l=Kr((o=e).buffer),new o.constructor(l,o.byteOffset,o.byteLength);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return Yr(e,n);case"[object Map]":case"[object Set]":return new a;case"[object Number]":case"[object String]":return new a(e);case"[object RegExp]":return(i=new(s=e).constructor(s.source,Wr.exec(s))).lastIndex=s.lastIndex,i;case"[object Symbol]":return r=e,Zr?Object(Zr.call(r)):{}}}function Xr(e){return"function"!=typeof e.constructor||Tn(e)?{}:hn(pr(e))}var Qr=Kn&&Kn.isMap,es=Qr?zn(Qr):function(e){return Ht(e)&&"[object Map]"==$r(e)};var ts=Kn&&Kn.isSet,ns=ts?zn(ts):function(e){return Ht(e)&&"[object Set]"==$r(e)},rs="[object Arguments]",ss="[object Function]",is="[object Object]",os={};function ls(e,t,n,r,s,i){var o,l=1&t;if(void 0!==o)return o;if(!Wt(e))return e;var a=Kt(e);if(a)o=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Vr.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e);else{var c=$r(e),u=c==ss||"[object GeneratorFunction]"==c;if(Fn(e))return Sr(e,l);if(c==is||c==rs||u&&!s)o=u?{}:Xr(e);else{if(!os[c])return s?e:{};o=Jr(e,c,l)}}i||(i=new xr);var d=i.get(e);if(d)return d;i.set(e,o),ns(e)?e.forEach(function(r){o.add(ls(r,t,n,r,e,i))}):es(e)&&e.forEach(function(r,s){o.set(s,ls(r,t,n,s,e,i))});var h=a?void 0:_r(e);return function(e,t){for(var n=-1,r=null==e?0:e.length;++n<r&&!1!==t(e[n],n,e););}(h||e,function(r,s){h&&(r=e[s=r]),Sn(o,s,ls(r,t,n,s,e,i))}),o}os[rs]=os["[object Array]"]=os["[object ArrayBuffer]"]=os["[object DataView]"]=os["[object Boolean]"]=os["[object Date]"]=os["[object Float32Array]"]=os["[object Float64Array]"]=os["[object Int8Array]"]=os["[object Int16Array]"]=os["[object Int32Array]"]=os["[object Map]"]=os["[object Number]"]=os[is]=os["[object RegExp]"]=os["[object Set]"]=os["[object String]"]=os["[object Symbol]"]=os["[object Uint8Array]"]=os["[object Uint8ClampedArray]"]=os["[object Uint16Array]"]=os["[object Uint32Array]"]=!0,os["[object Error]"]=os[ss]=os["[object WeakMap]"]=!1;function as(e){return ls(e,5)}function cs(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new fr;++t<n;)this.add(e[t])}function us(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}cs.prototype.add=cs.prototype.push=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},cs.prototype.has=function(e){return this.__data__.has(e)};function ds(e,t,n,r,s,i){var o=1&n,l=e.length,a=t.length;if(l!=a&&!(o&&a>l))return!1;var c=i.get(e),u=i.get(t);if(c&&u)return c==t&&u==e;var d=-1,h=!0,f=2&n?new cs:void 0;for(i.set(e,t),i.set(t,e);++d<l;){var p=e[d],m=t[d];if(r)var g=o?r(m,p,d,t,e,i):r(p,m,d,e,t,i);if(void 0!==g){if(g)continue;h=!1;break}if(f){if(!us(t,function(e,t){if(o=t,!f.has(o)&&(p===e||s(p,e,n,r,i)))return f.push(t);var o})){h=!1;break}}else if(p!==m&&!s(p,m,n,r,i)){h=!1;break}}return i.delete(e),i.delete(t),h}function hs(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n}function fs(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}var ps=Bt?Bt.prototype:void 0,ms=ps?ps.valueOf:void 0;var gs=Object.prototype.hasOwnProperty;var vs="[object Arguments]",bs="[object Array]",ys="[object Object]",xs=Object.prototype.hasOwnProperty;function ws(e,t,n,r,s,i){var o=Kt(e),l=Kt(t),a=o?bs:$r(e),c=l?bs:$r(t),u=(a=a==vs?ys:a)==ys,d=(c=c==vs?ys:c)==ys,h=a==c;if(h&&Fn(e)){if(!Fn(t))return!1;o=!0,u=!1}if(h&&!u)return i||(i=new xr),o||Gn(e)?ds(e,t,n,r,s,i):function(e,t,n,r,s,i,o){switch(n){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=t.byteLength||!i(new Hr(e),new Hr(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return En(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var l=hs;case"[object Set]":var a=1&r;if(l||(l=fs),e.size!=t.size&&!a)return!1;var c=o.get(e);if(c)return c==t;r|=2,o.set(e,t);var u=ds(l(e),l(t),r,s,i,o);return o.delete(e),u;case"[object Symbol]":if(ms)return ms.call(e)==ms.call(t)}return!1}(e,t,a,n,r,s,i);if(!(1&n)){var f=u&&xs.call(e,"__wrapped__"),p=d&&xs.call(t,"__wrapped__");if(f||p){var m=f?e.value():e,g=p?t.value():t;return i||(i=new xr),s(m,g,n,r,i)}}return!!h&&(i||(i=new xr),function(e,t,n,r,s,i){var o=1&n,l=_r(e),a=l.length;if(a!=_r(t).length&&!o)return!1;for(var c=a;c--;){var u=l[c];if(!(o?u in t:gs.call(t,u)))return!1}var d=i.get(e),h=i.get(t);if(d&&h)return d==t&&h==e;var f=!0;i.set(e,t),i.set(t,e);for(var p=o;++c<a;){var m=e[u=l[c]],g=t[u];if(r)var v=o?r(g,m,u,t,e,i):r(m,g,u,e,t,i);if(!(void 0===v?m===g||s(m,g,n,r,i):v)){f=!1;break}p||(p="constructor"==u)}if(f&&!p){var b=e.constructor,y=t.constructor;b==y||!("constructor"in e)||!("constructor"in t)||"function"==typeof b&&b instanceof b&&"function"==typeof y&&y instanceof y||(f=!1)}return i.delete(e),i.delete(t),f}(e,t,n,r,s,i))}function Ns(e,t,n,r,s){return e===t||(null==e||null==t||!Ht(e)&&!Ht(t)?e!=e&&t!=t:ws(e,t,n,r,Ns,s))}var Es=function(e,t,n){for(var r=-1,s=Object(e),i=n(e),o=i.length;o--;){var l=i[++r];if(!1===t(s[l],l,s))break}return e};function ks(e,t,n){(void 0!==n&&!En(e[t],n)||void 0===n&&!(t in e))&&Nn(e,t,n)}function Ss(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}function As(e){return function(e,t,n){var r=!n;n||(n={});for(var s=-1,i=t.length;++s<i;){var o=t[s],l=void 0;void 0===l&&(l=e[o]),r?Nn(n,o,l):Sn(n,o,l)}return n}(e,rr(e))}function Cs(e,t,n,r,s,i,o){var l=Ss(e,n),a=Ss(t,n),c=o.get(a);if(c)ks(e,n,c);else{var u,d=i?i(l,a,n+"",e,t,o):void 0,h=void 0===d;if(h){var f=Kt(a),p=!f&&Fn(a),m=!f&&!p&&Gn(a);d=a,f||p||m?Kt(l)?d=l:Ht(u=l)&&_n(u)?d=function(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t}(l):p?(h=!1,d=Sr(a,!0)):m?(h=!1,d=Yr(a,!0)):d=[]:function(e){if(!Ht(e)||"[object Object]"!=Vt(e))return!1;var t=pr(e);if(null===t)return!0;var n=br.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&vr.call(n)==yr}(a)||Mn(a)?(d=l,Mn(l)?d=As(l):Wt(l)&&!Zt(l)||(d=Xr(a))):h=!1}h&&(o.set(a,d),s(d,a,r,i,o),o.delete(a)),ks(e,n,d)}}function js(e,t,n,r,s){e!==t&&Es(t,function(i,o){if(s||(s=new xr),Wt(i))Cs(e,t,o,n,js,r,s);else{var l=r?r(Ss(e,o),i,o+"",e,t,s):void 0;void 0===l&&(l=i),ks(e,o,l)}},rr)}function _s(e,t){return Ns(e,t)}var Os,Ts=(Os=function(e,t,n){js(e,t,n)},Cn(function(e,t){var n=-1,r=t.length,s=r>1?t[r-1]:void 0,i=r>2?t[2]:void 0;for(s=Os.length>3&&"function"==typeof s?(r--,s):void 0,i&&function(e,t,n){if(!Wt(n))return!1;var r=typeof t;return!!("number"==r?_n(n)&&wn(t,n.length):"string"==r&&t in n)&&En(n[t],e)}(t[0],t[1],i)&&(s=r<3?void 0:s,r=1),e=Object(e);++n<r;){var o=t[n];o&&Os(e,o,n,s)}return e})),Ls=(e=>(e[e.TYPE=3]="TYPE",e[e.LEVEL=12]="LEVEL",e[e.ATTRIBUTE=13]="ATTRIBUTE",e[e.BLOT=14]="BLOT",e[e.INLINE=7]="INLINE",e[e.BLOCK=11]="BLOCK",e[e.BLOCK_BLOT=10]="BLOCK_BLOT",e[e.INLINE_BLOT=6]="INLINE_BLOT",e[e.BLOCK_ATTRIBUTE=9]="BLOCK_ATTRIBUTE",e[e.INLINE_ATTRIBUTE=5]="INLINE_ATTRIBUTE",e[e.ANY=15]="ANY",e))(Ls||{});class qs{constructor(e,t,n={}){this.attrName=e,this.keyName=t;const r=Ls.TYPE&Ls.ATTRIBUTE;this.scope=null!=n.scope?n.scope&Ls.LEVEL|r:Ls.ATTRIBUTE,null!=n.whitelist&&(this.whitelist=n.whitelist)}static keys(e){return Array.from(e.attributes).map(e=>e.name)}add(e,t){return!!this.canAdd(e,t)&&(e.setAttribute(this.keyName,t),!0)}canAdd(e,t){return null==this.whitelist||("string"==typeof t?this.whitelist.indexOf(t.replace(/["']/g,""))>-1:this.whitelist.indexOf(t)>-1)}remove(e){e.removeAttribute(this.keyName)}value(e){const t=e.getAttribute(this.keyName);return this.canAdd(e,t)&&t?t:""}}class Is extends Error{constructor(e){super(e="[Parchment] "+e),this.message=e,this.name=this.constructor.name}}const Rs=class e{constructor(){this.attributes={},this.classes={},this.tags={},this.types={}}static find(e,t=!1){if(null==e)return null;if(this.blots.has(e))return this.blots.get(e)||null;if(t){let n=null;try{n=e.parentNode}catch{return null}return this.find(n,t)}return null}create(t,n,r){const s=this.query(n);if(null==s)throw new Is(`Unable to create ${n} blot`);const i=s,o=n instanceof Node||n.nodeType===Node.TEXT_NODE?n:i.create(r),l=new i(t,o,r);return e.blots.set(l.domNode,l),l}find(t,n=!1){return e.find(t,n)}query(e,t=Ls.ANY){let n;return"string"==typeof e?n=this.types[e]||this.attributes[e]:e instanceof Text||e.nodeType===Node.TEXT_NODE?n=this.types.text:"number"==typeof e?e&Ls.LEVEL&Ls.BLOCK?n=this.types.block:e&Ls.LEVEL&Ls.INLINE&&(n=this.types.inline):e instanceof Element&&((e.getAttribute("class")||"").split(/\s+/).some(e=>(n=this.classes[e],!!n)),n=n||this.tags[e.tagName]),null==n?null:"scope"in n&&t&Ls.LEVEL&n.scope&&t&Ls.TYPE&n.scope?n:null}register(...e){return e.map(e=>{const t="blotName"in e,n="attrName"in e;if(!t&&!n)throw new Is("Invalid definition");if(t&&"abstract"===e.blotName)throw new Is("Cannot register abstract class");const r=t?e.blotName:n?e.attrName:void 0;return this.types[r]=e,n?"string"==typeof e.keyName&&(this.attributes[e.keyName]=e):t&&(e.className&&(this.classes[e.className]=e),e.tagName&&(Array.isArray(e.tagName)?e.tagName=e.tagName.map(e=>e.toUpperCase()):e.tagName=e.tagName.toUpperCase(),(Array.isArray(e.tagName)?e.tagName:[e.tagName]).forEach(t=>{(null==this.tags[t]||null==e.className)&&(this.tags[t]=e)}))),e})}};Rs.blots=new WeakMap;let Ms=Rs;function Bs(e,t){return(e.getAttribute("class")||"").split(/\s+/).filter(e=>0===e.indexOf(`${t}-`))}const Ds=class extends qs{static keys(e){return(e.getAttribute("class")||"").split(/\s+/).map(e=>e.split("-").slice(0,-1).join("-"))}add(e,t){return!!this.canAdd(e,t)&&(this.remove(e),e.classList.add(`${this.keyName}-${t}`),!0)}remove(e){Bs(e,this.keyName).forEach(t=>{e.classList.remove(t)}),0===e.classList.length&&e.removeAttribute("class")}value(e){const t=(Bs(e,this.keyName)[0]||"").slice(this.keyName.length+1);return this.canAdd(e,t)?t:""}};function Ps(e){const t=e.split("-"),n=t.slice(1).map(e=>e[0].toUpperCase()+e.slice(1)).join("");return t[0]+n}const Fs=class extends qs{static keys(e){return(e.getAttribute("style")||"").split(";").map(e=>e.split(":")[0].trim())}add(e,t){return!!this.canAdd(e,t)&&(e.style[Ps(this.keyName)]=t,!0)}remove(e){e.style[Ps(this.keyName)]="",e.getAttribute("style")||e.removeAttribute("style")}value(e){const t=e.style[Ps(this.keyName)];return this.canAdd(e,t)?t:""}};const Us=class{constructor(e){this.attributes={},this.domNode=e,this.build()}attribute(e,t){t?e.add(this.domNode,t)&&(null!=e.value(this.domNode)?this.attributes[e.attrName]=e:delete this.attributes[e.attrName]):(e.remove(this.domNode),delete this.attributes[e.attrName])}build(){this.attributes={};const e=Ms.find(this.domNode);if(null==e)return;const t=qs.keys(this.domNode),n=Ds.keys(this.domNode),r=Fs.keys(this.domNode);t.concat(n).concat(r).forEach(t=>{const n=e.scroll.query(t,Ls.ATTRIBUTE);n instanceof qs&&(this.attributes[n.attrName]=n)})}copy(e){Object.keys(this.attributes).forEach(t=>{const n=this.attributes[t].value(this.domNode);e.format(t,n)})}move(e){this.copy(e),Object.keys(this.attributes).forEach(e=>{this.attributes[e].remove(this.domNode)}),this.attributes={}}values(){return Object.keys(this.attributes).reduce((e,t)=>(e[t]=this.attributes[t].value(this.domNode),e),{})}},zs=class{constructor(e,t){this.scroll=e,this.domNode=t,Ms.blots.set(t,this),this.prev=null,this.next=null}static create(e){if(null==this.tagName)throw new Is("Blot definition missing tagName");let t,n;return Array.isArray(this.tagName)?("string"==typeof e?(n=e.toUpperCase(),parseInt(n,10).toString()===n&&(n=parseInt(n,10))):"number"==typeof e&&(n=e),t="number"==typeof n?document.createElement(this.tagName[n-1]):n&&this.tagName.indexOf(n)>-1?document.createElement(n):document.createElement(this.tagName[0])):t=document.createElement(this.tagName),this.className&&t.classList.add(this.className),t}get statics(){return this.constructor}attach(){}clone(){const e=this.domNode.cloneNode(!1);return this.scroll.create(e)}detach(){null!=this.parent&&this.parent.removeChild(this),Ms.blots.delete(this.domNode)}deleteAt(e,t){this.isolate(e,t).remove()}formatAt(e,t,n,r){const s=this.isolate(e,t);if(null!=this.scroll.query(n,Ls.BLOT)&&r)s.wrap(n,r);else if(null!=this.scroll.query(n,Ls.ATTRIBUTE)){const e=this.scroll.create(this.statics.scope);s.wrap(e),e.format(n,r)}}insertAt(e,t,n){const r=null==n?this.scroll.create("text",t):this.scroll.create(t,n),s=this.split(e);this.parent.insertBefore(r,s||void 0)}isolate(e,t){const n=this.split(e);if(null==n)throw new Error("Attempt to isolate at end");return n.split(t),n}length(){return 1}offset(e=this.parent){return null==this.parent||this===e?0:this.parent.children.offset(this)+this.parent.offset(e)}optimize(e){this.statics.requiredContainer&&!(this.parent instanceof this.statics.requiredContainer)&&this.wrap(this.statics.requiredContainer.blotName)}remove(){null!=this.domNode.parentNode&&this.domNode.parentNode.removeChild(this.domNode),this.detach()}replaceWith(e,t){const n="string"==typeof e?this.scroll.create(e,t):e;return null!=this.parent&&(this.parent.insertBefore(n,this.next||void 0),this.remove()),n}split(e,t){return 0===e?this:this.next}update(e,t){}wrap(e,t){const n="string"==typeof e?this.scroll.create(e,t):e;if(null!=this.parent&&this.parent.insertBefore(n,this.next||void 0),"function"!=typeof n.appendChild)throw new Is(`Cannot wrap ${e}`);return n.appendChild(this),n}};zs.blotName="abstract";let $s=zs;const Vs=class extends $s{static value(e){return!0}index(e,t){return this.domNode===e||this.domNode.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_CONTAINED_BY?Math.min(t,1):-1}position(e,t){let n=Array.from(this.parent.domNode.childNodes).indexOf(this.domNode);return e>0&&(n+=1),[this.parent.domNode,n]}value(){return{[this.statics.blotName]:this.statics.value(this.domNode)||!0}}};Vs.scope=Ls.INLINE_BLOT;const Hs=Vs;class Ks{constructor(){this.head=null,this.tail=null,this.length=0}append(...e){if(this.insertBefore(e[0],null),e.length>1){const t=e.slice(1);this.append(...t)}}at(e){const t=this.iterator();let n=t();for(;n&&e>0;)e-=1,n=t();return n}contains(e){const t=this.iterator();let n=t();for(;n;){if(n===e)return!0;n=t()}return!1}indexOf(e){const t=this.iterator();let n=t(),r=0;for(;n;){if(n===e)return r;r+=1,n=t()}return-1}insertBefore(e,t){null!=e&&(this.remove(e),e.next=t,null!=t?(e.prev=t.prev,null!=t.prev&&(t.prev.next=e),t.prev=e,t===this.head&&(this.head=e)):null!=this.tail?(this.tail.next=e,e.prev=this.tail,this.tail=e):(e.prev=null,this.head=this.tail=e),this.length+=1)}offset(e){let t=0,n=this.head;for(;null!=n;){if(n===e)return t;t+=n.length(),n=n.next}return-1}remove(e){this.contains(e)&&(null!=e.prev&&(e.prev.next=e.next),null!=e.next&&(e.next.prev=e.prev),e===this.head&&(this.head=e.next),e===this.tail&&(this.tail=e.prev),this.length-=1)}iterator(e=this.head){return()=>{const t=e;return null!=e&&(e=e.next),t}}find(e,t=!1){const n=this.iterator();let r=n();for(;r;){const s=r.length();if(e<s||t&&e===s&&(null==r.next||0!==r.next.length()))return[r,e];e-=s,r=n()}return[null,0]}forEach(e){const t=this.iterator();let n=t();for(;n;)e(n),n=t()}forEachAt(e,t,n){if(t<=0)return;const[r,s]=this.find(e);let i=e-s;const o=this.iterator(r);let l=o();for(;l&&i<e+t;){const r=l.length();e>i?n(l,e-i,Math.min(t,i+r-e)):n(l,0,Math.min(r,e+t-i)),i+=r,l=o()}}map(e){return this.reduce((t,n)=>(t.push(e(n)),t),[])}reduce(e,t){const n=this.iterator();let r=n();for(;r;)t=e(t,r),r=n();return t}}function Ws(e,t){const n=t.find(e);if(n)return n;try{return t.create(e)}catch{const n=t.create(Ls.INLINE);return Array.from(e.childNodes).forEach(e=>{n.domNode.appendChild(e)}),e.parentNode&&e.parentNode.replaceChild(n.domNode,e),n.attach(),n}}const Gs=class e extends $s{constructor(e,t){super(e,t),this.uiNode=null,this.build()}appendChild(e){this.insertBefore(e)}attach(){super.attach(),this.children.forEach(e=>{e.attach()})}attachUI(t){null!=this.uiNode&&this.uiNode.remove(),this.uiNode=t,e.uiClass&&this.uiNode.classList.add(e.uiClass),this.uiNode.setAttribute("contenteditable","false"),this.domNode.insertBefore(this.uiNode,this.domNode.firstChild)}build(){this.children=new Ks,Array.from(this.domNode.childNodes).filter(e=>e!==this.uiNode).reverse().forEach(e=>{try{const t=Ws(e,this.scroll);this.insertBefore(t,this.children.head||void 0)}catch(t){if(t instanceof Is)return;throw t}})}deleteAt(e,t){if(0===e&&t===this.length())return this.remove();this.children.forEachAt(e,t,(e,t,n)=>{e.deleteAt(t,n)})}descendant(t,n=0){const[r,s]=this.children.find(n);return null==t.blotName&&t(r)||null!=t.blotName&&r instanceof t?[r,s]:r instanceof e?r.descendant(t,s):[null,-1]}descendants(t,n=0,r=Number.MAX_VALUE){let s=[],i=r;return this.children.forEachAt(n,r,(n,r,o)=>{(null==t.blotName&&t(n)||null!=t.blotName&&n instanceof t)&&s.push(n),n instanceof e&&(s=s.concat(n.descendants(t,r,i))),i-=o}),s}detach(){this.children.forEach(e=>{e.detach()}),super.detach()}enforceAllowedChildren(){let t=!1;this.children.forEach(n=>{t||this.statics.allowedChildren.some(e=>n instanceof e)||(n.statics.scope===Ls.BLOCK_BLOT?(null!=n.next&&this.splitAfter(n),null!=n.prev&&this.splitAfter(n.prev),n.parent.unwrap(),t=!0):n instanceof e?n.unwrap():n.remove())})}formatAt(e,t,n,r){this.children.forEachAt(e,t,(e,t,s)=>{e.formatAt(t,s,n,r)})}insertAt(e,t,n){const[r,s]=this.children.find(e);if(r)r.insertAt(s,t,n);else{const e=null==n?this.scroll.create("text",t):this.scroll.create(t,n);this.appendChild(e)}}insertBefore(e,t){null!=e.parent&&e.parent.children.remove(e);let n=null;this.children.insertBefore(e,t||null),e.parent=this,null!=t&&(n=t.domNode),(this.domNode.parentNode!==e.domNode||this.domNode.nextSibling!==n)&&this.domNode.insertBefore(e.domNode,n),e.attach()}length(){return this.children.reduce((e,t)=>e+t.length(),0)}moveChildren(e,t){this.children.forEach(n=>{e.insertBefore(n,t)})}optimize(e){if(super.optimize(e),this.enforceAllowedChildren(),null!=this.uiNode&&this.uiNode!==this.domNode.firstChild&&this.domNode.insertBefore(this.uiNode,this.domNode.firstChild),0===this.children.length)if(null!=this.statics.defaultChild){const e=this.scroll.create(this.statics.defaultChild.blotName);this.appendChild(e)}else this.remove()}path(t,n=!1){const[r,s]=this.children.find(t,n),i=[[this,t]];return r instanceof e?i.concat(r.path(s,n)):(null!=r&&i.push([r,s]),i)}removeChild(e){this.children.remove(e)}replaceWith(t,n){const r="string"==typeof t?this.scroll.create(t,n):t;return r instanceof e&&this.moveChildren(r),super.replaceWith(r)}split(e,t=!1){if(!t){if(0===e)return this;if(e===this.length())return this.next}const n=this.clone();return this.parent&&this.parent.insertBefore(n,this.next||void 0),this.children.forEachAt(e,this.length(),(e,r,s)=>{const i=e.split(r,t);null!=i&&n.appendChild(i)}),n}splitAfter(e){const t=this.clone();for(;null!=e.next;)t.appendChild(e.next);return this.parent&&this.parent.insertBefore(t,this.next||void 0),t}unwrap(){this.parent&&this.moveChildren(this.parent,this.next||void 0),this.remove()}update(e,t){const n=[],r=[];e.forEach(e=>{e.target===this.domNode&&"childList"===e.type&&(n.push(...e.addedNodes),r.push(...e.removedNodes))}),r.forEach(e=>{if(null!=e.parentNode&&"IFRAME"!==e.tagName&&document.body.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_CONTAINED_BY)return;const t=this.scroll.find(e);null!=t&&(null==t.domNode.parentNode||t.domNode.parentNode===this.domNode)&&t.detach()}),n.filter(e=>e.parentNode===this.domNode&&e!==this.uiNode).sort((e,t)=>e===t?0:e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?1:-1).forEach(e=>{let t=null;null!=e.nextSibling&&(t=this.scroll.find(e.nextSibling));const n=Ws(e,this.scroll);(n.next!==t||null==n.next)&&(null!=n.parent&&n.parent.removeChild(this),this.insertBefore(n,t||void 0))}),this.enforceAllowedChildren()}};Gs.uiClass="";const Zs=Gs;const Ys=class e extends Zs{static create(e){return super.create(e)}static formats(t,n){const r=n.query(e.blotName);if(null==r||t.tagName!==r.tagName){if("string"==typeof this.tagName)return!0;if(Array.isArray(this.tagName))return t.tagName.toLowerCase()}}constructor(e,t){super(e,t),this.attributes=new Us(this.domNode)}format(t,n){if(t!==this.statics.blotName||n){const e=this.scroll.query(t,Ls.INLINE);if(null==e)return;e instanceof qs?this.attributes.attribute(e,n):n&&(t!==this.statics.blotName||this.formats()[t]!==n)&&this.replaceWith(t,n)}else this.children.forEach(t=>{t instanceof e||(t=t.wrap(e.blotName,!0)),this.attributes.copy(t)}),this.unwrap()}formats(){const e=this.attributes.values(),t=this.statics.formats(this.domNode,this.scroll);return null!=t&&(e[this.statics.blotName]=t),e}formatAt(e,t,n,r){null!=this.formats()[n]||this.scroll.query(n,Ls.ATTRIBUTE)?this.isolate(e,t).format(n,r):super.formatAt(e,t,n,r)}optimize(t){super.optimize(t);const n=this.formats();if(0===Object.keys(n).length)return this.unwrap();const r=this.next;r instanceof e&&r.prev===this&&function(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}(n,r.formats())&&(r.moveChildren(this),r.remove())}replaceWith(e,t){const n=super.replaceWith(e,t);return this.attributes.copy(n),n}update(e,t){super.update(e,t),e.some(e=>e.target===this.domNode&&"attributes"===e.type)&&this.attributes.build()}wrap(t,n){const r=super.wrap(t,n);return r instanceof e&&this.attributes.move(r),r}};Ys.allowedChildren=[Ys,Hs],Ys.blotName="inline",Ys.scope=Ls.INLINE_BLOT,Ys.tagName="SPAN";const Js=Ys,Xs=class e extends Zs{static create(e){return super.create(e)}static formats(t,n){const r=n.query(e.blotName);if(null==r||t.tagName!==r.tagName){if("string"==typeof this.tagName)return!0;if(Array.isArray(this.tagName))return t.tagName.toLowerCase()}}constructor(e,t){super(e,t),this.attributes=new Us(this.domNode)}format(t,n){const r=this.scroll.query(t,Ls.BLOCK);null!=r&&(r instanceof qs?this.attributes.attribute(r,n):t!==this.statics.blotName||n?n&&(t!==this.statics.blotName||this.formats()[t]!==n)&&this.replaceWith(t,n):this.replaceWith(e.blotName))}formats(){const e=this.attributes.values(),t=this.statics.formats(this.domNode,this.scroll);return null!=t&&(e[this.statics.blotName]=t),e}formatAt(e,t,n,r){null!=this.scroll.query(n,Ls.BLOCK)?this.format(n,r):super.formatAt(e,t,n,r)}insertAt(e,t,n){if(null==n||null!=this.scroll.query(t,Ls.INLINE))super.insertAt(e,t,n);else{const r=this.split(e);if(null==r)throw new Error("Attempt to insertAt after block boundaries");{const e=this.scroll.create(t,n);r.parent.insertBefore(e,r)}}}replaceWith(e,t){const n=super.replaceWith(e,t);return this.attributes.copy(n),n}update(e,t){super.update(e,t),e.some(e=>e.target===this.domNode&&"attributes"===e.type)&&this.attributes.build()}};Xs.blotName="block",Xs.scope=Ls.BLOCK_BLOT,Xs.tagName="P",Xs.allowedChildren=[Js,Xs,Hs];const Qs=Xs,ei=class extends Zs{checkMerge(){return null!==this.next&&this.next.statics.blotName===this.statics.blotName}deleteAt(e,t){super.deleteAt(e,t),this.enforceAllowedChildren()}formatAt(e,t,n,r){super.formatAt(e,t,n,r),this.enforceAllowedChildren()}insertAt(e,t,n){super.insertAt(e,t,n),this.enforceAllowedChildren()}optimize(e){super.optimize(e),this.children.length>0&&null!=this.next&&this.checkMerge()&&(this.next.moveChildren(this),this.next.remove())}};ei.blotName="container",ei.scope=Ls.BLOCK_BLOT;const ti=ei;const ni=class extends Hs{static formats(e,t){}format(e,t){super.formatAt(0,this.length(),e,t)}formatAt(e,t,n,r){0===e&&t===this.length()?this.format(n,r):super.formatAt(e,t,n,r)}formats(){return this.statics.formats(this.domNode,this.scroll)}},ri={attributes:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0},si=class extends Zs{constructor(e,t){super(null,t),this.registry=e,this.scroll=this,this.build(),this.observer=new MutationObserver(e=>{this.update(e)}),this.observer.observe(this.domNode,ri),this.attach()}create(e,t){return this.registry.create(this,e,t)}find(e,t=!1){const n=this.registry.find(e,t);return n?n.scroll===this?n:t?this.find(n.scroll.domNode.parentNode,!0):null:null}query(e,t=Ls.ANY){return this.registry.query(e,t)}register(...e){return this.registry.register(...e)}build(){null!=this.scroll&&super.build()}detach(){super.detach(),this.observer.disconnect()}deleteAt(e,t){this.update(),0===e&&t===this.length()?this.children.forEach(e=>{e.remove()}):super.deleteAt(e,t)}formatAt(e,t,n,r){this.update(),super.formatAt(e,t,n,r)}insertAt(e,t,n){this.update(),super.insertAt(e,t,n)}optimize(e=[],t={}){super.optimize(t);const n=t.mutationsMap||new WeakMap;let r=Array.from(this.observer.takeRecords());for(;r.length>0;)e.push(r.pop());const s=(e,t=!0)=>{null==e||e===this||null!=e.domNode.parentNode&&(n.has(e.domNode)||n.set(e.domNode,[]),t&&s(e.parent))},i=e=>{n.has(e.domNode)&&(e instanceof Zs&&e.children.forEach(i),n.delete(e.domNode),e.optimize(t))};let o=e;for(let l=0;o.length>0;l+=1){if(l>=100)throw new Error("[Parchment] Maximum optimize iterations reached");for(o.forEach(e=>{const t=this.find(e.target,!0);null!=t&&(t.domNode===e.target&&("childList"===e.type?(s(this.find(e.previousSibling,!1)),Array.from(e.addedNodes).forEach(e=>{const t=this.find(e,!1);s(t,!1),t instanceof Zs&&t.children.forEach(e=>{s(e,!1)})})):"attributes"===e.type&&s(t.prev)),s(t))}),this.children.forEach(i),o=Array.from(this.observer.takeRecords()),r=o.slice();r.length>0;)e.push(r.pop())}}update(e,t={}){e=e||this.observer.takeRecords();const n=new WeakMap;e.map(e=>{const t=this.find(e.target,!0);return null==t?null:n.has(t.domNode)?(n.get(t.domNode).push(e),null):(n.set(t.domNode,[e]),t)}).forEach(e=>{null!=e&&e!==this&&n.has(e.domNode)&&e.update(n.get(e.domNode)||[],t)}),t.mutationsMap=n,n.has(this.domNode)&&super.update(n.get(this.domNode),t),this.optimize(e,t)}};si.blotName="scroll",si.defaultChild=Qs,si.allowedChildren=[Qs,ti],si.scope=Ls.BLOCK_BLOT,si.tagName="DIV";const ii=si,oi=class e extends Hs{static create(e){return document.createTextNode(e)}static value(e){return e.data}constructor(e,t){super(e,t),this.text=this.statics.value(this.domNode)}deleteAt(e,t){this.domNode.data=this.text=this.text.slice(0,e)+this.text.slice(e+t)}index(e,t){return this.domNode===e?t:-1}insertAt(e,t,n){null==n?(this.text=this.text.slice(0,e)+t+this.text.slice(e),this.domNode.data=this.text):super.insertAt(e,t,n)}length(){return this.text.length}optimize(t){super.optimize(t),this.text=this.statics.value(this.domNode),0===this.text.length?this.remove():this.next instanceof e&&this.next.prev===this&&(this.insertAt(this.length(),this.next.value()),this.next.remove())}position(e,t=!1){return[this.domNode,e]}split(e,t=!1){if(!t){if(0===e)return this;if(e===this.length())return this.next}const n=this.scroll.create(this.domNode.splitText(e));return this.parent.insertBefore(n,this.next||void 0),this.text=this.statics.value(this.domNode),n}update(e,t){e.some(e=>"characterData"===e.type&&e.target===this.domNode)&&(this.text=this.statics.value(this.domNode))}value(){return this.text}};oi.blotName="text",oi.scope=Ls.INLINE_BLOT;const li=oi,ai=Object.freeze(Object.defineProperty({__proto__:null,Attributor:qs,AttributorStore:Us,BlockBlot:Qs,ClassAttributor:Ds,ContainerBlot:ti,EmbedBlot:ni,InlineBlot:Js,LeafBlot:Hs,ParentBlot:Zs,Registry:Ms,Scope:Ls,ScrollBlot:ii,StyleAttributor:Fs,TextBlot:li},Symbol.toStringTag,{value:"Module"}));var ci,ui,di={exports:{}};function hi(){if(ui)return ci;ui=1;var e=-1;function t(h,f,p,m,v){if(h===f)return h?[[0,h]]:[];if(null!=p){var b=function(e,t,n){var r="number"==typeof n?{index:n,length:0}:n.oldRange,s="number"==typeof n?null:n.newRange,i=e.length,o=t.length;if(0===r.length&&(null===s||0===s.length)){var l=r.index,a=e.slice(0,l),c=e.slice(l),u=s?s.index:null,d=l+o-i;if((null===u||u===d)&&!(d<0||d>o)){var h=t.slice(0,d);if((m=t.slice(d))===c){var f=Math.min(l,d);if((b=a.slice(0,f))===(x=h.slice(0,f)))return g(b,a.slice(f),h.slice(f),c)}}if(null===u||u===l){var p=l,m=(h=t.slice(0,p),t.slice(p));if(h===a){var v=Math.min(i-p,o-p);if((y=c.slice(c.length-v))===(w=m.slice(m.length-v)))return g(a,c.slice(0,c.length-v),m.slice(0,m.length-v),y)}}}if(r.length>0&&s&&0===s.length){var b=e.slice(0,r.index),y=e.slice(r.index+r.length);if(!(o<(f=b.length)+(v=y.length))){var x=t.slice(0,f),w=t.slice(o-v);if(b===x&&y===w)return g(b,e.slice(f,i-v),t.slice(f,o-v),y)}}return null}(h,f,p);if(b)return b}var y=r(h,f),x=h.substring(0,y);y=i(h=h.substring(y),f=f.substring(y));var w=h.substring(h.length-y),N=function(s,o){var l;if(!s)return[[1,o]];if(!o)return[[e,s]];var a=s.length>o.length?s:o,c=s.length>o.length?o:s,u=a.indexOf(c);if(-1!==u)return l=[[1,a.substring(0,u)],[0,c],[1,a.substring(u+c.length)]],s.length>o.length&&(l[0][0]=l[2][0]=e),l;if(1===c.length)return[[e,s],[1,o]];var d=function(e,t){var n=e.length>t.length?e:t,s=e.length>t.length?t:e;if(n.length<4||2*s.length<n.length)return null;function o(e,t,n){for(var s,o,l,a,c=e.substring(n,n+Math.floor(e.length/4)),u=-1,d="";-1!==(u=t.indexOf(c,u+1));){var h=r(e.substring(n),t.substring(u)),f=i(e.substring(0,n),t.substring(0,u));d.length<f+h&&(d=t.substring(u-f,u)+t.substring(u,u+h),s=e.substring(0,n-f),o=e.substring(n+h),l=t.substring(0,u-f),a=t.substring(u+h))}return 2*d.length>=e.length?[s,o,l,a,d]:null}var l,a,c,u,d,h=o(n,s,Math.ceil(n.length/4)),f=o(n,s,Math.ceil(n.length/2));if(!h&&!f)return null;l=f?h&&h[4].length>f[4].length?h:f:h;e.length>t.length?(a=l[0],c=l[1],u=l[2],d=l[3]):(u=l[0],d=l[1],a=l[2],c=l[3]);var p=l[4];return[a,c,u,d,p]}(s,o);if(d){var h=d[0],f=d[1],p=d[2],m=d[3],g=d[4],v=t(h,p),b=t(f,m);return v.concat([[0,g]],b)}return function(t,r){for(var s=t.length,i=r.length,o=Math.ceil((s+i)/2),l=o,a=2*o,c=new Array(a),u=new Array(a),d=0;d<a;d++)c[d]=-1,u[d]=-1;c[l+1]=0,u[l+1]=0;for(var h=s-i,f=h%2!=0,p=0,m=0,g=0,v=0,b=0;b<o;b++){for(var y=-b+p;y<=b-m;y+=2){for(var x=l+y,w=(A=y===-b||y!==b&&c[x-1]<c[x+1]?c[x+1]:c[x-1]+1)-y;A<s&&w<i&&t.charAt(A)===r.charAt(w);)A++,w++;if(c[x]=A,A>s)m+=2;else if(w>i)p+=2;else if(f){if((k=l+h-y)>=0&&k<a&&-1!==u[k])if(A>=(E=s-u[k]))return n(t,r,A,w)}}for(var N=-b+g;N<=b-v;N+=2){for(var E,k=l+N,S=(E=N===-b||N!==b&&u[k-1]<u[k+1]?u[k+1]:u[k-1]+1)-N;E<s&&S<i&&t.charAt(s-E-1)===r.charAt(i-S-1);)E++,S++;if(u[k]=E,E>s)v+=2;else if(S>i)g+=2;else if(!f){if((x=l+h-N)>=0&&x<a&&-1!==c[x]){var A;w=l+(A=c[x])-x;if(A>=(E=s-E))return n(t,r,A,w)}}}}return[[e,t],[1,r]]}(s,o)}(h=h.substring(0,h.length-y),f=f.substring(0,f.length-y));return x&&N.unshift([0,x]),w&&N.push([0,w]),d(N,v),m&&function(t){var n=!1,r=[],h=0,f=null,p=0,m=0,g=0,v=0,b=0;for(;p<t.length;)0==t[p][0]?(r[h++]=p,m=v,g=b,v=0,b=0,f=t[p][1]):(1==t[p][0]?v+=t[p][1].length:b+=t[p][1].length,f&&f.length<=Math.max(m,g)&&f.length<=Math.max(v,b)&&(t.splice(r[h-1],0,[e,f]),t[r[h-1]+1][0]=1,h--,p=--h>0?r[h-1]:-1,m=0,g=0,v=0,b=0,f=null,n=!0)),p++;n&&d(t);(function(e){function t(e,t){if(!e||!t)return 6;var n=e.charAt(e.length-1),r=t.charAt(0),s=n.match(o),i=r.match(o),d=s&&n.match(l),h=i&&r.match(l),f=d&&n.match(a),p=h&&r.match(a),m=f&&e.match(c),g=p&&t.match(u);return m||g?5:f||p?4:s&&!d&&h?3:d||h?2:s||i?1:0}var n=1;for(;n<e.length-1;){if(0==e[n-1][0]&&0==e[n+1][0]){var r=e[n-1][1],s=e[n][1],d=e[n+1][1],h=i(r,s);if(h){var f=s.substring(s.length-h);r=r.substring(0,r.length-h),s=f+s.substring(0,s.length-h),d=f+d}for(var p=r,m=s,g=d,v=t(r,s)+t(s,d);s.charAt(0)===d.charAt(0);){r+=s.charAt(0),s=s.substring(1)+d.charAt(0),d=d.substring(1);var b=t(r,s)+t(s,d);b>=v&&(v=b,p=r,m=s,g=d)}e[n-1][1]!=p&&(p?e[n-1][1]=p:(e.splice(n-1,1),n--),e[n][1]=m,g?e[n+1][1]=g:(e.splice(n+1,1),n--))}n++}})(t),p=1;for(;p<t.length;){if(t[p-1][0]==e&&1==t[p][0]){var y=t[p-1][1],x=t[p][1],w=s(y,x),N=s(x,y);w>=N?(w>=y.length/2||w>=x.length/2)&&(t.splice(p,0,[0,x.substring(0,w)]),t[p-1][1]=y.substring(0,y.length-w),t[p+1][1]=x.substring(w),p++):(N>=y.length/2||N>=x.length/2)&&(t.splice(p,0,[0,y.substring(0,N)]),t[p-1][0]=1,t[p-1][1]=x.substring(0,x.length-N),t[p+1][0]=e,t[p+1][1]=y.substring(N),p++),p++}p++}}(N),N}function n(e,n,r,s){var i=e.substring(0,r),o=n.substring(0,s),l=e.substring(r),a=n.substring(s),c=t(i,o),u=t(l,a);return c.concat(u)}function r(e,t){if(!e||!t||e.charAt(0)!==t.charAt(0))return 0;for(var n=0,r=Math.min(e.length,t.length),s=r,i=0;n<s;)e.substring(i,s)==t.substring(i,s)?i=n=s:r=s,s=Math.floor((r-n)/2+n);return h(e.charCodeAt(s-1))&&s--,s}function s(e,t){var n=e.length,r=t.length;if(0==n||0==r)return 0;n>r?e=e.substring(n-r):n<r&&(t=t.substring(0,n));var s=Math.min(n,r);if(e==t)return s;for(var i=0,o=1;;){var l=e.substring(s-o),a=t.indexOf(l);if(-1==a)return i;o+=a,0!=a&&e.substring(s-o)!=t.substring(0,o)||(i=o,o++)}}function i(e,t){if(!e||!t||e.slice(-1)!==t.slice(-1))return 0;for(var n=0,r=Math.min(e.length,t.length),s=r,i=0;n<s;)e.substring(e.length-s,e.length-i)==t.substring(t.length-s,t.length-i)?i=n=s:r=s,s=Math.floor((r-n)/2+n);return f(e.charCodeAt(e.length-s))&&s--,s}var o=/[^a-zA-Z0-9]/,l=/\s/,a=/[\r\n]/,c=/\n\r?\n$/,u=/^\r?\n\r?\n/;function d(t,n){t.push([0,""]);for(var s,o=0,l=0,a=0,c="",u="";o<t.length;)if(o<t.length-1&&!t[o][1])t.splice(o,1);else switch(t[o][0]){case 1:a++,u+=t[o][1],o++;break;case e:l++,c+=t[o][1],o++;break;case 0:var h=o-a-l-1;if(n){if(h>=0&&m(t[h][1])){var f=t[h][1].slice(-1);if(t[h][1]=t[h][1].slice(0,-1),c=f+c,u=f+u,!t[h][1]){t.splice(h,1),o--;var g=h-1;t[g]&&1===t[g][0]&&(a++,u=t[g][1]+u,g--),t[g]&&t[g][0]===e&&(l++,c=t[g][1]+c,g--),h=g}}if(p(t[o][1])){f=t[o][1].charAt(0);t[o][1]=t[o][1].slice(1),c+=f,u+=f}}if(o<t.length-1&&!t[o][1]){t.splice(o,1);break}if(c.length>0||u.length>0){c.length>0&&u.length>0&&(0!==(s=r(u,c))&&(h>=0?t[h][1]+=u.substring(0,s):(t.splice(0,0,[0,u.substring(0,s)]),o++),u=u.substring(s),c=c.substring(s)),0!==(s=i(u,c))&&(t[o][1]=u.substring(u.length-s)+t[o][1],u=u.substring(0,u.length-s),c=c.substring(0,c.length-s)));var v=a+l;0===c.length&&0===u.length?(t.splice(o-v,v),o-=v):0===c.length?(t.splice(o-v,v,[1,u]),o=o-v+1):0===u.length?(t.splice(o-v,v,[e,c]),o=o-v+1):(t.splice(o-v,v,[e,c],[1,u]),o=o-v+2)}0!==o&&0===t[o-1][0]?(t[o-1][1]+=t[o][1],t.splice(o,1)):o++,a=0,l=0,c="",u=""}""===t[t.length-1][1]&&t.pop();var b=!1;for(o=1;o<t.length-1;)0===t[o-1][0]&&0===t[o+1][0]&&(t[o][1].substring(t[o][1].length-t[o-1][1].length)===t[o-1][1]?(t[o][1]=t[o-1][1]+t[o][1].substring(0,t[o][1].length-t[o-1][1].length),t[o+1][1]=t[o-1][1]+t[o+1][1],t.splice(o-1,1),b=!0):t[o][1].substring(0,t[o+1][1].length)==t[o+1][1]&&(t[o-1][1]+=t[o+1][1],t[o][1]=t[o][1].substring(t[o+1][1].length)+t[o+1][1],t.splice(o+1,1),b=!0)),o++;b&&d(t,n)}function h(e){return e>=55296&&e<=56319}function f(e){return e>=56320&&e<=57343}function p(e){return f(e.charCodeAt(0))}function m(e){return h(e.charCodeAt(e.length-1))}function g(t,n,r,s){return m(t)||p(s)?null:function(e){for(var t=[],n=0;n<e.length;n++)e[n][1].length>0&&t.push(e[n]);return t}([[0,t],[e,n],[1,r],[0,s]])}function v(e,n,r,s){return t(e,n,r,s,!0)}return v.INSERT=1,v.DELETE=e,v.EQUAL=0,ci=v}var fi,pi={exports:{}};function mi(){return fi||(fi=1,function(e,t){var n="__lodash_hash_undefined__",r=9007199254740991,s="[object Arguments]",i="[object Boolean]",o="[object Date]",l="[object Function]",a="[object GeneratorFunction]",c="[object Map]",u="[object Number]",d="[object Object]",h="[object Promise]",f="[object RegExp]",p="[object Set]",m="[object String]",g="[object Symbol]",v="[object WeakMap]",b="[object ArrayBuffer]",y="[object DataView]",x="[object Float32Array]",w="[object Float64Array]",N="[object Int8Array]",E="[object Int16Array]",k="[object Int32Array]",S="[object Uint8Array]",A="[object Uint8ClampedArray]",C="[object Uint16Array]",j="[object Uint32Array]",_=/\w*$/,O=/^\[object .+?Constructor\]$/,T=/^(?:0|[1-9]\d*)$/,L={};L[s]=L["[object Array]"]=L[b]=L[y]=L[i]=L[o]=L[x]=L[w]=L[N]=L[E]=L[k]=L[c]=L[u]=L[d]=L[f]=L[p]=L[m]=L[g]=L[S]=L[A]=L[C]=L[j]=!0,L["[object Error]"]=L[l]=L[v]=!1;var q="object"==typeof W&&W&&W.Object===Object&&W,I="object"==typeof self&&self&&self.Object===Object&&self,R=q||I||Function("return this")(),M=t&&!t.nodeType&&t,B=M&&e&&!e.nodeType&&e,D=B&&B.exports===M;function P(e,t){return e.set(t[0],t[1]),e}function F(e,t){return e.add(t),e}function U(e,t,n,r){for(var s=-1,i=e?e.length:0;++s<i;)n=t(n,e[s],s,e);return n}function z(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(n){}return t}function $(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n}function V(e,t){return function(n){return e(t(n))}}function H(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}var K=Array.prototype,G=Function.prototype,Z=Object.prototype,Y=R["__core-js_shared__"],J=function(){var e=/[^.]+$/.exec(Y&&Y.keys&&Y.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),X=G.toString,Q=Z.hasOwnProperty,ee=Z.toString,te=RegExp("^"+X.call(Q).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ne=D?R.Buffer:void 0,re=R.Symbol,se=R.Uint8Array,ie=V(Object.getPrototypeOf,Object),oe=Object.create,le=Z.propertyIsEnumerable,ae=K.splice,ce=Object.getOwnPropertySymbols,ue=ne?ne.isBuffer:void 0,de=V(Object.keys,Object),he=Be(R,"DataView"),fe=Be(R,"Map"),pe=Be(R,"Promise"),me=Be(R,"Set"),ge=Be(R,"WeakMap"),ve=Be(Object,"create"),be=ze(he),ye=ze(fe),xe=ze(pe),we=ze(me),Ne=ze(ge),Ee=re?re.prototype:void 0,ke=Ee?Ee.valueOf:void 0;function Se(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Ae(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Ce(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function je(e){this.__data__=new Ae(e)}function _e(e,t){var n=Ve(e)||function(e){return function(e){return function(e){return!!e&&"object"==typeof e}(e)&&He(e)}(e)&&Q.call(e,"callee")&&(!le.call(e,"callee")||ee.call(e)==s)}(e)?function(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}(e.length,String):[],r=n.length,i=!!r;for(var o in e)!Q.call(e,o)||i&&("length"==o||Fe(o,r))||n.push(o);return n}function Oe(e,t,n){var r=e[t];Q.call(e,t)&&$e(r,n)&&(void 0!==n||t in e)||(e[t]=n)}function Te(e,t){for(var n=e.length;n--;)if($e(e[n][0],t))return n;return-1}function Le(e,t,n,r,h,v,O){var T;if(r&&(T=v?r(e,h,v,O):r(e)),void 0!==T)return T;if(!Ge(e))return e;var q=Ve(e);if(q){if(T=function(e){var t=e.length,n=e.constructor(t);t&&"string"==typeof e[0]&&Q.call(e,"index")&&(n.index=e.index,n.input=e.input);return n}(e),!t)return function(e,t){var n=-1,r=e.length;t||(t=Array(r));for(;++n<r;)t[n]=e[n];return t}(e,T)}else{var I=Pe(e),R=I==l||I==a;if(Ke(e))return function(e,t){if(t)return e.slice();var n=new e.constructor(e.length);return e.copy(n),n}(e,t);if(I==d||I==s||R&&!v){if(z(e))return v?e:{};if(T=function(e){return"function"!=typeof e.constructor||Ue(e)?{}:(t=ie(e),Ge(t)?oe(t):{});var t}(R?{}:e),!t)return function(e,t){return Re(e,De(e),t)}(e,function(e,t){return e&&Re(t,Ze(t),e)}(T,e))}else{if(!L[I])return v?e:{};T=function(e,t,n,r){var s=e.constructor;switch(t){case b:return Ie(e);case i:case o:return new s(+e);case y:return function(e,t){var n=t?Ie(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,r);case x:case w:case N:case E:case k:case S:case A:case C:case j:return function(e,t){var n=t?Ie(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}(e,r);case c:return function(e,t,n){var r=t?n($(e),!0):$(e);return U(r,P,new e.constructor)}(e,r,n);case u:case m:return new s(e);case f:return function(e){var t=new e.constructor(e.source,_.exec(e));return t.lastIndex=e.lastIndex,t}(e);case p:return function(e,t,n){var r=t?n(H(e),!0):H(e);return U(r,F,new e.constructor)}(e,r,n);case g:return l=e,ke?Object(ke.call(l)):{}}var l}(e,I,Le,t)}}O||(O=new je);var M=O.get(e);if(M)return M;if(O.set(e,T),!q)var B=n?function(e){return function(e,t,n){var r=t(e);return Ve(e)?r:function(e,t){for(var n=-1,r=t.length,s=e.length;++n<r;)e[s+n]=t[n];return e}(r,n(e))}(e,Ze,De)}(e):Ze(e);return function(e,t){for(var n=-1,r=e?e.length:0;++n<r&&!1!==t(e[n],n,e););}(B||e,function(s,i){B&&(s=e[i=s]),Oe(T,i,Le(s,t,n,r,i,e,O))}),T}function qe(e){return!(!Ge(e)||function(e){return!!J&&J in e}(e))&&(We(e)||z(e)?te:O).test(ze(e))}function Ie(e){var t=new e.constructor(e.byteLength);return new se(t).set(new se(e)),t}function Re(e,t,n,r){n||(n={});for(var s=-1,i=t.length;++s<i;){var o=t[s];Oe(n,o,e[o])}return n}function Me(e,t){var n,r,s=e.__data__;return("string"==(r=typeof(n=t))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?s["string"==typeof t?"string":"hash"]:s.map}function Be(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return qe(n)?n:void 0}Se.prototype.clear=function(){this.__data__=ve?ve(null):{}},Se.prototype.delete=function(e){return this.has(e)&&delete this.__data__[e]},Se.prototype.get=function(e){var t=this.__data__;if(ve){var r=t[e];return r===n?void 0:r}return Q.call(t,e)?t[e]:void 0},Se.prototype.has=function(e){var t=this.__data__;return ve?void 0!==t[e]:Q.call(t,e)},Se.prototype.set=function(e,t){return this.__data__[e]=ve&&void 0===t?n:t,this},Ae.prototype.clear=function(){this.__data__=[]},Ae.prototype.delete=function(e){var t=this.__data__,n=Te(t,e);return!(n<0)&&(n==t.length-1?t.pop():ae.call(t,n,1),!0)},Ae.prototype.get=function(e){var t=this.__data__,n=Te(t,e);return n<0?void 0:t[n][1]},Ae.prototype.has=function(e){return Te(this.__data__,e)>-1},Ae.prototype.set=function(e,t){var n=this.__data__,r=Te(n,e);return r<0?n.push([e,t]):n[r][1]=t,this},Ce.prototype.clear=function(){this.__data__={hash:new Se,map:new(fe||Ae),string:new Se}},Ce.prototype.delete=function(e){return Me(this,e).delete(e)},Ce.prototype.get=function(e){return Me(this,e).get(e)},Ce.prototype.has=function(e){return Me(this,e).has(e)},Ce.prototype.set=function(e,t){return Me(this,e).set(e,t),this},je.prototype.clear=function(){this.__data__=new Ae},je.prototype.delete=function(e){return this.__data__.delete(e)},je.prototype.get=function(e){return this.__data__.get(e)},je.prototype.has=function(e){return this.__data__.has(e)},je.prototype.set=function(e,t){var n=this.__data__;if(n instanceof Ae){var r=n.__data__;if(!fe||r.length<199)return r.push([e,t]),this;n=this.__data__=new Ce(r)}return n.set(e,t),this};var De=ce?V(ce,Object):function(){return[]},Pe=function(e){return ee.call(e)};function Fe(e,t){return!!(t=null==t?r:t)&&("number"==typeof e||T.test(e))&&e>-1&&e%1==0&&e<t}function Ue(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Z)}function ze(e){if(null!=e){try{return X.call(e)}catch(t){}try{return e+""}catch(t){}}return""}function $e(e,t){return e===t||e!=e&&t!=t}(he&&Pe(new he(new ArrayBuffer(1)))!=y||fe&&Pe(new fe)!=c||pe&&Pe(pe.resolve())!=h||me&&Pe(new me)!=p||ge&&Pe(new ge)!=v)&&(Pe=function(e){var t=ee.call(e),n=t==d?e.constructor:void 0,r=n?ze(n):void 0;if(r)switch(r){case be:return y;case ye:return c;case xe:return h;case we:return p;case Ne:return v}return t});var Ve=Array.isArray;function He(e){return null!=e&&function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=r}(e.length)&&!We(e)}var Ke=ue||function(){return!1};function We(e){var t=Ge(e)?ee.call(e):"";return t==l||t==a}function Ge(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function Ze(e){return He(e)?_e(e):function(e){if(!Ue(e))return de(e);var t=[];for(var n in Object(e))Q.call(e,n)&&"constructor"!=n&&t.push(n);return t}(e)}e.exports=function(e){return Le(e,!0,!0)}}(pi,pi.exports)),pi.exports}var gi,vi={exports:{}};function bi(){return gi||(gi=1,function(e,t){var n="__lodash_hash_undefined__",r=9007199254740991,s="[object Arguments]",i="[object Array]",o="[object Boolean]",l="[object Date]",a="[object Error]",c="[object Function]",u="[object Map]",d="[object Number]",h="[object Object]",f="[object Promise]",p="[object RegExp]",m="[object Set]",g="[object String]",v="[object Symbol]",b="[object WeakMap]",y="[object ArrayBuffer]",x="[object DataView]",w=/^\[object .+?Constructor\]$/,N=/^(?:0|[1-9]\d*)$/,E={};E["[object Float32Array]"]=E["[object Float64Array]"]=E["[object Int8Array]"]=E["[object Int16Array]"]=E["[object Int32Array]"]=E["[object Uint8Array]"]=E["[object Uint8ClampedArray]"]=E["[object Uint16Array]"]=E["[object Uint32Array]"]=!0,E[s]=E[i]=E[y]=E[o]=E[x]=E[l]=E[a]=E[c]=E[u]=E[d]=E[h]=E[p]=E[m]=E[g]=E[b]=!1;var k="object"==typeof W&&W&&W.Object===Object&&W,S="object"==typeof self&&self&&self.Object===Object&&self,A=k||S||Function("return this")(),C=t&&!t.nodeType&&t,j=C&&e&&!e.nodeType&&e,_=j&&j.exports===C,O=_&&k.process,T=function(){try{return O&&O.binding&&O.binding("util")}catch(e){}}(),L=T&&T.isTypedArray;function q(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}function I(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n}function R(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}var M=Array.prototype,B=Function.prototype,D=Object.prototype,P=A["__core-js_shared__"],F=B.toString,U=D.hasOwnProperty,z=function(){var e=/[^.]+$/.exec(P&&P.keys&&P.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),$=D.toString,V=RegExp("^"+F.call(U).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),H=_?A.Buffer:void 0,K=A.Symbol,G=A.Uint8Array,Z=D.propertyIsEnumerable,Y=M.splice,J=K?K.toStringTag:void 0,X=Object.getOwnPropertySymbols,Q=H?H.isBuffer:void 0,ee=function(e,t){return function(n){return e(t(n))}}(Object.keys,Object),te=_e(A,"DataView"),ne=_e(A,"Map"),re=_e(A,"Promise"),se=_e(A,"Set"),ie=_e(A,"WeakMap"),oe=_e(Object,"create"),le=qe(te),ae=qe(ne),ce=qe(re),ue=qe(se),de=qe(ie),he=K?K.prototype:void 0,fe=he?he.valueOf:void 0;function pe(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function me(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function ge(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function ve(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new ge;++t<n;)this.add(e[t])}function be(e){var t=this.__data__=new me(e);this.size=t.size}function ye(e,t){var n=Me(e),r=!n&&Re(e),s=!n&&!r&&Be(e),i=!n&&!r&&!s&&ze(e),o=n||r||s||i,l=o?function(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}(e.length,String):[],a=l.length;for(var c in e)!U.call(e,c)||o&&("length"==c||s&&("offset"==c||"parent"==c)||i&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||Le(c,a))||l.push(c);return l}function xe(e,t){for(var n=e.length;n--;)if(Ie(e[n][0],t))return n;return-1}function we(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":J&&J in Object(e)?function(e){var t=U.call(e,J),n=e[J];try{e[J]=void 0;var r=!0}catch(i){}var s=$.call(e);r&&(t?e[J]=n:delete e[J]);return s}(e):function(e){return $.call(e)}(e)}function Ne(e){return Ue(e)&&we(e)==s}function Ee(e,t,n,r,c){return e===t||(null==e||null==t||!Ue(e)&&!Ue(t)?e!=e&&t!=t:function(e,t,n,r,c,f){var b=Me(e),w=Me(t),N=b?i:Te(e),E=w?i:Te(t),k=(N=N==s?h:N)==h,S=(E=E==s?h:E)==h,A=N==E;if(A&&Be(e)){if(!Be(t))return!1;b=!0,k=!1}if(A&&!k)return f||(f=new be),b||ze(e)?Ae(e,t,n,r,c,f):function(e,t,n,r,s,i,c){switch(n){case x:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case y:return!(e.byteLength!=t.byteLength||!i(new G(e),new G(t)));case o:case l:case d:return Ie(+e,+t);case a:return e.name==t.name&&e.message==t.message;case p:case g:return e==t+"";case u:var h=I;case m:var f=1&r;if(h||(h=R),e.size!=t.size&&!f)return!1;var b=c.get(e);if(b)return b==t;r|=2,c.set(e,t);var w=Ae(h(e),h(t),r,s,i,c);return c.delete(e),w;case v:if(fe)return fe.call(e)==fe.call(t)}return!1}(e,t,N,n,r,c,f);if(!(1&n)){var C=k&&U.call(e,"__wrapped__"),j=S&&U.call(t,"__wrapped__");if(C||j){var _=C?e.value():e,O=j?t.value():t;return f||(f=new be),c(_,O,n,r,f)}}if(!A)return!1;return f||(f=new be),function(e,t,n,r,s,i){var o=1&n,l=Ce(e),a=l.length,c=Ce(t),u=c.length;if(a!=u&&!o)return!1;var d=a;for(;d--;){var h=l[d];if(!(o?h in t:U.call(t,h)))return!1}var f=i.get(e);if(f&&i.get(t))return f==t;var p=!0;i.set(e,t),i.set(t,e);var m=o;for(;++d<a;){var g=e[h=l[d]],v=t[h];if(r)var b=o?r(v,g,h,t,e,i):r(g,v,h,e,t,i);if(!(void 0===b?g===v||s(g,v,n,r,i):b)){p=!1;break}m||(m="constructor"==h)}if(p&&!m){var y=e.constructor,x=t.constructor;y==x||!("constructor"in e)||!("constructor"in t)||"function"==typeof y&&y instanceof y&&"function"==typeof x&&x instanceof x||(p=!1)}return i.delete(e),i.delete(t),p}(e,t,n,r,c,f)}(e,t,n,r,Ee,c))}function ke(e){return!(!Fe(e)||function(e){return!!z&&z in e}(e))&&(De(e)?V:w).test(qe(e))}function Se(e){if(n=(t=e)&&t.constructor,r="function"==typeof n&&n.prototype||D,t!==r)return ee(e);var t,n,r,s=[];for(var i in Object(e))U.call(e,i)&&"constructor"!=i&&s.push(i);return s}function Ae(e,t,n,r,s,i){var o=1&n,l=e.length,a=t.length;if(l!=a&&!(o&&a>l))return!1;var c=i.get(e);if(c&&i.get(t))return c==t;var u=-1,d=!0,h=2&n?new ve:void 0;for(i.set(e,t),i.set(t,e);++u<l;){var f=e[u],p=t[u];if(r)var m=o?r(p,f,u,t,e,i):r(f,p,u,e,t,i);if(void 0!==m){if(m)continue;d=!1;break}if(h){if(!q(t,function(e,t){if(o=t,!h.has(o)&&(f===e||s(f,e,n,r,i)))return h.push(t);var o})){d=!1;break}}else if(f!==p&&!s(f,p,n,r,i)){d=!1;break}}return i.delete(e),i.delete(t),d}function Ce(e){return function(e,t,n){var r=t(e);return Me(e)?r:function(e,t){for(var n=-1,r=t.length,s=e.length;++n<r;)e[s+n]=t[n];return e}(r,n(e))}(e,$e,Oe)}function je(e,t){var n,r,s=e.__data__;return("string"==(r=typeof(n=t))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?s["string"==typeof t?"string":"hash"]:s.map}function _e(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return ke(n)?n:void 0}pe.prototype.clear=function(){this.__data__=oe?oe(null):{},this.size=0},pe.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},pe.prototype.get=function(e){var t=this.__data__;if(oe){var r=t[e];return r===n?void 0:r}return U.call(t,e)?t[e]:void 0},pe.prototype.has=function(e){var t=this.__data__;return oe?void 0!==t[e]:U.call(t,e)},pe.prototype.set=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=oe&&void 0===t?n:t,this},me.prototype.clear=function(){this.__data__=[],this.size=0},me.prototype.delete=function(e){var t=this.__data__,n=xe(t,e);return!(n<0)&&(n==t.length-1?t.pop():Y.call(t,n,1),--this.size,!0)},me.prototype.get=function(e){var t=this.__data__,n=xe(t,e);return n<0?void 0:t[n][1]},me.prototype.has=function(e){return xe(this.__data__,e)>-1},me.prototype.set=function(e,t){var n=this.__data__,r=xe(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},ge.prototype.clear=function(){this.size=0,this.__data__={hash:new pe,map:new(ne||me),string:new pe}},ge.prototype.delete=function(e){var t=je(this,e).delete(e);return this.size-=t?1:0,t},ge.prototype.get=function(e){return je(this,e).get(e)},ge.prototype.has=function(e){return je(this,e).has(e)},ge.prototype.set=function(e,t){var n=je(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},ve.prototype.add=ve.prototype.push=function(e){return this.__data__.set(e,n),this},ve.prototype.has=function(e){return this.__data__.has(e)},be.prototype.clear=function(){this.__data__=new me,this.size=0},be.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},be.prototype.get=function(e){return this.__data__.get(e)},be.prototype.has=function(e){return this.__data__.has(e)},be.prototype.set=function(e,t){var n=this.__data__;if(n instanceof me){var r=n.__data__;if(!ne||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new ge(r)}return n.set(e,t),this.size=n.size,this};var Oe=X?function(e){return null==e?[]:(e=Object(e),function(e,t){for(var n=-1,r=null==e?0:e.length,s=0,i=[];++n<r;){var o=e[n];t(o,n,e)&&(i[s++]=o)}return i}(X(e),function(t){return Z.call(e,t)}))}:function(){return[]},Te=we;function Le(e,t){return!!(t=null==t?r:t)&&("number"==typeof e||N.test(e))&&e>-1&&e%1==0&&e<t}function qe(e){if(null!=e){try{return F.call(e)}catch(t){}try{return e+""}catch(t){}}return""}function Ie(e,t){return e===t||e!=e&&t!=t}(te&&Te(new te(new ArrayBuffer(1)))!=x||ne&&Te(new ne)!=u||re&&Te(re.resolve())!=f||se&&Te(new se)!=m||ie&&Te(new ie)!=b)&&(Te=function(e){var t=we(e),n=t==h?e.constructor:void 0,r=n?qe(n):"";if(r)switch(r){case le:return x;case ae:return u;case ce:return f;case ue:return m;case de:return b}return t});var Re=Ne(function(){return arguments}())?Ne:function(e){return Ue(e)&&U.call(e,"callee")&&!Z.call(e,"callee")},Me=Array.isArray;var Be=Q||function(){return!1};function De(e){if(!Fe(e))return!1;var t=we(e);return t==c||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Pe(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=r}function Fe(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function Ue(e){return null!=e&&"object"==typeof e}var ze=L?function(e){return function(t){return e(t)}}(L):function(e){return Ue(e)&&Pe(e.length)&&!!E[we(e)]};function $e(e){return null!=(t=e)&&Pe(t.length)&&!De(t)?ye(e):Se(e);var t}e.exports=function(e,t){return Ee(e,t)}}(vi,vi.exports)),vi.exports}var yi,xi={};var wi,Ni={};function Ei(){return wi||(wi=1,Object.defineProperty(Ni,"__esModule",{value:!0}),(e||(e={})).length=function(e){return"number"==typeof e.delete?e.delete:"number"==typeof e.retain?e.retain:"object"==typeof e.retain&&null!==e.retain?1:"string"==typeof e.insert?e.insert.length:1},Ni.default=e),Ni;var e}var ki,Si,Ai={};var Ci=(Si||(Si=1,function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.AttributeMap=t.OpIterator=t.Op=void 0;const n=hi(),r=mi(),s=bi(),i=function(){if(yi)return xi;yi=1,Object.defineProperty(xi,"__esModule",{value:!0});const e=mi(),t=bi();var n,r;return(r=n||(n={})).compose=function(t={},n={},r=!1){"object"!=typeof t&&(t={}),"object"!=typeof n&&(n={});let s=e(n);r||(s=Object.keys(s).reduce((e,t)=>(null!=s[t]&&(e[t]=s[t]),e),{}));for(const e in t)void 0!==t[e]&&void 0===n[e]&&(s[e]=t[e]);return Object.keys(s).length>0?s:void 0},r.diff=function(e={},n={}){"object"!=typeof e&&(e={}),"object"!=typeof n&&(n={});const r=Object.keys(e).concat(Object.keys(n)).reduce((r,s)=>(t(e[s],n[s])||(r[s]=void 0===n[s]?null:n[s]),r),{});return Object.keys(r).length>0?r:void 0},r.invert=function(e={},t={}){e=e||{};const n=Object.keys(t).reduce((n,r)=>(t[r]!==e[r]&&void 0!==e[r]&&(n[r]=t[r]),n),{});return Object.keys(e).reduce((n,r)=>(e[r]!==t[r]&&void 0===t[r]&&(n[r]=null),n),n)},r.transform=function(e,t,n=!1){if("object"!=typeof e)return t;if("object"!=typeof t)return;if(!n)return t;const r=Object.keys(t).reduce((n,r)=>(void 0===e[r]&&(n[r]=t[r]),n),{});return Object.keys(r).length>0?r:void 0},xi.default=n,xi}();t.AttributeMap=i.default;const o=Ei();t.Op=o.default;const l=function(){if(ki)return Ai;ki=1,Object.defineProperty(Ai,"__esModule",{value:!0});const e=Ei();return Ai.default=class{constructor(e){this.ops=e,this.index=0,this.offset=0}hasNext(){return this.peekLength()<1/0}next(t){t||(t=1/0);const n=this.ops[this.index];if(n){const r=this.offset,s=e.default.length(n);if(t>=s-r?(t=s-r,this.index+=1,this.offset=0):this.offset+=t,"number"==typeof n.delete)return{delete:t};{const e={};return n.attributes&&(e.attributes=n.attributes),"number"==typeof n.retain?e.retain=t:"object"==typeof n.retain&&null!==n.retain?e.retain=n.retain:"string"==typeof n.insert?e.insert=n.insert.substr(r,t):e.insert=n.insert,e}}return{retain:1/0}}peek(){return this.ops[this.index]}peekLength(){return this.ops[this.index]?e.default.length(this.ops[this.index])-this.offset:1/0}peekType(){const e=this.ops[this.index];return e?"number"==typeof e.delete?"delete":"number"==typeof e.retain||"object"==typeof e.retain&&null!==e.retain?"retain":"insert":"retain"}rest(){if(this.hasNext()){if(0===this.offset)return this.ops.slice(this.index);{const e=this.offset,t=this.index,n=this.next(),r=this.ops.slice(this.index);return this.offset=e,this.index=t,[n].concat(r)}}return[]}},Ai}();t.OpIterator=l.default;const a=String.fromCharCode(0),c=(e,t)=>{if("object"!=typeof e||null===e)throw new Error("cannot retain a "+typeof e);if("object"!=typeof t||null===t)throw new Error("cannot retain a "+typeof t);const n=Object.keys(e)[0];if(!n||n!==Object.keys(t)[0])throw new Error(`embed types not matched: ${n} != ${Object.keys(t)[0]}`);return[n,e[n],t[n]]};class u{constructor(e){Array.isArray(e)?this.ops=e:null!=e&&Array.isArray(e.ops)?this.ops=e.ops:this.ops=[]}static registerEmbed(e,t){this.handlers[e]=t}static unregisterEmbed(e){delete this.handlers[e]}static getHandler(e){const t=this.handlers[e];if(!t)throw new Error(`no handlers for embed type "${e}"`);return t}insert(e,t){const n={};return"string"==typeof e&&0===e.length?this:(n.insert=e,null!=t&&"object"==typeof t&&Object.keys(t).length>0&&(n.attributes=t),this.push(n))}delete(e){return e<=0?this:this.push({delete:e})}retain(e,t){if("number"==typeof e&&e<=0)return this;const n={retain:e};return null!=t&&"object"==typeof t&&Object.keys(t).length>0&&(n.attributes=t),this.push(n)}push(e){let t=this.ops.length,n=this.ops[t-1];if(e=r(e),"object"==typeof n){if("number"==typeof e.delete&&"number"==typeof n.delete)return this.ops[t-1]={delete:n.delete+e.delete},this;if("number"==typeof n.delete&&null!=e.insert&&(t-=1,n=this.ops[t-1],"object"!=typeof n))return this.ops.unshift(e),this;if(s(e.attributes,n.attributes)){if("string"==typeof e.insert&&"string"==typeof n.insert)return this.ops[t-1]={insert:n.insert+e.insert},"object"==typeof e.attributes&&(this.ops[t-1].attributes=e.attributes),this;if("number"==typeof e.retain&&"number"==typeof n.retain)return this.ops[t-1]={retain:n.retain+e.retain},"object"==typeof e.attributes&&(this.ops[t-1].attributes=e.attributes),this}}return t===this.ops.length?this.ops.push(e):this.ops.splice(t,0,e),this}chop(){const e=this.ops[this.ops.length-1];return e&&"number"==typeof e.retain&&!e.attributes&&this.ops.pop(),this}filter(e){return this.ops.filter(e)}forEach(e){this.ops.forEach(e)}map(e){return this.ops.map(e)}partition(e){const t=[],n=[];return this.forEach(r=>{(e(r)?t:n).push(r)}),[t,n]}reduce(e,t){return this.ops.reduce(e,t)}changeLength(){return this.reduce((e,t)=>t.insert?e+o.default.length(t):t.delete?e-t.delete:e,0)}length(){return this.reduce((e,t)=>e+o.default.length(t),0)}slice(e=0,t=1/0){const n=[],r=new l.default(this.ops);let s=0;for(;s<t&&r.hasNext();){let i;s<e?i=r.next(e-s):(i=r.next(t-s),n.push(i)),s+=o.default.length(i)}return new u(n)}compose(e){const t=new l.default(this.ops),n=new l.default(e.ops),r=[],o=n.peek();if(null!=o&&"number"==typeof o.retain&&null==o.attributes){let e=o.retain;for(;"insert"===t.peekType()&&t.peekLength()<=e;)e-=t.peekLength(),r.push(t.next());o.retain-e>0&&n.next(o.retain-e)}const a=new u(r);for(;t.hasNext()||n.hasNext();)if("insert"===n.peekType())a.push(n.next());else if("delete"===t.peekType())a.push(t.next());else{const e=Math.min(t.peekLength(),n.peekLength()),r=t.next(e),o=n.next(e);if(o.retain){const l={};if("number"==typeof r.retain)l.retain="number"==typeof o.retain?e:o.retain;else if("number"==typeof o.retain)null==r.retain?l.insert=r.insert:l.retain=r.retain;else{const e=null==r.retain?"insert":"retain",[t,n,s]=c(r[e],o.retain),i=u.getHandler(t);l[e]={[t]:i.compose(n,s,"retain"===e)}}const d=i.default.compose(r.attributes,o.attributes,"number"==typeof r.retain);if(d&&(l.attributes=d),a.push(l),!n.hasNext()&&s(a.ops[a.ops.length-1],l)){const e=new u(t.rest());return a.concat(e).chop()}}else"number"==typeof o.delete&&("number"==typeof r.retain||"object"==typeof r.retain&&null!==r.retain)&&a.push(o)}return a.chop()}concat(e){const t=new u(this.ops.slice());return e.ops.length>0&&(t.push(e.ops[0]),t.ops=t.ops.concat(e.ops.slice(1))),t}diff(e,t){if(this.ops===e.ops)return new u;const r=[this,e].map(t=>t.map(n=>{if(null!=n.insert)return"string"==typeof n.insert?n.insert:a;throw new Error("diff() called "+(t===e?"on":"with")+" non-document")}).join("")),o=new u,c=n(r[0],r[1],t,!0),d=new l.default(this.ops),h=new l.default(e.ops);return c.forEach(e=>{let t=e[1].length;for(;t>0;){let r=0;switch(e[0]){case n.INSERT:r=Math.min(h.peekLength(),t),o.push(h.next(r));break;case n.DELETE:r=Math.min(t,d.peekLength()),d.next(r),o.delete(r);break;case n.EQUAL:r=Math.min(d.peekLength(),h.peekLength(),t);const e=d.next(r),l=h.next(r);s(e.insert,l.insert)?o.retain(r,i.default.diff(e.attributes,l.attributes)):o.push(l).delete(r)}t-=r}}),o.chop()}eachLine(e,t="\n"){const n=new l.default(this.ops);let r=new u,s=0;for(;n.hasNext();){if("insert"!==n.peekType())return;const i=n.peek(),l=o.default.length(i)-n.peekLength(),a="string"==typeof i.insert?i.insert.indexOf(t,l)-l:-1;if(a<0)r.push(n.next());else if(a>0)r.push(n.next(a));else{if(!1===e(r,n.next(1).attributes||{},s))return;s+=1,r=new u}}r.length()>0&&e(r,{},s)}invert(e){const t=new u;return this.reduce((n,r)=>{if(r.insert)t.delete(o.default.length(r));else{if("number"==typeof r.retain&&null==r.attributes)return t.retain(r.retain),n+r.retain;if(r.delete||"number"==typeof r.retain){const s=r.delete||r.retain;return e.slice(n,n+s).forEach(e=>{r.delete?t.push(e):r.retain&&r.attributes&&t.retain(o.default.length(e),i.default.invert(r.attributes,e.attributes))}),n+s}if("object"==typeof r.retain&&null!==r.retain){const s=e.slice(n,n+1),o=new l.default(s.ops).next(),[a,d,h]=c(r.retain,o.insert),f=u.getHandler(a);return t.retain({[a]:f.invert(d,h)},i.default.invert(r.attributes,o.attributes)),n+1}}return n},0),t.chop()}transform(e,t=!1){if(t=!!t,"number"==typeof e)return this.transformPosition(e,t);const n=e,r=new l.default(this.ops),s=new l.default(n.ops),a=new u;for(;r.hasNext()||s.hasNext();)if("insert"!==r.peekType()||!t&&"insert"===s.peekType())if("insert"===s.peekType())a.push(s.next());else{const e=Math.min(r.peekLength(),s.peekLength()),n=r.next(e),o=s.next(e);if(n.delete)continue;if(o.delete)a.push(o);else{const r=n.retain,s=o.retain;let l="object"==typeof s&&null!==s?s:e;if("object"==typeof r&&null!==r&&"object"==typeof s&&null!==s){const e=Object.keys(r)[0];if(e===Object.keys(s)[0]){const n=u.getHandler(e);n&&(l={[e]:n.transform(r[e],s[e],t)})}}a.retain(l,i.default.transform(n.attributes,o.attributes,t))}}else a.retain(o.default.length(r.next()));return a.chop()}transformPosition(e,t=!1){t=!!t;const n=new l.default(this.ops);let r=0;for(;n.hasNext()&&r<=e;){const s=n.peekLength(),i=n.peekType();n.next(),"delete"!==i?("insert"===i&&(r<e||!t)&&(e+=s),r+=s):e-=Math.min(s,e-r)}return e}}u.Op=o.default,u.OpIterator=l.default,u.AttributeMap=i.default,u.handlers={},t.default=u,e.exports=u,e.exports.default=u}(di,di.exports)),di.exports);const ji=G(Ci);class _i extends ni{static value(){}optimize(){(this.prev||this.next)&&this.remove()}length(){return 0}value(){return""}}_i.blotName="break",_i.tagName="BR";let Oi=class extends li{};const Ti={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function Li(e){return e.replace(/[&<>"']/g,e=>Ti[e])}const qi=class e extends Js{static compare(t,n){const r=e.order.indexOf(t),s=e.order.indexOf(n);return r>=0||s>=0?r-s:t===n?0:t<n?-1:1}formatAt(t,n,r,s){if(e.compare(this.statics.blotName,r)<0&&this.scroll.query(r,Ls.BLOT)){const e=this.isolate(t,n);s&&e.wrap(r,s)}else super.formatAt(t,n,r,s)}optimize(t){if(super.optimize(t),this.parent instanceof e&&e.compare(this.statics.blotName,this.parent.statics.blotName)>0){const e=this.parent.isolate(this.offset(),this.length());this.moveChildren(e),e.wrap(this)}}};t(qi,"allowedChildren",[qi,_i,ni,Oi]),t(qi,"order",["cursor","inline","link","underline","strike","italic","bold","script","code"]);let Ii=qi;class Ri extends Qs{constructor(){super(...arguments),t(this,"cache",{})}delta(){return null==this.cache.delta&&(this.cache.delta=Bi(this)),this.cache.delta}deleteAt(e,t){super.deleteAt(e,t),this.cache={}}formatAt(e,t,n,r){t<=0||(this.scroll.query(n,Ls.BLOCK)?e+t===this.length()&&this.format(n,r):super.formatAt(e,Math.min(t,this.length()-e-1),n,r),this.cache={})}insertAt(e,t,n){if(null!=n)return super.insertAt(e,t,n),void(this.cache={});if(0===t.length)return;const r=t.split("\n"),s=r.shift();s.length>0&&(e<this.length()-1||null==this.children.tail?super.insertAt(Math.min(e,this.length()-1),s):this.children.tail.insertAt(this.children.tail.length(),s),this.cache={});let i=this;r.reduce((e,t)=>(i=i.split(e,!0),i.insertAt(0,t),t.length),e+s.length)}insertBefore(e,t){const{head:n}=this.children;super.insertBefore(e,t),n instanceof _i&&n.remove(),this.cache={}}length(){return null==this.cache.length&&(this.cache.length=super.length()+1),this.cache.length}moveChildren(e,t){super.moveChildren(e,t),this.cache={}}optimize(e){super.optimize(e),this.cache={}}path(e){return super.path(e,!0)}removeChild(e){super.removeChild(e),this.cache={}}split(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(t&&(0===e||e>=this.length()-1)){const t=this.clone();return 0===e?(this.parent.insertBefore(t,this),this):(this.parent.insertBefore(t,this.next),t)}const n=super.split(e,t);return this.cache={},n}}Ri.blotName="block",Ri.tagName="P",Ri.defaultChild=_i,Ri.allowedChildren=[_i,Ii,ni,Oi];class Mi extends ni{attach(){super.attach(),this.attributes=new Us(this.domNode)}delta(){return(new ji).insert(this.value(),{...this.formats(),...this.attributes.values()})}format(e,t){const n=this.scroll.query(e,Ls.BLOCK_ATTRIBUTE);null!=n&&this.attributes.attribute(n,t)}formatAt(e,t,n,r){this.format(n,r)}insertAt(e,t,n){if(null!=n)return void super.insertAt(e,t,n);const r=t.split("\n"),s=r.pop(),i=r.map(e=>{const t=this.scroll.create(Ri.blotName);return t.insertAt(0,e),t}),o=this.split(e);i.forEach(e=>{this.parent.insertBefore(e,o)}),s&&this.parent.insertBefore(this.scroll.create("text",s),o)}}function Bi(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return e.descendants(Hs).reduce((e,n)=>0===n.length()?e:e.insert(n.value(),Di(n,{},t)),new ji).insert("\n",Di(e))}function Di(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return null==e?t:("formats"in e&&"function"==typeof e.formats&&(t={...t,...e.formats()},n&&delete t["code-token"]),null==e.parent||"scroll"===e.parent.statics.blotName||e.parent.statics.scope!==e.statics.scope?t:Di(e.parent,t,n))}Mi.scope=Ls.BLOCK_BLOT;const Pi=class e extends ni{static value(){}constructor(t,n,r){super(t,n),this.selection=r,this.textNode=document.createTextNode(e.CONTENTS),this.domNode.appendChild(this.textNode),this.savedLength=0}detach(){null!=this.parent&&this.parent.removeChild(this)}format(t,n){if(0!==this.savedLength)return void super.format(t,n);let r=this,s=0;for(;null!=r&&r.statics.scope!==Ls.BLOCK_BLOT;)s+=r.offset(r.parent),r=r.parent;null!=r&&(this.savedLength=e.CONTENTS.length,r.optimize(),r.formatAt(s,e.CONTENTS.length,t,n),this.savedLength=0)}index(e,t){return e===this.textNode?0:super.index(e,t)}length(){return this.savedLength}position(){return[this.textNode,this.textNode.data.length]}remove(){super.remove(),this.parent=null}restore(){if(this.selection.composing||null==this.parent)return null;const t=this.selection.getNativeRange();for(;null!=this.domNode.lastChild&&this.domNode.lastChild!==this.textNode;)this.domNode.parentNode.insertBefore(this.domNode.lastChild,this.domNode);const n=this.prev instanceof Oi?this.prev:null,r=n?n.length():0,s=this.next instanceof Oi?this.next:null,i=s?s.text:"",{textNode:o}=this,l=o.data.split(e.CONTENTS).join("");let a;if(o.data=e.CONTENTS,n)a=n,(l||s)&&(n.insertAt(n.length(),l+i),s&&s.remove());else if(s)a=s,s.insertAt(0,l);else{const e=document.createTextNode(l);a=this.scroll.create(e),this.parent.insertBefore(a,this)}if(this.remove(),t){const e=(e,t)=>n&&e===n.domNode?t:e===o?r+t-1:s&&e===s.domNode?r+l.length+t:null,i=e(t.start.node,t.start.offset),c=e(t.end.node,t.end.offset);if(null!==i&&null!==c)return{startNode:a.domNode,startOffset:i,endNode:a.domNode,endOffset:c}}return null}update(e,t){if(e.some(e=>"characterData"===e.type&&e.target===this.textNode)){const e=this.restore();e&&(t.range=e)}}optimize(t){super.optimize(t);let{parent:n}=this;for(;n;){if("A"===n.domNode.tagName){this.savedLength=e.CONTENTS.length,n.isolate(this.offset(n),this.length()).unwrap(),this.savedLength=0;break}n=n.parent}}value(){return""}};t(Pi,"blotName","cursor"),t(Pi,"className","ql-cursor"),t(Pi,"tagName","span"),t(Pi,"CONTENTS","\ufeff");let Fi=Pi;var Ui,zi={exports:{}};var $i=(Ui||(Ui=1,function(e){var t=Object.prototype.hasOwnProperty,n="~";function r(){}function s(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function i(e,t,r,i,o){if("function"!=typeof r)throw new TypeError("The listener must be a function");var l=new s(r,i||e,o),a=n?n+t:t;return e._events[a]?e._events[a].fn?e._events[a]=[e._events[a],l]:e._events[a].push(l):(e._events[a]=l,e._eventsCount++),e}function o(e,t){0===--e._eventsCount?e._events=new r:delete e._events[t]}function l(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(n=!1)),l.prototype.eventNames=function(){var e,r,s=[];if(0===this._eventsCount)return s;for(r in e=this._events)t.call(e,r)&&s.push(n?r.slice(1):r);return Object.getOwnPropertySymbols?s.concat(Object.getOwnPropertySymbols(e)):s},l.prototype.listeners=function(e){var t=n?n+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var s=0,i=r.length,o=new Array(i);s<i;s++)o[s]=r[s].fn;return o},l.prototype.listenerCount=function(e){var t=n?n+e:e,r=this._events[t];return r?r.fn?1:r.length:0},l.prototype.emit=function(e,t,r,s,i,o){var l=n?n+e:e;if(!this._events[l])return!1;var a,c,u=this._events[l],d=arguments.length;if(u.fn){switch(u.once&&this.removeListener(e,u.fn,void 0,!0),d){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,t),!0;case 3:return u.fn.call(u.context,t,r),!0;case 4:return u.fn.call(u.context,t,r,s),!0;case 5:return u.fn.call(u.context,t,r,s,i),!0;case 6:return u.fn.call(u.context,t,r,s,i,o),!0}for(c=1,a=new Array(d-1);c<d;c++)a[c-1]=arguments[c];u.fn.apply(u.context,a)}else{var h,f=u.length;for(c=0;c<f;c++)switch(u[c].once&&this.removeListener(e,u[c].fn,void 0,!0),d){case 1:u[c].fn.call(u[c].context);break;case 2:u[c].fn.call(u[c].context,t);break;case 3:u[c].fn.call(u[c].context,t,r);break;case 4:u[c].fn.call(u[c].context,t,r,s);break;default:if(!a)for(h=1,a=new Array(d-1);h<d;h++)a[h-1]=arguments[h];u[c].fn.apply(u[c].context,a)}}return!0},l.prototype.on=function(e,t,n){return i(this,e,t,n,!1)},l.prototype.once=function(e,t,n){return i(this,e,t,n,!0)},l.prototype.removeListener=function(e,t,r,s){var i=n?n+e:e;if(!this._events[i])return this;if(!t)return o(this,i),this;var l=this._events[i];if(l.fn)l.fn!==t||s&&!l.once||r&&l.context!==r||o(this,i);else{for(var a=0,c=[],u=l.length;a<u;a++)(l[a].fn!==t||s&&!l[a].once||r&&l[a].context!==r)&&c.push(l[a]);c.length?this._events[i]=1===c.length?c[0]:c:o(this,i)}return this},l.prototype.removeAllListeners=function(e){var t;return e?(t=n?n+e:e,this._events[t]&&o(this,t)):(this._events=new r,this._eventsCount=0),this},l.prototype.off=l.prototype.removeListener,l.prototype.addListener=l.prototype.on,l.prefixed=n,l.EventEmitter=l,e.exports=l}(zi)),zi.exports);const Vi=G($i),Hi=new WeakMap,Ki=["error","warn","log","info"];let Wi="warn";function Gi(e){if(Wi&&Ki.indexOf(e)<=Ki.indexOf(Wi))for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r]}function Zi(e){return Ki.reduce((t,n)=>(t[n]=Gi.bind(console,n,e),t),{})}Zi.level=e=>{Wi=e},Gi.level=Zi.level;const Yi=Zi("quill:events");["selectionchange","mousedown","mouseup","click"].forEach(e=>{document.addEventListener(e,function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];Array.from(document.querySelectorAll(".ql-container")).forEach(e=>{const n=Hi.get(e);n&&n.emitter&&n.emitter.handleDOM(...t)})})});class Ji extends Vi{constructor(){super(),this.domListeners={},this.on("error",Yi.error)}emit(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return Yi.log.call(Yi,...t),super.emit(...t)}handleDOM(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];(this.domListeners[e.type]||[]).forEach(t=>{let{node:r,handler:s}=t;(e.target===r||r.contains(e.target))&&s(e,...n)})}listenDOM(e,t,n){this.domListeners[e]||(this.domListeners[e]=[]),this.domListeners[e].push({node:t,handler:n})}}t(Ji,"events",{EDITOR_CHANGE:"editor-change",SCROLL_BEFORE_UPDATE:"scroll-before-update",SCROLL_BLOT_MOUNT:"scroll-blot-mount",SCROLL_BLOT_UNMOUNT:"scroll-blot-unmount",SCROLL_OPTIMIZE:"scroll-optimize",SCROLL_UPDATE:"scroll-update",SCROLL_EMBED_UPDATE:"scroll-embed-update",SELECTION_CHANGE:"selection-change",TEXT_CHANGE:"text-change",COMPOSITION_BEFORE_START:"composition-before-start",COMPOSITION_START:"composition-start",COMPOSITION_BEFORE_END:"composition-before-end",COMPOSITION_END:"composition-end"}),t(Ji,"sources",{API:"api",SILENT:"silent",USER:"user"});const Xi=Zi("quill:selection");class Qi{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.index=e,this.length=t}}class eo{constructor(e,t){this.emitter=t,this.scroll=e,this.composing=!1,this.mouseDown=!1,this.root=this.scroll.domNode,this.cursor=this.scroll.create("cursor",this),this.savedRange=new Qi(0,0),this.lastRange=this.savedRange,this.lastNative=null,this.handleComposition(),this.handleDragging(),this.emitter.listenDOM("selectionchange",document,()=>{this.mouseDown||this.composing||setTimeout(this.update.bind(this,Ji.sources.USER),1)}),this.emitter.on(Ji.events.SCROLL_BEFORE_UPDATE,()=>{if(!this.hasFocus())return;const e=this.getNativeRange();null!=e&&e.start.node!==this.cursor.textNode&&this.emitter.once(Ji.events.SCROLL_UPDATE,(t,n)=>{try{this.root.contains(e.start.node)&&this.root.contains(e.end.node)&&this.setNativeRange(e.start.node,e.start.offset,e.end.node,e.end.offset);const r=n.some(e=>"characterData"===e.type||"childList"===e.type||"attributes"===e.type&&e.target===this.root);this.update(r?Ji.sources.SILENT:t)}catch(r){}})}),this.emitter.on(Ji.events.SCROLL_OPTIMIZE,(e,t)=>{if(t.range){const{startNode:e,startOffset:n,endNode:r,endOffset:s}=t.range;this.setNativeRange(e,n,r,s),this.update(Ji.sources.SILENT)}}),this.update(Ji.sources.SILENT)}handleComposition(){this.emitter.on(Ji.events.COMPOSITION_BEFORE_START,()=>{this.composing=!0}),this.emitter.on(Ji.events.COMPOSITION_END,()=>{if(this.composing=!1,this.cursor.parent){const e=this.cursor.restore();if(!e)return;setTimeout(()=>{this.setNativeRange(e.startNode,e.startOffset,e.endNode,e.endOffset)},1)}})}handleDragging(){this.emitter.listenDOM("mousedown",document.body,()=>{this.mouseDown=!0}),this.emitter.listenDOM("mouseup",document.body,()=>{this.mouseDown=!1,this.update(Ji.sources.USER)})}focus(){this.hasFocus()||(this.root.focus({preventScroll:!0}),this.setRange(this.savedRange))}format(e,t){this.scroll.update();const n=this.getNativeRange();if(null!=n&&n.native.collapsed&&!this.scroll.query(e,Ls.BLOCK)){if(n.start.node!==this.cursor.textNode){const e=this.scroll.find(n.start.node,!1);if(null==e)return;if(e instanceof Hs){const t=e.split(n.start.offset);e.parent.insertBefore(this.cursor,t)}else e.insertBefore(this.cursor,n.start.node);this.cursor.attach()}this.cursor.format(e,t),this.scroll.optimize(),this.setNativeRange(this.cursor.textNode,this.cursor.textNode.data.length),this.update()}}getBounds(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const n=this.scroll.length();let r;e=Math.min(e,n-1),t=Math.min(e+t,n-1)-e;let[s,i]=this.scroll.leaf(e);if(null==s)return null;if(t>0&&i===s.length()){const[t]=this.scroll.leaf(e+1);if(t){const[n]=this.scroll.line(e),[r]=this.scroll.line(e+1);n===r&&(s=t,i=0)}}[r,i]=s.position(i,!0);const o=document.createRange();if(t>0)return o.setStart(r,i),[s,i]=this.scroll.leaf(e+t),null==s?null:([r,i]=s.position(i,!0),o.setEnd(r,i),o.getBoundingClientRect());let l,a="left";if(r instanceof Text){if(!r.data.length)return null;i<r.data.length?(o.setStart(r,i),o.setEnd(r,i+1)):(o.setStart(r,i-1),o.setEnd(r,i),a="right"),l=o.getBoundingClientRect()}else{if(!(s.domNode instanceof Element))return null;l=s.domNode.getBoundingClientRect(),i>0&&(a="right")}return{bottom:l.top+l.height,height:l.height,left:l[a],right:l[a],top:l.top,width:0}}getNativeRange(){const e=document.getSelection();if(null==e||e.rangeCount<=0)return null;const t=e.getRangeAt(0);if(null==t)return null;const n=this.normalizeNative(t);return Xi.info("getNativeRange",n),n}getRange(){const e=this.scroll.domNode;if("isConnected"in e&&!e.isConnected)return[null,null];const t=this.getNativeRange();if(null==t)return[null,null];return[this.normalizedToRange(t),t]}hasFocus(){return document.activeElement===this.root||null!=document.activeElement&&to(this.root,document.activeElement)}normalizedToRange(e){const t=[[e.start.node,e.start.offset]];e.native.collapsed||t.push([e.end.node,e.end.offset]);const n=t.map(e=>{const[t,n]=e,r=this.scroll.find(t,!0),s=r.offset(this.scroll);return 0===n?s:r instanceof Hs?s+r.index(t,n):s+r.length()}),r=Math.min(Math.max(...n),this.scroll.length()-1),s=Math.min(r,...n);return new Qi(s,r-s)}normalizeNative(e){if(!to(this.root,e.startContainer)||!e.collapsed&&!to(this.root,e.endContainer))return null;const t={start:{node:e.startContainer,offset:e.startOffset},end:{node:e.endContainer,offset:e.endOffset},native:e};return[t.start,t.end].forEach(e=>{let{node:t,offset:n}=e;for(;!(t instanceof Text)&&t.childNodes.length>0;)if(t.childNodes.length>n)t=t.childNodes[n],n=0;else{if(t.childNodes.length!==n)break;t=t.lastChild,n=t instanceof Text?t.data.length:t.childNodes.length>0?t.childNodes.length:t.childNodes.length+1}e.node=t,e.offset=n}),t}rangeToNative(e){const t=this.scroll.length(),n=(e,n)=>{e=Math.min(t-1,e);const[r,s]=this.scroll.leaf(e);return r?r.position(s,n):[null,-1]};return[...n(e.index,!1),...n(e.index+e.length,!0)]}setNativeRange(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:t,s=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(Xi.info("setNativeRange",e,t,n,r),null!=e&&(null==this.root.parentNode||null==e.parentNode||null==n.parentNode))return;const i=document.getSelection();if(null!=i)if(null!=e){this.hasFocus()||this.root.focus({preventScroll:!0});const{native:o}=this.getNativeRange()||{};if(null==o||s||e!==o.startContainer||t!==o.startOffset||n!==o.endContainer||r!==o.endOffset){e instanceof Element&&"BR"===e.tagName&&(t=Array.from(e.parentNode.childNodes).indexOf(e),e=e.parentNode),n instanceof Element&&"BR"===n.tagName&&(r=Array.from(n.parentNode.childNodes).indexOf(n),n=n.parentNode);const s=document.createRange();s.setStart(e,t),s.setEnd(n,r),i.removeAllRanges(),i.addRange(s)}}else i.removeAllRanges(),this.root.blur()}setRange(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Ji.sources.API;if("string"==typeof t&&(n=t,t=!1),Xi.info("setRange",e),null!=e){const n=this.rangeToNative(e);this.setNativeRange(...n,t)}else this.setNativeRange(null);this.update(n)}update(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ji.sources.USER;const t=this.lastRange,[n,r]=this.getRange();if(this.lastRange=n,this.lastNative=r,null!=this.lastRange&&(this.savedRange=this.lastRange),!_s(t,this.lastRange)){if(!this.composing&&null!=r&&r.native.collapsed&&r.start.node!==this.cursor.textNode){const e=this.cursor.restore();e&&this.setNativeRange(e.startNode,e.startOffset,e.endNode,e.endOffset)}const n=[Ji.events.SELECTION_CHANGE,as(this.lastRange),as(t),e];this.emitter.emit(Ji.events.EDITOR_CHANGE,...n),e!==Ji.sources.SILENT&&this.emitter.emit(...n)}}}function to(e,t){try{t.parentNode}catch(n){return!1}return e.contains(t)}const no=/^[ -~]*$/;class ro{constructor(e){this.scroll=e,this.delta=this.getDelta()}applyDelta(e){this.scroll.update();let t=this.scroll.length();this.scroll.batchStart();const n=ao(e),r=new ji;return function(e){const t=[];return e.forEach(e=>{if("string"==typeof e.insert){e.insert.split("\n").forEach((n,r)=>{r&&t.push({insert:"\n",attributes:e.attributes}),n&&t.push({insert:n,attributes:e.attributes})})}else t.push(e)}),t}(n.ops.slice()).reduce((e,n)=>{const s=Ci.Op.length(n);let i=n.attributes||{},o=!1,l=!1;if(null!=n.insert){if(r.retain(s),"string"==typeof n.insert){const r=n.insert;l=!r.endsWith("\n")&&(t<=e||!!this.scroll.descendant(Mi,e)[0]),this.scroll.insertAt(e,r);const[s,o]=this.scroll.line(e);let a=Ts({},Di(s));if(s instanceof Ri){const[e]=s.descendant(Hs,o);e&&(a=Ts(a,Di(e)))}i=Ci.AttributeMap.diff(a,i)||{}}else if("object"==typeof n.insert){const r=Object.keys(n.insert)[0];if(null==r)return e;const s=null!=this.scroll.query(r,Ls.INLINE);if(s)(t<=e||this.scroll.descendant(Mi,e)[0])&&(l=!0);else if(e>0){const[t,n]=this.scroll.descendant(Hs,e-1);if(t instanceof Oi){"\n"!==t.value()[n]&&(o=!0)}else t instanceof ni&&t.statics.scope===Ls.INLINE_BLOT&&(o=!0)}if(this.scroll.insertAt(e,r,n.insert[r]),s){const[t]=this.scroll.descendant(Hs,e);if(t){const e=Ts({},Di(t));i=Ci.AttributeMap.diff(e,i)||{}}}}t+=s}else if(r.push(n),null!==n.retain&&"object"==typeof n.retain){const t=Object.keys(n.retain)[0];if(null==t)return e;this.scroll.updateEmbedAt(e,t,n.retain[t])}Object.keys(i).forEach(t=>{this.scroll.formatAt(e,s,t,i[t])});const a=o?1:0,c=l?1:0;return t+=a+c,r.retain(a),r.delete(c),e+s+a+c},0),r.reduce((e,t)=>"number"==typeof t.delete?(this.scroll.deleteAt(e,t.delete),e):e+Ci.Op.length(t),0),this.scroll.batchEnd(),this.scroll.optimize(),this.update(n)}deleteText(e,t){return this.scroll.deleteAt(e,t),this.update((new ji).retain(e).delete(t))}formatLine(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};this.scroll.update(),Object.keys(n).forEach(r=>{this.scroll.lines(e,Math.max(t,1)).forEach(e=>{e.format(r,n[r])})}),this.scroll.optimize();const r=(new ji).retain(e).retain(t,as(n));return this.update(r)}formatText(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.keys(n).forEach(r=>{this.scroll.formatAt(e,t,r,n[r])});const r=(new ji).retain(e).retain(t,as(n));return this.update(r)}getContents(e,t){return this.delta.slice(e,e+t)}getDelta(){return this.scroll.lines().reduce((e,t)=>e.concat(t.delta()),new ji)}getFormat(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=[],r=[];0===t?this.scroll.path(e).forEach(e=>{const[t]=e;t instanceof Ri?n.push(t):t instanceof Hs&&r.push(t)}):(n=this.scroll.lines(e,t),r=this.scroll.descendants(Hs,e,t));const[s,i]=[n,r].map(e=>{const t=e.shift();if(null==t)return{};let n=Di(t);for(;Object.keys(n).length>0;){const t=e.shift();if(null==t)return n;n=oo(Di(t),n)}return n});return{...s,...i}}getHTML(e,t){const[n,r]=this.scroll.line(e);if(n){const s=n.length();return!(n.length()>=r+t)||0===r&&t===s?io(this.scroll,e,t,!0):io(n,r,t,!0)}return""}getText(e,t){return this.getContents(e,t).filter(e=>"string"==typeof e.insert).map(e=>e.insert).join("")}insertContents(e,t){const n=ao(t),r=(new ji).retain(e).concat(n);return this.scroll.insertContents(e,n),this.update(r)}insertEmbed(e,t,n){return this.scroll.insertAt(e,t,n),this.update((new ji).retain(e).insert({[t]:n}))}insertText(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return t=t.replace(/\r\n/g,"\n").replace(/\r/g,"\n"),this.scroll.insertAt(e,t),Object.keys(n).forEach(r=>{this.scroll.formatAt(e,t.length,r,n[r])}),this.update((new ji).retain(e).insert(t,as(n)))}isBlank(){if(0===this.scroll.children.length)return!0;if(this.scroll.children.length>1)return!1;const e=this.scroll.children.head;if((null==e?void 0:e.statics.blotName)!==Ri.blotName)return!1;const t=e;return!(t.children.length>1)&&t.children.head instanceof _i}removeFormat(e,t){const n=this.getText(e,t),[r,s]=this.scroll.line(e+t);let i=0,o=new ji;null!=r&&(i=r.length()-s,o=r.delta().slice(s,s+i-1).insert("\n"));const l=this.getContents(e,t+i).diff((new ji).insert(n).concat(o)),a=(new ji).retain(e).concat(l);return this.applyDelta(a)}update(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;const r=this.delta;if(1===t.length&&"characterData"===t[0].type&&t[0].target.data.match(no)&&this.scroll.find(t[0].target)){const s=this.scroll.find(t[0].target),i=Di(s),o=s.offset(this.scroll),l=t[0].oldValue.replace(Fi.CONTENTS,""),a=(new ji).insert(l),c=(new ji).insert(s.value()),u=n&&{oldRange:co(n.oldRange,-o),newRange:co(n.newRange,-o)};e=(new ji).retain(o).concat(a.diff(c,u)).reduce((e,t)=>t.insert?e.insert(t.insert,i):e.push(t),new ji),this.delta=r.compose(e)}else this.delta=this.getDelta(),e&&_s(r.compose(e),this.delta)||(e=r.diff(this.delta,n));return e}}function so(e,t,n){if(0===e.length){const[e]=lo(n.pop());return t<=0?`</li></${e}>`:`</li></${e}>${so([],t-1,n)}`}const[{child:r,offset:s,length:i,indent:o,type:l},...a]=e,[c,u]=lo(l);if(o>t)return n.push(l),o===t+1?`<${c}><li${u}>${io(r,s,i)}${so(a,o,n)}`:`<${c}><li>${so(e,t+1,n)}`;const d=n[n.length-1];if(o===t&&l===d)return`</li><li${u}>${io(r,s,i)}${so(a,o,n)}`;const[h]=lo(n.pop());return`</li></${h}>${so(e,t-1,n)}`}function io(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if("html"in e&&"function"==typeof e.html)return e.html(t,n);if(e instanceof Oi){return Li(e.value().slice(t,t+n)).replaceAll(" ","&nbsp;")}if(e instanceof Zs){if("list-container"===e.statics.blotName){const r=[];return e.children.forEachAt(t,n,(e,t,n)=>{const s="formats"in e&&"function"==typeof e.formats?e.formats():{};r.push({child:e,offset:t,length:n,indent:s.indent||0,type:s.list})}),so(r,-1,[])}const s=[];if(e.children.forEachAt(t,n,(e,t,n)=>{s.push(io(e,t,n))}),r||"list"===e.statics.blotName)return s.join("");const{outerHTML:i,innerHTML:o}=e.domNode,[l,a]=i.split(`>${o}<`);return"<table"===l?`<table style="border: 1px solid #000;">${s.join("")}<${a}`:`${l}>${s.join("")}<${a}`}return e.domNode instanceof Element?e.domNode.outerHTML:""}function oo(e,t){return Object.keys(t).reduce((n,r)=>{if(null==e[r])return n;const s=t[r];return s===e[r]?n[r]=s:Array.isArray(s)?s.indexOf(e[r])<0?n[r]=s.concat([e[r]]):n[r]=s:n[r]=[s,e[r]],n},{})}function lo(e){const t="ordered"===e?"ol":"ul";switch(e){case"checked":return[t,' data-list="checked"'];case"unchecked":return[t,' data-list="unchecked"'];default:return[t,""]}}function ao(e){return e.reduce((e,t)=>{if("string"==typeof t.insert){const n=t.insert.replace(/\r\n/g,"\n").replace(/\r/g,"\n");return e.insert(n,t.attributes)}return e.push(t)},new ji)}function co(e,t){let{index:n,length:r}=e;return new Qi(n+t,r)}class uo{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.quill=e,this.options=t}}t(uo,"DEFAULTS",{});const ho="\ufeff";class fo extends ni{constructor(e,t){super(e,t),this.contentNode=document.createElement("span"),this.contentNode.setAttribute("contenteditable","false"),Array.from(this.domNode.childNodes).forEach(e=>{this.contentNode.appendChild(e)}),this.leftGuard=document.createTextNode(ho),this.rightGuard=document.createTextNode(ho),this.domNode.appendChild(this.leftGuard),this.domNode.appendChild(this.contentNode),this.domNode.appendChild(this.rightGuard)}index(e,t){return e===this.leftGuard?0:e===this.rightGuard?1:super.index(e,t)}restore(e){let t,n=null;const r=e.data.split(ho).join("");if(e===this.leftGuard)if(this.prev instanceof Oi){const e=this.prev.length();this.prev.insertAt(e,r),n={startNode:this.prev.domNode,startOffset:e+r.length}}else t=document.createTextNode(r),this.parent.insertBefore(this.scroll.create(t),this),n={startNode:t,startOffset:r.length};else e===this.rightGuard&&(this.next instanceof Oi?(this.next.insertAt(0,r),n={startNode:this.next.domNode,startOffset:r.length}):(t=document.createTextNode(r),this.parent.insertBefore(this.scroll.create(t),this.next),n={startNode:t,startOffset:r.length}));return e.data=ho,n}update(e,t){e.forEach(e=>{if("characterData"===e.type&&(e.target===this.leftGuard||e.target===this.rightGuard)){const n=this.restore(e.target);n&&(t.range=n)}})}}class po{constructor(e,n){t(this,"isComposing",!1),this.scroll=e,this.emitter=n,this.setupListeners()}setupListeners(){this.scroll.domNode.addEventListener("compositionstart",e=>{this.isComposing||this.handleCompositionStart(e)}),this.scroll.domNode.addEventListener("compositionend",e=>{this.isComposing&&queueMicrotask(()=>{this.handleCompositionEnd(e)})})}handleCompositionStart(e){const t=e.target instanceof Node?this.scroll.find(e.target,!0):null;!t||t instanceof fo||(this.emitter.emit(Ji.events.COMPOSITION_BEFORE_START,e),this.scroll.batchStart(),this.emitter.emit(Ji.events.COMPOSITION_START,e),this.isComposing=!0)}handleCompositionEnd(e){this.emitter.emit(Ji.events.COMPOSITION_BEFORE_END,e),this.scroll.batchEnd(),this.emitter.emit(Ji.events.COMPOSITION_END,e),this.isComposing=!1}}const mo=class{constructor(e,n){t(this,"modules",{}),this.quill=e,this.options=n}init(){Object.keys(this.options.modules).forEach(e=>{null==this.modules[e]&&this.addModule(e)})}addModule(e){const t=this.quill.constructor.import(`modules/${e}`);return this.modules[e]=new t(this.quill,this.options.modules[e]||{}),this.modules[e]}};t(mo,"DEFAULTS",{modules:{}}),t(mo,"themes",{default:mo});let go=mo;const vo=e=>e.parentElement||e.getRootNode().host||null,bo=e=>{const t=e.getBoundingClientRect(),n="offsetWidth"in e&&Math.abs(t.width)/e.offsetWidth||1,r="offsetHeight"in e&&Math.abs(t.height)/e.offsetHeight||1;return{top:t.top,right:t.left+e.clientWidth*n,bottom:t.top+e.clientHeight*r,left:t.left}},yo=e=>{const t=parseInt(e,10);return Number.isNaN(t)?0:t},xo=(e,t,n,r,s,i)=>e<n&&t>r?0:e<n?-(n-e+s):t>r?t-e>r-n?e+s-n:t-r+i:0,wo=["block","break","cursor","inline","scroll","text"],No=Zi("quill"),Eo=new Ms;Zs.uiClass="ql-ui";const ko=class e{static debug(e){!0===e&&(e="log"),Zi.level(e)}static find(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Hi.get(e)||Eo.find(e,t)}static import(e){return null==this.imports[e]&&No.error(`Cannot import ${e}. Are you sure it was registered?`),this.imports[e]}static register(){if("string"!=typeof(arguments.length<=0?void 0:arguments[0])){const e=arguments.length<=0?void 0:arguments[0],t=!!(arguments.length<=1?void 0:arguments[1]),n="attrName"in e?e.attrName:e.blotName;"string"==typeof n?this.register(`formats/${n}`,e,t):Object.keys(e).forEach(n=>{this.register(n,e[n],t)})}else{const e=arguments.length<=0?void 0:arguments[0],t=arguments.length<=1?void 0:arguments[1],n=!!(arguments.length<=2?void 0:arguments[2]);null==this.imports[e]||n||No.warn(`Overwriting ${e} with`,t),this.imports[e]=t,(e.startsWith("blots/")||e.startsWith("formats/"))&&t&&"boolean"!=typeof t&&"abstract"!==t.blotName&&Eo.register(t),"function"==typeof t.register&&t.register(Eo)}}constructor(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.options=function(e,t){const n=Ao(e);if(!n)throw new Error("Invalid Quill container");const r=!t.theme||t.theme===So.DEFAULTS.theme,s=r?go:So.import(`themes/${t.theme}`);if(!s)throw new Error(`Invalid theme ${t.theme}. Did you register it?`);const{modules:i,...o}=So.DEFAULTS,{modules:l,...a}=s.DEFAULTS;let c=Co(t.modules);null!=c&&c.toolbar&&c.toolbar.constructor!==Object&&(c={...c,toolbar:{container:c.toolbar}});const u=Ts({},Co(i),Co(l),c),d={...o,...jo(a),...jo(t)};let h=t.registry;h?t.formats&&No.warn('Ignoring "formats" option because "registry" is specified'):h=t.formats?((e,t,n)=>{const r=new Ms;return wo.forEach(e=>{const n=t.query(e);n&&r.register(n)}),e.forEach(e=>{let s=t.query(e);s||n.error(`Cannot register "${e}" specified in "formats" config. Are you sure it was registered?`);let i=0;for(;s;)if(r.register(s),s="blotName"in s?s.requiredContainer??null:null,i+=1,i>100){n.error(`Cycle detected in registering blot requiredContainer: "${e}"`);break}}),r})(t.formats,d.registry,No):d.registry;return{...d,registry:h,container:n,theme:s,modules:Object.entries(u).reduce((e,t)=>{let[n,r]=t;if(!r)return e;const s=So.import(`modules/${n}`);return null==s?(No.error(`Cannot load ${n} module. Are you sure you registered it?`),e):{...e,[n]:Ts({},s.DEFAULTS||{},r)}},{}),bounds:Ao(d.bounds)}}(t,n),this.container=this.options.container,null==this.container)return void No.error("Invalid Quill container",t);this.options.debug&&e.debug(this.options.debug);const r=this.container.innerHTML.trim();this.container.classList.add("ql-container"),this.container.innerHTML="",Hi.set(this.container,this),this.root=this.addContainer("ql-editor"),this.root.classList.add("ql-blank"),this.emitter=new Ji;const s=ii.blotName,i=this.options.registry.query(s);if(!i||!("blotName"in i))throw new Error(`Cannot initialize Quill without "${s}" blot`);if(this.scroll=new i(this.options.registry,this.root,{emitter:this.emitter}),this.editor=new ro(this.scroll),this.selection=new eo(this.scroll,this.emitter),this.composition=new po(this.scroll,this.emitter),this.theme=new this.options.theme(this,this.options),this.keyboard=this.theme.addModule("keyboard"),this.clipboard=this.theme.addModule("clipboard"),this.history=this.theme.addModule("history"),this.uploader=this.theme.addModule("uploader"),this.theme.addModule("input"),this.theme.addModule("uiNode"),this.theme.init(),this.emitter.on(Ji.events.EDITOR_CHANGE,e=>{e===Ji.events.TEXT_CHANGE&&this.root.classList.toggle("ql-blank",this.editor.isBlank())}),this.emitter.on(Ji.events.SCROLL_UPDATE,(e,t)=>{const n=this.selection.lastRange,[r]=this.selection.getRange(),s=n&&r?{oldRange:n,newRange:r}:void 0;_o.call(this,()=>this.editor.update(null,t,s),e)}),this.emitter.on(Ji.events.SCROLL_EMBED_UPDATE,(t,n)=>{const r=this.selection.lastRange,[s]=this.selection.getRange(),i=r&&s?{oldRange:r,newRange:s}:void 0;_o.call(this,()=>{const e=(new ji).retain(t.offset(this)).retain({[t.statics.blotName]:n});return this.editor.update(e,[],i)},e.sources.USER)}),r){const e=this.clipboard.convert({html:`${r}<p><br></p>`,text:"\n"});this.setContents(e)}this.history.clear(),this.options.placeholder&&this.root.setAttribute("data-placeholder",this.options.placeholder),this.options.readOnly&&this.disable(),this.allowReadOnlyEdits=!1}addContainer(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if("string"==typeof e){const t=e;(e=document.createElement("div")).classList.add(t)}return this.container.insertBefore(e,t),e}blur(){this.selection.setRange(null)}deleteText(e,t,n){return[e,t,,n]=Oo(e,t,n),_o.call(this,()=>this.editor.deleteText(e,t),n,e,-1*t)}disable(){this.enable(!1)}editReadOnly(e){this.allowReadOnlyEdits=!0;const t=e();return this.allowReadOnlyEdits=!1,t}enable(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.scroll.enable(e),this.container.classList.toggle("ql-disabled",!e)}focus(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.selection.focus(),e.preventScroll||this.scrollSelectionIntoView()}format(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Ji.sources.API;return _o.call(this,()=>{const n=this.getSelection(!0);let r=new ji;if(null==n)return r;if(this.scroll.query(e,Ls.BLOCK))r=this.editor.formatLine(n.index,n.length,{[e]:t});else{if(0===n.length)return this.selection.format(e,t),r;r=this.editor.formatText(n.index,n.length,{[e]:t})}return this.setSelection(n,Ji.sources.SILENT),r},n)}formatLine(e,t,n,r,s){let i;return[e,t,i,s]=Oo(e,t,n,r,s),_o.call(this,()=>this.editor.formatLine(e,t,i),s,e,0)}formatText(e,t,n,r,s){let i;return[e,t,i,s]=Oo(e,t,n,r,s),_o.call(this,()=>this.editor.formatText(e,t,i),s,e,0)}getBounds(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=null;if(n="number"==typeof e?this.selection.getBounds(e,t):this.selection.getBounds(e.index,e.length),!n)return null;const r=this.container.getBoundingClientRect();return{bottom:n.bottom-r.top,height:n.height,left:n.left-r.left,right:n.right-r.left,top:n.top-r.top,width:n.width}}getContents(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.getLength()-e;return[e,t]=Oo(e,t),this.editor.getContents(e,t)}getFormat(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.getSelection(!0),t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return"number"==typeof e?this.editor.getFormat(e,t):this.editor.getFormat(e.index,e.length)}getIndex(e){return e.offset(this.scroll)}getLength(){return this.scroll.length()}getLeaf(e){return this.scroll.leaf(e)}getLine(e){return this.scroll.line(e)}getLines(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Number.MAX_VALUE;return"number"!=typeof e?this.scroll.lines(e.index,e.length):this.scroll.lines(e,t)}getModule(e){return this.theme.modules[e]}getSelection(){return arguments.length>0&&void 0!==arguments[0]&&arguments[0]&&this.focus(),this.update(),this.selection.getRange()[0]}getSemanticHTML(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1?arguments[1]:void 0;return"number"==typeof e&&(t=t??this.getLength()-e),[e,t]=Oo(e,t),this.editor.getHTML(e,t)}getText(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1?arguments[1]:void 0;return"number"==typeof e&&(t=t??this.getLength()-e),[e,t]=Oo(e,t),this.editor.getText(e,t)}hasFocus(){return this.selection.hasFocus()}insertEmbed(t,n,r){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:e.sources.API;return _o.call(this,()=>this.editor.insertEmbed(t,n,r),s,t)}insertText(e,t,n,r,s){let i;return[e,,i,s]=Oo(e,0,n,r,s),_o.call(this,()=>this.editor.insertText(e,t,i),s,e,t.length)}isEnabled(){return this.scroll.isEnabled()}off(){return this.emitter.off(...arguments)}on(){return this.emitter.on(...arguments)}once(){return this.emitter.once(...arguments)}removeFormat(e,t,n){return[e,t,,n]=Oo(e,t,n),_o.call(this,()=>this.editor.removeFormat(e,t),n,e)}scrollRectIntoView(e){((e,t)=>{var n,r,s;const i=e.ownerDocument;let o=t,l=e;for(;l;){const e=l===i.body,t=e?{top:0,right:(null==(n=window.visualViewport)?void 0:n.width)??i.documentElement.clientWidth,bottom:(null==(r=window.visualViewport)?void 0:r.height)??i.documentElement.clientHeight,left:0}:bo(l),a=getComputedStyle(l),c=xo(o.left,o.right,t.left,t.right,yo(a.scrollPaddingLeft),yo(a.scrollPaddingRight)),u=xo(o.top,o.bottom,t.top,t.bottom,yo(a.scrollPaddingTop),yo(a.scrollPaddingBottom));if(c||u)if(e)null==(s=i.defaultView)||s.scrollBy(c,u);else{const{scrollLeft:e,scrollTop:t}=l;u&&(l.scrollTop+=u),c&&(l.scrollLeft+=c);const n=l.scrollLeft-e,r=l.scrollTop-t;o={left:o.left-n,top:o.top-r,right:o.right-n,bottom:o.bottom-r}}l=e||"fixed"===a.position?null:vo(l)}})(this.root,e)}scrollIntoView(){this.scrollSelectionIntoView()}scrollSelectionIntoView(){const e=this.selection.lastRange,t=e&&this.selection.getBounds(e.index,e.length);t&&this.scrollRectIntoView(t)}setContents(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ji.sources.API;return _o.call(this,()=>{e=new ji(e);const t=this.getLength(),n=this.editor.deleteText(0,t),r=this.editor.insertContents(0,e),s=this.editor.deleteText(this.getLength()-1,1);return n.compose(r).compose(s)},t)}setSelection(t,n,r){null==t?this.selection.setRange(null,n||e.sources.API):([t,n,,r]=Oo(t,n,r),this.selection.setRange(new Qi(Math.max(0,t),n),r),r!==Ji.sources.SILENT&&this.scrollSelectionIntoView())}setText(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ji.sources.API;const n=(new ji).insert(e);return this.setContents(n,t)}update(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ji.sources.USER;const t=this.scroll.update(e);return this.selection.update(e),t}updateContents(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ji.sources.API;return _o.call(this,()=>(e=new ji(e),this.editor.applyDelta(e)),t,!0)}};t(ko,"DEFAULTS",{bounds:null,modules:{clipboard:!0,keyboard:!0,history:!0,uploader:!0},placeholder:"",readOnly:!1,registry:Eo,theme:"default"}),t(ko,"events",Ji.events),t(ko,"sources",Ji.sources),t(ko,"version","2.0.3"),t(ko,"imports",{delta:ji,parchment:ai,"core/module":uo,"core/theme":go});let So=ko;function Ao(e){return"string"==typeof e?document.querySelector(e):e}function Co(e){return Object.entries(e??{}).reduce((e,t)=>{let[n,r]=t;return{...e,[n]:!0===r?{}:r}},{})}function jo(e){return Object.fromEntries(Object.entries(e).filter(e=>void 0!==e[1]))}function _o(e,t,n,r){if(!this.isEnabled()&&t===Ji.sources.USER&&!this.allowReadOnlyEdits)return new ji;let s=null==n?null:this.getSelection();const i=this.editor.delta,o=e();if(null!=s&&(!0===n&&(n=s.index),null==r?s=To(s,o,t):0!==r&&(s=To(s,n,r,t)),this.setSelection(s,Ji.sources.SILENT)),o.length()>0){const e=[Ji.events.TEXT_CHANGE,o,i,t];this.emitter.emit(Ji.events.EDITOR_CHANGE,...e),t!==Ji.sources.SILENT&&this.emitter.emit(...e)}return o}function Oo(e,t,n,r,s){let i={};return"number"==typeof e.index&&"number"==typeof e.length?"number"!=typeof t?(s=r,r=n,n=t,t=e.length,e=e.index):(t=e.length,e=e.index):"number"!=typeof t&&(s=r,r=n,n=t,t=0),"object"==typeof n?(i=n,s=r):"string"==typeof n&&(null!=r?i[n]=r:s=n),[e,t,i,s=s||Ji.sources.API]}function To(e,t,n,r){const s="number"==typeof n?n:0;if(null==e)return null;let i,o;return t&&"function"==typeof t.transformPosition?[i,o]=[e.index,e.index+e.length].map(e=>t.transformPosition(e,r!==Ji.sources.USER)):[i,o]=[e.index,e.index+e.length].map(e=>e<t||e===t&&r===Ji.sources.USER?e:s>=0?e+s:Math.max(t,e+s)),new Qi(i,o-i)}class Lo extends ti{}function qo(e){return e instanceof Ri||e instanceof Mi}function Io(e){return"function"==typeof e.updateContent}class Ro extends ii{constructor(e,t,n){let{emitter:r}=n;super(e,t),this.emitter=r,this.batch=!1,this.optimize(),this.enable(),this.domNode.addEventListener("dragstart",e=>this.handleDragStart(e))}batchStart(){Array.isArray(this.batch)||(this.batch=[])}batchEnd(){if(!this.batch)return;const e=this.batch;this.batch=!1,this.update(e)}emitMount(e){this.emitter.emit(Ji.events.SCROLL_BLOT_MOUNT,e)}emitUnmount(e){this.emitter.emit(Ji.events.SCROLL_BLOT_UNMOUNT,e)}emitEmbedUpdate(e,t){this.emitter.emit(Ji.events.SCROLL_EMBED_UPDATE,e,t)}deleteAt(e,t){const[n,r]=this.line(e),[s]=this.line(e+t);if(super.deleteAt(e,t),null!=s&&n!==s&&r>0){if(n instanceof Mi||s instanceof Mi)return void this.optimize();const e=s.children.head instanceof _i?null:s.children.head;n.moveChildren(s,e),n.remove()}this.optimize()}enable(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.domNode.setAttribute("contenteditable",e?"true":"false")}formatAt(e,t,n,r){super.formatAt(e,t,n,r),this.optimize()}insertAt(e,t,n){if(e>=this.length())if(null==n||null==this.scroll.query(t,Ls.BLOCK)){const e=this.scroll.create(this.statics.defaultChild.blotName);this.appendChild(e),null==n&&t.endsWith("\n")?e.insertAt(0,t.slice(0,-1),n):e.insertAt(0,t,n)}else{const e=this.scroll.create(t,n);this.appendChild(e)}else super.insertAt(e,t,n);this.optimize()}insertBefore(e,t){if(e.statics.scope===Ls.INLINE_BLOT){const n=this.scroll.create(this.statics.defaultChild.blotName);n.appendChild(e),super.insertBefore(n,t)}else super.insertBefore(e,t)}insertContents(e,t){const n=this.deltaToRenderBlocks(t.concat((new ji).insert("\n"))),r=n.pop();if(null==r)return;this.batchStart();const s=n.shift();if(s){const t="block"===s.type&&(0===s.delta.length()||!this.descendant(Mi,e)[0]&&e<this.length()),n="block"===s.type?s.delta:(new ji).insert({[s.key]:s.value});Mo(this,e,n);const r="block"===s.type?1:0,i=e+n.length()+r;t&&this.insertAt(i-1,"\n");const o=Di(this.line(e)[0]),l=Ci.AttributeMap.diff(o,s.attributes)||{};Object.keys(l).forEach(e=>{this.formatAt(i-1,1,e,l[e])}),e=i}let[i,o]=this.children.find(e);if(n.length&&(i&&(i=i.split(o),o=0),n.forEach(e=>{if("block"===e.type){Mo(this.createBlock(e.attributes,i||void 0),0,e.delta)}else{const t=this.create(e.key,e.value);this.insertBefore(t,i||void 0),Object.keys(e.attributes).forEach(n=>{t.format(n,e.attributes[n])})}})),"block"===r.type&&r.delta.length()){Mo(this,i?i.offset(i.scroll)+o:this.length(),r.delta)}this.batchEnd(),this.optimize()}isEnabled(){return"true"===this.domNode.getAttribute("contenteditable")}leaf(e){const t=this.path(e).pop();if(!t)return[null,-1];const[n,r]=t;return n instanceof Hs?[n,r]:[null,-1]}line(e){return e===this.length()?this.line(e-1):this.descendant(qo,e)}lines(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Number.MAX_VALUE;const n=(e,t,r)=>{let s=[],i=r;return e.children.forEachAt(t,r,(e,t,r)=>{qo(e)?s.push(e):e instanceof ti&&(s=s.concat(n(e,t,i))),i-=r}),s};return n(this,e,t)}optimize(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.batch||(super.optimize(e,t),e.length>0&&this.emitter.emit(Ji.events.SCROLL_OPTIMIZE,e,t))}path(e){return super.path(e).slice(1)}remove(){}update(e){if(this.batch)return void(Array.isArray(e)&&(this.batch=this.batch.concat(e)));let t=Ji.sources.USER;"string"==typeof e&&(t=e),Array.isArray(e)||(e=this.observer.takeRecords()),(e=e.filter(e=>{let{target:t}=e;const n=this.find(t,!0);return n&&!Io(n)})).length>0&&this.emitter.emit(Ji.events.SCROLL_BEFORE_UPDATE,t,e),super.update(e.concat([])),e.length>0&&this.emitter.emit(Ji.events.SCROLL_UPDATE,t,e)}updateEmbedAt(e,t,n){const[r]=this.descendant(e=>e instanceof Mi,e);r&&r.statics.blotName===t&&Io(r)&&r.updateContent(n)}handleDragStart(e){e.preventDefault()}deltaToRenderBlocks(e){const t=[];let n=new ji;return e.forEach(e=>{const r=null==e?void 0:e.insert;if(r)if("string"==typeof r){const s=r.split("\n");s.slice(0,-1).forEach(r=>{n.insert(r,e.attributes),t.push({type:"block",delta:n,attributes:e.attributes??{}}),n=new ji});const i=s[s.length-1];i&&n.insert(i,e.attributes)}else{const s=Object.keys(r)[0];if(!s)return;this.query(s,Ls.INLINE)?n.push(e):(n.length()&&t.push({type:"block",delta:n,attributes:{}}),n=new ji,t.push({type:"blockEmbed",key:s,value:r[s],attributes:e.attributes??{}}))}}),n.length()&&t.push({type:"block",delta:n,attributes:{}}),t}createBlock(e,t){let n;const r={};Object.entries(e).forEach(e=>{let[t,s]=e;null!=this.query(t,Ls.BLOCK&Ls.BLOT)?n=t:r[t]=s});const s=this.create(n||this.statics.defaultChild.blotName,n?e[n]:void 0);this.insertBefore(s,t||void 0);const i=s.length();return Object.entries(r).forEach(e=>{let[t,n]=e;s.formatAt(0,i,t,n)}),s}}function Mo(e,t,n){n.reduce((t,n)=>{const r=Ci.Op.length(n);let s=n.attributes||{};if(null!=n.insert)if("string"==typeof n.insert){const r=n.insert;e.insertAt(t,r);const[i]=e.descendant(Hs,t),o=Di(i);s=Ci.AttributeMap.diff(o,s)||{}}else if("object"==typeof n.insert){const r=Object.keys(n.insert)[0];if(null==r)return t;e.insertAt(t,r,n.insert[r]);if(null!=e.scroll.query(r,Ls.INLINE)){const[n]=e.descendant(Hs,t),r=Di(n);s=Ci.AttributeMap.diff(r,s)||{}}}return Object.keys(s).forEach(n=>{e.formatAt(t,r,n,s[n])}),t+r},t)}t(Ro,"blotName","scroll"),t(Ro,"className","ql-editor"),t(Ro,"tagName","DIV"),t(Ro,"defaultChild",Ri),t(Ro,"allowedChildren",[Ri,Mi,Lo]);const Bo={scope:Ls.BLOCK,whitelist:["right","center","justify"]},Do=new qs("align","align",Bo),Po=new Ds("align","ql-align",Bo),Fo=new Fs("align","text-align",Bo);class Uo extends Fs{value(e){let t=super.value(e);if(!t.startsWith("rgb("))return t;t=t.replace(/^[^\d]+/,"").replace(/[^\d]+$/,"");return`#${t.split(",").map(e=>`00${parseInt(e,10).toString(16)}`.slice(-2)).join("")}`}}const zo=new Ds("color","ql-color",{scope:Ls.INLINE}),$o=new Uo("color","color",{scope:Ls.INLINE}),Vo=new Ds("background","ql-bg",{scope:Ls.INLINE}),Ho=new Uo("background","background-color",{scope:Ls.INLINE});class Ko extends Lo{static create(e){const t=super.create(e);return t.setAttribute("spellcheck","false"),t}code(e,t){return this.children.map(e=>e.length()<=1?"":e.domNode.innerText).join("\n").slice(e,e+t)}html(e,t){return`<pre>\n${Li(this.code(e,t))}\n</pre>`}}class Wo extends Ri{static register(){So.register(Ko)}}t(Wo,"TAB"," ");class Go extends Ii{}Go.blotName="code",Go.tagName="CODE",Wo.blotName="code-block",Wo.className="ql-code-block",Wo.tagName="DIV",Ko.blotName="code-block-container",Ko.className="ql-code-block-container",Ko.tagName="DIV",Ko.allowedChildren=[Wo],Wo.allowedChildren=[Oi,_i,Fi],Wo.requiredContainer=Ko;const Zo={scope:Ls.BLOCK,whitelist:["rtl"]},Yo=new qs("direction","dir",Zo),Jo=new Ds("direction","ql-direction",Zo),Xo=new Fs("direction","direction",Zo),Qo={scope:Ls.INLINE,whitelist:["serif","monospace"]},el=new Ds("font","ql-font",Qo);const tl=new class extends Fs{value(e){return super.value(e).replace(/["']/g,"")}}("font","font-family",Qo),nl=new Ds("size","ql-size",{scope:Ls.INLINE,whitelist:["small","large","huge"]}),rl=new Fs("size","font-size",{scope:Ls.INLINE,whitelist:["10px","18px","32px"]}),sl=Zi("quill:keyboard"),il=/Mac/i.test(navigator.platform)?"metaKey":"ctrlKey";class ol extends uo{static match(e,t){return!["altKey","ctrlKey","metaKey","shiftKey"].some(n=>!!t[n]!==e[n]&&null!==t[n])&&(t.key===e.key||t.key===e.which)}constructor(e,t){super(e,t),this.bindings={},Object.keys(this.options.bindings).forEach(e=>{this.options.bindings[e]&&this.addBinding(this.options.bindings[e])}),this.addBinding({key:"Enter",shiftKey:null},this.handleEnter),this.addBinding({key:"Enter",metaKey:null,ctrlKey:null,altKey:null},()=>{}),/Firefox/i.test(navigator.userAgent)?(this.addBinding({key:"Backspace"},{collapsed:!0},this.handleBackspace),this.addBinding({key:"Delete"},{collapsed:!0},this.handleDelete)):(this.addBinding({key:"Backspace"},{collapsed:!0,prefix:/^.?$/},this.handleBackspace),this.addBinding({key:"Delete"},{collapsed:!0,suffix:/^.?$/},this.handleDelete)),this.addBinding({key:"Backspace"},{collapsed:!1},this.handleDeleteRange),this.addBinding({key:"Delete"},{collapsed:!1},this.handleDeleteRange),this.addBinding({key:"Backspace",altKey:null,ctrlKey:null,metaKey:null,shiftKey:null},{collapsed:!0,offset:0},this.handleBackspace),this.listen()}addBinding(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=function(e){if("string"==typeof e||"number"==typeof e)e={key:e};else{if("object"!=typeof e)return null;e=as(e)}e.shortKey&&(e[il]=e.shortKey,delete e.shortKey);return e}(e);if(null==r)return void sl.warn("Attempted to add invalid keyboard binding",r);"function"==typeof t&&(t={handler:t}),"function"==typeof n&&(n={handler:n});(Array.isArray(r.key)?r.key:[r.key]).forEach(e=>{const s={...r,key:e,...t,...n};this.bindings[s.key]=this.bindings[s.key]||[],this.bindings[s.key].push(s)})}listen(){this.quill.root.addEventListener("keydown",e=>{if(e.defaultPrevented||e.isComposing)return;if(229===e.keyCode&&("Enter"===e.key||"Backspace"===e.key))return;const t=(this.bindings[e.key]||[]).concat(this.bindings[e.which]||[]).filter(t=>ol.match(e,t));if(0===t.length)return;const n=So.find(e.target,!0);if(n&&n.scroll!==this.quill.scroll)return;const r=this.quill.getSelection();if(null==r||!this.quill.hasFocus())return;const[s,i]=this.quill.getLine(r.index),[o,l]=this.quill.getLeaf(r.index),[a,c]=0===r.length?[o,l]:this.quill.getLeaf(r.index+r.length),u=o instanceof li?o.value().slice(0,l):"",d=a instanceof li?a.value().slice(c):"",h={collapsed:0===r.length,empty:0===r.length&&s.length()<=1,format:this.quill.getFormat(r),line:s,offset:i,prefix:u,suffix:d,event:e};t.some(e=>{if(null!=e.collapsed&&e.collapsed!==h.collapsed)return!1;if(null!=e.empty&&e.empty!==h.empty)return!1;if(null!=e.offset&&e.offset!==h.offset)return!1;if(Array.isArray(e.format)){if(e.format.every(e=>null==h.format[e]))return!1}else if("object"==typeof e.format&&!Object.keys(e.format).every(t=>!0===e.format[t]?null!=h.format[t]:!1===e.format[t]?null==h.format[t]:_s(e.format[t],h.format[t])))return!1;return!(null!=e.prefix&&!e.prefix.test(h.prefix))&&(!(null!=e.suffix&&!e.suffix.test(h.suffix))&&!0!==e.handler.call(this,r,h,e))})&&e.preventDefault()})}handleBackspace(e,t){const n=/[\uD800-\uDBFF][\uDC00-\uDFFF]$/.test(t.prefix)?2:1;if(0===e.index||this.quill.getLength()<=1)return;let r={};const[s]=this.quill.getLine(e.index);let i=(new ji).retain(e.index-n).delete(n);if(0===t.offset){const[t]=this.quill.getLine(e.index-1);if(t){if(!("block"===t.statics.blotName&&t.length()<=1)){const t=s.formats(),n=this.quill.getFormat(e.index-1,1);if(r=Ci.AttributeMap.diff(t,n)||{},Object.keys(r).length>0){const t=(new ji).retain(e.index+s.length()-2).retain(1,r);i=i.compose(t)}}}}this.quill.updateContents(i,So.sources.USER),this.quill.focus()}handleDelete(e,t){const n=/^[\uD800-\uDBFF][\uDC00-\uDFFF]/.test(t.suffix)?2:1;if(e.index>=this.quill.getLength()-n)return;let r={};const[s]=this.quill.getLine(e.index);let i=(new ji).retain(e.index).delete(n);if(t.offset>=s.length()-1){const[t]=this.quill.getLine(e.index+1);if(t){const n=s.formats(),o=this.quill.getFormat(e.index,1);r=Ci.AttributeMap.diff(n,o)||{},Object.keys(r).length>0&&(i=i.retain(t.length()-1).retain(1,r))}}this.quill.updateContents(i,So.sources.USER),this.quill.focus()}handleDeleteRange(e){hl({range:e,quill:this.quill}),this.quill.focus()}handleEnter(e,t){const n=Object.keys(t.format).reduce((e,n)=>(this.quill.scroll.query(n,Ls.BLOCK)&&!Array.isArray(t.format[n])&&(e[n]=t.format[n]),e),{}),r=(new ji).retain(e.index).delete(e.length).insert("\n",n);this.quill.updateContents(r,So.sources.USER),this.quill.setSelection(e.index+1,So.sources.SILENT),this.quill.focus()}}const ll={bindings:{bold:ul("bold"),italic:ul("italic"),underline:ul("underline"),indent:{key:"Tab",format:["blockquote","indent","list"],handler(e,t){return!(!t.collapsed||0===t.offset)||(this.quill.format("indent","+1",So.sources.USER),!1)}},outdent:{key:"Tab",shiftKey:!0,format:["blockquote","indent","list"],handler(e,t){return!(!t.collapsed||0===t.offset)||(this.quill.format("indent","-1",So.sources.USER),!1)}},"outdent backspace":{key:"Backspace",collapsed:!0,shiftKey:null,metaKey:null,ctrlKey:null,altKey:null,format:["indent","list"],offset:0,handler(e,t){null!=t.format.indent?this.quill.format("indent","-1",So.sources.USER):null!=t.format.list&&this.quill.format("list",!1,So.sources.USER)}},"indent code-block":al(!0),"outdent code-block":al(!1),"remove tab":{key:"Tab",shiftKey:!0,collapsed:!0,prefix:/\t$/,handler(e){this.quill.deleteText(e.index-1,1,So.sources.USER)}},tab:{key:"Tab",handler(e,t){if(t.format.table)return!0;this.quill.history.cutoff();const n=(new ji).retain(e.index).delete(e.length).insert("\t");return this.quill.updateContents(n,So.sources.USER),this.quill.history.cutoff(),this.quill.setSelection(e.index+1,So.sources.SILENT),!1}},"blockquote empty enter":{key:"Enter",collapsed:!0,format:["blockquote"],empty:!0,handler(){this.quill.format("blockquote",!1,So.sources.USER)}},"list empty enter":{key:"Enter",collapsed:!0,format:["list"],empty:!0,handler(e,t){const n={list:!1};t.format.indent&&(n.indent=!1),this.quill.formatLine(e.index,e.length,n,So.sources.USER)}},"checklist enter":{key:"Enter",collapsed:!0,format:{list:"checked"},handler(e){const[t,n]=this.quill.getLine(e.index),r={...t.formats(),list:"checked"},s=(new ji).retain(e.index).insert("\n",r).retain(t.length()-n-1).retain(1,{list:"unchecked"});this.quill.updateContents(s,So.sources.USER),this.quill.setSelection(e.index+1,So.sources.SILENT),this.quill.scrollSelectionIntoView()}},"header enter":{key:"Enter",collapsed:!0,format:["header"],suffix:/^$/,handler(e,t){const[n,r]=this.quill.getLine(e.index),s=(new ji).retain(e.index).insert("\n",t.format).retain(n.length()-r-1).retain(1,{header:null});this.quill.updateContents(s,So.sources.USER),this.quill.setSelection(e.index+1,So.sources.SILENT),this.quill.scrollSelectionIntoView()}},"table backspace":{key:"Backspace",format:["table"],collapsed:!0,offset:0,handler(){}},"table delete":{key:"Delete",format:["table"],collapsed:!0,suffix:/^$/,handler(){}},"table enter":{key:"Enter",shiftKey:null,format:["table"],handler(e){const t=this.quill.getModule("table");if(t){const[n,r,s,i]=t.getTable(e),o=function(e,t,n,r){if(null==t.prev&&null==t.next)return null==n.prev&&null==n.next?0===r?-1:1:null==n.prev?-1:1;if(null==t.prev)return-1;if(null==t.next)return 1;return null}(0,r,s,i);if(null==o)return;let l=n.offset();if(o<0){const t=(new ji).retain(l).insert("\n");this.quill.updateContents(t,So.sources.USER),this.quill.setSelection(e.index+1,e.length,So.sources.SILENT)}else if(o>0){l+=n.length();const e=(new ji).retain(l).insert("\n");this.quill.updateContents(e,So.sources.USER),this.quill.setSelection(l,So.sources.USER)}}}},"table tab":{key:"Tab",shiftKey:null,format:["table"],handler(e,t){const{event:n,line:r}=t,s=r.offset(this.quill.scroll);n.shiftKey?this.quill.setSelection(s-1,So.sources.USER):this.quill.setSelection(s+r.length(),So.sources.USER)}},"list autofill":{key:" ",shiftKey:null,collapsed:!0,format:{"code-block":!1,blockquote:!1,table:!1},prefix:/^\s*?(\d+\.|-|\*|\[ ?\]|\[x\])$/,handler(e,t){if(null==this.quill.scroll.query("list"))return!0;const{length:n}=t.prefix,[r,s]=this.quill.getLine(e.index);if(s>n)return!0;let i;switch(t.prefix.trim()){case"[]":case"[ ]":i="unchecked";break;case"[x]":i="checked";break;case"-":case"*":i="bullet";break;default:i="ordered"}this.quill.insertText(e.index," ",So.sources.USER),this.quill.history.cutoff();const o=(new ji).retain(e.index-s).delete(n+1).retain(r.length()-2-s).retain(1,{list:i});return this.quill.updateContents(o,So.sources.USER),this.quill.history.cutoff(),this.quill.setSelection(e.index-n,So.sources.SILENT),!1}},"code exit":{key:"Enter",collapsed:!0,format:["code-block"],prefix:/^$/,suffix:/^\s*$/,handler(e){const[t,n]=this.quill.getLine(e.index);let r=2,s=t;for(;null!=s&&s.length()<=1&&s.formats()["code-block"];)if(s=s.prev,r-=1,r<=0){const r=(new ji).retain(e.index+t.length()-n-2).retain(1,{"code-block":null}).delete(1);return this.quill.updateContents(r,So.sources.USER),this.quill.setSelection(e.index-1,So.sources.SILENT),!1}return!0}},"embed left":cl("ArrowLeft",!1),"embed left shift":cl("ArrowLeft",!0),"embed right":cl("ArrowRight",!1),"embed right shift":cl("ArrowRight",!0),"table down":dl(!1),"table up":dl(!0)}};function al(e){return{key:"Tab",shiftKey:!e,format:{"code-block":!0},handler(t,n){let{event:r}=n;const s=this.quill.scroll.query("code-block"),{TAB:i}=s;if(0===t.length&&!r.shiftKey)return this.quill.insertText(t.index,i,So.sources.USER),void this.quill.setSelection(t.index+i.length,So.sources.SILENT);const o=0===t.length?this.quill.getLines(t.index,1):this.quill.getLines(t);let{index:l,length:a}=t;o.forEach((t,n)=>{e?(t.insertAt(0,i),0===n?l+=i.length:a+=i.length):t.domNode.textContent.startsWith(i)&&(t.deleteAt(0,i.length),0===n?l-=i.length:a-=i.length)}),this.quill.update(So.sources.USER),this.quill.setSelection(l,a,So.sources.SILENT)}}}function cl(e,t){const n="ArrowLeft"===e?"prefix":"suffix";return{key:e,shiftKey:t,altKey:null,[n]:/^$/,handler(n){let{index:r}=n;"ArrowRight"===e&&(r+=n.length+1);const[s]=this.quill.getLeaf(r);return!(s instanceof ni)||("ArrowLeft"===e?t?this.quill.setSelection(n.index-1,n.length+1,So.sources.USER):this.quill.setSelection(n.index-1,So.sources.USER):t?this.quill.setSelection(n.index,n.length+1,So.sources.USER):this.quill.setSelection(n.index+n.length+1,So.sources.USER),!1)}}}function ul(e){return{key:e[0],shortKey:!0,handler(t,n){this.quill.format(e,!n.format[e],So.sources.USER)}}}function dl(e){return{key:e?"ArrowUp":"ArrowDown",collapsed:!0,format:["table"],handler(t,n){const r=e?"prev":"next",s=n.line,i=s.parent[r];if(null!=i){if("table-row"===i.statics.blotName){let e=i.children.head,t=s;for(;null!=t.prev;)t=t.prev,e=e.next;const r=e.offset(this.quill.scroll)+Math.min(n.offset,e.length()-1);this.quill.setSelection(r,0,So.sources.USER)}}else{const t=s.table()[r];null!=t&&(e?this.quill.setSelection(t.offset(this.quill.scroll)+t.length()-1,0,So.sources.USER):this.quill.setSelection(t.offset(this.quill.scroll),0,So.sources.USER))}return!1}}}function hl(e){let{quill:t,range:n}=e;const r=t.getLines(n);let s={};if(r.length>1){const e=r[0].formats(),t=r[r.length-1].formats();s=Ci.AttributeMap.diff(t,e)||{}}t.deleteText(n,So.sources.USER),Object.keys(s).length>0&&t.formatLine(n.index,1,s,So.sources.USER),t.setSelection(n.index,So.sources.SILENT)}ol.DEFAULTS=ll;const fl=/font-weight:\s*normal/,pl=["P","OL","UL"],ml=e=>e&&pl.includes(e.tagName);const gl=/\bmso-list:[^;]*ignore/i,vl=/\bmso-list:[^;]*\bl(\d+)/i,bl=/\bmso-list:[^;]*\blevel(\d+)/i,yl=e=>{var t,n;const r=Array.from(e.querySelectorAll("[style*=mso-list]")),s=[],i=[];r.forEach(e=>{(e.getAttribute("style")||"").match(gl)?s.push(e):i.push(e)}),s.forEach(e=>{var t;return null==(t=e.parentNode)?void 0:t.removeChild(e)});const o=e.documentElement.innerHTML,l=i.map(e=>((e,t)=>{const n=e.getAttribute("style"),r=null==n?void 0:n.match(vl);if(!r)return null;const s=Number(r[1]),i=null==n?void 0:n.match(bl),o=i?Number(i[1]):1,l=new RegExp(`@list l${s}:level${o}\\s*\\{[^\\}]*mso-level-number-format:\\s*([\\w-]+)`,"i"),a=t.match(l);return{id:s,indent:o,type:a&&"bullet"===a[1]?"bullet":"ordered",element:e}})(e,o)).filter(e=>e);for(;l.length;){const e=[];let r=l.shift();for(;r;)e.push(r),r=l.length&&(null==(t=l[0])?void 0:t.element)===r.element.nextElementSibling&&l[0].id===r.id?l.shift():null;const s=document.createElement("ul");e.forEach(e=>{const t=document.createElement("li");t.setAttribute("data-list",e.type),e.indent>1&&t.setAttribute("class","ql-indent-"+(e.indent-1)),t.innerHTML=e.element.innerHTML,s.appendChild(t)});const i=null==(n=e[0])?void 0:n.element,{parentNode:o}=i??{};i&&(null==o||o.replaceChild(s,i)),e.slice(1).forEach(e=>{let{element:t}=e;null==o||o.removeChild(t)})}};const xl=[function(e){"urn:schemas-microsoft-com:office:word"===e.documentElement.getAttribute("xmlns:w")&&yl(e)},function(e){e.querySelector('[id^="docs-internal-guid-"]')&&((e=>{Array.from(e.querySelectorAll('b[style*="font-weight"]')).filter(e=>{var t;return null==(t=e.getAttribute("style"))?void 0:t.match(fl)}).forEach(t=>{var n;const r=e.createDocumentFragment();r.append(...t.childNodes),null==(n=t.parentNode)||n.replaceChild(r,t)})})(e),(e=>{Array.from(e.querySelectorAll("br")).filter(e=>ml(e.previousElementSibling)&&ml(e.nextElementSibling)).forEach(e=>{var t;null==(t=e.parentNode)||t.removeChild(e)})})(e))}],wl=Zi("quill:clipboard"),Nl=[[Node.TEXT_NODE,function(e,t,n){var r;let s=e.data;if("O:P"===(null==(r=e.parentElement)?void 0:r.tagName))return t.insert(s.trim());if(!Ol(e)){if(0===s.trim().length&&s.includes("\n")&&!function(e,t){return e.previousElementSibling&&e.nextElementSibling&&!jl(e.previousElementSibling,t)&&!jl(e.nextElementSibling,t)}(e,n))return t;s=s.replace(/[^\S\u00a0]/g," "),s=s.replace(/ {2,}/g," "),(null==e.previousSibling&&null!=e.parentElement&&jl(e.parentElement,n)||e.previousSibling instanceof Element&&jl(e.previousSibling,n))&&(s=s.replace(/^ /,"")),(null==e.nextSibling&&null!=e.parentElement&&jl(e.parentElement,n)||e.nextSibling instanceof Element&&jl(e.nextSibling,n))&&(s=s.replace(/ $/,"")),s=s.replaceAll(" "," ")}return t.insert(s)}],[Node.TEXT_NODE,ql],["br",function(e,t){Cl(t,"\n")||t.insert("\n");return t}],[Node.ELEMENT_NODE,ql],[Node.ELEMENT_NODE,function(e,t,n){const r=n.query(e);if(null==r)return t;if(r.prototype instanceof ni){const t={},s=r.value(e);if(null!=s)return t[r.blotName]=s,(new ji).insert(t,r.formats(e,n))}else if(r.prototype instanceof Qs&&!Cl(t,"\n")&&t.insert("\n"),"blotName"in r&&"formats"in r&&"function"==typeof r.formats)return Al(t,r.blotName,r.formats(e,n),n);return t}],[Node.ELEMENT_NODE,function(e,t,n){const r=qs.keys(e),s=Ds.keys(e),i=Fs.keys(e),o={};return r.concat(s).concat(i).forEach(t=>{let r=n.query(t,Ls.ATTRIBUTE);null!=r&&(o[r.attrName]=r.value(e),o[r.attrName])||(r=El[t],null==r||r.attrName!==t&&r.keyName!==t||(o[r.attrName]=r.value(e)||void 0),r=kl[t],null==r||r.attrName!==t&&r.keyName!==t||(r=kl[t],o[r.attrName]=r.value(e)||void 0))}),Object.entries(o).reduce((e,t)=>{let[r,s]=t;return Al(e,r,s,n)},t)}],[Node.ELEMENT_NODE,function(e,t,n){var r;const s={},i=e.style||{};"italic"===i.fontStyle&&(s.italic=!0);"underline"===i.textDecoration&&(s.underline=!0);"line-through"===i.textDecoration&&(s.strike=!0);((null==(r=i.fontWeight)?void 0:r.startsWith("bold"))||parseInt(i.fontWeight,10)>=700)&&(s.bold=!0);if(t=Object.entries(s).reduce((e,t)=>{let[r,s]=t;return Al(e,r,s,n)},t),parseFloat(i.textIndent||0)>0)return(new ji).insert("\t").concat(t);return t}],["li",function(e,t,n){const r=n.query(e);if(null==r||"list"!==r.blotName||!Cl(t,"\n"))return t;let s=-1,i=e.parentNode;for(;null!=i;)["OL","UL"].includes(i.tagName)&&(s+=1),i=i.parentNode;return s<=0?t:t.reduce((e,t)=>t.insert?t.attributes&&"number"==typeof t.attributes.indent?e.push(t):e.insert(t.insert,{indent:s,...t.attributes||{}}):e,new ji)}],["ol, ul",function(e,t,n){const r=e;let s="OL"===r.tagName?"ordered":"bullet";const i=r.getAttribute("data-checked");i&&(s="true"===i?"checked":"unchecked");return Al(t,"list",s,n)}],["pre",function(e,t,n){const r=n.query("code-block"),s=!r||!("formats"in r)||"function"!=typeof r.formats||r.formats(e,n);return Al(t,"code-block",s,n)}],["tr",function(e,t,n){var r,s;const i="TABLE"===(null==(r=e.parentElement)?void 0:r.tagName)?e.parentElement:null==(s=e.parentElement)?void 0:s.parentElement;if(null!=i){return Al(t,"table",Array.from(i.querySelectorAll("tr")).indexOf(e)+1,n)}return t}],["b",Ll("bold")],["i",Ll("italic")],["strike",Ll("strike")],["style",function(){return new ji}]],El=[Do,Yo].reduce((e,t)=>(e[t.keyName]=t,e),{}),kl=[Fo,Ho,$o,Xo,tl,rl].reduce((e,t)=>(e[t.keyName]=t,e),{});class Sl extends uo{constructor(e,t){super(e,t),this.quill.root.addEventListener("copy",e=>this.onCaptureCopy(e,!1)),this.quill.root.addEventListener("cut",e=>this.onCaptureCopy(e,!0)),this.quill.root.addEventListener("paste",this.onCapturePaste.bind(this)),this.matchers=[],Nl.concat(this.options.matchers??[]).forEach(e=>{let[t,n]=e;this.addMatcher(t,n)})}addMatcher(e,t){this.matchers.push([e,t])}convert(e){let{html:t,text:n}=e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(r[Wo.blotName])return(new ji).insert(n||"",{[Wo.blotName]:r[Wo.blotName]});if(!t)return(new ji).insert(n||"",r);const s=this.convertHTML(t);return Cl(s,"\n")&&(null==s.ops[s.ops.length-1].attributes||r.table)?s.compose((new ji).retain(s.length()-1).delete(1)):s}normalizeHTML(e){(e=>{e.documentElement&&xl.forEach(t=>{t(e)})})(e)}convertHTML(e){const t=(new DOMParser).parseFromString(e,"text/html");this.normalizeHTML(t);const n=t.body,r=new WeakMap,[s,i]=this.prepareMatching(n,r);return Tl(this.quill.scroll,n,s,i,r)}dangerouslyPasteHTML(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:So.sources.API;if("string"==typeof e){const n=this.convert({html:e,text:""});this.quill.setContents(n,t),this.quill.setSelection(0,So.sources.SILENT)}else{const r=this.convert({html:t,text:""});this.quill.updateContents((new ji).retain(e).concat(r),n),this.quill.setSelection(e+r.length(),So.sources.SILENT)}}onCaptureCopy(e){var t,n;let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(e.defaultPrevented)return;e.preventDefault();const[s]=this.quill.selection.getRange();if(null==s)return;const{html:i,text:o}=this.onCopy(s,r);null==(t=e.clipboardData)||t.setData("text/plain",o),null==(n=e.clipboardData)||n.setData("text/html",i),r&&hl({range:s,quill:this.quill})}normalizeURIList(e){return e.split(/\r?\n/).filter(e=>"#"!==e[0]).join("\n")}onCapturePaste(e){var t,n,r,s,i;if(e.defaultPrevented||!this.quill.isEnabled())return;e.preventDefault();const o=this.quill.getSelection(!0);if(null==o)return;const l=null==(t=e.clipboardData)?void 0:t.getData("text/html");let a=null==(n=e.clipboardData)?void 0:n.getData("text/plain");if(!l&&!a){const t=null==(r=e.clipboardData)?void 0:r.getData("text/uri-list");t&&(a=this.normalizeURIList(t))}const c=Array.from((null==(s=e.clipboardData)?void 0:s.files)||[]);if(!l&&c.length>0)this.quill.uploader.upload(o,c);else{if(l&&c.length>0){const e=(new DOMParser).parseFromString(l,"text/html");if(1===e.body.childElementCount&&"IMG"===(null==(i=e.body.firstElementChild)?void 0:i.tagName))return void this.quill.uploader.upload(o,c)}this.onPaste(o,{html:l,text:a})}}onCopy(e){const t=this.quill.getText(e);return{html:this.quill.getSemanticHTML(e),text:t}}onPaste(e,t){let{text:n,html:r}=t;const s=this.quill.getFormat(e.index),i=this.convert({text:n,html:r},s);wl.log("onPaste",i,{text:n,html:r});const o=(new ji).retain(e.index).delete(e.length).concat(i);this.quill.updateContents(o,So.sources.USER),this.quill.setSelection(o.length()-e.length,So.sources.SILENT),this.quill.scrollSelectionIntoView()}prepareMatching(e,t){const n=[],r=[];return this.matchers.forEach(s=>{const[i,o]=s;switch(i){case Node.TEXT_NODE:r.push(o);break;case Node.ELEMENT_NODE:n.push(o);break;default:Array.from(e.querySelectorAll(i)).forEach(e=>{if(t.has(e)){const n=t.get(e);null==n||n.push(o)}else t.set(e,[o])})}}),[n,r]}}function Al(e,t,n,r){return r.query(t)?e.reduce((e,r)=>{if(!r.insert)return e;if(r.attributes&&r.attributes[t])return e.push(r);const s=n?{[t]:n}:{};return e.insert(r.insert,{...s,...r.attributes})},new ji):e}function Cl(e,t){let n="";for(let r=e.ops.length-1;r>=0&&n.length<t.length;--r){const t=e.ops[r];if("string"!=typeof t.insert)break;n=t.insert+n}return n.slice(-1*t.length)===t}function jl(e,t){if(!(e instanceof Element))return!1;const n=t.query(e);return!(n&&n.prototype instanceof ni)&&["address","article","blockquote","canvas","dd","div","dl","dt","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","iframe","li","main","nav","ol","output","p","pre","section","table","td","tr","ul","video"].includes(e.tagName.toLowerCase())}t(Sl,"DEFAULTS",{matchers:[]});const _l=new WeakMap;function Ol(e){return null!=e&&(_l.has(e)||("PRE"===e.tagName?_l.set(e,!0):_l.set(e,Ol(e.parentNode))),_l.get(e))}function Tl(e,t,n,r,s){return t.nodeType===t.TEXT_NODE?r.reduce((n,r)=>r(t,n,e),new ji):t.nodeType===t.ELEMENT_NODE?Array.from(t.childNodes||[]).reduce((i,o)=>{let l=Tl(e,o,n,r,s);return o.nodeType===t.ELEMENT_NODE&&(l=n.reduce((t,n)=>n(o,t,e),l),l=(s.get(o)||[]).reduce((t,n)=>n(o,t,e),l)),i.concat(l)},new ji):new ji}function Ll(e){return(t,n,r)=>Al(n,e,!0,r)}function ql(e,t,n){if(!Cl(t,"\n")){if(jl(e,n)&&(e.childNodes.length>0||e instanceof HTMLParagraphElement))return t.insert("\n");if(t.length()>0&&e.nextSibling){let r=e.nextSibling;for(;null!=r;){if(jl(r,n))return t.insert("\n");const e=n.query(r);if(e&&e.prototype instanceof Mi)return t.insert("\n");r=r.firstChild}}}return t}class Il extends uo{constructor(e,n){super(e,n),t(this,"lastRecorded",0),t(this,"ignoreChange",!1),t(this,"stack",{undo:[],redo:[]}),t(this,"currentRange",null),this.quill.on(So.events.EDITOR_CHANGE,(e,t,n,r)=>{e===So.events.SELECTION_CHANGE?t&&r!==So.sources.SILENT&&(this.currentRange=t):e===So.events.TEXT_CHANGE&&(this.ignoreChange||(this.options.userOnly&&r!==So.sources.USER?this.transform(t):this.record(t,n)),this.currentRange=Ml(this.currentRange,t))}),this.quill.keyboard.addBinding({key:"z",shortKey:!0},this.undo.bind(this)),this.quill.keyboard.addBinding({key:["z","Z"],shortKey:!0,shiftKey:!0},this.redo.bind(this)),/Win/i.test(navigator.platform)&&this.quill.keyboard.addBinding({key:"y",shortKey:!0},this.redo.bind(this)),this.quill.root.addEventListener("beforeinput",e=>{"historyUndo"===e.inputType?(this.undo(),e.preventDefault()):"historyRedo"===e.inputType&&(this.redo(),e.preventDefault())})}change(e,t){if(0===this.stack[e].length)return;const n=this.stack[e].pop();if(!n)return;const r=this.quill.getContents(),s=n.delta.invert(r);this.stack[t].push({delta:s,range:Ml(n.range,s)}),this.lastRecorded=0,this.ignoreChange=!0,this.quill.updateContents(n.delta,So.sources.USER),this.ignoreChange=!1,this.restoreSelection(n)}clear(){this.stack={undo:[],redo:[]}}cutoff(){this.lastRecorded=0}record(e,t){if(0===e.ops.length)return;this.stack.redo=[];let n=e.invert(t),r=this.currentRange;const s=Date.now();if(this.lastRecorded+this.options.delay>s&&this.stack.undo.length>0){const e=this.stack.undo.pop();e&&(n=n.compose(e.delta),r=e.range)}else this.lastRecorded=s;0!==n.length()&&(this.stack.undo.push({delta:n,range:r}),this.stack.undo.length>this.options.maxStack&&this.stack.undo.shift())}redo(){this.change("redo","undo")}transform(e){Rl(this.stack.undo,e),Rl(this.stack.redo,e)}undo(){this.change("undo","redo")}restoreSelection(e){if(e.range)this.quill.setSelection(e.range,So.sources.USER);else{const t=function(e,t){const n=t.reduce((e,t)=>e+(t.delete||0),0);let r=t.length()-n;(function(e,t){const n=t.ops[t.ops.length-1];if(null==n)return!1;if(null!=n.insert)return"string"==typeof n.insert&&n.insert.endsWith("\n");if(null!=n.attributes)return Object.keys(n.attributes).some(t=>null!=e.query(t,Ls.BLOCK));return!1})(e,t)&&(r-=1);return r}(this.quill.scroll,e.delta);this.quill.setSelection(t,So.sources.USER)}}}function Rl(e,t){let n=t;for(let r=e.length-1;r>=0;r-=1){const t=e[r];e[r]={delta:n.transform(t.delta,!0),range:t.range&&Ml(t.range,n)},n=t.delta.transform(n),0===e[r].delta.length()&&e.splice(r,1)}}function Ml(e,t){if(!e)return e;const n=t.transformPosition(e.index);return{index:n,length:t.transformPosition(e.index+e.length)-n}}t(Il,"DEFAULTS",{delay:1e3,maxStack:100,userOnly:!1});class Bl extends uo{constructor(e,t){super(e,t),e.root.addEventListener("drop",t=>{var n;t.preventDefault();let r=null;if(document.caretRangeFromPoint)r=document.caretRangeFromPoint(t.clientX,t.clientY);else if(document.caretPositionFromPoint){const e=document.caretPositionFromPoint(t.clientX,t.clientY);r=document.createRange(),r.setStart(e.offsetNode,e.offset),r.setEnd(e.offsetNode,e.offset)}const s=r&&e.selection.normalizeNative(r);if(s){const r=e.selection.normalizedToRange(s);(null==(n=t.dataTransfer)?void 0:n.files)&&this.upload(r,t.dataTransfer.files)}})}upload(e,t){const n=[];Array.from(t).forEach(e=>{var t;e&&(null==(t=this.options.mimetypes)?void 0:t.includes(e.type))&&n.push(e)}),n.length>0&&this.options.handler.call(this,e,n)}}Bl.DEFAULTS={mimetypes:["image/png","image/jpeg"],handler(e,t){if(!this.quill.scroll.query("image"))return;const n=t.map(e=>new Promise(t=>{const n=new FileReader;n.onload=()=>{t(n.result)},n.readAsDataURL(e)}));Promise.all(n).then(t=>{const n=t.reduce((e,t)=>e.insert({image:t}),(new ji).retain(e.index).delete(e.length));this.quill.updateContents(n,Ji.sources.USER),this.quill.setSelection(e.index+t.length,Ji.sources.SILENT)})}};const Dl=["insertText","insertReplacementText"];const Pl=/Mac/i.test(navigator.platform);So.register({"blots/block":Ri,"blots/block/embed":Mi,"blots/break":_i,"blots/container":Lo,"blots/cursor":Fi,"blots/embed":fo,"blots/inline":Ii,"blots/scroll":Ro,"blots/text":Oi,"modules/clipboard":Sl,"modules/history":Il,"modules/keyboard":ol,"modules/uploader":Bl,"modules/input":class extends uo{constructor(e,t){super(e,t),e.root.addEventListener("beforeinput",e=>{this.handleBeforeInput(e)}),/Android/i.test(navigator.userAgent)||e.on(So.events.COMPOSITION_BEFORE_START,()=>{this.handleCompositionStart()})}deleteRange(e){hl({range:e,quill:this.quill})}replaceText(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(0===e.length)return!1;if(t){const n=this.quill.getFormat(e.index,1);this.deleteRange(e),this.quill.updateContents((new ji).retain(e.index).insert(t,n),So.sources.USER)}else this.deleteRange(e);return this.quill.setSelection(e.index+t.length,0,So.sources.SILENT),!0}handleBeforeInput(e){if(this.quill.composition.isComposing||e.defaultPrevented||!Dl.includes(e.inputType))return;const t=e.getTargetRanges?e.getTargetRanges()[0]:null;if(!t||!0===t.collapsed)return;const n=function(e){var t;if("string"==typeof e.data)return e.data;if(null==(t=e.dataTransfer)?void 0:t.types.includes("text/plain"))return e.dataTransfer.getData("text/plain");return null}(e);if(null==n)return;const r=this.quill.selection.normalizeNative(t),s=r?this.quill.selection.normalizedToRange(r):null;s&&this.replaceText(s,n)&&e.preventDefault()}handleCompositionStart(){const e=this.quill.getSelection();e&&this.replaceText(e)}},"modules/uiNode":class extends uo{constructor(e,n){super(e,n),t(this,"isListening",!1),t(this,"selectionChangeDeadline",0),this.handleArrowKeys(),this.handleNavigationShortcuts()}handleArrowKeys(){this.quill.keyboard.addBinding({key:["ArrowLeft","ArrowRight"],offset:0,shiftKey:null,handler(e,t){let{line:n,event:r}=t;if(!(n instanceof Zs&&n.uiNode))return!0;const s="rtl"===getComputedStyle(n.domNode).direction;return!!(s&&"ArrowRight"!==r.key||!s&&"ArrowLeft"!==r.key)||(this.quill.setSelection(e.index-1,e.length+(r.shiftKey?1:0),So.sources.USER),!1)}})}handleNavigationShortcuts(){this.quill.root.addEventListener("keydown",e=>{!e.defaultPrevented&&(e=>"ArrowLeft"===e.key||"ArrowRight"===e.key||"ArrowUp"===e.key||"ArrowDown"===e.key||"Home"===e.key||!(!Pl||"a"!==e.key||!0!==e.ctrlKey))(e)&&this.ensureListeningToSelectionChange()})}ensureListeningToSelectionChange(){if(this.selectionChangeDeadline=Date.now()+100,this.isListening)return;this.isListening=!0;document.addEventListener("selectionchange",()=>{this.isListening=!1,Date.now()<=this.selectionChangeDeadline&&this.handleSelectionChange()},{once:!0})}handleSelectionChange(){const e=document.getSelection();if(!e)return;const t=e.getRangeAt(0);if(!0!==t.collapsed||0!==t.startOffset)return;const n=this.quill.scroll.find(t.startContainer);if(!(n instanceof Zs&&n.uiNode))return;const r=document.createRange();r.setStartAfter(n.uiNode),r.setEndAfter(n.uiNode),e.removeAllRanges(),e.addRange(r)}}});const Fl=new class extends Ds{add(e,t){let n=0;if("+1"===t||"-1"===t){const r=this.value(e)||0;n="+1"===t?r+1:r-1}else"number"==typeof t&&(n=t);return 0===n?(this.remove(e),!0):super.add(e,n.toString())}canAdd(e,t){return super.canAdd(e,t)||super.canAdd(e,parseInt(t,10))}value(e){return parseInt(super.value(e),10)||void 0}}("indent","ql-indent",{scope:Ls.BLOCK,whitelist:[1,2,3,4,5,6,7,8]});class Ul extends Ri{}t(Ul,"blotName","blockquote"),t(Ul,"tagName","blockquote");class zl extends Ri{static formats(e){return this.tagName.indexOf(e.tagName)+1}}t(zl,"blotName","header"),t(zl,"tagName",["H1","H2","H3","H4","H5","H6"]);class $l extends Lo{}$l.blotName="list-container",$l.tagName="OL";class Vl extends Ri{static create(e){const t=super.create();return t.setAttribute("data-list",e),t}static formats(e){return e.getAttribute("data-list")||void 0}static register(){So.register($l)}constructor(e,t){super(e,t);const n=t.ownerDocument.createElement("span"),r=n=>{if(!e.isEnabled())return;const r=this.statics.formats(t,e);"checked"===r?(this.format("list","unchecked"),n.preventDefault()):"unchecked"===r&&(this.format("list","checked"),n.preventDefault())};n.addEventListener("mousedown",r),n.addEventListener("touchstart",r),this.attachUI(n)}format(e,t){e===this.statics.blotName&&t?this.domNode.setAttribute("data-list",t):super.format(e,t)}}Vl.blotName="list",Vl.tagName="LI",$l.allowedChildren=[Vl],Vl.requiredContainer=$l;class Hl extends Ii{static create(){return super.create()}static formats(){return!0}optimize(e){super.optimize(e),this.domNode.tagName!==this.statics.tagName[0]&&this.replaceWith(this.statics.blotName)}}t(Hl,"blotName","bold"),t(Hl,"tagName",["STRONG","B"]);class Kl extends Hl{}t(Kl,"blotName","italic"),t(Kl,"tagName",["EM","I"]);class Wl extends Ii{static create(e){const t=super.create(e);return t.setAttribute("href",this.sanitize(e)),t.setAttribute("rel","noopener noreferrer"),t.setAttribute("target","_blank"),t}static formats(e){return e.getAttribute("href")}static sanitize(e){return Gl(e,this.PROTOCOL_WHITELIST)?e:this.SANITIZED_URL}format(e,t){e===this.statics.blotName&&t?this.domNode.setAttribute("href",this.constructor.sanitize(t)):super.format(e,t)}}function Gl(e,t){const n=document.createElement("a");n.href=e;const r=n.href.slice(0,n.href.indexOf(":"));return t.indexOf(r)>-1}t(Wl,"blotName","link"),t(Wl,"tagName","A"),t(Wl,"SANITIZED_URL","about:blank"),t(Wl,"PROTOCOL_WHITELIST",["http","https","mailto","tel","sms"]);class Zl extends Ii{static create(e){return"super"===e?document.createElement("sup"):"sub"===e?document.createElement("sub"):super.create(e)}static formats(e){return"SUB"===e.tagName?"sub":"SUP"===e.tagName?"super":void 0}}t(Zl,"blotName","script"),t(Zl,"tagName",["SUB","SUP"]);class Yl extends Hl{}t(Yl,"blotName","strike"),t(Yl,"tagName",["S","STRIKE"]);class Jl extends Ii{}t(Jl,"blotName","underline"),t(Jl,"tagName","U");class Xl extends fo{static create(e){if(null==window.katex)throw new Error("Formula module requires KaTeX.");const t=super.create(e);return"string"==typeof e&&(window.katex.render(e,t,{throwOnError:!1,errorColor:"#f00"}),t.setAttribute("data-value",e)),t}static value(e){return e.getAttribute("data-value")}html(){const{formula:e}=this.value();return`<span>${e}</span>`}}t(Xl,"blotName","formula"),t(Xl,"className","ql-formula"),t(Xl,"tagName","SPAN");const Ql=["alt","height","width"];class ea extends ni{static create(e){const t=super.create(e);return"string"==typeof e&&t.setAttribute("src",this.sanitize(e)),t}static formats(e){return Ql.reduce((t,n)=>(e.hasAttribute(n)&&(t[n]=e.getAttribute(n)),t),{})}static match(e){return/\.(jpe?g|gif|png)$/.test(e)||/^data:image\/.+;base64/.test(e)}static sanitize(e){return Gl(e,["http","https","data"])?e:"//:0"}static value(e){return e.getAttribute("src")}format(e,t){Ql.indexOf(e)>-1?t?this.domNode.setAttribute(e,t):this.domNode.removeAttribute(e):super.format(e,t)}}t(ea,"blotName","image"),t(ea,"tagName","IMG");const ta=["height","width"];class na extends Mi{static create(e){const t=super.create(e);return t.setAttribute("frameborder","0"),t.setAttribute("allowfullscreen","true"),t.setAttribute("src",this.sanitize(e)),t}static formats(e){return ta.reduce((t,n)=>(e.hasAttribute(n)&&(t[n]=e.getAttribute(n)),t),{})}static sanitize(e){return Wl.sanitize(e)}static value(e){return e.getAttribute("src")}format(e,t){ta.indexOf(e)>-1?t?this.domNode.setAttribute(e,t):this.domNode.removeAttribute(e):super.format(e,t)}html(){const{video:e}=this.value();return`<a href="${e}">${e}</a>`}}t(na,"blotName","video"),t(na,"className","ql-video"),t(na,"tagName","IFRAME");const ra=new Ds("code-token","hljs",{scope:Ls.INLINE});class sa extends Ii{static formats(e,t){for(;null!=e&&e!==t.domNode;){if(e.classList&&e.classList.contains(Wo.className))return super.formats(e,t);e=e.parentNode}}constructor(e,t,n){super(e,t,n),ra.add(this.domNode,n)}format(e,t){e!==sa.blotName?super.format(e,t):t?ra.add(this.domNode,t):(ra.remove(this.domNode),this.domNode.classList.remove(this.statics.className))}optimize(){super.optimize(...arguments),ra.value(this.domNode)||this.unwrap()}}sa.blotName="code-token",sa.className="ql-token";class ia extends Wo{static create(e){const t=super.create(e);return"string"==typeof e&&t.setAttribute("data-language",e),t}static formats(e){return e.getAttribute("data-language")||"plain"}static register(){}format(e,t){e===this.statics.blotName&&t?this.domNode.setAttribute("data-language",t):super.format(e,t)}replaceWith(e,t){return this.formatAt(0,this.length(),sa.blotName,!1),super.replaceWith(e,t)}}class oa extends Ko{attach(){super.attach(),this.forceNext=!1,this.scroll.emitMount(this)}format(e,t){e===ia.blotName&&(this.forceNext=!0,this.children.forEach(n=>{n.format(e,t)}))}formatAt(e,t,n,r){n===ia.blotName&&(this.forceNext=!0),super.formatAt(e,t,n,r)}highlight(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(null==this.children.head)return;const n=`${Array.from(this.domNode.childNodes).filter(e=>e!==this.uiNode).map(e=>e.textContent).join("\n")}\n`,r=ia.formats(this.children.head.domNode);if(t||this.forceNext||this.cachedText!==n){if(n.trim().length>0||null==this.cachedText){const t=this.children.reduce((e,t)=>e.concat(Bi(t,!1)),new ji),s=e(n,r);t.diff(s).reduce((e,t)=>{let{retain:n,attributes:r}=t;return n?(r&&Object.keys(r).forEach(t=>{[ia.blotName,sa.blotName].includes(t)&&this.formatAt(e,n,t,r[t])}),e+n):e},0)}this.cachedText=n,this.forceNext=!1}}html(e,t){const[n]=this.children.find(e);return`<pre data-language="${n?ia.formats(n.domNode):"plain"}">\n${Li(this.code(e,t))}\n</pre>`}optimize(e){if(super.optimize(e),null!=this.parent&&null!=this.children.head&&null!=this.uiNode){const e=ia.formats(this.children.head.domNode);e!==this.uiNode.value&&(this.uiNode.value=e)}}}oa.allowedChildren=[ia],ia.requiredContainer=oa,ia.allowedChildren=[sa,Fi,Oi,_i];class la extends uo{static register(){So.register(sa,!0),So.register(ia,!0),So.register(oa,!0)}constructor(e,t){if(super(e,t),null==this.options.hljs)throw new Error("Syntax module requires highlight.js. Please include the library on the page before Quill.");this.languages=this.options.languages.reduce((e,t)=>{let{key:n}=t;return e[n]=!0,e},{}),this.highlightBlot=this.highlightBlot.bind(this),this.initListener(),this.initTimer()}initListener(){this.quill.on(So.events.SCROLL_BLOT_MOUNT,e=>{if(!(e instanceof oa))return;const t=this.quill.root.ownerDocument.createElement("select");this.options.languages.forEach(e=>{let{key:n,label:r}=e;const s=t.ownerDocument.createElement("option");s.textContent=r,s.setAttribute("value",n),t.appendChild(s)}),t.addEventListener("change",()=>{e.format(ia.blotName,t.value),this.quill.root.focus(),this.highlight(e,!0)}),null==e.uiNode&&(e.attachUI(t),e.children.head&&(t.value=ia.formats(e.children.head.domNode)))})}initTimer(){let e=null;this.quill.on(So.events.SCROLL_OPTIMIZE,()=>{e&&clearTimeout(e),e=setTimeout(()=>{this.highlight(),e=null},this.options.interval)})}highlight(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(this.quill.selection.composing)return;this.quill.update(So.sources.USER);const n=this.quill.getSelection();(null==e?this.quill.scroll.descendants(oa):[e]).forEach(e=>{e.highlight(this.highlightBlot,t)}),this.quill.update(So.sources.SILENT),null!=n&&this.quill.setSelection(n,So.sources.SILENT)}highlightBlot(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"plain";if(t=this.languages[t]?t:"plain","plain"===t)return Li(e).split("\n").reduce((e,n,r)=>(0!==r&&e.insert("\n",{[Wo.blotName]:t}),e.insert(n)),new ji);const n=this.quill.root.ownerDocument.createElement("div");return n.classList.add(Wo.className),n.innerHTML=((e,t,n)=>{if("string"==typeof e.versionString){const r=e.versionString.split(".")[0];if(parseInt(r,10)>=11)return e.highlight(n,{language:t}).value}return e.highlight(t,n).value})(this.options.hljs,t,e),Tl(this.quill.scroll,n,[(e,t)=>{const n=ra.value(e);return n?t.compose((new ji).retain(t.length(),{[sa.blotName]:n})):t}],[(e,n)=>e.data.split("\n").reduce((e,n,r)=>(0!==r&&e.insert("\n",{[Wo.blotName]:t}),e.insert(n)),n)],new WeakMap)}}la.DEFAULTS={hljs:window.hljs,interval:1e3,languages:[{key:"plain",label:"Plain"},{key:"bash",label:"Bash"},{key:"cpp",label:"C++"},{key:"cs",label:"C#"},{key:"css",label:"CSS"},{key:"diff",label:"Diff"},{key:"xml",label:"HTML/XML"},{key:"java",label:"Java"},{key:"javascript",label:"JavaScript"},{key:"markdown",label:"Markdown"},{key:"php",label:"PHP"},{key:"python",label:"Python"},{key:"ruby",label:"Ruby"},{key:"sql",label:"SQL"}]};const aa=class e extends Ri{static create(e){const t=super.create();return e?t.setAttribute("data-row",e):t.setAttribute("data-row",fa()),t}static formats(e){if(e.hasAttribute("data-row"))return e.getAttribute("data-row")}cellOffset(){return this.parent?this.parent.children.indexOf(this):-1}format(t,n){t===e.blotName&&n?this.domNode.setAttribute("data-row",n):super.format(t,n)}row(){return this.parent}rowOffset(){return this.row()?this.row().rowOffset():-1}table(){return this.row()&&this.row().table()}};t(aa,"blotName","table"),t(aa,"tagName","TD");let ca=aa;class ua extends Lo{checkMerge(){if(super.checkMerge()&&null!=this.next.children.head){const e=this.children.head.formats(),t=this.children.tail.formats(),n=this.next.children.head.formats(),r=this.next.children.tail.formats();return e.table===t.table&&e.table===n.table&&e.table===r.table}return!1}optimize(e){super.optimize(e),this.children.forEach(e=>{if(null==e.next)return;const t=e.formats(),n=e.next.formats();if(t.table!==n.table){const t=this.splitAfter(e);t&&t.optimize(),this.prev&&this.prev.optimize()}})}rowOffset(){return this.parent?this.parent.children.indexOf(this):-1}table(){return this.parent&&this.parent.parent}}t(ua,"blotName","table-row"),t(ua,"tagName","TR");class da extends Lo{}t(da,"blotName","table-body"),t(da,"tagName","TBODY");class ha extends Lo{balanceCells(){const e=this.descendants(ua),t=e.reduce((e,t)=>Math.max(t.children.length,e),0);e.forEach(e=>{new Array(t-e.children.length).fill(0).forEach(()=>{let t;null!=e.children.head&&(t=ca.formats(e.children.head.domNode));const n=this.scroll.create(ca.blotName,t);e.appendChild(n),n.optimize()})})}cells(e){return this.rows().map(t=>t.children.at(e))}deleteColumn(e){const[t]=this.descendant(da);null!=t&&null!=t.children.head&&t.children.forEach(t=>{const n=t.children.at(e);null!=n&&n.remove()})}insertColumn(e){const[t]=this.descendant(da);null!=t&&null!=t.children.head&&t.children.forEach(t=>{const n=t.children.at(e),r=ca.formats(t.children.head.domNode),s=this.scroll.create(ca.blotName,r);t.insertBefore(s,n)})}insertRow(e){const[t]=this.descendant(da);if(null==t||null==t.children.head)return;const n=fa(),r=this.scroll.create(ua.blotName);t.children.head.children.forEach(()=>{const e=this.scroll.create(ca.blotName,n);r.appendChild(e)});const s=t.children.at(e);t.insertBefore(r,s)}rows(){const e=this.children.head;return null==e?[]:e.children.map(e=>e)}}function fa(){return`row-${Math.random().toString(36).slice(2,6)}`}t(ha,"blotName","table-container"),t(ha,"tagName","TABLE"),ha.allowedChildren=[da],da.requiredContainer=ha,da.allowedChildren=[ua],ua.requiredContainer=da,ua.allowedChildren=[ca],ca.requiredContainer=ua;const pa=Zi("quill:toolbar");class ma extends uo{constructor(e,t){var n,r;if(super(e,t),Array.isArray(this.options.container)){const t=document.createElement("div");t.setAttribute("role","toolbar"),function(e,t){Array.isArray(t[0])||(t=[t]);t.forEach(t=>{const n=document.createElement("span");n.classList.add("ql-formats"),t.forEach(e=>{if("string"==typeof e)ga(n,e);else{const t=Object.keys(e)[0],r=e[t];Array.isArray(r)?function(e,t,n){const r=document.createElement("select");r.classList.add(`ql-${t}`),n.forEach(e=>{const t=document.createElement("option");!1!==e?t.setAttribute("value",String(e)):t.setAttribute("selected","selected"),r.appendChild(t)}),e.appendChild(r)}(n,t,r):ga(n,t,r)}}),e.appendChild(n)})}(t,this.options.container),null==(r=null==(n=e.container)?void 0:n.parentNode)||r.insertBefore(t,e.container),this.container=t}else"string"==typeof this.options.container?this.container=document.querySelector(this.options.container):this.container=this.options.container;this.container instanceof HTMLElement?(this.container.classList.add("ql-toolbar"),this.controls=[],this.handlers={},this.options.handlers&&Object.keys(this.options.handlers).forEach(e=>{var t;const n=null==(t=this.options.handlers)?void 0:t[e];n&&this.addHandler(e,n)}),Array.from(this.container.querySelectorAll("button, select")).forEach(e=>{this.attach(e)}),this.quill.on(So.events.EDITOR_CHANGE,()=>{const[e]=this.quill.selection.getRange();this.update(e)})):pa.error("Container required for toolbar",this.options)}addHandler(e,t){this.handlers[e]=t}attach(e){let t=Array.from(e.classList).find(e=>0===e.indexOf("ql-"));if(!t)return;if(t=t.slice(3),"BUTTON"===e.tagName&&e.setAttribute("type","button"),null==this.handlers[t]&&null==this.quill.scroll.query(t))return void pa.warn("ignoring attaching to nonexistent format",t,e);const n="SELECT"===e.tagName?"change":"click";e.addEventListener(n,n=>{let r;if("SELECT"===e.tagName){if(e.selectedIndex<0)return;const t=e.options[e.selectedIndex];r=!t.hasAttribute("selected")&&(t.value||!1)}else r=!e.classList.contains("ql-active")&&(e.value||!e.hasAttribute("value")),n.preventDefault();this.quill.focus();const[s]=this.quill.selection.getRange();if(null!=this.handlers[t])this.handlers[t].call(this,r);else if(this.quill.scroll.query(t).prototype instanceof ni){if(r=prompt(`Enter ${t}`),!r)return;this.quill.updateContents((new ji).retain(s.index).delete(s.length).insert({[t]:r}),So.sources.USER)}else this.quill.format(t,r,So.sources.USER);this.update(s)}),this.controls.push([t,e])}update(e){const t=null==e?{}:this.quill.getFormat(e);this.controls.forEach(n=>{const[r,s]=n;if("SELECT"===s.tagName){let n=null;if(null==e)n=null;else if(null==t[r])n=s.querySelector("option[selected]");else if(!Array.isArray(t[r])){let e=t[r];"string"==typeof e&&(e=e.replace(/"/g,'\\"')),n=s.querySelector(`option[value="${e}"]`)}null==n?(s.value="",s.selectedIndex=-1):n.selected=!0}else if(null==e)s.classList.remove("ql-active"),s.setAttribute("aria-pressed","false");else if(s.hasAttribute("value")){const e=t[r],n=e===s.getAttribute("value")||null!=e&&e.toString()===s.getAttribute("value")||null==e&&!s.getAttribute("value");s.classList.toggle("ql-active",n),s.setAttribute("aria-pressed",n.toString())}else{const e=null!=t[r];s.classList.toggle("ql-active",e),s.setAttribute("aria-pressed",e.toString())}})}}function ga(e,t,n){const r=document.createElement("button");r.setAttribute("type","button"),r.classList.add(`ql-${t}`),r.setAttribute("aria-pressed","false"),null!=n?(r.value=n,r.setAttribute("aria-label",`${t}: ${n}`)):r.setAttribute("aria-label",t),e.appendChild(r)}ma.DEFAULTS={},ma.DEFAULTS={container:null,handlers:{clean(){const e=this.quill.getSelection();if(null!=e)if(0===e.length){const e=this.quill.getFormat();Object.keys(e).forEach(e=>{null!=this.quill.scroll.query(e,Ls.INLINE)&&this.quill.format(e,!1,So.sources.USER)})}else this.quill.removeFormat(e.index,e.length,So.sources.USER)},direction(e){const{align:t}=this.quill.getFormat();"rtl"===e&&null==t?this.quill.format("align","right",So.sources.USER):e||"right"!==t||this.quill.format("align",!1,So.sources.USER),this.quill.format("direction",e,So.sources.USER)},indent(e){const t=this.quill.getSelection(),n=this.quill.getFormat(t),r=parseInt(n.indent||0,10);if("+1"===e||"-1"===e){let t="+1"===e?1:-1;"rtl"===n.direction&&(t*=-1),this.quill.format("indent",r+t,So.sources.USER)}},link(e){!0===e&&(e=prompt("Enter link URL:")),this.quill.format("link",e,So.sources.USER)},list(e){const t=this.quill.getSelection(),n=this.quill.getFormat(t);"check"===e?"checked"===n.list||"unchecked"===n.list?this.quill.format("list",!1,So.sources.USER):this.quill.format("list","unchecked",So.sources.USER):this.quill.format("list",e,So.sources.USER)}}};const va='<svg viewbox="0 0 18 18"><polyline class="ql-even ql-stroke" points="5 7 3 9 5 11"/><polyline class="ql-even ql-stroke" points="13 7 15 9 13 11"/><line class="ql-stroke" x1="10" x2="8" y1="5" y2="13"/></svg>',ba={align:{"":'<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="3" x2="15" y1="9" y2="9"/><line class="ql-stroke" x1="3" x2="13" y1="14" y2="14"/><line class="ql-stroke" x1="3" x2="9" y1="4" y2="4"/></svg>',center:'<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="15" x2="3" y1="9" y2="9"/><line class="ql-stroke" x1="14" x2="4" y1="14" y2="14"/><line class="ql-stroke" x1="12" x2="6" y1="4" y2="4"/></svg>',right:'<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="15" x2="3" y1="9" y2="9"/><line class="ql-stroke" x1="15" x2="5" y1="14" y2="14"/><line class="ql-stroke" x1="15" x2="9" y1="4" y2="4"/></svg>',justify:'<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="15" x2="3" y1="9" y2="9"/><line class="ql-stroke" x1="15" x2="3" y1="14" y2="14"/><line class="ql-stroke" x1="15" x2="3" y1="4" y2="4"/></svg>'},background:'<svg viewbox="0 0 18 18"><g class="ql-fill ql-color-label"><polygon points="6 6.868 6 6 5 6 5 7 5.942 7 6 6.868"/><rect height="1" width="1" x="4" y="4"/><polygon points="6.817 5 6 5 6 6 6.38 6 6.817 5"/><rect height="1" width="1" x="2" y="6"/><rect height="1" width="1" x="3" y="5"/><rect height="1" width="1" x="4" y="7"/><polygon points="4 11.439 4 11 3 11 3 12 3.755 12 4 11.439"/><rect height="1" width="1" x="2" y="12"/><rect height="1" width="1" x="2" y="9"/><rect height="1" width="1" x="2" y="15"/><polygon points="4.63 10 4 10 4 11 4.192 11 4.63 10"/><rect height="1" width="1" x="3" y="8"/><path d="M10.832,4.2L11,4.582V4H10.708A1.948,1.948,0,0,1,10.832,4.2Z"/><path d="M7,4.582L7.168,4.2A1.929,1.929,0,0,1,7.292,4H7V4.582Z"/><path d="M8,13H7.683l-0.351.8a1.933,1.933,0,0,1-.124.2H8V13Z"/><rect height="1" width="1" x="12" y="2"/><rect height="1" width="1" x="11" y="3"/><path d="M9,3H8V3.282A1.985,1.985,0,0,1,9,3Z"/><rect height="1" width="1" x="2" y="3"/><rect height="1" width="1" x="6" y="2"/><rect height="1" width="1" x="3" y="2"/><rect height="1" width="1" x="5" y="3"/><rect height="1" width="1" x="9" y="2"/><rect height="1" width="1" x="15" y="14"/><polygon points="13.447 10.174 13.469 10.225 13.472 10.232 13.808 11 14 11 14 10 13.37 10 13.447 10.174"/><rect height="1" width="1" x="13" y="7"/><rect height="1" width="1" x="15" y="5"/><rect height="1" width="1" x="14" y="6"/><rect height="1" width="1" x="15" y="8"/><rect height="1" width="1" x="14" y="9"/><path d="M3.775,14H3v1H4V14.314A1.97,1.97,0,0,1,3.775,14Z"/><rect height="1" width="1" x="14" y="3"/><polygon points="12 6.868 12 6 11.62 6 12 6.868"/><rect height="1" width="1" x="15" y="2"/><rect height="1" width="1" x="12" y="5"/><rect height="1" width="1" x="13" y="4"/><polygon points="12.933 9 13 9 13 8 12.495 8 12.933 9"/><rect height="1" width="1" x="9" y="14"/><rect height="1" width="1" x="8" y="15"/><path d="M6,14.926V15H7V14.316A1.993,1.993,0,0,1,6,14.926Z"/><rect height="1" width="1" x="5" y="15"/><path d="M10.668,13.8L10.317,13H10v1h0.792A1.947,1.947,0,0,1,10.668,13.8Z"/><rect height="1" width="1" x="11" y="15"/><path d="M14.332,12.2a1.99,1.99,0,0,1,.166.8H15V12H14.245Z"/><rect height="1" width="1" x="14" y="15"/><rect height="1" width="1" x="15" y="11"/></g><polyline class="ql-stroke" points="5.5 13 9 5 12.5 13"/><line class="ql-stroke" x1="11.63" x2="6.38" y1="11" y2="11"/></svg>',blockquote:'<svg viewbox="0 0 18 18"><rect class="ql-fill ql-stroke" height="3" width="3" x="4" y="5"/><rect class="ql-fill ql-stroke" height="3" width="3" x="11" y="5"/><path class="ql-even ql-fill ql-stroke" d="M7,8c0,4.031-3,5-3,5"/><path class="ql-even ql-fill ql-stroke" d="M14,8c0,4.031-3,5-3,5"/></svg>',bold:'<svg viewbox="0 0 18 18"><path class="ql-stroke" d="M5,4H9.5A2.5,2.5,0,0,1,12,6.5v0A2.5,2.5,0,0,1,9.5,9H5A0,0,0,0,1,5,9V4A0,0,0,0,1,5,4Z"/><path class="ql-stroke" d="M5,9h5.5A2.5,2.5,0,0,1,13,11.5v0A2.5,2.5,0,0,1,10.5,14H5a0,0,0,0,1,0,0V9A0,0,0,0,1,5,9Z"/></svg>',clean:'<svg class="" viewbox="0 0 18 18"><line class="ql-stroke" x1="5" x2="13" y1="3" y2="3"/><line class="ql-stroke" x1="6" x2="9.35" y1="12" y2="3"/><line class="ql-stroke" x1="11" x2="15" y1="11" y2="15"/><line class="ql-stroke" x1="15" x2="11" y1="11" y2="15"/><rect class="ql-fill" height="1" rx="0.5" ry="0.5" width="7" x="2" y="14"/></svg>',code:va,"code-block":va,color:'<svg viewbox="0 0 18 18"><line class="ql-color-label ql-stroke ql-transparent" x1="3" x2="15" y1="15" y2="15"/><polyline class="ql-stroke" points="5.5 11 9 3 12.5 11"/><line class="ql-stroke" x1="11.63" x2="6.38" y1="9" y2="9"/></svg>',direction:{"":'<svg viewbox="0 0 18 18"><polygon class="ql-stroke ql-fill" points="3 11 5 9 3 7 3 11"/><line class="ql-stroke ql-fill" x1="15" x2="11" y1="4" y2="4"/><path class="ql-fill" d="M11,3a3,3,0,0,0,0,6h1V3H11Z"/><rect class="ql-fill" height="11" width="1" x="11" y="4"/><rect class="ql-fill" height="11" width="1" x="13" y="4"/></svg>',rtl:'<svg viewbox="0 0 18 18"><polygon class="ql-stroke ql-fill" points="15 12 13 10 15 8 15 12"/><line class="ql-stroke ql-fill" x1="9" x2="5" y1="4" y2="4"/><path class="ql-fill" d="M5,3A3,3,0,0,0,5,9H6V3H5Z"/><rect class="ql-fill" height="11" width="1" x="5" y="4"/><rect class="ql-fill" height="11" width="1" x="7" y="4"/></svg>'},formula:'<svg viewbox="0 0 18 18"><path class="ql-fill" d="M11.759,2.482a2.561,2.561,0,0,0-3.53.607A7.656,7.656,0,0,0,6.8,6.2C6.109,9.188,5.275,14.677,4.15,14.927a1.545,1.545,0,0,0-1.3-.933A0.922,0.922,0,0,0,2,15.036S1.954,16,4.119,16s3.091-2.691,3.7-5.553c0.177-.826.36-1.726,0.554-2.6L8.775,6.2c0.381-1.421.807-2.521,1.306-2.676a1.014,1.014,0,0,0,1.02.56A0.966,0.966,0,0,0,11.759,2.482Z"/><rect class="ql-fill" height="1.6" rx="0.8" ry="0.8" width="5" x="5.15" y="6.2"/><path class="ql-fill" d="M13.663,12.027a1.662,1.662,0,0,1,.266-0.276q0.193,0.069.456,0.138a2.1,2.1,0,0,0,.535.069,1.075,1.075,0,0,0,.767-0.3,1.044,1.044,0,0,0,.314-0.8,0.84,0.84,0,0,0-.238-0.619,0.8,0.8,0,0,0-.594-0.239,1.154,1.154,0,0,0-.781.3,4.607,4.607,0,0,0-.781,1q-0.091.15-.218,0.346l-0.246.38c-0.068-.288-0.137-0.582-0.212-0.885-0.459-1.847-2.494-.984-2.941-0.8-0.482.2-.353,0.647-0.094,0.529a0.869,0.869,0,0,1,1.281.585c0.217,0.751.377,1.436,0.527,2.038a5.688,5.688,0,0,1-.362.467,2.69,2.69,0,0,1-.264.271q-0.221-.08-0.471-0.147a2.029,2.029,0,0,0-.522-0.066,1.079,1.079,0,0,0-.768.3A1.058,1.058,0,0,0,9,15.131a0.82,0.82,0,0,0,.832.852,1.134,1.134,0,0,0,.787-0.3,5.11,5.11,0,0,0,.776-0.993q0.141-.219.215-0.34c0.046-.076.122-0.194,0.223-0.346a2.786,2.786,0,0,0,.918,1.726,2.582,2.582,0,0,0,2.376-.185c0.317-.181.212-0.565,0-0.494A0.807,0.807,0,0,1,14.176,15a5.159,5.159,0,0,1-.913-2.446l0,0Q13.487,12.24,13.663,12.027Z"/></svg>',header:{1:'<svg viewBox="0 0 18 18"><path class="ql-fill" d="M10,4V14a1,1,0,0,1-2,0V10H3v4a1,1,0,0,1-2,0V4A1,1,0,0,1,3,4V8H8V4a1,1,0,0,1,2,0Zm6.06787,9.209H14.98975V7.59863a.54085.54085,0,0,0-.605-.60547h-.62744a1.01119,1.01119,0,0,0-.748.29688L11.645,8.56641a.5435.5435,0,0,0-.022.8584l.28613.30762a.53861.53861,0,0,0,.84717.0332l.09912-.08789a1.2137,1.2137,0,0,0,.2417-.35254h.02246s-.01123.30859-.01123.60547V13.209H12.041a.54085.54085,0,0,0-.605.60547v.43945a.54085.54085,0,0,0,.605.60547h4.02686a.54085.54085,0,0,0,.605-.60547v-.43945A.54085.54085,0,0,0,16.06787,13.209Z"/></svg>',2:'<svg viewBox="0 0 18 18"><path class="ql-fill" d="M16.73975,13.81445v.43945a.54085.54085,0,0,1-.605.60547H11.855a.58392.58392,0,0,1-.64893-.60547V14.0127c0-2.90527,3.39941-3.42187,3.39941-4.55469a.77675.77675,0,0,0-.84717-.78125,1.17684,1.17684,0,0,0-.83594.38477c-.2749.26367-.561.374-.85791.13184l-.4292-.34082c-.30811-.24219-.38525-.51758-.1543-.81445a2.97155,2.97155,0,0,1,2.45361-1.17676,2.45393,2.45393,0,0,1,2.68408,2.40918c0,2.45312-3.1792,2.92676-3.27832,3.93848h2.79443A.54085.54085,0,0,1,16.73975,13.81445ZM9,3A.99974.99974,0,0,0,8,4V8H3V4A1,1,0,0,0,1,4V14a1,1,0,0,0,2,0V10H8v4a1,1,0,0,0,2,0V4A.99974.99974,0,0,0,9,3Z"/></svg>',3:'<svg viewBox="0 0 18 18"><path class="ql-fill" d="M16.65186,12.30664a2.6742,2.6742,0,0,1-2.915,2.68457,3.96592,3.96592,0,0,1-2.25537-.6709.56007.56007,0,0,1-.13232-.83594L11.64648,13c.209-.34082.48389-.36328.82471-.1543a2.32654,2.32654,0,0,0,1.12256.33008c.71484,0,1.12207-.35156,1.12207-.78125,0-.61523-.61621-.86816-1.46338-.86816H13.2085a.65159.65159,0,0,1-.68213-.41895l-.05518-.10937a.67114.67114,0,0,1,.14307-.78125l.71533-.86914a8.55289,8.55289,0,0,1,.68213-.7373V8.58887a3.93913,3.93913,0,0,1-.748.05469H11.9873a.54085.54085,0,0,1-.605-.60547V7.59863a.54085.54085,0,0,1,.605-.60547h3.75146a.53773.53773,0,0,1,.60547.59375v.17676a1.03723,1.03723,0,0,1-.27539.748L14.74854,10.0293A2.31132,2.31132,0,0,1,16.65186,12.30664ZM9,3A.99974.99974,0,0,0,8,4V8H3V4A1,1,0,0,0,1,4V14a1,1,0,0,0,2,0V10H8v4a1,1,0,0,0,2,0V4A.99974.99974,0,0,0,9,3Z"/></svg>',4:'<svg viewBox="0 0 18 18"><path class="ql-fill" d="M10,4V14a1,1,0,0,1-2,0V10H3v4a1,1,0,0,1-2,0V4A1,1,0,0,1,3,4V8H8V4a1,1,0,0,1,2,0Zm7.05371,7.96582v.38477c0,.39648-.165.60547-.46191.60547h-.47314v1.29785a.54085.54085,0,0,1-.605.60547h-.69336a.54085.54085,0,0,1-.605-.60547V12.95605H11.333a.5412.5412,0,0,1-.60547-.60547v-.15332a1.199,1.199,0,0,1,.22021-.748l2.56348-4.05957a.7819.7819,0,0,1,.72607-.39648h1.27637a.54085.54085,0,0,1,.605.60547v3.7627h.33008A.54055.54055,0,0,1,17.05371,11.96582ZM14.28125,8.7207h-.022a4.18969,4.18969,0,0,1-.38525.81348l-1.188,1.80469v.02246h1.5293V9.60059A7.04058,7.04058,0,0,1,14.28125,8.7207Z"/></svg>',5:'<svg viewBox="0 0 18 18"><path class="ql-fill" d="M16.74023,12.18555a2.75131,2.75131,0,0,1-2.91553,2.80566,3.908,3.908,0,0,1-2.25537-.68164.54809.54809,0,0,1-.13184-.8252L11.73438,13c.209-.34082.48389-.36328.8252-.1543a2.23757,2.23757,0,0,0,1.1001.33008,1.01827,1.01827,0,0,0,1.1001-.96777c0-.61621-.53906-.97949-1.25439-.97949a2.15554,2.15554,0,0,0-.64893.09961,1.15209,1.15209,0,0,1-.814.01074l-.12109-.04395a.64116.64116,0,0,1-.45117-.71484l.231-3.00391a.56666.56666,0,0,1,.62744-.583H15.541a.54085.54085,0,0,1,.605.60547v.43945a.54085.54085,0,0,1-.605.60547H13.41748l-.04395.72559a1.29306,1.29306,0,0,1-.04395.30859h.022a2.39776,2.39776,0,0,1,.57227-.07715A2.53266,2.53266,0,0,1,16.74023,12.18555ZM9,3A.99974.99974,0,0,0,8,4V8H3V4A1,1,0,0,0,1,4V14a1,1,0,0,0,2,0V10H8v4a1,1,0,0,0,2,0V4A.99974.99974,0,0,0,9,3Z"/></svg>',6:'<svg viewBox="0 0 18 18"><path class="ql-fill" d="M14.51758,9.64453a1.85627,1.85627,0,0,0-1.24316.38477H13.252a1.73532,1.73532,0,0,1,1.72754-1.4082,2.66491,2.66491,0,0,1,.5498.06641c.35254.05469.57227.01074.70508-.40723l.16406-.5166a.53393.53393,0,0,0-.373-.75977,4.83723,4.83723,0,0,0-1.17773-.14258c-2.43164,0-3.7627,2.17773-3.7627,4.43359,0,2.47559,1.60645,3.69629,3.19043,3.69629A2.70585,2.70585,0,0,0,16.96,12.19727,2.43861,2.43861,0,0,0,14.51758,9.64453Zm-.23047,3.58691c-.67187,0-1.22168-.81445-1.22168-1.45215,0-.47363.30762-.583.72559-.583.96875,0,1.27734.59375,1.27734,1.12207A.82182.82182,0,0,1,14.28711,13.23145ZM10,4V14a1,1,0,0,1-2,0V10H3v4a1,1,0,0,1-2,0V4A1,1,0,0,1,3,4V8H8V4a1,1,0,0,1,2,0Z"/></svg>'},italic:'<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="7" x2="13" y1="4" y2="4"/><line class="ql-stroke" x1="5" x2="11" y1="14" y2="14"/><line class="ql-stroke" x1="8" x2="10" y1="14" y2="4"/></svg>',image:'<svg viewbox="0 0 18 18"><rect class="ql-stroke" height="10" width="12" x="3" y="4"/><circle class="ql-fill" cx="6" cy="7" r="1"/><polyline class="ql-even ql-fill" points="5 12 5 11 7 9 8 10 11 7 13 9 13 12 5 12"/></svg>',indent:{"+1":'<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="3" x2="15" y1="14" y2="14"/><line class="ql-stroke" x1="3" x2="15" y1="4" y2="4"/><line class="ql-stroke" x1="9" x2="15" y1="9" y2="9"/><polyline class="ql-fill ql-stroke" points="3 7 3 11 5 9 3 7"/></svg>',"-1":'<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="3" x2="15" y1="14" y2="14"/><line class="ql-stroke" x1="3" x2="15" y1="4" y2="4"/><line class="ql-stroke" x1="9" x2="15" y1="9" y2="9"/><polyline class="ql-stroke" points="5 7 5 11 3 9 5 7"/></svg>'},link:'<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="7" x2="11" y1="7" y2="11"/><path class="ql-even ql-stroke" d="M8.9,4.577a3.476,3.476,0,0,1,.36,4.679A3.476,3.476,0,0,1,4.577,8.9C3.185,7.5,2.035,6.4,4.217,4.217S7.5,3.185,8.9,4.577Z"/><path class="ql-even ql-stroke" d="M13.423,9.1a3.476,3.476,0,0,0-4.679-.36,3.476,3.476,0,0,0,.36,4.679c1.392,1.392,2.5,2.542,4.679.36S14.815,10.5,13.423,9.1Z"/></svg>',list:{bullet:'<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="6" x2="15" y1="4" y2="4"/><line class="ql-stroke" x1="6" x2="15" y1="9" y2="9"/><line class="ql-stroke" x1="6" x2="15" y1="14" y2="14"/><line class="ql-stroke" x1="3" x2="3" y1="4" y2="4"/><line class="ql-stroke" x1="3" x2="3" y1="9" y2="9"/><line class="ql-stroke" x1="3" x2="3" y1="14" y2="14"/></svg>',check:'<svg class="" viewbox="0 0 18 18"><line class="ql-stroke" x1="9" x2="15" y1="4" y2="4"/><polyline class="ql-stroke" points="3 4 4 5 6 3"/><line class="ql-stroke" x1="9" x2="15" y1="14" y2="14"/><polyline class="ql-stroke" points="3 14 4 15 6 13"/><line class="ql-stroke" x1="9" x2="15" y1="9" y2="9"/><polyline class="ql-stroke" points="3 9 4 10 6 8"/></svg>',ordered:'<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="7" x2="15" y1="4" y2="4"/><line class="ql-stroke" x1="7" x2="15" y1="9" y2="9"/><line class="ql-stroke" x1="7" x2="15" y1="14" y2="14"/><line class="ql-stroke ql-thin" x1="2.5" x2="4.5" y1="5.5" y2="5.5"/><path class="ql-fill" d="M3.5,6A0.5,0.5,0,0,1,3,5.5V3.085l-0.276.138A0.5,0.5,0,0,1,2.053,3c-0.124-.247-0.023-0.324.224-0.447l1-.5A0.5,0.5,0,0,1,4,2.5v3A0.5,0.5,0,0,1,3.5,6Z"/><path class="ql-stroke ql-thin" d="M4.5,10.5h-2c0-.234,1.85-1.076,1.85-2.234A0.959,0.959,0,0,0,2.5,8.156"/><path class="ql-stroke ql-thin" d="M2.5,14.846a0.959,0.959,0,0,0,1.85-.109A0.7,0.7,0,0,0,3.75,14a0.688,0.688,0,0,0,.6-0.736,0.959,0.959,0,0,0-1.85-.109"/></svg>'},script:{sub:'<svg viewbox="0 0 18 18"><path class="ql-fill" d="M15.5,15H13.861a3.858,3.858,0,0,0,1.914-2.975,1.8,1.8,0,0,0-1.6-1.751A1.921,1.921,0,0,0,12.021,11.7a0.50013,0.50013,0,1,0,.957.291h0a0.914,0.914,0,0,1,1.053-.725,0.81,0.81,0,0,1,.744.762c0,1.076-1.16971,1.86982-1.93971,2.43082A1.45639,1.45639,0,0,0,12,15.5a0.5,0.5,0,0,0,.5.5h3A0.5,0.5,0,0,0,15.5,15Z"/><path class="ql-fill" d="M9.65,5.241a1,1,0,0,0-1.409.108L6,7.964,3.759,5.349A1,1,0,0,0,2.192,6.59178Q2.21541,6.6213,2.241,6.649L4.684,9.5,2.241,12.35A1,1,0,0,0,3.71,13.70722q0.02557-.02768.049-0.05722L6,11.036,8.241,13.65a1,1,0,1,0,1.567-1.24277Q9.78459,12.3777,9.759,12.35L7.316,9.5,9.759,6.651A1,1,0,0,0,9.65,5.241Z"/></svg>',super:'<svg viewbox="0 0 18 18"><path class="ql-fill" d="M15.5,7H13.861a4.015,4.015,0,0,0,1.914-2.975,1.8,1.8,0,0,0-1.6-1.751A1.922,1.922,0,0,0,12.021,3.7a0.5,0.5,0,1,0,.957.291,0.917,0.917,0,0,1,1.053-.725,0.81,0.81,0,0,1,.744.762c0,1.077-1.164,1.925-1.934,2.486A1.423,1.423,0,0,0,12,7.5a0.5,0.5,0,0,0,.5.5h3A0.5,0.5,0,0,0,15.5,7Z"/><path class="ql-fill" d="M9.651,5.241a1,1,0,0,0-1.41.108L6,7.964,3.759,5.349a1,1,0,1,0-1.519,1.3L4.683,9.5,2.241,12.35a1,1,0,1,0,1.519,1.3L6,11.036,8.241,13.65a1,1,0,0,0,1.519-1.3L7.317,9.5,9.759,6.651A1,1,0,0,0,9.651,5.241Z"/></svg>'},strike:'<svg viewbox="0 0 18 18"><line class="ql-stroke ql-thin" x1="15.5" x2="2.5" y1="8.5" y2="9.5"/><path class="ql-fill" d="M9.007,8C6.542,7.791,6,7.519,6,6.5,6,5.792,7.283,5,9,5c1.571,0,2.765.679,2.969,1.309a1,1,0,0,0,1.9-.617C13.356,4.106,11.354,3,9,3,6.2,3,4,4.538,4,6.5a3.2,3.2,0,0,0,.5,1.843Z"/><path class="ql-fill" d="M8.984,10C11.457,10.208,12,10.479,12,11.5c0,0.708-1.283,1.5-3,1.5-1.571,0-2.765-.679-2.969-1.309a1,1,0,1,0-1.9.617C4.644,13.894,6.646,15,9,15c2.8,0,5-1.538,5-3.5a3.2,3.2,0,0,0-.5-1.843Z"/></svg>',table:'<svg viewbox="0 0 18 18"><rect class="ql-stroke" height="12" width="12" x="3" y="3"/><rect class="ql-fill" height="2" width="3" x="5" y="5"/><rect class="ql-fill" height="2" width="4" x="9" y="5"/><g class="ql-fill ql-transparent"><rect height="2" width="3" x="5" y="8"/><rect height="2" width="4" x="9" y="8"/><rect height="2" width="3" x="5" y="11"/><rect height="2" width="4" x="9" y="11"/></g></svg>',underline:'<svg viewbox="0 0 18 18"><path class="ql-stroke" d="M5,3V9a4.012,4.012,0,0,0,4,4H9a4.012,4.012,0,0,0,4-4V3"/><rect class="ql-fill" height="1" rx="0.5" ry="0.5" width="12" x="3" y="15"/></svg>',video:'<svg viewbox="0 0 18 18"><rect class="ql-stroke" height="12" width="12" x="3" y="3"/><rect class="ql-fill" height="12" width="1" x="5" y="3"/><rect class="ql-fill" height="12" width="1" x="12" y="3"/><rect class="ql-fill" height="2" width="8" x="5" y="8"/><rect class="ql-fill" height="1" width="3" x="3" y="5"/><rect class="ql-fill" height="1" width="3" x="3" y="7"/><rect class="ql-fill" height="1" width="3" x="3" y="10"/><rect class="ql-fill" height="1" width="3" x="3" y="12"/><rect class="ql-fill" height="1" width="3" x="12" y="5"/><rect class="ql-fill" height="1" width="3" x="12" y="7"/><rect class="ql-fill" height="1" width="3" x="12" y="10"/><rect class="ql-fill" height="1" width="3" x="12" y="12"/></svg>'};let ya=0;function xa(e,t){e.setAttribute(t,`${!("true"===e.getAttribute(t))}`)}class wa{constructor(e){this.select=e,this.container=document.createElement("span"),this.buildPicker(),this.select.style.display="none",this.select.parentNode.insertBefore(this.container,this.select),this.label.addEventListener("mousedown",()=>{this.togglePicker()}),this.label.addEventListener("keydown",e=>{switch(e.key){case"Enter":this.togglePicker();break;case"Escape":this.escape(),e.preventDefault()}}),this.select.addEventListener("change",this.update.bind(this))}togglePicker(){this.container.classList.toggle("ql-expanded"),xa(this.label,"aria-expanded"),xa(this.options,"aria-hidden")}buildItem(e){const t=document.createElement("span");t.tabIndex="0",t.setAttribute("role","button"),t.classList.add("ql-picker-item");const n=e.getAttribute("value");return n&&t.setAttribute("data-value",n),e.textContent&&t.setAttribute("data-label",e.textContent),t.addEventListener("click",()=>{this.selectItem(t,!0)}),t.addEventListener("keydown",e=>{switch(e.key){case"Enter":this.selectItem(t,!0),e.preventDefault();break;case"Escape":this.escape(),e.preventDefault()}}),t}buildLabel(){const e=document.createElement("span");return e.classList.add("ql-picker-label"),e.innerHTML='<svg viewbox="0 0 18 18"><polygon class="ql-stroke" points="7 11 9 13 11 11 7 11"/><polygon class="ql-stroke" points="7 7 9 5 11 7 7 7"/></svg>',e.tabIndex="0",e.setAttribute("role","button"),e.setAttribute("aria-expanded","false"),this.container.appendChild(e),e}buildOptions(){const e=document.createElement("span");e.classList.add("ql-picker-options"),e.setAttribute("aria-hidden","true"),e.tabIndex="-1",e.id=`ql-picker-options-${ya}`,ya+=1,this.label.setAttribute("aria-controls",e.id),this.options=e,Array.from(this.select.options).forEach(t=>{const n=this.buildItem(t);e.appendChild(n),!0===t.selected&&this.selectItem(n)}),this.container.appendChild(e)}buildPicker(){Array.from(this.select.attributes).forEach(e=>{this.container.setAttribute(e.name,e.value)}),this.container.classList.add("ql-picker"),this.label=this.buildLabel(),this.buildOptions()}escape(){this.close(),setTimeout(()=>this.label.focus(),1)}close(){this.container.classList.remove("ql-expanded"),this.label.setAttribute("aria-expanded","false"),this.options.setAttribute("aria-hidden","true")}selectItem(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const n=this.container.querySelector(".ql-selected");e!==n&&(null!=n&&n.classList.remove("ql-selected"),null!=e&&(e.classList.add("ql-selected"),this.select.selectedIndex=Array.from(e.parentNode.children).indexOf(e),e.hasAttribute("data-value")?this.label.setAttribute("data-value",e.getAttribute("data-value")):this.label.removeAttribute("data-value"),e.hasAttribute("data-label")?this.label.setAttribute("data-label",e.getAttribute("data-label")):this.label.removeAttribute("data-label"),t&&(this.select.dispatchEvent(new Event("change")),this.close())))}update(){let e;if(this.select.selectedIndex>-1){const t=this.container.querySelector(".ql-picker-options").children[this.select.selectedIndex];e=this.select.options[this.select.selectedIndex],this.selectItem(t)}else this.selectItem(null);const t=null!=e&&e!==this.select.querySelector("option[selected]");this.label.classList.toggle("ql-active",t)}}class Na extends wa{constructor(e,t){super(e),this.label.innerHTML=t,this.container.classList.add("ql-color-picker"),Array.from(this.container.querySelectorAll(".ql-picker-item")).slice(0,7).forEach(e=>{e.classList.add("ql-primary")})}buildItem(e){const t=super.buildItem(e);return t.style.backgroundColor=e.getAttribute("value")||"",t}selectItem(e,t){super.selectItem(e,t);const n=this.label.querySelector(".ql-color-label"),r=e&&e.getAttribute("data-value")||"";n&&("line"===n.tagName?n.style.stroke=r:n.style.fill=r)}}class Ea extends wa{constructor(e,t){super(e),this.container.classList.add("ql-icon-picker"),Array.from(this.container.querySelectorAll(".ql-picker-item")).forEach(e=>{e.innerHTML=t[e.getAttribute("data-value")||""]}),this.defaultItem=this.container.querySelector(".ql-selected"),this.selectItem(this.defaultItem)}selectItem(e,t){super.selectItem(e,t);const n=e||this.defaultItem;if(null!=n){if(this.label.innerHTML===n.innerHTML)return;this.label.innerHTML=n.innerHTML}}}class ka{constructor(e,t){this.quill=e,this.boundsContainer=t||document.body,this.root=e.addContainer("ql-tooltip"),this.root.innerHTML=this.constructor.TEMPLATE,(e=>{const{overflowY:t}=getComputedStyle(e,null);return"visible"!==t&&"clip"!==t})(this.quill.root)&&this.quill.root.addEventListener("scroll",()=>{this.root.style.marginTop=-1*this.quill.root.scrollTop+"px"}),this.hide()}hide(){this.root.classList.add("ql-hidden")}position(e){const t=e.left+e.width/2-this.root.offsetWidth/2,n=e.bottom+this.quill.root.scrollTop;this.root.style.left=`${t}px`,this.root.style.top=`${n}px`,this.root.classList.remove("ql-flip");const r=this.boundsContainer.getBoundingClientRect(),s=this.root.getBoundingClientRect();let i=0;if(s.right>r.right&&(i=r.right-s.right,this.root.style.left=`${t+i}px`),s.left<r.left&&(i=r.left-s.left,this.root.style.left=`${t+i}px`),s.bottom>r.bottom){const t=s.bottom-s.top,r=e.bottom-e.top+t;this.root.style.top=n-r+"px",this.root.classList.add("ql-flip")}return i}show(){this.root.classList.remove("ql-editing"),this.root.classList.remove("ql-hidden")}}const Sa=[!1,"center","right","justify"],Aa=["#000000","#e60000","#ff9900","#ffff00","#008a00","#0066cc","#9933ff","#ffffff","#facccc","#ffebcc","#ffffcc","#cce8cc","#cce0f5","#ebd6ff","#bbbbbb","#f06666","#ffc266","#ffff66","#66b966","#66a3e0","#c285ff","#888888","#a10000","#b26b00","#b2b200","#006100","#0047b2","#6b24b2","#444444","#5c0000","#663d00","#666600","#003700","#002966","#3d1466"],Ca=[!1,"serif","monospace"],ja=["1","2","3",!1],_a=["small",!1,"large","huge"];class Oa extends go{constructor(e,t){super(e,t);const n=t=>{document.body.contains(e.root)?(null==this.tooltip||this.tooltip.root.contains(t.target)||document.activeElement===this.tooltip.textbox||this.quill.hasFocus()||this.tooltip.hide(),null!=this.pickers&&this.pickers.forEach(e=>{e.container.contains(t.target)||e.close()})):document.body.removeEventListener("click",n)};e.emitter.listenDOM("click",document.body,n)}addModule(e){const t=super.addModule(e);return"toolbar"===e&&this.extendToolbar(t),t}buildButtons(e,t){Array.from(e).forEach(e=>{(e.getAttribute("class")||"").split(/\s+/).forEach(n=>{if(n.startsWith("ql-")&&(n=n.slice(3),null!=t[n]))if("direction"===n)e.innerHTML=t[n][""]+t[n].rtl;else if("string"==typeof t[n])e.innerHTML=t[n];else{const r=e.value||"";null!=r&&t[n][r]&&(e.innerHTML=t[n][r])}})})}buildPickers(e,t){this.pickers=Array.from(e).map(e=>{if(e.classList.contains("ql-align")&&(null==e.querySelector("option")&&La(e,Sa),"object"==typeof t.align))return new Ea(e,t.align);if(e.classList.contains("ql-background")||e.classList.contains("ql-color")){const n=e.classList.contains("ql-background")?"background":"color";return null==e.querySelector("option")&&La(e,Aa,"background"===n?"#ffffff":"#000000"),new Na(e,t[n])}return null==e.querySelector("option")&&(e.classList.contains("ql-font")?La(e,Ca):e.classList.contains("ql-header")?La(e,ja):e.classList.contains("ql-size")&&La(e,_a)),new wa(e)});this.quill.on(Ji.events.EDITOR_CHANGE,()=>{this.pickers.forEach(e=>{e.update()})})}}Oa.DEFAULTS=Ts({},go.DEFAULTS,{modules:{toolbar:{handlers:{formula(){this.quill.theme.tooltip.edit("formula")},image(){let e=this.container.querySelector("input.ql-image[type=file]");null==e&&(e=document.createElement("input"),e.setAttribute("type","file"),e.setAttribute("accept",this.quill.uploader.options.mimetypes.join(", ")),e.classList.add("ql-image"),e.addEventListener("change",()=>{const t=this.quill.getSelection(!0);this.quill.uploader.upload(t,e.files),e.value=""}),this.container.appendChild(e)),e.click()},video(){this.quill.theme.tooltip.edit("video")}}}}});class Ta extends ka{constructor(e,t){super(e,t),this.textbox=this.root.querySelector('input[type="text"]'),this.listen()}listen(){this.textbox.addEventListener("keydown",e=>{"Enter"===e.key?(this.save(),e.preventDefault()):"Escape"===e.key&&(this.cancel(),e.preventDefault())})}cancel(){this.hide(),this.restoreFocus()}edit(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"link",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(this.root.classList.remove("ql-hidden"),this.root.classList.add("ql-editing"),null==this.textbox)return;null!=t?this.textbox.value=t:e!==this.root.getAttribute("data-mode")&&(this.textbox.value="");const n=this.quill.getBounds(this.quill.selection.savedRange);null!=n&&this.position(n),this.textbox.select(),this.textbox.setAttribute("placeholder",this.textbox.getAttribute(`data-${e}`)||""),this.root.setAttribute("data-mode",e)}restoreFocus(){this.quill.focus({preventScroll:!0})}save(){let{value:e}=this.textbox;switch(this.root.getAttribute("data-mode")){case"link":{const{scrollTop:t}=this.quill.root;this.linkRange?(this.quill.formatText(this.linkRange,"link",e,Ji.sources.USER),delete this.linkRange):(this.restoreFocus(),this.quill.format("link",e,Ji.sources.USER)),this.quill.root.scrollTop=t;break}case"video":e=function(e){let t=e.match(/^(?:(https?):\/\/)?(?:(?:www|m)\.)?youtube\.com\/watch.*v=([a-zA-Z0-9_-]+)/)||e.match(/^(?:(https?):\/\/)?(?:(?:www|m)\.)?youtu\.be\/([a-zA-Z0-9_-]+)/);if(t)return`${t[1]||"https"}://www.youtube.com/embed/${t[2]}?showinfo=0`;if(t=e.match(/^(?:(https?):\/\/)?(?:www\.)?vimeo\.com\/(\d+)/))return`${t[1]||"https"}://player.vimeo.com/video/${t[2]}/`;return e}(e);case"formula":{if(!e)break;const t=this.quill.getSelection(!0);if(null!=t){const n=t.index+t.length;this.quill.insertEmbed(n,this.root.getAttribute("data-mode"),e,Ji.sources.USER),"formula"===this.root.getAttribute("data-mode")&&this.quill.insertText(n+1," ",Ji.sources.USER),this.quill.setSelection(n+2,Ji.sources.USER)}break}}this.textbox.value="",this.hide()}}function La(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];t.forEach(t=>{const r=document.createElement("option");t===n?r.setAttribute("selected","selected"):r.setAttribute("value",String(t)),e.appendChild(r)})}const qa=[["bold","italic","link"],[{header:1},{header:2},"blockquote"]];class Ia extends Ta{constructor(e,t){super(e,t),this.quill.on(Ji.events.EDITOR_CHANGE,(e,t,n,r)=>{if(e===Ji.events.SELECTION_CHANGE)if(null!=t&&t.length>0&&r===Ji.sources.USER){this.show(),this.root.style.left="0px",this.root.style.width="",this.root.style.width=`${this.root.offsetWidth}px`;const e=this.quill.getLines(t.index,t.length);if(1===e.length){const e=this.quill.getBounds(t);null!=e&&this.position(e)}else{const n=e[e.length-1],r=this.quill.getIndex(n),s=Math.min(n.length()-1,t.index+t.length-r),i=this.quill.getBounds(new Qi(r,s));null!=i&&this.position(i)}}else document.activeElement!==this.textbox&&this.quill.hasFocus()&&this.hide()})}listen(){super.listen(),this.root.querySelector(".ql-close").addEventListener("click",()=>{this.root.classList.remove("ql-editing")}),this.quill.on(Ji.events.SCROLL_OPTIMIZE,()=>{setTimeout(()=>{if(this.root.classList.contains("ql-hidden"))return;const e=this.quill.getSelection();if(null!=e){const t=this.quill.getBounds(e);null!=t&&this.position(t)}},1)})}cancel(){this.show()}position(e){const t=super.position(e),n=this.root.querySelector(".ql-tooltip-arrow");return n.style.marginLeft="",0!==t&&(n.style.marginLeft=-1*t-n.offsetWidth/2+"px"),t}}t(Ia,"TEMPLATE",['<span class="ql-tooltip-arrow"></span>','<div class="ql-tooltip-editor">','<input type="text" data-formula="e=mc^2" data-link="https://quilljs.com" data-video="Embed URL">','<a class="ql-close"></a>',"</div>"].join(""));class Ra extends Oa{constructor(e,t){null!=t.modules.toolbar&&null==t.modules.toolbar.container&&(t.modules.toolbar.container=qa),super(e,t),this.quill.container.classList.add("ql-bubble")}extendToolbar(e){this.tooltip=new Ia(this.quill,this.options.bounds),null!=e.container&&(this.tooltip.root.appendChild(e.container),this.buildButtons(e.container.querySelectorAll("button"),ba),this.buildPickers(e.container.querySelectorAll("select"),ba))}}Ra.DEFAULTS=Ts({},Oa.DEFAULTS,{modules:{toolbar:{handlers:{link(e){e?this.quill.theme.tooltip.edit():this.quill.format("link",!1,So.sources.USER)}}}}});const Ma=[[{header:["1","2","3",!1]}],["bold","italic","underline","link"],[{list:"ordered"},{list:"bullet"}],["clean"]];class Ba extends Ta{constructor(){super(...arguments),t(this,"preview",this.root.querySelector("a.ql-preview"))}listen(){super.listen(),this.root.querySelector("a.ql-action").addEventListener("click",e=>{this.root.classList.contains("ql-editing")?this.save():this.edit("link",this.preview.textContent),e.preventDefault()}),this.root.querySelector("a.ql-remove").addEventListener("click",e=>{if(null!=this.linkRange){const e=this.linkRange;this.restoreFocus(),this.quill.formatText(e,"link",!1,Ji.sources.USER),delete this.linkRange}e.preventDefault(),this.hide()}),this.quill.on(Ji.events.SELECTION_CHANGE,(e,t,n)=>{if(null!=e){if(0===e.length&&n===Ji.sources.USER){const[t,n]=this.quill.scroll.descendant(Wl,e.index);if(null!=t){this.linkRange=new Qi(e.index-n,t.length());const r=Wl.formats(t.domNode);this.preview.textContent=r,this.preview.setAttribute("href",r),this.show();const s=this.quill.getBounds(this.linkRange);return void(null!=s&&this.position(s))}}else delete this.linkRange;this.hide()}})}show(){super.show(),this.root.removeAttribute("data-mode")}}t(Ba,"TEMPLATE",['<a class="ql-preview" rel="noopener noreferrer" target="_blank" href="about:blank"></a>','<input type="text" data-formula="e=mc^2" data-link="https://quilljs.com" data-video="Embed URL">','<a class="ql-action"></a>','<a class="ql-remove"></a>'].join(""));class Da extends Oa{constructor(e,t){null!=t.modules.toolbar&&null==t.modules.toolbar.container&&(t.modules.toolbar.container=Ma),super(e,t),this.quill.container.classList.add("ql-snow")}extendToolbar(e){null!=e.container&&(e.container.classList.add("ql-snow"),this.buildButtons(e.container.querySelectorAll("button"),ba),this.buildPickers(e.container.querySelectorAll("select"),ba),this.tooltip=new Ba(this.quill,this.options.bounds),e.container.querySelector(".ql-link")&&this.quill.keyboard.addBinding({key:"k",shortKey:!0},(t,n)=>{e.handlers.link.call(e,!n.format.link)}))}}Da.DEFAULTS=Ts({},Oa.DEFAULTS,{modules:{toolbar:{handlers:{link(e){if(e){const e=this.quill.getSelection();if(null==e||0===e.length)return;let t=this.quill.getText(e);/^\S+@\S+\.\S+$/.test(t)&&0!==t.indexOf("mailto:")&&(t=`mailto:${t}`);const{tooltip:n}=this.quill.theme;n.edit("link",t)}else this.quill.format("link",!1,So.sources.USER)}}}}}),So.register({"attributors/attribute/direction":Yo,"attributors/class/align":Po,"attributors/class/background":Vo,"attributors/class/color":zo,"attributors/class/direction":Jo,"attributors/class/font":el,"attributors/class/size":nl,"attributors/style/align":Fo,"attributors/style/background":Ho,"attributors/style/color":$o,"attributors/style/direction":Xo,"attributors/style/font":tl,"attributors/style/size":rl},!0),So.register({"formats/align":Po,"formats/direction":Jo,"formats/indent":Fl,"formats/background":Ho,"formats/color":$o,"formats/font":el,"formats/size":nl,"formats/blockquote":Ul,"formats/code-block":Wo,"formats/header":zl,"formats/list":Vl,"formats/bold":Hl,"formats/code":Go,"formats/italic":Kl,"formats/link":Wl,"formats/script":Zl,"formats/strike":Yl,"formats/underline":Jl,"formats/formula":Xl,"formats/image":ea,"formats/video":na,"modules/syntax":la,"modules/table":class extends uo{static register(){So.register(ca),So.register(ua),So.register(da),So.register(ha)}constructor(){super(...arguments),this.listenBalanceCells()}balanceTables(){this.quill.scroll.descendants(ha).forEach(e=>{e.balanceCells()})}deleteColumn(){const[e,,t]=this.getTable();null!=t&&(e.deleteColumn(t.cellOffset()),this.quill.update(So.sources.USER))}deleteRow(){const[,e]=this.getTable();null!=e&&(e.remove(),this.quill.update(So.sources.USER))}deleteTable(){const[e]=this.getTable();if(null==e)return;const t=e.offset();e.remove(),this.quill.update(So.sources.USER),this.quill.setSelection(t,So.sources.SILENT)}getTable(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.quill.getSelection();if(null==e)return[null,null,null,-1];const[t,n]=this.quill.getLine(e.index);if(null==t||t.statics.blotName!==ca.blotName)return[null,null,null,-1];const r=t.parent;return[r.parent.parent,r,t,n]}insertColumn(e){const t=this.quill.getSelection();if(!t)return;const[n,r,s]=this.getTable(t);if(null==s)return;const i=s.cellOffset();n.insertColumn(i+e),this.quill.update(So.sources.USER);let o=r.rowOffset();0===e&&(o+=1),this.quill.setSelection(t.index+o,t.length,So.sources.SILENT)}insertColumnLeft(){this.insertColumn(0)}insertColumnRight(){this.insertColumn(1)}insertRow(e){const t=this.quill.getSelection();if(!t)return;const[n,r,s]=this.getTable(t);if(null==s)return;const i=r.rowOffset();n.insertRow(i+e),this.quill.update(So.sources.USER),e>0?this.quill.setSelection(t,So.sources.SILENT):this.quill.setSelection(t.index+r.children.length,t.length,So.sources.SILENT)}insertRowAbove(){this.insertRow(0)}insertRowBelow(){this.insertRow(1)}insertTable(e,t){const n=this.quill.getSelection();if(null==n)return;const r=new Array(e).fill(0).reduce(e=>{const n=new Array(t).fill("\n").join("");return e.insert(n,{table:fa()})},(new ji).retain(n.index));this.quill.updateContents(r,So.sources.USER),this.quill.setSelection(n.index,So.sources.SILENT),this.balanceTables()}listenBalanceCells(){this.quill.on(So.events.SCROLL_OPTIMIZE,e=>{e.some(e=>!!["TD","TR","TBODY","TABLE"].includes(e.target.tagName)&&(this.quill.once(So.events.TEXT_CHANGE,(e,t,n)=>{n===So.sources.USER&&this.balanceTables()}),!0))})}},"modules/toolbar":ma,"themes/bubble":Ra,"themes/snow":Da,"ui/icons":ba,"ui/picker":wa,"ui/icon-picker":Ea,"ui/color-picker":Na,"ui/tooltip":ka},!0);const Pa=({value:e,onChange:t,placeholder:s,style:i})=>{const o=r.useRef(null),l=r.useRef(null);return r.useEffect(()=>{if(o.current&&!l.current){l.current=new So(o.current,{theme:"snow",modules:{toolbar:[[{header:[1,2,!1]}],["bold","italic","underline"],["link","image"]]},placeholder:s});const e=l.current;e.on("text-change",(n,r,s)=>{if("user"===s){const n=e.root.innerHTML;null==t||t("<p><br></p>"===n?"":n)}})}},[s]),r.useEffect(()=>{const t=l.current;if(t&&e!==t.root.innerHTML){const n=0===t.getText().trim().length;!e&&n||t.clipboard.dangerouslyPasteHTML(e||"")}},[e]),n.jsx("div",{ref:o,style:{minHeight:"200px",...i}})},Fa="_fileUploadWrapper_byo9w_1",Ua=({value:e,onChange:t,accept:o=".pdf,.doc,.docx,.xls,.xlsx,.txt,.zip,.rar",listType:l="text",maxCount:a=1,key:c,disabled:u=!1,maxSize:d=1e3,buttonText:h="上传文件"})=>{const[p,m]=r.useState(!1),[g,v]=r.useState(""),[b,y]=r.useState(""),[x,w]=r.useState("none"),[N,E]=r.useState([]),[k,S]=r.useState(!1),A=e=>{try{const n=e.split("/");let r=n[n.length-1];r.includes("?")&&(r=r.split("?")[0]);try{r=decodeURIComponent(r)}catch(t){}return r||"未知文件"}catch(n){return"未知文件"}},C=e=>e?Array.isArray(e)?e.filter(Boolean):"string"==typeof e?e.split(",").map(e=>e.trim()).filter(Boolean):[]:[],j=r.useMemo(()=>{const t=C(e);return JSON.stringify(t)},[e]),_=r.useRef(N);r.useEffect(()=>{_.current=N},[N]),r.useEffect(()=>{if(k)return void S(!1);const t=C(e),n=_.current.filter(e=>"done"===e.status).map(e=>e.url).filter(Boolean);if(JSON.stringify(n)!==JSON.stringify(t))if(t.length>0){const e=t.map((e,t)=>({uid:`-${t+1}`,name:A(e),status:"done",url:e}));E(e)}else E([])},[j,k]);const O=r.useCallback(e=>{t&&t(e)},[t]);return n.jsxs("div",{className:Fa,children:[n.jsx(s.Upload,{accept:o,listType:l,fileList:N,onPreview:async e=>{const t=e.url||e.preview,n=e.name||"",r=(e=>{const t=e.substring(e.lastIndexOf(".")).toLowerCase();return[".jpg",".jpeg",".png",".gif",".bmp",".webp"].includes(t)?"image":[".txt",".json",".xml",".log"].includes(t)?"text":"none"})(n);y(n),w(r),"image"===r?(e.url||e.preview||!e.originFileObj||(e.preview=await(e=>new Promise((t,n)=>{const r=new FileReader;r.readAsDataURL(e),r.onload=()=>t(r.result),r.onerror=e=>n(e)}))(e.originFileObj)),v(e.url||e.preview),m(!0)):t?window.open(t,"_blank"):s.message.info("文件预览不可用")},onChange:({file:e,fileList:t})=>{var n,r;if(S(!0),"done"===e.status){if(null==(n=e.response)?void 0:n.data){s.message.success(`${e.name} 文件上传成功`);const n=t.map(t=>{var n;return t.uid===e.uid&&(null==(n=t.response)?void 0:n.data)?{...t,url:t.response.data,name:t.name}:t});E(n);const r=n.filter(e=>"done"===e.status).map(e=>{var t;return(null==(t=e.response)?void 0:t.data)||e.url}).filter(Boolean);1===a?null==O||O(r[0]||void 0):null==O||O(r.length>0?r:void 0)}else s.message.error(`${e.name} 文件上传成功,但未获取到 URL。`),E(t.filter(t=>t.uid!==e.uid))}else if("removed"===e.status){s.message.success(`${e.name} 文件已移除`),E(t);const n=t.filter(e=>"done"===e.status).map(e=>{var t;return(null==(t=e.response)?void 0:t.data)||e.url}).filter(Boolean);1===a?null==O||O(void 0):null==O||O(n.length>0?n:void 0)}else if("error"===e.status){s.message.error(`${e.name} 文件上传失败: ${(null==(r=e.error)?void 0:r.message)||"未知错误"}`),E(t);const n=t.filter(e=>"done"===e.status).map(e=>{var t;return(null==(t=e.response)?void 0:t.data)||e.url}).filter(Boolean);1===a?null==O||O(n[0]||void 0):null==O||O(n.length>0?n:void 0)}else E(t)},customRequest:async e=>{var t;const{onSuccess:n,onError:r,file:o,onProgress:l}=e,a=1024*d*1024;if(o instanceof File&&o.size>a)return s.message.error(`文件大小不能超过 ${d}MB`),void r(new Error(`文件大小不能超过 ${d}MB`));const c=new FormData;c.append("file",o);const u=null==(t=null==f?void 0:f.getOrgInfo())?void 0:t.orgId;u&&c.append("orgId",u.toString());try{const e=await(async(e,t)=>{const n=f.getToken();try{return(await i.post("/api/sterilization-service/common/uploadFile",e,{timeout:12e4,headers:{"Content-Type":"multipart/form-data",Authorization:`Bearer ${n}`,accessToken:n,...null==t?void 0:t.headers},onUploadProgress:null==t?void 0:t.onUploadProgress})).data}catch(r){if("ECONNABORTED"===r.code)throw new Error("上传超时,请检查网络连接或文件大小");throw r}})(c,{headers:{"Content-Type":"multipart/form-data"},onUploadProgress:e=>{e.total&&l({percent:e.loaded/e.total*100})}});e&&e.data?n(e,o):r(new Error("上传成功但响应中缺少文件URL"),e)}catch(h){r(h)}},maxCount:a,disabled:u,showUploadList:{showDownloadIcon:!0,showRemoveIcon:!u},onRemove:e=>!0,children:N.length>=(a||1)?null:n.jsx(s.Button,{icon:n.jsx(St,{}),disabled:u,type:"primary",children:h})},c),n.jsxs(s.Modal,{visible:p,title:b,footer:null,onCancel:()=>{m(!1),v(""),w("none")},width:"image"===x?800:600,children:["image"===x&&n.jsx("img",{alt:"预览",style:{width:"100%"},src:g}),"text"===x&&n.jsx("pre",{style:{maxHeight:"500px",overflow:"auto",whiteSpace:"pre-wrap"},children:g})]})]})},za="_formLabel_om345_1",$a="_tabContainer_om345_9",Va="_tabHeader_om345_14",Ha="_tabContent_om345_17",Ka="_treeselectEllipsis_om345_28",Wa="_addonAfterSelect_om345_46",Ga="_customAddModalBody_om345_50",Za="_customDisabled_om345_57",Ya=e=>new Promise((t,n)=>{const r=new FileReader;r.readAsDataURL(e),r.onload=()=>t(r.result),r.onerror=e=>n(e)}),Ja=({value:e,onChange:t,accept:i="image/*",listType:o="picture-card",maxCount:l=1,maxSize:a=5,disabled:c=!1,...u})=>{const[d,h]=r.useState(!1),[f,p]=r.useState(""),[m,g]=r.useState(""),[v,b]=r.useState([]),y=e=>e?e.startsWith("data:")?e:`data:image/png;base64,${e}`:"",x=e=>e?e.includes(",")?e.split(",")[1]:e:"";r.useEffect(()=>{if(e&&Array.isArray(e)&&e.length>0){const t=e.map((e,t)=>{let n="",r="";if("string"==typeof e)r=x(e),n=y(e);else if(Array.isArray(e)&&e.length>0&&"number"==typeof e[0]){const t=(e=>{try{const t=new Uint8Array(e);let n="";for(let e=0;e<t.length;e++)n+=String.fromCharCode(t[e]);return`data:image/png;base64,${btoa(n)}`}catch(t){return""}})(e);r=x(t),n=t}return{uid:`-${t}`,name:`image-${t}.png`,status:"done",url:n,thumbUrl:n,response:{data:r,url:n}}});b(t)}else b([])},[e]);const w=r.useCallback(e=>{t&&t(e)},[t]),N=n.jsxs("div",{children:[n.jsx(ft,{}),n.jsx("div",{style:{marginTop:8},children:"上传"})]});return n.jsxs(n.Fragment,{children:[n.jsx(s.Upload,{accept:i,listType:o,fileList:v,onPreview:async e=>{let t=e.url;if(t||e.preview||!e.originFileObj?!t&&e.preview&&(t=e.preview):(e.preview=await Ya(e.originFileObj),t=e.preview),!t)return void s.message.error("无法预览图片:未找到图片数据");p(t),h(!0);const n=e.name||"预览图片";g(n)},onChange:async({file:e,fileList:t})=>{var n,r,i;const o=e=>{var t,n;return(null==(t=e.response)?void 0:t.data)&&"string"==typeof e.response.data?x(e.response.data):(null==(n=e.response)?void 0:n.url)&&"string"==typeof e.response.url?x(e.response.url):e.url&&"string"==typeof e.url?x(e.url):e.preview&&"string"==typeof e.preview?x(e.preview):null};if("done"===e.status){const i=(null==(n=e.response)?void 0:n.data)||(null==(r=e.response)?void 0:r.url)||e.url||e.preview;if(i&&"string"==typeof i){s.message.success(`${e.name} 处理成功`);const n=y(i),r=t.map(t=>t.uid===e.uid?{...t,url:n,thumbUrl:n,response:{...e.response,data:x(i),url:n}}:t);b(r);const l=r.filter(e=>"done"===e.status).map(o).filter(Boolean);w(l.length>0?l:void 0)}else s.message.error(`${e.name} 处理失败:无法获取图片数据`),b(t.filter(t=>t.uid!==e.uid))}else if("removed"===e.status){s.message.success(`${e.name} 已移除`),b(t);const n=t.filter(e=>"done"===e.status).map(o).filter(Boolean);w(n.length>0?n:void 0)}else"error"===e.status?(s.message.error(`${e.name} 处理失败: ${(null==(i=e.error)?void 0:i.message)||"未知错误"}`),b(t)):b(t)},customRequest:async e=>{const{onSuccess:t,onError:n,file:r,onProgress:i}=e,o=1024*a*1024;if(r instanceof File&&r.size>o)return s.message.error(`图片大小不能超过 ${a}MB`),void(null==n||n(new Error(`图片大小不能超过 ${a}MB`)));try{i({percent:0});const e=await Ya(r),n=x(e);i({percent:100});t({data:n,url:e,preview:e},r)}catch(l){s.message.error((null==l?void 0:l.message)||"图片处理失败"),n(l)}},beforeUpload:e=>{const t=1024*a*1024;if(e.size>t)return s.message.error(`图片大小不能超过 ${a}MB`),s.Upload.LIST_IGNORE;return!!e.type.startsWith("image/")||(s.message.error("只能上传图片文件"),s.Upload.LIST_IGNORE)},maxCount:l,disabled:c,...u,children:l&&v.length>=l?null:N}),n.jsx(s.Modal,{open:d,title:m,footer:null,onCancel:()=>h(!1),width:800,children:n.jsx("img",{alt:"preview",style:{width:"100%"},src:f})})]})},Xa="_fileUploadContainer_1qeig_1",Qa="_uploadButton_1qeig_1",ec="_uploadText_1qeig_4",tc="_previewContainer_1qeig_28",nc="_previewIcon_1qeig_31",rc="_previewInfo_1qeig_35",sc="_downloadLink_1qeig_38",ic="_fileSizeInfo_1qeig_46",oc=e=>{var t;switch(null==(t=e.split(".").pop())?void 0:t.toLowerCase()){case"jpg":case"jpeg":case"png":case"gif":case"bmp":case"webp":return n.jsx(Ze,{});case"mp4":case"avi":case"mov":case"wmv":case"flv":case"mkv":return n.jsx(jt,{});case"pdf":return n.jsx(Xe,{});case"doc":case"docx":return n.jsx(lt,{});case"xls":case"xlsx":return n.jsx(Ke,{});case"ppt":case"pptx":return n.jsx(tt,{});default:return n.jsx(st,{})}},lc=e=>{var t;const r=null==(t=e.split(".").pop())?void 0:t.toLowerCase();switch(r){case"jpg":case"jpeg":case"png":case"gif":case"bmp":case"webp":return n.jsx(s.Tag,{color:"blue",children:"图片"});case"mp4":case"avi":case"mov":case"wmv":case"flv":case"mkv":return n.jsx(s.Tag,{color:"orange",children:"视频"});case"pdf":return n.jsx(s.Tag,{color:"red",children:"PDF"});case"doc":case"docx":return n.jsx(s.Tag,{color:"blue",children:"Word"});case"xls":case"xlsx":return n.jsx(s.Tag,{color:"green",children:"Excel"});case"ppt":case"pptx":return n.jsx(s.Tag,{color:"orange",children:"PPT"});case"txt":return n.jsx(s.Tag,{color:"default",children:"文本"});case"zip":case"rar":case"7z":return n.jsx(s.Tag,{color:"purple",children:"压缩包"});default:return n.jsx(s.Tag,{color:"default",children:(null==r?void 0:r.toUpperCase())||"文件"})}},ac=e=>{if(0===e)return"0 B";const t=Math.floor(Math.log(e)/Math.log(1024));return parseFloat((e/Math.pow(1024,t)).toFixed(2))+" "+["B","KB","MB","GB"][t]},cc=e=>{var t;const n=null==(t=e.split(".").pop())?void 0:t.toLowerCase();return["jpg","jpeg","png","gif","bmp","webp"].includes(n||"")},uc=e=>{var t;const n=null==(t=e.split(".").pop())?void 0:t.toLowerCase();return["mp4","avi","mov","wmv","flv","mkv"].includes(n||"")},dc=(e,t)=>{if(!e)return e;if(/^(https?:|data:|blob:)/i.test(e))return e;if(!t)return e;return`${t.replace(/\/+$/,"")}${e.startsWith("/")?e:`/${e}`}`},hc=({value:e,onChange:t,accept:i="image/*,video/*",listType:o="picture-card",maxCount:l=5,disabled:a=!1,showFileType:c=!0,baseUrl:u,params:d})=>{const[h,p]=r.useState(!1),[m,g]=r.useState(null),[v,b]=r.useState(""),[y,x]=r.useState([]);r.useEffect(()=>{if(Array.isArray(e)){const t=e.map((e,t)=>({uid:`-${t}`,name:e.fileName,status:"done",url:dc(e.url,u)}));x(t)}else if("string"==typeof e)try{const t=JSON.parse(e);if(Array.isArray(t)){const e=t.map((e,t)=>({uid:`-${t}`,name:e.fileName,status:"done",url:dc(e.url,u)}));x(e)}else x([])}catch(t){x([])}else x([])},[e,u]);const w=r.useCallback(e=>{t&&t(e)},[t]),N=n.jsxs("div",{className:Qa,children:[n.jsx(ft,{}),n.jsx("div",{className:ec,children:"上传"})]});return n.jsxs("div",{className:Xa,children:[n.jsx(s.Upload,{accept:i,listType:o,fileList:y,onPreview:async e=>{e.url||e.preview||e.originFileObj&&(e.preview=await(e=>new Promise((t,n)=>{const r=new FileReader;r.readAsDataURL(e),r.onload=()=>t(r.result),r.onerror=e=>n(e)}))(e.originFileObj)),g(e),p(!0),b(e.name||e.url.substring(e.url.lastIndexOf("/")+1))},onChange:({file:e,fileList:t})=>{var n;if(x(t),"done"===e.status||"removed"===e.status){const n=t.filter(e=>"done"===e.status).map(e=>{var t;return{url:(null==(t=e.response)?void 0:t.data)||e.url||"",fileName:e.name}}).filter(e=>e.url);w(n),"done"===e.status&&s.message.success(`${e.name} 文件上传成功`),"removed"===e.status&&s.message.success(`${e.name} 文件已移除`)}else"error"===e.status&&s.message.error(`${e.name} 文件上传失败: ${(null==(n=e.error)?void 0:n.message)||"未知错误"}`)},customRequest:async e=>{var t;const{onSuccess:n,onError:r,file:i,onProgress:o}=e;if(i instanceof File&&i.size>104857600)return s.message.error("文件大小不能超过 100MB"),void(null==r||r(new Error("文件大小不能超过 100MB")));const l=new FormData;l.append("file",i);const a=null==(t=null==f?void 0:f.getOrgInfo())?void 0:t.orgId;a&&l.append("orgId",a.toString()),d&&"object"==typeof d&&Object.entries(d).forEach(([e,t])=>{null!=t&&l.append(e,"string"==typeof t||t instanceof Blob?t:String(t))});try{const e=await q(l,{headers:{"Content-Type":"multipart/form-data"},onUploadProgress:e=>{e.total&&(null==o||o({percent:e.loaded/e.total*100}))}});e&&e.data?null==n||n(e,i):null==r||r(new Error("上传成功但响应中缺少文件URL"),e)}catch(c){null==r||r(c)}},maxCount:l,disabled:a,onRemove:e=>!0,children:y.length>=(l||1)?null:N}),n.jsx(s.Modal,{open:h,title:v,footer:null,onCancel:()=>p(!1),width:800,children:m&&n.jsx("div",{className:tc,style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"10px"},children:(m.url||m.preview)&&n.jsxs(n.Fragment,{children:[cc(m.name)&&n.jsx("img",{alt:"preview",style:{maxWidth:"100%",maxHeight:"600px",objectFit:"contain"},src:m.url||m.preview}),uc(m.name)&&n.jsx("video",{style:{maxWidth:"100%",maxHeight:"600px"},controls:!0,src:m.url||m.preview}),!cc(m.name)&&!uc(m.name)&&n.jsx("div",{className:nc,style:{fontSize:"48px"},children:oc(m.name)}),n.jsx("div",{className:rc,children:lc(m.name)}),n.jsx("div",{children:n.jsx("a",{href:m.url,target:"_blank",rel:"noopener noreferrer",className:sc,children:"下载/查看原文件"})}),m.size&&n.jsxs("div",{className:ic,children:["文件大小: ",ac(m.size)]})]})})})]})},fc="_fileFoldContainer_1dpfd_1",pc="_uploadWrapper_1dpfd_8",mc="_uploadBtn_1dpfd_11",gc="_fileList_1dpfd_16",vc="_fileItem_1dpfd_24",bc="_fileName_1dpfd_29",yc="_deleteIcon_1dpfd_37",xc=({value:e,onChange:t,accept:i="*/*",maxCount:o=100,disabled:l=!1,buttonText:a="文件夹",baseUrl:c,params:u})=>{const[d,h]=r.useState([]),p=e=>{if(!e)return e;if(/^(https?:|data:|blob:)/i.test(e))return e;if(!c)return e;return`${c.replace(/\/+$/,"")}${e.startsWith("/")?e:`/${e}`}`};r.useEffect(()=>{if(Array.isArray(e)){const t=e.map((e,t)=>({uid:`-${t}`,name:e.fileName,status:"done",url:p(e.url)}));h(t)}else if("string"==typeof e)try{const t=JSON.parse(e);if(Array.isArray(t)){const e=t.map((e,t)=>({uid:`-${t}`,name:e.fileName,status:"done",url:p(e.url)}));h(e)}else h([])}catch(t){h([])}else h([])},[e,c]);const m=r.useCallback(e=>{t&&t(e)},[t]);return n.jsxs("div",{className:fc,children:[n.jsx("div",{className:pc,children:n.jsx(s.Upload,{accept:i,showUploadList:!1,fileList:d,onChange:({file:e,fileList:t})=>{var n;if(h(t),"done"===e.status||"removed"===e.status){const n=t.filter(e=>"done"===e.status).map(e=>{var t;return{url:(null==(t=e.response)?void 0:t.data)||e.url||"",fileName:e.name}}).filter(e=>e.url);m(n),"done"===e.status&&s.message.success(`${e.name} 文件上传成功`),e.status}else"error"===e.status&&s.message.error(`${e.name} 文件上传失败: ${(null==(n=e.error)?void 0:n.message)||"未知错误"}`)},customRequest:async e=>{var t;const{onSuccess:n,onError:r,file:i,onProgress:o}=e;if(i instanceof File&&i.size>104857600)return s.message.error("文件大小不能超过 100MB"),void(null==r||r(new Error("文件大小不能超过 100MB")));const l=new FormData;l.append("file",i);const a=null==(t=null==f?void 0:f.getOrgInfo())?void 0:t.orgId;a&&l.append("orgId",a.toString()),u&&"object"==typeof u&&Object.entries(u).forEach(([e,t])=>{null!=t&&l.append(e,"string"==typeof t||t instanceof Blob?t:String(t))});try{const e=await q(l,{headers:{"Content-Type":"multipart/form-data"},onUploadProgress:e=>{e.total&&(null==o||o({percent:e.loaded/e.total*100}))}});e&&e.data?null==n||n(e,i):null==r||r(new Error("上传成功但响应中缺少文件URL"),e)}catch(c){null==r||r(c)}},maxCount:o,disabled:l,multiple:!0,children:n.jsx(s.Button,{icon:n.jsx(ft,{}),type:"dashed",className:mc,children:a})})}),n.jsx("div",{className:gc,children:d.map(e=>n.jsxs("div",{className:vc,children:[n.jsx("span",{className:bc,onClick:()=>(async e=>{if(e.url)try{const t=await fetch(e.url,{method:"GET",mode:"cors",credentials:"include",referrerPolicy:"no-referrer",headers:{}});if(!t.ok)throw new Error("文件下载失败");const n=await t.blob(),r=window.top||window.parent||window,i=window.URL.createObjectURL(n),o=r.document.createElement("a");o.href=i,o.download=e.name,o.rel="noopener noreferrer",o.style.display="none",r.document.body.appendChild(o),o.click(),setTimeout(()=>{r.document.body.removeChild(o),window.URL.revokeObjectURL(i)},100),s.message.success("文件下载成功")}catch(t){try{const t=document.createElement("a");t.href=e.url,t.download=e.name,t.target="_blank",t.rel="noopener noreferrer",t.referrerPolicy="no-referrer",t.click(),s.message.info("正在尝试下载文件...")}catch(n){s.message.error("文件下载失败,请稍后重试")}}})(e),style:{cursor:"pointer"},children:e.name}),!l&&n.jsx(Fe,{className:yc,onClick:()=>(e=>{const t=d.filter(t=>t.uid!==e.uid);h(t);const n=t.filter(e=>"done"===e.status).map(e=>{var t;return{url:(null==(t=e.response)?void 0:t.data)||e.url||"",fileName:e.name}}).filter(e=>e.url);m(n)})(e)})]},e.uid))})]})},{RangePicker:wc}=s.DatePicker,{TextArea:Nc}=s.Input,Ec=r.forwardRef((e,t)=>{var i;const{visible:c,mode:u,config:d,initialValues:h,onOk:p,onCancel:m,title:g,loading:v=!1,oneditFormChange:b,modalProps:y={},CustomModalFooter:x,tab:w=!1,validateConfig:N,activeTab:E,onTabChange:k}=e,[S]=s.Form.useForm(),[A,C]=r.useState("view"==u),[j,_]=r.useState(void 0);r.useRef(null);const L=r.useRef(!1);r.useEffect(()=>{if(c&&w){setTimeout(()=>{const e=document.querySelector(".ant-modal-body");e&&!L.current&&(_(e.clientHeight),L.current=!0)},100)}c||(_(void 0),L.current=!1)},[c,w]),r.useEffect(()=>{C("view"==u)},[u]),r.useImperativeHandle(t,()=>({setFieldsValue:e=>{S.setFieldsValue(e)},getFieldsValue:()=>S.getFieldsValue(),setActiveTab:e=>{I(e),null==k||k(e)}}));const[q,I]=r.useState(void 0),R=E??q,B=e=>{void 0===E&&I(e),null==k||k(e)};r.useEffect(()=>{if(c)if(S.resetFields(),"edit"!==u&&"view"!==u||!h){const e={};w?d.forEach(t=>{(t.children||[]).forEach(t=>{var n,r;const s=void 0!==t.defaultValue?t.defaultValue:null==(r=null==(n=t.options)?void 0:n[0])?void 0:r.value;void 0!==s&&(e[t.name]=s)})}):d.forEach(t=>{void 0!==t.defaultValue&&(e[t.name]=t.defaultValue)}),Object.keys(e).length>0&&S.setFieldsValue(e),V(S.getFieldValue("useOrgId")||z)}else if(w){const e={...h},t=[];d.forEach(e=>{e.children.forEach(e=>{var n,r;t.push({...e,defaultValue:e.defaultValue||(null==(r=null==(n=e.options)?void 0:n[0])?void 0:r.value)||e.defaultValue})})}),t.forEach(t=>{const n=e[t.name];if("datePicker"===t.type&&n)e[t.name]=o(n);else if("rangePicker"===t.type)if("string"==typeof t.name&&t.name.includes("/")){const[n,r]=t.name.split("/"),s=e[n],i=e[r];s&&i&&(e[t.name]=[o(s),o(i)])}else n&&Array.isArray(n)&&(e[t.name]=n.map(e=>o(e)));else if("treeSelect"===t.type&&t.multiple&&n)"string"==typeof n&&(e[t.name]=n.split(","));else if("Radio"===t.type&&t.options&&(0===n||1===n||"0"===n||"1"===n||n)){const r=t.options.find(e=>e.value==n);r&&(e[t.name]=r.value)}}),S.setFieldsValue(e)}else{const e={...h};d.forEach(t=>{const n=e[t.name];if("datePicker"===t.type&&n)e[t.name]=o(n);else if("rangePicker"===t.type)if("string"==typeof t.name&&t.name.includes("/")){const[n,r]=t.name.split("/"),s=e[n],i=e[r];s&&i&&(e[t.name]=[o(s),o(i)])}else n&&Array.isArray(n)&&(e[t.name]=n.map(e=>o(e)));else if("treeSelect"===t.type&&t.multiple&&n)"string"==typeof n&&(e[t.name]=n.split(","));else if("Radio"===t.type&&t.options&&(0===n||1===n||"0"===n||"1"===n||n)){const r=t.options.find(e=>e.value==n);r&&(e[t.name]=r.value)}}),S.setFieldsValue(e)}else S.resetFields()},[c,u,h,S]),r.useEffect(()=>{if(!c)return;if("edit"===u||"view"===u)return;const e={};w?d.forEach(t=>{(t.children||[]).forEach(t=>{var n,r;if(void 0!==S.getFieldValue(t.name))return;const s=void 0!==t.defaultValue?t.defaultValue:null==(r=null==(n=t.options)?void 0:n[0])?void 0:r.value;void 0!==s&&(e[t.name]=s)})}):d.forEach(t=>{void 0===S.getFieldValue(t.name)&&void 0!==t.defaultValue&&(e[t.name]=t.defaultValue)}),Object.keys(e).length>0&&S.setFieldsValue(e)},[d,w,c,u,S]),r.useEffect(()=>{if(c)if("edit"!==u&&"view"!==u||!h)V(S.getFieldValue("useOrgId")||z);else if(w){const e={...h},t=[];d.forEach(e=>{e.children.forEach(e=>{var n,r;t.push({...e,defaultValue:e.defaultValue||(null==(r=null==(n=e.options)?void 0:n[0])?void 0:r.value)||e.defaultValue})})}),t.forEach(t=>{if("datePicker"===t.type&&e[t.name])e[t.name]=o(e[t.name]);else if("rangePicker"===t.type)if("string"==typeof t.name&&t.name.includes("/")){const[n,r]=t.name.split("/"),s=e[n],i=e[r];s&&i&&(e[t.name]=[o(s),o(i)])}else e[t.name]&&Array.isArray(e[t.name])&&(e[t.name]=e[t.name].map(e=>o(e)));else"treeSelect"===t.type&&t.multiple&&e[t.name]&&"string"==typeof e[t.name]&&(e[t.name]=e[t.name].split(","))})}else{const e={...h};d.forEach(t=>{if("datePicker"===t.type&&e[t.name])e[t.name]=o(e[t.name]);else if("rangePicker"===t.type)if("string"==typeof t.name&&t.name.includes("/")){const[n,r]=t.name.split("/"),s=e[n],i=e[r];s&&i&&(e[t.name]=[o(s),o(i)])}else e[t.name]&&Array.isArray(e[t.name])&&(e[t.name]=e[t.name].map(e=>o(e)));else"treeSelect"===t.type&&t.multiple&&e[t.name]&&"string"==typeof e[t.name]&&(e[t.name]=e[t.name].split(","))})}else S.resetFields()},[d]);const D=r.useCallback(e=>{if(w){for(const t of d)if(t.children){const n=t.children.find(t=>t.name===e);if(n)return n.label}}else{const t=d.find(t=>t.name===e);if(t)return t.label}return e},[d,w]),P=r.useCallback((e,t)=>{const n=[];let r="";const s=new Set;return t&&Array.isArray(t)&&t.length>0&&(t.forEach(t=>{const i=e.filter(e=>t.includes(e.field)&&!s.has(e.field));if(i.length>1){const e=i.map(e=>D(e.field)).join("、")+"同时重复";i.forEach(t=>{n.push({name:t.field,errors:[e]}),s.add(t.field)}),r||(r=e)}else if(1===i.length){const e=i[0],t=D(e.field)+"重复";n.push({name:e.field,errors:[t]}),s.add(e.field),r||(r=t)}}),e.forEach(e=>{if(!s.has(e.field)){const t=D(e.field)+"重复";n.push({name:e.field,errors:[t]}),r||(r=t)}})),{errorFields:n,errorMessage:r||"验证失败"}},[D]),F=r.useMemo(()=>{if(!(null==N?void 0:N.realtime))return()=>{};const e=N.realtimeDelay||500;return l.debounce((e,t)=>{(async(e,t)=>{if(!N||!N.realtime)return;const{validateApi:n,validateFields:r,validateMethod:s="POST",validateParams:i,validateMessage:o="验证失败",union:l=!0,group:a}=N,c=t&&r.includes(t)?[t]:r,u=(null==h?void 0:h.id)||(null==h?void 0:h.ID)||null;let d;if(i)d=i(e);else{const t={};c.forEach(n=>{void 0!==e[n]&&null!==e[n]&&""!==e[n]&&(t[n]=e[n])}),d={field:c,value:t,id:u,union:l?1:0,group:a}}const f="GET"===s?await T(d,n):await O(d,n);if(200===f.code&&Array.isArray(f.data)){const e=f.data.filter(e=>!0===e.value);if(f.data.forEach(e=>{!1===e.value&&S.setFields([{name:e.field,errors:[]}])}),e.length>0){let t=[];if(a&&Array.isArray(a)&&a.length>0){const n=P(e,a);t=n.errorFields}else if(l&&e.length>1){const n=e.map(e=>D(e.field)).join("、")+"同时重复";e.forEach(e=>{t.push({name:e.field,errors:[n]})})}else e.forEach(e=>{const n=D(e.field);t.push({name:e.field,errors:[n+"重复"]})});t.length>0&&S.setFields(t)}}})(e,t).catch(()=>{})},e)},[N]),U=(e,t)=>{if("name"==t.name&&!(null==S?void 0:S.getFieldValue("pyCode"))){const t=(n=e.target.value,a.pinyin(n,{pattern:"first",toneType:"none",type:"array",nonZh:"consecutive"}).join("").toUpperCase());S.setFieldsValue({pyCode:t})}var n},z=null==(i=f.getOrgInfo())?void 0:i.orgId,[$,V]=r.useState(z),H=r.useMemo(()=>d.some(e=>w&&e.children?e.children.some(e=>"deptSelect"===e.type):"deptSelect"===e.type),[d,w]),K=r.useMemo(()=>d.some(e=>w&&e.children?e.children.some(e=>"orgSelect"===e.type):"orgSelect"===e.type),[d,w]);r.useEffect(()=>{H&&J()},[$,H]),r.useEffect(()=>{K&&X()},[K]);const[W,G]=r.useState([]),[Z,Y]=r.useState([]),J=async()=>{const e=await O({orgId:$,pageNum:1,pageSize:0},"/common-service/common/queryDeptById");if(200===e.code){const t=[{name:"通用",id:-1},...e.data||[]];G(t||[])}},X=async()=>{const e=await O({loginOrgId:z,pageNum:1,pageSize:0},"/common-service/common/getOrgList");200===e.code&&Y((null==e?void 0:e.data)||[])},Q=e=>{if("view"!==u)return;const t=S.getFieldValue(e);if(null==t||""===t)return void s.message.warning("没有内容可复制");let n="";if("object"==typeof t)if(o.isDayjs(t))n=t.format("YYYY-MM-DD HH:mm:ss");else if(Array.isArray(t))n=t.map(e=>o.isDayjs(e)?e.format("YYYY-MM-DD HH:mm:ss"):String(e)).join(", ");else if(t.addProvince){const e=[t.addProvince,t.addCity,t.addCounty,t.addStreet,t.address].filter(Boolean);n=e.join("-")}else n=JSON.stringify(t);else n=String(t);navigator.clipboard.writeText(n).then(()=>{s.message.success("已复制到剪贴板")}).catch(()=>{const e=document.createElement("textarea");e.value=n,e.style.position="fixed",e.style.opacity="0",document.body.appendChild(e),e.select();try{document.execCommand("copy"),s.message.success("已复制到剪贴板")}catch(t){}document.body.removeChild(e)})},ee=e=>{var t,r,i,o;const{type:l,name:a,placeholder:c,options:u,rules:d,...h}=e,f=A?"":c||`请输入${e.label}`,p=A?"":c||`请选择${e.label}`;switch(l){case"input":return n.jsx(s.Input,{placeholder:f,...h,readOnly:A||h.readOnly,onDoubleClick:()=>Q(a),onBlur:t=>U(t,e)});case"inputoption":return n.jsx(s.Input,{placeholder:f,...h,readOnly:A||h.readOnly,onDoubleClick:()=>Q(a),addonAfter:n.jsx(s.Form.Item,{name:e.optionname,noStyle:!0,initialValue:null==(r=null==(t=e.options)?void 0:t[0])?void 0:r.value,children:n.jsx(M,{disabled:A,options:e.options,allowClear:!A})})});case"inputnumberoption":return n.jsx(s.InputNumber,{className:Wa,placeholder:f,addonAfter:n.jsx(s.Form.Item,{name:e.optionname,noStyle:!0,initialValue:null==(o=null==(i=e.options)?void 0:i[0])?void 0:o.value,children:n.jsx(M,{disabled:A,options:e.options,allowClear:!A})}),...h});case"password":return n.jsx(s.Input.Password,{placeholder:f,...h,readOnly:A||h.readOnly,onDoubleClick:()=>Q(a)});case"rangePicker":return n.jsx(wc,{style:{width:"100%",cursor:A?"not-allowed":"auto",...h.style},placeholder:[p||"开始日期",p||"结束日期"],...h,disabled:A||h.disabled,allowClear:!A});case"datePicker":return n.jsx(s.DatePicker,{style:{width:"100%",cursor:A?"not-allowed":"auto",...h.style},placeholder:p,...h,disabled:A||h.disabled,allowClear:!A});case"InputNumber":return n.jsx(s.InputNumber,{style:{width:"100%",cursor:A?"not-allowed":"auto",...h.style},placeholder:f,...h,readOnly:A||h.readOnly,onDoubleClick:()=>Q(a)});case"Radio":return n.jsx(s.Form.Item,{name:a,noStyle:!0,children:n.jsx(s.Radio.Group,{style:{pointerEvents:A?"none":"auto",...h.style},disabled:A||h.disabled,options:u,...h})});case"Checkbox":return n.jsx(s.Form.Item,{name:a,noStyle:!0,children:n.jsx(s.Checkbox.Group,{style:{width:"100%",pointerEvents:A?"none":"auto",...h.style||{}},options:u,disabled:A||h.disabled,...h})});case"imageVideo":return n.jsx("div",{style:{pointerEvents:A?"none":"auto"},children:n.jsx(s.Form.Item,{name:a,noStyle:!0,children:n.jsx(hc,{...h})})});case"filefold":return n.jsx("div",{style:{pointerEvents:A?"none":"auto"},children:n.jsx(s.Form.Item,{name:a,noStyle:!0,children:n.jsx(xc,{...h})})});case"treeSelect":{const t=!!e.multiple||(null==h?void 0:h.multiple)||(null==h?void 0:h.treeCheckable),r=e=>{try{const t=(e||[]).map(e=>{var t,n;return"string"==typeof(null==e?void 0:e.label)?e.label:(null==(n=null==(t=null==e?void 0:e.label)?void 0:t.props)?void 0:n.children)??(null==e?void 0:e.value)}).filter(Boolean).join(",");return n.jsxs("span",{title:t,children:["+",e.length,"…"]})}catch(t){return n.jsxs("span",{children:["+",(null==e?void 0:e.length)||0,"…"]})}};return n.jsx(s.Form.Item,{name:a,noStyle:!0,children:n.jsx(M,{className:Ka,allowClear:!A,style:{width:"100%",cursor:A?"not-allowed":"auto",...h.style},placeholder:f,treeData:e.options,...t?{maxTagCount:1,maxTagPlaceholder:r}:{},...h,disabled:A||h.disabled})})}case"select":{const t=!!e.multiple||(null==h?void 0:h.multiple)||(null==h?void 0:h.treeCheckable),r=e=>{try{const t=(e||[]).map(e=>{var t,n;return"string"==typeof(null==e?void 0:e.label)?e.label:(null==(n=null==(t=null==e?void 0:e.label)?void 0:t.props)?void 0:n.children)??(null==e?void 0:e.value)}).filter(Boolean).join(",");return n.jsxs("span",{title:t,children:["+",e.length,"…"]})}catch(t){return n.jsxs("span",{children:["+",(null==e?void 0:e.length)||0,"…"]})}};return n.jsx(s.Form.Item,{name:a,noStyle:!0,children:n.jsx(M,{className:Ka,allowClear:!A,style:{width:"100%",cursor:A?"not-allowed":"auto",...h.style},placeholder:f,treeData:e.options,...t?{maxTagCount:1,maxTagPlaceholder:r}:{},...h,disabled:A||h.disabled})})}case"upload":return n.jsx("div",{style:{pointerEvents:A?"none":"auto"},children:n.jsx(s.Form.Item,{name:a,noStyle:!0,children:n.jsx(qt,{value:e.value,...h},`upload_${e.name}`)})});case"file":return n.jsx("div",{style:{pointerEvents:A?"none":"auto"},children:n.jsx(s.Form.Item,{name:a,noStyle:!0,children:n.jsx(Ua,{...h})})});case"textarea":return n.jsx(Nc,{rows:4,placeholder:f,...h,readOnly:A||h.readOnly,onDoubleClick:()=>Q(a)});case"area":return n.jsx("div",{style:{pointerEvents:A?"none":"auto"},onDoubleClick:()=>Q(a),children:n.jsx(s.Form.Item,{name:a,noStyle:!0,children:n.jsx(Lt,{...h,disabled:A})})});case"richText":const{style:l,...c}=h;return n.jsx("div",{style:{pointerEvents:A?"none":"auto"},onDoubleClick:()=>Q(a),children:n.jsx(s.Form.Item,{name:a,noStyle:!0,children:n.jsx(Pa,{style:l})})});case"doubleValue":return n.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[n.jsx(s.Form.Item,{name:e.firstLabel||"first",noStyle:!0,children:n.jsx(s.InputNumber,{style:{width:"100%",cursor:A?"not-allowed":"auto",...h.style},placeholder:e.firstPlaceholder||`请输入${e.firstLabel||"最小值"}`,decimalSeparator:".",parser:e=>{if(!e)return"";const t=e.replace(/[^\d.,-]/g,"").replace(/,/g,"."),n=t.split(".");return n.length>2?n[0]+"."+n.slice(1).join(""):t},...h})}),n.jsx("span",{style:{margin:"0 10px"},children:e.separator||"至"}),n.jsx(s.Form.Item,{name:e.secondLabel||"second",noStyle:!0,children:n.jsx(s.InputNumber,{style:{width:"100%",cursor:A?"not-allowed":"auto",...h.style},placeholder:e.secondPlaceholder||`请输入${e.secondLabel||"最大值"}`,decimalSeparator:".",parser:e=>{if(!e)return"";const t=e.replace(/[^\d.,-]/g,"").replace(/,/g,"."),n=t.split(".");return n.length>2?n[0]+"."+n.slice(1).join(""):t},...h})}),n.jsx("span",{style:{margin:"0 10px"},children:e.lastUnit})]});case"deptSelect":return n.jsx(s.Form.Item,{name:a,noStyle:!0,children:n.jsx(M,{allowClear:!0,fieldNames:{label:"name",value:"id"},style:{width:"100%"},placeholder:p,options:W,disabled:A||h.disabled,...h})});case"orgSelect":return n.jsx(s.Form.Item,{name:a,noStyle:!0,children:n.jsx(M,{onChange:e=>{V(e)},allowClear:!0,fieldNames:{label:"name",value:"id"},style:{width:"100%"},placeholder:p,options:Z,disabled:A||h.disabled,...h})});case"uploadByte":return n.jsx("div",{style:{pointerEvents:A?"none":"auto"},children:n.jsx(s.Form.Item,{name:a,noStyle:!0,children:n.jsx(Ja,{disabled:A||h.disabled,...h})})});case"custom":if(e.component){const t=e.component;return n.jsx(t,{disabled:A||h.disabled,...h})}return e.render?e.render({...h,name:a,disabled:A||h.disabled}):n.jsx(s.Input,{placeholder:f,...h,readOnly:A});default:return n.jsx(s.Input,{placeholder:f,...h,readOnly:A||h.readOnly,onDoubleClick:()=>Q(a)})}},te=g||("add"===u?"新增":"edit"===u?"编辑":"查看"),ne=e=>n.jsx(s.Tooltip,{title:e,placement:"topLeft",children:n.jsx("span",{className:za,children:e})}),re=e=>{const t=e.findIndex(e=>"upload"===e.type||"uploadByte"===e.type);if(-1===t||1===(e[t].uploadRowSpan||1))return n.jsx(s.Row,{gutter:24,justify:"start",children:e.map(e=>n.jsx(s.Col,{span:e.colSpan||6,children:n.jsx(s.Form.Item,{label:ne(e.label),name:e.name,rules:e.rules,initialValue:e.defaultValue,className:A||e.disabled?Za:"",children:ee(e)},e.name)},e.name))});const r=e[t],i=r.colSpan||6,o=r.uploadRowSpan||1,l=e.slice(0,t),a=e.slice(t+1);let c=0,u=[];const d=[];for(const n of a){const e=n.colSpan||6;c+e>24?(u.length&&d.push(u),u=[n],c=e):(u.push(n),c+=e)}u.length&&d.push(u);const h=d.slice(0,o),f=d.slice(o);return n.jsxs(n.Fragment,{children:[l.length>0&&n.jsx(s.Row,{gutter:24,justify:"start",children:l.map(e=>n.jsx(s.Col,{span:e.colSpan||6,children:n.jsx(s.Form.Item,{label:ne(e.label),name:e.name,rules:e.rules,initialValue:e.defaultValue,className:A||e.disabled?Za:"",children:ee(e)},e.name)},e.name))}),n.jsxs("div",{style:{display:"flex",alignItems:"flex-start"},children:[n.jsx("div",{style:{width:i/24*100+"%",flexShrink:0,paddingRight:12},children:n.jsx(s.Form.Item,{label:ne(r.label),name:r.name,rules:r.rules,initialValue:r.defaultValue,className:A||r.disabled?Za:"",children:ee(r)},r.name)}),n.jsx("div",{style:{flex:1,overflow:"hidden"},children:h.map((e,t)=>n.jsx(s.Row,{gutter:24,justify:"start",children:e.map(e=>n.jsx(s.Col,{span:e.colSpan||6,children:n.jsx(s.Form.Item,{label:ne(e.label),name:e.name,rules:e.rules,initialValue:e.defaultValue,className:A||e.disabled?Za:"",children:ee(e)},e.name)},e.name))},t))})]}),f.map((e,t)=>n.jsx(s.Row,{gutter:24,justify:"start",children:e.map(e=>n.jsx(s.Col,{span:e.colSpan||6,children:n.jsx(s.Form.Item,{label:ne(e.label),name:e.name,rules:e.rules,initialValue:e.defaultValue,className:A||e.disabled?Za:"",children:ee(e)},e.name)},e.name))},`below-${t}`))]})},se=()=>w?n.jsx("div",{className:$a,children:n.jsx(s.Tabs,{className:Va,activeKey:R,onChange:B,children:d.map(e=>n.jsx(s.Tabs.TabPane,{tab:ne(e.label),forceRender:!0,children:n.jsx("div",{className:Ha,children:re((null==e?void 0:e.children)||[])})},e.label))})}):re(d);return n.jsx(s.Modal,{title:te,open:c,onOk:async()=>{try{const e=await S.validateFields();N&&await(async e=>{var t,n,r,s,i,o;if(!N)return;const{validateApi:l,validateFields:a,validateMethod:c="POST",validateParams:u,validateMessage:d="验证失败",union:f=!1,group:p=[]}=N,m=(null==h?void 0:h.id)||(null==h?void 0:h.ID)||null;if(u){const r=u(e),s="GET"===c?await T(r,l):await O(r,l);if(200!==s.code){const e=s.msg||d;throw new Error(e)}if(Array.isArray(s.data)){const e=s.data.filter(e=>!0===e.value);if(e.length>0){const t=e.map(e=>({name:e.field,errors:[d]}));throw S.setFields(t),new Error(d)}}else if(!1===s.data||!1===(null==(t=s.data)?void 0:t.valid)){const e=(null==(n=s.data)?void 0:n.message)||s.msg||d;throw new Error(e)}return}if(p&&p.length>0){const t={};a.forEach(n=>{void 0!==e[n]&&null!==e[n]&&(t[n]=e[n])});const n={field:a,value:t,id:m,union:f?1:0,group:p},i="GET"===c?await T(n,l):await O(n,l);if(200!==i.code){const e=i.msg||d;throw new Error(e)}if(Array.isArray(i.data)){const e=i.data.filter(e=>!0===e.value);if(e.length>0){const{errorFields:t,errorMessage:n}=P(e,p);throw S.setFields(t),new Error(n)}}else if(!1===i.data||!1===(null==(r=i.data)?void 0:r.valid)){const e=(null==(s=i.data)?void 0:s.message)||i.msg||d;throw new Error(e)}}else{const t={};a.forEach(n=>{void 0!==e[n]&&null!==e[n]&&(t[n]=e[n])});const n={field:a,value:t,id:m,union:f?1:0},r="GET"===c?await T(n,l):await O(n,l);if(200!==r.code){const e=r.msg||d;throw new Error(e)}if(Array.isArray(r.data)){const e=r.data.filter(e=>!0===e.value);if(e.length>0){let t=[],n=d;if(p&&Array.isArray(p)&&p.length>0){const r=P(e,p);t=r.errorFields,n=r.errorMessage}else if(f&&e.length>1){const r=e.map(e=>D(e.field));n=r.join("、")+"同时重复",t=e.map(e=>({name:e.field,errors:[n]}))}else t=e.map(e=>{const t=D(e.field);return{name:e.field,errors:[t+"重复"]}}),1===e.length&&(n=D(e[0].field)+"重复");throw S.setFields(t),new Error(n)}}else if(!1===r.data||!1===(null==(i=r.data)?void 0:i.valid)){const e=(null==(o=r.data)?void 0:o.message)||r.msg||d;throw new Error(e)}}})(e);const t={...e},n=[];w?d.forEach(e=>{e.children&&n.push(...e.children)}):n.push(...d),n.forEach(e=>{var n,r,s,i;if(void 0===e.defaultValue||void 0!==t[e.name]&&null!==t[e.name]||(t[e.name]=e.defaultValue),"datePicker"===e.type&&t[e.name])o.isDayjs(t[e.name])&&(t[e.name]=e.dateFormat?t[e.name].format(e.dateFormat):t[e.name].toISOString());else if("rangePicker"===e.type&&t[e.name])if("string"==typeof e.name&&e.name.includes("/")){const[n,r]=e.name.split("/");if(Array.isArray(t[e.name])&&2===t[e.name].length){const[s,i]=t[e.name],l=t=>o.isDayjs(t)?e.dateFormat?t.format(e.dateFormat):t.toISOString():t;t[n]=l(s),t[r]=l(i),delete t[e.name]}}else Array.isArray(t[e.name])&&(t[e.name]=t[e.name].map(t=>o.isDayjs(t)?e.dateFormat?t.format(e.dateFormat):t.toISOString():t));if("select"===e.type&&e.labelName){const s=null==(n=e.options)?void 0:n.find(n=>{var r;return n[(null==(r=null==e?void 0:e.fieldNames)?void 0:r.value)||"value"]===t[e.name]}),i=s?s[(null==(r=null==e?void 0:e.fieldNames)?void 0:r.label)||"label"]:void 0;t[e.labelName]=i}if("treeSelect"===e.type&&e.multiple&&(t[e.name]=null==(s=t[e.name])?void 0:s.join(","),e.labelName)){const n=((null==(i=t[e.name])?void 0:i.split(","))||[]).map(t=>{var n,r;const s=null==(n=e.options)?void 0:n.find(n=>{var r;return n[(null==(r=null==e?void 0:e.fieldNames)?void 0:r.value)||"value"]===t});return s?s[(null==(r=null==e?void 0:e.fieldNames)?void 0:r.label)||"label"]:void 0}).filter(Boolean);t[e.labelName]=n.join(",")}if("Radio"===e.type&&e.options&&void 0!==t[e.name]&&null!==t[e.name]){const n=e.options.find(n=>n.value==t[e.name]);n&&"number"==typeof n.value&&(t[e.name]=Number(t[e.name]))}}),await p(t)}catch(e){(null==e?void 0:e.message)&&(s.message.error(e.message),(null==e?void 0:e.errorFields)&&S.setFields(e.errorFields))}},onCancel:m,width:y.width||800,confirmLoading:v,destroyOnClose:!0,maskClosable:!1,top:50,classNames:{body:Ga},styles:{body:{minHeight:w?j||300:void 0,maxHeight:"70vh",overflowY:"scroll",overflowX:"hidden"}},footer:(e,{OkBtn:t,CancelBtn:r})=>n.jsxs("div",{style:{marginTop:"20px",display:"flex",gap:"8px",justifyContent:"end"},children:[x&&x(S.getFieldsValue()),n.jsx(r,{}),n.jsx(t,{})]}),...y,children:n.jsx(s.Form,{form:S,name:`modal_form_${u}`,layout:"vertical",onValuesChange:(e,t)=>{if(b&&b(e,t),null==N?void 0:N.realtime){const n=Object.keys(e)[0];F(t,n)}},children:n.jsx(se,{})})})}),kc="_container_1814d_1",Sc="_searchForm_1814d_9",Ac="_tableContainer_1814d_15",Cc="_pagination_1814d_72",jc="_selectedRow_1814d_91",_c=r.forwardRef(({searchFormConfig:e,addFormConfig:t,tableColumns:i,URL:o,editText:a,viewText:c,delText:u,CustomOperations:d,classjson:h,postParams:f,proplist:p,topHeight:m,isnopage:g,PropOtherButton:v,CustomModalFooter:b,editdclickback:y,oneditFormChange:x,onSearchFormChange:w,addisdisabled:N={isdisabled:!1,message:""},tableHeight:E=150,limit:k={addLimit:!0,delLimit:!0,editLimit:!0,searchLimit:!0},actionWidth:S,onRowClick:A,onDelete:C,tableId:j,isaddtab:_=!1,validateConfig:T,tableConfig:q,isReset:I=!1,isResetdefault:R=!1,actionDisabled:M,actionToolTips:B,notoken:P=!1,onSearch:F,onReset:U,onView:z,...$},V)=>{r.useImperativeHandle(V,()=>({getList:async()=>ve(),setFieldsValue:e=>{var t;null==(t=ce.current)||t.setFieldsValue(e)},getFieldsValue:()=>{var e;return null==(e=ce.current)?void 0:e.getFieldsValue()},setActiveTab:e=>{var t,n;null==(n=null==(t=ce.current)?void 0:t.setActiveTab)||n.call(t,e)},reload:()=>{ve()},setCurrentRecord:e=>{ne(e)},getSearchFieldsValue:()=>{var e;return null==(e=ge.current)?void 0:e.getFieldsValue()},setSearchFieldsValue:e=>{var t;null==(t=ge.current)||t.setFieldsValue(e)},getDataSource:()=>W,getCurrentRecord:()=>te,openSettingModal:()=>{var e;null==(e=ue.current)||e.openSettingModal()},closeSettingModal:()=>{var e;null==(e=ue.current)||e.closeSettingModal()}}));const[H,K]=r.useState(!1),[W,G]=r.useState([]),[Z,Y]=r.useState({current:1,pageSize:50,total:0,showSizeChanger:!0,showQuickJumper:!0,showTotal:e=>`共 ${e} 条`}),[J,X]=r.useState(!1),[Q,ee]=r.useState("add"),[te,ne]=r.useState(null),[re,se]=r.useState([]),[ie,oe]=r.useState([]),[le,ae]=r.useState([]),ce=r.useRef(null),ue=r.useRef(null),de=r.useRef(f),he=r.useRef(Z),fe=r.useRef(null),[pe,me]=r.useState(0),ge=r.useRef(null);r.useEffect(()=>{de.current=f},[f]),r.useEffect(()=>{he.current=Z},[Z]),r.useEffect(()=>{J||ne(null)},[J]);const ve=l.debounce(async e=>{var t,n;if(!(null==o?void 0:o.search))return;const r=ge.current.getFieldsValue(),s={...null==(t=de.current)?void 0:t.searchParams,...e,pageNum:he.current.current,pageSize:he.current.pageSize,...r};g&&delete s.pageNum,g&&delete s.pageSize,K(!0);try{const e=P?L:O,t=await e(s,o.search);if(200===t.code){const e=(null==(n=null==t?void 0:t.data)?void 0:n.list)||(null==t?void 0:t.data),r=e.map(e=>(e.hasOwnProperty("addCountyCode")&&(e.alladdress={...e}),e)).map(e=>(e.alladdress={...e},e));G(r||[]),Y(e=>{var n,r;return{...e,current:null==(n=null==t?void 0:t.data)?void 0:n.pageNum,total:null==(r=null==t?void 0:t.data)?void 0:r.total}})}else G([]),Y(e=>({...e,total:0,current:1}))}catch(i){G([]),Y(e=>({...e,total:0,current:1}))}finally{K(!1)}},100);r.useEffect(()=>{(null==o?void 0:o.search)&&ve()},[Z.current,Z.pageSize,JSON.stringify(null==f?void 0:f.searchParams)]),r.useEffect(()=>{if(fe.current&&le.length>0){const e=fe.current.offsetHeight;me(e)}},[le]);const be=r.useRef(null);r.useEffect(()=>{const e={title:"操作",key:"action",align:"center",width:S||150,fixed:"right",render:(e,t)=>{const r=M?M(t):{},i=B?B(t):{},l=r.edit||!1,h=r.view||!1,f=r.delete||!1,p=(e,t,r,i,o)=>{const l=e?n.jsx("span",{style:{color:"rgba(0,0,0,0.25)",cursor:"not-allowed",...o},children:r}):n.jsx("a",{onClick:i,style:o,children:r});return t?n.jsx(s.Tooltip,{title:t,children:l}):l};return n.jsx(n.Fragment,{children:n.jsxs(s.Space,{size:"small",ref:be,children:["function"==typeof d?d(t):d,o.edit&&k.editLimit&&p(l,i.editTooltip,a||"编辑",()=>xe(t)),(o.view||o.edit)&&k.addLimit&&p(h,i.viewTooltip,c||"查看",()=>we(t)),o.delete&&k.delLimit&&p(f,i.deleteTooltip,u||"删除",()=>Ne(t),{color:f?"rgba(0,0,0,0.25)":"#f5222d"})]})})}},t=o.edit||o.delete||o.view||d,r=[...i],l=t?[...r,e]:r;oe(l)},[]),r.useEffect(()=>{e&&ae(e)},[e]),r.useEffect(()=>{t&&se(t)},[t]);const ye=()=>{ne(null),ee("add"),X(!0),y&&y()},xe=e=>{ne(e),ee("edit"),X(!0),y&&y(e)},we=e=>{ne(e),ee("view"),X(!0),null==z||z(e)},Ne=async e=>{o.delete&&s.Modal.confirm({title:`确认${u||"删除"}?`,content:`确定要${u||"删除"}这条记录吗?`,okText:"确认",cancelText:"取消",onOk:async()=>{try{K(!0);const t=P?L:O;if(200===(await t({id:e.id,...null==f?void 0:f.delParams},o.delete)).code){C&&C(e),s.message.success(`${u||"删除"}成功`);const t=Z.current,n=Z.pageSize,r=Z.total-1;r>0&&(t-1)*n>=r&&t>1?(Y(e=>({...e,current:e.current-1})),setTimeout(()=>{ve()},0)):ve()}}catch(t){}finally{K(!1)}}})},Ee=window.parent!==window.self,ke={"--table-height":Ee?`calc(100vh - ${pe}px - ${E}px + 39px)`:`calc(100vh - ${pe}px - ${E}px - 16px)`,height:Ee?"calc(100vh)":"calc(100vh - 63px)"};return n.jsxs("div",{className:kc,style:ke,children:[le.length>0||!m?n.jsx("div",{className:Sc,ref:fe,children:n.jsx(D,{config:le,onSearch:()=>{Y(e=>({...e,current:1})),ve(),null==F||F()},onReset:()=>{Y(e=>({...e,current:1})),ve(),null==U||U()},submitButtonText:"查询",resetButtonText:"重置",OtherButton:v||(()=>o.add&&k.addLimit&&n.jsx("div",{style:{marginLeft:"15px"},children:n.jsx(s.Tooltip,{title:N.isdisabled?N.message:"",children:n.jsx(s.Button,{type:"primary",onClick:ye,disabled:N.isdisabled,children:"新建"})})})),ref:ge,onSearchFormChange:(e,t)=>{w&&w(e,t)},isReset:I,isResetdefault:R})}):n.jsx("div",{style:{height:m}}),n.jsxs("div",{className:Ac,style:{height:`calc(100% - ${pe}px-35px)`},children:[n.jsx(Tt,{ref:ue,page:Z,virtual:g,tableId:j,scroll:{x:"1200px",y:"calc(100vh - 500px)"},onRowClick:(e,t)=>((e,t)=>{A&&A(e,t),ne(e)})(e,t),rowClassName:e=>e.id===(null==te?void 0:te.id)?jc:"",columns:ie,dataSource:p||W,loading:H,pagination:!1,onChange:e=>{Y(t=>({...t,current:e.current,pageSize:e.pageSize}))},rowKey:"id",...q,...$}),!g&&n.jsx("div",{className:Cc,children:n.jsx(s.Pagination,{size:"small",onChange:(e,t)=>{Y(n=>({...n,current:e,pageSize:t}))},...Z,showQuickJumper:!1})})]}),n.jsx(Ec,{validateConfig:T,CustomModalFooter:b,ref:ce,oneditFormChange:x,visible:J,mode:Q,config:"view"===Q?re.map(e=>({...e,disabled:!0})):re,initialValues:te,onOk:async e=>{if(e.alladdress&&(e={...e,...e.alladdress}),"view"!==Q){K(!0);try{let t;const n=P?L:O;t="add"==Q?await n({...e,...null==f?void 0:f.addParams},o.add):await n({id:null==te?void 0:te.id,...e,...null==f?void 0:f.editParams},o.edit),200==t.code&&(s.message.success(("add"===Q?"添加":"更新")+"成功"),X(!1),ve())}catch(t){}finally{K(!1)}}else X(!1)},onCancel:()=>X(!1),title:(()=>{switch(Q){case"add":return"新增";case"edit":return"编辑";case"view":return"查看";default:return"信息"}})(),loading:H,tab:_,modalProps:"view"===Q?{footer:[n.jsx(s.Button,{onClick:()=>X(!1),children:"关闭"},"close")],maskClosable:!0}:void 0})]})}),Oc=r.memo(_c),Tc="_table_y36iq_1",{Text:Lc}=s.Typography,qc="_table_y36iq_1",{Text:Ic}=s.Typography;let Rc={port:28081,host:"localhost",timeout:1e4};const Mc=async(e={},t)=>{const n=t?{...Rc,...t}:Rc,{port:r,host:s,timeout:o}=n,l=`http://${s}:${r}`;try{return(await i.post(`${l}/takeShot`,e,{headers:{"Content-Type":"application/json"},timeout:o})).data}catch(a){return{code:-1,msg:a.message||"截图请求失败",data:void 0}}},Bc=e=>{const{hotkeys:t,onTrigger:n,preventDefault:s=!1,stopPropagation:i=!1}=e,o=r.useRef(e);o.current=e;const l=r.useCallback((e,t)=>{const n=e.key.toLowerCase()===t.key.toLowerCase(),r=!!t.ctrl===e.ctrlKey,s=!!t.alt===e.altKey,i=!!t.shift===e.shiftKey,o=!!t.meta===e.metaKey;return n&&r&&s&&i&&o},[]),a=r.useCallback(e=>{const t=o.current;for(const n of t.hotkeys)if(l(e,n)){t.preventDefault&&e.preventDefault(),t.stopPropagation&&e.stopPropagation(),t.onTrigger(n,e);break}},[l]);r.useEffect(()=>{window.addEventListener("keydown",a);t.map(e=>{const t=[];return e.ctrl&&t.push("Ctrl"),e.alt&&t.push("Alt"),e.shift&&t.push("Shift"),e.meta&&t.push("Meta"),t.push(e.key),t.join("+")});return()=>{window.removeEventListener("keydown",a)}},[t,a])},Dc=e=>{const{keys:t,onKeyDown:n,onKeyUp:s,preventDefault:i=!1,stopPropagation:o=!1}=e,l=r.useRef(e);l.current=e;const a=r.useCallback(e=>{var t;const n=e.key,r=l.current;if(r.keys.includes(n)||r.keys.includes(e.code)){r.preventDefault&&e.preventDefault(),r.stopPropagation&&e.stopPropagation();const s=r.keys.includes(n)?n:e.code;null==(t=r.onKeyDown)||t.call(r,s,e)}},[]),c=r.useCallback(e=>{var t;const n=e.key,r=l.current;if(r.keys.includes(n)||r.keys.includes(e.code)){r.preventDefault&&e.preventDefault(),r.stopPropagation&&e.stopPropagation();const s=r.keys.includes(n)?n:e.code;null==(t=r.onKeyUp)||t.call(r,s,e)}},[]);r.useEffect(()=>(window.addEventListener("keydown",a),window.addEventListener("keyup",c),()=>{window.removeEventListener("keydown",a),window.removeEventListener("keyup",c)}),[t.join(","),a,c])};exports.CommonPage=Oc,exports.CustomAdd=Ec,exports.CustomForm=D,exports.CustomTable=Tt,exports.NomalSelect=M,exports.SelectApiTable=({cloumn:e,dropList:t,value:i,onChange:o,placeholder:l="请输入姓名或编号搜索",disabled:a=!1,apiUrl:c,propwidth:u})=>{const[d,h]=r.useState(""),[p,m]=r.useState(!1),[g,v]=r.useState(!1),[b,y]=r.useState(0),[x,w]=r.useState([]),[N,E]=r.useState([]);r.useEffect(()=>{e&&E(e)},[e]),r.useEffect(()=>{t&&w(t||[])},[t]);r.useEffect(()=>{(async()=>{var e,t,n;const r=await O({keyword:d,pageNum:1,pageSize:0,orgId:null==(e=null==f?void 0:f.getOrgInfo())?void 0:e.orgId,loginUserId:null==(t=null==f?void 0:f.getOrgInfo())?void 0:t.orgId},c);200===r.code&&w((null==(n=null==r?void 0:r.data)?void 0:n.list)||(null==r?void 0:r.data)||[])})()},[d]);const k=e=>{a||(null==o||o(e),h(e.name),m(!1))};return n.jsxs(n.Fragment,{children:[n.jsx(s.Input,{placeholder:l,value:d,onChange:e=>h(e.target.value),onKeyDown:e=>{if(!a&&x&&0!==x.length&&p)switch(e.key){case"ArrowDown":e.preventDefault(),y(e=>e<x.length-1?e+1:e);break;case"ArrowUp":e.preventDefault(),y(e=>e>0?e-1:0);break;case"Enter":e.preventDefault(),b>=0&&b<x.length&&k(x[b]);break;case"Escape":e.preventDefault(),m(!1)}},onFocus:()=>m(!0),onClick:()=>m(!0),onBlur:()=>{setTimeout(()=>m(!1),200)},suffix:g?n.jsx(ut,{}):n.jsx(yt,{style:{color:"#999"}}),disabled:a}),p?n.jsx("div",{onMouseDown:e=>e.preventDefault(),style:{backgroundColor:"#fff",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",borderRadius:"4px",width:u||"100%",maxHeight:"300px",position:"absolute",zIndex:1050},children:g?n.jsxs("div",{style:{padding:"16px",textAlign:"center"},children:[n.jsx(s.Spin,{indicator:n.jsx(ut,{}),size:"small"}),n.jsx(Ic,{style:{marginLeft:"8px"},children:"搜索中..."})]}):x&&0!==x.length?n.jsxs("div",{children:[n.jsxs("div",{style:{padding:"8px 12px"},children:[n.jsx(Ic,{strong:!0,children:"搜索结果"}),n.jsxs(Ic,{type:"secondary",style:{float:"right"},children:["共 ",(null==x?void 0:x.length)||0," 条记录"]})]}),n.jsx(s.Divider,{style:{margin:"0"}}),n.jsx(s.Table,{className:qc,columns:N,dataSource:x,rowKey:"id",pagination:!1,size:"small",rowClassName:(e,t)=>t===b?"ant-table-row-selected":"",scroll:{x:200,y:200},bordered:!0,onRow:(e,t)=>({onClick:()=>k(e),onMouseEnter:()=>y(t||0),style:{cursor:a?"not-allowed":"pointer",backgroundColor:t===b?"#e6f7ff":void 0}})})]}):n.jsx(s.Empty,{image:s.Empty.PRESENTED_IMAGE_SIMPLE,description:"无匹配数据",style:{margin:"16px 0"}})}):null]})},exports.SelectTable=({cloumn:e,dropList:t,value:i,onChange:o,placeholder:l="请输入搜索",disabled:a=!1,propwidth:c})=>{const[u,d]=r.useState(""),[h,f]=r.useState(!1),[p,m]=r.useState(!1),[g,v]=r.useState(0),[b,y]=r.useState([]),[x,w]=r.useState([]);r.useEffect(()=>{e&&w(e)},[e]),r.useEffect(()=>{t&&y(t)},[t]),r.useEffect(()=>{if(i&&t&&t.length>0){const e="object"==typeof i?i.id:i,n=t.find(t=>t.id===e);n&&d(n.name||"")}else i||d("")},[i,t]);const N=e=>{a||(null==o||o(e),d(e.name),f(!1))};return n.jsxs(n.Fragment,{children:[n.jsx(s.Input,{placeholder:l,value:u,onChange:e=>(e=>{d(e),m(!0);const n=t.filter(t=>String(t.name).toLowerCase().includes(e.toLowerCase())||String(t.code).toLowerCase().includes(e.toLowerCase())||String(t.pyCode).toLowerCase().includes(e.toLowerCase()));y(n),v(-1),m(!1),f(!0)})(e.target.value),onKeyDown:e=>{if(!a&&0!==b.length&&h)switch(e.key){case"ArrowDown":e.preventDefault(),v(e=>e<b.length-1?e+1:e);break;case"ArrowUp":e.preventDefault(),v(e=>e>0?e-1:0);break;case"Enter":e.preventDefault(),g>=0&&g<b.length&&N(b[g]);break;case"Escape":e.preventDefault(),f(!1)}},onFocus:()=>f(!0),onClick:()=>f(!0),onBlur:()=>{setTimeout(()=>f(!1),200)},suffix:p?n.jsx(ut,{}):n.jsx(yt,{style:{color:"#999"}}),disabled:a}),h?n.jsx("div",{onMouseDown:e=>e.preventDefault(),style:{backgroundColor:"#fff",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",borderRadius:"4px",width:c||"100%",maxHeight:"300px",position:"absolute",zIndex:1050},children:p?n.jsxs("div",{style:{padding:"16px",textAlign:"center"},children:[n.jsx(s.Spin,{indicator:n.jsx(ut,{}),size:"small"}),n.jsx(Lc,{style:{marginLeft:"8px"},children:"搜索中..."})]}):0===b.length?n.jsx(s.Empty,{image:s.Empty.PRESENTED_IMAGE_SIMPLE,description:"无匹配数据",style:{margin:"16px 0"}}):n.jsxs("div",{children:[n.jsxs("div",{style:{padding:"8px 12px"},children:[n.jsx(Lc,{strong:!0,children:"搜索结果"}),n.jsxs(Lc,{type:"secondary",style:{float:"right"},children:["共 ",b.length," 条记录"]})]}),n.jsx(s.Divider,{style:{margin:"0"}}),n.jsx(s.Table,{className:Tc,columns:x,dataSource:b,rowKey:"id",pagination:!1,size:"small",rowClassName:(e,t)=>t===g?"ant-table-row-selected":"",scroll:{x:300,y:200},bordered:!0,onRow:(e,t)=>({onClick:()=>N(e),onMouseEnter:()=>v(t||0),style:{cursor:a?"not-allowed":"pointer",backgroundColor:t===g?"#e6f7ff":void 0}})})]})}):null]})},exports.getTakeShotConfig=()=>({...Rc}),exports.setTakeShotConfig=e=>{Rc={...Rc,...e}},exports.takeShot=Mc,exports.takeShotWithRetry=async(e={},t=3,n=1e3,r)=>{let s;for(let o=0;o<t;o++){try{const t=await Mc(e,r);if(200===t.code)return t;if(-1!==t.code)return t}catch(i){s=i}o<t-1&&await new Promise(e=>setTimeout(e,n))}return{code:-1,msg:(null==s?void 0:s.message)||`截图失败,已重试 ${t} 次`,data:void 0}},exports.useFootPedalListener=e=>{const{leftKey:t="F1",rightKey:n="F2",middleKey:s,onLeftPedal:i,onRightPedal:o,onMiddlePedal:l,onKeyDown:a,onKeyUp:c}=e,u=r.useCallback((e,r)=>{null==a||a(e),e===t?null==i||i():e===n?null==o||o():e===s&&(null==l||l())},[t,n,s,i,o,l,a]),d=r.useCallback((e,t)=>{null==c||c(e)},[c]),h=[t,n];s&&h.push(s),Dc({keys:h,onKeyDown:u,onKeyUp:d})},exports.useHotkeyListener=Bc,exports.useKeyboardListener=Dc,exports.useTakeShotHotkey=(e,t=[{key:"F2"}])=>{Bc({hotkeys:t,onTrigger:(t,n)=>{e()},preventDefault:!0})};
6
+ */const X=G((Z||(Z=1,Y=J,function(){var e={}.hasOwnProperty;function t(){for(var e="",t=0;t<arguments.length;t++){var s=arguments[t];s&&(e=r(e,n(s)))}return e}function n(n){if("string"==typeof n||"number"==typeof n)return n;if("object"!=typeof n)return"";if(Array.isArray(n))return t.apply(null,n);if(n.toString!==Object.prototype.toString&&!n.toString.toString().includes("[native code]"))return n.toString();var s="";for(var i in n)e.call(n,i)&&n[i]&&(s=r(s,i));return s}function r(e,t){return t?e?e+" "+t:e+t:e}Y.exports?(t.default=t,Y.exports=t):window.classNames=t}()),J.exports)),Q=Math.round;function ee(e,t){const n=e.replace(/^[^(]*\((.*)/,"$1").replace(/\).*/,"").match(/\d*\.?\d+%?/g)||[],r=n.map(e=>parseFloat(e));for(let s=0;s<3;s+=1)r[s]=t(r[s]||0,n[s]||"",s);return n[3]?r[3]=n[3].includes("%")?r[3]/100:r[3]:r[3]=1,r}const te=(e,t,n)=>0===n?e:e/100;function ne(e,t){const n=t||255;return e>n?n:e<0?0:e}class re{constructor(e){function t(t){return t[0]in e&&t[1]in e&&t[2]in e}if(H(this,"isValid",!0),H(this,"r",0),H(this,"g",0),H(this,"b",0),H(this,"a",1),H(this,"_h",void 0),H(this,"_s",void 0),H(this,"_l",void 0),H(this,"_v",void 0),H(this,"_max",void 0),H(this,"_min",void 0),H(this,"_brightness",void 0),e)if("string"==typeof e){let t=function(e){return n.startsWith(e)};const n=e.trim();/^#?[A-F\d]{3,8}$/i.test(n)?this.fromHexString(n):t("rgb")?this.fromRgbString(n):t("hsl")?this.fromHslString(n):(t("hsv")||t("hsb"))&&this.fromHsvString(n)}else if(e instanceof re)this.r=e.r,this.g=e.g,this.b=e.b,this.a=e.a,this._h=e._h,this._s=e._s,this._l=e._l,this._v=e._v;else if(t("rgb"))this.r=ne(e.r),this.g=ne(e.g),this.b=ne(e.b),this.a="number"==typeof e.a?ne(e.a,1):1;else if(t("hsl"))this.fromHsl(e);else{if(!t("hsv"))throw new Error("@ant-design/fast-color: unsupported input "+JSON.stringify(e));this.fromHsv(e)}else;}setR(e){return this._sc("r",e)}setG(e){return this._sc("g",e)}setB(e){return this._sc("b",e)}setA(e){return this._sc("a",e,1)}setHue(e){const t=this.toHsv();return t.h=e,this._c(t)}getLuminance(){function e(e){const t=e/255;return t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4)}return.2126*e(this.r)+.7152*e(this.g)+.0722*e(this.b)}getHue(){if(void 0===this._h){const e=this.getMax()-this.getMin();this._h=0===e?0:Q(60*(this.r===this.getMax()?(this.g-this.b)/e+(this.g<this.b?6:0):this.g===this.getMax()?(this.b-this.r)/e+2:(this.r-this.g)/e+4))}return this._h}getSaturation(){if(void 0===this._s){const e=this.getMax()-this.getMin();this._s=0===e?0:e/this.getMax()}return this._s}getLightness(){return void 0===this._l&&(this._l=(this.getMax()+this.getMin())/510),this._l}getValue(){return void 0===this._v&&(this._v=this.getMax()/255),this._v}getBrightness(){return void 0===this._brightness&&(this._brightness=(299*this.r+587*this.g+114*this.b)/1e3),this._brightness}darken(e=10){const t=this.getHue(),n=this.getSaturation();let r=this.getLightness()-e/100;return r<0&&(r=0),this._c({h:t,s:n,l:r,a:this.a})}lighten(e=10){const t=this.getHue(),n=this.getSaturation();let r=this.getLightness()+e/100;return r>1&&(r=1),this._c({h:t,s:n,l:r,a:this.a})}mix(e,t=50){const n=this._c(e),r=t/100,s=e=>(n[e]-this[e])*r+this[e],i={r:Q(s("r")),g:Q(s("g")),b:Q(s("b")),a:Q(100*s("a"))/100};return this._c(i)}tint(e=10){return this.mix({r:255,g:255,b:255,a:1},e)}shade(e=10){return this.mix({r:0,g:0,b:0,a:1},e)}onBackground(e){const t=this._c(e),n=this.a+t.a*(1-this.a),r=e=>Q((this[e]*this.a+t[e]*t.a*(1-this.a))/n);return this._c({r:r("r"),g:r("g"),b:r("b"),a:n})}isDark(){return this.getBrightness()<128}isLight(){return this.getBrightness()>=128}equals(e){return this.r===e.r&&this.g===e.g&&this.b===e.b&&this.a===e.a}clone(){return this._c(this)}toHexString(){let e="#";const t=(this.r||0).toString(16);e+=2===t.length?t:"0"+t;const n=(this.g||0).toString(16);e+=2===n.length?n:"0"+n;const r=(this.b||0).toString(16);if(e+=2===r.length?r:"0"+r,"number"==typeof this.a&&this.a>=0&&this.a<1){const t=Q(255*this.a).toString(16);e+=2===t.length?t:"0"+t}return e}toHsl(){return{h:this.getHue(),s:this.getSaturation(),l:this.getLightness(),a:this.a}}toHslString(){const e=this.getHue(),t=Q(100*this.getSaturation()),n=Q(100*this.getLightness());return 1!==this.a?`hsla(${e},${t}%,${n}%,${this.a})`:`hsl(${e},${t}%,${n}%)`}toHsv(){return{h:this.getHue(),s:this.getSaturation(),v:this.getValue(),a:this.a}}toRgb(){return{r:this.r,g:this.g,b:this.b,a:this.a}}toRgbString(){return 1!==this.a?`rgba(${this.r},${this.g},${this.b},${this.a})`:`rgb(${this.r},${this.g},${this.b})`}toString(){return this.toRgbString()}_sc(e,t,n){const r=this.clone();return r[e]=ne(t,n),r}_c(e){return new this.constructor(e)}getMax(){return void 0===this._max&&(this._max=Math.max(this.r,this.g,this.b)),this._max}getMin(){return void 0===this._min&&(this._min=Math.min(this.r,this.g,this.b)),this._min}fromHexString(e){const t=e.replace("#","");function n(e,n){return parseInt(t[e]+t[n||e],16)}t.length<6?(this.r=n(0),this.g=n(1),this.b=n(2),this.a=t[3]?n(3)/255:1):(this.r=n(0,1),this.g=n(2,3),this.b=n(4,5),this.a=t[6]?n(6,7)/255:1)}fromHsl({h:e,s:t,l:n,a:r}){if(this._h=e%360,this._s=t,this._l=n,this.a="number"==typeof r?r:1,t<=0){const e=Q(255*n);this.r=e,this.g=e,this.b=e}let s=0,i=0,o=0;const l=e/60,a=(1-Math.abs(2*n-1))*t,c=a*(1-Math.abs(l%2-1));l>=0&&l<1?(s=a,i=c):l>=1&&l<2?(s=c,i=a):l>=2&&l<3?(i=a,o=c):l>=3&&l<4?(i=c,o=a):l>=4&&l<5?(s=c,o=a):l>=5&&l<6&&(s=a,o=c);const u=n-a/2;this.r=Q(255*(s+u)),this.g=Q(255*(i+u)),this.b=Q(255*(o+u))}fromHsv({h:e,s:t,v:n,a:r}){this._h=e%360,this._s=t,this._v=n,this.a="number"==typeof r?r:1;const s=Q(255*n);if(this.r=s,this.g=s,this.b=s,t<=0)return;const i=e/60,o=Math.floor(i),l=i-o,a=Q(n*(1-t)*255),c=Q(n*(1-t*l)*255),u=Q(n*(1-t*(1-l))*255);switch(o){case 0:this.g=u,this.b=a;break;case 1:this.r=c,this.b=a;break;case 2:this.r=a,this.b=u;break;case 3:this.r=a,this.g=c;break;case 4:this.r=u,this.g=a;break;default:this.g=a,this.b=c}}fromHsvString(e){const t=ee(e,te);this.fromHsv({h:t[0],s:t[1],v:t[2],a:t[3]})}fromHslString(e){const t=ee(e,te);this.fromHsl({h:t[0],s:t[1],l:t[2],a:t[3]})}fromRgbString(e){const t=ee(e,(e,t)=>t.includes("%")?Q(e/100*255):e);this.r=t[0],this.g=t[1],this.b=t[2],this.a=t[3]}}var se=[{index:7,amount:15},{index:6,amount:25},{index:5,amount:30},{index:5,amount:45},{index:5,amount:65},{index:5,amount:85},{index:4,amount:90},{index:3,amount:95},{index:2,amount:97},{index:1,amount:98}];function ie(e,t,n){var r;return(r=Math.round(e.h)>=60&&Math.round(e.h)<=240?n?Math.round(e.h)-2*t:Math.round(e.h)+2*t:n?Math.round(e.h)+2*t:Math.round(e.h)-2*t)<0?r+=360:r>=360&&(r-=360),r}function oe(e,t,n){return 0===e.h&&0===e.s?e.s:((r=n?e.s-.16*t:4===t?e.s+.16:e.s+.05*t)>1&&(r=1),n&&5===t&&r>.1&&(r=.1),r<.06&&(r=.06),Math.round(100*r)/100);var r}function le(e,t,n){var r;return r=n?e.v+.05*t:e.v-.15*t,r=Math.max(0,Math.min(1,r)),Math.round(100*r)/100}var ae=["#e6f4ff","#bae0ff","#91caff","#69b1ff","#4096ff","#1677ff","#0958d9","#003eb3","#002c8c","#001d66"];function ce(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ue(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ce(Object(n),!0).forEach(function(t){H(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ce(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}ae.primary=ae[5];var de="data-rc-order",he="data-rc-priority",fe=new Map;function pe(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).mark;return e?e.startsWith("data-")?e:"data-".concat(e):"rc-util-key"}function me(e){return e.attachTo?e.attachTo:document.querySelector("head")||document.body}function ge(e){return Array.from((fe.get(e)||e).children).filter(function(e){return"STYLE"===e.tagName})}function ve(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("undefined"==typeof window||!window.document||!window.document.createElement)return null;var n=t.csp,r=t.prepend,s=t.priority,i=void 0===s?0:s,o=function(e){return"queue"===e?"prependQueue":e?"prepend":"append"}(r),l="prependQueue"===o,a=document.createElement("style");a.setAttribute(de,o),l&&i&&a.setAttribute(he,"".concat(i)),null!=n&&n.nonce&&(a.nonce=null==n?void 0:n.nonce),a.innerHTML=e;var c=me(t),u=c.firstChild;if(r){if(l){var d=(t.styles||ge(c)).filter(function(e){if(!["prepend","prependQueue"].includes(e.getAttribute(de)))return!1;var t=Number(e.getAttribute(he)||0);return i>=t});if(d.length)return c.insertBefore(a,d[d.length-1].nextSibling),a}c.insertBefore(a,u)}else c.appendChild(a);return a}function be(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=me(n),s=ge(r),i=ue(ue({},n),{},{styles:s});!function(e,t){var n=fe.get(e);if(!n||!function(e,t){if(!e)return!1;if(e.contains)return e.contains(t);for(var n=t;n;){if(n===e)return!0;n=n.parentNode}return!1}(document,n)){var r=ve("",t),s=r.parentNode;fe.set(e,s),e.removeChild(r)}}(r,i);var o=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=me(t);return(t.styles||ge(n)).find(function(n){return n.getAttribute(pe(t))===e})}(t,i);if(o){var l,a,c;if(null!==(l=i.csp)&&void 0!==l&&l.nonce&&o.nonce!==(null===(a=i.csp)||void 0===a?void 0:a.nonce))o.nonce=null===(c=i.csp)||void 0===c?void 0:c.nonce;return o.innerHTML!==e&&(o.innerHTML=e),o}var u=ve(e,i);return u.setAttribute(pe(i),t),u}function ye(e){var t;return null==e||null===(t=e.getRootNode)||void 0===t?void 0:t.call(e)}function xe(e){return function(e){return ye(e)instanceof ShadowRoot}(e)?ye(e):null}var we={},Ne=[];function Ee(e,t){if("production"!==process.env.NODE_ENV&&!e&&void 0!==console)Ne.reduce(function(e,t){return t(null!=e?e:"","warning")},t)}function ke(e,t){if("production"!==process.env.NODE_ENV&&!e&&void 0!==console)Ne.reduce(function(e,t){return t(null!=e?e:"","note")},t)}function Se(e,t,n){t||we[n]||(e(!1,n),we[n]=!0)}function Ae(e,t){Se(Ee,e,t)}function Ce(e){return"object"===$(e)&&"string"==typeof e.name&&"string"==typeof e.theme&&("object"===$(e.icon)||"function"==typeof e.icon)}function je(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Object.keys(e).reduce(function(t,n){var r,s=e[n];if("class"===n)t.className=s,delete t.class;else delete t[n],t[(r=n,r.replace(/-(.)/g,function(e,t){return t.toUpperCase()}))]=s;return t},{})}function _e(e,t,n){return n?r.createElement(e.tag,ue(ue({key:t},je(e.attrs)),n),(e.children||[]).map(function(n,r){return _e(n,"".concat(t,"-").concat(e.tag,"-").concat(r))})):r.createElement(e.tag,ue({key:t},je(e.attrs)),(e.children||[]).map(function(n,r){return _e(n,"".concat(t,"-").concat(e.tag,"-").concat(r))}))}function Oe(e){return function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=[],r=new re(e),s=r.toHsv(),i=5;i>0;i-=1){var o=new re({h:ie(s,i,!0),s:oe(s,i,!0),v:le(s,i,!0)});n.push(o)}n.push(r);for(var l=1;l<=4;l+=1){var a=new re({h:ie(s,l),s:oe(s,l),v:le(s,l)});n.push(a)}return"dark"===t.theme?se.map(function(e){var r=e.index,s=e.amount;return new re(t.backgroundColor||"#141414").mix(n[r],s).toHexString()}):n.map(function(e){return e.toHexString()})}(e)[0]}function Te(e){return e?Array.isArray(e)?e:[e]:[]}Ae.preMessage=function(e){Ne.push(e)},Ae.resetWarned=function(){we={}},Ae.noteOnce=function(e,t){Se(ke,e,t)};var Le=["icon","className","onClick","style","primaryColor","secondaryColor"],qe={primaryColor:"#333",secondaryColor:"#E6E6E6",calculated:!1};var Ie=function(e){var t,n,s,i,o,l,a,c,d=e.icon,h=e.className,f=e.onClick,p=e.style,m=e.primaryColor,g=e.secondaryColor,v=K(e,Le),b=u.useRef(),y=qe;if(m&&(y={primaryColor:m,secondaryColor:g||Oe(m)}),t=b,n=r.useContext(P),s=n.csp,i=n.prefixCls,o=n.layer,l="\n.anticon {\n display: inline-flex;\n align-items: center;\n color: inherit;\n font-style: normal;\n line-height: 0;\n text-align: center;\n text-transform: none;\n vertical-align: -0.125em;\n text-rendering: optimizeLegibility;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n\n.anticon > * {\n line-height: 1;\n}\n\n.anticon svg {\n display: inline-block;\n}\n\n.anticon::before {\n display: none;\n}\n\n.anticon .anticon-icon {\n display: block;\n}\n\n.anticon[tabindex] {\n cursor: pointer;\n}\n\n.anticon-spin::before,\n.anticon-spin {\n display: inline-block;\n -webkit-animation: loadingCircle 1s infinite linear;\n animation: loadingCircle 1s infinite linear;\n}\n\n@-webkit-keyframes loadingCircle {\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n}\n\n@keyframes loadingCircle {\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n}\n",i&&(l=l.replace(/anticon/g,i)),o&&(l="@layer ".concat(o," {\n").concat(l,"\n}")),r.useEffect(function(){var e=xe(t.current);be(l,"@ant-design-icons",{prepend:!o,csp:s,attachTo:e})},[]),a=Ce(d),c="icon should be icon definiton, but got ".concat(d),Ae(a,"[@ant-design/icons] ".concat(c)),!Ce(d))return null;var x=d;return x&&"function"==typeof x.icon&&(x=ue(ue({},x),{},{icon:x.icon(y.primaryColor,y.secondaryColor)})),_e(x.icon,"svg-".concat(x.name),ue(ue({className:h,onClick:f,style:p,"data-icon":x.name,width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},v),{},{ref:b}))};function Re(e){var t=z(Te(e),2),n=t[0],r=t[1];return Ie.setTwoToneColors({primaryColor:n,secondaryColor:r})}Ie.displayName="IconReact",Ie.getTwoToneColors=function(){return ue({},qe)},Ie.setTwoToneColors=function(e){var t=e.primaryColor,n=e.secondaryColor;qe.primaryColor=t,qe.secondaryColor=n||Oe(t),qe.calculated=!!n};var Me=["className","icon","spin","rotate","tabIndex","onClick","twoToneColor"];Re(ae.primary);var Be=u.forwardRef(function(e,t){var n=e.className,r=e.icon,s=e.spin,i=e.rotate,o=e.tabIndex,l=e.onClick,a=e.twoToneColor,c=K(e,Me),d=u.useContext(P),h=d.prefixCls,f=void 0===h?"anticon":h,p=d.rootClassName,m=X(p,f,H(H({},"".concat(f,"-").concat(r.name),!!r.name),"".concat(f,"-spin"),!!s||"loading"===r.name),n),g=o;void 0===g&&l&&(g=-1);var v=i?{msTransform:"rotate(".concat(i,"deg)"),transform:"rotate(".concat(i,"deg)")}:void 0,b=z(Te(a),2),y=b[0],x=b[1];return u.createElement("span",F({role:"img","aria-label":r.name},c,{ref:t,tabIndex:g,onClick:l,className:m}),u.createElement(Ie,{icon:r,primaryColor:y,secondaryColor:x,style:v}))});Be.displayName="AntdIcon",Be.getTwoToneColor=function(){var e=Ie.getTwoToneColors();return e.calculated?[e.primaryColor,e.secondaryColor]:e.primaryColor},Be.setTwoToneColor=Re;var De={icon:{tag:"svg",attrs:{"fill-rule":"evenodd",viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M799.86 166.31c.02 0 .04.02.08.06l57.69 57.7c.04.03.05.05.06.08a.12.12 0 010 .06c0 .03-.02.05-.06.09L569.93 512l287.7 287.7c.04.04.05.06.06.09a.12.12 0 010 .07c0 .02-.02.04-.06.08l-57.7 57.69c-.03.04-.05.05-.07.06a.12.12 0 01-.07 0c-.03 0-.05-.02-.09-.06L512 569.93l-287.7 287.7c-.04.04-.06.05-.09.06a.12.12 0 01-.07 0c-.02 0-.04-.02-.08-.06l-57.69-57.7c-.04-.03-.05-.05-.06-.07a.12.12 0 010-.07c0-.03.02-.05.06-.09L454.07 512l-287.7-287.7c-.04-.04-.05-.06-.06-.09a.12.12 0 010-.07c0-.02.02-.04.06-.08l57.7-57.69c.03-.04.05-.05.07-.06a.12.12 0 01.07 0c.03 0 .05.02.09.06L512 454.07l287.7-287.7c.04-.04.06-.05.09-.06a.12.12 0 01.07 0z"}}]},name:"close",theme:"outlined"},Pe=function(e,t){return u.createElement(Be,F({},e,{ref:t,icon:De}))},Fe=u.forwardRef(Pe);"production"!==process.env.NODE_ENV&&(Fe.displayName="CloseOutlined");var Ue={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z"}}]},name:"down",theme:"outlined"},ze=function(e,t){return u.createElement(Be,F({},e,{ref:t,icon:Ue}))},$e=u.forwardRef(ze);"production"!==process.env.NODE_ENV&&($e.displayName="DownOutlined");var Ve={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0042 42h216v494zM514.1 580.1l-61.8-102.4c-2.2-3.6-6.1-5.8-10.3-5.8h-38.4c-2.3 0-4.5.6-6.4 1.9-5.6 3.5-7.3 10.9-3.7 16.6l82.3 130.4-83.4 132.8a12.04 12.04 0 0010.2 18.4h34.5c4.2 0 8-2.2 10.2-5.7L510 664.8l62.3 101.4c2.2 3.6 6.1 5.7 10.2 5.7H620c2.3 0 4.5-.7 6.5-1.9 5.6-3.6 7.2-11 3.6-16.6l-84-130.4 85.3-132.5a12.04 12.04 0 00-10.1-18.5h-35.7c-4.2 0-8.1 2.2-10.3 5.8l-61.2 102.3z"}}]},name:"file-excel",theme:"outlined"},He=function(e,t){return u.createElement(Be,F({},e,{ref:t,icon:Ve}))},Ke=u.forwardRef(He);"production"!==process.env.NODE_ENV&&(Ke.displayName="FileExcelOutlined");var We={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M553.1 509.1l-77.8 99.2-41.1-52.4a8 8 0 00-12.6 0l-99.8 127.2a7.98 7.98 0 006.3 12.9H696c6.7 0 10.4-7.7 6.3-12.9l-136.5-174a8.1 8.1 0 00-12.7 0zM360 442a40 40 0 1080 0 40 40 0 10-80 0zm494.6-153.4L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0042 42h216v494z"}}]},name:"file-image",theme:"outlined"},Ge=function(e,t){return u.createElement(Be,F({},e,{ref:t,icon:We}))},Ze=u.forwardRef(Ge);"production"!==process.env.NODE_ENV&&(Ze.displayName="FileImageOutlined");var Ye={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M531.3 574.4l.3-1.4c5.8-23.9 13.1-53.7 7.4-80.7-3.8-21.3-19.5-29.6-32.9-30.2-15.8-.7-29.9 8.3-33.4 21.4-6.6 24-.7 56.8 10.1 98.6-13.6 32.4-35.3 79.5-51.2 107.5-29.6 15.3-69.3 38.9-75.2 68.7-1.2 5.5.2 12.5 3.5 18.8 3.7 7 9.6 12.4 16.5 15 3 1.1 6.6 2 10.8 2 17.6 0 46.1-14.2 84.1-79.4 5.8-1.9 11.8-3.9 17.6-5.9 27.2-9.2 55.4-18.8 80.9-23.1 28.2 15.1 60.3 24.8 82.1 24.8 21.6 0 30.1-12.8 33.3-20.5 5.6-13.5 2.9-30.5-6.2-39.6-13.2-13-45.3-16.4-95.3-10.2-24.6-15-40.7-35.4-52.4-65.8zM421.6 726.3c-13.9 20.2-24.4 30.3-30.1 34.7 6.7-12.3 19.8-25.3 30.1-34.7zm87.6-235.5c5.2 8.9 4.5 35.8.5 49.4-4.9-19.9-5.6-48.1-2.7-51.4.8.1 1.5.7 2.2 2zm-1.6 120.5c10.7 18.5 24.2 34.4 39.1 46.2-21.6 4.9-41.3 13-58.9 20.2-4.2 1.7-8.3 3.4-12.3 5 13.3-24.1 24.4-51.4 32.1-71.4zm155.6 65.5c.1.2.2.5-.4.9h-.2l-.2.3c-.8.5-9 5.3-44.3-8.6 40.6-1.9 45 7.3 45.1 7.4zm191.4-388.2L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0042 42h216v494z"}}]},name:"file-pdf",theme:"outlined"},Je=function(e,t){return u.createElement(Be,F({},e,{ref:t,icon:Ye}))},Xe=u.forwardRef(Je);"production"!==process.env.NODE_ENV&&(Xe.displayName="FilePdfOutlined");var Qe={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M424 476c-4.4 0-8 3.6-8 8v276c0 4.4 3.6 8 8 8h32.5c4.4 0 8-3.6 8-8v-95.5h63.3c59.4 0 96.2-38.9 96.2-94.1 0-54.5-36.3-94.3-96-94.3H424zm150.6 94.3c0 43.4-26.5 54.3-71.2 54.3h-38.9V516.2h56.2c33.8 0 53.9 19.7 53.9 54.1zm280-281.7L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0042 42h216v494z"}}]},name:"file-ppt",theme:"outlined"},et=function(e,t){return u.createElement(Be,F({},e,{ref:t,icon:Qe}))},tt=u.forwardRef(et);"production"!==process.env.NODE_ENV&&(tt.displayName="FilePptOutlined");var nt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0042 42h216v494zM504 618H320c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h184c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8zM312 490v48c0 4.4 3.6 8 8 8h384c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H320c-4.4 0-8 3.6-8 8z"}}]},name:"file-text",theme:"outlined"},rt=function(e,t){return u.createElement(Be,F({},e,{ref:t,icon:nt}))},st=u.forwardRef(rt);"production"!==process.env.NODE_ENV&&(st.displayName="FileTextOutlined");var it={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0042 42h216v494zM528.1 472h-32.2c-5.5 0-10.3 3.7-11.6 9.1L434.6 680l-46.1-198.7c-1.3-5.4-6.1-9.3-11.7-9.3h-35.4a12.02 12.02 0 00-11.6 15.1l74.2 276c1.4 5.2 6.2 8.9 11.6 8.9h32c5.4 0 10.2-3.6 11.6-8.9l52.8-197 52.8 197c1.4 5.2 6.2 8.9 11.6 8.9h31.8c5.4 0 10.2-3.6 11.6-8.9l74.4-276a12.04 12.04 0 00-11.6-15.1H647c-5.6 0-10.4 3.9-11.7 9.3l-45.8 199.1-49.8-199.3c-1.3-5.4-6.1-9.1-11.6-9.1z"}}]},name:"file-word",theme:"outlined"},ot=function(e,t){return u.createElement(Be,F({},e,{ref:t,icon:it}))},lt=u.forwardRef(ot);"production"!==process.env.NODE_ENV&&(lt.displayName="FileWordOutlined");var at={icon:{tag:"svg",attrs:{viewBox:"0 0 1024 1024",focusable:"false"},children:[{tag:"path",attrs:{d:"M988 548c-19.9 0-36-16.1-36-36 0-59.4-11.6-117-34.6-171.3a440.45 440.45 0 00-94.3-139.9 437.71 437.71 0 00-139.9-94.3C629 83.6 571.4 72 512 72c-19.9 0-36-16.1-36-36s16.1-36 36-36c69.1 0 136.2 13.5 199.3 40.3C772.3 66 827 103 874 150c47 47 83.9 101.8 109.7 162.7 26.7 63.1 40.2 130.2 40.2 199.3.1 19.9-16 36-35.9 36z"}}]},name:"loading",theme:"outlined"},ct=function(e,t){return u.createElement(Be,F({},e,{ref:t,icon:at}))},ut=u.forwardRef(ct);"production"!==process.env.NODE_ENV&&(ut.displayName="LoadingOutlined");var dt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z"}},{tag:"path",attrs:{d:"M192 474h672q8 0 8 8v60q0 8-8 8H160q-8 0-8-8v-60q0-8 8-8z"}}]},name:"plus",theme:"outlined"},ht=function(e,t){return u.createElement(Be,F({},e,{ref:t,icon:dt}))},ft=u.forwardRef(ht);"production"!==process.env.NODE_ENV&&(ft.displayName="PlusOutlined");var pt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M765.7 486.8L314.9 134.7A7.97 7.97 0 00302 141v77.3c0 4.9 2.3 9.6 6.1 12.6l360 281.1-360 281.1c-3.9 3-6.1 7.7-6.1 12.6V883c0 6.7 7.7 10.4 12.9 6.3l450.8-352.1a31.96 31.96 0 000-50.4z"}}]},name:"right",theme:"outlined"},mt=function(e,t){return u.createElement(Be,F({},e,{ref:t,icon:pt}))},gt=u.forwardRef(mt);"production"!==process.env.NODE_ENV&&(gt.displayName="RightOutlined");var vt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M909.6 854.5L649.9 594.8C690.2 542.7 712 479 712 412c0-80.2-31.3-155.4-87.9-212.1-56.6-56.7-132-87.9-212.1-87.9s-155.5 31.3-212.1 87.9C143.2 256.5 112 331.8 112 412c0 80.1 31.3 155.5 87.9 212.1C256.5 680.8 331.8 712 412 712c67 0 130.6-21.8 182.7-62l259.7 259.6a8.2 8.2 0 0011.6 0l43.6-43.5a8.2 8.2 0 000-11.6zM570.4 570.4C528 612.7 471.8 636 412 636s-116-23.3-158.4-65.6C211.3 528 188 471.8 188 412s23.3-116.1 65.6-158.4C296 211.3 352.2 188 412 188s116.1 23.2 158.4 65.6S636 352.2 636 412s-23.3 116.1-65.6 158.4z"}}]},name:"search",theme:"outlined"},bt=function(e,t){return u.createElement(Be,F({},e,{ref:t,icon:vt}))},yt=u.forwardRef(bt);"production"!==process.env.NODE_ENV&&(yt.displayName="SearchOutlined");var xt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M924.8 625.7l-65.5-56c3.1-19 4.7-38.4 4.7-57.8s-1.6-38.8-4.7-57.8l65.5-56a32.03 32.03 0 009.3-35.2l-.9-2.6a443.74 443.74 0 00-79.7-137.9l-1.8-2.1a32.12 32.12 0 00-35.1-9.5l-81.3 28.9c-30-24.6-63.5-44-99.7-57.6l-15.7-85a32.05 32.05 0 00-25.8-25.7l-2.7-.5c-52.1-9.4-106.9-9.4-159 0l-2.7.5a32.05 32.05 0 00-25.8 25.7l-15.8 85.4a351.86 351.86 0 00-99 57.4l-81.9-29.1a32 32 0 00-35.1 9.5l-1.8 2.1a446.02 446.02 0 00-79.7 137.9l-.9 2.6c-4.5 12.5-.8 26.5 9.3 35.2l66.3 56.6c-3.1 18.8-4.6 38-4.6 57.1 0 19.2 1.5 38.4 4.6 57.1L99 625.5a32.03 32.03 0 00-9.3 35.2l.9 2.6c18.1 50.4 44.9 96.9 79.7 137.9l1.8 2.1a32.12 32.12 0 0035.1 9.5l81.9-29.1c29.8 24.5 63.1 43.9 99 57.4l15.8 85.4a32.05 32.05 0 0025.8 25.7l2.7.5a449.4 449.4 0 00159 0l2.7-.5a32.05 32.05 0 0025.8-25.7l15.7-85a350 350 0 0099.7-57.6l81.3 28.9a32 32 0 0035.1-9.5l1.8-2.1c34.8-41.1 61.6-87.5 79.7-137.9l.9-2.6c4.5-12.3.8-26.3-9.3-35zM788.3 465.9c2.5 15.1 3.8 30.6 3.8 46.1s-1.3 31-3.8 46.1l-6.6 40.1 74.7 63.9a370.03 370.03 0 01-42.6 73.6L721 702.8l-31.4 25.8c-23.9 19.6-50.5 35-79.3 45.8l-38.1 14.3-17.9 97a377.5 377.5 0 01-85 0l-17.9-97.2-37.8-14.5c-28.5-10.8-55-26.2-78.7-45.7l-31.4-25.9-93.4 33.2c-17-22.9-31.2-47.6-42.6-73.6l75.5-64.5-6.5-40c-2.4-14.9-3.7-30.3-3.7-45.5 0-15.3 1.2-30.6 3.7-45.5l6.5-40-75.5-64.5c11.3-26.1 25.6-50.7 42.6-73.6l93.4 33.2 31.4-25.9c23.7-19.5 50.2-34.9 78.7-45.7l37.9-14.3 17.9-97.2c28.1-3.2 56.8-3.2 85 0l17.9 97 38.1 14.3c28.7 10.8 55.4 26.2 79.3 45.8l31.4 25.8 92.8-32.9c17 22.9 31.2 47.6 42.6 73.6L781.8 426l6.5 39.9zM512 326c-97.2 0-176 78.8-176 176s78.8 176 176 176 176-78.8 176-176-78.8-176-176-176zm79.2 255.2A111.6 111.6 0 01512 614c-29.9 0-58-11.7-79.2-32.8A111.6 111.6 0 01400 502c0-29.9 11.7-58 32.8-79.2C454 401.6 482.1 390 512 390c29.9 0 58 11.6 79.2 32.8A111.6 111.6 0 01624 502c0 29.9-11.7 58-32.8 79.2z"}}]},name:"setting",theme:"outlined"},wt=function(e,t){return u.createElement(Be,F({},e,{ref:t,icon:xt}))},Nt=u.forwardRef(wt);"production"!==process.env.NODE_ENV&&(Nt.displayName="SettingOutlined");var Et={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M400 317.7h73.9V656c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V317.7H624c6.7 0 10.4-7.7 6.3-12.9L518.3 163a8 8 0 00-12.6 0l-112 141.7c-4.1 5.3-.4 13 6.3 13zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z"}}]},name:"upload",theme:"outlined"},kt=function(e,t){return u.createElement(Be,F({},e,{ref:t,icon:Et}))},St=u.forwardRef(kt);"production"!==process.env.NODE_ENV&&(St.displayName="UploadOutlined");var At={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M912 302.3L784 376V224c0-35.3-28.7-64-64-64H128c-35.3 0-64 28.7-64 64v576c0 35.3 28.7 64 64 64h592c35.3 0 64-28.7 64-64V648l128 73.7c21.3 12.3 48-3.1 48-27.6V330c0-24.6-26.7-40-48-27.7zM712 792H136V232h576v560zm176-167l-104-59.8V458.9L888 399v226zM208 360h112c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H208c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8z"}}]},name:"video-camera",theme:"outlined"},Ct=function(e,t){return u.createElement(Be,F({},e,{ref:t,icon:At}))},jt=u.forwardRef(Ct);"production"!==process.env.NODE_ENV&&(jt.displayName="VideoCameraOutlined");const{Option:_t}=s.Select,Ot=e=>(t,n)=>{const r=null==t?void 0:t[e],s=null==n?void 0:n[e],i=null==r||""===r,o=null==s||""===s;if(i&&o)return 0;if(i)return 1;if(o)return-1;const l=Number(r),a=Number(s);if(!isNaN(l)&&!isNaN(a))return l-a;const c=String(r),u=String(s);return c.localeCompare(u,"zh-CN",{numeric:!0,sensitivity:"base"})},Tt=r.forwardRef((e,t)=>{var i;const{columns:o,dataSource:a,pagination:c,tableId:u,size:d="middle",onRowClick:h,page:p,showTableConfig:m=!0,...g}=e,[v,b]=r.useState([]),[y,x]=r.useState([]),[w,N]=r.useState(!1),[E,k]=r.useState([]),[S,C]=r.useState([]),[j,_]=r.useState([]),[O]=s.Form.useForm(),[T,L]=r.useState([]),[q,I]=r.useState({field:null,order:null}),[R,M]=r.useState([]),B=f.getUserInfo(),D=null==(i=f.getOrgInfo())?void 0:i.orgId,P=r.useRef(void 0),F=r.useRef(void 0);r.useImperativeHandle(t,()=>({openSettingModal:()=>N(!0),closeSettingModal:()=>N(!1)}));const U=r.useMemo(()=>(null==o?void 0:o.map(e=>e.dataIndex||e.key).join(","))||"",[o]),z=r.useCallback(async()=>{var e,t,n;const r=(null==o?void 0:o.map((e,t)=>({key:e.key||e.dataIndex||`col-${t}`,title:e.title,dataIndex:e.dataIndex,displayTitle:"string"==typeof e.title?e.title:`列 ${t+1}`,headerAlignment:e.align||"left",contentAlignment:e.align||"left",dataFormat:"字符串",width:e.width||100,enabled:!1!==e.enabled,calculateTotal:!1,isBuiltIn:!1,allowSorting:!1,sort:t+1,render:e.render,fixed:e.fixed,originalColumn:{...e}})))||[];if(C(r),o.length>1)try{if(u){const i=await(s={userId:B.userId,tableId:u||"",orgId:D},A("/platform/business/common/getTableConfigByUser",s));if(null==(e=null==i?void 0:i.data)?void 0:e.content){const e=null==(n=JSON.parse(null==(t=null==i?void 0:i.data)?void 0:t.content))?void 0:n.map(e=>{var t;const n=null==(t=o.find(t=>t.key===e.key))?void 0:t.render;return{...e,render:n,originalColumn:{...e.originalColumn,render:n}}});k(e),_(e)}else k(r),_(r)}else k(r),_(r)}catch(i){k(r),_(r)}else k(r),_(r);var s},[o,u,B.userId]),$=r.useMemo(()=>l.debounce(z,100),[z]);r.useEffect(()=>{(P.current!==u||F.current!==U)&&(P.current=u,F.current=U,$())},[u,U,$]),r.useEffect(()=>{const e=E.filter(e=>e.enabled).sort((e,t)=>e.sort-t.sort).map(e=>{const t=o.find(t=>(t.key||t.dataIndex)===e.key),n={...e.originalColumn,...t,key:e.key,title:e.displayTitle,dataIndex:e.dataIndex,align:e.contentAlignment,width:Number(e.width),onHeaderCell:n=>{var r;const s=(null==t?void 0:t.onHeaderCell)||(null==(r=e.originalColumn)?void 0:r.onHeaderCell),i=s?s(n):{};return{...i,style:{...i.style,textAlign:e.headerAlignment}}}};return e.allowSorting&&e.dataIndex&&(n.sorter=!0,n.sortDirections=["ascend","descend"],n.sortOrder=q.field===e.dataIndex?q.order:null),n}),t=[...m?[{title:n.jsxs(s.Space,{size:"small",children:[n.jsx("span",{children:"序号"}),n.jsx(s.Tooltip,{title:"表格配置",children:n.jsx(Nt,{onClick:()=>N(!0),style:{cursor:"pointer"}})})]}),dataIndex:"INDEX",key:"INDEX",width:80,align:"center",isBuiltIn:!0,fixed:"left",render:(e,t,r)=>{const i=e||((null==p?void 0:p.current)-1)*(null==p?void 0:p.pageSize)+r+1||r+1;return n.jsx(s.Tooltip,{title:String(i),children:n.jsx("div",{style:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:i})})}}]:[],...e].map(e=>{const t=e.render;return{...e,render:(i,o,l)=>{const a=t?t(i,o,l):i;return r.isValidElement(a)?n.jsx("div",{style:{textAlign:e.align,width:"100%"},children:a}):"object"==typeof a&&null!==a?"":n.jsx(s.Tooltip,{title:null!=a?String(a):"",children:n.jsx("div",{style:{display:"block",width:"100%",textAlign:e.align,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",paddingLeft:"left"===e.align?0:void 0,paddingRight:"right"===e.align?0:void 0},children:null!=a?a:""})})}}});b(t)},[E,m,p,q,o]),r.useEffect(()=>{const e=(t,n,r)=>t.map((t,s)=>{const i=`${n}.${s+1}`,o={...t,parentId:(null==t?void 0:t.parentId)||r,id:(null==t?void 0:t.id)||`${r}-${s+1}`,INDEX:i};return Array.isArray(null==t?void 0:t.children)&&t.children.length>0&&(o.children=e(t.children,i,o.id)),o}),t=(a||[]).map((t,n)=>{const r=(null==t?void 0:t.INDEX)||((null==p?void 0:p.current)-1)*(null==p?void 0:p.pageSize)+n+1||n+1,s={...t,parentId:(null==t?void 0:t.parentId)||null,id:(null==t?void 0:t.id)||n+1,INDEX:r};return Array.isArray(null==t?void 0:t.children)&&t.children.length>0&&(s.children=e(t.children,r,s.id)),s});if(L(t.map(e=>e.id)),M(t),q.field&&q.order&&t.length>0){const e=[...t].sort((e,t)=>{const n=Ot(q.field)(e,t);return"descend"===q.order?-n:n});x(e)}else x(t)},[a]);const V=r.useRef(null),H=[{title:"显示名称",dataIndex:"displayTitle",key:"displayTitle",render:(e,t)=>n.jsx(s.Input,{size:"small",defaultValue:e,onBlur:e=>K(t.key,"displayTitle",e.target.value)})},{title:"表头对齐",dataIndex:"headerAlignment",key:"headerAlignment",align:"center",render:(e,t)=>n.jsxs(s.Radio.Group,{size:"small",defaultValue:e,onChange:e=>K(t.key,"headerAlignment",e.target.value),children:[n.jsx(s.Radio.Button,{value:"left",children:"左"}),n.jsx(s.Radio.Button,{value:"center",children:"中"}),n.jsx(s.Radio.Button,{value:"right",children:"右"})]})},{title:"内容对齐",dataIndex:"contentAlignment",key:"contentAlignment",align:"center",render:(e,t)=>n.jsxs(s.Radio.Group,{size:"small",defaultValue:e,onChange:e=>K(t.key,"contentAlignment",e.target.value),children:[n.jsx(s.Radio.Button,{value:"left",children:"左"}),n.jsx(s.Radio.Button,{value:"center",children:"中"}),n.jsx(s.Radio.Button,{value:"right",children:"右"})]})},{title:"数据格式",dataIndex:"dataFormat",key:"dataFormat",render:(e,t)=>n.jsxs(s.Select,{size:"small",defaultValue:e,style:{width:80},onChange:e=>K(t.key,"dataFormat",e),children:[n.jsx(_t,{value:"字符串",children:"字符串"}),n.jsx(_t,{value:"数字",children:"数字"}),n.jsx(_t,{value:"日期",children:"日期"})]})},{title:"宽度",dataIndex:"width",key:"width",render:(e,t)=>n.jsx(s.InputNumber,{size:"small",defaultValue:e,style:{width:60},onBlur:e=>K(t.key,"width",e.target.value)})},{title:"是否启用",dataIndex:"enabled",key:"enabled",align:"center",render:(e,t)=>n.jsx(s.Switch,{size:"small",defaultValue:e,onChange:e=>K(t.key,"enabled",e)})},{title:"允许排序",dataIndex:"allowSorting",key:"allowSorting",align:"center",render:(e,t)=>n.jsx(s.Switch,{size:"small",defaultValue:e,onChange:e=>K(t.key,"allowSorting",e)})},{title:"显示顺序",dataIndex:"sort",key:"sort",render:(e,t)=>n.jsx(s.InputNumber,{size:"small",defaultValue:e,style:{width:60},onBlur:e=>K(t.key,"sort",e.target.value)})}],K=(e,t,n)=>{_(r=>r.map(r=>r.key===e?{...r,[t]:n}:r))},W=async()=>{try{const t=await(e={tableId:u||"",userId:B.userId,content:JSON.stringify(j)},A("/platform/business/common/saveUserTableConfig",e));k(j),200===(null==t?void 0:t.code)&&(s.message.success("保存成功"),$())}catch(t){}var e},G=()=>{N(!1)},Z=(e,t=!1)=>{L(t?T.filter(t=>t!==(null==e?void 0:e.id)):[...T,null==e?void 0:e.id])},Y=r.useCallback(e=>{const{field:t,order:n}=e,r=R||[];if(!t||!n)return I({field:null,order:null}),void x([...r]);if(I({field:t,order:n}),0===r.length)return void x([]);const s=[...r].sort((e,r)=>{const s=Ot(t)(e,r);return"descend"===n?-s:s});x(s)},[R]),J=r.useCallback((e,t,n,r)=>{"sort"!==(null==r?void 0:r.action)?(g.onChange&&g.onChange(e,t,n,r),g.handleTableChange&&g.handleTableChange(e,t,n)):Y(n)},[Y,g.onChange,g.handleTableChange]),X=r.useMemo(()=>{if(!1===c)return!1;if(c&&"object"==typeof c){const e={pageSize:10,...c};return Array.isArray(e.pageSizeOptions)&&(e.pageSizeOptions=e.pageSizeOptions.filter(e=>null!=e)),e}return c},[c]);return n.jsxs(s.ConfigProvider,{theme:{components:{Table:{bodySortBg:"transparent",headerSortActiveBg:"#2569D8",headerSortHoverBg:"#2569D8"}}},children:[n.jsx(s.Table,{...g,columns:v,dataSource:y,bordered:!0,rowKey:"id",indentSize:24,pagination:X,size:"small",onChange:J,onRow:(e,t)=>{const n=g.onRow?g.onRow(e,t):{};return{...n,onClick:t=>{var r;h&&h(e,t),null==(r=null==n?void 0:n.onClick)||r.call(n,t)}}},expandable:{expandedRowKeys:T,expandIcon:({expanded:e,onExpand:t,record:r})=>{var s;if((null==(s=null==r?void 0:r.children)?void 0:s.length)>0){const s={fontSize:"14px",color:"rgba(0, 0, 0, 0.45)",cursor:"pointer",position:"absolute",left:`${18+8*((null==r?void 0:r.INDEX)?String(r.INDEX).split(".").length-1:0)}px`,top:"13px"};return e?n.jsx($e,{onClick:e=>{t(r,e),Z(r,!0)},style:s}):n.jsx(gt,{onClick:e=>{t(r,e),Z(r,!1)},style:s})}return null}}}),n.jsx(s.Modal,{title:"表格设置",visible:w,footer:[n.jsx(s.Button,{onClick:async()=>{var e;200===(await(e={userId:B.userId,tableId:u||""},A("/platform/business/common/restoreDefaultTableConfig",e))).code&&(k(S),_(S),N(!1),s.message.success("重置成功"))},children:"重置"},"reset"),n.jsx(s.Button,{onClick:G,children:"取消"},"cancel"),n.jsx(s.Button,{onClick:async()=>{try{const t=await(e={orgId:D,tableId:u||"",content:JSON.stringify(j)},A("/platform/business/common/saveCurOrgTableConfig",e));k(j),200===(null==t?void 0:t.code)&&(s.message.success("保存为机构配置成功"),N(!1))}catch(t){}var e},children:"保存为该机构配置"},"saveOrg"),n.jsx(s.Button,{type:"primary",onClick:()=>{N(!1),W()},children:"保存"},"submit")],onCancel:G,width:1e3,destroyOnClose:!0,maskClosable:!1,children:n.jsx(s.Spin,{spinning:!1,children:n.jsx(s.Form,{form:O,component:!1,children:n.jsx(s.Table,{ref:V,columns:H,dataSource:j.filter(e=>!e.isBuiltIn).sort((e,t)=>e.sort-t.sort),rowKey:"key",size:"small",pagination:!1,bordered:!0,scroll:{y:400}})})})})]})}),Lt=({label:e,id:t,value:i,onChange:o,disabled:l=!1})=>{const[a,c]=r.useState([]),[u,d]=r.useState(void 0),[h,f]=r.useState(!1),[p,m]=r.useState(void 0),[g,v]=r.useState(void 0),[b,y]=r.useState(void 0),[x,w]=r.useState(void 0),[N,E]=r.useState([]),[k,S]=r.useState(void 0),[A,C]=r.useState(!1),[j,_]=r.useState([]),[T,L]=r.useState(void 0),[q,I]=r.useState(!1),[R,M]=r.useState([]),[B,D]=r.useState(void 0),[P,F]=r.useState(!1),[U,z]=r.useState(""),$=r.useRef(!1),V=r.useRef(!1),H=r.useRef(o);H.current=o;const K=r.useCallback(e=>{H.current&&H.current(e)},[]),W=r.useCallback(async(e,t)=>{switch(e){case 1:f(!0);break;case 2:C(!0);break;case 3:I(!0);break;case 4:F(!0)}try{const n=await O({level:e,parent:t.toString()},"/platform/business/common/getAreaByLevel");return 200===n.code&&Array.isArray(n.data)?n.data.map(e=>({value:e.code,label:e.name})):[]}catch(n){return[]}finally{switch(e){case 1:f(!1);break;case 2:C(!1);break;case 3:I(!1);break;case 4:F(!1)}}},[]);r.useEffect(()=>{W(1,"0").then(e=>{c(e)})},[W]),r.useEffect(()=>{if(!i)return;if(V.current)return void(V.current=!1);$.current=!0,d(i.addProvinceCode),m(i.addProvince),S(i.addCityCode),v(i.addCity),L(i.addCountyCode),y(i.addCounty),D(i.addStreetCode),w(i.addStreet),z(i.address||"");(async()=>{try{if(i.addProvinceCode){const e=await W(2,i.addProvinceCode);if(E(e),i.addCityCode){const e=await W(3,i.addCityCode);if(_(e),i.addCountyCode){const e=await W(4,i.addCountyCode);M(e)}}}}finally{$.current=!1}})()},[i]),r.useEffect(()=>{$.current||(u?W(2,u).then(e=>E(e)):(v(void 0),y(void 0),w(void 0),m(void 0),z(""),S(void 0),E([]),L(void 0),_([]),D(void 0),M([])))},[u,W]),r.useEffect(()=>{$.current||(k?W(3,k).then(e=>_(e)):(L(void 0),_([]),D(void 0),M([]),z("")))},[k,W]),r.useEffect(()=>{$.current||(T?W(4,T).then(e=>M(e)):(D(void 0),M([]),z("")))},[T,W]);return n.jsx("div",{children:n.jsxs(s.Space,{wrap:!0,id:t,children:[n.jsx(s.Select,{style:{minWidth:100},options:a,value:u,onChange:e=>{var t;if(e===u&&void 0!==e)return;V.current=!0;const n=null==(t=a.find(t=>t.value===e))?void 0:t.label;d(e),m(n),S(void 0),v(void 0),E([]),L(void 0),y(void 0),_([]),D(void 0),w(void 0),M([]),z(""),K({addProvince:n,addProvinceCode:e,addCity:void 0,addCityCode:void 0,addCounty:void 0,addCountyCode:void 0,addStreet:void 0,addStreetCode:void 0,address:""})},placeholder:"请选择省",loading:h,disabled:l,allowClear:!0}),n.jsx(s.Select,{style:{minWidth:100},options:N,value:k,onChange:e=>{var t;if(e===k&&void 0!==e)return;V.current=!0;const n=null==(t=N.find(t=>t.value===e))?void 0:t.label;S(e),v(n),L(void 0),y(void 0),_([]),D(void 0),w(void 0),M([]),z(""),K({addProvince:p,addProvinceCode:u,addCity:n,addCityCode:e,addCounty:void 0,addCountyCode:void 0,addStreet:void 0,addStreetCode:void 0,address:""})},placeholder:"请选择市",loading:A,disabled:l||!u||h,allowClear:!0}),n.jsx(s.Select,{style:{minWidth:100},options:j,value:T,onChange:e=>{var t;if(e===T&&void 0!==e)return;V.current=!0;const n=null==(t=j.find(t=>t.value===e))?void 0:t.label;L(e),y(n),D(void 0),w(void 0),M([]),z(""),K({addProvince:p,addProvinceCode:u,addCity:g,addCityCode:k,addCounty:n,addCountyCode:e,addStreet:void 0,addStreetCode:void 0,address:""})},placeholder:"请选择区/县",loading:q,disabled:l||!k||A,allowClear:!0}),n.jsx(s.Select,{style:{minWidth:100},options:R,value:B,onChange:e=>{var t;if(e===B&&void 0!==e)return;V.current=!0;const n=null==(t=R.find(t=>t.value===e))?void 0:t.label;D(e),w(n),z(""),K({addProvince:p,addProvinceCode:u,addCity:g,addCityCode:k,addCounty:b,addCountyCode:T,addStreet:n,addStreetCode:e,address:""})},placeholder:"请选择乡/镇",loading:P,disabled:l||!T||q,allowClear:!0}),n.jsx(s.Input,{placeholder:"请输入详细地址",disabled:l||!T,value:U,onChange:e=>{V.current=!0;const t=e.target.value;z(t),K({addProvince:p,addProvinceCode:u,addCity:g,addCityCode:k,addCounty:b,addCountyCode:T,addStreet:x,addStreetCode:B,address:t})}})]})})},qt=({value:e,onChange:t,accept:i="image/*",listType:o="picture-card",maxCount:l=1,key:a,disabled:c=!1})=>{const[u,d]=r.useState(!1),[h,f]=r.useState(""),[p,m]=r.useState(""),[g,v]=r.useState([]);r.useEffect(()=>{v(e?[{uid:"-1",name:"image.png",status:"done",url:e}]:[])},[e]);const b=r.useCallback(e=>{t&&t(e)},[t]),y=n.jsxs("div",{children:[n.jsx(ft,{}),n.jsx("div",{style:{marginTop:8},children:"上传"})]});return n.jsxs(n.Fragment,{children:[n.jsx(s.Upload,{accept:i,listType:o,fileList:g,onPreview:async e=>{e.url||e.preview||e.originFileObj&&(e.preview=await(e=>new Promise((t,n)=>{const r=new FileReader;r.readAsDataURL(e),r.onload=()=>t(r.result),r.onerror=e=>n(e)}))(e.originFileObj)),f(e.url||e.preview),d(!0),m(e.name||e.url.substring(e.url.lastIndexOf("/")+1))},onChange:({file:e,fileList:t})=>{var n,r;if(v(t),"done"===e.status){const r=null==(n=e.response)?void 0:n.data;r?(s.message.success(`${e.name} 文件上传成功`),null==b||b(r)):(s.message.error(`${e.name} 文件上传成功,但未获取到 URL。`),v(t.filter(t=>t.uid!==e.uid)))}else"removed"===e.status?(s.message.success(`${e.name} 文件已移除`),null==b||b(void 0)):"error"===e.status&&(s.message.error(`${e.name} 文件上传失败: ${(null==(r=e.error)?void 0:r.message)||"未知错误"}`),null==b||b(void 0))},customRequest:async e=>{const{onSuccess:t,onError:n,file:r,onProgress:i}=e;if(r instanceof File&&r.size>8388608)return s.message.error("文件大小不能超过 8MB"),void(null==n||n(new Error("文件大小不能超过 8MB")));const o=new FormData;o.append("file",r);try{const e=await q(o,{headers:{"Content-Type":"multipart/form-data"},onUploadProgress:e=>{e.total&&i({percent:e.loaded/e.total*100})}});e&&e.data?(null==b||b(e.data),t(e,r)):n(new Error("上传成功但响应中缺少图片URL"),e)}catch(l){n(l)}},maxCount:l,disabled:c,onRemove:e=>!0,children:g.length>=(l||1)?null:y},a),n.jsx(s.Modal,{visible:u,title:p,footer:null,onCancel:()=>d(!1),children:n.jsx("img",{alt:"example",style:{width:"100%"},src:h})})]})};var It="object"==typeof global&&global&&global.Object===Object&&global,Rt="object"==typeof self&&self&&self.Object===Object&&self,Mt=It||Rt||Function("return this")(),Bt=Mt.Symbol,Dt=Object.prototype,Pt=Dt.hasOwnProperty,Ft=Dt.toString,Ut=Bt?Bt.toStringTag:void 0;var zt=Object.prototype.toString;var $t=Bt?Bt.toStringTag:void 0;function Vt(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":$t&&$t in Object(e)?function(e){var t=Pt.call(e,Ut),n=e[Ut];try{e[Ut]=void 0;var r=!0}catch(i){}var s=Ft.call(e);return r&&(t?e[Ut]=n:delete e[Ut]),s}(e):function(e){return zt.call(e)}(e)}function Ht(e){return null!=e&&"object"==typeof e}var Kt=Array.isArray;function Wt(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function Gt(e){return e}function Zt(e){if(!Wt(e))return!1;var t=Vt(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}var Yt,Jt=Mt["__core-js_shared__"],Xt=(Yt=/[^.]+$/.exec(Jt&&Jt.keys&&Jt.keys.IE_PROTO||""))?"Symbol(src)_1."+Yt:"";var Qt=Function.prototype.toString;function en(e){if(null!=e){try{return Qt.call(e)}catch(t){}try{return e+""}catch(t){}}return""}var tn=/^\[object .+?Constructor\]$/,nn=Function.prototype,rn=Object.prototype,sn=nn.toString,on=rn.hasOwnProperty,ln=RegExp("^"+sn.call(on).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function an(e){return!(!Wt(e)||(t=e,Xt&&Xt in t))&&(Zt(e)?ln:tn).test(en(e));var t}function cn(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return an(n)?n:void 0}var un=cn(Mt,"WeakMap"),dn=Object.create,hn=function(){function e(){}return function(t){if(!Wt(t))return{};if(dn)return dn(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();var fn=Date.now;var pn,mn,gn,vn=function(){try{var e=cn(Object,"defineProperty");return e({},"",{}),e}catch(t){}}(),bn=vn?function(e,t){return vn(e,"toString",{configurable:!0,enumerable:!1,value:(n=t,function(){return n}),writable:!0});var n}:Gt,yn=(pn=bn,mn=0,gn=0,function(){var e=fn(),t=16-(e-gn);if(gn=e,t>0){if(++mn>=800)return arguments[0]}else mn=0;return pn.apply(void 0,arguments)});var xn=/^(?:0|[1-9]\d*)$/;function wn(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&xn.test(e))&&e>-1&&e%1==0&&e<t}function Nn(e,t,n){"__proto__"==t&&vn?vn(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function En(e,t){return e===t||e!=e&&t!=t}var kn=Object.prototype.hasOwnProperty;function Sn(e,t,n){var r=e[t];kn.call(e,t)&&En(r,n)&&(void 0!==n||t in e)||Nn(e,t,n)}var An=Math.max;function Cn(e,t){return yn(function(e,t,n){return t=An(void 0===t?e.length-1:t,0),function(){for(var r=arguments,s=-1,i=An(r.length-t,0),o=Array(i);++s<i;)o[s]=r[t+s];s=-1;for(var l=Array(t+1);++s<t;)l[s]=r[s];return l[t]=n(o),function(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}(e,this,l)}}(e,t,Gt),e+"")}function jn(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function _n(e){return null!=e&&jn(e.length)&&!Zt(e)}var On=Object.prototype;function Tn(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||On)}function Ln(e){return Ht(e)&&"[object Arguments]"==Vt(e)}var qn=Object.prototype,In=qn.hasOwnProperty,Rn=qn.propertyIsEnumerable,Mn=Ln(function(){return arguments}())?Ln:function(e){return Ht(e)&&In.call(e,"callee")&&!Rn.call(e,"callee")};var Bn="object"==typeof exports&&exports&&!exports.nodeType&&exports,Dn=Bn&&"object"==typeof module&&module&&!module.nodeType&&module,Pn=Dn&&Dn.exports===Bn?Mt.Buffer:void 0,Fn=(Pn?Pn.isBuffer:void 0)||function(){return!1},Un={};function zn(e){return function(t){return e(t)}}Un["[object Float32Array]"]=Un["[object Float64Array]"]=Un["[object Int8Array]"]=Un["[object Int16Array]"]=Un["[object Int32Array]"]=Un["[object Uint8Array]"]=Un["[object Uint8ClampedArray]"]=Un["[object Uint16Array]"]=Un["[object Uint32Array]"]=!0,Un["[object Arguments]"]=Un["[object Array]"]=Un["[object ArrayBuffer]"]=Un["[object Boolean]"]=Un["[object DataView]"]=Un["[object Date]"]=Un["[object Error]"]=Un["[object Function]"]=Un["[object Map]"]=Un["[object Number]"]=Un["[object Object]"]=Un["[object RegExp]"]=Un["[object Set]"]=Un["[object String]"]=Un["[object WeakMap]"]=!1;var $n="object"==typeof exports&&exports&&!exports.nodeType&&exports,Vn=$n&&"object"==typeof module&&module&&!module.nodeType&&module,Hn=Vn&&Vn.exports===$n&&It.process,Kn=function(){try{var e=Vn&&Vn.require&&Vn.require("util").types;return e||Hn&&Hn.binding&&Hn.binding("util")}catch(t){}}(),Wn=Kn&&Kn.isTypedArray,Gn=Wn?zn(Wn):function(e){return Ht(e)&&jn(e.length)&&!!Un[Vt(e)]},Zn=Object.prototype.hasOwnProperty;function Yn(e,t){var n=Kt(e),r=!n&&Mn(e),s=!n&&!r&&Fn(e),i=!n&&!r&&!s&&Gn(e),o=n||r||s||i,l=o?function(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}(e.length,String):[],a=l.length;for(var c in e)!t&&!Zn.call(e,c)||o&&("length"==c||s&&("offset"==c||"parent"==c)||i&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||wn(c,a))||l.push(c);return l}function Jn(e,t){return function(n){return e(t(n))}}var Xn=Jn(Object.keys,Object),Qn=Object.prototype.hasOwnProperty;function er(e){return _n(e)?Yn(e):function(e){if(!Tn(e))return Xn(e);var t=[];for(var n in Object(e))Qn.call(e,n)&&"constructor"!=n&&t.push(n);return t}(e)}var tr=Object.prototype.hasOwnProperty;function nr(e){if(!Wt(e))return function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t}(e);var t=Tn(e),n=[];for(var r in e)("constructor"!=r||!t&&tr.call(e,r))&&n.push(r);return n}function rr(e){return _n(e)?Yn(e,!0):nr(e)}var sr=cn(Object,"create");var ir=Object.prototype.hasOwnProperty;var or=Object.prototype.hasOwnProperty;function lr(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function ar(e,t){for(var n=e.length;n--;)if(En(e[n][0],t))return n;return-1}lr.prototype.clear=function(){this.__data__=sr?sr(null):{},this.size=0},lr.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},lr.prototype.get=function(e){var t=this.__data__;if(sr){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return ir.call(t,e)?t[e]:void 0},lr.prototype.has=function(e){var t=this.__data__;return sr?void 0!==t[e]:or.call(t,e)},lr.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=sr&&void 0===t?"__lodash_hash_undefined__":t,this};var cr=Array.prototype.splice;function ur(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}ur.prototype.clear=function(){this.__data__=[],this.size=0},ur.prototype.delete=function(e){var t=this.__data__,n=ar(t,e);return!(n<0)&&(n==t.length-1?t.pop():cr.call(t,n,1),--this.size,!0)},ur.prototype.get=function(e){var t=this.__data__,n=ar(t,e);return n<0?void 0:t[n][1]},ur.prototype.has=function(e){return ar(this.__data__,e)>-1},ur.prototype.set=function(e,t){var n=this.__data__,r=ar(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this};var dr=cn(Mt,"Map");function hr(e,t){var n,r,s=e.__data__;return("string"==(r=typeof(n=t))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?s["string"==typeof t?"string":"hash"]:s.map}function fr(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}fr.prototype.clear=function(){this.size=0,this.__data__={hash:new lr,map:new(dr||ur),string:new lr}},fr.prototype.delete=function(e){var t=hr(this,e).delete(e);return this.size-=t?1:0,t},fr.prototype.get=function(e){return hr(this,e).get(e)},fr.prototype.has=function(e){return hr(this,e).has(e)},fr.prototype.set=function(e,t){var n=hr(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this};var pr=Jn(Object.getPrototypeOf,Object),mr=Function.prototype,gr=Object.prototype,vr=mr.toString,br=gr.hasOwnProperty,yr=vr.call(Object);function xr(e){var t=this.__data__=new ur(e);this.size=t.size}xr.prototype.clear=function(){this.__data__=new ur,this.size=0},xr.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},xr.prototype.get=function(e){return this.__data__.get(e)},xr.prototype.has=function(e){return this.__data__.has(e)},xr.prototype.set=function(e,t){var n=this.__data__;if(n instanceof ur){var r=n.__data__;if(!dr||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new fr(r)}return n.set(e,t),this.size=n.size,this};var wr="object"==typeof exports&&exports&&!exports.nodeType&&exports,Nr=wr&&"object"==typeof module&&module&&!module.nodeType&&module,Er=Nr&&Nr.exports===wr?Mt.Buffer:void 0,kr=Er?Er.allocUnsafe:void 0;function Sr(e,t){if(t)return e.slice();var n=e.length,r=kr?kr(n):new e.constructor(n);return e.copy(r),r}var Ar=Object.prototype.propertyIsEnumerable,Cr=Object.getOwnPropertySymbols,jr=Cr?function(e){return null==e?[]:(e=Object(e),function(e,t){for(var n=-1,r=null==e?0:e.length,s=0,i=[];++n<r;){var o=e[n];t(o,n,e)&&(i[s++]=o)}return i}(Cr(e),function(t){return Ar.call(e,t)}))}:function(){return[]};function _r(e){return function(e,t,n){var r=t(e);return Kt(e)?r:function(e,t){for(var n=-1,r=t.length,s=e.length;++n<r;)e[s+n]=t[n];return e}(r,n(e))}(e,er,jr)}var Or=cn(Mt,"DataView"),Tr=cn(Mt,"Promise"),Lr=cn(Mt,"Set"),qr="[object Map]",Ir="[object Promise]",Rr="[object Set]",Mr="[object WeakMap]",Br="[object DataView]",Dr=en(Or),Pr=en(dr),Fr=en(Tr),Ur=en(Lr),zr=en(un),$r=Vt;(Or&&$r(new Or(new ArrayBuffer(1)))!=Br||dr&&$r(new dr)!=qr||Tr&&$r(Tr.resolve())!=Ir||Lr&&$r(new Lr)!=Rr||un&&$r(new un)!=Mr)&&($r=function(e){var t=Vt(e),n="[object Object]"==t?e.constructor:void 0,r=n?en(n):"";if(r)switch(r){case Dr:return Br;case Pr:return qr;case Fr:return Ir;case Ur:return Rr;case zr:return Mr}return t});var Vr=Object.prototype.hasOwnProperty;var Hr=Mt.Uint8Array;function Kr(e){var t=new e.constructor(e.byteLength);return new Hr(t).set(new Hr(e)),t}var Wr=/\w*$/;var Gr=Bt?Bt.prototype:void 0,Zr=Gr?Gr.valueOf:void 0;function Yr(e,t){var n=t?Kr(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function Jr(e,t,n){var r,s,i,o,l,a=e.constructor;switch(t){case"[object ArrayBuffer]":return Kr(e);case"[object Boolean]":case"[object Date]":return new a(+e);case"[object DataView]":return l=Kr((o=e).buffer),new o.constructor(l,o.byteOffset,o.byteLength);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return Yr(e,n);case"[object Map]":case"[object Set]":return new a;case"[object Number]":case"[object String]":return new a(e);case"[object RegExp]":return(i=new(s=e).constructor(s.source,Wr.exec(s))).lastIndex=s.lastIndex,i;case"[object Symbol]":return r=e,Zr?Object(Zr.call(r)):{}}}function Xr(e){return"function"!=typeof e.constructor||Tn(e)?{}:hn(pr(e))}var Qr=Kn&&Kn.isMap,es=Qr?zn(Qr):function(e){return Ht(e)&&"[object Map]"==$r(e)};var ts=Kn&&Kn.isSet,ns=ts?zn(ts):function(e){return Ht(e)&&"[object Set]"==$r(e)},rs="[object Arguments]",ss="[object Function]",is="[object Object]",os={};function ls(e,t,n,r,s,i){var o,l=1&t;if(void 0!==o)return o;if(!Wt(e))return e;var a=Kt(e);if(a)o=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Vr.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e);else{var c=$r(e),u=c==ss||"[object GeneratorFunction]"==c;if(Fn(e))return Sr(e,l);if(c==is||c==rs||u&&!s)o=u?{}:Xr(e);else{if(!os[c])return s?e:{};o=Jr(e,c,l)}}i||(i=new xr);var d=i.get(e);if(d)return d;i.set(e,o),ns(e)?e.forEach(function(r){o.add(ls(r,t,n,r,e,i))}):es(e)&&e.forEach(function(r,s){o.set(s,ls(r,t,n,s,e,i))});var h=a?void 0:_r(e);return function(e,t){for(var n=-1,r=null==e?0:e.length;++n<r&&!1!==t(e[n],n,e););}(h||e,function(r,s){h&&(r=e[s=r]),Sn(o,s,ls(r,t,n,s,e,i))}),o}os[rs]=os["[object Array]"]=os["[object ArrayBuffer]"]=os["[object DataView]"]=os["[object Boolean]"]=os["[object Date]"]=os["[object Float32Array]"]=os["[object Float64Array]"]=os["[object Int8Array]"]=os["[object Int16Array]"]=os["[object Int32Array]"]=os["[object Map]"]=os["[object Number]"]=os[is]=os["[object RegExp]"]=os["[object Set]"]=os["[object String]"]=os["[object Symbol]"]=os["[object Uint8Array]"]=os["[object Uint8ClampedArray]"]=os["[object Uint16Array]"]=os["[object Uint32Array]"]=!0,os["[object Error]"]=os[ss]=os["[object WeakMap]"]=!1;function as(e){return ls(e,5)}function cs(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new fr;++t<n;)this.add(e[t])}function us(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}cs.prototype.add=cs.prototype.push=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},cs.prototype.has=function(e){return this.__data__.has(e)};function ds(e,t,n,r,s,i){var o=1&n,l=e.length,a=t.length;if(l!=a&&!(o&&a>l))return!1;var c=i.get(e),u=i.get(t);if(c&&u)return c==t&&u==e;var d=-1,h=!0,f=2&n?new cs:void 0;for(i.set(e,t),i.set(t,e);++d<l;){var p=e[d],m=t[d];if(r)var g=o?r(m,p,d,t,e,i):r(p,m,d,e,t,i);if(void 0!==g){if(g)continue;h=!1;break}if(f){if(!us(t,function(e,t){if(o=t,!f.has(o)&&(p===e||s(p,e,n,r,i)))return f.push(t);var o})){h=!1;break}}else if(p!==m&&!s(p,m,n,r,i)){h=!1;break}}return i.delete(e),i.delete(t),h}function hs(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n}function fs(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}var ps=Bt?Bt.prototype:void 0,ms=ps?ps.valueOf:void 0;var gs=Object.prototype.hasOwnProperty;var vs="[object Arguments]",bs="[object Array]",ys="[object Object]",xs=Object.prototype.hasOwnProperty;function ws(e,t,n,r,s,i){var o=Kt(e),l=Kt(t),a=o?bs:$r(e),c=l?bs:$r(t),u=(a=a==vs?ys:a)==ys,d=(c=c==vs?ys:c)==ys,h=a==c;if(h&&Fn(e)){if(!Fn(t))return!1;o=!0,u=!1}if(h&&!u)return i||(i=new xr),o||Gn(e)?ds(e,t,n,r,s,i):function(e,t,n,r,s,i,o){switch(n){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=t.byteLength||!i(new Hr(e),new Hr(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return En(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var l=hs;case"[object Set]":var a=1&r;if(l||(l=fs),e.size!=t.size&&!a)return!1;var c=o.get(e);if(c)return c==t;r|=2,o.set(e,t);var u=ds(l(e),l(t),r,s,i,o);return o.delete(e),u;case"[object Symbol]":if(ms)return ms.call(e)==ms.call(t)}return!1}(e,t,a,n,r,s,i);if(!(1&n)){var f=u&&xs.call(e,"__wrapped__"),p=d&&xs.call(t,"__wrapped__");if(f||p){var m=f?e.value():e,g=p?t.value():t;return i||(i=new xr),s(m,g,n,r,i)}}return!!h&&(i||(i=new xr),function(e,t,n,r,s,i){var o=1&n,l=_r(e),a=l.length;if(a!=_r(t).length&&!o)return!1;for(var c=a;c--;){var u=l[c];if(!(o?u in t:gs.call(t,u)))return!1}var d=i.get(e),h=i.get(t);if(d&&h)return d==t&&h==e;var f=!0;i.set(e,t),i.set(t,e);for(var p=o;++c<a;){var m=e[u=l[c]],g=t[u];if(r)var v=o?r(g,m,u,t,e,i):r(m,g,u,e,t,i);if(!(void 0===v?m===g||s(m,g,n,r,i):v)){f=!1;break}p||(p="constructor"==u)}if(f&&!p){var b=e.constructor,y=t.constructor;b==y||!("constructor"in e)||!("constructor"in t)||"function"==typeof b&&b instanceof b&&"function"==typeof y&&y instanceof y||(f=!1)}return i.delete(e),i.delete(t),f}(e,t,n,r,s,i))}function Ns(e,t,n,r,s){return e===t||(null==e||null==t||!Ht(e)&&!Ht(t)?e!=e&&t!=t:ws(e,t,n,r,Ns,s))}var Es=function(e,t,n){for(var r=-1,s=Object(e),i=n(e),o=i.length;o--;){var l=i[++r];if(!1===t(s[l],l,s))break}return e};function ks(e,t,n){(void 0!==n&&!En(e[t],n)||void 0===n&&!(t in e))&&Nn(e,t,n)}function Ss(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}function As(e){return function(e,t,n){var r=!n;n||(n={});for(var s=-1,i=t.length;++s<i;){var o=t[s],l=void 0;void 0===l&&(l=e[o]),r?Nn(n,o,l):Sn(n,o,l)}return n}(e,rr(e))}function Cs(e,t,n,r,s,i,o){var l=Ss(e,n),a=Ss(t,n),c=o.get(a);if(c)ks(e,n,c);else{var u,d=i?i(l,a,n+"",e,t,o):void 0,h=void 0===d;if(h){var f=Kt(a),p=!f&&Fn(a),m=!f&&!p&&Gn(a);d=a,f||p||m?Kt(l)?d=l:Ht(u=l)&&_n(u)?d=function(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t}(l):p?(h=!1,d=Sr(a,!0)):m?(h=!1,d=Yr(a,!0)):d=[]:function(e){if(!Ht(e)||"[object Object]"!=Vt(e))return!1;var t=pr(e);if(null===t)return!0;var n=br.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&vr.call(n)==yr}(a)||Mn(a)?(d=l,Mn(l)?d=As(l):Wt(l)&&!Zt(l)||(d=Xr(a))):h=!1}h&&(o.set(a,d),s(d,a,r,i,o),o.delete(a)),ks(e,n,d)}}function js(e,t,n,r,s){e!==t&&Es(t,function(i,o){if(s||(s=new xr),Wt(i))Cs(e,t,o,n,js,r,s);else{var l=r?r(Ss(e,o),i,o+"",e,t,s):void 0;void 0===l&&(l=i),ks(e,o,l)}},rr)}function _s(e,t){return Ns(e,t)}var Os,Ts=(Os=function(e,t,n){js(e,t,n)},Cn(function(e,t){var n=-1,r=t.length,s=r>1?t[r-1]:void 0,i=r>2?t[2]:void 0;for(s=Os.length>3&&"function"==typeof s?(r--,s):void 0,i&&function(e,t,n){if(!Wt(n))return!1;var r=typeof t;return!!("number"==r?_n(n)&&wn(t,n.length):"string"==r&&t in n)&&En(n[t],e)}(t[0],t[1],i)&&(s=r<3?void 0:s,r=1),e=Object(e);++n<r;){var o=t[n];o&&Os(e,o,n,s)}return e})),Ls=(e=>(e[e.TYPE=3]="TYPE",e[e.LEVEL=12]="LEVEL",e[e.ATTRIBUTE=13]="ATTRIBUTE",e[e.BLOT=14]="BLOT",e[e.INLINE=7]="INLINE",e[e.BLOCK=11]="BLOCK",e[e.BLOCK_BLOT=10]="BLOCK_BLOT",e[e.INLINE_BLOT=6]="INLINE_BLOT",e[e.BLOCK_ATTRIBUTE=9]="BLOCK_ATTRIBUTE",e[e.INLINE_ATTRIBUTE=5]="INLINE_ATTRIBUTE",e[e.ANY=15]="ANY",e))(Ls||{});class qs{constructor(e,t,n={}){this.attrName=e,this.keyName=t;const r=Ls.TYPE&Ls.ATTRIBUTE;this.scope=null!=n.scope?n.scope&Ls.LEVEL|r:Ls.ATTRIBUTE,null!=n.whitelist&&(this.whitelist=n.whitelist)}static keys(e){return Array.from(e.attributes).map(e=>e.name)}add(e,t){return!!this.canAdd(e,t)&&(e.setAttribute(this.keyName,t),!0)}canAdd(e,t){return null==this.whitelist||("string"==typeof t?this.whitelist.indexOf(t.replace(/["']/g,""))>-1:this.whitelist.indexOf(t)>-1)}remove(e){e.removeAttribute(this.keyName)}value(e){const t=e.getAttribute(this.keyName);return this.canAdd(e,t)&&t?t:""}}class Is extends Error{constructor(e){super(e="[Parchment] "+e),this.message=e,this.name=this.constructor.name}}const Rs=class e{constructor(){this.attributes={},this.classes={},this.tags={},this.types={}}static find(e,t=!1){if(null==e)return null;if(this.blots.has(e))return this.blots.get(e)||null;if(t){let n=null;try{n=e.parentNode}catch{return null}return this.find(n,t)}return null}create(t,n,r){const s=this.query(n);if(null==s)throw new Is(`Unable to create ${n} blot`);const i=s,o=n instanceof Node||n.nodeType===Node.TEXT_NODE?n:i.create(r),l=new i(t,o,r);return e.blots.set(l.domNode,l),l}find(t,n=!1){return e.find(t,n)}query(e,t=Ls.ANY){let n;return"string"==typeof e?n=this.types[e]||this.attributes[e]:e instanceof Text||e.nodeType===Node.TEXT_NODE?n=this.types.text:"number"==typeof e?e&Ls.LEVEL&Ls.BLOCK?n=this.types.block:e&Ls.LEVEL&Ls.INLINE&&(n=this.types.inline):e instanceof Element&&((e.getAttribute("class")||"").split(/\s+/).some(e=>(n=this.classes[e],!!n)),n=n||this.tags[e.tagName]),null==n?null:"scope"in n&&t&Ls.LEVEL&n.scope&&t&Ls.TYPE&n.scope?n:null}register(...e){return e.map(e=>{const t="blotName"in e,n="attrName"in e;if(!t&&!n)throw new Is("Invalid definition");if(t&&"abstract"===e.blotName)throw new Is("Cannot register abstract class");const r=t?e.blotName:n?e.attrName:void 0;return this.types[r]=e,n?"string"==typeof e.keyName&&(this.attributes[e.keyName]=e):t&&(e.className&&(this.classes[e.className]=e),e.tagName&&(Array.isArray(e.tagName)?e.tagName=e.tagName.map(e=>e.toUpperCase()):e.tagName=e.tagName.toUpperCase(),(Array.isArray(e.tagName)?e.tagName:[e.tagName]).forEach(t=>{(null==this.tags[t]||null==e.className)&&(this.tags[t]=e)}))),e})}};Rs.blots=new WeakMap;let Ms=Rs;function Bs(e,t){return(e.getAttribute("class")||"").split(/\s+/).filter(e=>0===e.indexOf(`${t}-`))}const Ds=class extends qs{static keys(e){return(e.getAttribute("class")||"").split(/\s+/).map(e=>e.split("-").slice(0,-1).join("-"))}add(e,t){return!!this.canAdd(e,t)&&(this.remove(e),e.classList.add(`${this.keyName}-${t}`),!0)}remove(e){Bs(e,this.keyName).forEach(t=>{e.classList.remove(t)}),0===e.classList.length&&e.removeAttribute("class")}value(e){const t=(Bs(e,this.keyName)[0]||"").slice(this.keyName.length+1);return this.canAdd(e,t)?t:""}};function Ps(e){const t=e.split("-"),n=t.slice(1).map(e=>e[0].toUpperCase()+e.slice(1)).join("");return t[0]+n}const Fs=class extends qs{static keys(e){return(e.getAttribute("style")||"").split(";").map(e=>e.split(":")[0].trim())}add(e,t){return!!this.canAdd(e,t)&&(e.style[Ps(this.keyName)]=t,!0)}remove(e){e.style[Ps(this.keyName)]="",e.getAttribute("style")||e.removeAttribute("style")}value(e){const t=e.style[Ps(this.keyName)];return this.canAdd(e,t)?t:""}};const Us=class{constructor(e){this.attributes={},this.domNode=e,this.build()}attribute(e,t){t?e.add(this.domNode,t)&&(null!=e.value(this.domNode)?this.attributes[e.attrName]=e:delete this.attributes[e.attrName]):(e.remove(this.domNode),delete this.attributes[e.attrName])}build(){this.attributes={};const e=Ms.find(this.domNode);if(null==e)return;const t=qs.keys(this.domNode),n=Ds.keys(this.domNode),r=Fs.keys(this.domNode);t.concat(n).concat(r).forEach(t=>{const n=e.scroll.query(t,Ls.ATTRIBUTE);n instanceof qs&&(this.attributes[n.attrName]=n)})}copy(e){Object.keys(this.attributes).forEach(t=>{const n=this.attributes[t].value(this.domNode);e.format(t,n)})}move(e){this.copy(e),Object.keys(this.attributes).forEach(e=>{this.attributes[e].remove(this.domNode)}),this.attributes={}}values(){return Object.keys(this.attributes).reduce((e,t)=>(e[t]=this.attributes[t].value(this.domNode),e),{})}},zs=class{constructor(e,t){this.scroll=e,this.domNode=t,Ms.blots.set(t,this),this.prev=null,this.next=null}static create(e){if(null==this.tagName)throw new Is("Blot definition missing tagName");let t,n;return Array.isArray(this.tagName)?("string"==typeof e?(n=e.toUpperCase(),parseInt(n,10).toString()===n&&(n=parseInt(n,10))):"number"==typeof e&&(n=e),t="number"==typeof n?document.createElement(this.tagName[n-1]):n&&this.tagName.indexOf(n)>-1?document.createElement(n):document.createElement(this.tagName[0])):t=document.createElement(this.tagName),this.className&&t.classList.add(this.className),t}get statics(){return this.constructor}attach(){}clone(){const e=this.domNode.cloneNode(!1);return this.scroll.create(e)}detach(){null!=this.parent&&this.parent.removeChild(this),Ms.blots.delete(this.domNode)}deleteAt(e,t){this.isolate(e,t).remove()}formatAt(e,t,n,r){const s=this.isolate(e,t);if(null!=this.scroll.query(n,Ls.BLOT)&&r)s.wrap(n,r);else if(null!=this.scroll.query(n,Ls.ATTRIBUTE)){const e=this.scroll.create(this.statics.scope);s.wrap(e),e.format(n,r)}}insertAt(e,t,n){const r=null==n?this.scroll.create("text",t):this.scroll.create(t,n),s=this.split(e);this.parent.insertBefore(r,s||void 0)}isolate(e,t){const n=this.split(e);if(null==n)throw new Error("Attempt to isolate at end");return n.split(t),n}length(){return 1}offset(e=this.parent){return null==this.parent||this===e?0:this.parent.children.offset(this)+this.parent.offset(e)}optimize(e){this.statics.requiredContainer&&!(this.parent instanceof this.statics.requiredContainer)&&this.wrap(this.statics.requiredContainer.blotName)}remove(){null!=this.domNode.parentNode&&this.domNode.parentNode.removeChild(this.domNode),this.detach()}replaceWith(e,t){const n="string"==typeof e?this.scroll.create(e,t):e;return null!=this.parent&&(this.parent.insertBefore(n,this.next||void 0),this.remove()),n}split(e,t){return 0===e?this:this.next}update(e,t){}wrap(e,t){const n="string"==typeof e?this.scroll.create(e,t):e;if(null!=this.parent&&this.parent.insertBefore(n,this.next||void 0),"function"!=typeof n.appendChild)throw new Is(`Cannot wrap ${e}`);return n.appendChild(this),n}};zs.blotName="abstract";let $s=zs;const Vs=class extends $s{static value(e){return!0}index(e,t){return this.domNode===e||this.domNode.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_CONTAINED_BY?Math.min(t,1):-1}position(e,t){let n=Array.from(this.parent.domNode.childNodes).indexOf(this.domNode);return e>0&&(n+=1),[this.parent.domNode,n]}value(){return{[this.statics.blotName]:this.statics.value(this.domNode)||!0}}};Vs.scope=Ls.INLINE_BLOT;const Hs=Vs;class Ks{constructor(){this.head=null,this.tail=null,this.length=0}append(...e){if(this.insertBefore(e[0],null),e.length>1){const t=e.slice(1);this.append(...t)}}at(e){const t=this.iterator();let n=t();for(;n&&e>0;)e-=1,n=t();return n}contains(e){const t=this.iterator();let n=t();for(;n;){if(n===e)return!0;n=t()}return!1}indexOf(e){const t=this.iterator();let n=t(),r=0;for(;n;){if(n===e)return r;r+=1,n=t()}return-1}insertBefore(e,t){null!=e&&(this.remove(e),e.next=t,null!=t?(e.prev=t.prev,null!=t.prev&&(t.prev.next=e),t.prev=e,t===this.head&&(this.head=e)):null!=this.tail?(this.tail.next=e,e.prev=this.tail,this.tail=e):(e.prev=null,this.head=this.tail=e),this.length+=1)}offset(e){let t=0,n=this.head;for(;null!=n;){if(n===e)return t;t+=n.length(),n=n.next}return-1}remove(e){this.contains(e)&&(null!=e.prev&&(e.prev.next=e.next),null!=e.next&&(e.next.prev=e.prev),e===this.head&&(this.head=e.next),e===this.tail&&(this.tail=e.prev),this.length-=1)}iterator(e=this.head){return()=>{const t=e;return null!=e&&(e=e.next),t}}find(e,t=!1){const n=this.iterator();let r=n();for(;r;){const s=r.length();if(e<s||t&&e===s&&(null==r.next||0!==r.next.length()))return[r,e];e-=s,r=n()}return[null,0]}forEach(e){const t=this.iterator();let n=t();for(;n;)e(n),n=t()}forEachAt(e,t,n){if(t<=0)return;const[r,s]=this.find(e);let i=e-s;const o=this.iterator(r);let l=o();for(;l&&i<e+t;){const r=l.length();e>i?n(l,e-i,Math.min(t,i+r-e)):n(l,0,Math.min(r,e+t-i)),i+=r,l=o()}}map(e){return this.reduce((t,n)=>(t.push(e(n)),t),[])}reduce(e,t){const n=this.iterator();let r=n();for(;r;)t=e(t,r),r=n();return t}}function Ws(e,t){const n=t.find(e);if(n)return n;try{return t.create(e)}catch{const n=t.create(Ls.INLINE);return Array.from(e.childNodes).forEach(e=>{n.domNode.appendChild(e)}),e.parentNode&&e.parentNode.replaceChild(n.domNode,e),n.attach(),n}}const Gs=class e extends $s{constructor(e,t){super(e,t),this.uiNode=null,this.build()}appendChild(e){this.insertBefore(e)}attach(){super.attach(),this.children.forEach(e=>{e.attach()})}attachUI(t){null!=this.uiNode&&this.uiNode.remove(),this.uiNode=t,e.uiClass&&this.uiNode.classList.add(e.uiClass),this.uiNode.setAttribute("contenteditable","false"),this.domNode.insertBefore(this.uiNode,this.domNode.firstChild)}build(){this.children=new Ks,Array.from(this.domNode.childNodes).filter(e=>e!==this.uiNode).reverse().forEach(e=>{try{const t=Ws(e,this.scroll);this.insertBefore(t,this.children.head||void 0)}catch(t){if(t instanceof Is)return;throw t}})}deleteAt(e,t){if(0===e&&t===this.length())return this.remove();this.children.forEachAt(e,t,(e,t,n)=>{e.deleteAt(t,n)})}descendant(t,n=0){const[r,s]=this.children.find(n);return null==t.blotName&&t(r)||null!=t.blotName&&r instanceof t?[r,s]:r instanceof e?r.descendant(t,s):[null,-1]}descendants(t,n=0,r=Number.MAX_VALUE){let s=[],i=r;return this.children.forEachAt(n,r,(n,r,o)=>{(null==t.blotName&&t(n)||null!=t.blotName&&n instanceof t)&&s.push(n),n instanceof e&&(s=s.concat(n.descendants(t,r,i))),i-=o}),s}detach(){this.children.forEach(e=>{e.detach()}),super.detach()}enforceAllowedChildren(){let t=!1;this.children.forEach(n=>{t||this.statics.allowedChildren.some(e=>n instanceof e)||(n.statics.scope===Ls.BLOCK_BLOT?(null!=n.next&&this.splitAfter(n),null!=n.prev&&this.splitAfter(n.prev),n.parent.unwrap(),t=!0):n instanceof e?n.unwrap():n.remove())})}formatAt(e,t,n,r){this.children.forEachAt(e,t,(e,t,s)=>{e.formatAt(t,s,n,r)})}insertAt(e,t,n){const[r,s]=this.children.find(e);if(r)r.insertAt(s,t,n);else{const e=null==n?this.scroll.create("text",t):this.scroll.create(t,n);this.appendChild(e)}}insertBefore(e,t){null!=e.parent&&e.parent.children.remove(e);let n=null;this.children.insertBefore(e,t||null),e.parent=this,null!=t&&(n=t.domNode),(this.domNode.parentNode!==e.domNode||this.domNode.nextSibling!==n)&&this.domNode.insertBefore(e.domNode,n),e.attach()}length(){return this.children.reduce((e,t)=>e+t.length(),0)}moveChildren(e,t){this.children.forEach(n=>{e.insertBefore(n,t)})}optimize(e){if(super.optimize(e),this.enforceAllowedChildren(),null!=this.uiNode&&this.uiNode!==this.domNode.firstChild&&this.domNode.insertBefore(this.uiNode,this.domNode.firstChild),0===this.children.length)if(null!=this.statics.defaultChild){const e=this.scroll.create(this.statics.defaultChild.blotName);this.appendChild(e)}else this.remove()}path(t,n=!1){const[r,s]=this.children.find(t,n),i=[[this,t]];return r instanceof e?i.concat(r.path(s,n)):(null!=r&&i.push([r,s]),i)}removeChild(e){this.children.remove(e)}replaceWith(t,n){const r="string"==typeof t?this.scroll.create(t,n):t;return r instanceof e&&this.moveChildren(r),super.replaceWith(r)}split(e,t=!1){if(!t){if(0===e)return this;if(e===this.length())return this.next}const n=this.clone();return this.parent&&this.parent.insertBefore(n,this.next||void 0),this.children.forEachAt(e,this.length(),(e,r,s)=>{const i=e.split(r,t);null!=i&&n.appendChild(i)}),n}splitAfter(e){const t=this.clone();for(;null!=e.next;)t.appendChild(e.next);return this.parent&&this.parent.insertBefore(t,this.next||void 0),t}unwrap(){this.parent&&this.moveChildren(this.parent,this.next||void 0),this.remove()}update(e,t){const n=[],r=[];e.forEach(e=>{e.target===this.domNode&&"childList"===e.type&&(n.push(...e.addedNodes),r.push(...e.removedNodes))}),r.forEach(e=>{if(null!=e.parentNode&&"IFRAME"!==e.tagName&&document.body.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_CONTAINED_BY)return;const t=this.scroll.find(e);null!=t&&(null==t.domNode.parentNode||t.domNode.parentNode===this.domNode)&&t.detach()}),n.filter(e=>e.parentNode===this.domNode&&e!==this.uiNode).sort((e,t)=>e===t?0:e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?1:-1).forEach(e=>{let t=null;null!=e.nextSibling&&(t=this.scroll.find(e.nextSibling));const n=Ws(e,this.scroll);(n.next!==t||null==n.next)&&(null!=n.parent&&n.parent.removeChild(this),this.insertBefore(n,t||void 0))}),this.enforceAllowedChildren()}};Gs.uiClass="";const Zs=Gs;const Ys=class e extends Zs{static create(e){return super.create(e)}static formats(t,n){const r=n.query(e.blotName);if(null==r||t.tagName!==r.tagName){if("string"==typeof this.tagName)return!0;if(Array.isArray(this.tagName))return t.tagName.toLowerCase()}}constructor(e,t){super(e,t),this.attributes=new Us(this.domNode)}format(t,n){if(t!==this.statics.blotName||n){const e=this.scroll.query(t,Ls.INLINE);if(null==e)return;e instanceof qs?this.attributes.attribute(e,n):n&&(t!==this.statics.blotName||this.formats()[t]!==n)&&this.replaceWith(t,n)}else this.children.forEach(t=>{t instanceof e||(t=t.wrap(e.blotName,!0)),this.attributes.copy(t)}),this.unwrap()}formats(){const e=this.attributes.values(),t=this.statics.formats(this.domNode,this.scroll);return null!=t&&(e[this.statics.blotName]=t),e}formatAt(e,t,n,r){null!=this.formats()[n]||this.scroll.query(n,Ls.ATTRIBUTE)?this.isolate(e,t).format(n,r):super.formatAt(e,t,n,r)}optimize(t){super.optimize(t);const n=this.formats();if(0===Object.keys(n).length)return this.unwrap();const r=this.next;r instanceof e&&r.prev===this&&function(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}(n,r.formats())&&(r.moveChildren(this),r.remove())}replaceWith(e,t){const n=super.replaceWith(e,t);return this.attributes.copy(n),n}update(e,t){super.update(e,t),e.some(e=>e.target===this.domNode&&"attributes"===e.type)&&this.attributes.build()}wrap(t,n){const r=super.wrap(t,n);return r instanceof e&&this.attributes.move(r),r}};Ys.allowedChildren=[Ys,Hs],Ys.blotName="inline",Ys.scope=Ls.INLINE_BLOT,Ys.tagName="SPAN";const Js=Ys,Xs=class e extends Zs{static create(e){return super.create(e)}static formats(t,n){const r=n.query(e.blotName);if(null==r||t.tagName!==r.tagName){if("string"==typeof this.tagName)return!0;if(Array.isArray(this.tagName))return t.tagName.toLowerCase()}}constructor(e,t){super(e,t),this.attributes=new Us(this.domNode)}format(t,n){const r=this.scroll.query(t,Ls.BLOCK);null!=r&&(r instanceof qs?this.attributes.attribute(r,n):t!==this.statics.blotName||n?n&&(t!==this.statics.blotName||this.formats()[t]!==n)&&this.replaceWith(t,n):this.replaceWith(e.blotName))}formats(){const e=this.attributes.values(),t=this.statics.formats(this.domNode,this.scroll);return null!=t&&(e[this.statics.blotName]=t),e}formatAt(e,t,n,r){null!=this.scroll.query(n,Ls.BLOCK)?this.format(n,r):super.formatAt(e,t,n,r)}insertAt(e,t,n){if(null==n||null!=this.scroll.query(t,Ls.INLINE))super.insertAt(e,t,n);else{const r=this.split(e);if(null==r)throw new Error("Attempt to insertAt after block boundaries");{const e=this.scroll.create(t,n);r.parent.insertBefore(e,r)}}}replaceWith(e,t){const n=super.replaceWith(e,t);return this.attributes.copy(n),n}update(e,t){super.update(e,t),e.some(e=>e.target===this.domNode&&"attributes"===e.type)&&this.attributes.build()}};Xs.blotName="block",Xs.scope=Ls.BLOCK_BLOT,Xs.tagName="P",Xs.allowedChildren=[Js,Xs,Hs];const Qs=Xs,ei=class extends Zs{checkMerge(){return null!==this.next&&this.next.statics.blotName===this.statics.blotName}deleteAt(e,t){super.deleteAt(e,t),this.enforceAllowedChildren()}formatAt(e,t,n,r){super.formatAt(e,t,n,r),this.enforceAllowedChildren()}insertAt(e,t,n){super.insertAt(e,t,n),this.enforceAllowedChildren()}optimize(e){super.optimize(e),this.children.length>0&&null!=this.next&&this.checkMerge()&&(this.next.moveChildren(this),this.next.remove())}};ei.blotName="container",ei.scope=Ls.BLOCK_BLOT;const ti=ei;const ni=class extends Hs{static formats(e,t){}format(e,t){super.formatAt(0,this.length(),e,t)}formatAt(e,t,n,r){0===e&&t===this.length()?this.format(n,r):super.formatAt(e,t,n,r)}formats(){return this.statics.formats(this.domNode,this.scroll)}},ri={attributes:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0},si=class extends Zs{constructor(e,t){super(null,t),this.registry=e,this.scroll=this,this.build(),this.observer=new MutationObserver(e=>{this.update(e)}),this.observer.observe(this.domNode,ri),this.attach()}create(e,t){return this.registry.create(this,e,t)}find(e,t=!1){const n=this.registry.find(e,t);return n?n.scroll===this?n:t?this.find(n.scroll.domNode.parentNode,!0):null:null}query(e,t=Ls.ANY){return this.registry.query(e,t)}register(...e){return this.registry.register(...e)}build(){null!=this.scroll&&super.build()}detach(){super.detach(),this.observer.disconnect()}deleteAt(e,t){this.update(),0===e&&t===this.length()?this.children.forEach(e=>{e.remove()}):super.deleteAt(e,t)}formatAt(e,t,n,r){this.update(),super.formatAt(e,t,n,r)}insertAt(e,t,n){this.update(),super.insertAt(e,t,n)}optimize(e=[],t={}){super.optimize(t);const n=t.mutationsMap||new WeakMap;let r=Array.from(this.observer.takeRecords());for(;r.length>0;)e.push(r.pop());const s=(e,t=!0)=>{null==e||e===this||null!=e.domNode.parentNode&&(n.has(e.domNode)||n.set(e.domNode,[]),t&&s(e.parent))},i=e=>{n.has(e.domNode)&&(e instanceof Zs&&e.children.forEach(i),n.delete(e.domNode),e.optimize(t))};let o=e;for(let l=0;o.length>0;l+=1){if(l>=100)throw new Error("[Parchment] Maximum optimize iterations reached");for(o.forEach(e=>{const t=this.find(e.target,!0);null!=t&&(t.domNode===e.target&&("childList"===e.type?(s(this.find(e.previousSibling,!1)),Array.from(e.addedNodes).forEach(e=>{const t=this.find(e,!1);s(t,!1),t instanceof Zs&&t.children.forEach(e=>{s(e,!1)})})):"attributes"===e.type&&s(t.prev)),s(t))}),this.children.forEach(i),o=Array.from(this.observer.takeRecords()),r=o.slice();r.length>0;)e.push(r.pop())}}update(e,t={}){e=e||this.observer.takeRecords();const n=new WeakMap;e.map(e=>{const t=this.find(e.target,!0);return null==t?null:n.has(t.domNode)?(n.get(t.domNode).push(e),null):(n.set(t.domNode,[e]),t)}).forEach(e=>{null!=e&&e!==this&&n.has(e.domNode)&&e.update(n.get(e.domNode)||[],t)}),t.mutationsMap=n,n.has(this.domNode)&&super.update(n.get(this.domNode),t),this.optimize(e,t)}};si.blotName="scroll",si.defaultChild=Qs,si.allowedChildren=[Qs,ti],si.scope=Ls.BLOCK_BLOT,si.tagName="DIV";const ii=si,oi=class e extends Hs{static create(e){return document.createTextNode(e)}static value(e){return e.data}constructor(e,t){super(e,t),this.text=this.statics.value(this.domNode)}deleteAt(e,t){this.domNode.data=this.text=this.text.slice(0,e)+this.text.slice(e+t)}index(e,t){return this.domNode===e?t:-1}insertAt(e,t,n){null==n?(this.text=this.text.slice(0,e)+t+this.text.slice(e),this.domNode.data=this.text):super.insertAt(e,t,n)}length(){return this.text.length}optimize(t){super.optimize(t),this.text=this.statics.value(this.domNode),0===this.text.length?this.remove():this.next instanceof e&&this.next.prev===this&&(this.insertAt(this.length(),this.next.value()),this.next.remove())}position(e,t=!1){return[this.domNode,e]}split(e,t=!1){if(!t){if(0===e)return this;if(e===this.length())return this.next}const n=this.scroll.create(this.domNode.splitText(e));return this.parent.insertBefore(n,this.next||void 0),this.text=this.statics.value(this.domNode),n}update(e,t){e.some(e=>"characterData"===e.type&&e.target===this.domNode)&&(this.text=this.statics.value(this.domNode))}value(){return this.text}};oi.blotName="text",oi.scope=Ls.INLINE_BLOT;const li=oi,ai=Object.freeze(Object.defineProperty({__proto__:null,Attributor:qs,AttributorStore:Us,BlockBlot:Qs,ClassAttributor:Ds,ContainerBlot:ti,EmbedBlot:ni,InlineBlot:Js,LeafBlot:Hs,ParentBlot:Zs,Registry:Ms,Scope:Ls,ScrollBlot:ii,StyleAttributor:Fs,TextBlot:li},Symbol.toStringTag,{value:"Module"}));var ci,ui,di={exports:{}};function hi(){if(ui)return ci;ui=1;var e=-1;function t(h,f,p,m,v){if(h===f)return h?[[0,h]]:[];if(null!=p){var b=function(e,t,n){var r="number"==typeof n?{index:n,length:0}:n.oldRange,s="number"==typeof n?null:n.newRange,i=e.length,o=t.length;if(0===r.length&&(null===s||0===s.length)){var l=r.index,a=e.slice(0,l),c=e.slice(l),u=s?s.index:null,d=l+o-i;if((null===u||u===d)&&!(d<0||d>o)){var h=t.slice(0,d);if((m=t.slice(d))===c){var f=Math.min(l,d);if((b=a.slice(0,f))===(x=h.slice(0,f)))return g(b,a.slice(f),h.slice(f),c)}}if(null===u||u===l){var p=l,m=(h=t.slice(0,p),t.slice(p));if(h===a){var v=Math.min(i-p,o-p);if((y=c.slice(c.length-v))===(w=m.slice(m.length-v)))return g(a,c.slice(0,c.length-v),m.slice(0,m.length-v),y)}}}if(r.length>0&&s&&0===s.length){var b=e.slice(0,r.index),y=e.slice(r.index+r.length);if(!(o<(f=b.length)+(v=y.length))){var x=t.slice(0,f),w=t.slice(o-v);if(b===x&&y===w)return g(b,e.slice(f,i-v),t.slice(f,o-v),y)}}return null}(h,f,p);if(b)return b}var y=r(h,f),x=h.substring(0,y);y=i(h=h.substring(y),f=f.substring(y));var w=h.substring(h.length-y),N=function(s,o){var l;if(!s)return[[1,o]];if(!o)return[[e,s]];var a=s.length>o.length?s:o,c=s.length>o.length?o:s,u=a.indexOf(c);if(-1!==u)return l=[[1,a.substring(0,u)],[0,c],[1,a.substring(u+c.length)]],s.length>o.length&&(l[0][0]=l[2][0]=e),l;if(1===c.length)return[[e,s],[1,o]];var d=function(e,t){var n=e.length>t.length?e:t,s=e.length>t.length?t:e;if(n.length<4||2*s.length<n.length)return null;function o(e,t,n){for(var s,o,l,a,c=e.substring(n,n+Math.floor(e.length/4)),u=-1,d="";-1!==(u=t.indexOf(c,u+1));){var h=r(e.substring(n),t.substring(u)),f=i(e.substring(0,n),t.substring(0,u));d.length<f+h&&(d=t.substring(u-f,u)+t.substring(u,u+h),s=e.substring(0,n-f),o=e.substring(n+h),l=t.substring(0,u-f),a=t.substring(u+h))}return 2*d.length>=e.length?[s,o,l,a,d]:null}var l,a,c,u,d,h=o(n,s,Math.ceil(n.length/4)),f=o(n,s,Math.ceil(n.length/2));if(!h&&!f)return null;l=f?h&&h[4].length>f[4].length?h:f:h;e.length>t.length?(a=l[0],c=l[1],u=l[2],d=l[3]):(u=l[0],d=l[1],a=l[2],c=l[3]);var p=l[4];return[a,c,u,d,p]}(s,o);if(d){var h=d[0],f=d[1],p=d[2],m=d[3],g=d[4],v=t(h,p),b=t(f,m);return v.concat([[0,g]],b)}return function(t,r){for(var s=t.length,i=r.length,o=Math.ceil((s+i)/2),l=o,a=2*o,c=new Array(a),u=new Array(a),d=0;d<a;d++)c[d]=-1,u[d]=-1;c[l+1]=0,u[l+1]=0;for(var h=s-i,f=h%2!=0,p=0,m=0,g=0,v=0,b=0;b<o;b++){for(var y=-b+p;y<=b-m;y+=2){for(var x=l+y,w=(A=y===-b||y!==b&&c[x-1]<c[x+1]?c[x+1]:c[x-1]+1)-y;A<s&&w<i&&t.charAt(A)===r.charAt(w);)A++,w++;if(c[x]=A,A>s)m+=2;else if(w>i)p+=2;else if(f){if((k=l+h-y)>=0&&k<a&&-1!==u[k])if(A>=(E=s-u[k]))return n(t,r,A,w)}}for(var N=-b+g;N<=b-v;N+=2){for(var E,k=l+N,S=(E=N===-b||N!==b&&u[k-1]<u[k+1]?u[k+1]:u[k-1]+1)-N;E<s&&S<i&&t.charAt(s-E-1)===r.charAt(i-S-1);)E++,S++;if(u[k]=E,E>s)v+=2;else if(S>i)g+=2;else if(!f){if((x=l+h-N)>=0&&x<a&&-1!==c[x]){var A;w=l+(A=c[x])-x;if(A>=(E=s-E))return n(t,r,A,w)}}}}return[[e,t],[1,r]]}(s,o)}(h=h.substring(0,h.length-y),f=f.substring(0,f.length-y));return x&&N.unshift([0,x]),w&&N.push([0,w]),d(N,v),m&&function(t){var n=!1,r=[],h=0,f=null,p=0,m=0,g=0,v=0,b=0;for(;p<t.length;)0==t[p][0]?(r[h++]=p,m=v,g=b,v=0,b=0,f=t[p][1]):(1==t[p][0]?v+=t[p][1].length:b+=t[p][1].length,f&&f.length<=Math.max(m,g)&&f.length<=Math.max(v,b)&&(t.splice(r[h-1],0,[e,f]),t[r[h-1]+1][0]=1,h--,p=--h>0?r[h-1]:-1,m=0,g=0,v=0,b=0,f=null,n=!0)),p++;n&&d(t);(function(e){function t(e,t){if(!e||!t)return 6;var n=e.charAt(e.length-1),r=t.charAt(0),s=n.match(o),i=r.match(o),d=s&&n.match(l),h=i&&r.match(l),f=d&&n.match(a),p=h&&r.match(a),m=f&&e.match(c),g=p&&t.match(u);return m||g?5:f||p?4:s&&!d&&h?3:d||h?2:s||i?1:0}var n=1;for(;n<e.length-1;){if(0==e[n-1][0]&&0==e[n+1][0]){var r=e[n-1][1],s=e[n][1],d=e[n+1][1],h=i(r,s);if(h){var f=s.substring(s.length-h);r=r.substring(0,r.length-h),s=f+s.substring(0,s.length-h),d=f+d}for(var p=r,m=s,g=d,v=t(r,s)+t(s,d);s.charAt(0)===d.charAt(0);){r+=s.charAt(0),s=s.substring(1)+d.charAt(0),d=d.substring(1);var b=t(r,s)+t(s,d);b>=v&&(v=b,p=r,m=s,g=d)}e[n-1][1]!=p&&(p?e[n-1][1]=p:(e.splice(n-1,1),n--),e[n][1]=m,g?e[n+1][1]=g:(e.splice(n+1,1),n--))}n++}})(t),p=1;for(;p<t.length;){if(t[p-1][0]==e&&1==t[p][0]){var y=t[p-1][1],x=t[p][1],w=s(y,x),N=s(x,y);w>=N?(w>=y.length/2||w>=x.length/2)&&(t.splice(p,0,[0,x.substring(0,w)]),t[p-1][1]=y.substring(0,y.length-w),t[p+1][1]=x.substring(w),p++):(N>=y.length/2||N>=x.length/2)&&(t.splice(p,0,[0,y.substring(0,N)]),t[p-1][0]=1,t[p-1][1]=x.substring(0,x.length-N),t[p+1][0]=e,t[p+1][1]=y.substring(N),p++),p++}p++}}(N),N}function n(e,n,r,s){var i=e.substring(0,r),o=n.substring(0,s),l=e.substring(r),a=n.substring(s),c=t(i,o),u=t(l,a);return c.concat(u)}function r(e,t){if(!e||!t||e.charAt(0)!==t.charAt(0))return 0;for(var n=0,r=Math.min(e.length,t.length),s=r,i=0;n<s;)e.substring(i,s)==t.substring(i,s)?i=n=s:r=s,s=Math.floor((r-n)/2+n);return h(e.charCodeAt(s-1))&&s--,s}function s(e,t){var n=e.length,r=t.length;if(0==n||0==r)return 0;n>r?e=e.substring(n-r):n<r&&(t=t.substring(0,n));var s=Math.min(n,r);if(e==t)return s;for(var i=0,o=1;;){var l=e.substring(s-o),a=t.indexOf(l);if(-1==a)return i;o+=a,0!=a&&e.substring(s-o)!=t.substring(0,o)||(i=o,o++)}}function i(e,t){if(!e||!t||e.slice(-1)!==t.slice(-1))return 0;for(var n=0,r=Math.min(e.length,t.length),s=r,i=0;n<s;)e.substring(e.length-s,e.length-i)==t.substring(t.length-s,t.length-i)?i=n=s:r=s,s=Math.floor((r-n)/2+n);return f(e.charCodeAt(e.length-s))&&s--,s}var o=/[^a-zA-Z0-9]/,l=/\s/,a=/[\r\n]/,c=/\n\r?\n$/,u=/^\r?\n\r?\n/;function d(t,n){t.push([0,""]);for(var s,o=0,l=0,a=0,c="",u="";o<t.length;)if(o<t.length-1&&!t[o][1])t.splice(o,1);else switch(t[o][0]){case 1:a++,u+=t[o][1],o++;break;case e:l++,c+=t[o][1],o++;break;case 0:var h=o-a-l-1;if(n){if(h>=0&&m(t[h][1])){var f=t[h][1].slice(-1);if(t[h][1]=t[h][1].slice(0,-1),c=f+c,u=f+u,!t[h][1]){t.splice(h,1),o--;var g=h-1;t[g]&&1===t[g][0]&&(a++,u=t[g][1]+u,g--),t[g]&&t[g][0]===e&&(l++,c=t[g][1]+c,g--),h=g}}if(p(t[o][1])){f=t[o][1].charAt(0);t[o][1]=t[o][1].slice(1),c+=f,u+=f}}if(o<t.length-1&&!t[o][1]){t.splice(o,1);break}if(c.length>0||u.length>0){c.length>0&&u.length>0&&(0!==(s=r(u,c))&&(h>=0?t[h][1]+=u.substring(0,s):(t.splice(0,0,[0,u.substring(0,s)]),o++),u=u.substring(s),c=c.substring(s)),0!==(s=i(u,c))&&(t[o][1]=u.substring(u.length-s)+t[o][1],u=u.substring(0,u.length-s),c=c.substring(0,c.length-s)));var v=a+l;0===c.length&&0===u.length?(t.splice(o-v,v),o-=v):0===c.length?(t.splice(o-v,v,[1,u]),o=o-v+1):0===u.length?(t.splice(o-v,v,[e,c]),o=o-v+1):(t.splice(o-v,v,[e,c],[1,u]),o=o-v+2)}0!==o&&0===t[o-1][0]?(t[o-1][1]+=t[o][1],t.splice(o,1)):o++,a=0,l=0,c="",u=""}""===t[t.length-1][1]&&t.pop();var b=!1;for(o=1;o<t.length-1;)0===t[o-1][0]&&0===t[o+1][0]&&(t[o][1].substring(t[o][1].length-t[o-1][1].length)===t[o-1][1]?(t[o][1]=t[o-1][1]+t[o][1].substring(0,t[o][1].length-t[o-1][1].length),t[o+1][1]=t[o-1][1]+t[o+1][1],t.splice(o-1,1),b=!0):t[o][1].substring(0,t[o+1][1].length)==t[o+1][1]&&(t[o-1][1]+=t[o+1][1],t[o][1]=t[o][1].substring(t[o+1][1].length)+t[o+1][1],t.splice(o+1,1),b=!0)),o++;b&&d(t,n)}function h(e){return e>=55296&&e<=56319}function f(e){return e>=56320&&e<=57343}function p(e){return f(e.charCodeAt(0))}function m(e){return h(e.charCodeAt(e.length-1))}function g(t,n,r,s){return m(t)||p(s)?null:function(e){for(var t=[],n=0;n<e.length;n++)e[n][1].length>0&&t.push(e[n]);return t}([[0,t],[e,n],[1,r],[0,s]])}function v(e,n,r,s){return t(e,n,r,s,!0)}return v.INSERT=1,v.DELETE=e,v.EQUAL=0,ci=v}var fi,pi={exports:{}};function mi(){return fi||(fi=1,function(e,t){var n="__lodash_hash_undefined__",r=9007199254740991,s="[object Arguments]",i="[object Boolean]",o="[object Date]",l="[object Function]",a="[object GeneratorFunction]",c="[object Map]",u="[object Number]",d="[object Object]",h="[object Promise]",f="[object RegExp]",p="[object Set]",m="[object String]",g="[object Symbol]",v="[object WeakMap]",b="[object ArrayBuffer]",y="[object DataView]",x="[object Float32Array]",w="[object Float64Array]",N="[object Int8Array]",E="[object Int16Array]",k="[object Int32Array]",S="[object Uint8Array]",A="[object Uint8ClampedArray]",C="[object Uint16Array]",j="[object Uint32Array]",_=/\w*$/,O=/^\[object .+?Constructor\]$/,T=/^(?:0|[1-9]\d*)$/,L={};L[s]=L["[object Array]"]=L[b]=L[y]=L[i]=L[o]=L[x]=L[w]=L[N]=L[E]=L[k]=L[c]=L[u]=L[d]=L[f]=L[p]=L[m]=L[g]=L[S]=L[A]=L[C]=L[j]=!0,L["[object Error]"]=L[l]=L[v]=!1;var q="object"==typeof W&&W&&W.Object===Object&&W,I="object"==typeof self&&self&&self.Object===Object&&self,R=q||I||Function("return this")(),M=t&&!t.nodeType&&t,B=M&&e&&!e.nodeType&&e,D=B&&B.exports===M;function P(e,t){return e.set(t[0],t[1]),e}function F(e,t){return e.add(t),e}function U(e,t,n,r){for(var s=-1,i=e?e.length:0;++s<i;)n=t(n,e[s],s,e);return n}function z(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(n){}return t}function $(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n}function V(e,t){return function(n){return e(t(n))}}function H(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}var K=Array.prototype,G=Function.prototype,Z=Object.prototype,Y=R["__core-js_shared__"],J=function(){var e=/[^.]+$/.exec(Y&&Y.keys&&Y.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),X=G.toString,Q=Z.hasOwnProperty,ee=Z.toString,te=RegExp("^"+X.call(Q).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ne=D?R.Buffer:void 0,re=R.Symbol,se=R.Uint8Array,ie=V(Object.getPrototypeOf,Object),oe=Object.create,le=Z.propertyIsEnumerable,ae=K.splice,ce=Object.getOwnPropertySymbols,ue=ne?ne.isBuffer:void 0,de=V(Object.keys,Object),he=Be(R,"DataView"),fe=Be(R,"Map"),pe=Be(R,"Promise"),me=Be(R,"Set"),ge=Be(R,"WeakMap"),ve=Be(Object,"create"),be=ze(he),ye=ze(fe),xe=ze(pe),we=ze(me),Ne=ze(ge),Ee=re?re.prototype:void 0,ke=Ee?Ee.valueOf:void 0;function Se(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Ae(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Ce(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function je(e){this.__data__=new Ae(e)}function _e(e,t){var n=Ve(e)||function(e){return function(e){return function(e){return!!e&&"object"==typeof e}(e)&&He(e)}(e)&&Q.call(e,"callee")&&(!le.call(e,"callee")||ee.call(e)==s)}(e)?function(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}(e.length,String):[],r=n.length,i=!!r;for(var o in e)!Q.call(e,o)||i&&("length"==o||Fe(o,r))||n.push(o);return n}function Oe(e,t,n){var r=e[t];Q.call(e,t)&&$e(r,n)&&(void 0!==n||t in e)||(e[t]=n)}function Te(e,t){for(var n=e.length;n--;)if($e(e[n][0],t))return n;return-1}function Le(e,t,n,r,h,v,O){var T;if(r&&(T=v?r(e,h,v,O):r(e)),void 0!==T)return T;if(!Ge(e))return e;var q=Ve(e);if(q){if(T=function(e){var t=e.length,n=e.constructor(t);t&&"string"==typeof e[0]&&Q.call(e,"index")&&(n.index=e.index,n.input=e.input);return n}(e),!t)return function(e,t){var n=-1,r=e.length;t||(t=Array(r));for(;++n<r;)t[n]=e[n];return t}(e,T)}else{var I=Pe(e),R=I==l||I==a;if(Ke(e))return function(e,t){if(t)return e.slice();var n=new e.constructor(e.length);return e.copy(n),n}(e,t);if(I==d||I==s||R&&!v){if(z(e))return v?e:{};if(T=function(e){return"function"!=typeof e.constructor||Ue(e)?{}:(t=ie(e),Ge(t)?oe(t):{});var t}(R?{}:e),!t)return function(e,t){return Re(e,De(e),t)}(e,function(e,t){return e&&Re(t,Ze(t),e)}(T,e))}else{if(!L[I])return v?e:{};T=function(e,t,n,r){var s=e.constructor;switch(t){case b:return Ie(e);case i:case o:return new s(+e);case y:return function(e,t){var n=t?Ie(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,r);case x:case w:case N:case E:case k:case S:case A:case C:case j:return function(e,t){var n=t?Ie(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}(e,r);case c:return function(e,t,n){var r=t?n($(e),!0):$(e);return U(r,P,new e.constructor)}(e,r,n);case u:case m:return new s(e);case f:return function(e){var t=new e.constructor(e.source,_.exec(e));return t.lastIndex=e.lastIndex,t}(e);case p:return function(e,t,n){var r=t?n(H(e),!0):H(e);return U(r,F,new e.constructor)}(e,r,n);case g:return l=e,ke?Object(ke.call(l)):{}}var l}(e,I,Le,t)}}O||(O=new je);var M=O.get(e);if(M)return M;if(O.set(e,T),!q)var B=n?function(e){return function(e,t,n){var r=t(e);return Ve(e)?r:function(e,t){for(var n=-1,r=t.length,s=e.length;++n<r;)e[s+n]=t[n];return e}(r,n(e))}(e,Ze,De)}(e):Ze(e);return function(e,t){for(var n=-1,r=e?e.length:0;++n<r&&!1!==t(e[n],n,e););}(B||e,function(s,i){B&&(s=e[i=s]),Oe(T,i,Le(s,t,n,r,i,e,O))}),T}function qe(e){return!(!Ge(e)||function(e){return!!J&&J in e}(e))&&(We(e)||z(e)?te:O).test(ze(e))}function Ie(e){var t=new e.constructor(e.byteLength);return new se(t).set(new se(e)),t}function Re(e,t,n,r){n||(n={});for(var s=-1,i=t.length;++s<i;){var o=t[s];Oe(n,o,e[o])}return n}function Me(e,t){var n,r,s=e.__data__;return("string"==(r=typeof(n=t))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?s["string"==typeof t?"string":"hash"]:s.map}function Be(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return qe(n)?n:void 0}Se.prototype.clear=function(){this.__data__=ve?ve(null):{}},Se.prototype.delete=function(e){return this.has(e)&&delete this.__data__[e]},Se.prototype.get=function(e){var t=this.__data__;if(ve){var r=t[e];return r===n?void 0:r}return Q.call(t,e)?t[e]:void 0},Se.prototype.has=function(e){var t=this.__data__;return ve?void 0!==t[e]:Q.call(t,e)},Se.prototype.set=function(e,t){return this.__data__[e]=ve&&void 0===t?n:t,this},Ae.prototype.clear=function(){this.__data__=[]},Ae.prototype.delete=function(e){var t=this.__data__,n=Te(t,e);return!(n<0)&&(n==t.length-1?t.pop():ae.call(t,n,1),!0)},Ae.prototype.get=function(e){var t=this.__data__,n=Te(t,e);return n<0?void 0:t[n][1]},Ae.prototype.has=function(e){return Te(this.__data__,e)>-1},Ae.prototype.set=function(e,t){var n=this.__data__,r=Te(n,e);return r<0?n.push([e,t]):n[r][1]=t,this},Ce.prototype.clear=function(){this.__data__={hash:new Se,map:new(fe||Ae),string:new Se}},Ce.prototype.delete=function(e){return Me(this,e).delete(e)},Ce.prototype.get=function(e){return Me(this,e).get(e)},Ce.prototype.has=function(e){return Me(this,e).has(e)},Ce.prototype.set=function(e,t){return Me(this,e).set(e,t),this},je.prototype.clear=function(){this.__data__=new Ae},je.prototype.delete=function(e){return this.__data__.delete(e)},je.prototype.get=function(e){return this.__data__.get(e)},je.prototype.has=function(e){return this.__data__.has(e)},je.prototype.set=function(e,t){var n=this.__data__;if(n instanceof Ae){var r=n.__data__;if(!fe||r.length<199)return r.push([e,t]),this;n=this.__data__=new Ce(r)}return n.set(e,t),this};var De=ce?V(ce,Object):function(){return[]},Pe=function(e){return ee.call(e)};function Fe(e,t){return!!(t=null==t?r:t)&&("number"==typeof e||T.test(e))&&e>-1&&e%1==0&&e<t}function Ue(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Z)}function ze(e){if(null!=e){try{return X.call(e)}catch(t){}try{return e+""}catch(t){}}return""}function $e(e,t){return e===t||e!=e&&t!=t}(he&&Pe(new he(new ArrayBuffer(1)))!=y||fe&&Pe(new fe)!=c||pe&&Pe(pe.resolve())!=h||me&&Pe(new me)!=p||ge&&Pe(new ge)!=v)&&(Pe=function(e){var t=ee.call(e),n=t==d?e.constructor:void 0,r=n?ze(n):void 0;if(r)switch(r){case be:return y;case ye:return c;case xe:return h;case we:return p;case Ne:return v}return t});var Ve=Array.isArray;function He(e){return null!=e&&function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=r}(e.length)&&!We(e)}var Ke=ue||function(){return!1};function We(e){var t=Ge(e)?ee.call(e):"";return t==l||t==a}function Ge(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function Ze(e){return He(e)?_e(e):function(e){if(!Ue(e))return de(e);var t=[];for(var n in Object(e))Q.call(e,n)&&"constructor"!=n&&t.push(n);return t}(e)}e.exports=function(e){return Le(e,!0,!0)}}(pi,pi.exports)),pi.exports}var gi,vi={exports:{}};function bi(){return gi||(gi=1,function(e,t){var n="__lodash_hash_undefined__",r=9007199254740991,s="[object Arguments]",i="[object Array]",o="[object Boolean]",l="[object Date]",a="[object Error]",c="[object Function]",u="[object Map]",d="[object Number]",h="[object Object]",f="[object Promise]",p="[object RegExp]",m="[object Set]",g="[object String]",v="[object Symbol]",b="[object WeakMap]",y="[object ArrayBuffer]",x="[object DataView]",w=/^\[object .+?Constructor\]$/,N=/^(?:0|[1-9]\d*)$/,E={};E["[object Float32Array]"]=E["[object Float64Array]"]=E["[object Int8Array]"]=E["[object Int16Array]"]=E["[object Int32Array]"]=E["[object Uint8Array]"]=E["[object Uint8ClampedArray]"]=E["[object Uint16Array]"]=E["[object Uint32Array]"]=!0,E[s]=E[i]=E[y]=E[o]=E[x]=E[l]=E[a]=E[c]=E[u]=E[d]=E[h]=E[p]=E[m]=E[g]=E[b]=!1;var k="object"==typeof W&&W&&W.Object===Object&&W,S="object"==typeof self&&self&&self.Object===Object&&self,A=k||S||Function("return this")(),C=t&&!t.nodeType&&t,j=C&&e&&!e.nodeType&&e,_=j&&j.exports===C,O=_&&k.process,T=function(){try{return O&&O.binding&&O.binding("util")}catch(e){}}(),L=T&&T.isTypedArray;function q(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}function I(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n}function R(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}var M=Array.prototype,B=Function.prototype,D=Object.prototype,P=A["__core-js_shared__"],F=B.toString,U=D.hasOwnProperty,z=function(){var e=/[^.]+$/.exec(P&&P.keys&&P.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),$=D.toString,V=RegExp("^"+F.call(U).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),H=_?A.Buffer:void 0,K=A.Symbol,G=A.Uint8Array,Z=D.propertyIsEnumerable,Y=M.splice,J=K?K.toStringTag:void 0,X=Object.getOwnPropertySymbols,Q=H?H.isBuffer:void 0,ee=function(e,t){return function(n){return e(t(n))}}(Object.keys,Object),te=_e(A,"DataView"),ne=_e(A,"Map"),re=_e(A,"Promise"),se=_e(A,"Set"),ie=_e(A,"WeakMap"),oe=_e(Object,"create"),le=qe(te),ae=qe(ne),ce=qe(re),ue=qe(se),de=qe(ie),he=K?K.prototype:void 0,fe=he?he.valueOf:void 0;function pe(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function me(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function ge(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function ve(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new ge;++t<n;)this.add(e[t])}function be(e){var t=this.__data__=new me(e);this.size=t.size}function ye(e,t){var n=Me(e),r=!n&&Re(e),s=!n&&!r&&Be(e),i=!n&&!r&&!s&&ze(e),o=n||r||s||i,l=o?function(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}(e.length,String):[],a=l.length;for(var c in e)!U.call(e,c)||o&&("length"==c||s&&("offset"==c||"parent"==c)||i&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||Le(c,a))||l.push(c);return l}function xe(e,t){for(var n=e.length;n--;)if(Ie(e[n][0],t))return n;return-1}function we(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":J&&J in Object(e)?function(e){var t=U.call(e,J),n=e[J];try{e[J]=void 0;var r=!0}catch(i){}var s=$.call(e);r&&(t?e[J]=n:delete e[J]);return s}(e):function(e){return $.call(e)}(e)}function Ne(e){return Ue(e)&&we(e)==s}function Ee(e,t,n,r,c){return e===t||(null==e||null==t||!Ue(e)&&!Ue(t)?e!=e&&t!=t:function(e,t,n,r,c,f){var b=Me(e),w=Me(t),N=b?i:Te(e),E=w?i:Te(t),k=(N=N==s?h:N)==h,S=(E=E==s?h:E)==h,A=N==E;if(A&&Be(e)){if(!Be(t))return!1;b=!0,k=!1}if(A&&!k)return f||(f=new be),b||ze(e)?Ae(e,t,n,r,c,f):function(e,t,n,r,s,i,c){switch(n){case x:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case y:return!(e.byteLength!=t.byteLength||!i(new G(e),new G(t)));case o:case l:case d:return Ie(+e,+t);case a:return e.name==t.name&&e.message==t.message;case p:case g:return e==t+"";case u:var h=I;case m:var f=1&r;if(h||(h=R),e.size!=t.size&&!f)return!1;var b=c.get(e);if(b)return b==t;r|=2,c.set(e,t);var w=Ae(h(e),h(t),r,s,i,c);return c.delete(e),w;case v:if(fe)return fe.call(e)==fe.call(t)}return!1}(e,t,N,n,r,c,f);if(!(1&n)){var C=k&&U.call(e,"__wrapped__"),j=S&&U.call(t,"__wrapped__");if(C||j){var _=C?e.value():e,O=j?t.value():t;return f||(f=new be),c(_,O,n,r,f)}}if(!A)return!1;return f||(f=new be),function(e,t,n,r,s,i){var o=1&n,l=Ce(e),a=l.length,c=Ce(t),u=c.length;if(a!=u&&!o)return!1;var d=a;for(;d--;){var h=l[d];if(!(o?h in t:U.call(t,h)))return!1}var f=i.get(e);if(f&&i.get(t))return f==t;var p=!0;i.set(e,t),i.set(t,e);var m=o;for(;++d<a;){var g=e[h=l[d]],v=t[h];if(r)var b=o?r(v,g,h,t,e,i):r(g,v,h,e,t,i);if(!(void 0===b?g===v||s(g,v,n,r,i):b)){p=!1;break}m||(m="constructor"==h)}if(p&&!m){var y=e.constructor,x=t.constructor;y==x||!("constructor"in e)||!("constructor"in t)||"function"==typeof y&&y instanceof y&&"function"==typeof x&&x instanceof x||(p=!1)}return i.delete(e),i.delete(t),p}(e,t,n,r,c,f)}(e,t,n,r,Ee,c))}function ke(e){return!(!Fe(e)||function(e){return!!z&&z in e}(e))&&(De(e)?V:w).test(qe(e))}function Se(e){if(n=(t=e)&&t.constructor,r="function"==typeof n&&n.prototype||D,t!==r)return ee(e);var t,n,r,s=[];for(var i in Object(e))U.call(e,i)&&"constructor"!=i&&s.push(i);return s}function Ae(e,t,n,r,s,i){var o=1&n,l=e.length,a=t.length;if(l!=a&&!(o&&a>l))return!1;var c=i.get(e);if(c&&i.get(t))return c==t;var u=-1,d=!0,h=2&n?new ve:void 0;for(i.set(e,t),i.set(t,e);++u<l;){var f=e[u],p=t[u];if(r)var m=o?r(p,f,u,t,e,i):r(f,p,u,e,t,i);if(void 0!==m){if(m)continue;d=!1;break}if(h){if(!q(t,function(e,t){if(o=t,!h.has(o)&&(f===e||s(f,e,n,r,i)))return h.push(t);var o})){d=!1;break}}else if(f!==p&&!s(f,p,n,r,i)){d=!1;break}}return i.delete(e),i.delete(t),d}function Ce(e){return function(e,t,n){var r=t(e);return Me(e)?r:function(e,t){for(var n=-1,r=t.length,s=e.length;++n<r;)e[s+n]=t[n];return e}(r,n(e))}(e,$e,Oe)}function je(e,t){var n,r,s=e.__data__;return("string"==(r=typeof(n=t))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?s["string"==typeof t?"string":"hash"]:s.map}function _e(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return ke(n)?n:void 0}pe.prototype.clear=function(){this.__data__=oe?oe(null):{},this.size=0},pe.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},pe.prototype.get=function(e){var t=this.__data__;if(oe){var r=t[e];return r===n?void 0:r}return U.call(t,e)?t[e]:void 0},pe.prototype.has=function(e){var t=this.__data__;return oe?void 0!==t[e]:U.call(t,e)},pe.prototype.set=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=oe&&void 0===t?n:t,this},me.prototype.clear=function(){this.__data__=[],this.size=0},me.prototype.delete=function(e){var t=this.__data__,n=xe(t,e);return!(n<0)&&(n==t.length-1?t.pop():Y.call(t,n,1),--this.size,!0)},me.prototype.get=function(e){var t=this.__data__,n=xe(t,e);return n<0?void 0:t[n][1]},me.prototype.has=function(e){return xe(this.__data__,e)>-1},me.prototype.set=function(e,t){var n=this.__data__,r=xe(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},ge.prototype.clear=function(){this.size=0,this.__data__={hash:new pe,map:new(ne||me),string:new pe}},ge.prototype.delete=function(e){var t=je(this,e).delete(e);return this.size-=t?1:0,t},ge.prototype.get=function(e){return je(this,e).get(e)},ge.prototype.has=function(e){return je(this,e).has(e)},ge.prototype.set=function(e,t){var n=je(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},ve.prototype.add=ve.prototype.push=function(e){return this.__data__.set(e,n),this},ve.prototype.has=function(e){return this.__data__.has(e)},be.prototype.clear=function(){this.__data__=new me,this.size=0},be.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},be.prototype.get=function(e){return this.__data__.get(e)},be.prototype.has=function(e){return this.__data__.has(e)},be.prototype.set=function(e,t){var n=this.__data__;if(n instanceof me){var r=n.__data__;if(!ne||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new ge(r)}return n.set(e,t),this.size=n.size,this};var Oe=X?function(e){return null==e?[]:(e=Object(e),function(e,t){for(var n=-1,r=null==e?0:e.length,s=0,i=[];++n<r;){var o=e[n];t(o,n,e)&&(i[s++]=o)}return i}(X(e),function(t){return Z.call(e,t)}))}:function(){return[]},Te=we;function Le(e,t){return!!(t=null==t?r:t)&&("number"==typeof e||N.test(e))&&e>-1&&e%1==0&&e<t}function qe(e){if(null!=e){try{return F.call(e)}catch(t){}try{return e+""}catch(t){}}return""}function Ie(e,t){return e===t||e!=e&&t!=t}(te&&Te(new te(new ArrayBuffer(1)))!=x||ne&&Te(new ne)!=u||re&&Te(re.resolve())!=f||se&&Te(new se)!=m||ie&&Te(new ie)!=b)&&(Te=function(e){var t=we(e),n=t==h?e.constructor:void 0,r=n?qe(n):"";if(r)switch(r){case le:return x;case ae:return u;case ce:return f;case ue:return m;case de:return b}return t});var Re=Ne(function(){return arguments}())?Ne:function(e){return Ue(e)&&U.call(e,"callee")&&!Z.call(e,"callee")},Me=Array.isArray;var Be=Q||function(){return!1};function De(e){if(!Fe(e))return!1;var t=we(e);return t==c||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Pe(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=r}function Fe(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function Ue(e){return null!=e&&"object"==typeof e}var ze=L?function(e){return function(t){return e(t)}}(L):function(e){return Ue(e)&&Pe(e.length)&&!!E[we(e)]};function $e(e){return null!=(t=e)&&Pe(t.length)&&!De(t)?ye(e):Se(e);var t}e.exports=function(e,t){return Ee(e,t)}}(vi,vi.exports)),vi.exports}var yi,xi={};var wi,Ni={};function Ei(){return wi||(wi=1,Object.defineProperty(Ni,"__esModule",{value:!0}),(e||(e={})).length=function(e){return"number"==typeof e.delete?e.delete:"number"==typeof e.retain?e.retain:"object"==typeof e.retain&&null!==e.retain?1:"string"==typeof e.insert?e.insert.length:1},Ni.default=e),Ni;var e}var ki,Si,Ai={};var Ci=(Si||(Si=1,function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.AttributeMap=t.OpIterator=t.Op=void 0;const n=hi(),r=mi(),s=bi(),i=function(){if(yi)return xi;yi=1,Object.defineProperty(xi,"__esModule",{value:!0});const e=mi(),t=bi();var n,r;return(r=n||(n={})).compose=function(t={},n={},r=!1){"object"!=typeof t&&(t={}),"object"!=typeof n&&(n={});let s=e(n);r||(s=Object.keys(s).reduce((e,t)=>(null!=s[t]&&(e[t]=s[t]),e),{}));for(const e in t)void 0!==t[e]&&void 0===n[e]&&(s[e]=t[e]);return Object.keys(s).length>0?s:void 0},r.diff=function(e={},n={}){"object"!=typeof e&&(e={}),"object"!=typeof n&&(n={});const r=Object.keys(e).concat(Object.keys(n)).reduce((r,s)=>(t(e[s],n[s])||(r[s]=void 0===n[s]?null:n[s]),r),{});return Object.keys(r).length>0?r:void 0},r.invert=function(e={},t={}){e=e||{};const n=Object.keys(t).reduce((n,r)=>(t[r]!==e[r]&&void 0!==e[r]&&(n[r]=t[r]),n),{});return Object.keys(e).reduce((n,r)=>(e[r]!==t[r]&&void 0===t[r]&&(n[r]=null),n),n)},r.transform=function(e,t,n=!1){if("object"!=typeof e)return t;if("object"!=typeof t)return;if(!n)return t;const r=Object.keys(t).reduce((n,r)=>(void 0===e[r]&&(n[r]=t[r]),n),{});return Object.keys(r).length>0?r:void 0},xi.default=n,xi}();t.AttributeMap=i.default;const o=Ei();t.Op=o.default;const l=function(){if(ki)return Ai;ki=1,Object.defineProperty(Ai,"__esModule",{value:!0});const e=Ei();return Ai.default=class{constructor(e){this.ops=e,this.index=0,this.offset=0}hasNext(){return this.peekLength()<1/0}next(t){t||(t=1/0);const n=this.ops[this.index];if(n){const r=this.offset,s=e.default.length(n);if(t>=s-r?(t=s-r,this.index+=1,this.offset=0):this.offset+=t,"number"==typeof n.delete)return{delete:t};{const e={};return n.attributes&&(e.attributes=n.attributes),"number"==typeof n.retain?e.retain=t:"object"==typeof n.retain&&null!==n.retain?e.retain=n.retain:"string"==typeof n.insert?e.insert=n.insert.substr(r,t):e.insert=n.insert,e}}return{retain:1/0}}peek(){return this.ops[this.index]}peekLength(){return this.ops[this.index]?e.default.length(this.ops[this.index])-this.offset:1/0}peekType(){const e=this.ops[this.index];return e?"number"==typeof e.delete?"delete":"number"==typeof e.retain||"object"==typeof e.retain&&null!==e.retain?"retain":"insert":"retain"}rest(){if(this.hasNext()){if(0===this.offset)return this.ops.slice(this.index);{const e=this.offset,t=this.index,n=this.next(),r=this.ops.slice(this.index);return this.offset=e,this.index=t,[n].concat(r)}}return[]}},Ai}();t.OpIterator=l.default;const a=String.fromCharCode(0),c=(e,t)=>{if("object"!=typeof e||null===e)throw new Error("cannot retain a "+typeof e);if("object"!=typeof t||null===t)throw new Error("cannot retain a "+typeof t);const n=Object.keys(e)[0];if(!n||n!==Object.keys(t)[0])throw new Error(`embed types not matched: ${n} != ${Object.keys(t)[0]}`);return[n,e[n],t[n]]};class u{constructor(e){Array.isArray(e)?this.ops=e:null!=e&&Array.isArray(e.ops)?this.ops=e.ops:this.ops=[]}static registerEmbed(e,t){this.handlers[e]=t}static unregisterEmbed(e){delete this.handlers[e]}static getHandler(e){const t=this.handlers[e];if(!t)throw new Error(`no handlers for embed type "${e}"`);return t}insert(e,t){const n={};return"string"==typeof e&&0===e.length?this:(n.insert=e,null!=t&&"object"==typeof t&&Object.keys(t).length>0&&(n.attributes=t),this.push(n))}delete(e){return e<=0?this:this.push({delete:e})}retain(e,t){if("number"==typeof e&&e<=0)return this;const n={retain:e};return null!=t&&"object"==typeof t&&Object.keys(t).length>0&&(n.attributes=t),this.push(n)}push(e){let t=this.ops.length,n=this.ops[t-1];if(e=r(e),"object"==typeof n){if("number"==typeof e.delete&&"number"==typeof n.delete)return this.ops[t-1]={delete:n.delete+e.delete},this;if("number"==typeof n.delete&&null!=e.insert&&(t-=1,n=this.ops[t-1],"object"!=typeof n))return this.ops.unshift(e),this;if(s(e.attributes,n.attributes)){if("string"==typeof e.insert&&"string"==typeof n.insert)return this.ops[t-1]={insert:n.insert+e.insert},"object"==typeof e.attributes&&(this.ops[t-1].attributes=e.attributes),this;if("number"==typeof e.retain&&"number"==typeof n.retain)return this.ops[t-1]={retain:n.retain+e.retain},"object"==typeof e.attributes&&(this.ops[t-1].attributes=e.attributes),this}}return t===this.ops.length?this.ops.push(e):this.ops.splice(t,0,e),this}chop(){const e=this.ops[this.ops.length-1];return e&&"number"==typeof e.retain&&!e.attributes&&this.ops.pop(),this}filter(e){return this.ops.filter(e)}forEach(e){this.ops.forEach(e)}map(e){return this.ops.map(e)}partition(e){const t=[],n=[];return this.forEach(r=>{(e(r)?t:n).push(r)}),[t,n]}reduce(e,t){return this.ops.reduce(e,t)}changeLength(){return this.reduce((e,t)=>t.insert?e+o.default.length(t):t.delete?e-t.delete:e,0)}length(){return this.reduce((e,t)=>e+o.default.length(t),0)}slice(e=0,t=1/0){const n=[],r=new l.default(this.ops);let s=0;for(;s<t&&r.hasNext();){let i;s<e?i=r.next(e-s):(i=r.next(t-s),n.push(i)),s+=o.default.length(i)}return new u(n)}compose(e){const t=new l.default(this.ops),n=new l.default(e.ops),r=[],o=n.peek();if(null!=o&&"number"==typeof o.retain&&null==o.attributes){let e=o.retain;for(;"insert"===t.peekType()&&t.peekLength()<=e;)e-=t.peekLength(),r.push(t.next());o.retain-e>0&&n.next(o.retain-e)}const a=new u(r);for(;t.hasNext()||n.hasNext();)if("insert"===n.peekType())a.push(n.next());else if("delete"===t.peekType())a.push(t.next());else{const e=Math.min(t.peekLength(),n.peekLength()),r=t.next(e),o=n.next(e);if(o.retain){const l={};if("number"==typeof r.retain)l.retain="number"==typeof o.retain?e:o.retain;else if("number"==typeof o.retain)null==r.retain?l.insert=r.insert:l.retain=r.retain;else{const e=null==r.retain?"insert":"retain",[t,n,s]=c(r[e],o.retain),i=u.getHandler(t);l[e]={[t]:i.compose(n,s,"retain"===e)}}const d=i.default.compose(r.attributes,o.attributes,"number"==typeof r.retain);if(d&&(l.attributes=d),a.push(l),!n.hasNext()&&s(a.ops[a.ops.length-1],l)){const e=new u(t.rest());return a.concat(e).chop()}}else"number"==typeof o.delete&&("number"==typeof r.retain||"object"==typeof r.retain&&null!==r.retain)&&a.push(o)}return a.chop()}concat(e){const t=new u(this.ops.slice());return e.ops.length>0&&(t.push(e.ops[0]),t.ops=t.ops.concat(e.ops.slice(1))),t}diff(e,t){if(this.ops===e.ops)return new u;const r=[this,e].map(t=>t.map(n=>{if(null!=n.insert)return"string"==typeof n.insert?n.insert:a;throw new Error("diff() called "+(t===e?"on":"with")+" non-document")}).join("")),o=new u,c=n(r[0],r[1],t,!0),d=new l.default(this.ops),h=new l.default(e.ops);return c.forEach(e=>{let t=e[1].length;for(;t>0;){let r=0;switch(e[0]){case n.INSERT:r=Math.min(h.peekLength(),t),o.push(h.next(r));break;case n.DELETE:r=Math.min(t,d.peekLength()),d.next(r),o.delete(r);break;case n.EQUAL:r=Math.min(d.peekLength(),h.peekLength(),t);const e=d.next(r),l=h.next(r);s(e.insert,l.insert)?o.retain(r,i.default.diff(e.attributes,l.attributes)):o.push(l).delete(r)}t-=r}}),o.chop()}eachLine(e,t="\n"){const n=new l.default(this.ops);let r=new u,s=0;for(;n.hasNext();){if("insert"!==n.peekType())return;const i=n.peek(),l=o.default.length(i)-n.peekLength(),a="string"==typeof i.insert?i.insert.indexOf(t,l)-l:-1;if(a<0)r.push(n.next());else if(a>0)r.push(n.next(a));else{if(!1===e(r,n.next(1).attributes||{},s))return;s+=1,r=new u}}r.length()>0&&e(r,{},s)}invert(e){const t=new u;return this.reduce((n,r)=>{if(r.insert)t.delete(o.default.length(r));else{if("number"==typeof r.retain&&null==r.attributes)return t.retain(r.retain),n+r.retain;if(r.delete||"number"==typeof r.retain){const s=r.delete||r.retain;return e.slice(n,n+s).forEach(e=>{r.delete?t.push(e):r.retain&&r.attributes&&t.retain(o.default.length(e),i.default.invert(r.attributes,e.attributes))}),n+s}if("object"==typeof r.retain&&null!==r.retain){const s=e.slice(n,n+1),o=new l.default(s.ops).next(),[a,d,h]=c(r.retain,o.insert),f=u.getHandler(a);return t.retain({[a]:f.invert(d,h)},i.default.invert(r.attributes,o.attributes)),n+1}}return n},0),t.chop()}transform(e,t=!1){if(t=!!t,"number"==typeof e)return this.transformPosition(e,t);const n=e,r=new l.default(this.ops),s=new l.default(n.ops),a=new u;for(;r.hasNext()||s.hasNext();)if("insert"!==r.peekType()||!t&&"insert"===s.peekType())if("insert"===s.peekType())a.push(s.next());else{const e=Math.min(r.peekLength(),s.peekLength()),n=r.next(e),o=s.next(e);if(n.delete)continue;if(o.delete)a.push(o);else{const r=n.retain,s=o.retain;let l="object"==typeof s&&null!==s?s:e;if("object"==typeof r&&null!==r&&"object"==typeof s&&null!==s){const e=Object.keys(r)[0];if(e===Object.keys(s)[0]){const n=u.getHandler(e);n&&(l={[e]:n.transform(r[e],s[e],t)})}}a.retain(l,i.default.transform(n.attributes,o.attributes,t))}}else a.retain(o.default.length(r.next()));return a.chop()}transformPosition(e,t=!1){t=!!t;const n=new l.default(this.ops);let r=0;for(;n.hasNext()&&r<=e;){const s=n.peekLength(),i=n.peekType();n.next(),"delete"!==i?("insert"===i&&(r<e||!t)&&(e+=s),r+=s):e-=Math.min(s,e-r)}return e}}u.Op=o.default,u.OpIterator=l.default,u.AttributeMap=i.default,u.handlers={},t.default=u,e.exports=u,e.exports.default=u}(di,di.exports)),di.exports);const ji=G(Ci);class _i extends ni{static value(){}optimize(){(this.prev||this.next)&&this.remove()}length(){return 0}value(){return""}}_i.blotName="break",_i.tagName="BR";let Oi=class extends li{};const Ti={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function Li(e){return e.replace(/[&<>"']/g,e=>Ti[e])}const qi=class e extends Js{static compare(t,n){const r=e.order.indexOf(t),s=e.order.indexOf(n);return r>=0||s>=0?r-s:t===n?0:t<n?-1:1}formatAt(t,n,r,s){if(e.compare(this.statics.blotName,r)<0&&this.scroll.query(r,Ls.BLOT)){const e=this.isolate(t,n);s&&e.wrap(r,s)}else super.formatAt(t,n,r,s)}optimize(t){if(super.optimize(t),this.parent instanceof e&&e.compare(this.statics.blotName,this.parent.statics.blotName)>0){const e=this.parent.isolate(this.offset(),this.length());this.moveChildren(e),e.wrap(this)}}};t(qi,"allowedChildren",[qi,_i,ni,Oi]),t(qi,"order",["cursor","inline","link","underline","strike","italic","bold","script","code"]);let Ii=qi;class Ri extends Qs{constructor(){super(...arguments),t(this,"cache",{})}delta(){return null==this.cache.delta&&(this.cache.delta=Bi(this)),this.cache.delta}deleteAt(e,t){super.deleteAt(e,t),this.cache={}}formatAt(e,t,n,r){t<=0||(this.scroll.query(n,Ls.BLOCK)?e+t===this.length()&&this.format(n,r):super.formatAt(e,Math.min(t,this.length()-e-1),n,r),this.cache={})}insertAt(e,t,n){if(null!=n)return super.insertAt(e,t,n),void(this.cache={});if(0===t.length)return;const r=t.split("\n"),s=r.shift();s.length>0&&(e<this.length()-1||null==this.children.tail?super.insertAt(Math.min(e,this.length()-1),s):this.children.tail.insertAt(this.children.tail.length(),s),this.cache={});let i=this;r.reduce((e,t)=>(i=i.split(e,!0),i.insertAt(0,t),t.length),e+s.length)}insertBefore(e,t){const{head:n}=this.children;super.insertBefore(e,t),n instanceof _i&&n.remove(),this.cache={}}length(){return null==this.cache.length&&(this.cache.length=super.length()+1),this.cache.length}moveChildren(e,t){super.moveChildren(e,t),this.cache={}}optimize(e){super.optimize(e),this.cache={}}path(e){return super.path(e,!0)}removeChild(e){super.removeChild(e),this.cache={}}split(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(t&&(0===e||e>=this.length()-1)){const t=this.clone();return 0===e?(this.parent.insertBefore(t,this),this):(this.parent.insertBefore(t,this.next),t)}const n=super.split(e,t);return this.cache={},n}}Ri.blotName="block",Ri.tagName="P",Ri.defaultChild=_i,Ri.allowedChildren=[_i,Ii,ni,Oi];class Mi extends ni{attach(){super.attach(),this.attributes=new Us(this.domNode)}delta(){return(new ji).insert(this.value(),{...this.formats(),...this.attributes.values()})}format(e,t){const n=this.scroll.query(e,Ls.BLOCK_ATTRIBUTE);null!=n&&this.attributes.attribute(n,t)}formatAt(e,t,n,r){this.format(n,r)}insertAt(e,t,n){if(null!=n)return void super.insertAt(e,t,n);const r=t.split("\n"),s=r.pop(),i=r.map(e=>{const t=this.scroll.create(Ri.blotName);return t.insertAt(0,e),t}),o=this.split(e);i.forEach(e=>{this.parent.insertBefore(e,o)}),s&&this.parent.insertBefore(this.scroll.create("text",s),o)}}function Bi(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return e.descendants(Hs).reduce((e,n)=>0===n.length()?e:e.insert(n.value(),Di(n,{},t)),new ji).insert("\n",Di(e))}function Di(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return null==e?t:("formats"in e&&"function"==typeof e.formats&&(t={...t,...e.formats()},n&&delete t["code-token"]),null==e.parent||"scroll"===e.parent.statics.blotName||e.parent.statics.scope!==e.statics.scope?t:Di(e.parent,t,n))}Mi.scope=Ls.BLOCK_BLOT;const Pi=class e extends ni{static value(){}constructor(t,n,r){super(t,n),this.selection=r,this.textNode=document.createTextNode(e.CONTENTS),this.domNode.appendChild(this.textNode),this.savedLength=0}detach(){null!=this.parent&&this.parent.removeChild(this)}format(t,n){if(0!==this.savedLength)return void super.format(t,n);let r=this,s=0;for(;null!=r&&r.statics.scope!==Ls.BLOCK_BLOT;)s+=r.offset(r.parent),r=r.parent;null!=r&&(this.savedLength=e.CONTENTS.length,r.optimize(),r.formatAt(s,e.CONTENTS.length,t,n),this.savedLength=0)}index(e,t){return e===this.textNode?0:super.index(e,t)}length(){return this.savedLength}position(){return[this.textNode,this.textNode.data.length]}remove(){super.remove(),this.parent=null}restore(){if(this.selection.composing||null==this.parent)return null;const t=this.selection.getNativeRange();for(;null!=this.domNode.lastChild&&this.domNode.lastChild!==this.textNode;)this.domNode.parentNode.insertBefore(this.domNode.lastChild,this.domNode);const n=this.prev instanceof Oi?this.prev:null,r=n?n.length():0,s=this.next instanceof Oi?this.next:null,i=s?s.text:"",{textNode:o}=this,l=o.data.split(e.CONTENTS).join("");let a;if(o.data=e.CONTENTS,n)a=n,(l||s)&&(n.insertAt(n.length(),l+i),s&&s.remove());else if(s)a=s,s.insertAt(0,l);else{const e=document.createTextNode(l);a=this.scroll.create(e),this.parent.insertBefore(a,this)}if(this.remove(),t){const e=(e,t)=>n&&e===n.domNode?t:e===o?r+t-1:s&&e===s.domNode?r+l.length+t:null,i=e(t.start.node,t.start.offset),c=e(t.end.node,t.end.offset);if(null!==i&&null!==c)return{startNode:a.domNode,startOffset:i,endNode:a.domNode,endOffset:c}}return null}update(e,t){if(e.some(e=>"characterData"===e.type&&e.target===this.textNode)){const e=this.restore();e&&(t.range=e)}}optimize(t){super.optimize(t);let{parent:n}=this;for(;n;){if("A"===n.domNode.tagName){this.savedLength=e.CONTENTS.length,n.isolate(this.offset(n),this.length()).unwrap(),this.savedLength=0;break}n=n.parent}}value(){return""}};t(Pi,"blotName","cursor"),t(Pi,"className","ql-cursor"),t(Pi,"tagName","span"),t(Pi,"CONTENTS","\ufeff");let Fi=Pi;var Ui,zi={exports:{}};var $i=(Ui||(Ui=1,function(e){var t=Object.prototype.hasOwnProperty,n="~";function r(){}function s(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function i(e,t,r,i,o){if("function"!=typeof r)throw new TypeError("The listener must be a function");var l=new s(r,i||e,o),a=n?n+t:t;return e._events[a]?e._events[a].fn?e._events[a]=[e._events[a],l]:e._events[a].push(l):(e._events[a]=l,e._eventsCount++),e}function o(e,t){0===--e._eventsCount?e._events=new r:delete e._events[t]}function l(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(n=!1)),l.prototype.eventNames=function(){var e,r,s=[];if(0===this._eventsCount)return s;for(r in e=this._events)t.call(e,r)&&s.push(n?r.slice(1):r);return Object.getOwnPropertySymbols?s.concat(Object.getOwnPropertySymbols(e)):s},l.prototype.listeners=function(e){var t=n?n+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var s=0,i=r.length,o=new Array(i);s<i;s++)o[s]=r[s].fn;return o},l.prototype.listenerCount=function(e){var t=n?n+e:e,r=this._events[t];return r?r.fn?1:r.length:0},l.prototype.emit=function(e,t,r,s,i,o){var l=n?n+e:e;if(!this._events[l])return!1;var a,c,u=this._events[l],d=arguments.length;if(u.fn){switch(u.once&&this.removeListener(e,u.fn,void 0,!0),d){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,t),!0;case 3:return u.fn.call(u.context,t,r),!0;case 4:return u.fn.call(u.context,t,r,s),!0;case 5:return u.fn.call(u.context,t,r,s,i),!0;case 6:return u.fn.call(u.context,t,r,s,i,o),!0}for(c=1,a=new Array(d-1);c<d;c++)a[c-1]=arguments[c];u.fn.apply(u.context,a)}else{var h,f=u.length;for(c=0;c<f;c++)switch(u[c].once&&this.removeListener(e,u[c].fn,void 0,!0),d){case 1:u[c].fn.call(u[c].context);break;case 2:u[c].fn.call(u[c].context,t);break;case 3:u[c].fn.call(u[c].context,t,r);break;case 4:u[c].fn.call(u[c].context,t,r,s);break;default:if(!a)for(h=1,a=new Array(d-1);h<d;h++)a[h-1]=arguments[h];u[c].fn.apply(u[c].context,a)}}return!0},l.prototype.on=function(e,t,n){return i(this,e,t,n,!1)},l.prototype.once=function(e,t,n){return i(this,e,t,n,!0)},l.prototype.removeListener=function(e,t,r,s){var i=n?n+e:e;if(!this._events[i])return this;if(!t)return o(this,i),this;var l=this._events[i];if(l.fn)l.fn!==t||s&&!l.once||r&&l.context!==r||o(this,i);else{for(var a=0,c=[],u=l.length;a<u;a++)(l[a].fn!==t||s&&!l[a].once||r&&l[a].context!==r)&&c.push(l[a]);c.length?this._events[i]=1===c.length?c[0]:c:o(this,i)}return this},l.prototype.removeAllListeners=function(e){var t;return e?(t=n?n+e:e,this._events[t]&&o(this,t)):(this._events=new r,this._eventsCount=0),this},l.prototype.off=l.prototype.removeListener,l.prototype.addListener=l.prototype.on,l.prefixed=n,l.EventEmitter=l,e.exports=l}(zi)),zi.exports);const Vi=G($i),Hi=new WeakMap,Ki=["error","warn","log","info"];let Wi="warn";function Gi(e){if(Wi&&Ki.indexOf(e)<=Ki.indexOf(Wi))for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r]}function Zi(e){return Ki.reduce((t,n)=>(t[n]=Gi.bind(console,n,e),t),{})}Zi.level=e=>{Wi=e},Gi.level=Zi.level;const Yi=Zi("quill:events");["selectionchange","mousedown","mouseup","click"].forEach(e=>{document.addEventListener(e,function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];Array.from(document.querySelectorAll(".ql-container")).forEach(e=>{const n=Hi.get(e);n&&n.emitter&&n.emitter.handleDOM(...t)})})});class Ji extends Vi{constructor(){super(),this.domListeners={},this.on("error",Yi.error)}emit(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return Yi.log.call(Yi,...t),super.emit(...t)}handleDOM(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];(this.domListeners[e.type]||[]).forEach(t=>{let{node:r,handler:s}=t;(e.target===r||r.contains(e.target))&&s(e,...n)})}listenDOM(e,t,n){this.domListeners[e]||(this.domListeners[e]=[]),this.domListeners[e].push({node:t,handler:n})}}t(Ji,"events",{EDITOR_CHANGE:"editor-change",SCROLL_BEFORE_UPDATE:"scroll-before-update",SCROLL_BLOT_MOUNT:"scroll-blot-mount",SCROLL_BLOT_UNMOUNT:"scroll-blot-unmount",SCROLL_OPTIMIZE:"scroll-optimize",SCROLL_UPDATE:"scroll-update",SCROLL_EMBED_UPDATE:"scroll-embed-update",SELECTION_CHANGE:"selection-change",TEXT_CHANGE:"text-change",COMPOSITION_BEFORE_START:"composition-before-start",COMPOSITION_START:"composition-start",COMPOSITION_BEFORE_END:"composition-before-end",COMPOSITION_END:"composition-end"}),t(Ji,"sources",{API:"api",SILENT:"silent",USER:"user"});const Xi=Zi("quill:selection");class Qi{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.index=e,this.length=t}}class eo{constructor(e,t){this.emitter=t,this.scroll=e,this.composing=!1,this.mouseDown=!1,this.root=this.scroll.domNode,this.cursor=this.scroll.create("cursor",this),this.savedRange=new Qi(0,0),this.lastRange=this.savedRange,this.lastNative=null,this.handleComposition(),this.handleDragging(),this.emitter.listenDOM("selectionchange",document,()=>{this.mouseDown||this.composing||setTimeout(this.update.bind(this,Ji.sources.USER),1)}),this.emitter.on(Ji.events.SCROLL_BEFORE_UPDATE,()=>{if(!this.hasFocus())return;const e=this.getNativeRange();null!=e&&e.start.node!==this.cursor.textNode&&this.emitter.once(Ji.events.SCROLL_UPDATE,(t,n)=>{try{this.root.contains(e.start.node)&&this.root.contains(e.end.node)&&this.setNativeRange(e.start.node,e.start.offset,e.end.node,e.end.offset);const r=n.some(e=>"characterData"===e.type||"childList"===e.type||"attributes"===e.type&&e.target===this.root);this.update(r?Ji.sources.SILENT:t)}catch(r){}})}),this.emitter.on(Ji.events.SCROLL_OPTIMIZE,(e,t)=>{if(t.range){const{startNode:e,startOffset:n,endNode:r,endOffset:s}=t.range;this.setNativeRange(e,n,r,s),this.update(Ji.sources.SILENT)}}),this.update(Ji.sources.SILENT)}handleComposition(){this.emitter.on(Ji.events.COMPOSITION_BEFORE_START,()=>{this.composing=!0}),this.emitter.on(Ji.events.COMPOSITION_END,()=>{if(this.composing=!1,this.cursor.parent){const e=this.cursor.restore();if(!e)return;setTimeout(()=>{this.setNativeRange(e.startNode,e.startOffset,e.endNode,e.endOffset)},1)}})}handleDragging(){this.emitter.listenDOM("mousedown",document.body,()=>{this.mouseDown=!0}),this.emitter.listenDOM("mouseup",document.body,()=>{this.mouseDown=!1,this.update(Ji.sources.USER)})}focus(){this.hasFocus()||(this.root.focus({preventScroll:!0}),this.setRange(this.savedRange))}format(e,t){this.scroll.update();const n=this.getNativeRange();if(null!=n&&n.native.collapsed&&!this.scroll.query(e,Ls.BLOCK)){if(n.start.node!==this.cursor.textNode){const e=this.scroll.find(n.start.node,!1);if(null==e)return;if(e instanceof Hs){const t=e.split(n.start.offset);e.parent.insertBefore(this.cursor,t)}else e.insertBefore(this.cursor,n.start.node);this.cursor.attach()}this.cursor.format(e,t),this.scroll.optimize(),this.setNativeRange(this.cursor.textNode,this.cursor.textNode.data.length),this.update()}}getBounds(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const n=this.scroll.length();let r;e=Math.min(e,n-1),t=Math.min(e+t,n-1)-e;let[s,i]=this.scroll.leaf(e);if(null==s)return null;if(t>0&&i===s.length()){const[t]=this.scroll.leaf(e+1);if(t){const[n]=this.scroll.line(e),[r]=this.scroll.line(e+1);n===r&&(s=t,i=0)}}[r,i]=s.position(i,!0);const o=document.createRange();if(t>0)return o.setStart(r,i),[s,i]=this.scroll.leaf(e+t),null==s?null:([r,i]=s.position(i,!0),o.setEnd(r,i),o.getBoundingClientRect());let l,a="left";if(r instanceof Text){if(!r.data.length)return null;i<r.data.length?(o.setStart(r,i),o.setEnd(r,i+1)):(o.setStart(r,i-1),o.setEnd(r,i),a="right"),l=o.getBoundingClientRect()}else{if(!(s.domNode instanceof Element))return null;l=s.domNode.getBoundingClientRect(),i>0&&(a="right")}return{bottom:l.top+l.height,height:l.height,left:l[a],right:l[a],top:l.top,width:0}}getNativeRange(){const e=document.getSelection();if(null==e||e.rangeCount<=0)return null;const t=e.getRangeAt(0);if(null==t)return null;const n=this.normalizeNative(t);return Xi.info("getNativeRange",n),n}getRange(){const e=this.scroll.domNode;if("isConnected"in e&&!e.isConnected)return[null,null];const t=this.getNativeRange();if(null==t)return[null,null];return[this.normalizedToRange(t),t]}hasFocus(){return document.activeElement===this.root||null!=document.activeElement&&to(this.root,document.activeElement)}normalizedToRange(e){const t=[[e.start.node,e.start.offset]];e.native.collapsed||t.push([e.end.node,e.end.offset]);const n=t.map(e=>{const[t,n]=e,r=this.scroll.find(t,!0),s=r.offset(this.scroll);return 0===n?s:r instanceof Hs?s+r.index(t,n):s+r.length()}),r=Math.min(Math.max(...n),this.scroll.length()-1),s=Math.min(r,...n);return new Qi(s,r-s)}normalizeNative(e){if(!to(this.root,e.startContainer)||!e.collapsed&&!to(this.root,e.endContainer))return null;const t={start:{node:e.startContainer,offset:e.startOffset},end:{node:e.endContainer,offset:e.endOffset},native:e};return[t.start,t.end].forEach(e=>{let{node:t,offset:n}=e;for(;!(t instanceof Text)&&t.childNodes.length>0;)if(t.childNodes.length>n)t=t.childNodes[n],n=0;else{if(t.childNodes.length!==n)break;t=t.lastChild,n=t instanceof Text?t.data.length:t.childNodes.length>0?t.childNodes.length:t.childNodes.length+1}e.node=t,e.offset=n}),t}rangeToNative(e){const t=this.scroll.length(),n=(e,n)=>{e=Math.min(t-1,e);const[r,s]=this.scroll.leaf(e);return r?r.position(s,n):[null,-1]};return[...n(e.index,!1),...n(e.index+e.length,!0)]}setNativeRange(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:t,s=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(Xi.info("setNativeRange",e,t,n,r),null!=e&&(null==this.root.parentNode||null==e.parentNode||null==n.parentNode))return;const i=document.getSelection();if(null!=i)if(null!=e){this.hasFocus()||this.root.focus({preventScroll:!0});const{native:o}=this.getNativeRange()||{};if(null==o||s||e!==o.startContainer||t!==o.startOffset||n!==o.endContainer||r!==o.endOffset){e instanceof Element&&"BR"===e.tagName&&(t=Array.from(e.parentNode.childNodes).indexOf(e),e=e.parentNode),n instanceof Element&&"BR"===n.tagName&&(r=Array.from(n.parentNode.childNodes).indexOf(n),n=n.parentNode);const s=document.createRange();s.setStart(e,t),s.setEnd(n,r),i.removeAllRanges(),i.addRange(s)}}else i.removeAllRanges(),this.root.blur()}setRange(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Ji.sources.API;if("string"==typeof t&&(n=t,t=!1),Xi.info("setRange",e),null!=e){const n=this.rangeToNative(e);this.setNativeRange(...n,t)}else this.setNativeRange(null);this.update(n)}update(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ji.sources.USER;const t=this.lastRange,[n,r]=this.getRange();if(this.lastRange=n,this.lastNative=r,null!=this.lastRange&&(this.savedRange=this.lastRange),!_s(t,this.lastRange)){if(!this.composing&&null!=r&&r.native.collapsed&&r.start.node!==this.cursor.textNode){const e=this.cursor.restore();e&&this.setNativeRange(e.startNode,e.startOffset,e.endNode,e.endOffset)}const n=[Ji.events.SELECTION_CHANGE,as(this.lastRange),as(t),e];this.emitter.emit(Ji.events.EDITOR_CHANGE,...n),e!==Ji.sources.SILENT&&this.emitter.emit(...n)}}}function to(e,t){try{t.parentNode}catch(n){return!1}return e.contains(t)}const no=/^[ -~]*$/;class ro{constructor(e){this.scroll=e,this.delta=this.getDelta()}applyDelta(e){this.scroll.update();let t=this.scroll.length();this.scroll.batchStart();const n=ao(e),r=new ji;return function(e){const t=[];return e.forEach(e=>{if("string"==typeof e.insert){e.insert.split("\n").forEach((n,r)=>{r&&t.push({insert:"\n",attributes:e.attributes}),n&&t.push({insert:n,attributes:e.attributes})})}else t.push(e)}),t}(n.ops.slice()).reduce((e,n)=>{const s=Ci.Op.length(n);let i=n.attributes||{},o=!1,l=!1;if(null!=n.insert){if(r.retain(s),"string"==typeof n.insert){const r=n.insert;l=!r.endsWith("\n")&&(t<=e||!!this.scroll.descendant(Mi,e)[0]),this.scroll.insertAt(e,r);const[s,o]=this.scroll.line(e);let a=Ts({},Di(s));if(s instanceof Ri){const[e]=s.descendant(Hs,o);e&&(a=Ts(a,Di(e)))}i=Ci.AttributeMap.diff(a,i)||{}}else if("object"==typeof n.insert){const r=Object.keys(n.insert)[0];if(null==r)return e;const s=null!=this.scroll.query(r,Ls.INLINE);if(s)(t<=e||this.scroll.descendant(Mi,e)[0])&&(l=!0);else if(e>0){const[t,n]=this.scroll.descendant(Hs,e-1);if(t instanceof Oi){"\n"!==t.value()[n]&&(o=!0)}else t instanceof ni&&t.statics.scope===Ls.INLINE_BLOT&&(o=!0)}if(this.scroll.insertAt(e,r,n.insert[r]),s){const[t]=this.scroll.descendant(Hs,e);if(t){const e=Ts({},Di(t));i=Ci.AttributeMap.diff(e,i)||{}}}}t+=s}else if(r.push(n),null!==n.retain&&"object"==typeof n.retain){const t=Object.keys(n.retain)[0];if(null==t)return e;this.scroll.updateEmbedAt(e,t,n.retain[t])}Object.keys(i).forEach(t=>{this.scroll.formatAt(e,s,t,i[t])});const a=o?1:0,c=l?1:0;return t+=a+c,r.retain(a),r.delete(c),e+s+a+c},0),r.reduce((e,t)=>"number"==typeof t.delete?(this.scroll.deleteAt(e,t.delete),e):e+Ci.Op.length(t),0),this.scroll.batchEnd(),this.scroll.optimize(),this.update(n)}deleteText(e,t){return this.scroll.deleteAt(e,t),this.update((new ji).retain(e).delete(t))}formatLine(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};this.scroll.update(),Object.keys(n).forEach(r=>{this.scroll.lines(e,Math.max(t,1)).forEach(e=>{e.format(r,n[r])})}),this.scroll.optimize();const r=(new ji).retain(e).retain(t,as(n));return this.update(r)}formatText(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.keys(n).forEach(r=>{this.scroll.formatAt(e,t,r,n[r])});const r=(new ji).retain(e).retain(t,as(n));return this.update(r)}getContents(e,t){return this.delta.slice(e,e+t)}getDelta(){return this.scroll.lines().reduce((e,t)=>e.concat(t.delta()),new ji)}getFormat(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=[],r=[];0===t?this.scroll.path(e).forEach(e=>{const[t]=e;t instanceof Ri?n.push(t):t instanceof Hs&&r.push(t)}):(n=this.scroll.lines(e,t),r=this.scroll.descendants(Hs,e,t));const[s,i]=[n,r].map(e=>{const t=e.shift();if(null==t)return{};let n=Di(t);for(;Object.keys(n).length>0;){const t=e.shift();if(null==t)return n;n=oo(Di(t),n)}return n});return{...s,...i}}getHTML(e,t){const[n,r]=this.scroll.line(e);if(n){const s=n.length();return!(n.length()>=r+t)||0===r&&t===s?io(this.scroll,e,t,!0):io(n,r,t,!0)}return""}getText(e,t){return this.getContents(e,t).filter(e=>"string"==typeof e.insert).map(e=>e.insert).join("")}insertContents(e,t){const n=ao(t),r=(new ji).retain(e).concat(n);return this.scroll.insertContents(e,n),this.update(r)}insertEmbed(e,t,n){return this.scroll.insertAt(e,t,n),this.update((new ji).retain(e).insert({[t]:n}))}insertText(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return t=t.replace(/\r\n/g,"\n").replace(/\r/g,"\n"),this.scroll.insertAt(e,t),Object.keys(n).forEach(r=>{this.scroll.formatAt(e,t.length,r,n[r])}),this.update((new ji).retain(e).insert(t,as(n)))}isBlank(){if(0===this.scroll.children.length)return!0;if(this.scroll.children.length>1)return!1;const e=this.scroll.children.head;if((null==e?void 0:e.statics.blotName)!==Ri.blotName)return!1;const t=e;return!(t.children.length>1)&&t.children.head instanceof _i}removeFormat(e,t){const n=this.getText(e,t),[r,s]=this.scroll.line(e+t);let i=0,o=new ji;null!=r&&(i=r.length()-s,o=r.delta().slice(s,s+i-1).insert("\n"));const l=this.getContents(e,t+i).diff((new ji).insert(n).concat(o)),a=(new ji).retain(e).concat(l);return this.applyDelta(a)}update(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;const r=this.delta;if(1===t.length&&"characterData"===t[0].type&&t[0].target.data.match(no)&&this.scroll.find(t[0].target)){const s=this.scroll.find(t[0].target),i=Di(s),o=s.offset(this.scroll),l=t[0].oldValue.replace(Fi.CONTENTS,""),a=(new ji).insert(l),c=(new ji).insert(s.value()),u=n&&{oldRange:co(n.oldRange,-o),newRange:co(n.newRange,-o)};e=(new ji).retain(o).concat(a.diff(c,u)).reduce((e,t)=>t.insert?e.insert(t.insert,i):e.push(t),new ji),this.delta=r.compose(e)}else this.delta=this.getDelta(),e&&_s(r.compose(e),this.delta)||(e=r.diff(this.delta,n));return e}}function so(e,t,n){if(0===e.length){const[e]=lo(n.pop());return t<=0?`</li></${e}>`:`</li></${e}>${so([],t-1,n)}`}const[{child:r,offset:s,length:i,indent:o,type:l},...a]=e,[c,u]=lo(l);if(o>t)return n.push(l),o===t+1?`<${c}><li${u}>${io(r,s,i)}${so(a,o,n)}`:`<${c}><li>${so(e,t+1,n)}`;const d=n[n.length-1];if(o===t&&l===d)return`</li><li${u}>${io(r,s,i)}${so(a,o,n)}`;const[h]=lo(n.pop());return`</li></${h}>${so(e,t-1,n)}`}function io(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if("html"in e&&"function"==typeof e.html)return e.html(t,n);if(e instanceof Oi){return Li(e.value().slice(t,t+n)).replaceAll(" ","&nbsp;")}if(e instanceof Zs){if("list-container"===e.statics.blotName){const r=[];return e.children.forEachAt(t,n,(e,t,n)=>{const s="formats"in e&&"function"==typeof e.formats?e.formats():{};r.push({child:e,offset:t,length:n,indent:s.indent||0,type:s.list})}),so(r,-1,[])}const s=[];if(e.children.forEachAt(t,n,(e,t,n)=>{s.push(io(e,t,n))}),r||"list"===e.statics.blotName)return s.join("");const{outerHTML:i,innerHTML:o}=e.domNode,[l,a]=i.split(`>${o}<`);return"<table"===l?`<table style="border: 1px solid #000;">${s.join("")}<${a}`:`${l}>${s.join("")}<${a}`}return e.domNode instanceof Element?e.domNode.outerHTML:""}function oo(e,t){return Object.keys(t).reduce((n,r)=>{if(null==e[r])return n;const s=t[r];return s===e[r]?n[r]=s:Array.isArray(s)?s.indexOf(e[r])<0?n[r]=s.concat([e[r]]):n[r]=s:n[r]=[s,e[r]],n},{})}function lo(e){const t="ordered"===e?"ol":"ul";switch(e){case"checked":return[t,' data-list="checked"'];case"unchecked":return[t,' data-list="unchecked"'];default:return[t,""]}}function ao(e){return e.reduce((e,t)=>{if("string"==typeof t.insert){const n=t.insert.replace(/\r\n/g,"\n").replace(/\r/g,"\n");return e.insert(n,t.attributes)}return e.push(t)},new ji)}function co(e,t){let{index:n,length:r}=e;return new Qi(n+t,r)}class uo{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.quill=e,this.options=t}}t(uo,"DEFAULTS",{});const ho="\ufeff";class fo extends ni{constructor(e,t){super(e,t),this.contentNode=document.createElement("span"),this.contentNode.setAttribute("contenteditable","false"),Array.from(this.domNode.childNodes).forEach(e=>{this.contentNode.appendChild(e)}),this.leftGuard=document.createTextNode(ho),this.rightGuard=document.createTextNode(ho),this.domNode.appendChild(this.leftGuard),this.domNode.appendChild(this.contentNode),this.domNode.appendChild(this.rightGuard)}index(e,t){return e===this.leftGuard?0:e===this.rightGuard?1:super.index(e,t)}restore(e){let t,n=null;const r=e.data.split(ho).join("");if(e===this.leftGuard)if(this.prev instanceof Oi){const e=this.prev.length();this.prev.insertAt(e,r),n={startNode:this.prev.domNode,startOffset:e+r.length}}else t=document.createTextNode(r),this.parent.insertBefore(this.scroll.create(t),this),n={startNode:t,startOffset:r.length};else e===this.rightGuard&&(this.next instanceof Oi?(this.next.insertAt(0,r),n={startNode:this.next.domNode,startOffset:r.length}):(t=document.createTextNode(r),this.parent.insertBefore(this.scroll.create(t),this.next),n={startNode:t,startOffset:r.length}));return e.data=ho,n}update(e,t){e.forEach(e=>{if("characterData"===e.type&&(e.target===this.leftGuard||e.target===this.rightGuard)){const n=this.restore(e.target);n&&(t.range=n)}})}}class po{constructor(e,n){t(this,"isComposing",!1),this.scroll=e,this.emitter=n,this.setupListeners()}setupListeners(){this.scroll.domNode.addEventListener("compositionstart",e=>{this.isComposing||this.handleCompositionStart(e)}),this.scroll.domNode.addEventListener("compositionend",e=>{this.isComposing&&queueMicrotask(()=>{this.handleCompositionEnd(e)})})}handleCompositionStart(e){const t=e.target instanceof Node?this.scroll.find(e.target,!0):null;!t||t instanceof fo||(this.emitter.emit(Ji.events.COMPOSITION_BEFORE_START,e),this.scroll.batchStart(),this.emitter.emit(Ji.events.COMPOSITION_START,e),this.isComposing=!0)}handleCompositionEnd(e){this.emitter.emit(Ji.events.COMPOSITION_BEFORE_END,e),this.scroll.batchEnd(),this.emitter.emit(Ji.events.COMPOSITION_END,e),this.isComposing=!1}}const mo=class{constructor(e,n){t(this,"modules",{}),this.quill=e,this.options=n}init(){Object.keys(this.options.modules).forEach(e=>{null==this.modules[e]&&this.addModule(e)})}addModule(e){const t=this.quill.constructor.import(`modules/${e}`);return this.modules[e]=new t(this.quill,this.options.modules[e]||{}),this.modules[e]}};t(mo,"DEFAULTS",{modules:{}}),t(mo,"themes",{default:mo});let go=mo;const vo=e=>e.parentElement||e.getRootNode().host||null,bo=e=>{const t=e.getBoundingClientRect(),n="offsetWidth"in e&&Math.abs(t.width)/e.offsetWidth||1,r="offsetHeight"in e&&Math.abs(t.height)/e.offsetHeight||1;return{top:t.top,right:t.left+e.clientWidth*n,bottom:t.top+e.clientHeight*r,left:t.left}},yo=e=>{const t=parseInt(e,10);return Number.isNaN(t)?0:t},xo=(e,t,n,r,s,i)=>e<n&&t>r?0:e<n?-(n-e+s):t>r?t-e>r-n?e+s-n:t-r+i:0,wo=["block","break","cursor","inline","scroll","text"],No=Zi("quill"),Eo=new Ms;Zs.uiClass="ql-ui";const ko=class e{static debug(e){!0===e&&(e="log"),Zi.level(e)}static find(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Hi.get(e)||Eo.find(e,t)}static import(e){return null==this.imports[e]&&No.error(`Cannot import ${e}. Are you sure it was registered?`),this.imports[e]}static register(){if("string"!=typeof(arguments.length<=0?void 0:arguments[0])){const e=arguments.length<=0?void 0:arguments[0],t=!!(arguments.length<=1?void 0:arguments[1]),n="attrName"in e?e.attrName:e.blotName;"string"==typeof n?this.register(`formats/${n}`,e,t):Object.keys(e).forEach(n=>{this.register(n,e[n],t)})}else{const e=arguments.length<=0?void 0:arguments[0],t=arguments.length<=1?void 0:arguments[1],n=!!(arguments.length<=2?void 0:arguments[2]);null==this.imports[e]||n||No.warn(`Overwriting ${e} with`,t),this.imports[e]=t,(e.startsWith("blots/")||e.startsWith("formats/"))&&t&&"boolean"!=typeof t&&"abstract"!==t.blotName&&Eo.register(t),"function"==typeof t.register&&t.register(Eo)}}constructor(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.options=function(e,t){const n=Ao(e);if(!n)throw new Error("Invalid Quill container");const r=!t.theme||t.theme===So.DEFAULTS.theme,s=r?go:So.import(`themes/${t.theme}`);if(!s)throw new Error(`Invalid theme ${t.theme}. Did you register it?`);const{modules:i,...o}=So.DEFAULTS,{modules:l,...a}=s.DEFAULTS;let c=Co(t.modules);null!=c&&c.toolbar&&c.toolbar.constructor!==Object&&(c={...c,toolbar:{container:c.toolbar}});const u=Ts({},Co(i),Co(l),c),d={...o,...jo(a),...jo(t)};let h=t.registry;h?t.formats&&No.warn('Ignoring "formats" option because "registry" is specified'):h=t.formats?((e,t,n)=>{const r=new Ms;return wo.forEach(e=>{const n=t.query(e);n&&r.register(n)}),e.forEach(e=>{let s=t.query(e);s||n.error(`Cannot register "${e}" specified in "formats" config. Are you sure it was registered?`);let i=0;for(;s;)if(r.register(s),s="blotName"in s?s.requiredContainer??null:null,i+=1,i>100){n.error(`Cycle detected in registering blot requiredContainer: "${e}"`);break}}),r})(t.formats,d.registry,No):d.registry;return{...d,registry:h,container:n,theme:s,modules:Object.entries(u).reduce((e,t)=>{let[n,r]=t;if(!r)return e;const s=So.import(`modules/${n}`);return null==s?(No.error(`Cannot load ${n} module. Are you sure you registered it?`),e):{...e,[n]:Ts({},s.DEFAULTS||{},r)}},{}),bounds:Ao(d.bounds)}}(t,n),this.container=this.options.container,null==this.container)return void No.error("Invalid Quill container",t);this.options.debug&&e.debug(this.options.debug);const r=this.container.innerHTML.trim();this.container.classList.add("ql-container"),this.container.innerHTML="",Hi.set(this.container,this),this.root=this.addContainer("ql-editor"),this.root.classList.add("ql-blank"),this.emitter=new Ji;const s=ii.blotName,i=this.options.registry.query(s);if(!i||!("blotName"in i))throw new Error(`Cannot initialize Quill without "${s}" blot`);if(this.scroll=new i(this.options.registry,this.root,{emitter:this.emitter}),this.editor=new ro(this.scroll),this.selection=new eo(this.scroll,this.emitter),this.composition=new po(this.scroll,this.emitter),this.theme=new this.options.theme(this,this.options),this.keyboard=this.theme.addModule("keyboard"),this.clipboard=this.theme.addModule("clipboard"),this.history=this.theme.addModule("history"),this.uploader=this.theme.addModule("uploader"),this.theme.addModule("input"),this.theme.addModule("uiNode"),this.theme.init(),this.emitter.on(Ji.events.EDITOR_CHANGE,e=>{e===Ji.events.TEXT_CHANGE&&this.root.classList.toggle("ql-blank",this.editor.isBlank())}),this.emitter.on(Ji.events.SCROLL_UPDATE,(e,t)=>{const n=this.selection.lastRange,[r]=this.selection.getRange(),s=n&&r?{oldRange:n,newRange:r}:void 0;_o.call(this,()=>this.editor.update(null,t,s),e)}),this.emitter.on(Ji.events.SCROLL_EMBED_UPDATE,(t,n)=>{const r=this.selection.lastRange,[s]=this.selection.getRange(),i=r&&s?{oldRange:r,newRange:s}:void 0;_o.call(this,()=>{const e=(new ji).retain(t.offset(this)).retain({[t.statics.blotName]:n});return this.editor.update(e,[],i)},e.sources.USER)}),r){const e=this.clipboard.convert({html:`${r}<p><br></p>`,text:"\n"});this.setContents(e)}this.history.clear(),this.options.placeholder&&this.root.setAttribute("data-placeholder",this.options.placeholder),this.options.readOnly&&this.disable(),this.allowReadOnlyEdits=!1}addContainer(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if("string"==typeof e){const t=e;(e=document.createElement("div")).classList.add(t)}return this.container.insertBefore(e,t),e}blur(){this.selection.setRange(null)}deleteText(e,t,n){return[e,t,,n]=Oo(e,t,n),_o.call(this,()=>this.editor.deleteText(e,t),n,e,-1*t)}disable(){this.enable(!1)}editReadOnly(e){this.allowReadOnlyEdits=!0;const t=e();return this.allowReadOnlyEdits=!1,t}enable(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.scroll.enable(e),this.container.classList.toggle("ql-disabled",!e)}focus(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.selection.focus(),e.preventScroll||this.scrollSelectionIntoView()}format(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Ji.sources.API;return _o.call(this,()=>{const n=this.getSelection(!0);let r=new ji;if(null==n)return r;if(this.scroll.query(e,Ls.BLOCK))r=this.editor.formatLine(n.index,n.length,{[e]:t});else{if(0===n.length)return this.selection.format(e,t),r;r=this.editor.formatText(n.index,n.length,{[e]:t})}return this.setSelection(n,Ji.sources.SILENT),r},n)}formatLine(e,t,n,r,s){let i;return[e,t,i,s]=Oo(e,t,n,r,s),_o.call(this,()=>this.editor.formatLine(e,t,i),s,e,0)}formatText(e,t,n,r,s){let i;return[e,t,i,s]=Oo(e,t,n,r,s),_o.call(this,()=>this.editor.formatText(e,t,i),s,e,0)}getBounds(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=null;if(n="number"==typeof e?this.selection.getBounds(e,t):this.selection.getBounds(e.index,e.length),!n)return null;const r=this.container.getBoundingClientRect();return{bottom:n.bottom-r.top,height:n.height,left:n.left-r.left,right:n.right-r.left,top:n.top-r.top,width:n.width}}getContents(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.getLength()-e;return[e,t]=Oo(e,t),this.editor.getContents(e,t)}getFormat(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.getSelection(!0),t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return"number"==typeof e?this.editor.getFormat(e,t):this.editor.getFormat(e.index,e.length)}getIndex(e){return e.offset(this.scroll)}getLength(){return this.scroll.length()}getLeaf(e){return this.scroll.leaf(e)}getLine(e){return this.scroll.line(e)}getLines(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Number.MAX_VALUE;return"number"!=typeof e?this.scroll.lines(e.index,e.length):this.scroll.lines(e,t)}getModule(e){return this.theme.modules[e]}getSelection(){return arguments.length>0&&void 0!==arguments[0]&&arguments[0]&&this.focus(),this.update(),this.selection.getRange()[0]}getSemanticHTML(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1?arguments[1]:void 0;return"number"==typeof e&&(t=t??this.getLength()-e),[e,t]=Oo(e,t),this.editor.getHTML(e,t)}getText(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1?arguments[1]:void 0;return"number"==typeof e&&(t=t??this.getLength()-e),[e,t]=Oo(e,t),this.editor.getText(e,t)}hasFocus(){return this.selection.hasFocus()}insertEmbed(t,n,r){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:e.sources.API;return _o.call(this,()=>this.editor.insertEmbed(t,n,r),s,t)}insertText(e,t,n,r,s){let i;return[e,,i,s]=Oo(e,0,n,r,s),_o.call(this,()=>this.editor.insertText(e,t,i),s,e,t.length)}isEnabled(){return this.scroll.isEnabled()}off(){return this.emitter.off(...arguments)}on(){return this.emitter.on(...arguments)}once(){return this.emitter.once(...arguments)}removeFormat(e,t,n){return[e,t,,n]=Oo(e,t,n),_o.call(this,()=>this.editor.removeFormat(e,t),n,e)}scrollRectIntoView(e){((e,t)=>{var n,r,s;const i=e.ownerDocument;let o=t,l=e;for(;l;){const e=l===i.body,t=e?{top:0,right:(null==(n=window.visualViewport)?void 0:n.width)??i.documentElement.clientWidth,bottom:(null==(r=window.visualViewport)?void 0:r.height)??i.documentElement.clientHeight,left:0}:bo(l),a=getComputedStyle(l),c=xo(o.left,o.right,t.left,t.right,yo(a.scrollPaddingLeft),yo(a.scrollPaddingRight)),u=xo(o.top,o.bottom,t.top,t.bottom,yo(a.scrollPaddingTop),yo(a.scrollPaddingBottom));if(c||u)if(e)null==(s=i.defaultView)||s.scrollBy(c,u);else{const{scrollLeft:e,scrollTop:t}=l;u&&(l.scrollTop+=u),c&&(l.scrollLeft+=c);const n=l.scrollLeft-e,r=l.scrollTop-t;o={left:o.left-n,top:o.top-r,right:o.right-n,bottom:o.bottom-r}}l=e||"fixed"===a.position?null:vo(l)}})(this.root,e)}scrollIntoView(){this.scrollSelectionIntoView()}scrollSelectionIntoView(){const e=this.selection.lastRange,t=e&&this.selection.getBounds(e.index,e.length);t&&this.scrollRectIntoView(t)}setContents(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ji.sources.API;return _o.call(this,()=>{e=new ji(e);const t=this.getLength(),n=this.editor.deleteText(0,t),r=this.editor.insertContents(0,e),s=this.editor.deleteText(this.getLength()-1,1);return n.compose(r).compose(s)},t)}setSelection(t,n,r){null==t?this.selection.setRange(null,n||e.sources.API):([t,n,,r]=Oo(t,n,r),this.selection.setRange(new Qi(Math.max(0,t),n),r),r!==Ji.sources.SILENT&&this.scrollSelectionIntoView())}setText(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ji.sources.API;const n=(new ji).insert(e);return this.setContents(n,t)}update(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ji.sources.USER;const t=this.scroll.update(e);return this.selection.update(e),t}updateContents(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ji.sources.API;return _o.call(this,()=>(e=new ji(e),this.editor.applyDelta(e)),t,!0)}};t(ko,"DEFAULTS",{bounds:null,modules:{clipboard:!0,keyboard:!0,history:!0,uploader:!0},placeholder:"",readOnly:!1,registry:Eo,theme:"default"}),t(ko,"events",Ji.events),t(ko,"sources",Ji.sources),t(ko,"version","2.0.3"),t(ko,"imports",{delta:ji,parchment:ai,"core/module":uo,"core/theme":go});let So=ko;function Ao(e){return"string"==typeof e?document.querySelector(e):e}function Co(e){return Object.entries(e??{}).reduce((e,t)=>{let[n,r]=t;return{...e,[n]:!0===r?{}:r}},{})}function jo(e){return Object.fromEntries(Object.entries(e).filter(e=>void 0!==e[1]))}function _o(e,t,n,r){if(!this.isEnabled()&&t===Ji.sources.USER&&!this.allowReadOnlyEdits)return new ji;let s=null==n?null:this.getSelection();const i=this.editor.delta,o=e();if(null!=s&&(!0===n&&(n=s.index),null==r?s=To(s,o,t):0!==r&&(s=To(s,n,r,t)),this.setSelection(s,Ji.sources.SILENT)),o.length()>0){const e=[Ji.events.TEXT_CHANGE,o,i,t];this.emitter.emit(Ji.events.EDITOR_CHANGE,...e),t!==Ji.sources.SILENT&&this.emitter.emit(...e)}return o}function Oo(e,t,n,r,s){let i={};return"number"==typeof e.index&&"number"==typeof e.length?"number"!=typeof t?(s=r,r=n,n=t,t=e.length,e=e.index):(t=e.length,e=e.index):"number"!=typeof t&&(s=r,r=n,n=t,t=0),"object"==typeof n?(i=n,s=r):"string"==typeof n&&(null!=r?i[n]=r:s=n),[e,t,i,s=s||Ji.sources.API]}function To(e,t,n,r){const s="number"==typeof n?n:0;if(null==e)return null;let i,o;return t&&"function"==typeof t.transformPosition?[i,o]=[e.index,e.index+e.length].map(e=>t.transformPosition(e,r!==Ji.sources.USER)):[i,o]=[e.index,e.index+e.length].map(e=>e<t||e===t&&r===Ji.sources.USER?e:s>=0?e+s:Math.max(t,e+s)),new Qi(i,o-i)}class Lo extends ti{}function qo(e){return e instanceof Ri||e instanceof Mi}function Io(e){return"function"==typeof e.updateContent}class Ro extends ii{constructor(e,t,n){let{emitter:r}=n;super(e,t),this.emitter=r,this.batch=!1,this.optimize(),this.enable(),this.domNode.addEventListener("dragstart",e=>this.handleDragStart(e))}batchStart(){Array.isArray(this.batch)||(this.batch=[])}batchEnd(){if(!this.batch)return;const e=this.batch;this.batch=!1,this.update(e)}emitMount(e){this.emitter.emit(Ji.events.SCROLL_BLOT_MOUNT,e)}emitUnmount(e){this.emitter.emit(Ji.events.SCROLL_BLOT_UNMOUNT,e)}emitEmbedUpdate(e,t){this.emitter.emit(Ji.events.SCROLL_EMBED_UPDATE,e,t)}deleteAt(e,t){const[n,r]=this.line(e),[s]=this.line(e+t);if(super.deleteAt(e,t),null!=s&&n!==s&&r>0){if(n instanceof Mi||s instanceof Mi)return void this.optimize();const e=s.children.head instanceof _i?null:s.children.head;n.moveChildren(s,e),n.remove()}this.optimize()}enable(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.domNode.setAttribute("contenteditable",e?"true":"false")}formatAt(e,t,n,r){super.formatAt(e,t,n,r),this.optimize()}insertAt(e,t,n){if(e>=this.length())if(null==n||null==this.scroll.query(t,Ls.BLOCK)){const e=this.scroll.create(this.statics.defaultChild.blotName);this.appendChild(e),null==n&&t.endsWith("\n")?e.insertAt(0,t.slice(0,-1),n):e.insertAt(0,t,n)}else{const e=this.scroll.create(t,n);this.appendChild(e)}else super.insertAt(e,t,n);this.optimize()}insertBefore(e,t){if(e.statics.scope===Ls.INLINE_BLOT){const n=this.scroll.create(this.statics.defaultChild.blotName);n.appendChild(e),super.insertBefore(n,t)}else super.insertBefore(e,t)}insertContents(e,t){const n=this.deltaToRenderBlocks(t.concat((new ji).insert("\n"))),r=n.pop();if(null==r)return;this.batchStart();const s=n.shift();if(s){const t="block"===s.type&&(0===s.delta.length()||!this.descendant(Mi,e)[0]&&e<this.length()),n="block"===s.type?s.delta:(new ji).insert({[s.key]:s.value});Mo(this,e,n);const r="block"===s.type?1:0,i=e+n.length()+r;t&&this.insertAt(i-1,"\n");const o=Di(this.line(e)[0]),l=Ci.AttributeMap.diff(o,s.attributes)||{};Object.keys(l).forEach(e=>{this.formatAt(i-1,1,e,l[e])}),e=i}let[i,o]=this.children.find(e);if(n.length&&(i&&(i=i.split(o),o=0),n.forEach(e=>{if("block"===e.type){Mo(this.createBlock(e.attributes,i||void 0),0,e.delta)}else{const t=this.create(e.key,e.value);this.insertBefore(t,i||void 0),Object.keys(e.attributes).forEach(n=>{t.format(n,e.attributes[n])})}})),"block"===r.type&&r.delta.length()){Mo(this,i?i.offset(i.scroll)+o:this.length(),r.delta)}this.batchEnd(),this.optimize()}isEnabled(){return"true"===this.domNode.getAttribute("contenteditable")}leaf(e){const t=this.path(e).pop();if(!t)return[null,-1];const[n,r]=t;return n instanceof Hs?[n,r]:[null,-1]}line(e){return e===this.length()?this.line(e-1):this.descendant(qo,e)}lines(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Number.MAX_VALUE;const n=(e,t,r)=>{let s=[],i=r;return e.children.forEachAt(t,r,(e,t,r)=>{qo(e)?s.push(e):e instanceof ti&&(s=s.concat(n(e,t,i))),i-=r}),s};return n(this,e,t)}optimize(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.batch||(super.optimize(e,t),e.length>0&&this.emitter.emit(Ji.events.SCROLL_OPTIMIZE,e,t))}path(e){return super.path(e).slice(1)}remove(){}update(e){if(this.batch)return void(Array.isArray(e)&&(this.batch=this.batch.concat(e)));let t=Ji.sources.USER;"string"==typeof e&&(t=e),Array.isArray(e)||(e=this.observer.takeRecords()),(e=e.filter(e=>{let{target:t}=e;const n=this.find(t,!0);return n&&!Io(n)})).length>0&&this.emitter.emit(Ji.events.SCROLL_BEFORE_UPDATE,t,e),super.update(e.concat([])),e.length>0&&this.emitter.emit(Ji.events.SCROLL_UPDATE,t,e)}updateEmbedAt(e,t,n){const[r]=this.descendant(e=>e instanceof Mi,e);r&&r.statics.blotName===t&&Io(r)&&r.updateContent(n)}handleDragStart(e){e.preventDefault()}deltaToRenderBlocks(e){const t=[];let n=new ji;return e.forEach(e=>{const r=null==e?void 0:e.insert;if(r)if("string"==typeof r){const s=r.split("\n");s.slice(0,-1).forEach(r=>{n.insert(r,e.attributes),t.push({type:"block",delta:n,attributes:e.attributes??{}}),n=new ji});const i=s[s.length-1];i&&n.insert(i,e.attributes)}else{const s=Object.keys(r)[0];if(!s)return;this.query(s,Ls.INLINE)?n.push(e):(n.length()&&t.push({type:"block",delta:n,attributes:{}}),n=new ji,t.push({type:"blockEmbed",key:s,value:r[s],attributes:e.attributes??{}}))}}),n.length()&&t.push({type:"block",delta:n,attributes:{}}),t}createBlock(e,t){let n;const r={};Object.entries(e).forEach(e=>{let[t,s]=e;null!=this.query(t,Ls.BLOCK&Ls.BLOT)?n=t:r[t]=s});const s=this.create(n||this.statics.defaultChild.blotName,n?e[n]:void 0);this.insertBefore(s,t||void 0);const i=s.length();return Object.entries(r).forEach(e=>{let[t,n]=e;s.formatAt(0,i,t,n)}),s}}function Mo(e,t,n){n.reduce((t,n)=>{const r=Ci.Op.length(n);let s=n.attributes||{};if(null!=n.insert)if("string"==typeof n.insert){const r=n.insert;e.insertAt(t,r);const[i]=e.descendant(Hs,t),o=Di(i);s=Ci.AttributeMap.diff(o,s)||{}}else if("object"==typeof n.insert){const r=Object.keys(n.insert)[0];if(null==r)return t;e.insertAt(t,r,n.insert[r]);if(null!=e.scroll.query(r,Ls.INLINE)){const[n]=e.descendant(Hs,t),r=Di(n);s=Ci.AttributeMap.diff(r,s)||{}}}return Object.keys(s).forEach(n=>{e.formatAt(t,r,n,s[n])}),t+r},t)}t(Ro,"blotName","scroll"),t(Ro,"className","ql-editor"),t(Ro,"tagName","DIV"),t(Ro,"defaultChild",Ri),t(Ro,"allowedChildren",[Ri,Mi,Lo]);const Bo={scope:Ls.BLOCK,whitelist:["right","center","justify"]},Do=new qs("align","align",Bo),Po=new Ds("align","ql-align",Bo),Fo=new Fs("align","text-align",Bo);class Uo extends Fs{value(e){let t=super.value(e);if(!t.startsWith("rgb("))return t;t=t.replace(/^[^\d]+/,"").replace(/[^\d]+$/,"");return`#${t.split(",").map(e=>`00${parseInt(e,10).toString(16)}`.slice(-2)).join("")}`}}const zo=new Ds("color","ql-color",{scope:Ls.INLINE}),$o=new Uo("color","color",{scope:Ls.INLINE}),Vo=new Ds("background","ql-bg",{scope:Ls.INLINE}),Ho=new Uo("background","background-color",{scope:Ls.INLINE});class Ko extends Lo{static create(e){const t=super.create(e);return t.setAttribute("spellcheck","false"),t}code(e,t){return this.children.map(e=>e.length()<=1?"":e.domNode.innerText).join("\n").slice(e,e+t)}html(e,t){return`<pre>\n${Li(this.code(e,t))}\n</pre>`}}class Wo extends Ri{static register(){So.register(Ko)}}t(Wo,"TAB"," ");class Go extends Ii{}Go.blotName="code",Go.tagName="CODE",Wo.blotName="code-block",Wo.className="ql-code-block",Wo.tagName="DIV",Ko.blotName="code-block-container",Ko.className="ql-code-block-container",Ko.tagName="DIV",Ko.allowedChildren=[Wo],Wo.allowedChildren=[Oi,_i,Fi],Wo.requiredContainer=Ko;const Zo={scope:Ls.BLOCK,whitelist:["rtl"]},Yo=new qs("direction","dir",Zo),Jo=new Ds("direction","ql-direction",Zo),Xo=new Fs("direction","direction",Zo),Qo={scope:Ls.INLINE,whitelist:["serif","monospace"]},el=new Ds("font","ql-font",Qo);const tl=new class extends Fs{value(e){return super.value(e).replace(/["']/g,"")}}("font","font-family",Qo),nl=new Ds("size","ql-size",{scope:Ls.INLINE,whitelist:["small","large","huge"]}),rl=new Fs("size","font-size",{scope:Ls.INLINE,whitelist:["10px","18px","32px"]}),sl=Zi("quill:keyboard"),il=/Mac/i.test(navigator.platform)?"metaKey":"ctrlKey";class ol extends uo{static match(e,t){return!["altKey","ctrlKey","metaKey","shiftKey"].some(n=>!!t[n]!==e[n]&&null!==t[n])&&(t.key===e.key||t.key===e.which)}constructor(e,t){super(e,t),this.bindings={},Object.keys(this.options.bindings).forEach(e=>{this.options.bindings[e]&&this.addBinding(this.options.bindings[e])}),this.addBinding({key:"Enter",shiftKey:null},this.handleEnter),this.addBinding({key:"Enter",metaKey:null,ctrlKey:null,altKey:null},()=>{}),/Firefox/i.test(navigator.userAgent)?(this.addBinding({key:"Backspace"},{collapsed:!0},this.handleBackspace),this.addBinding({key:"Delete"},{collapsed:!0},this.handleDelete)):(this.addBinding({key:"Backspace"},{collapsed:!0,prefix:/^.?$/},this.handleBackspace),this.addBinding({key:"Delete"},{collapsed:!0,suffix:/^.?$/},this.handleDelete)),this.addBinding({key:"Backspace"},{collapsed:!1},this.handleDeleteRange),this.addBinding({key:"Delete"},{collapsed:!1},this.handleDeleteRange),this.addBinding({key:"Backspace",altKey:null,ctrlKey:null,metaKey:null,shiftKey:null},{collapsed:!0,offset:0},this.handleBackspace),this.listen()}addBinding(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=function(e){if("string"==typeof e||"number"==typeof e)e={key:e};else{if("object"!=typeof e)return null;e=as(e)}e.shortKey&&(e[il]=e.shortKey,delete e.shortKey);return e}(e);if(null==r)return void sl.warn("Attempted to add invalid keyboard binding",r);"function"==typeof t&&(t={handler:t}),"function"==typeof n&&(n={handler:n});(Array.isArray(r.key)?r.key:[r.key]).forEach(e=>{const s={...r,key:e,...t,...n};this.bindings[s.key]=this.bindings[s.key]||[],this.bindings[s.key].push(s)})}listen(){this.quill.root.addEventListener("keydown",e=>{if(e.defaultPrevented||e.isComposing)return;if(229===e.keyCode&&("Enter"===e.key||"Backspace"===e.key))return;const t=(this.bindings[e.key]||[]).concat(this.bindings[e.which]||[]).filter(t=>ol.match(e,t));if(0===t.length)return;const n=So.find(e.target,!0);if(n&&n.scroll!==this.quill.scroll)return;const r=this.quill.getSelection();if(null==r||!this.quill.hasFocus())return;const[s,i]=this.quill.getLine(r.index),[o,l]=this.quill.getLeaf(r.index),[a,c]=0===r.length?[o,l]:this.quill.getLeaf(r.index+r.length),u=o instanceof li?o.value().slice(0,l):"",d=a instanceof li?a.value().slice(c):"",h={collapsed:0===r.length,empty:0===r.length&&s.length()<=1,format:this.quill.getFormat(r),line:s,offset:i,prefix:u,suffix:d,event:e};t.some(e=>{if(null!=e.collapsed&&e.collapsed!==h.collapsed)return!1;if(null!=e.empty&&e.empty!==h.empty)return!1;if(null!=e.offset&&e.offset!==h.offset)return!1;if(Array.isArray(e.format)){if(e.format.every(e=>null==h.format[e]))return!1}else if("object"==typeof e.format&&!Object.keys(e.format).every(t=>!0===e.format[t]?null!=h.format[t]:!1===e.format[t]?null==h.format[t]:_s(e.format[t],h.format[t])))return!1;return!(null!=e.prefix&&!e.prefix.test(h.prefix))&&(!(null!=e.suffix&&!e.suffix.test(h.suffix))&&!0!==e.handler.call(this,r,h,e))})&&e.preventDefault()})}handleBackspace(e,t){const n=/[\uD800-\uDBFF][\uDC00-\uDFFF]$/.test(t.prefix)?2:1;if(0===e.index||this.quill.getLength()<=1)return;let r={};const[s]=this.quill.getLine(e.index);let i=(new ji).retain(e.index-n).delete(n);if(0===t.offset){const[t]=this.quill.getLine(e.index-1);if(t){if(!("block"===t.statics.blotName&&t.length()<=1)){const t=s.formats(),n=this.quill.getFormat(e.index-1,1);if(r=Ci.AttributeMap.diff(t,n)||{},Object.keys(r).length>0){const t=(new ji).retain(e.index+s.length()-2).retain(1,r);i=i.compose(t)}}}}this.quill.updateContents(i,So.sources.USER),this.quill.focus()}handleDelete(e,t){const n=/^[\uD800-\uDBFF][\uDC00-\uDFFF]/.test(t.suffix)?2:1;if(e.index>=this.quill.getLength()-n)return;let r={};const[s]=this.quill.getLine(e.index);let i=(new ji).retain(e.index).delete(n);if(t.offset>=s.length()-1){const[t]=this.quill.getLine(e.index+1);if(t){const n=s.formats(),o=this.quill.getFormat(e.index,1);r=Ci.AttributeMap.diff(n,o)||{},Object.keys(r).length>0&&(i=i.retain(t.length()-1).retain(1,r))}}this.quill.updateContents(i,So.sources.USER),this.quill.focus()}handleDeleteRange(e){hl({range:e,quill:this.quill}),this.quill.focus()}handleEnter(e,t){const n=Object.keys(t.format).reduce((e,n)=>(this.quill.scroll.query(n,Ls.BLOCK)&&!Array.isArray(t.format[n])&&(e[n]=t.format[n]),e),{}),r=(new ji).retain(e.index).delete(e.length).insert("\n",n);this.quill.updateContents(r,So.sources.USER),this.quill.setSelection(e.index+1,So.sources.SILENT),this.quill.focus()}}const ll={bindings:{bold:ul("bold"),italic:ul("italic"),underline:ul("underline"),indent:{key:"Tab",format:["blockquote","indent","list"],handler(e,t){return!(!t.collapsed||0===t.offset)||(this.quill.format("indent","+1",So.sources.USER),!1)}},outdent:{key:"Tab",shiftKey:!0,format:["blockquote","indent","list"],handler(e,t){return!(!t.collapsed||0===t.offset)||(this.quill.format("indent","-1",So.sources.USER),!1)}},"outdent backspace":{key:"Backspace",collapsed:!0,shiftKey:null,metaKey:null,ctrlKey:null,altKey:null,format:["indent","list"],offset:0,handler(e,t){null!=t.format.indent?this.quill.format("indent","-1",So.sources.USER):null!=t.format.list&&this.quill.format("list",!1,So.sources.USER)}},"indent code-block":al(!0),"outdent code-block":al(!1),"remove tab":{key:"Tab",shiftKey:!0,collapsed:!0,prefix:/\t$/,handler(e){this.quill.deleteText(e.index-1,1,So.sources.USER)}},tab:{key:"Tab",handler(e,t){if(t.format.table)return!0;this.quill.history.cutoff();const n=(new ji).retain(e.index).delete(e.length).insert("\t");return this.quill.updateContents(n,So.sources.USER),this.quill.history.cutoff(),this.quill.setSelection(e.index+1,So.sources.SILENT),!1}},"blockquote empty enter":{key:"Enter",collapsed:!0,format:["blockquote"],empty:!0,handler(){this.quill.format("blockquote",!1,So.sources.USER)}},"list empty enter":{key:"Enter",collapsed:!0,format:["list"],empty:!0,handler(e,t){const n={list:!1};t.format.indent&&(n.indent=!1),this.quill.formatLine(e.index,e.length,n,So.sources.USER)}},"checklist enter":{key:"Enter",collapsed:!0,format:{list:"checked"},handler(e){const[t,n]=this.quill.getLine(e.index),r={...t.formats(),list:"checked"},s=(new ji).retain(e.index).insert("\n",r).retain(t.length()-n-1).retain(1,{list:"unchecked"});this.quill.updateContents(s,So.sources.USER),this.quill.setSelection(e.index+1,So.sources.SILENT),this.quill.scrollSelectionIntoView()}},"header enter":{key:"Enter",collapsed:!0,format:["header"],suffix:/^$/,handler(e,t){const[n,r]=this.quill.getLine(e.index),s=(new ji).retain(e.index).insert("\n",t.format).retain(n.length()-r-1).retain(1,{header:null});this.quill.updateContents(s,So.sources.USER),this.quill.setSelection(e.index+1,So.sources.SILENT),this.quill.scrollSelectionIntoView()}},"table backspace":{key:"Backspace",format:["table"],collapsed:!0,offset:0,handler(){}},"table delete":{key:"Delete",format:["table"],collapsed:!0,suffix:/^$/,handler(){}},"table enter":{key:"Enter",shiftKey:null,format:["table"],handler(e){const t=this.quill.getModule("table");if(t){const[n,r,s,i]=t.getTable(e),o=function(e,t,n,r){if(null==t.prev&&null==t.next)return null==n.prev&&null==n.next?0===r?-1:1:null==n.prev?-1:1;if(null==t.prev)return-1;if(null==t.next)return 1;return null}(0,r,s,i);if(null==o)return;let l=n.offset();if(o<0){const t=(new ji).retain(l).insert("\n");this.quill.updateContents(t,So.sources.USER),this.quill.setSelection(e.index+1,e.length,So.sources.SILENT)}else if(o>0){l+=n.length();const e=(new ji).retain(l).insert("\n");this.quill.updateContents(e,So.sources.USER),this.quill.setSelection(l,So.sources.USER)}}}},"table tab":{key:"Tab",shiftKey:null,format:["table"],handler(e,t){const{event:n,line:r}=t,s=r.offset(this.quill.scroll);n.shiftKey?this.quill.setSelection(s-1,So.sources.USER):this.quill.setSelection(s+r.length(),So.sources.USER)}},"list autofill":{key:" ",shiftKey:null,collapsed:!0,format:{"code-block":!1,blockquote:!1,table:!1},prefix:/^\s*?(\d+\.|-|\*|\[ ?\]|\[x\])$/,handler(e,t){if(null==this.quill.scroll.query("list"))return!0;const{length:n}=t.prefix,[r,s]=this.quill.getLine(e.index);if(s>n)return!0;let i;switch(t.prefix.trim()){case"[]":case"[ ]":i="unchecked";break;case"[x]":i="checked";break;case"-":case"*":i="bullet";break;default:i="ordered"}this.quill.insertText(e.index," ",So.sources.USER),this.quill.history.cutoff();const o=(new ji).retain(e.index-s).delete(n+1).retain(r.length()-2-s).retain(1,{list:i});return this.quill.updateContents(o,So.sources.USER),this.quill.history.cutoff(),this.quill.setSelection(e.index-n,So.sources.SILENT),!1}},"code exit":{key:"Enter",collapsed:!0,format:["code-block"],prefix:/^$/,suffix:/^\s*$/,handler(e){const[t,n]=this.quill.getLine(e.index);let r=2,s=t;for(;null!=s&&s.length()<=1&&s.formats()["code-block"];)if(s=s.prev,r-=1,r<=0){const r=(new ji).retain(e.index+t.length()-n-2).retain(1,{"code-block":null}).delete(1);return this.quill.updateContents(r,So.sources.USER),this.quill.setSelection(e.index-1,So.sources.SILENT),!1}return!0}},"embed left":cl("ArrowLeft",!1),"embed left shift":cl("ArrowLeft",!0),"embed right":cl("ArrowRight",!1),"embed right shift":cl("ArrowRight",!0),"table down":dl(!1),"table up":dl(!0)}};function al(e){return{key:"Tab",shiftKey:!e,format:{"code-block":!0},handler(t,n){let{event:r}=n;const s=this.quill.scroll.query("code-block"),{TAB:i}=s;if(0===t.length&&!r.shiftKey)return this.quill.insertText(t.index,i,So.sources.USER),void this.quill.setSelection(t.index+i.length,So.sources.SILENT);const o=0===t.length?this.quill.getLines(t.index,1):this.quill.getLines(t);let{index:l,length:a}=t;o.forEach((t,n)=>{e?(t.insertAt(0,i),0===n?l+=i.length:a+=i.length):t.domNode.textContent.startsWith(i)&&(t.deleteAt(0,i.length),0===n?l-=i.length:a-=i.length)}),this.quill.update(So.sources.USER),this.quill.setSelection(l,a,So.sources.SILENT)}}}function cl(e,t){const n="ArrowLeft"===e?"prefix":"suffix";return{key:e,shiftKey:t,altKey:null,[n]:/^$/,handler(n){let{index:r}=n;"ArrowRight"===e&&(r+=n.length+1);const[s]=this.quill.getLeaf(r);return!(s instanceof ni)||("ArrowLeft"===e?t?this.quill.setSelection(n.index-1,n.length+1,So.sources.USER):this.quill.setSelection(n.index-1,So.sources.USER):t?this.quill.setSelection(n.index,n.length+1,So.sources.USER):this.quill.setSelection(n.index+n.length+1,So.sources.USER),!1)}}}function ul(e){return{key:e[0],shortKey:!0,handler(t,n){this.quill.format(e,!n.format[e],So.sources.USER)}}}function dl(e){return{key:e?"ArrowUp":"ArrowDown",collapsed:!0,format:["table"],handler(t,n){const r=e?"prev":"next",s=n.line,i=s.parent[r];if(null!=i){if("table-row"===i.statics.blotName){let e=i.children.head,t=s;for(;null!=t.prev;)t=t.prev,e=e.next;const r=e.offset(this.quill.scroll)+Math.min(n.offset,e.length()-1);this.quill.setSelection(r,0,So.sources.USER)}}else{const t=s.table()[r];null!=t&&(e?this.quill.setSelection(t.offset(this.quill.scroll)+t.length()-1,0,So.sources.USER):this.quill.setSelection(t.offset(this.quill.scroll),0,So.sources.USER))}return!1}}}function hl(e){let{quill:t,range:n}=e;const r=t.getLines(n);let s={};if(r.length>1){const e=r[0].formats(),t=r[r.length-1].formats();s=Ci.AttributeMap.diff(t,e)||{}}t.deleteText(n,So.sources.USER),Object.keys(s).length>0&&t.formatLine(n.index,1,s,So.sources.USER),t.setSelection(n.index,So.sources.SILENT)}ol.DEFAULTS=ll;const fl=/font-weight:\s*normal/,pl=["P","OL","UL"],ml=e=>e&&pl.includes(e.tagName);const gl=/\bmso-list:[^;]*ignore/i,vl=/\bmso-list:[^;]*\bl(\d+)/i,bl=/\bmso-list:[^;]*\blevel(\d+)/i,yl=e=>{var t,n;const r=Array.from(e.querySelectorAll("[style*=mso-list]")),s=[],i=[];r.forEach(e=>{(e.getAttribute("style")||"").match(gl)?s.push(e):i.push(e)}),s.forEach(e=>{var t;return null==(t=e.parentNode)?void 0:t.removeChild(e)});const o=e.documentElement.innerHTML,l=i.map(e=>((e,t)=>{const n=e.getAttribute("style"),r=null==n?void 0:n.match(vl);if(!r)return null;const s=Number(r[1]),i=null==n?void 0:n.match(bl),o=i?Number(i[1]):1,l=new RegExp(`@list l${s}:level${o}\\s*\\{[^\\}]*mso-level-number-format:\\s*([\\w-]+)`,"i"),a=t.match(l);return{id:s,indent:o,type:a&&"bullet"===a[1]?"bullet":"ordered",element:e}})(e,o)).filter(e=>e);for(;l.length;){const e=[];let r=l.shift();for(;r;)e.push(r),r=l.length&&(null==(t=l[0])?void 0:t.element)===r.element.nextElementSibling&&l[0].id===r.id?l.shift():null;const s=document.createElement("ul");e.forEach(e=>{const t=document.createElement("li");t.setAttribute("data-list",e.type),e.indent>1&&t.setAttribute("class","ql-indent-"+(e.indent-1)),t.innerHTML=e.element.innerHTML,s.appendChild(t)});const i=null==(n=e[0])?void 0:n.element,{parentNode:o}=i??{};i&&(null==o||o.replaceChild(s,i)),e.slice(1).forEach(e=>{let{element:t}=e;null==o||o.removeChild(t)})}};const xl=[function(e){"urn:schemas-microsoft-com:office:word"===e.documentElement.getAttribute("xmlns:w")&&yl(e)},function(e){e.querySelector('[id^="docs-internal-guid-"]')&&((e=>{Array.from(e.querySelectorAll('b[style*="font-weight"]')).filter(e=>{var t;return null==(t=e.getAttribute("style"))?void 0:t.match(fl)}).forEach(t=>{var n;const r=e.createDocumentFragment();r.append(...t.childNodes),null==(n=t.parentNode)||n.replaceChild(r,t)})})(e),(e=>{Array.from(e.querySelectorAll("br")).filter(e=>ml(e.previousElementSibling)&&ml(e.nextElementSibling)).forEach(e=>{var t;null==(t=e.parentNode)||t.removeChild(e)})})(e))}],wl=Zi("quill:clipboard"),Nl=[[Node.TEXT_NODE,function(e,t,n){var r;let s=e.data;if("O:P"===(null==(r=e.parentElement)?void 0:r.tagName))return t.insert(s.trim());if(!Ol(e)){if(0===s.trim().length&&s.includes("\n")&&!function(e,t){return e.previousElementSibling&&e.nextElementSibling&&!jl(e.previousElementSibling,t)&&!jl(e.nextElementSibling,t)}(e,n))return t;s=s.replace(/[^\S\u00a0]/g," "),s=s.replace(/ {2,}/g," "),(null==e.previousSibling&&null!=e.parentElement&&jl(e.parentElement,n)||e.previousSibling instanceof Element&&jl(e.previousSibling,n))&&(s=s.replace(/^ /,"")),(null==e.nextSibling&&null!=e.parentElement&&jl(e.parentElement,n)||e.nextSibling instanceof Element&&jl(e.nextSibling,n))&&(s=s.replace(/ $/,"")),s=s.replaceAll(" "," ")}return t.insert(s)}],[Node.TEXT_NODE,ql],["br",function(e,t){Cl(t,"\n")||t.insert("\n");return t}],[Node.ELEMENT_NODE,ql],[Node.ELEMENT_NODE,function(e,t,n){const r=n.query(e);if(null==r)return t;if(r.prototype instanceof ni){const t={},s=r.value(e);if(null!=s)return t[r.blotName]=s,(new ji).insert(t,r.formats(e,n))}else if(r.prototype instanceof Qs&&!Cl(t,"\n")&&t.insert("\n"),"blotName"in r&&"formats"in r&&"function"==typeof r.formats)return Al(t,r.blotName,r.formats(e,n),n);return t}],[Node.ELEMENT_NODE,function(e,t,n){const r=qs.keys(e),s=Ds.keys(e),i=Fs.keys(e),o={};return r.concat(s).concat(i).forEach(t=>{let r=n.query(t,Ls.ATTRIBUTE);null!=r&&(o[r.attrName]=r.value(e),o[r.attrName])||(r=El[t],null==r||r.attrName!==t&&r.keyName!==t||(o[r.attrName]=r.value(e)||void 0),r=kl[t],null==r||r.attrName!==t&&r.keyName!==t||(r=kl[t],o[r.attrName]=r.value(e)||void 0))}),Object.entries(o).reduce((e,t)=>{let[r,s]=t;return Al(e,r,s,n)},t)}],[Node.ELEMENT_NODE,function(e,t,n){var r;const s={},i=e.style||{};"italic"===i.fontStyle&&(s.italic=!0);"underline"===i.textDecoration&&(s.underline=!0);"line-through"===i.textDecoration&&(s.strike=!0);((null==(r=i.fontWeight)?void 0:r.startsWith("bold"))||parseInt(i.fontWeight,10)>=700)&&(s.bold=!0);if(t=Object.entries(s).reduce((e,t)=>{let[r,s]=t;return Al(e,r,s,n)},t),parseFloat(i.textIndent||0)>0)return(new ji).insert("\t").concat(t);return t}],["li",function(e,t,n){const r=n.query(e);if(null==r||"list"!==r.blotName||!Cl(t,"\n"))return t;let s=-1,i=e.parentNode;for(;null!=i;)["OL","UL"].includes(i.tagName)&&(s+=1),i=i.parentNode;return s<=0?t:t.reduce((e,t)=>t.insert?t.attributes&&"number"==typeof t.attributes.indent?e.push(t):e.insert(t.insert,{indent:s,...t.attributes||{}}):e,new ji)}],["ol, ul",function(e,t,n){const r=e;let s="OL"===r.tagName?"ordered":"bullet";const i=r.getAttribute("data-checked");i&&(s="true"===i?"checked":"unchecked");return Al(t,"list",s,n)}],["pre",function(e,t,n){const r=n.query("code-block"),s=!r||!("formats"in r)||"function"!=typeof r.formats||r.formats(e,n);return Al(t,"code-block",s,n)}],["tr",function(e,t,n){var r,s;const i="TABLE"===(null==(r=e.parentElement)?void 0:r.tagName)?e.parentElement:null==(s=e.parentElement)?void 0:s.parentElement;if(null!=i){return Al(t,"table",Array.from(i.querySelectorAll("tr")).indexOf(e)+1,n)}return t}],["b",Ll("bold")],["i",Ll("italic")],["strike",Ll("strike")],["style",function(){return new ji}]],El=[Do,Yo].reduce((e,t)=>(e[t.keyName]=t,e),{}),kl=[Fo,Ho,$o,Xo,tl,rl].reduce((e,t)=>(e[t.keyName]=t,e),{});class Sl extends uo{constructor(e,t){super(e,t),this.quill.root.addEventListener("copy",e=>this.onCaptureCopy(e,!1)),this.quill.root.addEventListener("cut",e=>this.onCaptureCopy(e,!0)),this.quill.root.addEventListener("paste",this.onCapturePaste.bind(this)),this.matchers=[],Nl.concat(this.options.matchers??[]).forEach(e=>{let[t,n]=e;this.addMatcher(t,n)})}addMatcher(e,t){this.matchers.push([e,t])}convert(e){let{html:t,text:n}=e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(r[Wo.blotName])return(new ji).insert(n||"",{[Wo.blotName]:r[Wo.blotName]});if(!t)return(new ji).insert(n||"",r);const s=this.convertHTML(t);return Cl(s,"\n")&&(null==s.ops[s.ops.length-1].attributes||r.table)?s.compose((new ji).retain(s.length()-1).delete(1)):s}normalizeHTML(e){(e=>{e.documentElement&&xl.forEach(t=>{t(e)})})(e)}convertHTML(e){const t=(new DOMParser).parseFromString(e,"text/html");this.normalizeHTML(t);const n=t.body,r=new WeakMap,[s,i]=this.prepareMatching(n,r);return Tl(this.quill.scroll,n,s,i,r)}dangerouslyPasteHTML(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:So.sources.API;if("string"==typeof e){const n=this.convert({html:e,text:""});this.quill.setContents(n,t),this.quill.setSelection(0,So.sources.SILENT)}else{const r=this.convert({html:t,text:""});this.quill.updateContents((new ji).retain(e).concat(r),n),this.quill.setSelection(e+r.length(),So.sources.SILENT)}}onCaptureCopy(e){var t,n;let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(e.defaultPrevented)return;e.preventDefault();const[s]=this.quill.selection.getRange();if(null==s)return;const{html:i,text:o}=this.onCopy(s,r);null==(t=e.clipboardData)||t.setData("text/plain",o),null==(n=e.clipboardData)||n.setData("text/html",i),r&&hl({range:s,quill:this.quill})}normalizeURIList(e){return e.split(/\r?\n/).filter(e=>"#"!==e[0]).join("\n")}onCapturePaste(e){var t,n,r,s,i;if(e.defaultPrevented||!this.quill.isEnabled())return;e.preventDefault();const o=this.quill.getSelection(!0);if(null==o)return;const l=null==(t=e.clipboardData)?void 0:t.getData("text/html");let a=null==(n=e.clipboardData)?void 0:n.getData("text/plain");if(!l&&!a){const t=null==(r=e.clipboardData)?void 0:r.getData("text/uri-list");t&&(a=this.normalizeURIList(t))}const c=Array.from((null==(s=e.clipboardData)?void 0:s.files)||[]);if(!l&&c.length>0)this.quill.uploader.upload(o,c);else{if(l&&c.length>0){const e=(new DOMParser).parseFromString(l,"text/html");if(1===e.body.childElementCount&&"IMG"===(null==(i=e.body.firstElementChild)?void 0:i.tagName))return void this.quill.uploader.upload(o,c)}this.onPaste(o,{html:l,text:a})}}onCopy(e){const t=this.quill.getText(e);return{html:this.quill.getSemanticHTML(e),text:t}}onPaste(e,t){let{text:n,html:r}=t;const s=this.quill.getFormat(e.index),i=this.convert({text:n,html:r},s);wl.log("onPaste",i,{text:n,html:r});const o=(new ji).retain(e.index).delete(e.length).concat(i);this.quill.updateContents(o,So.sources.USER),this.quill.setSelection(o.length()-e.length,So.sources.SILENT),this.quill.scrollSelectionIntoView()}prepareMatching(e,t){const n=[],r=[];return this.matchers.forEach(s=>{const[i,o]=s;switch(i){case Node.TEXT_NODE:r.push(o);break;case Node.ELEMENT_NODE:n.push(o);break;default:Array.from(e.querySelectorAll(i)).forEach(e=>{if(t.has(e)){const n=t.get(e);null==n||n.push(o)}else t.set(e,[o])})}}),[n,r]}}function Al(e,t,n,r){return r.query(t)?e.reduce((e,r)=>{if(!r.insert)return e;if(r.attributes&&r.attributes[t])return e.push(r);const s=n?{[t]:n}:{};return e.insert(r.insert,{...s,...r.attributes})},new ji):e}function Cl(e,t){let n="";for(let r=e.ops.length-1;r>=0&&n.length<t.length;--r){const t=e.ops[r];if("string"!=typeof t.insert)break;n=t.insert+n}return n.slice(-1*t.length)===t}function jl(e,t){if(!(e instanceof Element))return!1;const n=t.query(e);return!(n&&n.prototype instanceof ni)&&["address","article","blockquote","canvas","dd","div","dl","dt","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","iframe","li","main","nav","ol","output","p","pre","section","table","td","tr","ul","video"].includes(e.tagName.toLowerCase())}t(Sl,"DEFAULTS",{matchers:[]});const _l=new WeakMap;function Ol(e){return null!=e&&(_l.has(e)||("PRE"===e.tagName?_l.set(e,!0):_l.set(e,Ol(e.parentNode))),_l.get(e))}function Tl(e,t,n,r,s){return t.nodeType===t.TEXT_NODE?r.reduce((n,r)=>r(t,n,e),new ji):t.nodeType===t.ELEMENT_NODE?Array.from(t.childNodes||[]).reduce((i,o)=>{let l=Tl(e,o,n,r,s);return o.nodeType===t.ELEMENT_NODE&&(l=n.reduce((t,n)=>n(o,t,e),l),l=(s.get(o)||[]).reduce((t,n)=>n(o,t,e),l)),i.concat(l)},new ji):new ji}function Ll(e){return(t,n,r)=>Al(n,e,!0,r)}function ql(e,t,n){if(!Cl(t,"\n")){if(jl(e,n)&&(e.childNodes.length>0||e instanceof HTMLParagraphElement))return t.insert("\n");if(t.length()>0&&e.nextSibling){let r=e.nextSibling;for(;null!=r;){if(jl(r,n))return t.insert("\n");const e=n.query(r);if(e&&e.prototype instanceof Mi)return t.insert("\n");r=r.firstChild}}}return t}class Il extends uo{constructor(e,n){super(e,n),t(this,"lastRecorded",0),t(this,"ignoreChange",!1),t(this,"stack",{undo:[],redo:[]}),t(this,"currentRange",null),this.quill.on(So.events.EDITOR_CHANGE,(e,t,n,r)=>{e===So.events.SELECTION_CHANGE?t&&r!==So.sources.SILENT&&(this.currentRange=t):e===So.events.TEXT_CHANGE&&(this.ignoreChange||(this.options.userOnly&&r!==So.sources.USER?this.transform(t):this.record(t,n)),this.currentRange=Ml(this.currentRange,t))}),this.quill.keyboard.addBinding({key:"z",shortKey:!0},this.undo.bind(this)),this.quill.keyboard.addBinding({key:["z","Z"],shortKey:!0,shiftKey:!0},this.redo.bind(this)),/Win/i.test(navigator.platform)&&this.quill.keyboard.addBinding({key:"y",shortKey:!0},this.redo.bind(this)),this.quill.root.addEventListener("beforeinput",e=>{"historyUndo"===e.inputType?(this.undo(),e.preventDefault()):"historyRedo"===e.inputType&&(this.redo(),e.preventDefault())})}change(e,t){if(0===this.stack[e].length)return;const n=this.stack[e].pop();if(!n)return;const r=this.quill.getContents(),s=n.delta.invert(r);this.stack[t].push({delta:s,range:Ml(n.range,s)}),this.lastRecorded=0,this.ignoreChange=!0,this.quill.updateContents(n.delta,So.sources.USER),this.ignoreChange=!1,this.restoreSelection(n)}clear(){this.stack={undo:[],redo:[]}}cutoff(){this.lastRecorded=0}record(e,t){if(0===e.ops.length)return;this.stack.redo=[];let n=e.invert(t),r=this.currentRange;const s=Date.now();if(this.lastRecorded+this.options.delay>s&&this.stack.undo.length>0){const e=this.stack.undo.pop();e&&(n=n.compose(e.delta),r=e.range)}else this.lastRecorded=s;0!==n.length()&&(this.stack.undo.push({delta:n,range:r}),this.stack.undo.length>this.options.maxStack&&this.stack.undo.shift())}redo(){this.change("redo","undo")}transform(e){Rl(this.stack.undo,e),Rl(this.stack.redo,e)}undo(){this.change("undo","redo")}restoreSelection(e){if(e.range)this.quill.setSelection(e.range,So.sources.USER);else{const t=function(e,t){const n=t.reduce((e,t)=>e+(t.delete||0),0);let r=t.length()-n;(function(e,t){const n=t.ops[t.ops.length-1];if(null==n)return!1;if(null!=n.insert)return"string"==typeof n.insert&&n.insert.endsWith("\n");if(null!=n.attributes)return Object.keys(n.attributes).some(t=>null!=e.query(t,Ls.BLOCK));return!1})(e,t)&&(r-=1);return r}(this.quill.scroll,e.delta);this.quill.setSelection(t,So.sources.USER)}}}function Rl(e,t){let n=t;for(let r=e.length-1;r>=0;r-=1){const t=e[r];e[r]={delta:n.transform(t.delta,!0),range:t.range&&Ml(t.range,n)},n=t.delta.transform(n),0===e[r].delta.length()&&e.splice(r,1)}}function Ml(e,t){if(!e)return e;const n=t.transformPosition(e.index);return{index:n,length:t.transformPosition(e.index+e.length)-n}}t(Il,"DEFAULTS",{delay:1e3,maxStack:100,userOnly:!1});class Bl extends uo{constructor(e,t){super(e,t),e.root.addEventListener("drop",t=>{var n;t.preventDefault();let r=null;if(document.caretRangeFromPoint)r=document.caretRangeFromPoint(t.clientX,t.clientY);else if(document.caretPositionFromPoint){const e=document.caretPositionFromPoint(t.clientX,t.clientY);r=document.createRange(),r.setStart(e.offsetNode,e.offset),r.setEnd(e.offsetNode,e.offset)}const s=r&&e.selection.normalizeNative(r);if(s){const r=e.selection.normalizedToRange(s);(null==(n=t.dataTransfer)?void 0:n.files)&&this.upload(r,t.dataTransfer.files)}})}upload(e,t){const n=[];Array.from(t).forEach(e=>{var t;e&&(null==(t=this.options.mimetypes)?void 0:t.includes(e.type))&&n.push(e)}),n.length>0&&this.options.handler.call(this,e,n)}}Bl.DEFAULTS={mimetypes:["image/png","image/jpeg"],handler(e,t){if(!this.quill.scroll.query("image"))return;const n=t.map(e=>new Promise(t=>{const n=new FileReader;n.onload=()=>{t(n.result)},n.readAsDataURL(e)}));Promise.all(n).then(t=>{const n=t.reduce((e,t)=>e.insert({image:t}),(new ji).retain(e.index).delete(e.length));this.quill.updateContents(n,Ji.sources.USER),this.quill.setSelection(e.index+t.length,Ji.sources.SILENT)})}};const Dl=["insertText","insertReplacementText"];const Pl=/Mac/i.test(navigator.platform);So.register({"blots/block":Ri,"blots/block/embed":Mi,"blots/break":_i,"blots/container":Lo,"blots/cursor":Fi,"blots/embed":fo,"blots/inline":Ii,"blots/scroll":Ro,"blots/text":Oi,"modules/clipboard":Sl,"modules/history":Il,"modules/keyboard":ol,"modules/uploader":Bl,"modules/input":class extends uo{constructor(e,t){super(e,t),e.root.addEventListener("beforeinput",e=>{this.handleBeforeInput(e)}),/Android/i.test(navigator.userAgent)||e.on(So.events.COMPOSITION_BEFORE_START,()=>{this.handleCompositionStart()})}deleteRange(e){hl({range:e,quill:this.quill})}replaceText(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(0===e.length)return!1;if(t){const n=this.quill.getFormat(e.index,1);this.deleteRange(e),this.quill.updateContents((new ji).retain(e.index).insert(t,n),So.sources.USER)}else this.deleteRange(e);return this.quill.setSelection(e.index+t.length,0,So.sources.SILENT),!0}handleBeforeInput(e){if(this.quill.composition.isComposing||e.defaultPrevented||!Dl.includes(e.inputType))return;const t=e.getTargetRanges?e.getTargetRanges()[0]:null;if(!t||!0===t.collapsed)return;const n=function(e){var t;if("string"==typeof e.data)return e.data;if(null==(t=e.dataTransfer)?void 0:t.types.includes("text/plain"))return e.dataTransfer.getData("text/plain");return null}(e);if(null==n)return;const r=this.quill.selection.normalizeNative(t),s=r?this.quill.selection.normalizedToRange(r):null;s&&this.replaceText(s,n)&&e.preventDefault()}handleCompositionStart(){const e=this.quill.getSelection();e&&this.replaceText(e)}},"modules/uiNode":class extends uo{constructor(e,n){super(e,n),t(this,"isListening",!1),t(this,"selectionChangeDeadline",0),this.handleArrowKeys(),this.handleNavigationShortcuts()}handleArrowKeys(){this.quill.keyboard.addBinding({key:["ArrowLeft","ArrowRight"],offset:0,shiftKey:null,handler(e,t){let{line:n,event:r}=t;if(!(n instanceof Zs&&n.uiNode))return!0;const s="rtl"===getComputedStyle(n.domNode).direction;return!!(s&&"ArrowRight"!==r.key||!s&&"ArrowLeft"!==r.key)||(this.quill.setSelection(e.index-1,e.length+(r.shiftKey?1:0),So.sources.USER),!1)}})}handleNavigationShortcuts(){this.quill.root.addEventListener("keydown",e=>{!e.defaultPrevented&&(e=>"ArrowLeft"===e.key||"ArrowRight"===e.key||"ArrowUp"===e.key||"ArrowDown"===e.key||"Home"===e.key||!(!Pl||"a"!==e.key||!0!==e.ctrlKey))(e)&&this.ensureListeningToSelectionChange()})}ensureListeningToSelectionChange(){if(this.selectionChangeDeadline=Date.now()+100,this.isListening)return;this.isListening=!0;document.addEventListener("selectionchange",()=>{this.isListening=!1,Date.now()<=this.selectionChangeDeadline&&this.handleSelectionChange()},{once:!0})}handleSelectionChange(){const e=document.getSelection();if(!e)return;const t=e.getRangeAt(0);if(!0!==t.collapsed||0!==t.startOffset)return;const n=this.quill.scroll.find(t.startContainer);if(!(n instanceof Zs&&n.uiNode))return;const r=document.createRange();r.setStartAfter(n.uiNode),r.setEndAfter(n.uiNode),e.removeAllRanges(),e.addRange(r)}}});const Fl=new class extends Ds{add(e,t){let n=0;if("+1"===t||"-1"===t){const r=this.value(e)||0;n="+1"===t?r+1:r-1}else"number"==typeof t&&(n=t);return 0===n?(this.remove(e),!0):super.add(e,n.toString())}canAdd(e,t){return super.canAdd(e,t)||super.canAdd(e,parseInt(t,10))}value(e){return parseInt(super.value(e),10)||void 0}}("indent","ql-indent",{scope:Ls.BLOCK,whitelist:[1,2,3,4,5,6,7,8]});class Ul extends Ri{}t(Ul,"blotName","blockquote"),t(Ul,"tagName","blockquote");class zl extends Ri{static formats(e){return this.tagName.indexOf(e.tagName)+1}}t(zl,"blotName","header"),t(zl,"tagName",["H1","H2","H3","H4","H5","H6"]);class $l extends Lo{}$l.blotName="list-container",$l.tagName="OL";class Vl extends Ri{static create(e){const t=super.create();return t.setAttribute("data-list",e),t}static formats(e){return e.getAttribute("data-list")||void 0}static register(){So.register($l)}constructor(e,t){super(e,t);const n=t.ownerDocument.createElement("span"),r=n=>{if(!e.isEnabled())return;const r=this.statics.formats(t,e);"checked"===r?(this.format("list","unchecked"),n.preventDefault()):"unchecked"===r&&(this.format("list","checked"),n.preventDefault())};n.addEventListener("mousedown",r),n.addEventListener("touchstart",r),this.attachUI(n)}format(e,t){e===this.statics.blotName&&t?this.domNode.setAttribute("data-list",t):super.format(e,t)}}Vl.blotName="list",Vl.tagName="LI",$l.allowedChildren=[Vl],Vl.requiredContainer=$l;class Hl extends Ii{static create(){return super.create()}static formats(){return!0}optimize(e){super.optimize(e),this.domNode.tagName!==this.statics.tagName[0]&&this.replaceWith(this.statics.blotName)}}t(Hl,"blotName","bold"),t(Hl,"tagName",["STRONG","B"]);class Kl extends Hl{}t(Kl,"blotName","italic"),t(Kl,"tagName",["EM","I"]);class Wl extends Ii{static create(e){const t=super.create(e);return t.setAttribute("href",this.sanitize(e)),t.setAttribute("rel","noopener noreferrer"),t.setAttribute("target","_blank"),t}static formats(e){return e.getAttribute("href")}static sanitize(e){return Gl(e,this.PROTOCOL_WHITELIST)?e:this.SANITIZED_URL}format(e,t){e===this.statics.blotName&&t?this.domNode.setAttribute("href",this.constructor.sanitize(t)):super.format(e,t)}}function Gl(e,t){const n=document.createElement("a");n.href=e;const r=n.href.slice(0,n.href.indexOf(":"));return t.indexOf(r)>-1}t(Wl,"blotName","link"),t(Wl,"tagName","A"),t(Wl,"SANITIZED_URL","about:blank"),t(Wl,"PROTOCOL_WHITELIST",["http","https","mailto","tel","sms"]);class Zl extends Ii{static create(e){return"super"===e?document.createElement("sup"):"sub"===e?document.createElement("sub"):super.create(e)}static formats(e){return"SUB"===e.tagName?"sub":"SUP"===e.tagName?"super":void 0}}t(Zl,"blotName","script"),t(Zl,"tagName",["SUB","SUP"]);class Yl extends Hl{}t(Yl,"blotName","strike"),t(Yl,"tagName",["S","STRIKE"]);class Jl extends Ii{}t(Jl,"blotName","underline"),t(Jl,"tagName","U");class Xl extends fo{static create(e){if(null==window.katex)throw new Error("Formula module requires KaTeX.");const t=super.create(e);return"string"==typeof e&&(window.katex.render(e,t,{throwOnError:!1,errorColor:"#f00"}),t.setAttribute("data-value",e)),t}static value(e){return e.getAttribute("data-value")}html(){const{formula:e}=this.value();return`<span>${e}</span>`}}t(Xl,"blotName","formula"),t(Xl,"className","ql-formula"),t(Xl,"tagName","SPAN");const Ql=["alt","height","width"];class ea extends ni{static create(e){const t=super.create(e);return"string"==typeof e&&t.setAttribute("src",this.sanitize(e)),t}static formats(e){return Ql.reduce((t,n)=>(e.hasAttribute(n)&&(t[n]=e.getAttribute(n)),t),{})}static match(e){return/\.(jpe?g|gif|png)$/.test(e)||/^data:image\/.+;base64/.test(e)}static sanitize(e){return Gl(e,["http","https","data"])?e:"//:0"}static value(e){return e.getAttribute("src")}format(e,t){Ql.indexOf(e)>-1?t?this.domNode.setAttribute(e,t):this.domNode.removeAttribute(e):super.format(e,t)}}t(ea,"blotName","image"),t(ea,"tagName","IMG");const ta=["height","width"];class na extends Mi{static create(e){const t=super.create(e);return t.setAttribute("frameborder","0"),t.setAttribute("allowfullscreen","true"),t.setAttribute("src",this.sanitize(e)),t}static formats(e){return ta.reduce((t,n)=>(e.hasAttribute(n)&&(t[n]=e.getAttribute(n)),t),{})}static sanitize(e){return Wl.sanitize(e)}static value(e){return e.getAttribute("src")}format(e,t){ta.indexOf(e)>-1?t?this.domNode.setAttribute(e,t):this.domNode.removeAttribute(e):super.format(e,t)}html(){const{video:e}=this.value();return`<a href="${e}">${e}</a>`}}t(na,"blotName","video"),t(na,"className","ql-video"),t(na,"tagName","IFRAME");const ra=new Ds("code-token","hljs",{scope:Ls.INLINE});class sa extends Ii{static formats(e,t){for(;null!=e&&e!==t.domNode;){if(e.classList&&e.classList.contains(Wo.className))return super.formats(e,t);e=e.parentNode}}constructor(e,t,n){super(e,t,n),ra.add(this.domNode,n)}format(e,t){e!==sa.blotName?super.format(e,t):t?ra.add(this.domNode,t):(ra.remove(this.domNode),this.domNode.classList.remove(this.statics.className))}optimize(){super.optimize(...arguments),ra.value(this.domNode)||this.unwrap()}}sa.blotName="code-token",sa.className="ql-token";class ia extends Wo{static create(e){const t=super.create(e);return"string"==typeof e&&t.setAttribute("data-language",e),t}static formats(e){return e.getAttribute("data-language")||"plain"}static register(){}format(e,t){e===this.statics.blotName&&t?this.domNode.setAttribute("data-language",t):super.format(e,t)}replaceWith(e,t){return this.formatAt(0,this.length(),sa.blotName,!1),super.replaceWith(e,t)}}class oa extends Ko{attach(){super.attach(),this.forceNext=!1,this.scroll.emitMount(this)}format(e,t){e===ia.blotName&&(this.forceNext=!0,this.children.forEach(n=>{n.format(e,t)}))}formatAt(e,t,n,r){n===ia.blotName&&(this.forceNext=!0),super.formatAt(e,t,n,r)}highlight(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(null==this.children.head)return;const n=`${Array.from(this.domNode.childNodes).filter(e=>e!==this.uiNode).map(e=>e.textContent).join("\n")}\n`,r=ia.formats(this.children.head.domNode);if(t||this.forceNext||this.cachedText!==n){if(n.trim().length>0||null==this.cachedText){const t=this.children.reduce((e,t)=>e.concat(Bi(t,!1)),new ji),s=e(n,r);t.diff(s).reduce((e,t)=>{let{retain:n,attributes:r}=t;return n?(r&&Object.keys(r).forEach(t=>{[ia.blotName,sa.blotName].includes(t)&&this.formatAt(e,n,t,r[t])}),e+n):e},0)}this.cachedText=n,this.forceNext=!1}}html(e,t){const[n]=this.children.find(e);return`<pre data-language="${n?ia.formats(n.domNode):"plain"}">\n${Li(this.code(e,t))}\n</pre>`}optimize(e){if(super.optimize(e),null!=this.parent&&null!=this.children.head&&null!=this.uiNode){const e=ia.formats(this.children.head.domNode);e!==this.uiNode.value&&(this.uiNode.value=e)}}}oa.allowedChildren=[ia],ia.requiredContainer=oa,ia.allowedChildren=[sa,Fi,Oi,_i];class la extends uo{static register(){So.register(sa,!0),So.register(ia,!0),So.register(oa,!0)}constructor(e,t){if(super(e,t),null==this.options.hljs)throw new Error("Syntax module requires highlight.js. Please include the library on the page before Quill.");this.languages=this.options.languages.reduce((e,t)=>{let{key:n}=t;return e[n]=!0,e},{}),this.highlightBlot=this.highlightBlot.bind(this),this.initListener(),this.initTimer()}initListener(){this.quill.on(So.events.SCROLL_BLOT_MOUNT,e=>{if(!(e instanceof oa))return;const t=this.quill.root.ownerDocument.createElement("select");this.options.languages.forEach(e=>{let{key:n,label:r}=e;const s=t.ownerDocument.createElement("option");s.textContent=r,s.setAttribute("value",n),t.appendChild(s)}),t.addEventListener("change",()=>{e.format(ia.blotName,t.value),this.quill.root.focus(),this.highlight(e,!0)}),null==e.uiNode&&(e.attachUI(t),e.children.head&&(t.value=ia.formats(e.children.head.domNode)))})}initTimer(){let e=null;this.quill.on(So.events.SCROLL_OPTIMIZE,()=>{e&&clearTimeout(e),e=setTimeout(()=>{this.highlight(),e=null},this.options.interval)})}highlight(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(this.quill.selection.composing)return;this.quill.update(So.sources.USER);const n=this.quill.getSelection();(null==e?this.quill.scroll.descendants(oa):[e]).forEach(e=>{e.highlight(this.highlightBlot,t)}),this.quill.update(So.sources.SILENT),null!=n&&this.quill.setSelection(n,So.sources.SILENT)}highlightBlot(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"plain";if(t=this.languages[t]?t:"plain","plain"===t)return Li(e).split("\n").reduce((e,n,r)=>(0!==r&&e.insert("\n",{[Wo.blotName]:t}),e.insert(n)),new ji);const n=this.quill.root.ownerDocument.createElement("div");return n.classList.add(Wo.className),n.innerHTML=((e,t,n)=>{if("string"==typeof e.versionString){const r=e.versionString.split(".")[0];if(parseInt(r,10)>=11)return e.highlight(n,{language:t}).value}return e.highlight(t,n).value})(this.options.hljs,t,e),Tl(this.quill.scroll,n,[(e,t)=>{const n=ra.value(e);return n?t.compose((new ji).retain(t.length(),{[sa.blotName]:n})):t}],[(e,n)=>e.data.split("\n").reduce((e,n,r)=>(0!==r&&e.insert("\n",{[Wo.blotName]:t}),e.insert(n)),n)],new WeakMap)}}la.DEFAULTS={hljs:window.hljs,interval:1e3,languages:[{key:"plain",label:"Plain"},{key:"bash",label:"Bash"},{key:"cpp",label:"C++"},{key:"cs",label:"C#"},{key:"css",label:"CSS"},{key:"diff",label:"Diff"},{key:"xml",label:"HTML/XML"},{key:"java",label:"Java"},{key:"javascript",label:"JavaScript"},{key:"markdown",label:"Markdown"},{key:"php",label:"PHP"},{key:"python",label:"Python"},{key:"ruby",label:"Ruby"},{key:"sql",label:"SQL"}]};const aa=class e extends Ri{static create(e){const t=super.create();return e?t.setAttribute("data-row",e):t.setAttribute("data-row",fa()),t}static formats(e){if(e.hasAttribute("data-row"))return e.getAttribute("data-row")}cellOffset(){return this.parent?this.parent.children.indexOf(this):-1}format(t,n){t===e.blotName&&n?this.domNode.setAttribute("data-row",n):super.format(t,n)}row(){return this.parent}rowOffset(){return this.row()?this.row().rowOffset():-1}table(){return this.row()&&this.row().table()}};t(aa,"blotName","table"),t(aa,"tagName","TD");let ca=aa;class ua extends Lo{checkMerge(){if(super.checkMerge()&&null!=this.next.children.head){const e=this.children.head.formats(),t=this.children.tail.formats(),n=this.next.children.head.formats(),r=this.next.children.tail.formats();return e.table===t.table&&e.table===n.table&&e.table===r.table}return!1}optimize(e){super.optimize(e),this.children.forEach(e=>{if(null==e.next)return;const t=e.formats(),n=e.next.formats();if(t.table!==n.table){const t=this.splitAfter(e);t&&t.optimize(),this.prev&&this.prev.optimize()}})}rowOffset(){return this.parent?this.parent.children.indexOf(this):-1}table(){return this.parent&&this.parent.parent}}t(ua,"blotName","table-row"),t(ua,"tagName","TR");class da extends Lo{}t(da,"blotName","table-body"),t(da,"tagName","TBODY");class ha extends Lo{balanceCells(){const e=this.descendants(ua),t=e.reduce((e,t)=>Math.max(t.children.length,e),0);e.forEach(e=>{new Array(t-e.children.length).fill(0).forEach(()=>{let t;null!=e.children.head&&(t=ca.formats(e.children.head.domNode));const n=this.scroll.create(ca.blotName,t);e.appendChild(n),n.optimize()})})}cells(e){return this.rows().map(t=>t.children.at(e))}deleteColumn(e){const[t]=this.descendant(da);null!=t&&null!=t.children.head&&t.children.forEach(t=>{const n=t.children.at(e);null!=n&&n.remove()})}insertColumn(e){const[t]=this.descendant(da);null!=t&&null!=t.children.head&&t.children.forEach(t=>{const n=t.children.at(e),r=ca.formats(t.children.head.domNode),s=this.scroll.create(ca.blotName,r);t.insertBefore(s,n)})}insertRow(e){const[t]=this.descendant(da);if(null==t||null==t.children.head)return;const n=fa(),r=this.scroll.create(ua.blotName);t.children.head.children.forEach(()=>{const e=this.scroll.create(ca.blotName,n);r.appendChild(e)});const s=t.children.at(e);t.insertBefore(r,s)}rows(){const e=this.children.head;return null==e?[]:e.children.map(e=>e)}}function fa(){return`row-${Math.random().toString(36).slice(2,6)}`}t(ha,"blotName","table-container"),t(ha,"tagName","TABLE"),ha.allowedChildren=[da],da.requiredContainer=ha,da.allowedChildren=[ua],ua.requiredContainer=da,ua.allowedChildren=[ca],ca.requiredContainer=ua;const pa=Zi("quill:toolbar");class ma extends uo{constructor(e,t){var n,r;if(super(e,t),Array.isArray(this.options.container)){const t=document.createElement("div");t.setAttribute("role","toolbar"),function(e,t){Array.isArray(t[0])||(t=[t]);t.forEach(t=>{const n=document.createElement("span");n.classList.add("ql-formats"),t.forEach(e=>{if("string"==typeof e)ga(n,e);else{const t=Object.keys(e)[0],r=e[t];Array.isArray(r)?function(e,t,n){const r=document.createElement("select");r.classList.add(`ql-${t}`),n.forEach(e=>{const t=document.createElement("option");!1!==e?t.setAttribute("value",String(e)):t.setAttribute("selected","selected"),r.appendChild(t)}),e.appendChild(r)}(n,t,r):ga(n,t,r)}}),e.appendChild(n)})}(t,this.options.container),null==(r=null==(n=e.container)?void 0:n.parentNode)||r.insertBefore(t,e.container),this.container=t}else"string"==typeof this.options.container?this.container=document.querySelector(this.options.container):this.container=this.options.container;this.container instanceof HTMLElement?(this.container.classList.add("ql-toolbar"),this.controls=[],this.handlers={},this.options.handlers&&Object.keys(this.options.handlers).forEach(e=>{var t;const n=null==(t=this.options.handlers)?void 0:t[e];n&&this.addHandler(e,n)}),Array.from(this.container.querySelectorAll("button, select")).forEach(e=>{this.attach(e)}),this.quill.on(So.events.EDITOR_CHANGE,()=>{const[e]=this.quill.selection.getRange();this.update(e)})):pa.error("Container required for toolbar",this.options)}addHandler(e,t){this.handlers[e]=t}attach(e){let t=Array.from(e.classList).find(e=>0===e.indexOf("ql-"));if(!t)return;if(t=t.slice(3),"BUTTON"===e.tagName&&e.setAttribute("type","button"),null==this.handlers[t]&&null==this.quill.scroll.query(t))return void pa.warn("ignoring attaching to nonexistent format",t,e);const n="SELECT"===e.tagName?"change":"click";e.addEventListener(n,n=>{let r;if("SELECT"===e.tagName){if(e.selectedIndex<0)return;const t=e.options[e.selectedIndex];r=!t.hasAttribute("selected")&&(t.value||!1)}else r=!e.classList.contains("ql-active")&&(e.value||!e.hasAttribute("value")),n.preventDefault();this.quill.focus();const[s]=this.quill.selection.getRange();if(null!=this.handlers[t])this.handlers[t].call(this,r);else if(this.quill.scroll.query(t).prototype instanceof ni){if(r=prompt(`Enter ${t}`),!r)return;this.quill.updateContents((new ji).retain(s.index).delete(s.length).insert({[t]:r}),So.sources.USER)}else this.quill.format(t,r,So.sources.USER);this.update(s)}),this.controls.push([t,e])}update(e){const t=null==e?{}:this.quill.getFormat(e);this.controls.forEach(n=>{const[r,s]=n;if("SELECT"===s.tagName){let n=null;if(null==e)n=null;else if(null==t[r])n=s.querySelector("option[selected]");else if(!Array.isArray(t[r])){let e=t[r];"string"==typeof e&&(e=e.replace(/"/g,'\\"')),n=s.querySelector(`option[value="${e}"]`)}null==n?(s.value="",s.selectedIndex=-1):n.selected=!0}else if(null==e)s.classList.remove("ql-active"),s.setAttribute("aria-pressed","false");else if(s.hasAttribute("value")){const e=t[r],n=e===s.getAttribute("value")||null!=e&&e.toString()===s.getAttribute("value")||null==e&&!s.getAttribute("value");s.classList.toggle("ql-active",n),s.setAttribute("aria-pressed",n.toString())}else{const e=null!=t[r];s.classList.toggle("ql-active",e),s.setAttribute("aria-pressed",e.toString())}})}}function ga(e,t,n){const r=document.createElement("button");r.setAttribute("type","button"),r.classList.add(`ql-${t}`),r.setAttribute("aria-pressed","false"),null!=n?(r.value=n,r.setAttribute("aria-label",`${t}: ${n}`)):r.setAttribute("aria-label",t),e.appendChild(r)}ma.DEFAULTS={},ma.DEFAULTS={container:null,handlers:{clean(){const e=this.quill.getSelection();if(null!=e)if(0===e.length){const e=this.quill.getFormat();Object.keys(e).forEach(e=>{null!=this.quill.scroll.query(e,Ls.INLINE)&&this.quill.format(e,!1,So.sources.USER)})}else this.quill.removeFormat(e.index,e.length,So.sources.USER)},direction(e){const{align:t}=this.quill.getFormat();"rtl"===e&&null==t?this.quill.format("align","right",So.sources.USER):e||"right"!==t||this.quill.format("align",!1,So.sources.USER),this.quill.format("direction",e,So.sources.USER)},indent(e){const t=this.quill.getSelection(),n=this.quill.getFormat(t),r=parseInt(n.indent||0,10);if("+1"===e||"-1"===e){let t="+1"===e?1:-1;"rtl"===n.direction&&(t*=-1),this.quill.format("indent",r+t,So.sources.USER)}},link(e){!0===e&&(e=prompt("Enter link URL:")),this.quill.format("link",e,So.sources.USER)},list(e){const t=this.quill.getSelection(),n=this.quill.getFormat(t);"check"===e?"checked"===n.list||"unchecked"===n.list?this.quill.format("list",!1,So.sources.USER):this.quill.format("list","unchecked",So.sources.USER):this.quill.format("list",e,So.sources.USER)}}};const va='<svg viewbox="0 0 18 18"><polyline class="ql-even ql-stroke" points="5 7 3 9 5 11"/><polyline class="ql-even ql-stroke" points="13 7 15 9 13 11"/><line class="ql-stroke" x1="10" x2="8" y1="5" y2="13"/></svg>',ba={align:{"":'<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="3" x2="15" y1="9" y2="9"/><line class="ql-stroke" x1="3" x2="13" y1="14" y2="14"/><line class="ql-stroke" x1="3" x2="9" y1="4" y2="4"/></svg>',center:'<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="15" x2="3" y1="9" y2="9"/><line class="ql-stroke" x1="14" x2="4" y1="14" y2="14"/><line class="ql-stroke" x1="12" x2="6" y1="4" y2="4"/></svg>',right:'<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="15" x2="3" y1="9" y2="9"/><line class="ql-stroke" x1="15" x2="5" y1="14" y2="14"/><line class="ql-stroke" x1="15" x2="9" y1="4" y2="4"/></svg>',justify:'<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="15" x2="3" y1="9" y2="9"/><line class="ql-stroke" x1="15" x2="3" y1="14" y2="14"/><line class="ql-stroke" x1="15" x2="3" y1="4" y2="4"/></svg>'},background:'<svg viewbox="0 0 18 18"><g class="ql-fill ql-color-label"><polygon points="6 6.868 6 6 5 6 5 7 5.942 7 6 6.868"/><rect height="1" width="1" x="4" y="4"/><polygon points="6.817 5 6 5 6 6 6.38 6 6.817 5"/><rect height="1" width="1" x="2" y="6"/><rect height="1" width="1" x="3" y="5"/><rect height="1" width="1" x="4" y="7"/><polygon points="4 11.439 4 11 3 11 3 12 3.755 12 4 11.439"/><rect height="1" width="1" x="2" y="12"/><rect height="1" width="1" x="2" y="9"/><rect height="1" width="1" x="2" y="15"/><polygon points="4.63 10 4 10 4 11 4.192 11 4.63 10"/><rect height="1" width="1" x="3" y="8"/><path d="M10.832,4.2L11,4.582V4H10.708A1.948,1.948,0,0,1,10.832,4.2Z"/><path d="M7,4.582L7.168,4.2A1.929,1.929,0,0,1,7.292,4H7V4.582Z"/><path d="M8,13H7.683l-0.351.8a1.933,1.933,0,0,1-.124.2H8V13Z"/><rect height="1" width="1" x="12" y="2"/><rect height="1" width="1" x="11" y="3"/><path d="M9,3H8V3.282A1.985,1.985,0,0,1,9,3Z"/><rect height="1" width="1" x="2" y="3"/><rect height="1" width="1" x="6" y="2"/><rect height="1" width="1" x="3" y="2"/><rect height="1" width="1" x="5" y="3"/><rect height="1" width="1" x="9" y="2"/><rect height="1" width="1" x="15" y="14"/><polygon points="13.447 10.174 13.469 10.225 13.472 10.232 13.808 11 14 11 14 10 13.37 10 13.447 10.174"/><rect height="1" width="1" x="13" y="7"/><rect height="1" width="1" x="15" y="5"/><rect height="1" width="1" x="14" y="6"/><rect height="1" width="1" x="15" y="8"/><rect height="1" width="1" x="14" y="9"/><path d="M3.775,14H3v1H4V14.314A1.97,1.97,0,0,1,3.775,14Z"/><rect height="1" width="1" x="14" y="3"/><polygon points="12 6.868 12 6 11.62 6 12 6.868"/><rect height="1" width="1" x="15" y="2"/><rect height="1" width="1" x="12" y="5"/><rect height="1" width="1" x="13" y="4"/><polygon points="12.933 9 13 9 13 8 12.495 8 12.933 9"/><rect height="1" width="1" x="9" y="14"/><rect height="1" width="1" x="8" y="15"/><path d="M6,14.926V15H7V14.316A1.993,1.993,0,0,1,6,14.926Z"/><rect height="1" width="1" x="5" y="15"/><path d="M10.668,13.8L10.317,13H10v1h0.792A1.947,1.947,0,0,1,10.668,13.8Z"/><rect height="1" width="1" x="11" y="15"/><path d="M14.332,12.2a1.99,1.99,0,0,1,.166.8H15V12H14.245Z"/><rect height="1" width="1" x="14" y="15"/><rect height="1" width="1" x="15" y="11"/></g><polyline class="ql-stroke" points="5.5 13 9 5 12.5 13"/><line class="ql-stroke" x1="11.63" x2="6.38" y1="11" y2="11"/></svg>',blockquote:'<svg viewbox="0 0 18 18"><rect class="ql-fill ql-stroke" height="3" width="3" x="4" y="5"/><rect class="ql-fill ql-stroke" height="3" width="3" x="11" y="5"/><path class="ql-even ql-fill ql-stroke" d="M7,8c0,4.031-3,5-3,5"/><path class="ql-even ql-fill ql-stroke" d="M14,8c0,4.031-3,5-3,5"/></svg>',bold:'<svg viewbox="0 0 18 18"><path class="ql-stroke" d="M5,4H9.5A2.5,2.5,0,0,1,12,6.5v0A2.5,2.5,0,0,1,9.5,9H5A0,0,0,0,1,5,9V4A0,0,0,0,1,5,4Z"/><path class="ql-stroke" d="M5,9h5.5A2.5,2.5,0,0,1,13,11.5v0A2.5,2.5,0,0,1,10.5,14H5a0,0,0,0,1,0,0V9A0,0,0,0,1,5,9Z"/></svg>',clean:'<svg class="" viewbox="0 0 18 18"><line class="ql-stroke" x1="5" x2="13" y1="3" y2="3"/><line class="ql-stroke" x1="6" x2="9.35" y1="12" y2="3"/><line class="ql-stroke" x1="11" x2="15" y1="11" y2="15"/><line class="ql-stroke" x1="15" x2="11" y1="11" y2="15"/><rect class="ql-fill" height="1" rx="0.5" ry="0.5" width="7" x="2" y="14"/></svg>',code:va,"code-block":va,color:'<svg viewbox="0 0 18 18"><line class="ql-color-label ql-stroke ql-transparent" x1="3" x2="15" y1="15" y2="15"/><polyline class="ql-stroke" points="5.5 11 9 3 12.5 11"/><line class="ql-stroke" x1="11.63" x2="6.38" y1="9" y2="9"/></svg>',direction:{"":'<svg viewbox="0 0 18 18"><polygon class="ql-stroke ql-fill" points="3 11 5 9 3 7 3 11"/><line class="ql-stroke ql-fill" x1="15" x2="11" y1="4" y2="4"/><path class="ql-fill" d="M11,3a3,3,0,0,0,0,6h1V3H11Z"/><rect class="ql-fill" height="11" width="1" x="11" y="4"/><rect class="ql-fill" height="11" width="1" x="13" y="4"/></svg>',rtl:'<svg viewbox="0 0 18 18"><polygon class="ql-stroke ql-fill" points="15 12 13 10 15 8 15 12"/><line class="ql-stroke ql-fill" x1="9" x2="5" y1="4" y2="4"/><path class="ql-fill" d="M5,3A3,3,0,0,0,5,9H6V3H5Z"/><rect class="ql-fill" height="11" width="1" x="5" y="4"/><rect class="ql-fill" height="11" width="1" x="7" y="4"/></svg>'},formula:'<svg viewbox="0 0 18 18"><path class="ql-fill" d="M11.759,2.482a2.561,2.561,0,0,0-3.53.607A7.656,7.656,0,0,0,6.8,6.2C6.109,9.188,5.275,14.677,4.15,14.927a1.545,1.545,0,0,0-1.3-.933A0.922,0.922,0,0,0,2,15.036S1.954,16,4.119,16s3.091-2.691,3.7-5.553c0.177-.826.36-1.726,0.554-2.6L8.775,6.2c0.381-1.421.807-2.521,1.306-2.676a1.014,1.014,0,0,0,1.02.56A0.966,0.966,0,0,0,11.759,2.482Z"/><rect class="ql-fill" height="1.6" rx="0.8" ry="0.8" width="5" x="5.15" y="6.2"/><path class="ql-fill" d="M13.663,12.027a1.662,1.662,0,0,1,.266-0.276q0.193,0.069.456,0.138a2.1,2.1,0,0,0,.535.069,1.075,1.075,0,0,0,.767-0.3,1.044,1.044,0,0,0,.314-0.8,0.84,0.84,0,0,0-.238-0.619,0.8,0.8,0,0,0-.594-0.239,1.154,1.154,0,0,0-.781.3,4.607,4.607,0,0,0-.781,1q-0.091.15-.218,0.346l-0.246.38c-0.068-.288-0.137-0.582-0.212-0.885-0.459-1.847-2.494-.984-2.941-0.8-0.482.2-.353,0.647-0.094,0.529a0.869,0.869,0,0,1,1.281.585c0.217,0.751.377,1.436,0.527,2.038a5.688,5.688,0,0,1-.362.467,2.69,2.69,0,0,1-.264.271q-0.221-.08-0.471-0.147a2.029,2.029,0,0,0-.522-0.066,1.079,1.079,0,0,0-.768.3A1.058,1.058,0,0,0,9,15.131a0.82,0.82,0,0,0,.832.852,1.134,1.134,0,0,0,.787-0.3,5.11,5.11,0,0,0,.776-0.993q0.141-.219.215-0.34c0.046-.076.122-0.194,0.223-0.346a2.786,2.786,0,0,0,.918,1.726,2.582,2.582,0,0,0,2.376-.185c0.317-.181.212-0.565,0-0.494A0.807,0.807,0,0,1,14.176,15a5.159,5.159,0,0,1-.913-2.446l0,0Q13.487,12.24,13.663,12.027Z"/></svg>',header:{1:'<svg viewBox="0 0 18 18"><path class="ql-fill" d="M10,4V14a1,1,0,0,1-2,0V10H3v4a1,1,0,0,1-2,0V4A1,1,0,0,1,3,4V8H8V4a1,1,0,0,1,2,0Zm6.06787,9.209H14.98975V7.59863a.54085.54085,0,0,0-.605-.60547h-.62744a1.01119,1.01119,0,0,0-.748.29688L11.645,8.56641a.5435.5435,0,0,0-.022.8584l.28613.30762a.53861.53861,0,0,0,.84717.0332l.09912-.08789a1.2137,1.2137,0,0,0,.2417-.35254h.02246s-.01123.30859-.01123.60547V13.209H12.041a.54085.54085,0,0,0-.605.60547v.43945a.54085.54085,0,0,0,.605.60547h4.02686a.54085.54085,0,0,0,.605-.60547v-.43945A.54085.54085,0,0,0,16.06787,13.209Z"/></svg>',2:'<svg viewBox="0 0 18 18"><path class="ql-fill" d="M16.73975,13.81445v.43945a.54085.54085,0,0,1-.605.60547H11.855a.58392.58392,0,0,1-.64893-.60547V14.0127c0-2.90527,3.39941-3.42187,3.39941-4.55469a.77675.77675,0,0,0-.84717-.78125,1.17684,1.17684,0,0,0-.83594.38477c-.2749.26367-.561.374-.85791.13184l-.4292-.34082c-.30811-.24219-.38525-.51758-.1543-.81445a2.97155,2.97155,0,0,1,2.45361-1.17676,2.45393,2.45393,0,0,1,2.68408,2.40918c0,2.45312-3.1792,2.92676-3.27832,3.93848h2.79443A.54085.54085,0,0,1,16.73975,13.81445ZM9,3A.99974.99974,0,0,0,8,4V8H3V4A1,1,0,0,0,1,4V14a1,1,0,0,0,2,0V10H8v4a1,1,0,0,0,2,0V4A.99974.99974,0,0,0,9,3Z"/></svg>',3:'<svg viewBox="0 0 18 18"><path class="ql-fill" d="M16.65186,12.30664a2.6742,2.6742,0,0,1-2.915,2.68457,3.96592,3.96592,0,0,1-2.25537-.6709.56007.56007,0,0,1-.13232-.83594L11.64648,13c.209-.34082.48389-.36328.82471-.1543a2.32654,2.32654,0,0,0,1.12256.33008c.71484,0,1.12207-.35156,1.12207-.78125,0-.61523-.61621-.86816-1.46338-.86816H13.2085a.65159.65159,0,0,1-.68213-.41895l-.05518-.10937a.67114.67114,0,0,1,.14307-.78125l.71533-.86914a8.55289,8.55289,0,0,1,.68213-.7373V8.58887a3.93913,3.93913,0,0,1-.748.05469H11.9873a.54085.54085,0,0,1-.605-.60547V7.59863a.54085.54085,0,0,1,.605-.60547h3.75146a.53773.53773,0,0,1,.60547.59375v.17676a1.03723,1.03723,0,0,1-.27539.748L14.74854,10.0293A2.31132,2.31132,0,0,1,16.65186,12.30664ZM9,3A.99974.99974,0,0,0,8,4V8H3V4A1,1,0,0,0,1,4V14a1,1,0,0,0,2,0V10H8v4a1,1,0,0,0,2,0V4A.99974.99974,0,0,0,9,3Z"/></svg>',4:'<svg viewBox="0 0 18 18"><path class="ql-fill" d="M10,4V14a1,1,0,0,1-2,0V10H3v4a1,1,0,0,1-2,0V4A1,1,0,0,1,3,4V8H8V4a1,1,0,0,1,2,0Zm7.05371,7.96582v.38477c0,.39648-.165.60547-.46191.60547h-.47314v1.29785a.54085.54085,0,0,1-.605.60547h-.69336a.54085.54085,0,0,1-.605-.60547V12.95605H11.333a.5412.5412,0,0,1-.60547-.60547v-.15332a1.199,1.199,0,0,1,.22021-.748l2.56348-4.05957a.7819.7819,0,0,1,.72607-.39648h1.27637a.54085.54085,0,0,1,.605.60547v3.7627h.33008A.54055.54055,0,0,1,17.05371,11.96582ZM14.28125,8.7207h-.022a4.18969,4.18969,0,0,1-.38525.81348l-1.188,1.80469v.02246h1.5293V9.60059A7.04058,7.04058,0,0,1,14.28125,8.7207Z"/></svg>',5:'<svg viewBox="0 0 18 18"><path class="ql-fill" d="M16.74023,12.18555a2.75131,2.75131,0,0,1-2.91553,2.80566,3.908,3.908,0,0,1-2.25537-.68164.54809.54809,0,0,1-.13184-.8252L11.73438,13c.209-.34082.48389-.36328.8252-.1543a2.23757,2.23757,0,0,0,1.1001.33008,1.01827,1.01827,0,0,0,1.1001-.96777c0-.61621-.53906-.97949-1.25439-.97949a2.15554,2.15554,0,0,0-.64893.09961,1.15209,1.15209,0,0,1-.814.01074l-.12109-.04395a.64116.64116,0,0,1-.45117-.71484l.231-3.00391a.56666.56666,0,0,1,.62744-.583H15.541a.54085.54085,0,0,1,.605.60547v.43945a.54085.54085,0,0,1-.605.60547H13.41748l-.04395.72559a1.29306,1.29306,0,0,1-.04395.30859h.022a2.39776,2.39776,0,0,1,.57227-.07715A2.53266,2.53266,0,0,1,16.74023,12.18555ZM9,3A.99974.99974,0,0,0,8,4V8H3V4A1,1,0,0,0,1,4V14a1,1,0,0,0,2,0V10H8v4a1,1,0,0,0,2,0V4A.99974.99974,0,0,0,9,3Z"/></svg>',6:'<svg viewBox="0 0 18 18"><path class="ql-fill" d="M14.51758,9.64453a1.85627,1.85627,0,0,0-1.24316.38477H13.252a1.73532,1.73532,0,0,1,1.72754-1.4082,2.66491,2.66491,0,0,1,.5498.06641c.35254.05469.57227.01074.70508-.40723l.16406-.5166a.53393.53393,0,0,0-.373-.75977,4.83723,4.83723,0,0,0-1.17773-.14258c-2.43164,0-3.7627,2.17773-3.7627,4.43359,0,2.47559,1.60645,3.69629,3.19043,3.69629A2.70585,2.70585,0,0,0,16.96,12.19727,2.43861,2.43861,0,0,0,14.51758,9.64453Zm-.23047,3.58691c-.67187,0-1.22168-.81445-1.22168-1.45215,0-.47363.30762-.583.72559-.583.96875,0,1.27734.59375,1.27734,1.12207A.82182.82182,0,0,1,14.28711,13.23145ZM10,4V14a1,1,0,0,1-2,0V10H3v4a1,1,0,0,1-2,0V4A1,1,0,0,1,3,4V8H8V4a1,1,0,0,1,2,0Z"/></svg>'},italic:'<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="7" x2="13" y1="4" y2="4"/><line class="ql-stroke" x1="5" x2="11" y1="14" y2="14"/><line class="ql-stroke" x1="8" x2="10" y1="14" y2="4"/></svg>',image:'<svg viewbox="0 0 18 18"><rect class="ql-stroke" height="10" width="12" x="3" y="4"/><circle class="ql-fill" cx="6" cy="7" r="1"/><polyline class="ql-even ql-fill" points="5 12 5 11 7 9 8 10 11 7 13 9 13 12 5 12"/></svg>',indent:{"+1":'<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="3" x2="15" y1="14" y2="14"/><line class="ql-stroke" x1="3" x2="15" y1="4" y2="4"/><line class="ql-stroke" x1="9" x2="15" y1="9" y2="9"/><polyline class="ql-fill ql-stroke" points="3 7 3 11 5 9 3 7"/></svg>',"-1":'<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="3" x2="15" y1="14" y2="14"/><line class="ql-stroke" x1="3" x2="15" y1="4" y2="4"/><line class="ql-stroke" x1="9" x2="15" y1="9" y2="9"/><polyline class="ql-stroke" points="5 7 5 11 3 9 5 7"/></svg>'},link:'<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="7" x2="11" y1="7" y2="11"/><path class="ql-even ql-stroke" d="M8.9,4.577a3.476,3.476,0,0,1,.36,4.679A3.476,3.476,0,0,1,4.577,8.9C3.185,7.5,2.035,6.4,4.217,4.217S7.5,3.185,8.9,4.577Z"/><path class="ql-even ql-stroke" d="M13.423,9.1a3.476,3.476,0,0,0-4.679-.36,3.476,3.476,0,0,0,.36,4.679c1.392,1.392,2.5,2.542,4.679.36S14.815,10.5,13.423,9.1Z"/></svg>',list:{bullet:'<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="6" x2="15" y1="4" y2="4"/><line class="ql-stroke" x1="6" x2="15" y1="9" y2="9"/><line class="ql-stroke" x1="6" x2="15" y1="14" y2="14"/><line class="ql-stroke" x1="3" x2="3" y1="4" y2="4"/><line class="ql-stroke" x1="3" x2="3" y1="9" y2="9"/><line class="ql-stroke" x1="3" x2="3" y1="14" y2="14"/></svg>',check:'<svg class="" viewbox="0 0 18 18"><line class="ql-stroke" x1="9" x2="15" y1="4" y2="4"/><polyline class="ql-stroke" points="3 4 4 5 6 3"/><line class="ql-stroke" x1="9" x2="15" y1="14" y2="14"/><polyline class="ql-stroke" points="3 14 4 15 6 13"/><line class="ql-stroke" x1="9" x2="15" y1="9" y2="9"/><polyline class="ql-stroke" points="3 9 4 10 6 8"/></svg>',ordered:'<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="7" x2="15" y1="4" y2="4"/><line class="ql-stroke" x1="7" x2="15" y1="9" y2="9"/><line class="ql-stroke" x1="7" x2="15" y1="14" y2="14"/><line class="ql-stroke ql-thin" x1="2.5" x2="4.5" y1="5.5" y2="5.5"/><path class="ql-fill" d="M3.5,6A0.5,0.5,0,0,1,3,5.5V3.085l-0.276.138A0.5,0.5,0,0,1,2.053,3c-0.124-.247-0.023-0.324.224-0.447l1-.5A0.5,0.5,0,0,1,4,2.5v3A0.5,0.5,0,0,1,3.5,6Z"/><path class="ql-stroke ql-thin" d="M4.5,10.5h-2c0-.234,1.85-1.076,1.85-2.234A0.959,0.959,0,0,0,2.5,8.156"/><path class="ql-stroke ql-thin" d="M2.5,14.846a0.959,0.959,0,0,0,1.85-.109A0.7,0.7,0,0,0,3.75,14a0.688,0.688,0,0,0,.6-0.736,0.959,0.959,0,0,0-1.85-.109"/></svg>'},script:{sub:'<svg viewbox="0 0 18 18"><path class="ql-fill" d="M15.5,15H13.861a3.858,3.858,0,0,0,1.914-2.975,1.8,1.8,0,0,0-1.6-1.751A1.921,1.921,0,0,0,12.021,11.7a0.50013,0.50013,0,1,0,.957.291h0a0.914,0.914,0,0,1,1.053-.725,0.81,0.81,0,0,1,.744.762c0,1.076-1.16971,1.86982-1.93971,2.43082A1.45639,1.45639,0,0,0,12,15.5a0.5,0.5,0,0,0,.5.5h3A0.5,0.5,0,0,0,15.5,15Z"/><path class="ql-fill" d="M9.65,5.241a1,1,0,0,0-1.409.108L6,7.964,3.759,5.349A1,1,0,0,0,2.192,6.59178Q2.21541,6.6213,2.241,6.649L4.684,9.5,2.241,12.35A1,1,0,0,0,3.71,13.70722q0.02557-.02768.049-0.05722L6,11.036,8.241,13.65a1,1,0,1,0,1.567-1.24277Q9.78459,12.3777,9.759,12.35L7.316,9.5,9.759,6.651A1,1,0,0,0,9.65,5.241Z"/></svg>',super:'<svg viewbox="0 0 18 18"><path class="ql-fill" d="M15.5,7H13.861a4.015,4.015,0,0,0,1.914-2.975,1.8,1.8,0,0,0-1.6-1.751A1.922,1.922,0,0,0,12.021,3.7a0.5,0.5,0,1,0,.957.291,0.917,0.917,0,0,1,1.053-.725,0.81,0.81,0,0,1,.744.762c0,1.077-1.164,1.925-1.934,2.486A1.423,1.423,0,0,0,12,7.5a0.5,0.5,0,0,0,.5.5h3A0.5,0.5,0,0,0,15.5,7Z"/><path class="ql-fill" d="M9.651,5.241a1,1,0,0,0-1.41.108L6,7.964,3.759,5.349a1,1,0,1,0-1.519,1.3L4.683,9.5,2.241,12.35a1,1,0,1,0,1.519,1.3L6,11.036,8.241,13.65a1,1,0,0,0,1.519-1.3L7.317,9.5,9.759,6.651A1,1,0,0,0,9.651,5.241Z"/></svg>'},strike:'<svg viewbox="0 0 18 18"><line class="ql-stroke ql-thin" x1="15.5" x2="2.5" y1="8.5" y2="9.5"/><path class="ql-fill" d="M9.007,8C6.542,7.791,6,7.519,6,6.5,6,5.792,7.283,5,9,5c1.571,0,2.765.679,2.969,1.309a1,1,0,0,0,1.9-.617C13.356,4.106,11.354,3,9,3,6.2,3,4,4.538,4,6.5a3.2,3.2,0,0,0,.5,1.843Z"/><path class="ql-fill" d="M8.984,10C11.457,10.208,12,10.479,12,11.5c0,0.708-1.283,1.5-3,1.5-1.571,0-2.765-.679-2.969-1.309a1,1,0,1,0-1.9.617C4.644,13.894,6.646,15,9,15c2.8,0,5-1.538,5-3.5a3.2,3.2,0,0,0-.5-1.843Z"/></svg>',table:'<svg viewbox="0 0 18 18"><rect class="ql-stroke" height="12" width="12" x="3" y="3"/><rect class="ql-fill" height="2" width="3" x="5" y="5"/><rect class="ql-fill" height="2" width="4" x="9" y="5"/><g class="ql-fill ql-transparent"><rect height="2" width="3" x="5" y="8"/><rect height="2" width="4" x="9" y="8"/><rect height="2" width="3" x="5" y="11"/><rect height="2" width="4" x="9" y="11"/></g></svg>',underline:'<svg viewbox="0 0 18 18"><path class="ql-stroke" d="M5,3V9a4.012,4.012,0,0,0,4,4H9a4.012,4.012,0,0,0,4-4V3"/><rect class="ql-fill" height="1" rx="0.5" ry="0.5" width="12" x="3" y="15"/></svg>',video:'<svg viewbox="0 0 18 18"><rect class="ql-stroke" height="12" width="12" x="3" y="3"/><rect class="ql-fill" height="12" width="1" x="5" y="3"/><rect class="ql-fill" height="12" width="1" x="12" y="3"/><rect class="ql-fill" height="2" width="8" x="5" y="8"/><rect class="ql-fill" height="1" width="3" x="3" y="5"/><rect class="ql-fill" height="1" width="3" x="3" y="7"/><rect class="ql-fill" height="1" width="3" x="3" y="10"/><rect class="ql-fill" height="1" width="3" x="3" y="12"/><rect class="ql-fill" height="1" width="3" x="12" y="5"/><rect class="ql-fill" height="1" width="3" x="12" y="7"/><rect class="ql-fill" height="1" width="3" x="12" y="10"/><rect class="ql-fill" height="1" width="3" x="12" y="12"/></svg>'};let ya=0;function xa(e,t){e.setAttribute(t,`${!("true"===e.getAttribute(t))}`)}class wa{constructor(e){this.select=e,this.container=document.createElement("span"),this.buildPicker(),this.select.style.display="none",this.select.parentNode.insertBefore(this.container,this.select),this.label.addEventListener("mousedown",()=>{this.togglePicker()}),this.label.addEventListener("keydown",e=>{switch(e.key){case"Enter":this.togglePicker();break;case"Escape":this.escape(),e.preventDefault()}}),this.select.addEventListener("change",this.update.bind(this))}togglePicker(){this.container.classList.toggle("ql-expanded"),xa(this.label,"aria-expanded"),xa(this.options,"aria-hidden")}buildItem(e){const t=document.createElement("span");t.tabIndex="0",t.setAttribute("role","button"),t.classList.add("ql-picker-item");const n=e.getAttribute("value");return n&&t.setAttribute("data-value",n),e.textContent&&t.setAttribute("data-label",e.textContent),t.addEventListener("click",()=>{this.selectItem(t,!0)}),t.addEventListener("keydown",e=>{switch(e.key){case"Enter":this.selectItem(t,!0),e.preventDefault();break;case"Escape":this.escape(),e.preventDefault()}}),t}buildLabel(){const e=document.createElement("span");return e.classList.add("ql-picker-label"),e.innerHTML='<svg viewbox="0 0 18 18"><polygon class="ql-stroke" points="7 11 9 13 11 11 7 11"/><polygon class="ql-stroke" points="7 7 9 5 11 7 7 7"/></svg>',e.tabIndex="0",e.setAttribute("role","button"),e.setAttribute("aria-expanded","false"),this.container.appendChild(e),e}buildOptions(){const e=document.createElement("span");e.classList.add("ql-picker-options"),e.setAttribute("aria-hidden","true"),e.tabIndex="-1",e.id=`ql-picker-options-${ya}`,ya+=1,this.label.setAttribute("aria-controls",e.id),this.options=e,Array.from(this.select.options).forEach(t=>{const n=this.buildItem(t);e.appendChild(n),!0===t.selected&&this.selectItem(n)}),this.container.appendChild(e)}buildPicker(){Array.from(this.select.attributes).forEach(e=>{this.container.setAttribute(e.name,e.value)}),this.container.classList.add("ql-picker"),this.label=this.buildLabel(),this.buildOptions()}escape(){this.close(),setTimeout(()=>this.label.focus(),1)}close(){this.container.classList.remove("ql-expanded"),this.label.setAttribute("aria-expanded","false"),this.options.setAttribute("aria-hidden","true")}selectItem(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const n=this.container.querySelector(".ql-selected");e!==n&&(null!=n&&n.classList.remove("ql-selected"),null!=e&&(e.classList.add("ql-selected"),this.select.selectedIndex=Array.from(e.parentNode.children).indexOf(e),e.hasAttribute("data-value")?this.label.setAttribute("data-value",e.getAttribute("data-value")):this.label.removeAttribute("data-value"),e.hasAttribute("data-label")?this.label.setAttribute("data-label",e.getAttribute("data-label")):this.label.removeAttribute("data-label"),t&&(this.select.dispatchEvent(new Event("change")),this.close())))}update(){let e;if(this.select.selectedIndex>-1){const t=this.container.querySelector(".ql-picker-options").children[this.select.selectedIndex];e=this.select.options[this.select.selectedIndex],this.selectItem(t)}else this.selectItem(null);const t=null!=e&&e!==this.select.querySelector("option[selected]");this.label.classList.toggle("ql-active",t)}}class Na extends wa{constructor(e,t){super(e),this.label.innerHTML=t,this.container.classList.add("ql-color-picker"),Array.from(this.container.querySelectorAll(".ql-picker-item")).slice(0,7).forEach(e=>{e.classList.add("ql-primary")})}buildItem(e){const t=super.buildItem(e);return t.style.backgroundColor=e.getAttribute("value")||"",t}selectItem(e,t){super.selectItem(e,t);const n=this.label.querySelector(".ql-color-label"),r=e&&e.getAttribute("data-value")||"";n&&("line"===n.tagName?n.style.stroke=r:n.style.fill=r)}}class Ea extends wa{constructor(e,t){super(e),this.container.classList.add("ql-icon-picker"),Array.from(this.container.querySelectorAll(".ql-picker-item")).forEach(e=>{e.innerHTML=t[e.getAttribute("data-value")||""]}),this.defaultItem=this.container.querySelector(".ql-selected"),this.selectItem(this.defaultItem)}selectItem(e,t){super.selectItem(e,t);const n=e||this.defaultItem;if(null!=n){if(this.label.innerHTML===n.innerHTML)return;this.label.innerHTML=n.innerHTML}}}class ka{constructor(e,t){this.quill=e,this.boundsContainer=t||document.body,this.root=e.addContainer("ql-tooltip"),this.root.innerHTML=this.constructor.TEMPLATE,(e=>{const{overflowY:t}=getComputedStyle(e,null);return"visible"!==t&&"clip"!==t})(this.quill.root)&&this.quill.root.addEventListener("scroll",()=>{this.root.style.marginTop=-1*this.quill.root.scrollTop+"px"}),this.hide()}hide(){this.root.classList.add("ql-hidden")}position(e){const t=e.left+e.width/2-this.root.offsetWidth/2,n=e.bottom+this.quill.root.scrollTop;this.root.style.left=`${t}px`,this.root.style.top=`${n}px`,this.root.classList.remove("ql-flip");const r=this.boundsContainer.getBoundingClientRect(),s=this.root.getBoundingClientRect();let i=0;if(s.right>r.right&&(i=r.right-s.right,this.root.style.left=`${t+i}px`),s.left<r.left&&(i=r.left-s.left,this.root.style.left=`${t+i}px`),s.bottom>r.bottom){const t=s.bottom-s.top,r=e.bottom-e.top+t;this.root.style.top=n-r+"px",this.root.classList.add("ql-flip")}return i}show(){this.root.classList.remove("ql-editing"),this.root.classList.remove("ql-hidden")}}const Sa=[!1,"center","right","justify"],Aa=["#000000","#e60000","#ff9900","#ffff00","#008a00","#0066cc","#9933ff","#ffffff","#facccc","#ffebcc","#ffffcc","#cce8cc","#cce0f5","#ebd6ff","#bbbbbb","#f06666","#ffc266","#ffff66","#66b966","#66a3e0","#c285ff","#888888","#a10000","#b26b00","#b2b200","#006100","#0047b2","#6b24b2","#444444","#5c0000","#663d00","#666600","#003700","#002966","#3d1466"],Ca=[!1,"serif","monospace"],ja=["1","2","3",!1],_a=["small",!1,"large","huge"];class Oa extends go{constructor(e,t){super(e,t);const n=t=>{document.body.contains(e.root)?(null==this.tooltip||this.tooltip.root.contains(t.target)||document.activeElement===this.tooltip.textbox||this.quill.hasFocus()||this.tooltip.hide(),null!=this.pickers&&this.pickers.forEach(e=>{e.container.contains(t.target)||e.close()})):document.body.removeEventListener("click",n)};e.emitter.listenDOM("click",document.body,n)}addModule(e){const t=super.addModule(e);return"toolbar"===e&&this.extendToolbar(t),t}buildButtons(e,t){Array.from(e).forEach(e=>{(e.getAttribute("class")||"").split(/\s+/).forEach(n=>{if(n.startsWith("ql-")&&(n=n.slice(3),null!=t[n]))if("direction"===n)e.innerHTML=t[n][""]+t[n].rtl;else if("string"==typeof t[n])e.innerHTML=t[n];else{const r=e.value||"";null!=r&&t[n][r]&&(e.innerHTML=t[n][r])}})})}buildPickers(e,t){this.pickers=Array.from(e).map(e=>{if(e.classList.contains("ql-align")&&(null==e.querySelector("option")&&La(e,Sa),"object"==typeof t.align))return new Ea(e,t.align);if(e.classList.contains("ql-background")||e.classList.contains("ql-color")){const n=e.classList.contains("ql-background")?"background":"color";return null==e.querySelector("option")&&La(e,Aa,"background"===n?"#ffffff":"#000000"),new Na(e,t[n])}return null==e.querySelector("option")&&(e.classList.contains("ql-font")?La(e,Ca):e.classList.contains("ql-header")?La(e,ja):e.classList.contains("ql-size")&&La(e,_a)),new wa(e)});this.quill.on(Ji.events.EDITOR_CHANGE,()=>{this.pickers.forEach(e=>{e.update()})})}}Oa.DEFAULTS=Ts({},go.DEFAULTS,{modules:{toolbar:{handlers:{formula(){this.quill.theme.tooltip.edit("formula")},image(){let e=this.container.querySelector("input.ql-image[type=file]");null==e&&(e=document.createElement("input"),e.setAttribute("type","file"),e.setAttribute("accept",this.quill.uploader.options.mimetypes.join(", ")),e.classList.add("ql-image"),e.addEventListener("change",()=>{const t=this.quill.getSelection(!0);this.quill.uploader.upload(t,e.files),e.value=""}),this.container.appendChild(e)),e.click()},video(){this.quill.theme.tooltip.edit("video")}}}}});class Ta extends ka{constructor(e,t){super(e,t),this.textbox=this.root.querySelector('input[type="text"]'),this.listen()}listen(){this.textbox.addEventListener("keydown",e=>{"Enter"===e.key?(this.save(),e.preventDefault()):"Escape"===e.key&&(this.cancel(),e.preventDefault())})}cancel(){this.hide(),this.restoreFocus()}edit(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"link",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(this.root.classList.remove("ql-hidden"),this.root.classList.add("ql-editing"),null==this.textbox)return;null!=t?this.textbox.value=t:e!==this.root.getAttribute("data-mode")&&(this.textbox.value="");const n=this.quill.getBounds(this.quill.selection.savedRange);null!=n&&this.position(n),this.textbox.select(),this.textbox.setAttribute("placeholder",this.textbox.getAttribute(`data-${e}`)||""),this.root.setAttribute("data-mode",e)}restoreFocus(){this.quill.focus({preventScroll:!0})}save(){let{value:e}=this.textbox;switch(this.root.getAttribute("data-mode")){case"link":{const{scrollTop:t}=this.quill.root;this.linkRange?(this.quill.formatText(this.linkRange,"link",e,Ji.sources.USER),delete this.linkRange):(this.restoreFocus(),this.quill.format("link",e,Ji.sources.USER)),this.quill.root.scrollTop=t;break}case"video":e=function(e){let t=e.match(/^(?:(https?):\/\/)?(?:(?:www|m)\.)?youtube\.com\/watch.*v=([a-zA-Z0-9_-]+)/)||e.match(/^(?:(https?):\/\/)?(?:(?:www|m)\.)?youtu\.be\/([a-zA-Z0-9_-]+)/);if(t)return`${t[1]||"https"}://www.youtube.com/embed/${t[2]}?showinfo=0`;if(t=e.match(/^(?:(https?):\/\/)?(?:www\.)?vimeo\.com\/(\d+)/))return`${t[1]||"https"}://player.vimeo.com/video/${t[2]}/`;return e}(e);case"formula":{if(!e)break;const t=this.quill.getSelection(!0);if(null!=t){const n=t.index+t.length;this.quill.insertEmbed(n,this.root.getAttribute("data-mode"),e,Ji.sources.USER),"formula"===this.root.getAttribute("data-mode")&&this.quill.insertText(n+1," ",Ji.sources.USER),this.quill.setSelection(n+2,Ji.sources.USER)}break}}this.textbox.value="",this.hide()}}function La(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];t.forEach(t=>{const r=document.createElement("option");t===n?r.setAttribute("selected","selected"):r.setAttribute("value",String(t)),e.appendChild(r)})}const qa=[["bold","italic","link"],[{header:1},{header:2},"blockquote"]];class Ia extends Ta{constructor(e,t){super(e,t),this.quill.on(Ji.events.EDITOR_CHANGE,(e,t,n,r)=>{if(e===Ji.events.SELECTION_CHANGE)if(null!=t&&t.length>0&&r===Ji.sources.USER){this.show(),this.root.style.left="0px",this.root.style.width="",this.root.style.width=`${this.root.offsetWidth}px`;const e=this.quill.getLines(t.index,t.length);if(1===e.length){const e=this.quill.getBounds(t);null!=e&&this.position(e)}else{const n=e[e.length-1],r=this.quill.getIndex(n),s=Math.min(n.length()-1,t.index+t.length-r),i=this.quill.getBounds(new Qi(r,s));null!=i&&this.position(i)}}else document.activeElement!==this.textbox&&this.quill.hasFocus()&&this.hide()})}listen(){super.listen(),this.root.querySelector(".ql-close").addEventListener("click",()=>{this.root.classList.remove("ql-editing")}),this.quill.on(Ji.events.SCROLL_OPTIMIZE,()=>{setTimeout(()=>{if(this.root.classList.contains("ql-hidden"))return;const e=this.quill.getSelection();if(null!=e){const t=this.quill.getBounds(e);null!=t&&this.position(t)}},1)})}cancel(){this.show()}position(e){const t=super.position(e),n=this.root.querySelector(".ql-tooltip-arrow");return n.style.marginLeft="",0!==t&&(n.style.marginLeft=-1*t-n.offsetWidth/2+"px"),t}}t(Ia,"TEMPLATE",['<span class="ql-tooltip-arrow"></span>','<div class="ql-tooltip-editor">','<input type="text" data-formula="e=mc^2" data-link="https://quilljs.com" data-video="Embed URL">','<a class="ql-close"></a>',"</div>"].join(""));class Ra extends Oa{constructor(e,t){null!=t.modules.toolbar&&null==t.modules.toolbar.container&&(t.modules.toolbar.container=qa),super(e,t),this.quill.container.classList.add("ql-bubble")}extendToolbar(e){this.tooltip=new Ia(this.quill,this.options.bounds),null!=e.container&&(this.tooltip.root.appendChild(e.container),this.buildButtons(e.container.querySelectorAll("button"),ba),this.buildPickers(e.container.querySelectorAll("select"),ba))}}Ra.DEFAULTS=Ts({},Oa.DEFAULTS,{modules:{toolbar:{handlers:{link(e){e?this.quill.theme.tooltip.edit():this.quill.format("link",!1,So.sources.USER)}}}}});const Ma=[[{header:["1","2","3",!1]}],["bold","italic","underline","link"],[{list:"ordered"},{list:"bullet"}],["clean"]];class Ba extends Ta{constructor(){super(...arguments),t(this,"preview",this.root.querySelector("a.ql-preview"))}listen(){super.listen(),this.root.querySelector("a.ql-action").addEventListener("click",e=>{this.root.classList.contains("ql-editing")?this.save():this.edit("link",this.preview.textContent),e.preventDefault()}),this.root.querySelector("a.ql-remove").addEventListener("click",e=>{if(null!=this.linkRange){const e=this.linkRange;this.restoreFocus(),this.quill.formatText(e,"link",!1,Ji.sources.USER),delete this.linkRange}e.preventDefault(),this.hide()}),this.quill.on(Ji.events.SELECTION_CHANGE,(e,t,n)=>{if(null!=e){if(0===e.length&&n===Ji.sources.USER){const[t,n]=this.quill.scroll.descendant(Wl,e.index);if(null!=t){this.linkRange=new Qi(e.index-n,t.length());const r=Wl.formats(t.domNode);this.preview.textContent=r,this.preview.setAttribute("href",r),this.show();const s=this.quill.getBounds(this.linkRange);return void(null!=s&&this.position(s))}}else delete this.linkRange;this.hide()}})}show(){super.show(),this.root.removeAttribute("data-mode")}}t(Ba,"TEMPLATE",['<a class="ql-preview" rel="noopener noreferrer" target="_blank" href="about:blank"></a>','<input type="text" data-formula="e=mc^2" data-link="https://quilljs.com" data-video="Embed URL">','<a class="ql-action"></a>','<a class="ql-remove"></a>'].join(""));class Da extends Oa{constructor(e,t){null!=t.modules.toolbar&&null==t.modules.toolbar.container&&(t.modules.toolbar.container=Ma),super(e,t),this.quill.container.classList.add("ql-snow")}extendToolbar(e){null!=e.container&&(e.container.classList.add("ql-snow"),this.buildButtons(e.container.querySelectorAll("button"),ba),this.buildPickers(e.container.querySelectorAll("select"),ba),this.tooltip=new Ba(this.quill,this.options.bounds),e.container.querySelector(".ql-link")&&this.quill.keyboard.addBinding({key:"k",shortKey:!0},(t,n)=>{e.handlers.link.call(e,!n.format.link)}))}}Da.DEFAULTS=Ts({},Oa.DEFAULTS,{modules:{toolbar:{handlers:{link(e){if(e){const e=this.quill.getSelection();if(null==e||0===e.length)return;let t=this.quill.getText(e);/^\S+@\S+\.\S+$/.test(t)&&0!==t.indexOf("mailto:")&&(t=`mailto:${t}`);const{tooltip:n}=this.quill.theme;n.edit("link",t)}else this.quill.format("link",!1,So.sources.USER)}}}}}),So.register({"attributors/attribute/direction":Yo,"attributors/class/align":Po,"attributors/class/background":Vo,"attributors/class/color":zo,"attributors/class/direction":Jo,"attributors/class/font":el,"attributors/class/size":nl,"attributors/style/align":Fo,"attributors/style/background":Ho,"attributors/style/color":$o,"attributors/style/direction":Xo,"attributors/style/font":tl,"attributors/style/size":rl},!0),So.register({"formats/align":Po,"formats/direction":Jo,"formats/indent":Fl,"formats/background":Ho,"formats/color":$o,"formats/font":el,"formats/size":nl,"formats/blockquote":Ul,"formats/code-block":Wo,"formats/header":zl,"formats/list":Vl,"formats/bold":Hl,"formats/code":Go,"formats/italic":Kl,"formats/link":Wl,"formats/script":Zl,"formats/strike":Yl,"formats/underline":Jl,"formats/formula":Xl,"formats/image":ea,"formats/video":na,"modules/syntax":la,"modules/table":class extends uo{static register(){So.register(ca),So.register(ua),So.register(da),So.register(ha)}constructor(){super(...arguments),this.listenBalanceCells()}balanceTables(){this.quill.scroll.descendants(ha).forEach(e=>{e.balanceCells()})}deleteColumn(){const[e,,t]=this.getTable();null!=t&&(e.deleteColumn(t.cellOffset()),this.quill.update(So.sources.USER))}deleteRow(){const[,e]=this.getTable();null!=e&&(e.remove(),this.quill.update(So.sources.USER))}deleteTable(){const[e]=this.getTable();if(null==e)return;const t=e.offset();e.remove(),this.quill.update(So.sources.USER),this.quill.setSelection(t,So.sources.SILENT)}getTable(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.quill.getSelection();if(null==e)return[null,null,null,-1];const[t,n]=this.quill.getLine(e.index);if(null==t||t.statics.blotName!==ca.blotName)return[null,null,null,-1];const r=t.parent;return[r.parent.parent,r,t,n]}insertColumn(e){const t=this.quill.getSelection();if(!t)return;const[n,r,s]=this.getTable(t);if(null==s)return;const i=s.cellOffset();n.insertColumn(i+e),this.quill.update(So.sources.USER);let o=r.rowOffset();0===e&&(o+=1),this.quill.setSelection(t.index+o,t.length,So.sources.SILENT)}insertColumnLeft(){this.insertColumn(0)}insertColumnRight(){this.insertColumn(1)}insertRow(e){const t=this.quill.getSelection();if(!t)return;const[n,r,s]=this.getTable(t);if(null==s)return;const i=r.rowOffset();n.insertRow(i+e),this.quill.update(So.sources.USER),e>0?this.quill.setSelection(t,So.sources.SILENT):this.quill.setSelection(t.index+r.children.length,t.length,So.sources.SILENT)}insertRowAbove(){this.insertRow(0)}insertRowBelow(){this.insertRow(1)}insertTable(e,t){const n=this.quill.getSelection();if(null==n)return;const r=new Array(e).fill(0).reduce(e=>{const n=new Array(t).fill("\n").join("");return e.insert(n,{table:fa()})},(new ji).retain(n.index));this.quill.updateContents(r,So.sources.USER),this.quill.setSelection(n.index,So.sources.SILENT),this.balanceTables()}listenBalanceCells(){this.quill.on(So.events.SCROLL_OPTIMIZE,e=>{e.some(e=>!!["TD","TR","TBODY","TABLE"].includes(e.target.tagName)&&(this.quill.once(So.events.TEXT_CHANGE,(e,t,n)=>{n===So.sources.USER&&this.balanceTables()}),!0))})}},"modules/toolbar":ma,"themes/bubble":Ra,"themes/snow":Da,"ui/icons":ba,"ui/picker":wa,"ui/icon-picker":Ea,"ui/color-picker":Na,"ui/tooltip":ka},!0);const Pa=({value:e,onChange:t,placeholder:s,style:i})=>{const o=r.useRef(null),l=r.useRef(null);return r.useEffect(()=>{if(o.current&&!l.current){l.current=new So(o.current,{theme:"snow",modules:{toolbar:[[{header:[1,2,!1]}],["bold","italic","underline"],["link","image"]]},placeholder:s});const e=l.current;e.on("text-change",(n,r,s)=>{if("user"===s){const n=e.root.innerHTML;null==t||t("<p><br></p>"===n?"":n)}})}},[s]),r.useEffect(()=>{const t=l.current;if(t&&e!==t.root.innerHTML){const n=0===t.getText().trim().length;!e&&n||t.clipboard.dangerouslyPasteHTML(e||"")}},[e]),n.jsx("div",{ref:o,style:{minHeight:"200px",...i}})},Fa="_fileUploadWrapper_byo9w_1",Ua=({value:e,onChange:t,accept:o=".pdf,.doc,.docx,.xls,.xlsx,.txt,.zip,.rar",listType:l="text",maxCount:a=1,key:c,disabled:u=!1,maxSize:d=1e3,buttonText:h="上传文件"})=>{const[p,m]=r.useState(!1),[g,v]=r.useState(""),[b,y]=r.useState(""),[x,w]=r.useState("none"),[N,E]=r.useState([]),[k,S]=r.useState(!1),A=e=>{try{const n=e.split("/");let r=n[n.length-1];r.includes("?")&&(r=r.split("?")[0]);try{r=decodeURIComponent(r)}catch(t){}return r||"未知文件"}catch(n){return"未知文件"}},C=e=>e?Array.isArray(e)?e.filter(Boolean):"string"==typeof e?e.split(",").map(e=>e.trim()).filter(Boolean):[]:[],j=r.useMemo(()=>{const t=C(e);return JSON.stringify(t)},[e]),_=r.useRef(N);r.useEffect(()=>{_.current=N},[N]),r.useEffect(()=>{if(k)return void S(!1);const t=C(e),n=_.current.filter(e=>"done"===e.status).map(e=>e.url).filter(Boolean);if(JSON.stringify(n)!==JSON.stringify(t))if(t.length>0){const e=t.map((e,t)=>({uid:`-${t+1}`,name:A(e),status:"done",url:e}));E(e)}else E([])},[j,k]);const O=r.useCallback(e=>{t&&t(e)},[t]);return n.jsxs("div",{className:Fa,children:[n.jsx(s.Upload,{accept:o,listType:l,fileList:N,onPreview:async e=>{const t=e.url||e.preview,n=e.name||"",r=(e=>{const t=e.substring(e.lastIndexOf(".")).toLowerCase();return[".jpg",".jpeg",".png",".gif",".bmp",".webp"].includes(t)?"image":[".txt",".json",".xml",".log"].includes(t)?"text":"none"})(n);y(n),w(r),"image"===r?(e.url||e.preview||!e.originFileObj||(e.preview=await(e=>new Promise((t,n)=>{const r=new FileReader;r.readAsDataURL(e),r.onload=()=>t(r.result),r.onerror=e=>n(e)}))(e.originFileObj)),v(e.url||e.preview),m(!0)):t?window.open(t,"_blank"):s.message.info("文件预览不可用")},onChange:({file:e,fileList:t})=>{var n,r;if(S(!0),"done"===e.status){if(null==(n=e.response)?void 0:n.data){s.message.success(`${e.name} 文件上传成功`);const n=t.map(t=>{var n;return t.uid===e.uid&&(null==(n=t.response)?void 0:n.data)?{...t,url:t.response.data,name:t.name}:t});E(n);const r=n.filter(e=>"done"===e.status).map(e=>{var t;return(null==(t=e.response)?void 0:t.data)||e.url}).filter(Boolean);1===a?null==O||O(r[0]||void 0):null==O||O(r.length>0?r:void 0)}else s.message.error(`${e.name} 文件上传成功,但未获取到 URL。`),E(t.filter(t=>t.uid!==e.uid))}else if("removed"===e.status){s.message.success(`${e.name} 文件已移除`),E(t);const n=t.filter(e=>"done"===e.status).map(e=>{var t;return(null==(t=e.response)?void 0:t.data)||e.url}).filter(Boolean);1===a?null==O||O(void 0):null==O||O(n.length>0?n:void 0)}else if("error"===e.status){s.message.error(`${e.name} 文件上传失败: ${(null==(r=e.error)?void 0:r.message)||"未知错误"}`),E(t);const n=t.filter(e=>"done"===e.status).map(e=>{var t;return(null==(t=e.response)?void 0:t.data)||e.url}).filter(Boolean);1===a?null==O||O(n[0]||void 0):null==O||O(n.length>0?n:void 0)}else E(t)},customRequest:async e=>{var t;const{onSuccess:n,onError:r,file:o,onProgress:l}=e,a=1024*d*1024;if(o instanceof File&&o.size>a)return s.message.error(`文件大小不能超过 ${d}MB`),void r(new Error(`文件大小不能超过 ${d}MB`));const c=new FormData;c.append("file",o);const u=null==(t=null==f?void 0:f.getOrgInfo())?void 0:t.orgId;u&&c.append("orgId",u.toString());try{const e=await(async(e,t)=>{const n=f.getToken();try{return(await i.post("/api/sterilization-service/common/uploadFile",e,{timeout:12e4,headers:{"Content-Type":"multipart/form-data",Authorization:`Bearer ${n}`,accessToken:n,...null==t?void 0:t.headers},onUploadProgress:null==t?void 0:t.onUploadProgress})).data}catch(r){if("ECONNABORTED"===r.code)throw new Error("上传超时,请检查网络连接或文件大小");throw r}})(c,{headers:{"Content-Type":"multipart/form-data"},onUploadProgress:e=>{e.total&&l({percent:e.loaded/e.total*100})}});e&&e.data?n(e,o):r(new Error("上传成功但响应中缺少文件URL"),e)}catch(h){r(h)}},maxCount:a,disabled:u,showUploadList:{showDownloadIcon:!0,showRemoveIcon:!u},onRemove:e=>!0,children:N.length>=(a||1)?null:n.jsx(s.Button,{icon:n.jsx(St,{}),disabled:u,type:"primary",children:h})},c),n.jsxs(s.Modal,{visible:p,title:b,footer:null,onCancel:()=>{m(!1),v(""),w("none")},width:"image"===x?800:600,children:["image"===x&&n.jsx("img",{alt:"预览",style:{width:"100%"},src:g}),"text"===x&&n.jsx("pre",{style:{maxHeight:"500px",overflow:"auto",whiteSpace:"pre-wrap"},children:g})]})]})},za="_formLabel_om345_1",$a="_tabContainer_om345_9",Va="_tabHeader_om345_14",Ha="_tabContent_om345_17",Ka="_treeselectEllipsis_om345_28",Wa="_addonAfterSelect_om345_46",Ga="_customAddModalBody_om345_50",Za="_customDisabled_om345_57",Ya=e=>new Promise((t,n)=>{const r=new FileReader;r.readAsDataURL(e),r.onload=()=>t(r.result),r.onerror=e=>n(e)}),Ja=({value:e,onChange:t,accept:i="image/*",listType:o="picture-card",maxCount:l=1,maxSize:a=5,disabled:c=!1,...u})=>{const[d,h]=r.useState(!1),[f,p]=r.useState(""),[m,g]=r.useState(""),[v,b]=r.useState([]),y=e=>e?e.startsWith("data:")?e:`data:image/png;base64,${e}`:"",x=e=>e?e.includes(",")?e.split(",")[1]:e:"";r.useEffect(()=>{if(e&&Array.isArray(e)&&e.length>0){const t=e.map((e,t)=>{let n="",r="";if("string"==typeof e)r=x(e),n=y(e);else if(Array.isArray(e)&&e.length>0&&"number"==typeof e[0]){const t=(e=>{try{const t=new Uint8Array(e);let n="";for(let e=0;e<t.length;e++)n+=String.fromCharCode(t[e]);return`data:image/png;base64,${btoa(n)}`}catch(t){return""}})(e);r=x(t),n=t}return{uid:`-${t}`,name:`image-${t}.png`,status:"done",url:n,thumbUrl:n,response:{data:r,url:n}}});b(t)}else b([])},[e]);const w=r.useCallback(e=>{t&&t(e)},[t]),N=n.jsxs("div",{children:[n.jsx(ft,{}),n.jsx("div",{style:{marginTop:8},children:"上传"})]});return n.jsxs(n.Fragment,{children:[n.jsx(s.Upload,{accept:i,listType:o,fileList:v,onPreview:async e=>{let t=e.url;if(t||e.preview||!e.originFileObj?!t&&e.preview&&(t=e.preview):(e.preview=await Ya(e.originFileObj),t=e.preview),!t)return void s.message.error("无法预览图片:未找到图片数据");p(t),h(!0);const n=e.name||"预览图片";g(n)},onChange:async({file:e,fileList:t})=>{var n,r,i;const o=e=>{var t,n;return(null==(t=e.response)?void 0:t.data)&&"string"==typeof e.response.data?x(e.response.data):(null==(n=e.response)?void 0:n.url)&&"string"==typeof e.response.url?x(e.response.url):e.url&&"string"==typeof e.url?x(e.url):e.preview&&"string"==typeof e.preview?x(e.preview):null};if("done"===e.status){const i=(null==(n=e.response)?void 0:n.data)||(null==(r=e.response)?void 0:r.url)||e.url||e.preview;if(i&&"string"==typeof i){s.message.success(`${e.name} 处理成功`);const n=y(i),r=t.map(t=>t.uid===e.uid?{...t,url:n,thumbUrl:n,response:{...e.response,data:x(i),url:n}}:t);b(r);const l=r.filter(e=>"done"===e.status).map(o).filter(Boolean);w(l.length>0?l:void 0)}else s.message.error(`${e.name} 处理失败:无法获取图片数据`),b(t.filter(t=>t.uid!==e.uid))}else if("removed"===e.status){s.message.success(`${e.name} 已移除`),b(t);const n=t.filter(e=>"done"===e.status).map(o).filter(Boolean);w(n.length>0?n:void 0)}else"error"===e.status?(s.message.error(`${e.name} 处理失败: ${(null==(i=e.error)?void 0:i.message)||"未知错误"}`),b(t)):b(t)},customRequest:async e=>{const{onSuccess:t,onError:n,file:r,onProgress:i}=e,o=1024*a*1024;if(r instanceof File&&r.size>o)return s.message.error(`图片大小不能超过 ${a}MB`),void(null==n||n(new Error(`图片大小不能超过 ${a}MB`)));try{i({percent:0});const e=await Ya(r),n=x(e);i({percent:100});t({data:n,url:e,preview:e},r)}catch(l){s.message.error((null==l?void 0:l.message)||"图片处理失败"),n(l)}},beforeUpload:e=>{const t=1024*a*1024;if(e.size>t)return s.message.error(`图片大小不能超过 ${a}MB`),s.Upload.LIST_IGNORE;return!!e.type.startsWith("image/")||(s.message.error("只能上传图片文件"),s.Upload.LIST_IGNORE)},maxCount:l,disabled:c,...u,children:l&&v.length>=l?null:N}),n.jsx(s.Modal,{open:d,title:m,footer:null,onCancel:()=>h(!1),width:800,children:n.jsx("img",{alt:"preview",style:{width:"100%"},src:f})})]})},Xa="_fileUploadContainer_1qeig_1",Qa="_uploadButton_1qeig_1",ec="_uploadText_1qeig_4",tc="_previewContainer_1qeig_28",nc="_previewIcon_1qeig_31",rc="_previewInfo_1qeig_35",sc="_downloadLink_1qeig_38",ic="_fileSizeInfo_1qeig_46",oc=e=>{var t;switch(null==(t=e.split(".").pop())?void 0:t.toLowerCase()){case"jpg":case"jpeg":case"png":case"gif":case"bmp":case"webp":return n.jsx(Ze,{});case"mp4":case"avi":case"mov":case"wmv":case"flv":case"mkv":return n.jsx(jt,{});case"pdf":return n.jsx(Xe,{});case"doc":case"docx":return n.jsx(lt,{});case"xls":case"xlsx":return n.jsx(Ke,{});case"ppt":case"pptx":return n.jsx(tt,{});default:return n.jsx(st,{})}},lc=e=>{var t;const r=null==(t=e.split(".").pop())?void 0:t.toLowerCase();switch(r){case"jpg":case"jpeg":case"png":case"gif":case"bmp":case"webp":return n.jsx(s.Tag,{color:"blue",children:"图片"});case"mp4":case"avi":case"mov":case"wmv":case"flv":case"mkv":return n.jsx(s.Tag,{color:"orange",children:"视频"});case"pdf":return n.jsx(s.Tag,{color:"red",children:"PDF"});case"doc":case"docx":return n.jsx(s.Tag,{color:"blue",children:"Word"});case"xls":case"xlsx":return n.jsx(s.Tag,{color:"green",children:"Excel"});case"ppt":case"pptx":return n.jsx(s.Tag,{color:"orange",children:"PPT"});case"txt":return n.jsx(s.Tag,{color:"default",children:"文本"});case"zip":case"rar":case"7z":return n.jsx(s.Tag,{color:"purple",children:"压缩包"});default:return n.jsx(s.Tag,{color:"default",children:(null==r?void 0:r.toUpperCase())||"文件"})}},ac=e=>{if(0===e)return"0 B";const t=Math.floor(Math.log(e)/Math.log(1024));return parseFloat((e/Math.pow(1024,t)).toFixed(2))+" "+["B","KB","MB","GB"][t]},cc=e=>{var t;const n=null==(t=e.split(".").pop())?void 0:t.toLowerCase();return["jpg","jpeg","png","gif","bmp","webp"].includes(n||"")},uc=e=>{var t;const n=null==(t=e.split(".").pop())?void 0:t.toLowerCase();return["mp4","avi","mov","wmv","flv","mkv"].includes(n||"")},dc=(e,t)=>{if(!e)return e;if(/^(https?:|data:|blob:)/i.test(e))return e;if(!t)return e;return`${t.replace(/\/+$/,"")}${e.startsWith("/")?e:`/${e}`}`},hc=({value:e,onChange:t,accept:i="image/*,video/*",listType:o="picture-card",maxCount:l=5,disabled:a=!1,showFileType:c=!0,baseUrl:u,params:d})=>{const[h,p]=r.useState(!1),[m,g]=r.useState(null),[v,b]=r.useState(""),[y,x]=r.useState([]);r.useEffect(()=>{if(Array.isArray(e)){const t=e.map((e,t)=>({uid:`-${t}`,name:e.fileName,status:"done",url:dc(e.url,u)}));x(t)}else if("string"==typeof e)try{const t=JSON.parse(e);if(Array.isArray(t)){const e=t.map((e,t)=>({uid:`-${t}`,name:e.fileName,status:"done",url:dc(e.url,u)}));x(e)}else x([])}catch(t){x([])}else x([])},[e,u]);const w=r.useCallback(e=>{t&&t(e)},[t]),N=n.jsxs("div",{className:Qa,children:[n.jsx(ft,{}),n.jsx("div",{className:ec,children:"上传"})]});return n.jsxs("div",{className:Xa,children:[n.jsx(s.Upload,{accept:i,listType:o,fileList:y,onPreview:async e=>{e.url||e.preview||e.originFileObj&&(e.preview=await(e=>new Promise((t,n)=>{const r=new FileReader;r.readAsDataURL(e),r.onload=()=>t(r.result),r.onerror=e=>n(e)}))(e.originFileObj)),g(e),p(!0),b(e.name||e.url.substring(e.url.lastIndexOf("/")+1))},onChange:({file:e,fileList:t})=>{var n;if(x(t),"done"===e.status||"removed"===e.status){const n=t.filter(e=>"done"===e.status).map(e=>{var t;return{url:(null==(t=e.response)?void 0:t.data)||e.url||"",fileName:e.name}}).filter(e=>e.url);w(n),"done"===e.status&&s.message.success(`${e.name} 文件上传成功`),"removed"===e.status&&s.message.success(`${e.name} 文件已移除`)}else"error"===e.status&&s.message.error(`${e.name} 文件上传失败: ${(null==(n=e.error)?void 0:n.message)||"未知错误"}`)},customRequest:async e=>{var t;const{onSuccess:n,onError:r,file:i,onProgress:o}=e;if(i instanceof File&&i.size>104857600)return s.message.error("文件大小不能超过 100MB"),void(null==r||r(new Error("文件大小不能超过 100MB")));const l=new FormData;l.append("file",i);const a=null==(t=null==f?void 0:f.getOrgInfo())?void 0:t.orgId;a&&l.append("orgId",a.toString()),d&&"object"==typeof d&&Object.entries(d).forEach(([e,t])=>{null!=t&&l.append(e,"string"==typeof t||t instanceof Blob?t:String(t))});try{const e=await q(l,{headers:{"Content-Type":"multipart/form-data"},onUploadProgress:e=>{e.total&&(null==o||o({percent:e.loaded/e.total*100}))}});e&&e.data?null==n||n(e,i):null==r||r(new Error("上传成功但响应中缺少文件URL"),e)}catch(c){null==r||r(c)}},maxCount:l,disabled:a,onRemove:e=>!0,children:y.length>=(l||1)?null:N}),n.jsx(s.Modal,{open:h,title:v,footer:null,onCancel:()=>p(!1),width:800,children:m&&n.jsx("div",{className:tc,style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"10px"},children:(m.url||m.preview)&&n.jsxs(n.Fragment,{children:[cc(m.name)&&n.jsx("img",{alt:"preview",style:{maxWidth:"100%",maxHeight:"600px",objectFit:"contain"},src:m.url||m.preview}),uc(m.name)&&n.jsx("video",{style:{maxWidth:"100%",maxHeight:"600px"},controls:!0,src:m.url||m.preview}),!cc(m.name)&&!uc(m.name)&&n.jsx("div",{className:nc,style:{fontSize:"48px"},children:oc(m.name)}),n.jsx("div",{className:rc,children:lc(m.name)}),n.jsx("div",{children:n.jsx("a",{href:m.url,target:"_blank",rel:"noopener noreferrer",className:sc,children:"下载/查看原文件"})}),m.size&&n.jsxs("div",{className:ic,children:["文件大小: ",ac(m.size)]})]})})})]})},fc="_fileFoldContainer_1dpfd_1",pc="_uploadWrapper_1dpfd_8",mc="_uploadBtn_1dpfd_11",gc="_fileList_1dpfd_16",vc="_fileItem_1dpfd_24",bc="_fileName_1dpfd_29",yc="_deleteIcon_1dpfd_37",xc=({value:e,onChange:t,accept:i="*/*",maxCount:o=100,disabled:l=!1,buttonText:a="文件夹",baseUrl:c,params:u})=>{const[d,h]=r.useState([]),p=e=>{if(!e)return e;if(/^(https?:|data:|blob:)/i.test(e))return e;if(!c)return e;return`${c.replace(/\/+$/,"")}${e.startsWith("/")?e:`/${e}`}`};r.useEffect(()=>{if(Array.isArray(e)){const t=e.map((e,t)=>({uid:`-${t}`,name:e.fileName,status:"done",url:p(e.url)}));h(t)}else if("string"==typeof e)try{const t=JSON.parse(e);if(Array.isArray(t)){const e=t.map((e,t)=>({uid:`-${t}`,name:e.fileName,status:"done",url:p(e.url)}));h(e)}else h([])}catch(t){h([])}else h([])},[e,c]);const m=r.useCallback(e=>{t&&t(e)},[t]);return n.jsxs("div",{className:fc,children:[n.jsx("div",{className:pc,children:n.jsx(s.Upload,{accept:i,showUploadList:!1,fileList:d,onChange:({file:e,fileList:t})=>{var n;if(h(t),"done"===e.status||"removed"===e.status){const n=t.filter(e=>"done"===e.status).map(e=>{var t;return{url:(null==(t=e.response)?void 0:t.data)||e.url||"",fileName:e.name}}).filter(e=>e.url);m(n),"done"===e.status&&s.message.success(`${e.name} 文件上传成功`),e.status}else"error"===e.status&&s.message.error(`${e.name} 文件上传失败: ${(null==(n=e.error)?void 0:n.message)||"未知错误"}`)},customRequest:async e=>{var t;const{onSuccess:n,onError:r,file:i,onProgress:o}=e;if(i instanceof File&&i.size>104857600)return s.message.error("文件大小不能超过 100MB"),void(null==r||r(new Error("文件大小不能超过 100MB")));const l=new FormData;l.append("file",i);const a=null==(t=null==f?void 0:f.getOrgInfo())?void 0:t.orgId;a&&l.append("orgId",a.toString()),u&&"object"==typeof u&&Object.entries(u).forEach(([e,t])=>{null!=t&&l.append(e,"string"==typeof t||t instanceof Blob?t:String(t))});try{const e=await q(l,{headers:{"Content-Type":"multipart/form-data"},onUploadProgress:e=>{e.total&&(null==o||o({percent:e.loaded/e.total*100}))}});e&&e.data?null==n||n(e,i):null==r||r(new Error("上传成功但响应中缺少文件URL"),e)}catch(c){null==r||r(c)}},maxCount:o,disabled:l,multiple:!0,children:n.jsx(s.Button,{icon:n.jsx(ft,{}),type:"dashed",className:mc,children:a})})}),n.jsx("div",{className:gc,children:d.map(e=>n.jsxs("div",{className:vc,children:[n.jsx("span",{className:bc,onClick:()=>(async e=>{if(e.url)try{const t=await fetch(e.url,{method:"GET",mode:"cors",credentials:"include",referrerPolicy:"no-referrer",headers:{}});if(!t.ok)throw new Error("文件下载失败");const n=await t.blob(),r=window.top||window.parent||window,i=window.URL.createObjectURL(n),o=r.document.createElement("a");o.href=i,o.download=e.name,o.rel="noopener noreferrer",o.style.display="none",r.document.body.appendChild(o),o.click(),setTimeout(()=>{r.document.body.removeChild(o),window.URL.revokeObjectURL(i)},100),s.message.success("文件下载成功")}catch(t){try{const t=document.createElement("a");t.href=e.url,t.download=e.name,t.target="_blank",t.rel="noopener noreferrer",t.referrerPolicy="no-referrer",t.click(),s.message.info("正在尝试下载文件...")}catch(n){s.message.error("文件下载失败,请稍后重试")}}})(e),style:{cursor:"pointer"},children:e.name}),!l&&n.jsx(Fe,{className:yc,onClick:()=>(e=>{const t=d.filter(t=>t.uid!==e.uid);h(t);const n=t.filter(e=>"done"===e.status).map(e=>{var t;return{url:(null==(t=e.response)?void 0:t.data)||e.url||"",fileName:e.name}}).filter(e=>e.url);m(n)})(e)})]},e.uid))})]})},{RangePicker:wc}=s.DatePicker,{TextArea:Nc}=s.Input,Ec=r.forwardRef((e,t)=>{var i;const{visible:c,mode:u,config:d,initialValues:h,onOk:p,onCancel:m,title:g,loading:v=!1,oneditFormChange:b,modalProps:y={},CustomModalFooter:x,tab:w=!1,validateConfig:N,activeTab:E,onTabChange:k}=e,[S]=s.Form.useForm(),[A,C]=r.useState("view"==u),[j,_]=r.useState(void 0);r.useRef(null);const L=r.useRef(!1);r.useEffect(()=>{if(c&&w){setTimeout(()=>{const e=document.querySelector(".ant-modal-body");e&&!L.current&&(_(e.clientHeight),L.current=!0)},100)}c||(_(void 0),L.current=!1)},[c,w]),r.useEffect(()=>{C("view"==u)},[u]),r.useImperativeHandle(t,()=>({setFieldsValue:e=>{S.setFieldsValue(e)},getFieldsValue:()=>S.getFieldsValue(),setActiveTab:e=>{I(e),null==k||k(e)}}));const[q,I]=r.useState(void 0),R=E??q,B=e=>{void 0===E&&I(e),null==k||k(e)};r.useEffect(()=>{if(c)if(S.resetFields(),w&&d&&d.length>0&&void 0===E&&I(d[0].label),"edit"!==u&&"view"!==u||!h){const e={};w?d.forEach(t=>{(t.children||[]).forEach(t=>{var n,r;const s=void 0!==t.defaultValue?t.defaultValue:null==(r=null==(n=t.options)?void 0:n[0])?void 0:r.value;void 0!==s&&(e[t.name]=s)})}):d.forEach(t=>{void 0!==t.defaultValue&&(e[t.name]=t.defaultValue)}),Object.keys(e).length>0&&S.setFieldsValue(e),V(S.getFieldValue("useOrgId")||z)}else if(w){const e={...h},t=[];d.forEach(e=>{e.children.forEach(e=>{var n,r;t.push({...e,defaultValue:e.defaultValue||(null==(r=null==(n=e.options)?void 0:n[0])?void 0:r.value)||e.defaultValue})})}),t.forEach(t=>{const n=e[t.name];if("datePicker"===t.type&&n)e[t.name]=o(n);else if("rangePicker"===t.type)if("string"==typeof t.name&&t.name.includes("/")){const[n,r]=t.name.split("/"),s=e[n],i=e[r];s&&i&&(e[t.name]=[o(s),o(i)])}else n&&Array.isArray(n)&&(e[t.name]=n.map(e=>o(e)));else if("treeSelect"===t.type&&t.multiple&&n)"string"==typeof n&&(e[t.name]=n.split(","));else if("Radio"===t.type&&t.options&&(0===n||1===n||"0"===n||"1"===n||n)){const r=t.options.find(e=>e.value==n);r&&(e[t.name]=r.value)}}),S.setFieldsValue(e)}else{const e={...h};d.forEach(t=>{const n=e[t.name];if("datePicker"===t.type&&n)e[t.name]=o(n);else if("rangePicker"===t.type)if("string"==typeof t.name&&t.name.includes("/")){const[n,r]=t.name.split("/"),s=e[n],i=e[r];s&&i&&(e[t.name]=[o(s),o(i)])}else n&&Array.isArray(n)&&(e[t.name]=n.map(e=>o(e)));else if("treeSelect"===t.type&&t.multiple&&n)"string"==typeof n&&(e[t.name]=n.split(","));else if("Radio"===t.type&&t.options&&(0===n||1===n||"0"===n||"1"===n||n)){const r=t.options.find(e=>e.value==n);r&&(e[t.name]=r.value)}}),S.setFieldsValue(e)}else S.resetFields()},[c,u,h,S]),r.useEffect(()=>{if(!c)return;if("edit"===u||"view"===u)return;const e={};w?d.forEach(t=>{(t.children||[]).forEach(t=>{var n,r;if(void 0!==S.getFieldValue(t.name))return;const s=void 0!==t.defaultValue?t.defaultValue:null==(r=null==(n=t.options)?void 0:n[0])?void 0:r.value;void 0!==s&&(e[t.name]=s)})}):d.forEach(t=>{void 0===S.getFieldValue(t.name)&&void 0!==t.defaultValue&&(e[t.name]=t.defaultValue)}),Object.keys(e).length>0&&S.setFieldsValue(e)},[d,w,c,u,S]),r.useEffect(()=>{if(c)if("edit"!==u&&"view"!==u||!h)V(S.getFieldValue("useOrgId")||z);else if(w){const e={...h},t=[];d.forEach(e=>{e.children.forEach(e=>{var n,r;t.push({...e,defaultValue:e.defaultValue||(null==(r=null==(n=e.options)?void 0:n[0])?void 0:r.value)||e.defaultValue})})}),t.forEach(t=>{if("datePicker"===t.type&&e[t.name])e[t.name]=o(e[t.name]);else if("rangePicker"===t.type)if("string"==typeof t.name&&t.name.includes("/")){const[n,r]=t.name.split("/"),s=e[n],i=e[r];s&&i&&(e[t.name]=[o(s),o(i)])}else e[t.name]&&Array.isArray(e[t.name])&&(e[t.name]=e[t.name].map(e=>o(e)));else"treeSelect"===t.type&&t.multiple&&e[t.name]&&"string"==typeof e[t.name]&&(e[t.name]=e[t.name].split(","))})}else{const e={...h};d.forEach(t=>{if("datePicker"===t.type&&e[t.name])e[t.name]=o(e[t.name]);else if("rangePicker"===t.type)if("string"==typeof t.name&&t.name.includes("/")){const[n,r]=t.name.split("/"),s=e[n],i=e[r];s&&i&&(e[t.name]=[o(s),o(i)])}else e[t.name]&&Array.isArray(e[t.name])&&(e[t.name]=e[t.name].map(e=>o(e)));else"treeSelect"===t.type&&t.multiple&&e[t.name]&&"string"==typeof e[t.name]&&(e[t.name]=e[t.name].split(","))})}else S.resetFields()},[d]);const D=r.useCallback(e=>{if(w){for(const t of d)if(t.children){const n=t.children.find(t=>t.name===e);if(n)return n.label}}else{const t=d.find(t=>t.name===e);if(t)return t.label}return e},[d,w]),P=r.useCallback((e,t)=>{const n=[];let r="";const s=new Set;return t&&Array.isArray(t)&&t.length>0&&(t.forEach(t=>{const i=e.filter(e=>t.includes(e.field)&&!s.has(e.field));if(i.length>1){const e=i.map(e=>D(e.field)).join("、")+"同时重复";i.forEach(t=>{n.push({name:t.field,errors:[e]}),s.add(t.field)}),r||(r=e)}else if(1===i.length){const e=i[0],t=D(e.field)+"重复";n.push({name:e.field,errors:[t]}),s.add(e.field),r||(r=t)}}),e.forEach(e=>{if(!s.has(e.field)){const t=D(e.field)+"重复";n.push({name:e.field,errors:[t]}),r||(r=t)}})),{errorFields:n,errorMessage:r||"验证失败"}},[D]),F=r.useMemo(()=>{if(!(null==N?void 0:N.realtime))return()=>{};const e=N.realtimeDelay||500;return l.debounce((e,t)=>{(async(e,t)=>{if(!N||!N.realtime)return;const{validateApi:n,validateFields:r,validateMethod:s="POST",validateParams:i,validateMessage:o="验证失败",union:l=!0,group:a}=N,c=t&&r.includes(t)?[t]:r,u=(null==h?void 0:h.id)||(null==h?void 0:h.ID)||null;let d;if(i)d=i(e);else{const t={};c.forEach(n=>{void 0!==e[n]&&null!==e[n]&&""!==e[n]&&(t[n]=e[n])}),d={field:c,value:t,id:u,union:l?1:0,group:a}}const f="GET"===s?await T(d,n):await O(d,n);if(200===f.code&&Array.isArray(f.data)){const e=f.data.filter(e=>!0===e.value);if(f.data.forEach(e=>{!1===e.value&&S.setFields([{name:e.field,errors:[]}])}),e.length>0){let t=[];if(a&&Array.isArray(a)&&a.length>0){const n=P(e,a);t=n.errorFields}else if(l&&e.length>1){const n=e.map(e=>D(e.field)).join("、")+"同时重复";e.forEach(e=>{t.push({name:e.field,errors:[n]})})}else e.forEach(e=>{const n=D(e.field);t.push({name:e.field,errors:[n+"重复"]})});t.length>0&&S.setFields(t)}}})(e,t).catch(()=>{})},e)},[N]),U=(e,t)=>{if("name"==t.name&&!(null==S?void 0:S.getFieldValue("pyCode"))){const t=(n=e.target.value,a.pinyin(n,{pattern:"first",toneType:"none",type:"array",nonZh:"consecutive"}).join("").toUpperCase());S.setFieldsValue({pyCode:t})}var n},z=null==(i=f.getOrgInfo())?void 0:i.orgId,[$,V]=r.useState(z),H=r.useMemo(()=>d.some(e=>w&&e.children?e.children.some(e=>"deptSelect"===e.type):"deptSelect"===e.type),[d,w]),K=r.useMemo(()=>d.some(e=>w&&e.children?e.children.some(e=>"orgSelect"===e.type):"orgSelect"===e.type),[d,w]);r.useEffect(()=>{H&&J()},[$,H]),r.useEffect(()=>{K&&X()},[K]);const[W,G]=r.useState([]),[Z,Y]=r.useState([]),J=async()=>{const e=await O({orgId:$,pageNum:1,pageSize:0},"/common-service/common/queryDeptById");if(200===e.code){const t=[{name:"通用",id:-1},...e.data||[]];G(t||[])}},X=async()=>{const e=await O({loginOrgId:z,pageNum:1,pageSize:0},"/common-service/common/getOrgList");200===e.code&&Y((null==e?void 0:e.data)||[])},Q=e=>{if("view"!==u)return;const t=S.getFieldValue(e);if(null==t||""===t)return void s.message.warning("没有内容可复制");let n="";if("object"==typeof t)if(o.isDayjs(t))n=t.format("YYYY-MM-DD HH:mm:ss");else if(Array.isArray(t))n=t.map(e=>o.isDayjs(e)?e.format("YYYY-MM-DD HH:mm:ss"):String(e)).join(", ");else if(t.addProvince){const e=[t.addProvince,t.addCity,t.addCounty,t.addStreet,t.address].filter(Boolean);n=e.join("-")}else n=JSON.stringify(t);else n=String(t);navigator.clipboard.writeText(n).then(()=>{s.message.success("已复制到剪贴板")}).catch(()=>{const e=document.createElement("textarea");e.value=n,e.style.position="fixed",e.style.opacity="0",document.body.appendChild(e),e.select();try{document.execCommand("copy"),s.message.success("已复制到剪贴板")}catch(t){}document.body.removeChild(e)})},ee=e=>{var t,r,i,o;const{type:l,name:a,placeholder:c,options:u,rules:d,...h}=e,f=A?"":c||`请输入${e.label}`,p=A?"":c||`请选择${e.label}`;switch(l){case"input":return n.jsx(s.Input,{placeholder:f,...h,readOnly:A||h.readOnly,onDoubleClick:()=>Q(a),onBlur:t=>U(t,e)});case"inputoption":return n.jsx(s.Input,{placeholder:f,...h,readOnly:A||h.readOnly,onDoubleClick:()=>Q(a),addonAfter:n.jsx(s.Form.Item,{name:e.optionname,noStyle:!0,initialValue:null==(r=null==(t=e.options)?void 0:t[0])?void 0:r.value,children:n.jsx(M,{disabled:A,options:e.options,allowClear:!A})})});case"inputnumberoption":return n.jsx(s.InputNumber,{className:Wa,placeholder:f,addonAfter:n.jsx(s.Form.Item,{name:e.optionname,noStyle:!0,initialValue:null==(o=null==(i=e.options)?void 0:i[0])?void 0:o.value,children:n.jsx(M,{disabled:A,options:e.options,allowClear:!A})}),...h});case"password":return n.jsx(s.Input.Password,{placeholder:f,...h,readOnly:A||h.readOnly,onDoubleClick:()=>Q(a)});case"rangePicker":return n.jsx(wc,{style:{width:"100%",cursor:A?"not-allowed":"auto",...h.style},placeholder:[p||"开始日期",p||"结束日期"],...h,disabled:A||h.disabled,allowClear:!A});case"datePicker":return n.jsx(s.DatePicker,{style:{width:"100%",cursor:A?"not-allowed":"auto",...h.style},placeholder:p,...h,disabled:A||h.disabled,allowClear:!A});case"InputNumber":return n.jsx(s.InputNumber,{style:{width:"100%",cursor:A?"not-allowed":"auto",...h.style},placeholder:f,...h,readOnly:A||h.readOnly,onDoubleClick:()=>Q(a)});case"Radio":return n.jsx(s.Form.Item,{name:a,noStyle:!0,children:n.jsx(s.Radio.Group,{style:{pointerEvents:A?"none":"auto",...h.style},disabled:A||h.disabled,options:u,...h})});case"Checkbox":return n.jsx(s.Form.Item,{name:a,noStyle:!0,children:n.jsx(s.Checkbox.Group,{style:{width:"100%",pointerEvents:A?"none":"auto",...h.style||{}},options:u,disabled:A||h.disabled,...h})});case"imageVideo":return n.jsx("div",{style:{pointerEvents:A?"none":"auto"},children:n.jsx(s.Form.Item,{name:a,noStyle:!0,children:n.jsx(hc,{...h})})});case"filefold":return n.jsx("div",{style:{pointerEvents:A?"none":"auto"},children:n.jsx(s.Form.Item,{name:a,noStyle:!0,children:n.jsx(xc,{...h})})});case"treeSelect":{const t=!!e.multiple||(null==h?void 0:h.multiple)||(null==h?void 0:h.treeCheckable),r=e=>{try{const t=(e||[]).map(e=>{var t,n;return"string"==typeof(null==e?void 0:e.label)?e.label:(null==(n=null==(t=null==e?void 0:e.label)?void 0:t.props)?void 0:n.children)??(null==e?void 0:e.value)}).filter(Boolean).join(",");return n.jsxs("span",{title:t,children:["+",e.length,"…"]})}catch(t){return n.jsxs("span",{children:["+",(null==e?void 0:e.length)||0,"…"]})}};return n.jsx(s.Form.Item,{name:a,noStyle:!0,children:n.jsx(M,{className:Ka,allowClear:!A,style:{width:"100%",cursor:A?"not-allowed":"auto",...h.style},placeholder:f,treeData:e.options,...t?{maxTagCount:1,maxTagPlaceholder:r}:{},...h,disabled:A||h.disabled})})}case"select":{const t=!!e.multiple||(null==h?void 0:h.multiple)||(null==h?void 0:h.treeCheckable),r=e=>{try{const t=(e||[]).map(e=>{var t,n;return"string"==typeof(null==e?void 0:e.label)?e.label:(null==(n=null==(t=null==e?void 0:e.label)?void 0:t.props)?void 0:n.children)??(null==e?void 0:e.value)}).filter(Boolean).join(",");return n.jsxs("span",{title:t,children:["+",e.length,"…"]})}catch(t){return n.jsxs("span",{children:["+",(null==e?void 0:e.length)||0,"…"]})}};return n.jsx(s.Form.Item,{name:a,noStyle:!0,children:n.jsx(M,{className:Ka,allowClear:!A,style:{width:"100%",cursor:A?"not-allowed":"auto",...h.style},placeholder:f,treeData:e.options,...t?{maxTagCount:1,maxTagPlaceholder:r}:{},...h,disabled:A||h.disabled})})}case"upload":return n.jsx("div",{style:{pointerEvents:A?"none":"auto"},children:n.jsx(s.Form.Item,{name:a,noStyle:!0,children:n.jsx(qt,{value:e.value,...h},`upload_${e.name}`)})});case"file":return n.jsx("div",{style:{pointerEvents:A?"none":"auto"},children:n.jsx(s.Form.Item,{name:a,noStyle:!0,children:n.jsx(Ua,{...h})})});case"textarea":return n.jsx(Nc,{rows:4,placeholder:f,...h,readOnly:A||h.readOnly,onDoubleClick:()=>Q(a)});case"area":return n.jsx("div",{style:{pointerEvents:A?"none":"auto"},onDoubleClick:()=>Q(a),children:n.jsx(s.Form.Item,{name:a,noStyle:!0,children:n.jsx(Lt,{...h,disabled:A})})});case"richText":const{style:l,...c}=h;return n.jsx("div",{style:{pointerEvents:A?"none":"auto"},onDoubleClick:()=>Q(a),children:n.jsx(s.Form.Item,{name:a,noStyle:!0,children:n.jsx(Pa,{style:l})})});case"doubleValue":return n.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[n.jsx(s.Form.Item,{name:e.firstLabel||"first",noStyle:!0,children:n.jsx(s.InputNumber,{style:{width:"100%",cursor:A?"not-allowed":"auto",...h.style},placeholder:e.firstPlaceholder||`请输入${e.firstLabel||"最小值"}`,decimalSeparator:".",parser:e=>{if(!e)return"";const t=e.replace(/[^\d.,-]/g,"").replace(/,/g,"."),n=t.split(".");return n.length>2?n[0]+"."+n.slice(1).join(""):t},...h})}),n.jsx("span",{style:{margin:"0 10px"},children:e.separator||"至"}),n.jsx(s.Form.Item,{name:e.secondLabel||"second",noStyle:!0,children:n.jsx(s.InputNumber,{style:{width:"100%",cursor:A?"not-allowed":"auto",...h.style},placeholder:e.secondPlaceholder||`请输入${e.secondLabel||"最大值"}`,decimalSeparator:".",parser:e=>{if(!e)return"";const t=e.replace(/[^\d.,-]/g,"").replace(/,/g,"."),n=t.split(".");return n.length>2?n[0]+"."+n.slice(1).join(""):t},...h})}),n.jsx("span",{style:{margin:"0 10px"},children:e.lastUnit})]});case"deptSelect":return n.jsx(s.Form.Item,{name:a,noStyle:!0,children:n.jsx(M,{allowClear:!0,fieldNames:{label:"name",value:"id"},style:{width:"100%"},placeholder:p,options:W,disabled:A||h.disabled,...h})});case"orgSelect":return n.jsx(s.Form.Item,{name:a,noStyle:!0,children:n.jsx(M,{onChange:e=>{V(e)},allowClear:!0,fieldNames:{label:"name",value:"id"},style:{width:"100%"},placeholder:p,options:Z,disabled:A||h.disabled,...h})});case"uploadByte":return n.jsx("div",{style:{pointerEvents:A?"none":"auto"},children:n.jsx(s.Form.Item,{name:a,noStyle:!0,children:n.jsx(Ja,{disabled:A||h.disabled,...h})})});case"custom":if(e.component){const t=e.component;return n.jsx(t,{disabled:A||h.disabled,...h})}return e.render?e.render({...h,name:a,disabled:A||h.disabled}):n.jsx(s.Input,{placeholder:f,...h,readOnly:A});default:return n.jsx(s.Input,{placeholder:f,...h,readOnly:A||h.readOnly,onDoubleClick:()=>Q(a)})}},te=g||("add"===u?"新增":"edit"===u?"编辑":"查看"),ne=e=>n.jsx(s.Tooltip,{title:e,placement:"topLeft",children:n.jsx("span",{className:za,children:e})}),re=e=>{const t=e.findIndex(e=>"upload"===e.type||"uploadByte"===e.type);if(-1===t||1===(e[t].uploadRowSpan||1))return n.jsx(s.Row,{gutter:24,justify:"start",children:e.map(e=>n.jsx(s.Col,{span:e.colSpan||6,children:n.jsx(s.Form.Item,{label:ne(e.label),name:e.name,rules:e.rules,initialValue:e.defaultValue,className:A||e.disabled?Za:"",children:ee(e)},e.name)},e.name))});const r=e[t],i=r.colSpan||6,o=r.uploadRowSpan||1,l=e.slice(0,t),a=e.slice(t+1);let c=0,u=[];const d=[];for(const n of a){const e=n.colSpan||6;c+e>24?(u.length&&d.push(u),u=[n],c=e):(u.push(n),c+=e)}u.length&&d.push(u);const h=d.slice(0,o),f=d.slice(o);return n.jsxs(n.Fragment,{children:[l.length>0&&n.jsx(s.Row,{gutter:24,justify:"start",children:l.map(e=>n.jsx(s.Col,{span:e.colSpan||6,children:n.jsx(s.Form.Item,{label:ne(e.label),name:e.name,rules:e.rules,initialValue:e.defaultValue,className:A||e.disabled?Za:"",children:ee(e)},e.name)},e.name))}),n.jsxs("div",{style:{display:"flex",alignItems:"flex-start"},children:[n.jsx("div",{style:{width:i/24*100+"%",flexShrink:0,paddingRight:12},children:n.jsx(s.Form.Item,{label:ne(r.label),name:r.name,rules:r.rules,initialValue:r.defaultValue,className:A||r.disabled?Za:"",children:ee(r)},r.name)}),n.jsx("div",{style:{flex:1,overflow:"hidden"},children:h.map((e,t)=>n.jsx(s.Row,{gutter:24,justify:"start",children:e.map(e=>n.jsx(s.Col,{span:e.colSpan||6,children:n.jsx(s.Form.Item,{label:ne(e.label),name:e.name,rules:e.rules,initialValue:e.defaultValue,className:A||e.disabled?Za:"",children:ee(e)},e.name)},e.name))},t))})]}),f.map((e,t)=>n.jsx(s.Row,{gutter:24,justify:"start",children:e.map(e=>n.jsx(s.Col,{span:e.colSpan||6,children:n.jsx(s.Form.Item,{label:ne(e.label),name:e.name,rules:e.rules,initialValue:e.defaultValue,className:A||e.disabled?Za:"",children:ee(e)},e.name)},e.name))},`below-${t}`))]})},se=()=>w?n.jsx("div",{className:$a,children:n.jsx(s.Tabs,{className:Va,activeKey:R,onChange:B,children:d.map(e=>n.jsx(s.Tabs.TabPane,{tab:ne(e.label),forceRender:!0,children:n.jsx("div",{className:Ha,children:re((null==e?void 0:e.children)||[])})},e.label))})}):re(d);return n.jsx(s.Modal,{title:te,open:c,onOk:async()=>{try{const e=await S.validateFields();N&&await(async e=>{var t,n,r,s,i,o;if(!N)return;const{validateApi:l,validateFields:a,validateMethod:c="POST",validateParams:u,validateMessage:d="验证失败",union:f=!1,group:p=[]}=N,m=(null==h?void 0:h.id)||(null==h?void 0:h.ID)||null;if(u){const r=u(e),s="GET"===c?await T(r,l):await O(r,l);if(200!==s.code){const e=s.msg||d;throw new Error(e)}if(Array.isArray(s.data)){const e=s.data.filter(e=>!0===e.value);if(e.length>0){const t=e.map(e=>({name:e.field,errors:[d]}));throw S.setFields(t),new Error(d)}}else if(!1===s.data||!1===(null==(t=s.data)?void 0:t.valid)){const e=(null==(n=s.data)?void 0:n.message)||s.msg||d;throw new Error(e)}return}if(p&&p.length>0){const t={};a.forEach(n=>{void 0!==e[n]&&null!==e[n]&&(t[n]=e[n])});const n={field:a,value:t,id:m,union:f?1:0,group:p},i="GET"===c?await T(n,l):await O(n,l);if(200!==i.code){const e=i.msg||d;throw new Error(e)}if(Array.isArray(i.data)){const e=i.data.filter(e=>!0===e.value);if(e.length>0){const{errorFields:t,errorMessage:n}=P(e,p);throw S.setFields(t),new Error(n)}}else if(!1===i.data||!1===(null==(r=i.data)?void 0:r.valid)){const e=(null==(s=i.data)?void 0:s.message)||i.msg||d;throw new Error(e)}}else{const t={};a.forEach(n=>{void 0!==e[n]&&null!==e[n]&&(t[n]=e[n])});const n={field:a,value:t,id:m,union:f?1:0},r="GET"===c?await T(n,l):await O(n,l);if(200!==r.code){const e=r.msg||d;throw new Error(e)}if(Array.isArray(r.data)){const e=r.data.filter(e=>!0===e.value);if(e.length>0){let t=[],n=d;if(p&&Array.isArray(p)&&p.length>0){const r=P(e,p);t=r.errorFields,n=r.errorMessage}else if(f&&e.length>1){const r=e.map(e=>D(e.field));n=r.join("、")+"同时重复",t=e.map(e=>({name:e.field,errors:[n]}))}else t=e.map(e=>{const t=D(e.field);return{name:e.field,errors:[t+"重复"]}}),1===e.length&&(n=D(e[0].field)+"重复");throw S.setFields(t),new Error(n)}}else if(!1===r.data||!1===(null==(i=r.data)?void 0:i.valid)){const e=(null==(o=r.data)?void 0:o.message)||r.msg||d;throw new Error(e)}}})(e);const t={...e},n=[];w?d.forEach(e=>{e.children&&n.push(...e.children)}):n.push(...d),n.forEach(e=>{var n,r,s,i;if(void 0===e.defaultValue||void 0!==t[e.name]&&null!==t[e.name]||(t[e.name]=e.defaultValue),"datePicker"===e.type&&t[e.name])o.isDayjs(t[e.name])&&(t[e.name]=e.dateFormat?t[e.name].format(e.dateFormat):t[e.name].toISOString());else if("rangePicker"===e.type&&t[e.name])if("string"==typeof e.name&&e.name.includes("/")){const[n,r]=e.name.split("/");if(Array.isArray(t[e.name])&&2===t[e.name].length){const[s,i]=t[e.name],l=t=>o.isDayjs(t)?e.dateFormat?t.format(e.dateFormat):t.toISOString():t;t[n]=l(s),t[r]=l(i),delete t[e.name]}}else Array.isArray(t[e.name])&&(t[e.name]=t[e.name].map(t=>o.isDayjs(t)?e.dateFormat?t.format(e.dateFormat):t.toISOString():t));if("select"===e.type&&e.labelName){const s=null==(n=e.options)?void 0:n.find(n=>{var r;return n[(null==(r=null==e?void 0:e.fieldNames)?void 0:r.value)||"value"]===t[e.name]}),i=s?s[(null==(r=null==e?void 0:e.fieldNames)?void 0:r.label)||"label"]:void 0;t[e.labelName]=i}if("treeSelect"===e.type&&e.multiple&&(t[e.name]=null==(s=t[e.name])?void 0:s.join(","),e.labelName)){const n=((null==(i=t[e.name])?void 0:i.split(","))||[]).map(t=>{var n,r;const s=null==(n=e.options)?void 0:n.find(n=>{var r;return n[(null==(r=null==e?void 0:e.fieldNames)?void 0:r.value)||"value"]===t});return s?s[(null==(r=null==e?void 0:e.fieldNames)?void 0:r.label)||"label"]:void 0}).filter(Boolean);t[e.labelName]=n.join(",")}if("Radio"===e.type&&e.options&&void 0!==t[e.name]&&null!==t[e.name]){const n=e.options.find(n=>n.value==t[e.name]);n&&"number"==typeof n.value&&(t[e.name]=Number(t[e.name]))}}),await p(t)}catch(e){if(w&&(null==e?void 0:e.errorFields)&&Array.isArray(e.errorFields)&&d&&d.length>0){const t=e.errorFields.map(e=>Array.isArray(e.name)?e.name[0]:e.name),n=d.find(e=>e.label===R),r=((null==n?void 0:n.children)||[]).map(e=>e.name);if(!t.some(e=>r.includes(e)))for(const s of d){const t=(s.children||[]).map(e=>e.name),n=e.errorFields.filter(e=>{const n=Array.isArray(e.name)?e.name[0]:e.name;return t.includes(n)});if(n.length>0){void 0===E&&I(s.label),null==k||k(s.label),setTimeout(()=>{S.setFields(e.errorFields);const t=n[0],r=Array.isArray(t.name)?t.name[0]:t.name;try{S.scrollToField(r,{behavior:"smooth",block:"center"})}catch(s){}},100);break}}}(null==e?void 0:e.message)&&(s.message.error(e.message),(null==e?void 0:e.errorFields)&&S.setFields(e.errorFields))}},onCancel:m,width:y.width||800,confirmLoading:v,destroyOnClose:!0,maskClosable:!1,top:50,classNames:{body:Ga},styles:{body:{minHeight:w?j||300:void 0,maxHeight:"70vh",overflowY:"scroll",overflowX:"hidden"}},footer:(e,{OkBtn:t,CancelBtn:r})=>n.jsxs("div",{style:{marginTop:"20px",display:"flex",gap:"8px",justifyContent:"end"},children:[x&&x(S.getFieldsValue()),n.jsx(r,{}),n.jsx(t,{})]}),...y,children:n.jsx(s.Form,{form:S,name:`modal_form_${u}`,layout:"vertical",onValuesChange:(e,t)=>{if(b&&b(e,t),null==N?void 0:N.realtime){const n=Object.keys(e)[0];F(t,n)}},children:n.jsx(se,{})})})}),kc="_container_1814d_1",Sc="_searchForm_1814d_9",Ac="_tableContainer_1814d_15",Cc="_pagination_1814d_72",jc="_selectedRow_1814d_91",_c=r.forwardRef(({searchFormConfig:e,addFormConfig:t,tableColumns:i,URL:o,editText:a,viewText:c,delText:u,CustomOperations:d,classjson:h,postParams:f,proplist:p,topHeight:m,isnopage:g,PropOtherButton:v,CustomModalFooter:b,editdclickback:y,oneditFormChange:x,onSearchFormChange:w,addisdisabled:N={isdisabled:!1,message:""},tableHeight:E=150,limit:k={addLimit:!0,delLimit:!0,editLimit:!0,searchLimit:!0},actionWidth:S,onRowClick:A,onDelete:C,tableId:j,isaddtab:_=!1,validateConfig:T,tableConfig:q,isReset:I=!1,isResetdefault:R=!1,actionDisabled:M,actionToolTips:B,notoken:P=!1,onSearch:F,onReset:U,onView:z,...$},V)=>{r.useImperativeHandle(V,()=>({getList:async()=>ve(),setFieldsValue:e=>{var t;null==(t=ce.current)||t.setFieldsValue(e)},getFieldsValue:()=>{var e;return null==(e=ce.current)?void 0:e.getFieldsValue()},setActiveTab:e=>{var t,n;null==(n=null==(t=ce.current)?void 0:t.setActiveTab)||n.call(t,e)},reload:()=>{ve()},setCurrentRecord:e=>{ne(e)},getSearchFieldsValue:()=>{var e;return null==(e=ge.current)?void 0:e.getFieldsValue()},setSearchFieldsValue:e=>{var t;null==(t=ge.current)||t.setFieldsValue(e)},getDataSource:()=>W,getCurrentRecord:()=>te,openSettingModal:()=>{var e;null==(e=ue.current)||e.openSettingModal()},closeSettingModal:()=>{var e;null==(e=ue.current)||e.closeSettingModal()}}));const[H,K]=r.useState(!1),[W,G]=r.useState([]),[Z,Y]=r.useState({current:1,pageSize:50,total:0,showSizeChanger:!0,showQuickJumper:!0,showTotal:e=>`共 ${e} 条`}),[J,X]=r.useState(!1),[Q,ee]=r.useState("add"),[te,ne]=r.useState(null),[re,se]=r.useState([]),[ie,oe]=r.useState([]),[le,ae]=r.useState([]),ce=r.useRef(null),ue=r.useRef(null),de=r.useRef(f),he=r.useRef(Z),fe=r.useRef(null),[pe,me]=r.useState(0),ge=r.useRef(null);r.useEffect(()=>{de.current=f},[f]),r.useEffect(()=>{he.current=Z},[Z]),r.useEffect(()=>{J||ne(null)},[J]);const ve=l.debounce(async e=>{var t,n;if(!(null==o?void 0:o.search))return;const r=ge.current.getFieldsValue(),s={...null==(t=de.current)?void 0:t.searchParams,...e,pageNum:he.current.current,pageSize:he.current.pageSize,...r};g&&delete s.pageNum,g&&delete s.pageSize,K(!0);try{const e=P?L:O,t=await e(s,o.search);if(200===t.code){const e=(null==(n=null==t?void 0:t.data)?void 0:n.list)||(null==t?void 0:t.data),r=e.map(e=>(e.hasOwnProperty("addCountyCode")&&(e.alladdress={...e}),e)).map(e=>(e.alladdress={...e},e));G(r||[]),Y(e=>{var n,r;return{...e,current:null==(n=null==t?void 0:t.data)?void 0:n.pageNum,total:null==(r=null==t?void 0:t.data)?void 0:r.total}})}else G([]),Y(e=>({...e,total:0,current:1}))}catch(i){G([]),Y(e=>({...e,total:0,current:1}))}finally{K(!1)}},100);r.useEffect(()=>{(null==o?void 0:o.search)&&ve()},[Z.current,Z.pageSize,JSON.stringify(null==f?void 0:f.searchParams)]),r.useEffect(()=>{if(fe.current&&le.length>0){const e=fe.current.offsetHeight;me(e)}},[le]);const be=r.useRef(null);r.useEffect(()=>{const e={title:"操作",key:"action",align:"center",width:S||150,fixed:"right",render:(e,t)=>{const r=M?M(t):{},i=B?B(t):{},l=r.edit||!1,h=r.view||!1,f=r.delete||!1,p=(e,t,r,i,o)=>{const l=e?n.jsx("span",{style:{color:"rgba(0,0,0,0.25)",cursor:"not-allowed",...o},children:r}):n.jsx("a",{onClick:i,style:o,children:r});return t?n.jsx(s.Tooltip,{title:t,children:l}):l};return n.jsx(n.Fragment,{children:n.jsxs(s.Space,{size:"small",ref:be,children:["function"==typeof d?d(t):d,o.edit&&k.editLimit&&p(l,i.editTooltip,a||"编辑",()=>xe(t)),(o.view||o.edit)&&k.addLimit&&p(h,i.viewTooltip,c||"查看",()=>we(t)),o.delete&&k.delLimit&&p(f,i.deleteTooltip,u||"删除",()=>Ne(t),{color:f?"rgba(0,0,0,0.25)":"#f5222d"})]})})}},t=o.edit||o.delete||o.view||d,r=[...i],l=t?[...r,e]:r;oe(l)},[]),r.useEffect(()=>{e&&ae(e)},[e]),r.useEffect(()=>{t&&se(t)},[t]);const ye=()=>{ne(null),ee("add"),X(!0),y&&y()},xe=e=>{ne(e),ee("edit"),X(!0),y&&y(e)},we=e=>{ne(e),ee("view"),X(!0),null==z||z(e)},Ne=async e=>{o.delete&&s.Modal.confirm({title:`确认${u||"删除"}?`,content:`确定要${u||"删除"}这条记录吗?`,okText:"确认",cancelText:"取消",onOk:async()=>{try{K(!0);const t=P?L:O;if(200===(await t({id:e.id,...null==f?void 0:f.delParams},o.delete)).code){C&&C(e),s.message.success(`${u||"删除"}成功`);const t=Z.current,n=Z.pageSize,r=Z.total-1;r>0&&(t-1)*n>=r&&t>1?(Y(e=>({...e,current:e.current-1})),setTimeout(()=>{ve()},0)):ve()}}catch(t){}finally{K(!1)}}})},Ee=window.parent!==window.self,ke={"--table-height":Ee?`calc(100vh - ${pe}px - ${E}px + 39px)`:`calc(100vh - ${pe}px - ${E}px - 16px)`,height:Ee?"calc(100vh)":"calc(100vh - 63px)"};return n.jsxs("div",{className:kc,style:ke,children:[le.length>0||!m?n.jsx("div",{className:Sc,ref:fe,children:n.jsx(D,{config:le,onSearch:()=>{Y(e=>({...e,current:1})),ve(),null==F||F()},onReset:()=>{Y(e=>({...e,current:1})),ve(),null==U||U()},submitButtonText:"查询",resetButtonText:"重置",OtherButton:v||(()=>o.add&&k.addLimit&&n.jsx("div",{style:{marginLeft:"15px"},children:n.jsx(s.Tooltip,{title:N.isdisabled?N.message:"",children:n.jsx(s.Button,{type:"primary",onClick:ye,disabled:N.isdisabled,children:"新建"})})})),ref:ge,onSearchFormChange:(e,t)=>{w&&w(e,t)},isReset:I,isResetdefault:R})}):n.jsx("div",{style:{height:m}}),n.jsxs("div",{className:Ac,style:{height:`calc(100% - ${pe}px-35px)`},children:[n.jsx(Tt,{ref:ue,page:Z,virtual:g,tableId:j,scroll:{x:"1200px",y:"calc(100vh - 500px)"},onRowClick:(e,t)=>((e,t)=>{A&&A(e,t),ne(e)})(e,t),rowClassName:e=>e.id===(null==te?void 0:te.id)?jc:"",columns:ie,dataSource:p||W,loading:H,pagination:!1,onChange:e=>{Y(t=>({...t,current:e.current,pageSize:e.pageSize}))},rowKey:"id",...q,...$}),!g&&n.jsx("div",{className:Cc,children:n.jsx(s.Pagination,{size:"small",onChange:(e,t)=>{Y(n=>({...n,current:e,pageSize:t}))},...Z,showQuickJumper:!1})})]}),n.jsx(Ec,{validateConfig:T,CustomModalFooter:b,ref:ce,oneditFormChange:x,visible:J,mode:Q,config:"view"===Q?re.map(e=>({...e,disabled:!0})):re,initialValues:te,onOk:async e=>{if(e.alladdress&&(e={...e,...e.alladdress}),"view"!==Q){K(!0);try{let t;const n=P?L:O;t="add"==Q?await n({...e,...null==f?void 0:f.addParams},o.add):await n({id:null==te?void 0:te.id,...e,...null==f?void 0:f.editParams},o.edit),200==t.code&&(s.message.success(("add"===Q?"添加":"更新")+"成功"),X(!1),ve())}catch(t){}finally{K(!1)}}else X(!1)},onCancel:()=>X(!1),title:(()=>{switch(Q){case"add":return"新增";case"edit":return"编辑";case"view":return"查看";default:return"信息"}})(),loading:H,tab:_,modalProps:"view"===Q?{footer:[n.jsx(s.Button,{onClick:()=>X(!1),children:"关闭"},"close")],maskClosable:!0}:void 0})]})}),Oc=r.memo(_c),Tc="_table_y36iq_1",{Text:Lc}=s.Typography,qc="_table_y36iq_1",{Text:Ic}=s.Typography;let Rc={port:28081,host:"localhost",timeout:1e4};const Mc=async(e={},t)=>{const n=t?{...Rc,...t}:Rc,{port:r,host:s,timeout:o}=n,l=`http://${s}:${r}`;try{return(await i.post(`${l}/takeShot`,e,{headers:{"Content-Type":"application/json"},timeout:o})).data}catch(a){return{code:-1,msg:a.message||"截图请求失败",data:void 0}}},Bc=e=>{const{hotkeys:t,onTrigger:n,preventDefault:s=!1,stopPropagation:i=!1}=e,o=r.useRef(e);o.current=e;const l=r.useCallback((e,t)=>{const n=e.key.toLowerCase()===t.key.toLowerCase(),r=!!t.ctrl===e.ctrlKey,s=!!t.alt===e.altKey,i=!!t.shift===e.shiftKey,o=!!t.meta===e.metaKey;return n&&r&&s&&i&&o},[]),a=r.useCallback(e=>{const t=o.current;for(const n of t.hotkeys)if(l(e,n)){t.preventDefault&&e.preventDefault(),t.stopPropagation&&e.stopPropagation(),t.onTrigger(n,e);break}},[l]);r.useEffect(()=>{window.addEventListener("keydown",a);t.map(e=>{const t=[];return e.ctrl&&t.push("Ctrl"),e.alt&&t.push("Alt"),e.shift&&t.push("Shift"),e.meta&&t.push("Meta"),t.push(e.key),t.join("+")});return()=>{window.removeEventListener("keydown",a)}},[t,a])},Dc=e=>{const{keys:t,onKeyDown:n,onKeyUp:s,preventDefault:i=!1,stopPropagation:o=!1}=e,l=r.useRef(e);l.current=e;const a=r.useCallback(e=>{var t;const n=e.key,r=l.current;if(r.keys.includes(n)||r.keys.includes(e.code)){r.preventDefault&&e.preventDefault(),r.stopPropagation&&e.stopPropagation();const s=r.keys.includes(n)?n:e.code;null==(t=r.onKeyDown)||t.call(r,s,e)}},[]),c=r.useCallback(e=>{var t;const n=e.key,r=l.current;if(r.keys.includes(n)||r.keys.includes(e.code)){r.preventDefault&&e.preventDefault(),r.stopPropagation&&e.stopPropagation();const s=r.keys.includes(n)?n:e.code;null==(t=r.onKeyUp)||t.call(r,s,e)}},[]);r.useEffect(()=>(window.addEventListener("keydown",a),window.addEventListener("keyup",c),()=>{window.removeEventListener("keydown",a),window.removeEventListener("keyup",c)}),[t.join(","),a,c])};exports.CommonPage=Oc,exports.CustomAdd=Ec,exports.CustomForm=D,exports.CustomTable=Tt,exports.NomalSelect=M,exports.SelectApiTable=({cloumn:e,dropList:t,value:i,onChange:o,placeholder:l="请输入姓名或编号搜索",disabled:a=!1,apiUrl:c,propwidth:u})=>{const[d,h]=r.useState(""),[p,m]=r.useState(!1),[g,v]=r.useState(!1),[b,y]=r.useState(0),[x,w]=r.useState([]),[N,E]=r.useState([]);r.useEffect(()=>{e&&E(e)},[e]),r.useEffect(()=>{t&&w(t||[])},[t]);r.useEffect(()=>{(async()=>{var e,t,n;const r=await O({keyword:d,pageNum:1,pageSize:0,orgId:null==(e=null==f?void 0:f.getOrgInfo())?void 0:e.orgId,loginUserId:null==(t=null==f?void 0:f.getOrgInfo())?void 0:t.orgId},c);200===r.code&&w((null==(n=null==r?void 0:r.data)?void 0:n.list)||(null==r?void 0:r.data)||[])})()},[d]);const k=e=>{a||(null==o||o(e),h(e.name),m(!1))};return n.jsxs(n.Fragment,{children:[n.jsx(s.Input,{placeholder:l,value:d,onChange:e=>h(e.target.value),onKeyDown:e=>{if(!a&&x&&0!==x.length&&p)switch(e.key){case"ArrowDown":e.preventDefault(),y(e=>e<x.length-1?e+1:e);break;case"ArrowUp":e.preventDefault(),y(e=>e>0?e-1:0);break;case"Enter":e.preventDefault(),b>=0&&b<x.length&&k(x[b]);break;case"Escape":e.preventDefault(),m(!1)}},onFocus:()=>m(!0),onClick:()=>m(!0),onBlur:()=>{setTimeout(()=>m(!1),200)},suffix:g?n.jsx(ut,{}):n.jsx(yt,{style:{color:"#999"}}),disabled:a}),p?n.jsx("div",{onMouseDown:e=>e.preventDefault(),style:{backgroundColor:"#fff",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",borderRadius:"4px",width:u||"100%",maxHeight:"300px",position:"absolute",zIndex:1050},children:g?n.jsxs("div",{style:{padding:"16px",textAlign:"center"},children:[n.jsx(s.Spin,{indicator:n.jsx(ut,{}),size:"small"}),n.jsx(Ic,{style:{marginLeft:"8px"},children:"搜索中..."})]}):x&&0!==x.length?n.jsxs("div",{children:[n.jsxs("div",{style:{padding:"8px 12px"},children:[n.jsx(Ic,{strong:!0,children:"搜索结果"}),n.jsxs(Ic,{type:"secondary",style:{float:"right"},children:["共 ",(null==x?void 0:x.length)||0," 条记录"]})]}),n.jsx(s.Divider,{style:{margin:"0"}}),n.jsx(s.Table,{className:qc,columns:N,dataSource:x,rowKey:"id",pagination:!1,size:"small",rowClassName:(e,t)=>t===b?"ant-table-row-selected":"",scroll:{x:200,y:200},bordered:!0,onRow:(e,t)=>({onClick:()=>k(e),onMouseEnter:()=>y(t||0),style:{cursor:a?"not-allowed":"pointer",backgroundColor:t===b?"#e6f7ff":void 0}})})]}):n.jsx(s.Empty,{image:s.Empty.PRESENTED_IMAGE_SIMPLE,description:"无匹配数据",style:{margin:"16px 0"}})}):null]})},exports.SelectTable=({cloumn:e,dropList:t,value:i,onChange:o,placeholder:l="请输入搜索",disabled:a=!1,propwidth:c})=>{const[u,d]=r.useState(""),[h,f]=r.useState(!1),[p,m]=r.useState(!1),[g,v]=r.useState(0),[b,y]=r.useState([]),[x,w]=r.useState([]);r.useEffect(()=>{e&&w(e)},[e]),r.useEffect(()=>{t&&y(t)},[t]),r.useEffect(()=>{if(i&&t&&t.length>0){const e="object"==typeof i?i.id:i,n=t.find(t=>t.id===e);n&&d(n.name||"")}else i||d("")},[i,t]);const N=e=>{a||(null==o||o(e),d(e.name),f(!1))};return n.jsxs(n.Fragment,{children:[n.jsx(s.Input,{placeholder:l,value:u,onChange:e=>(e=>{d(e),m(!0);const n=t.filter(t=>String(t.name).toLowerCase().includes(e.toLowerCase())||String(t.code).toLowerCase().includes(e.toLowerCase())||String(t.pyCode).toLowerCase().includes(e.toLowerCase()));y(n),v(-1),m(!1),f(!0)})(e.target.value),onKeyDown:e=>{if(!a&&0!==b.length&&h)switch(e.key){case"ArrowDown":e.preventDefault(),v(e=>e<b.length-1?e+1:e);break;case"ArrowUp":e.preventDefault(),v(e=>e>0?e-1:0);break;case"Enter":e.preventDefault(),g>=0&&g<b.length&&N(b[g]);break;case"Escape":e.preventDefault(),f(!1)}},onFocus:()=>f(!0),onClick:()=>f(!0),onBlur:()=>{setTimeout(()=>f(!1),200)},suffix:p?n.jsx(ut,{}):n.jsx(yt,{style:{color:"#999"}}),disabled:a}),h?n.jsx("div",{onMouseDown:e=>e.preventDefault(),style:{backgroundColor:"#fff",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",borderRadius:"4px",width:c||"100%",maxHeight:"300px",position:"absolute",zIndex:1050},children:p?n.jsxs("div",{style:{padding:"16px",textAlign:"center"},children:[n.jsx(s.Spin,{indicator:n.jsx(ut,{}),size:"small"}),n.jsx(Lc,{style:{marginLeft:"8px"},children:"搜索中..."})]}):0===b.length?n.jsx(s.Empty,{image:s.Empty.PRESENTED_IMAGE_SIMPLE,description:"无匹配数据",style:{margin:"16px 0"}}):n.jsxs("div",{children:[n.jsxs("div",{style:{padding:"8px 12px"},children:[n.jsx(Lc,{strong:!0,children:"搜索结果"}),n.jsxs(Lc,{type:"secondary",style:{float:"right"},children:["共 ",b.length," 条记录"]})]}),n.jsx(s.Divider,{style:{margin:"0"}}),n.jsx(s.Table,{className:Tc,columns:x,dataSource:b,rowKey:"id",pagination:!1,size:"small",rowClassName:(e,t)=>t===g?"ant-table-row-selected":"",scroll:{x:300,y:200},bordered:!0,onRow:(e,t)=>({onClick:()=>N(e),onMouseEnter:()=>v(t||0),style:{cursor:a?"not-allowed":"pointer",backgroundColor:t===g?"#e6f7ff":void 0}})})]})}):null]})},exports.getTakeShotConfig=()=>({...Rc}),exports.setTakeShotConfig=e=>{Rc={...Rc,...e}},exports.takeShot=Mc,exports.takeShotWithRetry=async(e={},t=3,n=1e3,r)=>{let s;for(let o=0;o<t;o++){try{const t=await Mc(e,r);if(200===t.code)return t;if(-1!==t.code)return t}catch(i){s=i}o<t-1&&await new Promise(e=>setTimeout(e,n))}return{code:-1,msg:(null==s?void 0:s.message)||`截图失败,已重试 ${t} 次`,data:void 0}},exports.useFootPedalListener=e=>{const{leftKey:t="F1",rightKey:n="F2",middleKey:s,onLeftPedal:i,onRightPedal:o,onMiddlePedal:l,onKeyDown:a,onKeyUp:c}=e,u=r.useCallback((e,r)=>{null==a||a(e),e===t?null==i||i():e===n?null==o||o():e===s&&(null==l||l())},[t,n,s,i,o,l,a]),d=r.useCallback((e,t)=>{null==c||c(e)},[c]),h=[t,n];s&&h.push(s),Dc({keys:h,onKeyDown:u,onKeyUp:d})},exports.useHotkeyListener=Bc,exports.useKeyboardListener=Dc,exports.useTakeShotHotkey=(e,t=[{key:"F2"}])=>{Bc({hotkeys:t,onTrigger:(t,n)=>{e()},preventDefault:!0})};
7
7
  //# sourceMappingURL=index.cjs.map